Skip to content

Commit

Permalink
Merge pull request #374 from thetisproject/fix-nonhydrostatic-adaptivity
Browse files Browse the repository at this point in the history
Fix NonHydrostaticTimeIntegrator2D for projection of solutions with adaptivity
  • Loading branch information
stephankramer authored Jan 14, 2025
2 parents 3515ec4 + 043b50a commit d2ae4fe
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions thetis/coupled_timeintegrator_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,12 @@ def initialize(self, solution2d):
self.timesteppers.swe2d.initialize(self.fields.solution_2d)
if self.nh_options.update_free_surface:
self.timesteppers.fs2d.initialize(self.fields.elev_2d)
self.elev_old.assign(self.fields.elev_2d)

@PETSc.Log.EventDecorator("thetis.NonHydrostaticTimeIntegrator2D.advance")
def advance(self, t, update_forcings=None):
"""Advances equations for one time step."""
if self.nh_options.update_free_surface:
self.elev_old.assign(self.fields.elev_2d)
if self.serial_advancing:
# --- advance in serial ---
self.timesteppers.swe2d.advance(t, update_forcings=update_forcings)
Expand All @@ -213,7 +214,6 @@ def advance(self, t, update_forcings=None):
if self.nh_options.update_free_surface:
self.fields.elev_2d.assign(self.elev_old)
self.timesteppers.fs2d.advance(t, update_forcings=update_forcings)
self.elev_old.assign(self.fields.elev_2d)
# update old solution
if self.options.swe_timestepper_type == 'SSPIMEX':
self.timesteppers.swe2d.erk.solution_old.assign(self.fields.solution_2d)
Expand All @@ -234,4 +234,3 @@ def advance(self, t, update_forcings=None):
elif last_stage:
self.fields.elev_2d.assign(self.elev_old)
self.timesteppers.fs2d.advance(t, update_forcings=update_forcings)
self.elev_old.assign(self.fields.elev_2d)

0 comments on commit d2ae4fe

Please sign in to comment.