Skip to content

Commit

Permalink
actually make predictor work...
Browse files Browse the repository at this point in the history
  • Loading branch information
tommbendall committed Sep 26, 2024
1 parent ac27179 commit 279ea8b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions gusto/timestepping/semi_implicit_quasi_newton.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,10 @@ def __init__(self, equation_set, io, transport_schemes, spatial_methods,

if self.predictor is not None:
V_DG = equation_set.domain.spaces('DG')
self.predictor_field_in = Function(V_DG)
div_factor = Constant(1.0) - (Constant(1.0) - self.alpha)*self.dt*div(self.x.n('u'))
self.predictor_interpolator = Interpolator(
self.x.star(predictor)*div_factor, V_DG
self.x.star(predictor)*div_factor, self.predictor_field_in
)

def _apply_bcs(self):
Expand Down Expand Up @@ -290,13 +291,12 @@ def transport_field(self, name, scheme, xstar, xp):
if name == self.predictor:
# Pre-multiply this variable by (1 - dt*beta*div(u))
V = xstar(name).function_space()
field_in = Function(V)
field_out = Function(V)
self.predictor_interpolator.interpolate()
scheme.apply(field_out, field_in)
scheme.apply(field_out, self.predictor_field_in)

# xp is xstar plus the increment from the transported predictor
xp(name).assign(xstar(name) + field_out - field_in)
xp(name).assign(xstar(name) + field_out - self.predictor_field_in)
else:
# Standard transport
scheme.apply(xp(name), xstar(name))
Expand Down

0 comments on commit 279ea8b

Please sign in to comment.