Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#736 change T_ref to T_init #737

Merged
merged 3 commits into from
Nov 19, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

## Bug fixes

- Fixed bug with wrong temperature in initial conditions ([#737](https://github.com/pybamm-team/PyBaMM/pull/737))
- Improved flexibility of parameter values so that parameters (such as diffusivity or current) can be set as functions or scalars ([#723](https://github.com/pybamm-team/PyBaMM/pull/723))
- Fixed a bug where boundary conditions were sometimes handled incorrectly in 1+1D models ([#713](https://github.com/pybamm-team/PyBaMM/pull/713))
- Corrected a sign error in Dirichlet boundary conditions in the Finite Element Method ([#706](https://github.com/pybamm-team/PyBaMM/pull/706))
Expand Down
2 changes: 1 addition & 1 deletion examples/scripts/DFN.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# load model
model = pybamm.lithium_ion.DFN()

model.convert_to_format = "python"
# create geometry
geometry = model.default_geometry

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ def set_initial_conditions(self, variables):

self.initial_conditions = {
phi_s_cn: pybamm.Scalar(0),
phi_s_cp: param.U_p(param.c_p_init, param.T_ref)
- param.U_n(param.c_n_init, param.T_ref),
phi_s_cp: param.U_p(param.c_p_init, param.T_init)
- param.U_n(param.c_n_init, param.T_init),
i_boundary_cc: applied_current / cc_area,
}

Expand Down
6 changes: 3 additions & 3 deletions pybamm/models/submodels/electrode/ohm/full_ohm.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ def set_boundary_conditions(self, variables):
def set_initial_conditions(self, variables):

phi_s = variables[self.domain + " electrode potential"]
T_ref = self.param.T_ref
T_init = self.param.T_init

if self.domain == "Negative":
phi_s_init = pybamm.Scalar(0)
elif self.domain == "Positive":
phi_s_init = self.param.U_p(self.param.c_p_init, T_ref) - self.param.U_n(
self.param.c_n_init, T_ref
phi_s_init = self.param.U_p(self.param.c_p_init, T_init) - self.param.U_n(
self.param.c_n_init, T_init
)

self.initial_conditions[phi_s] = phi_s_init
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def _get_standard_flux_variables(self, N_e):
"""

param = self.param
D_e_typ = param.D_e(param.c_e_typ, param.T_ref)
D_e_typ = param.D_e(param.c_e_typ, param.T_init)
flux_scale = D_e_typ * param.c_e_typ / param.L_x

variables = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ def set_algebraic(self, variables):

def set_initial_conditions(self, variables):
phi_e = variables["Electrolyte potential"]
T_ref = self.param.T_ref
self.initial_conditions = {phi_e: -self.param.U_n(self.param.c_n_init, T_ref)}
T_init = self.param.T_init
self.initial_conditions = {phi_e: -self.param.U_n(self.param.c_n_init, T_init)}
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ def set_initial_conditions(self, variables):

delta_phi_e = variables[self.domain + " electrode surface potential difference"]
if self.domain == "Negative":
delta_phi_e_init = self.param.U_n(self.param.c_n_init, self.param.T_ref)
delta_phi_e_init = self.param.U_n(self.param.c_n_init, self.param.T_init)
elif self.domain == "Positive":
delta_phi_e_init = self.param.U_p(self.param.c_p_init, self.param.T_ref)
delta_phi_e_init = self.param.U_p(self.param.c_p_init, self.param.T_init)

self.initial_conditions = {delta_phi_e: delta_phi_e_init}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ def set_initial_conditions(self, variables):
+ " electrode surface potential difference"
]
if self.domain == "Negative":
delta_phi_init = self.param.U_n(self.param.c_n_init, self.param.T_ref)
delta_phi_init = self.param.U_n(self.param.c_n_init, self.param.T_init)
elif self.domain == "Positive":
delta_phi_init = self.param.U_p(self.param.c_p_init, self.param.T_ref)
delta_phi_init = self.param.U_p(self.param.c_p_init, self.param.T_init)

self.initial_conditions = {delta_phi: delta_phi_init}

Expand Down
4 changes: 2 additions & 2 deletions pybamm/models/submodels/interface/lead_acid.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ def _get_open_circuit_potential(self, variables):
c_e = c_e.orphans[0]

if self.domain == "Negative":
ocp = self.param.U_n(c_e, self.param.T_ref)
ocp = self.param.U_n(c_e, self.param.T_init)
elif self.domain == "Positive":
ocp = self.param.U_p(c_e, self.param.T_ref)
ocp = self.param.U_p(c_e, self.param.T_init)

dUdT = pybamm.Scalar(0)

Expand Down
3 changes: 2 additions & 1 deletion pybamm/parameters/standard_parameters_lead_acid.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,8 @@ def U_p_dimensional(c_e, T):
c_n_init = c_e_init
c_p_init = c_e_init

# Thermal effects not implemented for lead-acid, but parameter needed for consistency
# Thermal effects not implemented for lead-acid, but parameters needed for consistency
T_init = pybamm.Scalar(0)
Theta = pybamm.Scalar(0) # ratio of typical temperature change to ambient temperature


Expand Down