Skip to content

Commit

Permalink
added new default solver
Browse files Browse the repository at this point in the history
  • Loading branch information
RemDelaporteMathurin committed Oct 29, 2024
1 parent 77c97b3 commit be1e362
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions festim/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __init__(
subdomains=None,
boundary_conditions=None,
settings=None,
petcs_options=None,
) -> None:
self.mesh = mesh
# for arguments to initialise as empty list
Expand All @@ -42,6 +43,7 @@ def __init__(
self.formulation = None
self.bc_forms = []
self.show_progress_bar = True
self.petcs_options = petcs_options

@property
def volume_subdomains(self):
Expand Down Expand Up @@ -102,6 +104,13 @@ def create_solver(self):
self.solver.rtol = self.settings.rtol
self.solver.max_it = self.settings.max_iterations

if self.petcs_options is None:
ksp = self.solver.krylov_solver
ksp.setType("preonly")
ksp.getPC().setType("lu")
ksp.getPC().setFactorSolverType("mumps")
ksp.setErrorIfNotConverged(True)

def run(self):
"""Runs the model"""

Expand Down

0 comments on commit be1e362

Please sign in to comment.