Skip to content

Commit

Permalink
fixing the jacobian of linear time derivatives for explicit RK break…
Browse files Browse the repository at this point in the history
…s boussinesq test
  • Loading branch information
JHopeCollins committed Nov 6, 2024
1 parent 3df9ca9 commit 6055d24
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions gusto/time_discretisation/time_discretisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,6 @@ def __init__(self, domain, field_name=None, fixed_subcycles=None,
if solver_parameters is None:
self.solver_parameters = {'snes_type': 'ksponly',
'ksp_type': 'cg',
'ksp_rtol': 1e-10,
'pc_type': 'bjacobi',
'sub_pc_type': 'ilu'}
else:
Expand Down Expand Up @@ -385,7 +384,8 @@ def setup(self, equation, apply_bcs=True, *active_labels):
self.x0 = Function(self.fs)
self.x1 = Function(self.fs)

# If the time_derivative term is nonlinear, we must use a nonlinear solver
# If the time_derivative term is nonlinear, we must use a nonlinear solver,
# but if the time_derivative term is linear, we can reuse the factorisations.
if (
len(self.residual.label_map(
lambda t: t.has_label(nonlinear_time_derivative),
Expand All @@ -397,6 +397,9 @@ def setup(self, equation, apply_bcs=True, *active_labels):
+ ' as the time derivative term is nonlinear')
logger.warning(message)
self.solver_parameters['snes_type'] = 'newtonls'
else:
self.solver_parameters.setdefault('snes_lag_jacobian', -2)
self.solver_parameters.setdefault('snes_lag_jacobian_persists', None)

@cached_property
def lhs(self):
Expand Down

0 comments on commit 6055d24

Please sign in to comment.