Skip to content

Commit

Permalink
Add a bunch of debug log messages to SIQN timestepper
Browse files Browse the repository at this point in the history
  • Loading branch information
JDBetteridge committed Aug 29, 2023
1 parent ef8419e commit c051c5b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions gusto/timeloop.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ def run(self, t, tmax, pick_up=False):
self.t.assign(self.t + self.dt)

with timed_stage("Dump output"):
logger.debug('Dumping output to disk')
self.io.dump(self.fields, float(self.t), self.get_initial_timesteps())

if self.io.output.checkpoint and self.io.output.checkpoint_method == 'dumbcheckpoint':
Expand Down Expand Up @@ -549,7 +550,9 @@ def timestep(self):
xrhs = self.xrhs
dy = self.dy

logger.debug("Entering Semi-implicit Quasi-Newton timestep method")
with timed_stage("Apply forcing terms"):
logger.debug("Semi-implicit Quasi-Newton applying initial forcing")
self.forcing.apply(xn, xn, xstar(self.field_name), "explicit")

xp(self.field_name).assign(xstar(self.field_name))
Expand All @@ -561,18 +564,21 @@ def timestep(self):
f'transporting velocity, outer iteration {k}')
for name, scheme in self.active_transport:
# transports a field from xstar and puts result in xp
logger.debug(f"Semi-implicit Quasi-Newton transporting {name}")
scheme.apply(xp(name), xstar(name))

xrhs.assign(0.) # xrhs is the residual which goes in the linear solve

for i in range(self.maxi):

with timed_stage("Apply forcing terms"):
logger.debug(f"Semi-implicit Quasi-Newton applying forcing at stage {k =}, {i =}")
self.forcing.apply(xp, xnp1, xrhs, "implicit")

xrhs -= xnp1(self.field_name)

with timed_stage("Implicit solve"):
logger.debug(f"Semi-implicit Quasi-Newton perform implicit solve at stage {k =}, {i =}")
self.linear_solver.solve(xrhs, dy) # solves linear system and places result in dy

xnp1X = xnp1(self.field_name)
Expand All @@ -585,16 +591,21 @@ def timestep(self):

for name, scheme in self.auxiliary_schemes:
# transports a field from xn and puts result in xnp1
logger.debug(f"Semi-implicit Quasi-Newton auxiliary scheme for {name}")
scheme.apply(xnp1(name), xn(name))

with timed_stage("Diffusion"):
for name, scheme in self.diffusion_schemes:
logger.debug(f"Semi-implicit Quasi-Newton diffusing {name}")
scheme.apply(xnp1(name), xnp1(name))

with timed_stage("Physics"):
for _, scheme in self.physics_schemes:
logger.debug(f"Semi-implicit Quasi-Newton doing physics on {name}")
scheme.apply(xnp1(scheme.field_name), xnp1(scheme.field_name))

logger.debug("Leaving Semi-implicit Quasi-Newton timestep method")

def run(self, t, tmax, pick_up=False):
"""
Runs the model for the specified time, from t to tmax.
Expand Down

0 comments on commit c051c5b

Please sign in to comment.