Skip to content

Commit

Permalink
fixed test + proper integration
Browse files Browse the repository at this point in the history
  • Loading branch information
RemDelaporteMathurin committed Nov 18, 2024
1 parent 6ef6cdc commit 9709503
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
13 changes: 8 additions & 5 deletions src/festim/hydrogen_transport_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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):
Expand Down
6 changes: 3 additions & 3 deletions test/system_tests/test_multi_material.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 9709503

Please sign in to comment.