File monitor.hxx

Functions

bool isMultiple(BoutReal a, BoutReal b)

Return true if either a is a multiple of b or vice-versa

Assumes both arguments are greater than zero

class Monitor
#include <monitor.hxx>

Monitor baseclass for the Solver

Can be called ether with a specified frequency, or with the frequency of the BOUT++ output monitor.

Subclassed by BoutMonitor, PhysicsModel::PhysicsModelMonitor

Public Functions

Monitor(BoutReal timestep_ = -1)

A timestep_ of -1 defaults to the the frequency of the BOUT++ output monitor

virtual ~Monitor()
virtual int call(Solver *solver, BoutReal time, int iter, int nout) = 0

Callback function for the solver, called after timestep_ has passed

Return
non-zero if simulation should be stopped
Parameters
  • solver: The solver calling this monitor
  • time: The current simulation time
  • iter: The current simulation iteration
  • nout: The total number of iterations for this simulation

virtual void cleanup()

Callback function for when a clean shutdown is initiated.

Protected Functions

BoutReal getTimestep() const

Get the currently set timestep for this monitor.

void setTimestep(BoutReal new_timestep)

Set the timestep for this Monitor

Can only be called before the Monitor is added to a Solver

Private Members

bool is_added = {false}

Set to true when Monitor is added to a Solver.

BoutReal timestep = {-1}

The desired physical timestep.

int period = {1}

How often this monitor should be called, in internal Solver steps.

Friends

friend Solver

needs access to timestep and freq

struct RunMetrics

Public Functions

void outputVars(Datafile &file)

Adds variables to the output file, for post-processing

void calculateDerivedMetrics()

Calculates derived metrics

void writeProgress(BoutReal simtime, bool output_split)

Write job progress to screen

Public Members

BoutReal t_elapsed = 0

cumulative wall clock time in seconds

BoutReal wtime = 0

time step’s wall clock time in seconds

int ncalls = 0

number of RHS calls

int ncalls_e = 0

number of RHS calls for fast timescale

int ncalls_i = 0

number of RHS calls for slow timescale

BoutReal wtime_rhs = 0

wall time spent calculating RHS

BoutReal wtime_invert = 0

wall time spent inverting Laplacian

BoutReal wtime_comms = 0

wall time spent communicating (part of RHS)

BoutReal wtime_io = 0

wall time spent on I/O

BoutReal wtime_per_rhs = 0

wall time per RHS evaluation

BoutReal wtime_per_rhs_e = 0

wall time per fast timescale RHS evaluation

BoutReal wtime_per_rhs_i = 0

wall time per slow timescale RHS evaluation