diff --git a/src/festim/hydrogen_transport_problem.py b/src/festim/hydrogen_transport_problem.py index d7e7f9bd6..bc2e44249 100644 --- a/src/festim/hydrogen_transport_problem.py +++ b/src/festim/hydrogen_transport_problem.py @@ -1380,14 +1380,17 @@ def mixed_term(u, v, n): self.J = dolfinx.fem.form(J, entity_maps=entity_maps) def create_solver(self): - self.solver = NewtonSolver( + self.solver = NewNewtonSolver( self.forms, - self.J, [subdomain.u for subdomain in self.volume_subdomains], bcs=self.bc_forms, - max_iterations=self.settings.max_iterations, + J=self.J, + # max_iterations=self.settings.max_iterations, petsc_options=self.petsc_options, ) + self.solver.atol = self.settings.atol + self.solver.rtol = self.settings.rtol + self.solver.max_it = self.settings.max_iterations def create_flux_values_fenics(self): """For each particle flux create the ``value_fenics`` attribute""" @@ -1447,7 +1450,7 @@ def iterate(self): self.update_time_dependent_values() # solve main problem - self.solver.solve(self.settings.atol, self.settings.rtol) + self.solver.solve() # post processing self.post_processing() @@ -1475,7 +1478,7 @@ def run(self): self.progress_bar.refresh() # refresh progress bar to show 100% else: # Solve steady-state - self.solver.solve(self.settings.rtol) + self.solver.solve() self.post_processing() def __del__(self): diff --git a/test/system_tests/test_multi_material.py b/test/system_tests/test_multi_material.py index 7d2720d09..07ac562a8 100644 --- a/test/system_tests/test_multi_material.py +++ b/test/system_tests/test_multi_material.py @@ -142,7 +142,7 @@ def c_exact_bot_np(x): my_model.temperature = 500.0 # lambda x: 300 + 10 * x[1] + 100 * x[0] - my_model.settings = F.Settings(atol=None, rtol=1e-5, transient=False) + my_model.settings = F.Settings(atol=1e-5, rtol=1e-5, transient=False) my_model.exports = [ F.VTXSpeciesExport(f"u_{subdomain.id}.bp", field=H, subdomain=subdomain) for subdomain in my_model.volume_subdomains @@ -216,7 +216,7 @@ def test_1_material_discontinuous_version(): my_model.temperature = lambda x: 300 + 100 * x[0] - my_model.settings = F.Settings(atol=None, rtol=1e-5, transient=False) + my_model.settings = F.Settings(atol=1e-5, rtol=1e-5, transient=False) my_model.exports = [ F.VTXSpeciesExport( @@ -384,7 +384,7 @@ def test_2_mats_particle_flux_bc(): my_model.temperature = lambda x: 300 + 10 * x[1] + 100 * x[0] - my_model.settings = F.Settings(atol=None, rtol=1e-5, transient=False) + my_model.settings = F.Settings(atol=1e-5, rtol=1e-5, transient=False) my_model.exports = [ F.VTXSpeciesExport(f"u_{subdomain.id}.bp", field=H, subdomain=subdomain)