WindVel Observer

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

template<typename Store, typename FunctorFunc>
CollectDataForDataset<Store> auto CollectWindVariable(const Dataset<Store> &dataset, const FunctorFunc ffunc, const std::string_view name, const size_t maxchunk, const size_t ngbxs)

Constructs type sastifying the CollectDataForDataset concept for a given Store (using an instance of the GenericCollectData class) which writes a wind velocity component to an Xarray in a dataset.

Function return type writes a wind velocity component to an Xarray as a 4-byte floating point type with units “m/s” by collecting data according to the given FunctorFunc from within a Kokkos::parallel_for loop over gridboxes with a range policy.

Parameters:
  • dataset – The dataset to write the wind velocity component to.

  • ffunc – The functor function to collect the wind velocity component from within a parallel range policy over gridboxes.

  • maxchunk – The maximum chunk size (number of elements).

  • ngbxs – The number of gridboxes.

Returns:

CollectDataForDataset<Store> An instance satisfying the CollectDataForDataset concept for collecting a wind velocity component from each gridbox.

struct WvelFunc

Functor operator to perform a copy of the wvel at the centre of each gridbox “wvel” to d_data within Kokkos::parallel_for loop over gridboxes with range policy.

Signature of operator such that type can be used by GenericCollectData struct for FunctorFunc.

Note: Conversion of wvel from double (8 bytes) to single precision float (4 bytes).

Param ii:

The index of the gridbox.

Param d_gbxs:

The view of gridboxes on device.

Param totsupers:

The view of superdroplets on device.

Param d_data:

The mirror view buffer for wvel form each gridbox.

Public Functions

inline void operator()(const size_t ii, viewd_constgbx d_gbxs, const viewd_constsupers totsupers, Buffer<float>::mirrorviewd_buffer d_data) const
struct UvelFunc

Functor operator to perform a copy of the uvel at the centre of each gridbox “uvel” to d_data within Kokkos::parallel_for loop over gridboxes with range policy.

Signature of operator such that type can be used by GenericCollectData struct for FunctorFunc.

Note: Conversion of uvel from double (8 bytes) to single precision float (4 bytes).

Param ii:

The index of the gridbox.

Param d_gbxs:

The view of gridboxes on device.

Param totsupers:

The view of superdroplets on device.

Param d_data:

The mirror view buffer for uvel form each gridbox.

Public Functions

inline void operator()(const size_t ii, viewd_constgbx d_gbxs, const viewd_constsupers totsupers, Buffer<float>::mirrorviewd_buffer d_data) const
struct VvelFunc

Functor operator to perform a copy of the vvel at the centre of each gridbox “vvel” to d_data within Kokkos::parallel_for loop over gridboxes with range policy.

Signature of operator such that type can be used by GenericCollectData struct for FunctorFunc.

Note: Conversion of vvel from double (8 bytes) to single precision float (4 bytes).

Param ii:

The index of the gridbox.

Param d_gbxs:

The view of gridboxes on device.

Param totsupers:

The view of superdroplets on device.

Param d_data:

The mirror view buffer for vvel form each gridbox.

Public Functions

inline void operator()(const size_t ii, viewd_constgbx d_gbxs, const viewd_constsupers totsupers, Buffer<float>::mirrorviewd_buffer d_data) const
template<typename Store>
inline CollectDataForDataset<Store> auto CollectWindVel(const Dataset<Store> &dataset, const size_t maxchunk, const size_t ngbxs)

Constructs a type satisyfing the CollectDataForDataset concept for collecting all three wind velocity components in each gridbox and writing them to a dataset.

This function combines CollectDataForDataset types for the three wind velocity components (wvel, vvel and uvel) in each gridbox using instances of the GenericCollectData class.

Template Parameters:

Store – The type of the dataset store.

Parameters:
  • dataset – The dataset to write the wind velocity components to.

  • maxchunk – The maximum chunk size (number of elements).

  • ngbxs – The number of gridboxes.

Returns:

CollectDataForDataset<Store> An instance of CollectDataForDataset for collecting wind velocity data.

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

Constructs an observer which writes the wind velocity components in each gridbox (wvel, vvel and uvel) at start of each observation timestep to a arrays 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).

  • ngbxs – The number of gridboxes.

Returns:

Observer An observer instance for writing the wind velocity components.