Skip to content

Commit

Permalink
#4274 fix issue with latexify
Browse files Browse the repository at this point in the history
  • Loading branch information
brosaplanella committed Aug 25, 2024
1 parent 740a587 commit 455d488
Showing 1 changed file with 6 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,11 @@ class Composite(BaseElectrolyteConductivity):
def __init__(self, param, domain=None, options=None):
super().__init__(param, domain, options=options)

def _higher_order_macinnes_function(self, x):
"Function to differentiate between composite and first-order models"
def _derivative_macinnes_function(self, x):
"Compute the derivative of the MacInnes function."
tol = pybamm.settings.tolerances["macinnes__c_e"]
x = pybamm.maximum(x, tol)
return pybamm.log(x)

def _gradient_macinnes_function(self, x):
"Gradient of the MacInnes function"
# tol = pybamm.settings.tolerances["macinnes__c_e"]
# x_edge = pybamm.FullBroadcastToEdges(
# x,
# broadcast_domains=x.domains,
# )
# return pybamm.grad(x) / pybamm.maximum(x_edge, tol)
return pybamm.grad(self._higher_order_macinnes_function(x))
return 1 / x

def get_coupled_variables(self, variables):
i_boundary_cc = variables["Current collector current density [A.m-2]"]
Expand Down Expand Up @@ -97,7 +87,7 @@ def get_coupled_variables(self, variables):

eta_c_n = -RT_F_av_n * pybamm.IndefiniteIntegral(
param.chi(c_e_n, T_av_n)
* self._higher_order_macinnes_function(c_e_n).diff(c_e_n)
* self._derivative_macinnes_function(c_e_n)
* pybamm.grad(c_e_n),
x_n,
)
Expand All @@ -118,7 +108,7 @@ def get_coupled_variables(self, variables):
i_e_s_edge = pybamm.PrimaryBroadcastToEdges(i_boundary_cc, "separator")
eta_c_s = -RT_F_av_s * pybamm.IndefiniteIntegral(
param.chi(c_e_s, T_av_s)
* self._higher_order_macinnes_function(c_e_s).diff(c_e_s)
* self._derivative_macinnes_function(c_e_s)
* pybamm.grad(c_e_s),
x_s,
)
Expand All @@ -137,7 +127,7 @@ def get_coupled_variables(self, variables):
i_e_p_edge = i_boundary_cc * (L_x - x_p_edge) / L_p
eta_c_p = -RT_F_av_p * pybamm.IndefiniteIntegral(
param.chi(c_e_p, T_av_p)
* self._higher_order_macinnes_function(c_e_p).diff(c_e_p)
* self._derivative_macinnes_function(c_e_p)
* pybamm.grad(c_e_p),
x_p,
)
Expand Down

0 comments on commit 455d488

Please sign in to comment.