Skip to content

Commit 59869d0

Browse files
authored
Fix convergence of Semi-Implicit Quasi-Newton inner loop (#645)
1 parent ba47c9c commit 59869d0

9 files changed

+10
-11
lines changed

gusto/timestepping/semi_implicit_quasi_newton.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def __init__(self, equation_set, io, transport_schemes, spatial_methods,
3838
diffusion_schemes=None, physics_schemes=None,
3939
slow_physics_schemes=None, fast_physics_schemes=None,
4040
alpha=0.5, off_centred_u=False,
41-
num_outer=2, num_inner=2, accelerator=False,
41+
num_outer=2, num_inner=2, accelerator=True,
4242
predictor=None, reference_update_freq=None,
4343
spinup_steps=0):
4444
"""
@@ -89,8 +89,8 @@ def __init__(self, equation_set, io, transport_schemes, spatial_methods,
8989
linear solve. Defaults to 2. Note that default used by the Met
9090
Office's ENDGame and GungHo models is 2.
9191
accelerator (bool, optional): Whether to zero non-wind implicit
92-
forcings for transport terms in order to speed up solver
93-
convergence. Defaults to False.
92+
forcings for prognostic variables in order to speed up solver
93+
convergence. Defaults to True.
9494
predictor (str, optional): a single string corresponding to the name
9595
of a variable to transport using the divergence predictor. This
9696
pre-multiplies that variable by (1 - beta*dt*div(u)) before the
@@ -161,7 +161,6 @@ def __init__(self, equation_set, io, transport_schemes, spatial_methods,
161161
+ f"physics scheme {parametrisation.label.label}")
162162

163163
self.active_transport = []
164-
self.transported_fields = []
165164
for scheme in transport_schemes:
166165
assert scheme.nlevels == 1, "multilevel schemes not supported as part of this timestepping loop"
167166
if isinstance(scheme.field_name, list):
@@ -466,7 +465,7 @@ def timestep(self):
466465
self.forcing.apply(xp, xnp1, xrhs, "implicit")
467466
if (inner > 0 and self.accelerator):
468467
# Zero implicit forcing to accelerate solver convergence
469-
self.forcing.zero_forcing_terms(self.equation, xp, xrhs, self.transported_fields)
468+
self.forcing.zero_forcing_terms(self.equation, xnp1, xrhs, self.equation.field_names)
470469

471470
xrhs -= xnp1(self.field_name)
472471
xrhs += xrhs_phys
@@ -659,23 +658,23 @@ def apply(self, x_in, x_nl, x_out, label):
659658
x_out.assign(x_in(self.field_name))
660659
x_out += self.xF
661660

662-
def zero_forcing_terms(self, equation, x_in, x_out, transported_field_names):
661+
def zero_forcing_terms(self, equation, x_in, x_out, field_names):
663662
"""
664-
Zero forcing term F(x) for non-wind transport.
663+
Zero forcing term F(x) for non-wind prognostics.
665664
666665
This takes x_in and x_out, where \n
667666
x_out = x_in + scale*F(x_nl) \n
668-
for some field x_nl and sets x_out = x_in for all non-wind transport terms
667+
for some field x_nl and sets x_out = x_in for all non-wind prognostics
669668
670669
Args:
671670
equation (:class:`PrognosticEquationSet`): the prognostic
672671
equation set to be solved
673672
x_in (:class:`FieldCreator`): the field to be incremented.
674673
x_out (:class:`FieldCreator`): the output field to be updated.
675-
transported_field_names (str): list of fields names for transported fields
674+
field_names (str): list of fields names for prognostic fields
676675
"""
677-
for field_name in transported_field_names:
676+
for field_name in field_names:
678677
if field_name != 'u':
679-
logger.info(f'Semi-Implicit Quasi Newton: Zeroing implicit forcing for {field_name}')
678+
logger.debug(f'Semi-Implicit Quasi Newton: Zeroing implicit forcing for {field_name}')
680679
field_index = equation.field_names.index(field_name)
681680
x_out.subfunctions[field_index].assign(x_in(field_name))
0 Bytes
Binary file not shown.
-24 Bytes
Binary file not shown.
-24 Bytes
Binary file not shown.
-24 Bytes
Binary file not shown.
-24 Bytes
Binary file not shown.
-24 Bytes
Binary file not shown.
-24 Bytes
Binary file not shown.
-24 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)