Skip to content

Commit

Permalink
Residual weights for other equations. up divergence tolerance
Browse files Browse the repository at this point in the history
  • Loading branch information
tlroy committed May 14, 2024
1 parent a4f264e commit 058c360
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions echemfem/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,11 +448,13 @@ def steady_forms(self, us, v):
v[self.num_mass],
conc_params,
solid=False)
Form += a
bcs += bc
elif self.flow["electroneutrality full"]:
a, bc = self.electroneutrality_form(us, v[self.num_liquid - 1], conc_params)
Form += a
weight = self.physical_params.get("electroneutrality residual weight")
if weight is None:
weight = 1.0
Form += weight * a
bcs += bc
# Poisson equation for the solid potential
if self.flow["porous"] and (
Expand All @@ -461,7 +463,10 @@ def steady_forms(self, us, v):
v[self.num_mass + 1],
conc_params,
solid=True)
Form += a
weight = self.physical_params.get("solid potential residual weight")
if weight is None:
weight = 1.0
Form += weight * a
bcs += bc
# Single phase Darcy
if self.flow["darcy"] and self.flow["advection"]:
Expand Down Expand Up @@ -944,7 +949,7 @@ def init_solver_parameters(
"snes_converged_reason": None,
"snes_rtol": 1e-16,
"snes_atol": 1e-16,
# "snes_divergence_tolerance": -1,
"snes_divergence_tolerance": 1e6,
"snes_max_it": 50,
}

Expand Down

0 comments on commit 058c360

Please sign in to comment.