Diagnostics¶
Diagnostics are separate objects (instances of subclasses of VerosDiagnostic
)
responsible for handling I/O, restart mechanics, and monitoring of the numerical
solution. All available diagnostics are instantiated and added to a dictionary
attribute VerosState.diagnostics
(with a key determined by their name attribute).
Options for diagnostics may be set during the VerosSetup.set_diagnostics()
method:
class MyModelSetup(VerosSetup):
...
def set_diagnostics(self, state):
diagnostics = state.diagnostics
diagnostics['averages'].output_variables = ['psi','u','v']
diagnostics['averages'].sampling_frequency = 3600.
diagnostics['snapshot'].output_variables += ['du']
Base class¶
This class implements some common logic for all diagnostics. This makes it easy to write your own diagnostics: Just derive from this class, and implement the virtual functions.
- class veros.diagnostics.base.VerosDiagnostic(state)[source]¶
Bases:
object
Base class for diagnostics. Provides an interface and wrappers for common I/O.
Any diagnostic needs to implement the 5 interface methods and set some attributes.
- name = None¶
Name that identifies the current diagnostic
Available diagnostics¶
Currently, the following diagnostics are implemented and added to
VerosState.diagnostics
:
Snapshot¶
- class veros.diagnostics.snapshot.Snapshot(state)[source]¶
Bases:
VerosDiagnostic
Writes snapshots of the current solution. Also reads and writes the main restart data required for restarting a Veros simulation.
- output_path = '{identifier}.snapshot.nc'¶
File to write to. May contain format strings that are replaced with Veros attributes.
- name = 'snapshot'¶
- output_frequency = None¶
Frequency (in seconds) in which output is written.
Averages¶
- class veros.diagnostics.averages.Averages(state)[source]¶
Bases:
VerosDiagnostic
Time average output diagnostic.
All registered variables are summed up when
diagnose()
is called, and averaged and output upon callingoutput()
.- name = 'averages'¶
- output_path = '{identifier}.averages.nc'¶
File to write to. May contain format strings that are replaced with Veros attributes.
- output_frequency = None¶
Frequency (in seconds) in which output is written.
- sampling_frequency = None¶
Frequency (in seconds) in which variables are accumulated.
- output_variables = None¶
Iterable containing all variables to be averaged. Changes have no effect after
initialize
has been called.
CFL monitor¶
- class veros.diagnostics.cfl_monitor.CFLMonitor(state)[source]¶
Bases:
VerosDiagnostic
Diagnostic monitoring the maximum CFL number of the solution to detect instabilities.
Writes output to stdout (no binary output).
- name = 'cfl_monitor'¶
- output_frequency = None¶
Frequency (in seconds) in which output is written.
Tracer monitor¶
- class veros.diagnostics.tracer_monitor.TracerMonitor(state)[source]¶
Bases:
VerosDiagnostic
Diagnostic monitoring global tracer contents / fluxes.
Writes output to stdout (no binary output).
- name = 'tracer_monitor'¶
Name that identifies the current diagnostic
- output_frequency = None¶
Energy¶
- class veros.diagnostics.energy.Energy(state)[source]¶
Bases:
VerosDiagnostic
Diagnose globally averaged energy cycle. Also averages energy in time.
- name = 'energy'¶
- output_path = '{identifier}.energy.nc'¶
File to write to. May contain format strings that are replaced with Veros attributes.
- output_frequency = None¶
Frequency (in seconds) in which output is written.
- sampling_frequency = None¶
Frequency (in seconds) in which variables are accumulated.
Overturning¶
- class veros.diagnostics.overturning.Overturning(state)[source]¶
Bases:
VerosDiagnostic
Isopycnal overturning diagnostic. Computes and writes vertical streamfunctions (zonally averaged).
- name = 'overturning'¶
- output_path = '{identifier}.overturning.nc'¶
File to write to. May contain format strings that are replaced with Veros attributes.
- output_frequency = None¶
Frequency (in seconds) in which output is written.
- sampling_frequency = None¶
Frequency (in seconds) in which variables are accumulated.
- p_ref = 2000.0¶
Reference pressure for isopycnals