Skip to content

Commit

Permalink
Merge pull request #483 from firedrakeproject/solver_fix
Browse files Browse the repository at this point in the history
Fix to linearisation of contiunuity split, and solver parameters now passed through for IMEX Multistage
  • Loading branch information
jshipton authored Mar 7, 2024
2 parents d4afd7c + 4fff6e4 commit bf27b9e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions gusto/common_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
geophysical fluid dynamics."""

from firedrake import (dx, dot, grad, div, inner, outer, cross, curl, split,
TestFunction, TestFunctions, TrialFunction)
TestFunction, TestFunctions, TrialFunctions)
from firedrake.fml import subject, drop
from gusto.configuration import TransportEquationType
from gusto.labels import (transport, transporting_velocity, diffusion,
Expand Down Expand Up @@ -245,7 +245,7 @@ def split_continuity_form(equation):

# Add linearisations of new terms if required
if (t.has_label(linearisation)):
u_trial = TrialFunction(W)[u_idx]
u_trial = TrialFunctions(W)[u_idx]
qbar = split(equation.X_ref)[idx]
# Add linearisation to adv_term
linear_adv_term = linear_advection_form(test, qbar, u_trial)
Expand Down
4 changes: 2 additions & 2 deletions gusto/time_discretisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ def solvers(self):
# setup solver using residual defined in derived class
problem = NonlinearVariationalProblem(self.res(stage), self.x_out, bcs=self.bcs)
solver_name = self.field_name+self.__class__.__name__ + "%s" % (stage)
solvers.append(NonlinearVariationalSolver(problem, options_prefix=solver_name))
solvers.append(NonlinearVariationalSolver(problem, solver_parameters=self.solver_parameters, options_prefix=solver_name))
return solvers

@cached_property
Expand All @@ -484,7 +484,7 @@ def final_solver(self):
# setup solver using lhs and rhs defined in derived class
problem = NonlinearVariationalProblem(self.final_res, self.x_out, bcs=self.bcs)
solver_name = self.field_name+self.__class__.__name__
return NonlinearVariationalSolver(problem, options_prefix=solver_name)
return NonlinearVariationalSolver(problem, solver_parameters=self.solver_parameters, options_prefix=solver_name)

def apply(self, x_out, x_in):
self.x1.assign(x_in)
Expand Down

0 comments on commit bf27b9e

Please sign in to comment.