From 058c360ff8d5ef3163b4df04af213358eaaca8da Mon Sep 17 00:00:00 2001 From: Thomas Roy Date: Tue, 14 May 2024 10:04:47 -0700 Subject: [PATCH] Residual weights for other equations. up divergence tolerance --- echemfem/solver.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/echemfem/solver.py b/echemfem/solver.py index 452534b..7488405 100644 --- a/echemfem/solver.py +++ b/echemfem/solver.py @@ -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 ( @@ -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"]: @@ -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, }