TotNsupers Observer

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

template<typename Store>
class DoTotNsupersObs

Template class for functionality to observe the total number of superdroplets at the start of each timestep and write it to a Zarr array in an Xarray dataset.

Template Parameters:

Store – Type of store for dataset.

Public Functions

inline DoTotNsupersObs(Dataset<Store> &dataset, const size_t maxchunk)

Constructor for DoTotNsupersObs.

Parameters:
  • datasetDataset to write totnsupers data to.

  • maxchunk – Maximum number of elements in a chunk (1-D vector size).

inline ~DoTotNsupersObs()

Destructor for DoTotNsupersObs.

inline void before_timestepping(const viewd_constgbx d_gbxs) const

Placeholder for before timestepping functionality and to make class satisfy observer concept.

inline void after_timestepping() const

Placeholder for after timestepping functionality and to make class satisfy observer concept.

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

Adapter to call at start step function which writes the total number of superdroplets in totsupers view to the array in the dataset.

Parameters:
  • t_mdl – Current model timestep.

  • d_gbxs – View of gridboxes on device.

  • totsupers – View of superdrops on device.

inline SDMMonitor auto get_sdmmonitor() const

Get null monitor for SDM processes from observer.

Returns:

monitor ‘mo’ of the observer that does nothing

Private Functions

inline void at_start_step(const viewd_constsupers totsupers) const

Write out the total number of superdroplets in totsupers view at the start of a timestep to an array in the dataset.

Note: conversion of totnsupers from size_t (arch dependent usually 8 bytes) to shorter 4 byte, unsigned int (unit32_t).

Parameters:

totsupers – View of all the superdroplets to count (on device memory but metadata for extent of view is available on host).

Private Members

Dataset<Store> &dataset

dataset to write totnsupers data to

std::shared_ptr<XarrayZarrArray<Store, uint32_t>> xzarr_ptr

pointer to totnsupers array

template<typename Store>
inline Observer auto TotNsupersObserver(const unsigned int interval, Dataset<Store> &dataset, const size_t maxchunk)

Constructs an observer which writes the total number of superdroplets at start of each observation timestep to a 1-D array with a constant observation timestep “interval”.

Template Parameters:

Store – Type of store for dataset.

Parameters:
  • interval – Observation timestep.

  • datasetDataset to write time data to.

  • maxchunk – Maximum number of elements in a chunk (1-D vector size).

Returns:

Constructed type satisfying observer concept.