StreamOut Observer

Header file: <libs/observers/streamout_observer.hpp> [source]

struct StreamOutObserver

Struct that satisfies the observer concept and streams out live data to an output device (e.g. computer screen) about gridboxes during every observation at fixed ‘interval’ timesteps.

Public Functions

inline StreamOutObserver(const unsigned int obsstep, const std::function<double(unsigned int)> step2realtime)

Constructor for StreamOutObserver.

Parameters:
  • obsstep – Interval in model timesteps between observation events.

  • step2realtime – Function to convert model timesteps to real time.

inline void before_timestepping(const viewd_constgbx d_gbxs) const

Function called before timestepping.

Parameters:

d_gbxs – View of grid boxes.

inline void after_timestepping() const

Function called after timestepping.

inline unsigned int next_obs(const unsigned int t_mdl) const

Determine the next observation time.

Calculates the next observation time based on the current model time and this observer’s constant timestep between observations, ‘interval’.

Parameters:

t_mdl – The unsigned int parameter representing the current model timestep.

Returns:

Unsigned int for the next observation timestep.

inline bool on_step(const unsigned int t_mdl) const

Check if observer is “on step”.

Checks if the current model time is on an observation timestep.

Parameters:

t_mdl – The unsigned int parameter representing the current model timestep.

Returns:

True if the current timestep is an observation timestep, false otherwise.

inline void at_start_step(const unsigned int t_mdl, const viewd_constgbx d_gbxs, const viewd_constsupers totsupers) const

Observe gridboxes at the start of each timestep.

If timestep is on observation step, stream out statement about gridboxes to output device e.g. a computer terminal.

Parameters:
  • t_mdl – Current model time.

  • d_gbxs – View of grid boxes.

  • totsupers – View of super grids.

Private Functions

void streamout_statement(const unsigned int t_mdl, const viewd_constgbx d_gbxs) const

Prints a statement about the state of grid boxes.

This function prints out information about the state of gridboxes. It extracts information from the 0th gridbox in the gridboxes’ view and prints some information e.g. temperature, pressure, specific humidity, and specific cloud water content. Additionally, it prints the total number of superdroplets in the domain and the total number of gridboxes.

Parameters:
  • t_mdl – Current model time.

  • d_gbxs – View of the gridboxes on the device.

Private Members

unsigned int interval

Timestep between output events.

std::function<double(unsigned int)> step2realtime

Function to convert model timesteps to real time.