Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 18 additions & 14 deletions gusto/timestepping/timestepper.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ def __init__(self, equation, io):
Args:
equation (:class:`PrognosticEquation`): the prognostic equation.
io (:class:`IO`): the model's object for controlling input/output.
init_io (:bool): whether or not to set up the IO
"""

self.equation = equation
self.io = io
self.init_io = True # flag so that IO is only set up once
self.dt = self.equation.domain.dt
self.t = self.equation.domain.t
self.reference_profiles_initialised = False
Expand Down Expand Up @@ -189,16 +191,23 @@ def run(self, t, tmax, pick_up=False):
tmax (float): the end time of the run
pick_up: (bool): specify whether to pick_up from a previous run
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing from the docstring

"""
if self.init_io:
# Set up diagnostics, which may set up some fields necessary to pick up
self.io.setup_diagnostics(self.fields)
self.io.setup_log_courant(self.fields)
if self.equation.domain.mesh.extruded:
self.io.setup_log_courant(self.fields, component='horizontal')
self.io.setup_log_courant(self.fields, component='vertical')
if self.transporting_velocity != "prognostic":
self.io.setup_log_courant(self.fields, name='transporting_velocity',
expression=self.transporting_velocity)

# Set up dump, which may also include an initial dump
with timed_stage("Dump output"):
logger.debug('Dumping output to disk')
self.io.setup_dump(self.fields, t, pick_up)

# Set up diagnostics, which may set up some fields necessary to pick up
self.io.setup_diagnostics(self.fields)
self.io.setup_log_courant(self.fields)
if self.equation.domain.mesh.extruded:
self.io.setup_log_courant(self.fields, component='horizontal')
self.io.setup_log_courant(self.fields, component='vertical')
if self.transporting_velocity != "prognostic":
self.io.setup_log_courant(self.fields, name='transporting_velocity',
expression=self.transporting_velocity)
self.init_io = False

if pick_up:
# Pick up fields, and return other info to be picked up
Expand All @@ -213,11 +222,6 @@ def run(self, t, tmax, pick_up=False):
else:
self.step = 1

# Set up dump, which may also include an initial dump
with timed_stage("Dump output"):
logger.debug('Dumping output to disk')
self.io.setup_dump(self.fields, t, pick_up)

self.log_field_stats()

self.t.assign(t)
Expand Down
Loading