Skip to content

Commit

Permalink
Merge pull request #899 from festim-dev/change_default_solver
Browse files Browse the repository at this point in the history
New default PETSC parameters
  • Loading branch information
RemDelaporteMathurin authored Oct 29, 2024
2 parents 77c97b3 + e6e8a2c commit 9eb3527
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Create Conda environment
shell: bash -l {0}
run: |
conda install -c conda-forge fenics-dolfinx=0.8.0
conda install -c conda-forge fenics-dolfinx=0.9.0
- name: Install local package and dependencies
shell: bash -l {0}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
container_version: [v0.8.0, nightly]
container_version: [v0.9.0, nightly]
container: dolfinx/dolfinx:${{ matrix.container_version }}
steps:
- name: Checkout code
Expand Down
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 9eb3527

Please sign in to comment.