File monitor.hxx#

Functions

inline 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, LaplaceHypre3d::Hypre3dMonitor, PhysicsModel::PhysicsModelMonitor

Public Functions

inline Monitor(BoutReal timestep_ = -1)#

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

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

Callback function for the solver, called after timestep_ has passed

Parameters:
  • solver[in] The solver calling this monitor

  • time[in] The current simulation time

  • iter[in] The current simulation iteration

  • nout[in] The total number of iterations for this simulation

Returns:

non-zero if simulation should be stopped

inline virtual void cleanup()#

Callback function for when a clean shutdown is initiated.

inline virtual void outputVars(MAYBE_UNUSED(Options &options), MAYBE_UNUSED(const std::string &time_dimension))#

Protected Functions

inline BoutReal getTimestep() const#

Get the currently set timestep for this monitor.

inline 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 class Solver
struct RunMetrics#

Public Functions

void outputVars(Options &output_options) const#

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