From 1705a6eca5133b4c9f046417140d68397e8ea54d Mon Sep 17 00:00:00 2001 From: Clara Levante Date: Tue, 9 Apr 2024 09:17:42 +0200 Subject: [PATCH 01/35] zarr and observers folders renamed --- .../cxx/{observers2 => observers}/observers.rst | 16 ++++++++-------- .../{observers2 => observers}/observers2mod.rst | 0 docs/source/cxx/{zarr2 => zarr}/buffer.rst | 6 +++--- docs/source/cxx/{zarr2 => zarr}/chunks.rst | 10 +++++----- docs/source/cxx/{zarr2 => zarr}/dataset.rst | 6 +++--- docs/source/cxx/{zarr2 => zarr}/fsstore.rst | 6 +++--- .../cxx/{zarr2 => zarr}/store_accessor.rst | 6 +++--- .../cxx/{zarr2 => zarr}/xarray_zarr_array.rst | 14 +++++++------- docs/source/cxx/{zarr2 => zarr}/zarr2mod.rst | 0 docs/source/cxx/{zarr2 => zarr}/zarr_array.rst | 14 +++++++------- docs/source/cxx/{zarr2 => zarr}/zarr_group.rst | 6 +++--- libs/{observers2 => observers}/CMakeLists.txt | 4 ++-- .../collect_data_for_dataset.hpp | 14 +++++++------- .../gbxindex_observer.hpp | 16 ++++++++-------- .../generic_collect_data.hpp | 16 ++++++++-------- .../massmoments_observer.cpp | 4 ++-- .../massmoments_observer.hpp | 12 ++++++------ .../nsupers_observer.hpp | 12 ++++++------ libs/{observers2 => observers}/observers.hpp | 10 +++++----- .../parallel_write_data.hpp | 12 ++++++------ .../runstats_observer.cpp | 6 +++--- .../runstats_observer.hpp | 10 +++++----- .../{observers2 => observers}/state_observer.hpp | 12 ++++++------ .../streamout_observer.cpp | 6 +++--- .../streamout_observer.hpp | 10 +++++----- .../superdrops_observer.hpp | 12 ++++++------ .../thermo_observer.hpp | 12 ++++++------ libs/{observers2 => observers}/time_observer.hpp | 14 +++++++------- .../totnsupers_observer.hpp | 16 ++++++++-------- .../windvel_observer.hpp | 12 ++++++------ .../write_to_dataset_observer.hpp | 12 ++++++------ libs/{zarr2 => zarr}/CMakeLists.txt | 2 +- libs/{zarr2 => zarr}/buffer.hpp | 10 +++++----- libs/{zarr2 => zarr}/chunks.hpp | 10 +++++----- libs/{zarr2 => zarr}/dataset.hpp | 8 ++++---- libs/{zarr2 => zarr}/fsstore.cpp | 4 ++-- libs/{zarr2 => zarr}/fsstore.hpp | 10 +++++----- libs/{zarr2 => zarr}/store_accessor.hpp | 10 +++++----- libs/{zarr2 => zarr}/xarray_zarr_array.hpp | 10 +++++----- libs/{zarr2 => zarr}/zarr_array.hpp | 10 +++++----- libs/{zarr2 => zarr}/zarr_group.hpp | 10 +++++----- 41 files changed, 195 insertions(+), 195 deletions(-) rename docs/source/cxx/{observers2 => observers}/observers.rst (71%) rename docs/source/cxx/{observers2 => observers}/observers2mod.rst (100%) rename docs/source/cxx/{zarr2 => zarr}/buffer.rst (69%) rename docs/source/cxx/{zarr2 => zarr}/chunks.rst (73%) rename docs/source/cxx/{zarr2 => zarr}/dataset.rst (68%) rename docs/source/cxx/{zarr2 => zarr}/fsstore.rst (68%) rename docs/source/cxx/{zarr2 => zarr}/store_accessor.rst (67%) rename docs/source/cxx/{zarr2 => zarr}/xarray_zarr_array.rst (68%) rename docs/source/cxx/{zarr2 => zarr}/zarr2mod.rst (100%) rename docs/source/cxx/{zarr2 => zarr}/zarr_array.rst (67%) rename docs/source/cxx/{zarr2 => zarr}/zarr_group.rst (68%) rename libs/{observers2 => observers}/CMakeLists.txt (95%) rename libs/{observers2 => observers}/collect_data_for_dataset.hpp (95%) rename libs/{observers2 => observers}/gbxindex_observer.hpp (91%) rename libs/{observers2 => observers}/generic_collect_data.hpp (93%) rename libs/{observers2 => observers}/massmoments_observer.cpp (98%) rename libs/{observers2 => observers}/massmoments_observer.hpp (98%) rename libs/{observers2 => observers}/nsupers_observer.hpp (91%) rename libs/{observers2 => observers}/observers.hpp (97%) rename libs/{observers2 => observers}/parallel_write_data.hpp (96%) rename libs/{observers2 => observers}/runstats_observer.cpp (93%) rename libs/{observers2 => observers}/runstats_observer.hpp (92%) rename libs/{observers2 => observers}/state_observer.hpp (87%) rename libs/{observers2 => observers}/streamout_observer.cpp (93%) rename libs/{observers2 => observers}/streamout_observer.hpp (90%) rename libs/{observers2 => observers}/superdrops_observer.hpp (97%) rename libs/{observers2 => observers}/thermo_observer.hpp (96%) rename libs/{observers2 => observers}/time_observer.hpp (92%) rename libs/{observers2 => observers}/totnsupers_observer.hpp (89%) rename libs/{observers2 => observers}/windvel_observer.hpp (95%) rename libs/{observers2 => observers}/write_to_dataset_observer.hpp (93%) rename libs/{zarr2 => zarr}/CMakeLists.txt (98%) rename libs/{zarr2 => zarr}/buffer.hpp (97%) rename libs/{zarr2 => zarr}/chunks.hpp (98%) rename libs/{zarr2 => zarr}/dataset.hpp (99%) rename libs/{zarr2 => zarr}/fsstore.cpp (96%) rename libs/{zarr2 => zarr}/fsstore.hpp (93%) rename libs/{zarr2 => zarr}/store_accessor.hpp (95%) rename libs/{zarr2 => zarr}/xarray_zarr_array.hpp (98%) rename libs/{zarr2 => zarr}/zarr_array.hpp (99%) rename libs/{zarr2 => zarr}/zarr_group.hpp (91%) diff --git a/docs/source/cxx/observers2/observers.rst b/docs/source/cxx/observers/observers.rst similarity index 71% rename from docs/source/cxx/observers2/observers.rst rename to docs/source/cxx/observers/observers.rst index b424eaae5..285682e78 100644 --- a/docs/source/cxx/observers2/observers.rst +++ b/docs/source/cxx/observers/observers.rst @@ -1,34 +1,34 @@ Observers ========= -Header file: ```` -`[source] `_ +Header file: ```` +`[source] `_ .. doxygenconcept:: Observer - :project: observers2 + :project: observers .. doxygenstruct:: CombinedObserver - :project: observers2 + :project: observers :private-members: :protected-members: :members: :undoc-members: .. doxygenfunction:: operator>>(const Observer auto obs1, const Observer auto obs2) - :project: observers2 + :project: observers .. doxygenstruct:: NullObserver - :project: observers2 + :project: observers :private-members: :protected-members: :members: :undoc-members: .. doxygenconcept:: ObsFuncs - :project: observers2 + :project: observers .. doxygenstruct:: ConstTstepObserver - :project: observers2 + :project: observers :private-members: :protected-members: :members: diff --git a/docs/source/cxx/observers2/observers2mod.rst b/docs/source/cxx/observers/observers2mod.rst similarity index 100% rename from docs/source/cxx/observers2/observers2mod.rst rename to docs/source/cxx/observers/observers2mod.rst diff --git a/docs/source/cxx/zarr2/buffer.rst b/docs/source/cxx/zarr/buffer.rst similarity index 69% rename from docs/source/cxx/zarr2/buffer.rst rename to docs/source/cxx/zarr/buffer.rst index 2ae78039f..d47bd41cf 100644 --- a/docs/source/cxx/zarr2/buffer.rst +++ b/docs/source/cxx/zarr/buffer.rst @@ -1,11 +1,11 @@ Buffer ====== -Header file: ```` -`[source] `_ +Header file: ```` +`[source] `_ .. doxygenstruct:: Buffer - :project: zarr2 + :project: zarr :private-members: :protected-members: :members: diff --git a/docs/source/cxx/zarr2/chunks.rst b/docs/source/cxx/zarr/chunks.rst similarity index 73% rename from docs/source/cxx/zarr2/chunks.rst rename to docs/source/cxx/zarr/chunks.rst index 6afa76939..43fcda12e 100644 --- a/docs/source/cxx/zarr2/chunks.rst +++ b/docs/source/cxx/zarr/chunks.rst @@ -1,17 +1,17 @@ Chunks ====== -Header file: ```` -`[source] `_ +Header file: ```` +`[source] `_ .. doxygenfunction:: vec_product(const std::vector& vec) - :project: zarr2 + :project: zarr .. doxygenfunction:: vec_product(const std::vector& vec, const size_t aa) - :project: zarr2 + :project: zarr .. doxygenclass:: Chunks - :project: zarr2 + :project: zarr :private-members: :protected-members: :members: diff --git a/docs/source/cxx/zarr2/dataset.rst b/docs/source/cxx/zarr/dataset.rst similarity index 68% rename from docs/source/cxx/zarr2/dataset.rst rename to docs/source/cxx/zarr/dataset.rst index 7423658a1..99ad5c22a 100644 --- a/docs/source/cxx/zarr2/dataset.rst +++ b/docs/source/cxx/zarr/dataset.rst @@ -1,11 +1,11 @@ Dataset ======= -Header file: ```` -`[source] `_ +Header file: ```` +`[source] `_ .. doxygenclass:: Dataset - :project: zarr2 + :project: zarr :private-members: :protected-members: :members: diff --git a/docs/source/cxx/zarr2/fsstore.rst b/docs/source/cxx/zarr/fsstore.rst similarity index 68% rename from docs/source/cxx/zarr2/fsstore.rst rename to docs/source/cxx/zarr/fsstore.rst index 32efc83a9..caf1eca7a 100644 --- a/docs/source/cxx/zarr2/fsstore.rst +++ b/docs/source/cxx/zarr/fsstore.rst @@ -1,11 +1,11 @@ FSStore ======= -Header file: ```` -`[source] `_ +Header file: ```` +`[source] `_ .. doxygenclass:: FSStore - :project: zarr2 + :project: zarr :private-members: :protected-members: :members: diff --git a/docs/source/cxx/zarr2/store_accessor.rst b/docs/source/cxx/zarr/store_accessor.rst similarity index 67% rename from docs/source/cxx/zarr2/store_accessor.rst rename to docs/source/cxx/zarr/store_accessor.rst index 67d42db7c..2f2e7170a 100644 --- a/docs/source/cxx/zarr2/store_accessor.rst +++ b/docs/source/cxx/zarr/store_accessor.rst @@ -1,11 +1,11 @@ StoreAccessor ============= -Header file: ```` -`[source] `_ +Header file: ```` +`[source] `_ .. doxygenstruct:: StoreAccessor - :project: zarr2 + :project: zarr :private-members: :protected-members: :members: diff --git a/docs/source/cxx/zarr2/xarray_zarr_array.rst b/docs/source/cxx/zarr/xarray_zarr_array.rst similarity index 68% rename from docs/source/cxx/zarr2/xarray_zarr_array.rst rename to docs/source/cxx/zarr/xarray_zarr_array.rst index 58ab35e91..5d3137b20 100644 --- a/docs/source/cxx/zarr2/xarray_zarr_array.rst +++ b/docs/source/cxx/zarr/xarray_zarr_array.rst @@ -1,23 +1,23 @@ XarrayZarrArray =============== -Header file: ```` -`[source] `_ +Header file: ```` +`[source] `_ .. doxygenfunction:: write_zattrs_json - :project: zarr2 + :project: zarr .. doxygenfunction:: reduced_arrayshape_from_dims - :project: zarr2 + :project: zarr .. doxygenfunction:: vecstr_to_string - :project: zarr2 + :project: zarr .. doxygenfunction:: make_xarray_metadata - :project: zarr2 + :project: zarr .. doxygenclass:: XarrayZarrArray - :project: zarr2 + :project: zarr :private-members: :protected-members: :members: diff --git a/docs/source/cxx/zarr2/zarr2mod.rst b/docs/source/cxx/zarr/zarr2mod.rst similarity index 100% rename from docs/source/cxx/zarr2/zarr2mod.rst rename to docs/source/cxx/zarr/zarr2mod.rst diff --git a/docs/source/cxx/zarr2/zarr_array.rst b/docs/source/cxx/zarr/zarr_array.rst similarity index 67% rename from docs/source/cxx/zarr2/zarr_array.rst rename to docs/source/cxx/zarr/zarr_array.rst index b865112b2..e569f8eae 100644 --- a/docs/source/cxx/zarr2/zarr_array.rst +++ b/docs/source/cxx/zarr/zarr_array.rst @@ -1,23 +1,23 @@ ZarrArray ========= -Header file: ```` -`[source] `_ +Header file: ```` +`[source] `_ .. doxygenfunction:: good2Dchunkshape - :project: zarr2 + :project: zarr .. doxygenfunction:: write_zarray_json - :project: zarr2 + :project: zarr .. doxygenfunction:: vec_to_string - :project: zarr2 + :project: zarr .. doxygenfunction:: make_part_zarrmetadata - :project: zarr2 + :project: zarr .. doxygenclass:: ZarrArray - :project: zarr2 + :project: zarr :private-members: :protected-members: :members: diff --git a/docs/source/cxx/zarr2/zarr_group.rst b/docs/source/cxx/zarr/zarr_group.rst similarity index 68% rename from docs/source/cxx/zarr2/zarr_group.rst rename to docs/source/cxx/zarr/zarr_group.rst index e9b77f8b1..219f18c67 100644 --- a/docs/source/cxx/zarr2/zarr_group.rst +++ b/docs/source/cxx/zarr/zarr_group.rst @@ -1,11 +1,11 @@ ZarrGroup ========= -Header file: ```` -`[source] `_ +Header file: ```` +`[source] `_ .. doxygenstruct:: ZarrGroup - :project: zarr2 + :project: zarr :private-members: :protected-members: :members: diff --git a/libs/observers2/CMakeLists.txt b/libs/observers/CMakeLists.txt similarity index 95% rename from libs/observers2/CMakeLists.txt rename to libs/observers/CMakeLists.txt index d4f940a40..6fe0294e8 100644 --- a/libs/observers2/CMakeLists.txt +++ b/libs/observers/CMakeLists.txt @@ -4,7 +4,7 @@ if(NOT DEFINED CMAKE_MINIMUM_REQUIRED_VERSION) endif() # set library name and print directory of this CMakeLists.txt (source directory of library) -set(LIBNAME "observers2") +set(LIBNAME "observers") message("${LIBNAME} LIBRARY_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}") # explicitly set library executables path to /lib in top level of build tree @@ -24,7 +24,7 @@ target_include_directories(${LIBNAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") target_include_directories(${LIBNAME} PRIVATE "${CMAKE_SOURCE_DIR}/libs") # CLEO libs directory # Link libraries to target library -set(LINKLIBS gridboxes superdrops zarr2) +set(LINKLIBS gridboxes superdrops zarr) target_link_libraries(${LIBNAME} PUBLIC "${LINKLIBS}") target_link_libraries(${LIBNAME} PUBLIC Kokkos::kokkos) diff --git a/libs/observers2/collect_data_for_dataset.hpp b/libs/observers/collect_data_for_dataset.hpp similarity index 95% rename from libs/observers2/collect_data_for_dataset.hpp rename to libs/observers/collect_data_for_dataset.hpp index 3ce77a9b6..f6286a7dc 100644 --- a/libs/observers2/collect_data_for_dataset.hpp +++ b/libs/observers/collect_data_for_dataset.hpp @@ -4,7 +4,7 @@ * * ----- CLEO ----- * File: collect_data_for_dataset.hpp - * Project: observers2 + * Project: observers * Created Date: Wednesday 24th January 2024 * Author: Clara Bayley (CB) * Additional Contributors: @@ -20,17 +20,17 @@ * structs to collect data within parallel loops and write it to arrays in a dataset */ -// TODO(CB) document observers2 +// TODO(CB) document observers -#ifndef LIBS_OBSERVERS2_COLLECT_DATA_FOR_DATASET_HPP_ -#define LIBS_OBSERVERS2_COLLECT_DATA_FOR_DATASET_HPP_ +#ifndef LIBS_OBSERVERS_COLLECT_DATA_FOR_DATASET_HPP_ +#define LIBS_OBSERVERS_COLLECT_DATA_FOR_DATASET_HPP_ #include #include #include "../kokkosaliases.hpp" -#include "zarr2/dataset.hpp" -#include "zarr2/fsstore.hpp" +#include "zarr/dataset.hpp" +#include "zarr/fsstore.hpp" /** * @brief Concept for CollectDataForDataset is all types that have functions for creating a functor @@ -169,4 +169,4 @@ struct NullCollectDataForDataset { void reallocate_views(const size_t sz) const {} }; -#endif // LIBS_OBSERVERS2_COLLECT_DATA_FOR_DATASET_HPP_ +#endif // LIBS_OBSERVERS_COLLECT_DATA_FOR_DATASET_HPP_ diff --git a/libs/observers2/gbxindex_observer.hpp b/libs/observers/gbxindex_observer.hpp similarity index 91% rename from libs/observers2/gbxindex_observer.hpp rename to libs/observers/gbxindex_observer.hpp index 2f0bc0930..c3fc03854 100644 --- a/libs/observers2/gbxindex_observer.hpp +++ b/libs/observers/gbxindex_observer.hpp @@ -4,12 +4,12 @@ * * ----- CLEO ----- * File: gbxindex_observer.hpp - * Project: observers2 + * Project: observers * Created Date: Wednesday 24th January 2024 * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Wednesday 3rd April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -19,8 +19,8 @@ * Observer to output gridbox indexes at the start of each simulation to an array in a dataset */ -#ifndef LIBS_OBSERVERS2_GBXINDEX_OBSERVER_HPP_ -#define LIBS_OBSERVERS2_GBXINDEX_OBSERVER_HPP_ +#ifndef LIBS_OBSERVERS_GBXINDEX_OBSERVER_HPP_ +#define LIBS_OBSERVERS_GBXINDEX_OBSERVER_HPP_ #include #include @@ -30,9 +30,9 @@ #include "../kokkosaliases.hpp" #include "./observers.hpp" #include "gridboxes/gridbox.hpp" -#include "zarr2/buffer.hpp" -#include "zarr2/dataset.hpp" -#include "zarr2/xarray_zarr_array.hpp" +#include "zarr/buffer.hpp" +#include "zarr/dataset.hpp" +#include "zarr/xarray_zarr_array.hpp" struct GbxIndexFunctor { viewd_constgbx d_gbxs; // view of gridboxes @@ -95,4 +95,4 @@ class GbxindexObserver { bool on_step(const unsigned int t_mdl) const { return false; } }; -#endif // LIBS_OBSERVERS2_GBXINDEX_OBSERVER_HPP_ +#endif // LIBS_OBSERVERS_GBXINDEX_OBSERVER_HPP_ diff --git a/libs/observers2/generic_collect_data.hpp b/libs/observers/generic_collect_data.hpp similarity index 93% rename from libs/observers2/generic_collect_data.hpp rename to libs/observers/generic_collect_data.hpp index 9e8b6858e..75ac92a8e 100644 --- a/libs/observers2/generic_collect_data.hpp +++ b/libs/observers/generic_collect_data.hpp @@ -4,12 +4,12 @@ * * ----- CLEO ----- * File: generic_collect_data.hpp - * Project: observers2 + * Project: observers * Created Date: Thursday 4th April 2024 * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Friday 5th April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -20,16 +20,16 @@ * variable(s) and write it to xarray(s) in a datatset. */ -#ifndef LIBS_OBSERVERS2_GENERIC_COLLECT_DATA_HPP_ -#define LIBS_OBSERVERS2_GENERIC_COLLECT_DATA_HPP_ +#ifndef LIBS_OBSERVERS_GENERIC_COLLECT_DATA_HPP_ +#define LIBS_OBSERVERS_GENERIC_COLLECT_DATA_HPP_ #include #include #include "../kokkosaliases.hpp" -#include "zarr2/buffer.hpp" -#include "zarr2/dataset.hpp" -#include "zarr2/xarray_zarr_array.hpp" +#include "zarr/buffer.hpp" +#include "zarr/dataset.hpp" +#include "zarr/xarray_zarr_array.hpp" template struct XarrayAndViews { @@ -115,4 +115,4 @@ class GenericCollectData { } }; -#endif // LIBS_OBSERVERS2_GENERIC_COLLECT_DATA_HPP_ +#endif // LIBS_OBSERVERS_GENERIC_COLLECT_DATA_HPP_ diff --git a/libs/observers2/massmoments_observer.cpp b/libs/observers/massmoments_observer.cpp similarity index 98% rename from libs/observers2/massmoments_observer.cpp rename to libs/observers/massmoments_observer.cpp index 071624c9d..a8fec513c 100644 --- a/libs/observers2/massmoments_observer.cpp +++ b/libs/observers/massmoments_observer.cpp @@ -4,12 +4,12 @@ * * ----- CLEO ----- * File: massmoments_observer.cpp - * Project: observers2 + * Project: observers * Created Date: Wednesday 24th January 2024 * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 8th April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License diff --git a/libs/observers2/massmoments_observer.hpp b/libs/observers/massmoments_observer.hpp similarity index 98% rename from libs/observers2/massmoments_observer.hpp rename to libs/observers/massmoments_observer.hpp index 65a258f6a..ecae3e6ae 100644 --- a/libs/observers2/massmoments_observer.hpp +++ b/libs/observers/massmoments_observer.hpp @@ -4,12 +4,12 @@ * * ----- CLEO ----- * File: massmoments_observer.hpp - * Project: observers2 + * Project: observers * Created Date: Wednesday 24th January 2024 * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 8th April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -20,8 +20,8 @@ * to individual arrays in a dataset a constant interval at the start of each timestep. */ -#ifndef LIBS_OBSERVERS2_MASSMOMENTS_OBSERVER_HPP_ -#define LIBS_OBSERVERS2_MASSMOMENTS_OBSERVER_HPP_ +#ifndef LIBS_OBSERVERS_MASSMOMENTS_OBSERVER_HPP_ +#define LIBS_OBSERVERS_MASSMOMENTS_OBSERVER_HPP_ #include #include @@ -35,7 +35,7 @@ #include "./write_to_dataset_observer.hpp" #include "gridboxes/gridbox.hpp" #include "superdrops/superdrop.hpp" -#include "zarr2/dataset.hpp" +#include "zarr/dataset.hpp" struct MassMomentsFunc { /* Operator is functor to perform calculation of 0th, 1st and 2nd moments of the (real) @@ -239,4 +239,4 @@ inline Observer auto MassMomentsRaindropsObserver(const unsigned int interval, return WriteToDatasetObserver(interval, parallel_write); } -#endif // LIBS_OBSERVERS2_MASSMOMENTS_OBSERVER_HPP_ +#endif // LIBS_OBSERVERS_MASSMOMENTS_OBSERVER_HPP_ diff --git a/libs/observers2/nsupers_observer.hpp b/libs/observers/nsupers_observer.hpp similarity index 91% rename from libs/observers2/nsupers_observer.hpp rename to libs/observers/nsupers_observer.hpp index 1c67c8f7b..decc1c5a1 100644 --- a/libs/observers2/nsupers_observer.hpp +++ b/libs/observers/nsupers_observer.hpp @@ -4,12 +4,12 @@ * * ----- CLEO ----- * File: nsupers_observer.hpp - * Project: observers2 + * Project: observers * Created Date: Wednesday 24th January 2024 * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Thursday 4th April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -20,8 +20,8 @@ * a constant interval timestep to arrays in a dataset */ -#ifndef LIBS_OBSERVERS2_NSUPERS_OBSERVER_HPP_ -#define LIBS_OBSERVERS2_NSUPERS_OBSERVER_HPP_ +#ifndef LIBS_OBSERVERS_NSUPERS_OBSERVER_HPP_ +#define LIBS_OBSERVERS_NSUPERS_OBSERVER_HPP_ #include #include @@ -36,7 +36,7 @@ #include "./generic_collect_data.hpp" #include "./write_to_dataset_observer.hpp" #include "gridboxes/gridbox.hpp" -#include "zarr2/dataset.hpp" +#include "zarr/dataset.hpp" /* Operator is functor to perform copy of the number of superdroplets in each gridbox "nsupers" to d_data in parallel. Note conversion of nsupers from size_t (architecture dependent usually long @@ -70,4 +70,4 @@ inline Observer auto NsupersObserver(const unsigned int interval, const Dataset< return WriteToDatasetObserver(interval, dataset, CollectNsupers(dataset, maxchunk, ngbxs)); } -#endif // LIBS_OBSERVERS2_NSUPERS_OBSERVER_HPP_ +#endif // LIBS_OBSERVERS_NSUPERS_OBSERVER_HPP_ diff --git a/libs/observers2/observers.hpp b/libs/observers/observers.hpp similarity index 97% rename from libs/observers2/observers.hpp rename to libs/observers/observers.hpp index d53360725..10c57c95b 100644 --- a/libs/observers2/observers.hpp +++ b/libs/observers/observers.hpp @@ -3,12 +3,12 @@ * * ----- CLEO ----- * File: observers.hpp - * Project: observers2 + * Project: observers * Created Date: Friday 13th October 2023 * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Wednesday 3rd April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -21,8 +21,8 @@ * from a Gridbox's State to a computer screen. */ -#ifndef LIBS_OBSERVERS2_OBSERVERS_HPP_ -#define LIBS_OBSERVERS2_OBSERVERS_HPP_ +#ifndef LIBS_OBSERVERS_OBSERVERS_HPP_ +#define LIBS_OBSERVERS_OBSERVERS_HPP_ #include #include @@ -290,4 +290,4 @@ struct ConstTstepObserver { } }; -#endif // LIBS_OBSERVERS2_OBSERVERS_HPP_ +#endif // LIBS_OBSERVERS_OBSERVERS_HPP_ diff --git a/libs/observers2/parallel_write_data.hpp b/libs/observers/parallel_write_data.hpp similarity index 96% rename from libs/observers2/parallel_write_data.hpp rename to libs/observers/parallel_write_data.hpp index 7d37257ac..5fab1685c 100644 --- a/libs/observers2/parallel_write_data.hpp +++ b/libs/observers/parallel_write_data.hpp @@ -4,12 +4,12 @@ * * ----- CLEO ----- * File: parallel_write_data.hpp - * Project: observers2 + * Project: observers * Created Date: Wednesday 24th January 2024 * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 8th April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -20,14 +20,14 @@ * writing data from gridboxes and/or superdroplets to arrays in a dataset */ -#ifndef LIBS_OBSERVERS2_PARALLEL_WRITE_DATA_HPP_ -#define LIBS_OBSERVERS2_PARALLEL_WRITE_DATA_HPP_ +#ifndef LIBS_OBSERVERS_PARALLEL_WRITE_DATA_HPP_ +#define LIBS_OBSERVERS_PARALLEL_WRITE_DATA_HPP_ #include #include #include "../kokkosaliases.hpp" -#include "zarr2/dataset.hpp" +#include "zarr/dataset.hpp" /* struct for function-like object to call for parallel_gridboxes_func in ParallelWriteGridboxes */ struct ParallelGridboxesRangePolicyFunc { @@ -142,4 +142,4 @@ class ParallelWriteSupers { } }; -#endif // LIBS_OBSERVERS2_PARALLEL_WRITE_DATA_HPP_ +#endif // LIBS_OBSERVERS_PARALLEL_WRITE_DATA_HPP_ diff --git a/libs/observers2/runstats_observer.cpp b/libs/observers/runstats_observer.cpp similarity index 93% rename from libs/observers2/runstats_observer.cpp rename to libs/observers/runstats_observer.cpp index ba7bc54cd..01a65f71a 100644 --- a/libs/observers2/runstats_observer.cpp +++ b/libs/observers/runstats_observer.cpp @@ -4,12 +4,12 @@ * * ----- CLEO ----- * File: runstats_observer.cpp - * Project: observers2 + * Project: observers * Created Date: Monday 8th April 2024 * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 8th April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -21,7 +21,7 @@ * e.g. of timestepping CLEO */ -#include "observers2/runstats_observer.hpp" +#include "observers/runstats_observer.hpp" void RunStatsObserver::print_summary() const { const auto t_start = stats->t_start; diff --git a/libs/observers2/runstats_observer.hpp b/libs/observers/runstats_observer.hpp similarity index 92% rename from libs/observers2/runstats_observer.hpp rename to libs/observers/runstats_observer.hpp index 480af6460..6dfe12ee4 100644 --- a/libs/observers2/runstats_observer.hpp +++ b/libs/observers/runstats_observer.hpp @@ -4,12 +4,12 @@ * * ----- CLEO ----- * File: runstats_observer.hpp - * Project: observers2 + * Project: observers * Created Date: Monday 8th April 2024 * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 8th April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -21,8 +21,8 @@ * e.g. of timestepping CLEO */ -#ifndef LIBS_OBSERVERS2_RUNSTATS_OBSERVER_HPP_ -#define LIBS_OBSERVERS2_RUNSTATS_OBSERVER_HPP_ +#ifndef LIBS_OBSERVERS_RUNSTATS_OBSERVER_HPP_ +#define LIBS_OBSERVERS_RUNSTATS_OBSERVER_HPP_ #include #include @@ -102,4 +102,4 @@ class RunStatsObserver { } }; -#endif // LIBS_OBSERVERS2_RUNSTATS_OBSERVER_HPP_ +#endif // LIBS_OBSERVERS_RUNSTATS_OBSERVER_HPP_ diff --git a/libs/observers2/state_observer.hpp b/libs/observers/state_observer.hpp similarity index 87% rename from libs/observers2/state_observer.hpp rename to libs/observers/state_observer.hpp index b1552d613..c431da1b9 100644 --- a/libs/observers2/state_observer.hpp +++ b/libs/observers/state_observer.hpp @@ -4,12 +4,12 @@ * * ----- CLEO ----- * File: state_observer.hpp - * Project: observers2 + * Project: observers * Created Date: Wednesday 24th January 2024 * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Thursday 4th April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -20,8 +20,8 @@ * a constant interval timestep to arrays in a dataset */ -#ifndef LIBS_OBSERVERS2_STATE_OBSERVER_HPP_ -#define LIBS_OBSERVERS2_STATE_OBSERVER_HPP_ +#ifndef LIBS_OBSERVERS_STATE_OBSERVER_HPP_ +#define LIBS_OBSERVERS_STATE_OBSERVER_HPP_ #include #include @@ -38,7 +38,7 @@ #include "./windvel_observer.hpp" #include "./write_to_dataset_observer.hpp" #include "gridboxes/gridbox.hpp" -#include "zarr2/dataset.hpp" +#include "zarr/dataset.hpp" /* constructs observer which writes writes thermodynamic and wind velocity variables from the state of each gridbox with a constant timestep 'interval' using an instance of the WriteToDatasetObserver @@ -54,4 +54,4 @@ inline Observer auto StateObserver(const unsigned int interval, const Dataset #include @@ -70,4 +70,4 @@ struct StreamOutObserver { } }; -#endif // LIBS_OBSERVERS2_STREAMOUT_OBSERVER_HPP_ +#endif // LIBS_OBSERVERS_STREAMOUT_OBSERVER_HPP_ diff --git a/libs/observers2/superdrops_observer.hpp b/libs/observers/superdrops_observer.hpp similarity index 97% rename from libs/observers2/superdrops_observer.hpp rename to libs/observers/superdrops_observer.hpp index 1558da69f..d6db8df6c 100644 --- a/libs/observers2/superdrops_observer.hpp +++ b/libs/observers/superdrops_observer.hpp @@ -4,12 +4,12 @@ * * ----- CLEO ----- * File: superdrops_observer.hpp - * Project: observers2 + * Project: observers * Created Date: Wednesday 24th January 2024 * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 8th April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -20,8 +20,8 @@ * a constant interval timestep to ragged arrays in a dataset */ -#ifndef LIBS_OBSERVERS2_SUPERDROPS_OBSERVER_HPP_ -#define LIBS_OBSERVERS2_SUPERDROPS_OBSERVER_HPP_ +#ifndef LIBS_OBSERVERS_SUPERDROPS_OBSERVER_HPP_ +#define LIBS_OBSERVERS_SUPERDROPS_OBSERVER_HPP_ #include #include @@ -37,7 +37,7 @@ #include "./generic_collect_data.hpp" #include "./write_to_dataset_observer.hpp" #include "superdrops/superdrop.hpp" -#include "zarr2/dataset.hpp" +#include "zarr/dataset.hpp" template struct RaggedCount { @@ -233,4 +233,4 @@ inline Observer auto SuperdropsObserver(const unsigned int interval, const Datas return WriteToDatasetObserver(interval, dataset, collect_data, ragged_count); } -#endif // LIBS_OBSERVERS2_SUPERDROPS_OBSERVER_HPP_ +#endif // LIBS_OBSERVERS_SUPERDROPS_OBSERVER_HPP_ diff --git a/libs/observers2/thermo_observer.hpp b/libs/observers/thermo_observer.hpp similarity index 96% rename from libs/observers2/thermo_observer.hpp rename to libs/observers/thermo_observer.hpp index 4338c1e24..c4ebe6fbf 100644 --- a/libs/observers2/thermo_observer.hpp +++ b/libs/observers/thermo_observer.hpp @@ -4,12 +4,12 @@ * * ----- CLEO ----- * File: thermo_observer.hpp - * Project: observers2 + * Project: observers * Created Date: Wednesday 24th January 2024 * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Thursday 4th April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -20,8 +20,8 @@ * a constant interval timestep to arrays in a dataset */ -#ifndef LIBS_OBSERVERS2_THERMO_OBSERVER_HPP_ -#define LIBS_OBSERVERS2_THERMO_OBSERVER_HPP_ +#ifndef LIBS_OBSERVERS_THERMO_OBSERVER_HPP_ +#define LIBS_OBSERVERS_THERMO_OBSERVER_HPP_ #include #include @@ -36,7 +36,7 @@ #include "./generic_collect_data.hpp" #include "./write_to_dataset_observer.hpp" #include "gridboxes/gridbox.hpp" -#include "zarr2/dataset.hpp" +#include "zarr/dataset.hpp" /* returns CollectDataForDataset which writes a state variable from each gridbox to an array in a dataset in a given store for a given datatype and using a given @@ -132,4 +132,4 @@ inline Observer auto ThermoObserver(const unsigned int interval, const Dataset #include @@ -33,8 +33,8 @@ #include "../kokkosaliases.hpp" #include "./observers.hpp" #include "gridboxes/gridbox.hpp" -#include "zarr2/dataset.hpp" -#include "zarr2/xarray_zarr_array.hpp" +#include "zarr/dataset.hpp" +#include "zarr/xarray_zarr_array.hpp" /* template class for observing time and writing to array as a coordinate of an xarray dataset */ template @@ -88,4 +88,4 @@ inline Observer auto TimeObserver(const unsigned int interval, Dataset &d return ConstTstepObserver(interval, DoTimeObs(dataset, maxchunk, step2dimlesstime)); } -#endif // LIBS_OBSERVERS2_TIME_OBSERVER_HPP_ +#endif // LIBS_OBSERVERS_TIME_OBSERVER_HPP_ diff --git a/libs/observers2/totnsupers_observer.hpp b/libs/observers/totnsupers_observer.hpp similarity index 89% rename from libs/observers2/totnsupers_observer.hpp rename to libs/observers/totnsupers_observer.hpp index eb9e81cd0..d11f5baa4 100644 --- a/libs/observers2/totnsupers_observer.hpp +++ b/libs/observers/totnsupers_observer.hpp @@ -4,12 +4,12 @@ * * ----- CLEO ----- * File: totnsupers_observer.hpp - * Project: observers2 + * Project: observers * Created Date: Wednesday 24th January 2024 * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Thursday 4th April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -20,8 +20,8 @@ * dataset */ -#ifndef LIBS_OBSERVERS2_TOTNSUPERS_OBSERVER_HPP_ -#define LIBS_OBSERVERS2_TOTNSUPERS_OBSERVER_HPP_ +#ifndef LIBS_OBSERVERS_TOTNSUPERS_OBSERVER_HPP_ +#define LIBS_OBSERVERS_TOTNSUPERS_OBSERVER_HPP_ #include #include @@ -31,9 +31,9 @@ #include "../kokkosaliases.hpp" #include "./observers.hpp" #include "gridboxes/gridbox.hpp" -#include "zarr2/buffer.hpp" -#include "zarr2/dataset.hpp" -#include "zarr2/xarray_zarr_array.hpp" +#include "zarr/buffer.hpp" +#include "zarr/dataset.hpp" +#include "zarr/xarray_zarr_array.hpp" /* template observer which writes gbxindex for every gridbox out to a 1-D array as a coordinate of an xarray dataset */ @@ -79,4 +79,4 @@ inline Observer auto TotNsupersObserver(const unsigned int interval, Dataset #include @@ -36,7 +36,7 @@ #include "./generic_collect_data.hpp" #include "./write_to_dataset_observer.hpp" #include "gridboxes/gridbox.hpp" -#include "zarr2/dataset.hpp" +#include "zarr/dataset.hpp" /* returns CollectDataForDataset which writes a state variable from each gridbox to an array in a dataset in a given store for a given datatype and using a given @@ -119,4 +119,4 @@ inline Observer auto WindVelObserver(const unsigned int interval, const Dataset< return WriteToDatasetObserver(interval, dataset, windvel); } -#endif // LIBS_OBSERVERS2_WINDVEL_OBSERVER_HPP_ +#endif // LIBS_OBSERVERS_WINDVEL_OBSERVER_HPP_ diff --git a/libs/observers2/write_to_dataset_observer.hpp b/libs/observers/write_to_dataset_observer.hpp similarity index 93% rename from libs/observers2/write_to_dataset_observer.hpp rename to libs/observers/write_to_dataset_observer.hpp index e0efd372a..57058354b 100644 --- a/libs/observers2/write_to_dataset_observer.hpp +++ b/libs/observers/write_to_dataset_observer.hpp @@ -4,12 +4,12 @@ * * ----- CLEO ----- * File: write_to_dataset_observer.hpp - * Project: observers2 + * Project: observers * Created Date: Wednesday 24th January 2024 * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Thursday 4th April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -20,8 +20,8 @@ * constant time interval */ -#ifndef LIBS_OBSERVERS2_WRITE_TO_DATASET_OBSERVER_HPP_ -#define LIBS_OBSERVERS2_WRITE_TO_DATASET_OBSERVER_HPP_ +#ifndef LIBS_OBSERVERS_WRITE_TO_DATASET_OBSERVER_HPP_ +#define LIBS_OBSERVERS_WRITE_TO_DATASET_OBSERVER_HPP_ #include #include @@ -31,7 +31,7 @@ #include "./collect_data_for_dataset.hpp" #include "./observers.hpp" #include "./parallel_write_data.hpp" -#include "zarr2/dataset.hpp" +#include "zarr/dataset.hpp" /* template class for to call a function during the at_start_step function of an observer in order to collect variables from gridboxes and/or superdroplets in parallel and then write them @@ -89,4 +89,4 @@ inline Observer auto WriteToDatasetObserver(const unsigned int interval, return ConstTstepObserver(interval, DoWriteToDataset(parallel_write)); } -#endif // LIBS_OBSERVERS2_WRITE_TO_DATASET_OBSERVER_HPP_ +#endif // LIBS_OBSERVERS_WRITE_TO_DATASET_OBSERVER_HPP_ diff --git a/libs/zarr2/CMakeLists.txt b/libs/zarr/CMakeLists.txt similarity index 98% rename from libs/zarr2/CMakeLists.txt rename to libs/zarr/CMakeLists.txt index cb2727255..8c5c96b45 100644 --- a/libs/zarr2/CMakeLists.txt +++ b/libs/zarr/CMakeLists.txt @@ -4,7 +4,7 @@ if(NOT DEFINED CMAKE_MINIMUM_REQUIRED_VERSION) endif() # set library name and print directory of this CMakeLists.txt (source directory of library) -set(LIBNAME "zarr2") +set(LIBNAME "zarr") message("${LIBNAME} LIBRARY_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}") # explicitly set library executables path to /lib in top level of build tree diff --git a/libs/zarr2/buffer.hpp b/libs/zarr/buffer.hpp similarity index 97% rename from libs/zarr2/buffer.hpp rename to libs/zarr/buffer.hpp index d333920c3..d6755094b 100644 --- a/libs/zarr2/buffer.hpp +++ b/libs/zarr/buffer.hpp @@ -4,12 +4,12 @@ * * ----- CLEO ----- * File: buffer.hpp - * Project: zarr2 + * Project: zarr * Created Date: Monday 18th March 2024 * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Saturday 30th March 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -19,8 +19,8 @@ * Class for a buffer used by a ZarrArray to acculuate data and then write it into a store */ -#ifndef LIBS_ZARR2_BUFFER_HPP_ -#define LIBS_ZARR2_BUFFER_HPP_ +#ifndef LIBS_ZARR_BUFFER_HPP_ +#define LIBS_ZARR_BUFFER_HPP_ #include #include @@ -172,4 +172,4 @@ struct Buffer { } }; -#endif // LIBS_ZARR2_BUFFER_HPP_ +#endif // LIBS_ZARR_BUFFER_HPP_ diff --git a/libs/zarr2/chunks.hpp b/libs/zarr/chunks.hpp similarity index 98% rename from libs/zarr2/chunks.hpp rename to libs/zarr/chunks.hpp index bd8e173d1..7b16853b2 100644 --- a/libs/zarr2/chunks.hpp +++ b/libs/zarr/chunks.hpp @@ -4,12 +4,12 @@ * * ----- CLEO ----- * File: chunks.hpp - * Project: zarr2 + * Project: zarr * Created Date: Monday 18th March 2024 * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Saturday 30th March 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -19,8 +19,8 @@ * Class to manage and write chunks of data to an array in a given memory store. */ -#ifndef LIBS_ZARR2_CHUNKS_HPP_ -#define LIBS_ZARR2_CHUNKS_HPP_ +#ifndef LIBS_ZARR_CHUNKS_HPP_ +#define LIBS_ZARR_CHUNKS_HPP_ #include #include @@ -244,4 +244,4 @@ class Chunks { } }; -#endif // LIBS_ZARR2_CHUNKS_HPP_ +#endif // LIBS_ZARR_CHUNKS_HPP_ diff --git a/libs/zarr2/dataset.hpp b/libs/zarr/dataset.hpp similarity index 99% rename from libs/zarr2/dataset.hpp rename to libs/zarr/dataset.hpp index ef0604d10..8720e1d02 100644 --- a/libs/zarr2/dataset.hpp +++ b/libs/zarr/dataset.hpp @@ -4,7 +4,7 @@ * * ----- CLEO ----- * File: dataset.hpp - * Project: zarr2 + * Project: zarr * Created Date: Monday 18th March 2024 * Author: Clara Bayley (CB) * Additional Contributors: @@ -19,8 +19,8 @@ * Structure to create a ZarrGroup which is xarray and netCDF compatible. */ -#ifndef LIBS_ZARR2_DATASET_HPP_ -#define LIBS_ZARR2_DATASET_HPP_ +#ifndef LIBS_ZARR_DATASET_HPP_ +#define LIBS_ZARR_DATASET_HPP_ #include #include @@ -293,4 +293,4 @@ class Dataset { } }; -#endif // LIBS_ZARR2_DATASET_HPP_ +#endif // LIBS_ZARR_DATASET_HPP_ diff --git a/libs/zarr2/fsstore.cpp b/libs/zarr/fsstore.cpp similarity index 96% rename from libs/zarr2/fsstore.cpp rename to libs/zarr/fsstore.cpp index 85f2cb28c..f533f9702 100644 --- a/libs/zarr2/fsstore.cpp +++ b/libs/zarr/fsstore.cpp @@ -4,12 +4,12 @@ * * ----- CLEO ----- * File: fsstore.cpp - * Project: zarr2 + * Project: zarr * Created Date: Monday 18th March 2024 * Author: Clara Bayley (CB) * Additional Contributors: Tobias Kölling (TB) * ----- - * Last Modified: Tuesday 26th March 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License diff --git a/libs/zarr2/fsstore.hpp b/libs/zarr/fsstore.hpp similarity index 93% rename from libs/zarr2/fsstore.hpp rename to libs/zarr/fsstore.hpp index a97ee1074..b6f125204 100644 --- a/libs/zarr2/fsstore.hpp +++ b/libs/zarr/fsstore.hpp @@ -4,12 +4,12 @@ * * ----- CLEO ----- * File: fsstore.hpp - * Project: zarr2 + * Project: zarr * Created Date: Monday 18th March 2024 * Author: Clara Bayley (CB) * Additional Contributors: Tobias Kölling (TB) * ----- - * Last Modified: Tuesday 26th March 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -19,8 +19,8 @@ * Class for writing memory in a a file system store under a given key. */ -#ifndef LIBS_ZARR2_FSSTORE_HPP_ -#define LIBS_ZARR2_FSSTORE_HPP_ +#ifndef LIBS_ZARR_FSSTORE_HPP_ +#define LIBS_ZARR_FSSTORE_HPP_ #include #include @@ -75,4 +75,4 @@ class FSStore { bool write(const std::string_view key, const std::span buffer) const; }; -#endif // LIBS_ZARR2_FSSTORE_HPP_ +#endif // LIBS_ZARR_FSSTORE_HPP_ diff --git a/libs/zarr2/store_accessor.hpp b/libs/zarr/store_accessor.hpp similarity index 95% rename from libs/zarr2/store_accessor.hpp rename to libs/zarr/store_accessor.hpp index d247faf8b..698b0761a 100644 --- a/libs/zarr2/store_accessor.hpp +++ b/libs/zarr/store_accessor.hpp @@ -4,12 +4,12 @@ * * ----- CLEO ----- * File: store_accessor.hpp - * Project: zarr2 + * Project: zarr * Created Date: Monday 18th March 2024 * Author: Clara Bayley (CB) * Additional Contributors: Tobias Kölling (TB) * ----- - * Last Modified: Wednesday 27th March 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -20,8 +20,8 @@ * write to some kind of memory store under a given key. */ -#ifndef LIBS_ZARR2_STORE_ACCESSOR_HPP_ -#define LIBS_ZARR2_STORE_ACCESSOR_HPP_ +#ifndef LIBS_ZARR_STORE_ACCESSOR_HPP_ +#define LIBS_ZARR_STORE_ACCESSOR_HPP_ #include #include @@ -107,4 +107,4 @@ struct StoreAccessor { } }; -#endif // LIBS_ZARR2_STORE_ACCESSOR_HPP_ +#endif // LIBS_ZARR_STORE_ACCESSOR_HPP_ diff --git a/libs/zarr2/xarray_zarr_array.hpp b/libs/zarr/xarray_zarr_array.hpp similarity index 98% rename from libs/zarr2/xarray_zarr_array.hpp rename to libs/zarr/xarray_zarr_array.hpp index 57b3fd458..f4c26384f 100644 --- a/libs/zarr2/xarray_zarr_array.hpp +++ b/libs/zarr/xarray_zarr_array.hpp @@ -4,12 +4,12 @@ * * ----- CLEO ----- * File: xarray_zarr_array.hpp - * Project: zarr2 + * Project: zarr * Created Date: Monday 18th March 2024 * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Thursday 4th April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -20,8 +20,8 @@ * (https://zarr.readthedocs.io/en/stable/spec/v2.html) in a given memory store. */ -#ifndef LIBS_ZARR2_XARRAY_ZARR_ARRAY_HPP_ -#define LIBS_ZARR2_XARRAY_ZARR_ARRAY_HPP_ +#ifndef LIBS_ZARR_XARRAY_ZARR_ARRAY_HPP_ +#define LIBS_ZARR_XARRAY_ZARR_ARRAY_HPP_ #include #include @@ -408,4 +408,4 @@ class XarrayZarrArray { } }; -#endif // LIBS_ZARR2_XARRAY_ZARR_ARRAY_HPP_ +#endif // LIBS_ZARR_XARRAY_ZARR_ARRAY_HPP_ diff --git a/libs/zarr2/zarr_array.hpp b/libs/zarr/zarr_array.hpp similarity index 99% rename from libs/zarr2/zarr_array.hpp rename to libs/zarr/zarr_array.hpp index d74b00370..f98704aad 100644 --- a/libs/zarr2/zarr_array.hpp +++ b/libs/zarr/zarr_array.hpp @@ -4,12 +4,12 @@ * * ----- CLEO ----- * File: zarr_array.hpp - * Project: zarr2 + * Project: zarr * Created Date: Monday 18th March 2024 * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Thursday 4th April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -20,8 +20,8 @@ * (https://zarr.readthedocs.io/en/stable/spec/v2.html) in a given memory store. */ -#ifndef LIBS_ZARR2_ZARR_ARRAY_HPP_ -#define LIBS_ZARR2_ZARR_ARRAY_HPP_ +#ifndef LIBS_ZARR_ZARR_ARRAY_HPP_ +#define LIBS_ZARR_ZARR_ARRAY_HPP_ #include #include @@ -414,4 +414,4 @@ class ZarrArray { } }; -#endif // LIBS_ZARR2_ZARR_ARRAY_HPP_ +#endif // LIBS_ZARR_ZARR_ARRAY_HPP_ diff --git a/libs/zarr2/zarr_group.hpp b/libs/zarr/zarr_group.hpp similarity index 91% rename from libs/zarr2/zarr_group.hpp rename to libs/zarr/zarr_group.hpp index 9836775e3..0ac1baed8 100644 --- a/libs/zarr2/zarr_group.hpp +++ b/libs/zarr/zarr_group.hpp @@ -4,12 +4,12 @@ * * ----- CLEO ----- * File: zarr_group.hpp - * Project: zarr2 + * Project: zarr * Created Date: Monday 18th March 2024 * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Tuesday 26th March 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -20,8 +20,8 @@ * (https://zarr.readthedocs.io/en/stable/spec/v2.html) in a given memory store. */ -#ifndef LIBS_ZARR2_ZARR_GROUP_HPP_ -#define LIBS_ZARR2_ZARR_GROUP_HPP_ +#ifndef LIBS_ZARR_ZARR_GROUP_HPP_ +#define LIBS_ZARR_ZARR_GROUP_HPP_ #include #include @@ -56,4 +56,4 @@ struct ZarrGroup { } }; -#endif // LIBS_ZARR2_ZARR_GROUP_HPP_ +#endif // LIBS_ZARR_ZARR_GROUP_HPP_ From 88b253e0b410f344dc05f0a243c0da18b1c9b94c Mon Sep 17 00:00:00 2001 From: Clara Levante Date: Tue, 9 Apr 2024 09:27:08 +0200 Subject: [PATCH 02/35] #includes and cmake targets renamed --- docs/doxygen/doxygen.dox | 2 +- docs/source/conf.py | 6 ++-- docs/source/cxx/cxx.rst | 4 +-- .../{observers2mod.rst => observersmod.rst} | 0 .../cxx/zarr/{zarr2mod.rst => zarrmod.rst} | 0 examples/adiabaticparcel/src/CMakeLists.txt | 2 +- examples/adiabaticparcel/src/main_adia0D.cpp | 18 +++++------ .../golovin/src/CMakeLists.txt | 2 +- .../golovin/src/main_golcolls.cpp | 16 +++++----- .../long/src/CMakeLists.txt | 2 +- .../long/src/main_longcolls.cpp | 16 +++++----- .../lowlist/src/CMakeLists.txt | 2 +- .../lowlist/src/main_lowlistcolls.cpp | 16 +++++----- examples/constthermo2d/src/CMakeLists.txt | 2 +- examples/constthermo2d/src/main_const2D.cpp | 20 ++++++------- examples/divfreemotion/src/CMakeLists.txt | 2 +- examples/divfreemotion/src/main_divfree2D.cpp | 16 +++++----- examples/rainshaft1d/src/CMakeLists.txt | 2 +- examples/rainshaft1d/src/main_rshaft1D.cpp | 20 ++++++------- examples/speedtest/src/CMakeLists.txt | 2 +- examples/speedtest/src/main_spdtest.cpp | 26 ++++++++-------- examples/yac/divfreemotion/src/CMakeLists.txt | 2 +- .../yac/divfreemotion/src/main_divfree2D.cpp | 16 +++++----- examples/yac/fromfile/src/CMakeLists.txt | 2 +- examples/yac/fromfile/src/main_yac1.cpp | 18 +++++------ examples/yac/yac_3d/src/CMakeLists.txt | 2 +- examples/yac/yac_3d/src/main_yac1.cpp | 18 +++++------ libs/CMakeLists.txt | 4 +-- libs/runcleo/CMakeLists.txt | 2 +- libs/runcleo/runcleo.hpp | 4 +-- libs/runcleo/sdmmethods.hpp | 4 +-- roughpaper/CMakeLists.txt | 2 +- roughpaper/main.cpp | 30 +++++++++---------- src/CMakeLists.txt | 2 +- src/main.cpp | 24 +++++++-------- 35 files changed, 153 insertions(+), 153 deletions(-) rename docs/source/cxx/observers/{observers2mod.rst => observersmod.rst} (100%) rename docs/source/cxx/zarr/{zarr2mod.rst => zarrmod.rst} (100%) diff --git a/docs/doxygen/doxygen.dox b/docs/doxygen/doxygen.dox index a76d77781..a931a4b28 100644 --- a/docs/doxygen/doxygen.dox +++ b/docs/doxygen/doxygen.dox @@ -949,7 +949,7 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = ../libs/runcleo/ ../libs/superdrops/ ../libs/zarr2/ ../libs/observers2/ +INPUT = ../libs/runcleo/ ../libs/superdrops/ ../libs/zarr/ ../libs/observers/ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/docs/source/conf.py b/docs/source/conf.py index f2e69a2b5..2e7de182d 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -6,7 +6,7 @@ Author: Clara Bayley (CB) Additional Contributors: ----- -Last Modified: Wednesday 27th March 2024 +Last Modified: Tuesday 9th April 2024 Modified By: CB ----- License: BSD 3-Clause "New" or "Revised" License @@ -76,8 +76,8 @@ breathe_projects = { "runcleo" : "../build/doxygen/xml/", "superdrops" : "../build/doxygen/xml/", - "zarr2" : "../build/doxygen/xml/", - "observers2" : "../build/doxygen/xml/", + "zarr" : "../build/doxygen/xml/", + "observers" : "../build/doxygen/xml/", } breathe_default_project = 'proj' diff --git a/docs/source/cxx/cxx.rst b/docs/source/cxx/cxx.rst index 4ac8efe22..39ea3905c 100644 --- a/docs/source/cxx/cxx.rst +++ b/docs/source/cxx/cxx.rst @@ -19,8 +19,8 @@ a SDM coupled to a Dynamics Solver. runcleo/runcleomod superdrops/superdropsmod - zarr2/zarr2mod - observers2/observers2mod + zarr/zarrmod + observers/observersmod Indices and tables ------------------ diff --git a/docs/source/cxx/observers/observers2mod.rst b/docs/source/cxx/observers/observersmod.rst similarity index 100% rename from docs/source/cxx/observers/observers2mod.rst rename to docs/source/cxx/observers/observersmod.rst diff --git a/docs/source/cxx/zarr/zarr2mod.rst b/docs/source/cxx/zarr/zarrmod.rst similarity index 100% rename from docs/source/cxx/zarr/zarr2mod.rst rename to docs/source/cxx/zarr/zarrmod.rst diff --git a/examples/adiabaticparcel/src/CMakeLists.txt b/examples/adiabaticparcel/src/CMakeLists.txt index d80ca2840..19a040b09 100644 --- a/examples/adiabaticparcel/src/CMakeLists.txt +++ b/examples/adiabaticparcel/src/CMakeLists.txt @@ -9,7 +9,7 @@ project("adiabaticparcel") message("PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}") # Set libraries from CLEO to link with executable -set(CLEOLIBS gridboxes initialise observers2 runcleo superdrops zarr2) +set(CLEOLIBS gridboxes initialise observers runcleo superdrops zarr) # create primary executable for CVODE-CLEO coupled model adiabatic parcel setup add_executable(adia0D EXCLUDE_FROM_ALL "main_adia0D.cpp") diff --git a/examples/adiabaticparcel/src/main_adia0D.cpp b/examples/adiabaticparcel/src/main_adia0D.cpp index f4a449834..f55c952f7 100644 --- a/examples/adiabaticparcel/src/main_adia0D.cpp +++ b/examples/adiabaticparcel/src/main_adia0D.cpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 8th April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -36,12 +36,12 @@ #include "initialise/config.hpp" #include "initialise/initsupers_frombinary.hpp" #include "initialise/timesteps.hpp" -#include "observers2/gbxindex_observer.hpp" -#include "observers2/observers.hpp" -#include "observers2/state_observer.hpp" -#include "observers2/streamout_observer.hpp" -#include "observers2/superdrops_observer.hpp" -#include "observers2/time_observer.hpp" +#include "observers/gbxindex_observer.hpp" +#include "observers/observers.hpp" +#include "observers/state_observer.hpp" +#include "observers/streamout_observer.hpp" +#include "observers/superdrops_observer.hpp" +#include "observers/time_observer.hpp" #include "runcleo/coupleddynamics.hpp" #include "runcleo/couplingcomms.hpp" #include "runcleo/initialconditions.hpp" @@ -50,8 +50,8 @@ #include "superdrops/condensation.hpp" #include "superdrops/microphysicalprocess.hpp" #include "superdrops/motion.hpp" -#include "zarr2/dataset.hpp" -#include "zarr2/fsstore.hpp" +#include "zarr/dataset.hpp" +#include "zarr/fsstore.hpp" inline CoupledDynamics auto create_coupldyn(const Config &config, const unsigned int couplstep) { return CvodeDynamics(config, couplstep, &step2dimlesstime); diff --git a/examples/boxmodelcollisions/golovin/src/CMakeLists.txt b/examples/boxmodelcollisions/golovin/src/CMakeLists.txt index 3ceb6f041..7553dec49 100644 --- a/examples/boxmodelcollisions/golovin/src/CMakeLists.txt +++ b/examples/boxmodelcollisions/golovin/src/CMakeLists.txt @@ -9,7 +9,7 @@ project("boxmodelcollisions_golovin") message("PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}") # Set libraries from CLEO to link with executable -set(CLEOLIBS gridboxes initialise observers2 runcleo superdrops zarr2) +set(CLEOLIBS gridboxes initialise observers runcleo superdrops zarr) # create primary executable for CLEO uncoupled model golovin kernel box model setup add_executable(golcolls EXCLUDE_FROM_ALL "main_golcolls.cpp") diff --git a/examples/boxmodelcollisions/golovin/src/main_golcolls.cpp b/examples/boxmodelcollisions/golovin/src/main_golcolls.cpp index 2ee9aa7fa..7eef97943 100644 --- a/examples/boxmodelcollisions/golovin/src/main_golcolls.cpp +++ b/examples/boxmodelcollisions/golovin/src/main_golcolls.cpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 8th April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -38,11 +38,11 @@ #include "initialise/initgbxs_null.hpp" #include "initialise/initsupers_frombinary.hpp" #include "initialise/timesteps.hpp" -#include "observers2/gbxindex_observer.hpp" -#include "observers2/observers.hpp" -#include "observers2/streamout_observer.hpp" -#include "observers2/superdrops_observer.hpp" -#include "observers2/time_observer.hpp" +#include "observers/gbxindex_observer.hpp" +#include "observers/observers.hpp" +#include "observers/streamout_observer.hpp" +#include "observers/superdrops_observer.hpp" +#include "observers/time_observer.hpp" #include "runcleo/coupleddynamics.hpp" #include "runcleo/couplingcomms.hpp" #include "runcleo/initialconditions.hpp" @@ -52,8 +52,8 @@ #include "superdrops/collisions/golovinprob.hpp" #include "superdrops/microphysicalprocess.hpp" #include "superdrops/motion.hpp" -#include "zarr2/dataset.hpp" -#include "zarr2/fsstore.hpp" +#include "zarr/dataset.hpp" +#include "zarr/fsstore.hpp" inline InitialConditions auto create_initconds(const Config &config) { const InitSupersFromBinary initsupers(config); diff --git a/examples/boxmodelcollisions/long/src/CMakeLists.txt b/examples/boxmodelcollisions/long/src/CMakeLists.txt index 050768d87..08fa130e1 100644 --- a/examples/boxmodelcollisions/long/src/CMakeLists.txt +++ b/examples/boxmodelcollisions/long/src/CMakeLists.txt @@ -9,7 +9,7 @@ project("boxmodelcollisions_long") message("PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}") # Set libraries from CLEO to link with executable -set(CLEOLIBS gridboxes initialise observers2 runcleo superdrops zarr2) +set(CLEOLIBS gridboxes initialise observers runcleo superdrops zarr) # create primary executable for CLEO uncoupled model long kernel box model setup add_executable(longcolls EXCLUDE_FROM_ALL "main_longcolls.cpp") diff --git a/examples/boxmodelcollisions/long/src/main_longcolls.cpp b/examples/boxmodelcollisions/long/src/main_longcolls.cpp index c73e65b08..355403382 100644 --- a/examples/boxmodelcollisions/long/src/main_longcolls.cpp +++ b/examples/boxmodelcollisions/long/src/main_longcolls.cpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 8th April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -38,11 +38,11 @@ #include "initialise/initgbxs_null.hpp" #include "initialise/initsupers_frombinary.hpp" #include "initialise/timesteps.hpp" -#include "observers2/gbxindex_observer.hpp" -#include "observers2/observers.hpp" -#include "observers2/streamout_observer.hpp" -#include "observers2/superdrops_observer.hpp" -#include "observers2/time_observer.hpp" +#include "observers/gbxindex_observer.hpp" +#include "observers/observers.hpp" +#include "observers/streamout_observer.hpp" +#include "observers/superdrops_observer.hpp" +#include "observers/time_observer.hpp" #include "runcleo/coupleddynamics.hpp" #include "runcleo/couplingcomms.hpp" #include "runcleo/initialconditions.hpp" @@ -52,8 +52,8 @@ #include "superdrops/collisions/longhydroprob.hpp" #include "superdrops/microphysicalprocess.hpp" #include "superdrops/motion.hpp" -#include "zarr2/dataset.hpp" -#include "zarr2/fsstore.hpp" +#include "zarr/dataset.hpp" +#include "zarr/fsstore.hpp" inline InitialConditions auto create_initconds(const Config &config) { const InitSupersFromBinary initsupers(config); diff --git a/examples/boxmodelcollisions/lowlist/src/CMakeLists.txt b/examples/boxmodelcollisions/lowlist/src/CMakeLists.txt index 3e2c7a25e..2af78934b 100644 --- a/examples/boxmodelcollisions/lowlist/src/CMakeLists.txt +++ b/examples/boxmodelcollisions/lowlist/src/CMakeLists.txt @@ -9,7 +9,7 @@ project("boxmodelcollisions_lowlist") message("PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}") # Set libraries from CLEO to link with executable -set(CLEOLIBS gridboxes initialise observers2 runcleo superdrops zarr2) +set(CLEOLIBS gridboxes initialise observers runcleo superdrops zarr) # create primary executable for CLEO uncoupled model lowlist kernel box model setup add_executable(lowlistcolls EXCLUDE_FROM_ALL "main_lowlistcolls.cpp") diff --git a/examples/boxmodelcollisions/lowlist/src/main_lowlistcolls.cpp b/examples/boxmodelcollisions/lowlist/src/main_lowlistcolls.cpp index fcf4007fc..43172ddd0 100644 --- a/examples/boxmodelcollisions/lowlist/src/main_lowlistcolls.cpp +++ b/examples/boxmodelcollisions/lowlist/src/main_lowlistcolls.cpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 8th April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -38,11 +38,11 @@ #include "initialise/initgbxs_null.hpp" #include "initialise/initsupers_frombinary.hpp" #include "initialise/timesteps.hpp" -#include "observers2/gbxindex_observer.hpp" -#include "observers2/observers.hpp" -#include "observers2/streamout_observer.hpp" -#include "observers2/superdrops_observer.hpp" -#include "observers2/time_observer.hpp" +#include "observers/gbxindex_observer.hpp" +#include "observers/observers.hpp" +#include "observers/streamout_observer.hpp" +#include "observers/superdrops_observer.hpp" +#include "observers/time_observer.hpp" #include "runcleo/coupleddynamics.hpp" #include "runcleo/couplingcomms.hpp" #include "runcleo/initialconditions.hpp" @@ -52,8 +52,8 @@ #include "superdrops/collisions/lowlistprob.hpp" #include "superdrops/microphysicalprocess.hpp" #include "superdrops/motion.hpp" -#include "zarr2/dataset.hpp" -#include "zarr2/fsstore.hpp" +#include "zarr/dataset.hpp" +#include "zarr/fsstore.hpp" inline InitialConditions auto create_initconds(const Config &config) { const InitSupersFromBinary initsupers(config); diff --git a/examples/constthermo2d/src/CMakeLists.txt b/examples/constthermo2d/src/CMakeLists.txt index e6ea9fa4e..19ad9025c 100644 --- a/examples/constthermo2d/src/CMakeLists.txt +++ b/examples/constthermo2d/src/CMakeLists.txt @@ -9,7 +9,7 @@ project("constthermo2d") message("PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}") # Set libraries from CLEO to link with executable -set(CLEOLIBS gridboxes initialise observers2 runcleo superdrops zarr2) +set(CLEOLIBS gridboxes initialise observers runcleo superdrops zarr) # create primary executable for CLEO in 2-D coupled to thermodynamics from file setup add_executable(const2D EXCLUDE_FROM_ALL "main_const2D.cpp") diff --git a/examples/constthermo2d/src/main_const2D.cpp b/examples/constthermo2d/src/main_const2D.cpp index 70dd50d19..815c4c9de 100644 --- a/examples/constthermo2d/src/main_const2D.cpp +++ b/examples/constthermo2d/src/main_const2D.cpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 8th April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -38,13 +38,13 @@ #include "initialise/initgbxs_null.hpp" #include "initialise/initsupers_frombinary.hpp" #include "initialise/timesteps.hpp" -#include "observers2/gbxindex_observer.hpp" -#include "observers2/massmoments_observer.hpp" -#include "observers2/nsupers_observer.hpp" -#include "observers2/observers.hpp" -#include "observers2/streamout_observer.hpp" -#include "observers2/superdrops_observer.hpp" -#include "observers2/time_observer.hpp" +#include "observers/gbxindex_observer.hpp" +#include "observers/massmoments_observer.hpp" +#include "observers/nsupers_observer.hpp" +#include "observers/observers.hpp" +#include "observers/streamout_observer.hpp" +#include "observers/superdrops_observer.hpp" +#include "observers/time_observer.hpp" #include "runcleo/coupleddynamics.hpp" #include "runcleo/couplingcomms.hpp" #include "runcleo/initialconditions.hpp" @@ -56,8 +56,8 @@ #include "superdrops/microphysicalprocess.hpp" #include "superdrops/motion.hpp" #include "superdrops/terminalvelocity.hpp" -#include "zarr2/dataset.hpp" -#include "zarr2/fsstore.hpp" +#include "zarr/dataset.hpp" +#include "zarr/fsstore.hpp" inline CoupledDynamics auto create_coupldyn(const Config &config, const CartesianMaps &gbxmaps, const unsigned int couplstep, diff --git a/examples/divfreemotion/src/CMakeLists.txt b/examples/divfreemotion/src/CMakeLists.txt index d8be48526..d14880752 100644 --- a/examples/divfreemotion/src/CMakeLists.txt +++ b/examples/divfreemotion/src/CMakeLists.txt @@ -9,7 +9,7 @@ project("divfreemotion") message("PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}") # Set libraries from CLEO to link with executable -set(CLEOLIBS gridboxes initialise observers2 runcleo superdrops zarr2) +set(CLEOLIBS gridboxes initialise observers runcleo superdrops zarr) # create primary executable for CLEO in 2-D coupled to thermodynamics from file setup add_executable(divfree2D EXCLUDE_FROM_ALL "main_divfree2D.cpp") diff --git a/examples/divfreemotion/src/main_divfree2D.cpp b/examples/divfreemotion/src/main_divfree2D.cpp index 84fc03d30..3e442f4b7 100644 --- a/examples/divfreemotion/src/main_divfree2D.cpp +++ b/examples/divfreemotion/src/main_divfree2D.cpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 8th April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -38,11 +38,11 @@ #include "initialise/initgbxs_null.hpp" #include "initialise/initsupers_frombinary.hpp" #include "initialise/timesteps.hpp" -#include "observers2/gbxindex_observer.hpp" -#include "observers2/observers.hpp" -#include "observers2/streamout_observer.hpp" -#include "observers2/superdrops_observer.hpp" -#include "observers2/time_observer.hpp" +#include "observers/gbxindex_observer.hpp" +#include "observers/observers.hpp" +#include "observers/streamout_observer.hpp" +#include "observers/superdrops_observer.hpp" +#include "observers/time_observer.hpp" #include "runcleo/coupleddynamics.hpp" #include "runcleo/couplingcomms.hpp" #include "runcleo/initialconditions.hpp" @@ -50,8 +50,8 @@ #include "runcleo/sdmmethods.hpp" #include "superdrops/microphysicalprocess.hpp" #include "superdrops/motion.hpp" -#include "zarr2/dataset.hpp" -#include "zarr2/fsstore.hpp" +#include "zarr/dataset.hpp" +#include "zarr/fsstore.hpp" inline CoupledDynamics auto create_coupldyn(const Config &config, const CartesianMaps &gbxmaps, const unsigned int couplstep, diff --git a/examples/rainshaft1d/src/CMakeLists.txt b/examples/rainshaft1d/src/CMakeLists.txt index 13bf4a248..8abb37da0 100644 --- a/examples/rainshaft1d/src/CMakeLists.txt +++ b/examples/rainshaft1d/src/CMakeLists.txt @@ -9,7 +9,7 @@ project("rainshaft1d") message("PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}") # Set libraries from CLEO to link with executable -set(CLEOLIBS gridboxes initialise observers2 runcleo superdrops zarr2) +set(CLEOLIBS gridboxes initialise observers runcleo superdrops zarr) # create primary executable for CLEO in 1-D coupled to thermodynamics from file setup add_executable(rshaft1D EXCLUDE_FROM_ALL "main_rshaft1D.cpp") diff --git a/examples/rainshaft1d/src/main_rshaft1D.cpp b/examples/rainshaft1d/src/main_rshaft1D.cpp index fa2f46145..c783a94de 100644 --- a/examples/rainshaft1d/src/main_rshaft1D.cpp +++ b/examples/rainshaft1d/src/main_rshaft1D.cpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 8th April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -38,13 +38,13 @@ #include "initialise/initgbxs_null.hpp" #include "initialise/initsupers_frombinary.hpp" #include "initialise/timesteps.hpp" -#include "observers2/gbxindex_observer.hpp" -#include "observers2/massmoments_observer.hpp" -#include "observers2/nsupers_observer.hpp" -#include "observers2/observers.hpp" -#include "observers2/streamout_observer.hpp" -#include "observers2/superdrops_observer.hpp" -#include "observers2/time_observer.hpp" +#include "observers/gbxindex_observer.hpp" +#include "observers/massmoments_observer.hpp" +#include "observers/nsupers_observer.hpp" +#include "observers/observers.hpp" +#include "observers/streamout_observer.hpp" +#include "observers/superdrops_observer.hpp" +#include "observers/time_observer.hpp" #include "runcleo/coupleddynamics.hpp" #include "runcleo/couplingcomms.hpp" #include "runcleo/initialconditions.hpp" @@ -56,8 +56,8 @@ #include "superdrops/microphysicalprocess.hpp" #include "superdrops/motion.hpp" #include "superdrops/terminalvelocity.hpp" -#include "zarr2/dataset.hpp" -#include "zarr2/fsstore.hpp" +#include "zarr/dataset.hpp" +#include "zarr/fsstore.hpp" inline CoupledDynamics auto create_coupldyn(const Config &config, const CartesianMaps &gbxmaps, const unsigned int couplstep, diff --git a/examples/speedtest/src/CMakeLists.txt b/examples/speedtest/src/CMakeLists.txt index c9d1e9427..18f243a66 100644 --- a/examples/speedtest/src/CMakeLists.txt +++ b/examples/speedtest/src/CMakeLists.txt @@ -9,7 +9,7 @@ project("speedtest") message("PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}") # Set libraries from CLEO to link with executable -set(CLEOLIBS gridboxes initialise observers2 runcleo superdrops zarr2) +set(CLEOLIBS gridboxes initialise observers runcleo superdrops zarr) # create primary executable for CLEO in serial, gpu and cpu speed tests add_executable(spdtest EXCLUDE_FROM_ALL "main_spdtest.cpp") diff --git a/examples/speedtest/src/main_spdtest.cpp b/examples/speedtest/src/main_spdtest.cpp index 363cc0fda..439e84838 100644 --- a/examples/speedtest/src/main_spdtest.cpp +++ b/examples/speedtest/src/main_spdtest.cpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 8th April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -38,16 +38,16 @@ #include "initialise/initgbxs_null.hpp" #include "initialise/initsupers_frombinary.hpp" #include "initialise/timesteps.hpp" -#include "observers2/gbxindex_observer.hpp" -#include "observers2/massmoments_observer.hpp" -#include "observers2/nsupers_observer.hpp" -#include "observers2/observers.hpp" -#include "observers2/runstats_observer.hpp" -#include "observers2/state_observer.hpp" -#include "observers2/streamout_observer.hpp" -#include "observers2/superdrops_observer.hpp" -#include "observers2/time_observer.hpp" -#include "observers2/totnsupers_observer.hpp" +#include "observers/gbxindex_observer.hpp" +#include "observers/massmoments_observer.hpp" +#include "observers/nsupers_observer.hpp" +#include "observers/observers.hpp" +#include "observers/runstats_observer.hpp" +#include "observers/state_observer.hpp" +#include "observers/streamout_observer.hpp" +#include "observers/superdrops_observer.hpp" +#include "observers/time_observer.hpp" +#include "observers/totnsupers_observer.hpp" #include "runcleo/coupleddynamics.hpp" #include "runcleo/couplingcomms.hpp" #include "runcleo/initialconditions.hpp" @@ -59,8 +59,8 @@ #include "superdrops/microphysicalprocess.hpp" #include "superdrops/motion.hpp" #include "superdrops/terminalvelocity.hpp" -#include "zarr2/dataset.hpp" -#include "zarr2/fsstore.hpp" +#include "zarr/dataset.hpp" +#include "zarr/fsstore.hpp" inline CoupledDynamics auto create_coupldyn(const Config &config, const CartesianMaps &gbxmaps, const unsigned int couplstep, diff --git a/examples/yac/divfreemotion/src/CMakeLists.txt b/examples/yac/divfreemotion/src/CMakeLists.txt index 633f59f5d..12c335194 100644 --- a/examples/yac/divfreemotion/src/CMakeLists.txt +++ b/examples/yac/divfreemotion/src/CMakeLists.txt @@ -9,7 +9,7 @@ project("divfreemotion_yac") message("PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}") # Set libraries from CLEO to link with executable -set(CLEOLIBS gridboxes initialise observers2 runcleo superdrops zarr2) +set(CLEOLIBS gridboxes initialise observers runcleo superdrops zarr) # create primary executable for CLEO in 2-D coupled to thermodynamics from file setup add_executable(divfree2D_yac EXCLUDE_FROM_ALL "main_divfree2D.cpp") diff --git a/examples/yac/divfreemotion/src/main_divfree2D.cpp b/examples/yac/divfreemotion/src/main_divfree2D.cpp index 2eb9ff7f6..1b5fde3b0 100644 --- a/examples/yac/divfreemotion/src/main_divfree2D.cpp +++ b/examples/yac/divfreemotion/src/main_divfree2D.cpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 8th April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -38,11 +38,11 @@ #include "initialise/initgbxs_null.hpp" #include "initialise/initsupers_frombinary.hpp" #include "initialise/timesteps.hpp" -#include "observers2/gbxindex_observer.hpp" -#include "observers2/observers.hpp" -#include "observers2/streamout_observer.hpp" -#include "observers2/superdrops_observer.hpp" -#include "observers2/time_observer.hpp" +#include "observers/gbxindex_observer.hpp" +#include "observers/observers.hpp" +#include "observers/streamout_observer.hpp" +#include "observers/superdrops_observer.hpp" +#include "observers/time_observer.hpp" #include "runcleo/coupleddynamics.hpp" #include "runcleo/couplingcomms.hpp" #include "runcleo/initialconditions.hpp" @@ -50,8 +50,8 @@ #include "runcleo/sdmmethods.hpp" #include "superdrops/microphysicalprocess.hpp" #include "superdrops/motion.hpp" -#include "zarr2/dataset.hpp" -#include "zarr2/fsstore.hpp" +#include "zarr/dataset.hpp" +#include "zarr/fsstore.hpp" inline CoupledDynamics auto create_coupldyn(const Config &config, const CartesianMaps &gbxmaps, const unsigned int couplstep, diff --git a/examples/yac/fromfile/src/CMakeLists.txt b/examples/yac/fromfile/src/CMakeLists.txt index 2186a7389..1122c4e3e 100644 --- a/examples/yac/fromfile/src/CMakeLists.txt +++ b/examples/yac/fromfile/src/CMakeLists.txt @@ -9,7 +9,7 @@ project("yac1") message("PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}") # Set libraries from CLEO to link with executable -set(CLEOLIBS gridboxes initialise observers2 runcleo superdrops zarr2) +set(CLEOLIBS gridboxes initialise observers runcleo superdrops zarr) # create primary executable for CLEO in 2-D coupled to thermodynamics from file setup add_executable(yac1 EXCLUDE_FROM_ALL "main_yac1.cpp") diff --git a/examples/yac/fromfile/src/main_yac1.cpp b/examples/yac/fromfile/src/main_yac1.cpp index 0bd47351b..97fb9567a 100644 --- a/examples/yac/fromfile/src/main_yac1.cpp +++ b/examples/yac/fromfile/src/main_yac1.cpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 8th April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -38,12 +38,12 @@ #include "initialise/initgbxs_null.hpp" #include "initialise/initsupers_frombinary.hpp" #include "initialise/timesteps.hpp" -#include "observers2/gbxindex_observer.hpp" -#include "observers2/observers.hpp" -#include "observers2/state_observer.hpp" -#include "observers2/streamout_observer.hpp" -#include "observers2/superdrops_observer.hpp" -#include "observers2/time_observer.hpp" +#include "observers/gbxindex_observer.hpp" +#include "observers/observers.hpp" +#include "observers/state_observer.hpp" +#include "observers/streamout_observer.hpp" +#include "observers/superdrops_observer.hpp" +#include "observers/time_observer.hpp" #include "runcleo/coupleddynamics.hpp" #include "runcleo/couplingcomms.hpp" #include "runcleo/initialconditions.hpp" @@ -51,8 +51,8 @@ #include "runcleo/sdmmethods.hpp" #include "superdrops/microphysicalprocess.hpp" #include "superdrops/motion.hpp" -#include "zarr2/dataset.hpp" -#include "zarr2/fsstore.hpp" +#include "zarr/dataset.hpp" +#include "zarr/fsstore.hpp" inline CoupledDynamics auto create_coupldyn(const Config &config, const CartesianMaps &gbxmaps, const unsigned int couplstep, diff --git a/examples/yac/yac_3d/src/CMakeLists.txt b/examples/yac/yac_3d/src/CMakeLists.txt index b6240235e..f43d4e4df 100644 --- a/examples/yac/yac_3d/src/CMakeLists.txt +++ b/examples/yac/yac_3d/src/CMakeLists.txt @@ -9,7 +9,7 @@ project("yac_3d") message("PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}") # Set libraries from CLEO to link with executable -set(CLEOLIBS gridboxes initialise observers2 runcleo superdrops zarr2) +set(CLEOLIBS gridboxes initialise observers runcleo superdrops zarr) # create primary executable for CLEO in 2-D coupled to thermodynamics from file setup add_executable(yac_3d EXCLUDE_FROM_ALL "main_yac1.cpp") diff --git a/examples/yac/yac_3d/src/main_yac1.cpp b/examples/yac/yac_3d/src/main_yac1.cpp index cfba3e601..4a94ecc1a 100644 --- a/examples/yac/yac_3d/src/main_yac1.cpp +++ b/examples/yac/yac_3d/src/main_yac1.cpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 8th April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -38,12 +38,12 @@ #include "initialise/initgbxs_null.hpp" #include "initialise/initsupers_frombinary.hpp" #include "initialise/timesteps.hpp" -#include "observers2/gbxindex_observer.hpp" -#include "observers2/observers.hpp" -#include "observers2/state_observer.hpp" -#include "observers2/streamout_observer.hpp" -#include "observers2/superdrops_observer.hpp" -#include "observers2/time_observer.hpp" +#include "observers/gbxindex_observer.hpp" +#include "observers/observers.hpp" +#include "observers/state_observer.hpp" +#include "observers/streamout_observer.hpp" +#include "observers/superdrops_observer.hpp" +#include "observers/time_observer.hpp" #include "runcleo/coupleddynamics.hpp" #include "runcleo/couplingcomms.hpp" #include "runcleo/initialconditions.hpp" @@ -51,8 +51,8 @@ #include "runcleo/sdmmethods.hpp" #include "superdrops/microphysicalprocess.hpp" #include "superdrops/motion.hpp" -#include "zarr2/dataset.hpp" -#include "zarr2/fsstore.hpp" +#include "zarr/dataset.hpp" +#include "zarr/fsstore.hpp" inline CoupledDynamics auto create_coupldyn(const Config &config, const CartesianMaps &gbxmaps, const unsigned int couplstep, diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt index 65747488d..77635d54d 100644 --- a/libs/CMakeLists.txt +++ b/libs/CMakeLists.txt @@ -8,8 +8,8 @@ add_subdirectory(gridboxes) add_subdirectory(initialise) add_subdirectory(runcleo) add_subdirectory(superdrops) -add_subdirectory(zarr2) -add_subdirectory(observers2) +add_subdirectory(zarr) +add_subdirectory(observers) # libraries particular to certain CLEO configurations # add_subdirectory(coupldyn_cvode EXCLUDE_FROM_ALL) diff --git a/libs/runcleo/CMakeLists.txt b/libs/runcleo/CMakeLists.txt index 459491943..10207237c 100644 --- a/libs/runcleo/CMakeLists.txt +++ b/libs/runcleo/CMakeLists.txt @@ -23,7 +23,7 @@ target_include_directories(${LIBNAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") target_include_directories(${LIBNAME} PRIVATE "${CMAKE_SOURCE_DIR}/libs") # CLEO libs directory # Link libraries to target library -set(LINKLIBS gridboxes observers2 superdrops zarr2) +set(LINKLIBS gridboxes observers superdrops zarr) target_link_libraries(${LIBNAME} PUBLIC "${LINKLIBS}") target_link_libraries(${LIBNAME} PUBLIC Kokkos::kokkos) diff --git a/libs/runcleo/runcleo.hpp b/libs/runcleo/runcleo.hpp index 4bed1cf57..ca2917c0b 100644 --- a/libs/runcleo/runcleo.hpp +++ b/libs/runcleo/runcleo.hpp @@ -8,7 +8,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: Tobias Kölling (TK) * ----- - * Last Modified: Wednesday 3rd April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -41,7 +41,7 @@ #include "gridboxes/gridbox.hpp" #include "gridboxes/gridboxmaps.hpp" #include "gridboxes/movesupersindomain.hpp" -#include "observers2/observers.hpp" +#include "observers/observers.hpp" #include "superdrops/microphysicalprocess.hpp" #include "superdrops/motion.hpp" #include "superdrops/superdrop.hpp" diff --git a/libs/runcleo/sdmmethods.hpp b/libs/runcleo/sdmmethods.hpp index 15257631a..fe5622cc1 100644 --- a/libs/runcleo/sdmmethods.hpp +++ b/libs/runcleo/sdmmethods.hpp @@ -8,7 +8,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: Tobias Kölling (TK) * ----- - * Last Modified: Wednesday 3rd April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -31,7 +31,7 @@ #include "gridboxes/gridbox.hpp" #include "gridboxes/gridboxmaps.hpp" #include "gridboxes/movesupersindomain.hpp" -#include "observers2/observers.hpp" +#include "observers/observers.hpp" #include "superdrops/microphysicalprocess.hpp" #include "superdrops/motion.hpp" #include "superdrops/superdrop.hpp" diff --git a/roughpaper/CMakeLists.txt b/roughpaper/CMakeLists.txt index 6eac94c52..c8b6ae5e5 100644 --- a/roughpaper/CMakeLists.txt +++ b/roughpaper/CMakeLists.txt @@ -13,7 +13,7 @@ message("${PROJECT_NAME} PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -g -gdwarf-4") # Set libraries from CLEO to link with executable -set(CLEOLIBS coupldyn_fromfile cartesiandomain gridboxes initialise runcleo superdrops zarr2 observers2) +set(CLEOLIBS coupldyn_fromfile cartesiandomain gridboxes initialise runcleo superdrops zarr observers) # create primary executable "test" add_executable(test main.cpp) diff --git a/roughpaper/main.cpp b/roughpaper/main.cpp index 24bb3365e..67bb64b27 100644 --- a/roughpaper/main.cpp +++ b/roughpaper/main.cpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 8th April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -33,18 +33,18 @@ #include "initialise/initgbxs_null.hpp" #include "initialise/initsupers_frombinary.hpp" #include "initialise/timesteps.hpp" -#include "observers2/gbxindex_observer.hpp" -#include "observers2/massmoments_observer.hpp" -#include "observers2/nsupers_observer.hpp" -#include "observers2/observers.hpp" -#include "observers2/runstats_observer.hpp" -#include "observers2/state_observer.hpp" -#include "observers2/streamout_observer.hpp" -#include "observers2/superdrops_observer.hpp" -#include "observers2/thermo_observer.hpp" -#include "observers2/time_observer.hpp" -#include "observers2/totnsupers_observer.hpp" -#include "observers2/windvel_observer.hpp" +#include "observers/gbxindex_observer.hpp" +#include "observers/massmoments_observer.hpp" +#include "observers/nsupers_observer.hpp" +#include "observers/observers.hpp" +#include "observers/runstats_observer.hpp" +#include "observers/state_observer.hpp" +#include "observers/streamout_observer.hpp" +#include "observers/superdrops_observer.hpp" +#include "observers/thermo_observer.hpp" +#include "observers/time_observer.hpp" +#include "observers/totnsupers_observer.hpp" +#include "observers/windvel_observer.hpp" #include "runcleo/coupleddynamics.hpp" #include "runcleo/couplingcomms.hpp" #include "runcleo/initialconditions.hpp" @@ -52,8 +52,8 @@ #include "runcleo/sdmmethods.hpp" #include "superdrops/microphysicalprocess.hpp" #include "superdrops/motion.hpp" -#include "zarr2/dataset.hpp" -#include "zarr2/fsstore.hpp" +#include "zarr/dataset.hpp" +#include "zarr/fsstore.hpp" template inline Observer auto create_superdrops_observer(const Config &config, const Timesteps &tsteps, diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 350e8d8a1..e2e45588c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,7 +8,7 @@ project("cleocoupledsdm") message("${PROJECT_NAME} PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}") # Set libraries from CLEO to link with executable -set(CLEOLIBS gridboxes initialise observers2 runcleo superdrops zarr2) +set(CLEOLIBS gridboxes initialise observers runcleo superdrops zarr) # create primary executable "cleocoupledsdm" for cleo sdm coupled to dynamics solver add_executable(cleocoupledsdm main.cpp) diff --git a/src/main.cpp b/src/main.cpp index 8f0a29a8a..98b095a69 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -39,16 +39,16 @@ #include "initialise/initgbxs_null.hpp" #include "initialise/initsupers_frombinary.hpp" #include "initialise/timesteps.hpp" -#include "observers2/gbxindex_observer.hpp" -#include "observers2/massmoments_observer.hpp" -#include "observers2/nsupers_observer.hpp" -#include "observers2/observers.hpp" -#include "observers2/runstats_observer.hpp" -#include "observers2/state_observer.hpp" -#include "observers2/streamout_observer.hpp" -#include "observers2/superdrops_observer.hpp" -#include "observers2/time_observer.hpp" -#include "observers2/totnsupers_observer.hpp" +#include "observers/gbxindex_observer.hpp" +#include "observers/massmoments_observer.hpp" +#include "observers/nsupers_observer.hpp" +#include "observers/observers.hpp" +#include "observers/runstats_observer.hpp" +#include "observers/state_observer.hpp" +#include "observers/streamout_observer.hpp" +#include "observers/superdrops_observer.hpp" +#include "observers/time_observer.hpp" +#include "observers/totnsupers_observer.hpp" #include "runcleo/coupleddynamics.hpp" #include "runcleo/couplingcomms.hpp" #include "runcleo/initialconditions.hpp" @@ -67,8 +67,8 @@ #include "superdrops/microphysicalprocess.hpp" #include "superdrops/motion.hpp" #include "superdrops/terminalvelocity.hpp" -#include "zarr2/dataset.hpp" -#include "zarr2/fsstore.hpp" +#include "zarr/dataset.hpp" +#include "zarr/fsstore.hpp" inline CoupledDynamics auto create_coupldyn(const Config &config, const CartesianMaps &gbxmaps, const unsigned int couplstep, From cfb0666123c1c0ee7b58cd33702f98e7724cf2d6 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Tue, 9 Apr 2024 14:09:31 +0200 Subject: [PATCH 03/35] draft rst files for observers --- .../cxx/observers/collect_data_for_dataset.rst | 12 ++++++++++++ docs/source/cxx/observers/gbxindex_observer.rst | 12 ++++++++++++ .../source/cxx/observers/generic_collect_data.rst | 12 ++++++++++++ .../source/cxx/observers/massmoments_observer.rst | 12 ++++++++++++ docs/source/cxx/observers/nsupers_observer.rst | 12 ++++++++++++ docs/source/cxx/observers/observersmod.rst | 15 +++++++++++++++ docs/source/cxx/observers/parallel_write_data.rst | 12 ++++++++++++ docs/source/cxx/observers/runstats_observer.rst | 12 ++++++++++++ docs/source/cxx/observers/state_observer.rst | 12 ++++++++++++ docs/source/cxx/observers/streamout_observer.rst | 12 ++++++++++++ docs/source/cxx/observers/superdrops_observer.rst | 12 ++++++++++++ docs/source/cxx/observers/thermo_observer.rst | 12 ++++++++++++ docs/source/cxx/observers/time_observer.rst | 12 ++++++++++++ docs/source/cxx/observers/totnsupers_observer.rst | 12 ++++++++++++ docs/source/cxx/observers/windvel_observer.rst | 12 ++++++++++++ .../cxx/observers/write_to_dataset_observer.rst | 12 ++++++++++++ 16 files changed, 195 insertions(+) create mode 100644 docs/source/cxx/observers/collect_data_for_dataset.rst create mode 100644 docs/source/cxx/observers/gbxindex_observer.rst create mode 100644 docs/source/cxx/observers/generic_collect_data.rst create mode 100644 docs/source/cxx/observers/massmoments_observer.rst create mode 100644 docs/source/cxx/observers/nsupers_observer.rst create mode 100644 docs/source/cxx/observers/parallel_write_data.rst create mode 100644 docs/source/cxx/observers/runstats_observer.rst create mode 100644 docs/source/cxx/observers/state_observer.rst create mode 100644 docs/source/cxx/observers/streamout_observer.rst create mode 100644 docs/source/cxx/observers/superdrops_observer.rst create mode 100644 docs/source/cxx/observers/thermo_observer.rst create mode 100644 docs/source/cxx/observers/time_observer.rst create mode 100644 docs/source/cxx/observers/totnsupers_observer.rst create mode 100644 docs/source/cxx/observers/windvel_observer.rst create mode 100644 docs/source/cxx/observers/write_to_dataset_observer.rst diff --git a/docs/source/cxx/observers/collect_data_for_dataset.rst b/docs/source/cxx/observers/collect_data_for_dataset.rst new file mode 100644 index 000000000..70e8a91e8 --- /dev/null +++ b/docs/source/cxx/observers/collect_data_for_dataset.rst @@ -0,0 +1,12 @@ +XXX Observer +============ + +Header file: ```` +`[source] `_ + +.. doxygenstruct:: XXXObserver + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: diff --git a/docs/source/cxx/observers/gbxindex_observer.rst b/docs/source/cxx/observers/gbxindex_observer.rst new file mode 100644 index 000000000..70e8a91e8 --- /dev/null +++ b/docs/source/cxx/observers/gbxindex_observer.rst @@ -0,0 +1,12 @@ +XXX Observer +============ + +Header file: ```` +`[source] `_ + +.. doxygenstruct:: XXXObserver + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: diff --git a/docs/source/cxx/observers/generic_collect_data.rst b/docs/source/cxx/observers/generic_collect_data.rst new file mode 100644 index 000000000..70e8a91e8 --- /dev/null +++ b/docs/source/cxx/observers/generic_collect_data.rst @@ -0,0 +1,12 @@ +XXX Observer +============ + +Header file: ```` +`[source] `_ + +.. doxygenstruct:: XXXObserver + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: diff --git a/docs/source/cxx/observers/massmoments_observer.rst b/docs/source/cxx/observers/massmoments_observer.rst new file mode 100644 index 000000000..70e8a91e8 --- /dev/null +++ b/docs/source/cxx/observers/massmoments_observer.rst @@ -0,0 +1,12 @@ +XXX Observer +============ + +Header file: ```` +`[source] `_ + +.. doxygenstruct:: XXXObserver + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: diff --git a/docs/source/cxx/observers/nsupers_observer.rst b/docs/source/cxx/observers/nsupers_observer.rst new file mode 100644 index 000000000..70e8a91e8 --- /dev/null +++ b/docs/source/cxx/observers/nsupers_observer.rst @@ -0,0 +1,12 @@ +XXX Observer +============ + +Header file: ```` +`[source] `_ + +.. doxygenstruct:: XXXObserver + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: diff --git a/docs/source/cxx/observers/observersmod.rst b/docs/source/cxx/observers/observersmod.rst index f348c3532..37e5189ce 100644 --- a/docs/source/cxx/observers/observersmod.rst +++ b/docs/source/cxx/observers/observersmod.rst @@ -14,3 +14,18 @@ e.g. to a dataset or to a computer screen. :caption: Contents: observers + streamout_observer + runstats_observer.rst + write_to_dataset_observer.rst + parallel_write_data.rst + collect_data_for_dataset.rst + generic_collect_data.rst + time_observer.rst + gbxindex_observer.rst + superdrops_observer.rst + nsupers_observer.rst + totnsupers_observer.rst + state_observer.rst + thermo_observer.rst + windvel_observer.rst + massmoments_observer.rst diff --git a/docs/source/cxx/observers/parallel_write_data.rst b/docs/source/cxx/observers/parallel_write_data.rst new file mode 100644 index 000000000..70e8a91e8 --- /dev/null +++ b/docs/source/cxx/observers/parallel_write_data.rst @@ -0,0 +1,12 @@ +XXX Observer +============ + +Header file: ```` +`[source] `_ + +.. doxygenstruct:: XXXObserver + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: diff --git a/docs/source/cxx/observers/runstats_observer.rst b/docs/source/cxx/observers/runstats_observer.rst new file mode 100644 index 000000000..70e8a91e8 --- /dev/null +++ b/docs/source/cxx/observers/runstats_observer.rst @@ -0,0 +1,12 @@ +XXX Observer +============ + +Header file: ```` +`[source] `_ + +.. doxygenstruct:: XXXObserver + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: diff --git a/docs/source/cxx/observers/state_observer.rst b/docs/source/cxx/observers/state_observer.rst new file mode 100644 index 000000000..70e8a91e8 --- /dev/null +++ b/docs/source/cxx/observers/state_observer.rst @@ -0,0 +1,12 @@ +XXX Observer +============ + +Header file: ```` +`[source] `_ + +.. doxygenstruct:: XXXObserver + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: diff --git a/docs/source/cxx/observers/streamout_observer.rst b/docs/source/cxx/observers/streamout_observer.rst new file mode 100644 index 000000000..effbdb51c --- /dev/null +++ b/docs/source/cxx/observers/streamout_observer.rst @@ -0,0 +1,12 @@ +StreamOut Observer +================== + +Header file: ```` +`[source] `_ + +.. doxygenstruct:: StreamOutObserver + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: diff --git a/docs/source/cxx/observers/superdrops_observer.rst b/docs/source/cxx/observers/superdrops_observer.rst new file mode 100644 index 000000000..70e8a91e8 --- /dev/null +++ b/docs/source/cxx/observers/superdrops_observer.rst @@ -0,0 +1,12 @@ +XXX Observer +============ + +Header file: ```` +`[source] `_ + +.. doxygenstruct:: XXXObserver + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: diff --git a/docs/source/cxx/observers/thermo_observer.rst b/docs/source/cxx/observers/thermo_observer.rst new file mode 100644 index 000000000..70e8a91e8 --- /dev/null +++ b/docs/source/cxx/observers/thermo_observer.rst @@ -0,0 +1,12 @@ +XXX Observer +============ + +Header file: ```` +`[source] `_ + +.. doxygenstruct:: XXXObserver + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: diff --git a/docs/source/cxx/observers/time_observer.rst b/docs/source/cxx/observers/time_observer.rst new file mode 100644 index 000000000..70e8a91e8 --- /dev/null +++ b/docs/source/cxx/observers/time_observer.rst @@ -0,0 +1,12 @@ +XXX Observer +============ + +Header file: ```` +`[source] `_ + +.. doxygenstruct:: XXXObserver + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: diff --git a/docs/source/cxx/observers/totnsupers_observer.rst b/docs/source/cxx/observers/totnsupers_observer.rst new file mode 100644 index 000000000..70e8a91e8 --- /dev/null +++ b/docs/source/cxx/observers/totnsupers_observer.rst @@ -0,0 +1,12 @@ +XXX Observer +============ + +Header file: ```` +`[source] `_ + +.. doxygenstruct:: XXXObserver + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: diff --git a/docs/source/cxx/observers/windvel_observer.rst b/docs/source/cxx/observers/windvel_observer.rst new file mode 100644 index 000000000..70e8a91e8 --- /dev/null +++ b/docs/source/cxx/observers/windvel_observer.rst @@ -0,0 +1,12 @@ +XXX Observer +============ + +Header file: ```` +`[source] `_ + +.. doxygenstruct:: XXXObserver + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: diff --git a/docs/source/cxx/observers/write_to_dataset_observer.rst b/docs/source/cxx/observers/write_to_dataset_observer.rst new file mode 100644 index 000000000..70e8a91e8 --- /dev/null +++ b/docs/source/cxx/observers/write_to_dataset_observer.rst @@ -0,0 +1,12 @@ +XXX Observer +============ + +Header file: ```` +`[source] `_ + +.. doxygenstruct:: XXXObserver + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: From 4f970148622e18c41dec7052702f4be727566f6e Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Tue, 9 Apr 2024 14:10:42 +0200 Subject: [PATCH 04/35] todo notes added --- docs/source/cxx/observers/collect_data_for_dataset.rst | 2 ++ docs/source/cxx/observers/gbxindex_observer.rst | 2 ++ docs/source/cxx/observers/generic_collect_data.rst | 2 ++ docs/source/cxx/observers/massmoments_observer.rst | 2 ++ docs/source/cxx/observers/nsupers_observer.rst | 2 ++ docs/source/cxx/observers/parallel_write_data.rst | 2 ++ docs/source/cxx/observers/runstats_observer.rst | 2 ++ docs/source/cxx/observers/state_observer.rst | 2 ++ docs/source/cxx/observers/superdrops_observer.rst | 2 ++ docs/source/cxx/observers/thermo_observer.rst | 2 ++ docs/source/cxx/observers/time_observer.rst | 2 ++ docs/source/cxx/observers/totnsupers_observer.rst | 2 ++ docs/source/cxx/observers/windvel_observer.rst | 2 ++ docs/source/cxx/observers/write_to_dataset_observer.rst | 2 ++ 14 files changed, 28 insertions(+) diff --git a/docs/source/cxx/observers/collect_data_for_dataset.rst b/docs/source/cxx/observers/collect_data_for_dataset.rst index 70e8a91e8..cb0f6b088 100644 --- a/docs/source/cxx/observers/collect_data_for_dataset.rst +++ b/docs/source/cxx/observers/collect_data_for_dataset.rst @@ -1,6 +1,8 @@ XXX Observer ============ +// TODO(CB) write doc + Header file: ```` `[source] `_ diff --git a/docs/source/cxx/observers/gbxindex_observer.rst b/docs/source/cxx/observers/gbxindex_observer.rst index 70e8a91e8..cb0f6b088 100644 --- a/docs/source/cxx/observers/gbxindex_observer.rst +++ b/docs/source/cxx/observers/gbxindex_observer.rst @@ -1,6 +1,8 @@ XXX Observer ============ +// TODO(CB) write doc + Header file: ```` `[source] `_ diff --git a/docs/source/cxx/observers/generic_collect_data.rst b/docs/source/cxx/observers/generic_collect_data.rst index 70e8a91e8..cb0f6b088 100644 --- a/docs/source/cxx/observers/generic_collect_data.rst +++ b/docs/source/cxx/observers/generic_collect_data.rst @@ -1,6 +1,8 @@ XXX Observer ============ +// TODO(CB) write doc + Header file: ```` `[source] `_ diff --git a/docs/source/cxx/observers/massmoments_observer.rst b/docs/source/cxx/observers/massmoments_observer.rst index 70e8a91e8..cb0f6b088 100644 --- a/docs/source/cxx/observers/massmoments_observer.rst +++ b/docs/source/cxx/observers/massmoments_observer.rst @@ -1,6 +1,8 @@ XXX Observer ============ +// TODO(CB) write doc + Header file: ```` `[source] `_ diff --git a/docs/source/cxx/observers/nsupers_observer.rst b/docs/source/cxx/observers/nsupers_observer.rst index 70e8a91e8..cb0f6b088 100644 --- a/docs/source/cxx/observers/nsupers_observer.rst +++ b/docs/source/cxx/observers/nsupers_observer.rst @@ -1,6 +1,8 @@ XXX Observer ============ +// TODO(CB) write doc + Header file: ```` `[source] `_ diff --git a/docs/source/cxx/observers/parallel_write_data.rst b/docs/source/cxx/observers/parallel_write_data.rst index 70e8a91e8..cb0f6b088 100644 --- a/docs/source/cxx/observers/parallel_write_data.rst +++ b/docs/source/cxx/observers/parallel_write_data.rst @@ -1,6 +1,8 @@ XXX Observer ============ +// TODO(CB) write doc + Header file: ```` `[source] `_ diff --git a/docs/source/cxx/observers/runstats_observer.rst b/docs/source/cxx/observers/runstats_observer.rst index 70e8a91e8..cb0f6b088 100644 --- a/docs/source/cxx/observers/runstats_observer.rst +++ b/docs/source/cxx/observers/runstats_observer.rst @@ -1,6 +1,8 @@ XXX Observer ============ +// TODO(CB) write doc + Header file: ```` `[source] `_ diff --git a/docs/source/cxx/observers/state_observer.rst b/docs/source/cxx/observers/state_observer.rst index 70e8a91e8..cb0f6b088 100644 --- a/docs/source/cxx/observers/state_observer.rst +++ b/docs/source/cxx/observers/state_observer.rst @@ -1,6 +1,8 @@ XXX Observer ============ +// TODO(CB) write doc + Header file: ```` `[source] `_ diff --git a/docs/source/cxx/observers/superdrops_observer.rst b/docs/source/cxx/observers/superdrops_observer.rst index 70e8a91e8..cb0f6b088 100644 --- a/docs/source/cxx/observers/superdrops_observer.rst +++ b/docs/source/cxx/observers/superdrops_observer.rst @@ -1,6 +1,8 @@ XXX Observer ============ +// TODO(CB) write doc + Header file: ```` `[source] `_ diff --git a/docs/source/cxx/observers/thermo_observer.rst b/docs/source/cxx/observers/thermo_observer.rst index 70e8a91e8..cb0f6b088 100644 --- a/docs/source/cxx/observers/thermo_observer.rst +++ b/docs/source/cxx/observers/thermo_observer.rst @@ -1,6 +1,8 @@ XXX Observer ============ +// TODO(CB) write doc + Header file: ```` `[source] `_ diff --git a/docs/source/cxx/observers/time_observer.rst b/docs/source/cxx/observers/time_observer.rst index 70e8a91e8..cb0f6b088 100644 --- a/docs/source/cxx/observers/time_observer.rst +++ b/docs/source/cxx/observers/time_observer.rst @@ -1,6 +1,8 @@ XXX Observer ============ +// TODO(CB) write doc + Header file: ```` `[source] `_ diff --git a/docs/source/cxx/observers/totnsupers_observer.rst b/docs/source/cxx/observers/totnsupers_observer.rst index 70e8a91e8..cb0f6b088 100644 --- a/docs/source/cxx/observers/totnsupers_observer.rst +++ b/docs/source/cxx/observers/totnsupers_observer.rst @@ -1,6 +1,8 @@ XXX Observer ============ +// TODO(CB) write doc + Header file: ```` `[source] `_ diff --git a/docs/source/cxx/observers/windvel_observer.rst b/docs/source/cxx/observers/windvel_observer.rst index 70e8a91e8..cb0f6b088 100644 --- a/docs/source/cxx/observers/windvel_observer.rst +++ b/docs/source/cxx/observers/windvel_observer.rst @@ -1,6 +1,8 @@ XXX Observer ============ +// TODO(CB) write doc + Header file: ```` `[source] `_ diff --git a/docs/source/cxx/observers/write_to_dataset_observer.rst b/docs/source/cxx/observers/write_to_dataset_observer.rst index 70e8a91e8..cb0f6b088 100644 --- a/docs/source/cxx/observers/write_to_dataset_observer.rst +++ b/docs/source/cxx/observers/write_to_dataset_observer.rst @@ -1,6 +1,8 @@ XXX Observer ============ +// TODO(CB) write doc + Header file: ```` `[source] `_ From 3eb62286505a23aa5c9b43375233757eaf972122 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Tue, 9 Apr 2024 15:09:13 +0200 Subject: [PATCH 05/35] docs(streamoutobserver): for stream out observer --- libs/observers/streamout_observer.cpp | 16 ++++++- libs/observers/streamout_observer.hpp | 62 ++++++++++++++++++++++++--- 2 files changed, 70 insertions(+), 8 deletions(-) diff --git a/libs/observers/streamout_observer.cpp b/libs/observers/streamout_observer.cpp index 557fddd5c..2838bd12a 100644 --- a/libs/observers/streamout_observer.cpp +++ b/libs/observers/streamout_observer.cpp @@ -23,8 +23,20 @@ #include "observers/streamout_observer.hpp" -void StreamOutObserver::print_statement(const unsigned int t_mdl, - const viewd_constgbx d_gbxs) const { +/** + * @brief 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. + * + * @param t_mdl Current model time. + * @param d_gbxs View of the gridboxes on the device. + */ +void StreamOutObserver::streamout_statement(const unsigned int t_mdl, + const viewd_constgbx d_gbxs) const { /* copy first gridbox into mirror view in case Gridboxes view is in device memory */ auto d_gbx = Kokkos::subview(d_gbxs, kkpair_size_t({0, 1})); auto h_gbx = Kokkos::create_mirror_view_and_copy(HostSpace(), d_gbx); diff --git a/libs/observers/streamout_observer.hpp b/libs/observers/streamout_observer.hpp index 6ce0e5c12..cdccbc33b 100644 --- a/libs/observers/streamout_observer.hpp +++ b/libs/observers/streamout_observer.hpp @@ -17,7 +17,7 @@ * ----- * File Description: * Struct satisfies observer type and streams out live data to an output device - * (e.g. computer screen) about the state of gridboxes during every observation + * (e.g. computer screen) about gridboxes during every observation * at fixed 'interval' timesteps. */ @@ -37,35 +37,85 @@ namespace dlc = dimless_constants; +/** + * @struct StreamOutObserver + * @brief Struct that satisfies the observer type and streams out live data to an output device + * (e.g. computer screen) about gridboxes during every observation at fixed 'interval' timesteps. + */ struct StreamOutObserver { private: - unsigned int interval; // timestep between print statements - std::function step2realtime; // function to convert timesteps to real time + unsigned int interval; /**< Timestep between output events. */ + std::function + step2realtime; /**< Function to convert model timesteps to real time. */ - void print_statement(const unsigned int t_mdl, const viewd_constgbx d_gbxs) const; + /** + * @brief 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. + * + * @param t_mdl Current model time. + * @param d_gbxs View of the gridboxes on the device. + */ + void streamout_statement(const unsigned int t_mdl, const viewd_constgbx d_gbxs) const; public: + /** + * @brief Constructor for StreamOutObserver. + * @param obsstep Interval in model timesteps between observation events. + * @param step2realtime Function to convert model timesteps to real time. + */ StreamOutObserver(const unsigned int obsstep, const std::function step2realtime) : interval(obsstep), step2realtime(step2realtime) {} + /** + * @brief Function called before timestepping. + * @param d_gbxs View of grid boxes. + */ void before_timestepping(const viewd_constgbx d_gbxs) const { std::cout << "observer includes StreamOutObserver\n"; } + /** + * @brief Function called after timestepping. + */ void after_timestepping() const {} + /** + * @brief Calculate the next observation timestep based on the current model timestep and the + * fixed interval between observations for this observer. + * @param t_mdl Current model timestep. + * @return Next observation timestep. + */ unsigned int next_obs(const unsigned int t_mdl) const { return ((t_mdl / interval) + 1) * interval; } + /** + * @brief Check if the current timestep is an observation timestep. + * @param t_mdl Current model time. + * @return True if the current timestep is an observation timestep, false otherwise. + */ bool on_step(const unsigned int t_mdl) const { return t_mdl % interval == 0; } - /* observe Gridboxes (copy to host) at start of timestep */ + /** + * @brief 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. + * + * @param t_mdl Current model time. + * @param d_gbxs View of grid boxes. + * @param totsupers View of super grids. + */ void at_start_step(const unsigned int t_mdl, const viewd_constgbx d_gbxs, const viewd_constsupers totsupers) const { if (on_step(t_mdl)) { - print_statement(t_mdl, d_gbxs); + streamout_statement(t_mdl, d_gbxs); } } }; From 96a6734c58b0edca5c4b9bc538e3271795011dd1 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Tue, 9 Apr 2024 18:50:30 +0200 Subject: [PATCH 06/35] docs(observers): runstats docs --- .../cxx/observers/runstats_observer.rst | 17 ++-- libs/observers/observers.hpp | 14 +-- libs/observers/runstats_observer.cpp | 10 +- libs/observers/runstats_observer.hpp | 97 +++++++++++++++---- libs/observers/streamout_observer.hpp | 20 ++-- 5 files changed, 119 insertions(+), 39 deletions(-) diff --git a/docs/source/cxx/observers/runstats_observer.rst b/docs/source/cxx/observers/runstats_observer.rst index cb0f6b088..fcf2ed3bf 100644 --- a/docs/source/cxx/observers/runstats_observer.rst +++ b/docs/source/cxx/observers/runstats_observer.rst @@ -1,12 +1,17 @@ -XXX Observer -============ +RunStatsObserver +================ -// TODO(CB) write doc +Header file: ```` +`[source] `_ -Header file: ```` -`[source] `_ +.. doxygenstruct:: RunStats + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: -.. doxygenstruct:: XXXObserver +.. doxygenclass:: RunStatsObserver :project: observers :private-members: :protected-members: diff --git a/libs/observers/observers.hpp b/libs/observers/observers.hpp index 10c57c95b..eef716904 100644 --- a/libs/observers/observers.hpp +++ b/libs/observers/observers.hpp @@ -253,23 +253,23 @@ struct ConstTstepObserver { /** * @brief Determine the next observation time. * - * Calculates the next observation time based on the current model time and the constant - * timestep between observations, 'interval'. + * Calculates the next observation time based on the current model time and this observer's + * constant timestep between observations, 'interval'. * - * @param t_mdl The unsigned int parameter representing the current model time. - * @return Unsigned int for the next observation time. + * @param t_mdl The unsigned int parameter representing the current model timestep. + * @return Unsigned int for the next observation timestep. */ unsigned int next_obs(const unsigned int t_mdl) const { return ((t_mdl / interval) + 1) * interval; } /** - * @brief Check if on step. + * @brief Check if observer is "on step". * * Checks if the current model time is on an observation timestep. * - * @param t_mdl The unsigned int parameter representing the current model time. - * @return bool True if on step, false otherwise. + * @param t_mdl The unsigned int parameter representing the current model timestep. + * @return True if the current timestep is an observation timestep, false otherwise. */ bool on_step(const unsigned int t_mdl) const { return t_mdl % interval == 0; } diff --git a/libs/observers/runstats_observer.cpp b/libs/observers/runstats_observer.cpp index 01a65f71a..00e300501 100644 --- a/libs/observers/runstats_observer.cpp +++ b/libs/observers/runstats_observer.cpp @@ -23,6 +23,9 @@ #include "observers/runstats_observer.hpp" +/** + * @brief Prints a summary of runtime statistics to the terminal window. + */ void RunStatsObserver::print_summary() const { const auto t_start = stats->t_start; const auto t_end = stats->t_end; @@ -34,8 +37,11 @@ void RunStatsObserver::print_summary() const { << "-----------------------------\n"; } -/* open and write some the runtime -statistics to a file called 'statsfile' */ +/** + * @brief Writes out some of the runtime statistics to a file. + * + * Writes timing statistics out to a text file called stats_filename. + */ void RunStatsObserver::write_to_file() const { std::ofstream file(stats_filename); diff --git a/libs/observers/runstats_observer.hpp b/libs/observers/runstats_observer.hpp index 6dfe12ee4..a11478cf6 100644 --- a/libs/observers/runstats_observer.hpp +++ b/libs/observers/runstats_observer.hpp @@ -36,64 +36,127 @@ #include "../kokkosaliases.hpp" #include "gridboxes/gridbox.hpp" +/** + * @struct RunStats + * @brief Structure to hold runtime statistics. + */ struct RunStats { private: Kokkos::Timer kokkostimer; public: - double t0; // time of observer creation - double t_start; // time of before timestepping run - double t_end; // time of end of timestepping + double t0; /**< Time of observer creation. */ + double t_start; /**< Time before timestepping run. */ + double t_end; /**< Time at the end of timestepping. */ + /** + * @brief Constructor for RunStats. + */ RunStats() : kokkostimer(Kokkos::Timer()), t0(0.0), t_start(0.0), t_end(0.0) { t0 = kokkostimer.seconds(); } - /* returns tiem elapsed since t0 [s] */ + /** + * @brief Returns time elapsed since kokkostimer was at time=t0. + * @return Time elapsed since t0 in seconds. + */ double time_elapsed() const { return kokkostimer.seconds() - t0; } }; +/** + * @class RunStatsObserver + * @brief Class that satisfies the observer concept and makes and + * outputs runtime performance statistics. + */ class RunStatsObserver { private: - unsigned int interval; // timestep between runtime observations - std::shared_ptr stats; - std::string stats_filename; - - /* plug function in case of need to functionality at the start of a timestep */ + unsigned int interval; /**< Timestep between runtime observations. */ + std::shared_ptr stats; /**< Pointer to runtime statistics. */ + std::string stats_filename; /**< Filename to output runtime statistics. */ + + /** + * @brief Function to be executed at the start of each timestep. + * + * Plug function does nothing but exists in case of need to add functionality + * at the start of a timestep. + */ void at_start_step() const {} - /* print out summary of runtime - stats to terminal window */ + /** + * @brief Prints a summary of runtime statistics to the terminal window. + */ void print_summary() const; - /* writes out some of the runtime - statistics to the statsfile */ + /** + * @brief Writes out some of the runtime statistics to a file. + * + * Writes timing statistics out to a text file called stats_filename. + */ void write_to_file() const; public: + /** + * @brief Constructor for RunStatsObserver. + * @param obsstep Model timestep between runstats observations. + * @param stats_filename Filename to output run statistics. + */ RunStatsObserver(const unsigned int obsstep, const std::string stats_filename) : interval(obsstep), stats(std::make_shared()), stats_filename(stats_filename) {} - /* record stats before timestepping - e.g. current time */ + /** + * @brief Records statistics before timestepping. + * + * Records time of t_start = time of call to before_timestepping. + * + * @param d_gbxs View of grid boxes. + */ void before_timestepping(const viewd_constgbx d_gbxs) const { stats->t_start = stats->time_elapsed(); } - /* record stats after timestepping - e.g. current time */ + /** + * @brief Records statistics after timestepping. + * + * Records time of t_end = time of call to after_timestepping. + */ void after_timestepping() const { stats->t_end = stats->time_elapsed(); print_summary(); write_to_file(); } + /** + * @brief 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'. + * + * @param t_mdl The unsigned int parameter representing the current model timestep. + * @return Unsigned int for the next observation timestep. + */ unsigned int next_obs(const unsigned int t_mdl) const { return ((t_mdl / interval) + 1) * interval; } + /** + * @brief Check if observer is "on step". + * + * Checks if the current model time is on an observation timestep. + * + * @param t_mdl The unsigned int parameter representing the current model timestep. + * @return True if the current timestep is an observation timestep, false otherwise. + */ bool on_step(const unsigned int t_mdl) const { return t_mdl % interval == 0; } + /** + * @brief Executes statistics functionality at the start of each timestep. + * + * If timestep is on observation step, call the function to make a runstats observation. + * + * @param t_mdl Current model time. + * @param d_gbxs View of grid boxes. + * @param totsupers View of super grids. + */ void at_start_step(const unsigned int t_mdl, const viewd_constgbx d_gbxs, const viewd_constsupers totsupers) const { if (on_step(t_mdl)) { diff --git a/libs/observers/streamout_observer.hpp b/libs/observers/streamout_observer.hpp index cdccbc33b..13c828362 100644 --- a/libs/observers/streamout_observer.hpp +++ b/libs/observers/streamout_observer.hpp @@ -39,7 +39,7 @@ namespace dlc = dimless_constants; /** * @struct StreamOutObserver - * @brief Struct that satisfies the observer type and streams out live data to an output device + * @brief 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. */ struct StreamOutObserver { @@ -86,18 +86,24 @@ struct StreamOutObserver { void after_timestepping() const {} /** - * @brief Calculate the next observation timestep based on the current model timestep and the - * fixed interval between observations for this observer. - * @param t_mdl Current model timestep. - * @return Next observation timestep. + * @brief 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'. + * + * @param t_mdl The unsigned int parameter representing the current model timestep. + * @return Unsigned int for the next observation timestep. */ unsigned int next_obs(const unsigned int t_mdl) const { return ((t_mdl / interval) + 1) * interval; } /** - * @brief Check if the current timestep is an observation timestep. - * @param t_mdl Current model time. + * @brief Check if observer is "on step". + * + * Checks if the current model time is on an observation timestep. + * + * @param t_mdl The unsigned int parameter representing the current model timestep. * @return True if the current timestep is an observation timestep, false otherwise. */ bool on_step(const unsigned int t_mdl) const { return t_mdl % interval == 0; } From 14ee1890f8de16ddb32be67d9cbb1e52bb032f2e Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Tue, 9 Apr 2024 18:55:54 +0200 Subject: [PATCH 07/35] chore: delete TODOs --- docs/source/usage/requirements.rst | 2 +- libs/observers/collect_data_for_dataset.hpp | 22 ++++++++++----------- libs/runcleo/runcleo.hpp | 1 - 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/docs/source/usage/requirements.rst b/docs/source/usage/requirements.rst index 1d0c87919..2ea18e456 100644 --- a/docs/source/usage/requirements.rst +++ b/docs/source/usage/requirements.rst @@ -1,7 +1,7 @@ Requirements ============ -TODO(CB) update requirements with micromambda package installer advice +TODO(CB) update requirements with formating of code? The following requirements ensure CLEO's build, compilation and execution on DKRZ's Levante HPC. If they do not work, diff --git a/libs/observers/collect_data_for_dataset.hpp b/libs/observers/collect_data_for_dataset.hpp index f6286a7dc..e6f8e06be 100644 --- a/libs/observers/collect_data_for_dataset.hpp +++ b/libs/observers/collect_data_for_dataset.hpp @@ -20,8 +20,6 @@ * structs to collect data within parallel loops and write it to arrays in a dataset */ -// TODO(CB) document observers - #ifndef LIBS_OBSERVERS_COLLECT_DATA_FOR_DATASET_HPP_ #define LIBS_OBSERVERS_COLLECT_DATA_FOR_DATASET_HPP_ @@ -40,16 +38,16 @@ * @tparam CDD The type that satisfies the CollectDataForDataset concept. */ template -concept CollectDataForDataset = - requires(CDD cdd, const Dataset &ds, const viewd_constgbx d_gbxs, - const viewd_constsupers totsupers, const size_t sz) { - { cdd.get_functor(d_gbxs, totsupers) }; - { cdd.reallocate_views(sz) } -> std::same_as; - { cdd.write_to_arrays(ds) } -> std::same_as; - { cdd.write_to_ragged_arrays(ds) } -> std::same_as; - { cdd.write_arrayshapes(ds) } -> std::same_as; - { cdd.write_ragged_arrayshapes(ds) } -> std::same_as; - }; +concept CollectDataForDataset = requires(CDD cdd, const Dataset &ds, + const viewd_constgbx d_gbxs, + const viewd_constsupers totsupers, const size_t sz) { + {cdd.get_functor(d_gbxs, totsupers)}; + { cdd.reallocate_views(sz) } -> std::same_as; + { cdd.write_to_arrays(ds) } -> std::same_as; + { cdd.write_to_ragged_arrays(ds) } -> std::same_as; + { cdd.write_arrayshapes(ds) } -> std::same_as; + { cdd.write_ragged_arrayshapes(ds) } -> std::same_as; +}; /** * @brief struct is a new CollectDataForDataset formed from the combination of two structs that diff --git a/libs/runcleo/runcleo.hpp b/libs/runcleo/runcleo.hpp index ca2917c0b..04f07c870 100644 --- a/libs/runcleo/runcleo.hpp +++ b/libs/runcleo/runcleo.hpp @@ -192,7 +192,6 @@ class RunCLEO { * library's `std::min` to find `t_next` (also GPU compatible). * * @see SDMMethods::get_couplstep() - * @see SDMMethods::ObsClass::next_obs() // TODO(CB) fill in and reference "ObsClass" docs */ unsigned int get_next_step(const unsigned int t_mdl) const { const auto next_couplstep = [&, t_mdl]() { From 211bb4c3c183e40c5e4af1ad446080ff3bb99d83 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Tue, 9 Apr 2024 23:19:43 +0200 Subject: [PATCH 08/35] refactor(zarr): docstrings with /* */ not ///< --- libs/zarr/buffer.hpp | 12 ++++++------ libs/zarr/dataset.hpp | 4 ++-- libs/zarr/store_accessor.hpp | 4 ++-- libs/zarr/xarray_zarr_array.hpp | 8 ++++---- libs/zarr/zarr_array.hpp | 16 ++++++++-------- libs/zarr/zarr_group.hpp | 2 +- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/libs/zarr/buffer.hpp b/libs/zarr/buffer.hpp index d6755094b..1d56919b1 100644 --- a/libs/zarr/buffer.hpp +++ b/libs/zarr/buffer.hpp @@ -44,15 +44,15 @@ template struct Buffer { public: - using viewh_buffer = Kokkos::View; /// View of buffer type on host - using subviewh_buffer = Kokkos::Subview; ///< Subview of host view + using viewh_buffer = Kokkos::View; /**< View of buffer type on host */ + using subviewh_buffer = Kokkos::Subview; /**< Subview of host view */ using mirrorviewd_buffer = Kokkos::View; /// mirror view of buffer view on device + ExecSpace>; /**< mirror view of buffer view on device */ private: - const size_t chunksize; ///< Total chunk size = product of shape of chunks - size_t fill; ///< Number of elements of buffer currently filled - viewh_buffer buffer; ///< View for buffer in host memory + const size_t chunksize; /**< Total chunk size = product of shape of chunks */ + size_t fill; /**< Number of elements of buffer currently filled */ + viewh_buffer buffer; /**< View for buffer in host memory */ /** * @brief Parallel loop on host to fill buffer with NaN (numerical limit). diff --git a/libs/zarr/dataset.hpp b/libs/zarr/dataset.hpp index 8720e1d02..f6e072a6f 100644 --- a/libs/zarr/dataset.hpp +++ b/libs/zarr/dataset.hpp @@ -46,9 +46,9 @@ template class Dataset { private: - ZarrGroup group; ///< Reference to the zarr group object. + ZarrGroup group; /**< Reference to the zarr group object. */ std::unordered_map - datasetdims; ///< map from name of each dimension in dataset to their size + datasetdims; /**< map from name of each dimension in dataset to their size */ /** * @brief Adds a dimension to the dataset. diff --git a/libs/zarr/store_accessor.hpp b/libs/zarr/store_accessor.hpp index 698b0761a..54bdda112 100644 --- a/libs/zarr/store_accessor.hpp +++ b/libs/zarr/store_accessor.hpp @@ -42,8 +42,8 @@ */ template struct StoreAccessor { - Store& store; ///< Reference to the store object. - std::string_view key; ///< The key under which data will be stored in the store. + Store& store; /**< Reference to the store object. */ + std::string_view key; /**< The key under which data will be stored in the store. */ /** * @brief Write a range of memory representing unsigned bytes (uint8_t) to the store. diff --git a/libs/zarr/xarray_zarr_array.hpp b/libs/zarr/xarray_zarr_array.hpp index f4c26384f..648b7c0ee 100644 --- a/libs/zarr/xarray_zarr_array.hpp +++ b/libs/zarr/xarray_zarr_array.hpp @@ -221,10 +221,10 @@ template class XarrayZarrArray { private: using viewh_buffer = Buffer::viewh_buffer; - ZarrArray zarr; ///< zarr array in store - std::vector dimnames; ///< ordered list of names of each dimenion of array - std::vector arrayshape; ///< current size of the array along each of its dimensions - size_t last_totnchunks; ///< Number of chunks of array since arrayshape last written + ZarrArray zarr; /**< zarr array in store */ + std::vector dimnames; /**< ordered list of names of each dimenion of array */ + std::vector arrayshape; /**< current size of the array along each of its dimensions */ + size_t last_totnchunks; /**< Number of chunks of array since arrayshape last written */ /** * @brief Sets shape of array along each dimension to be the same size as each of its dimensions diff --git a/libs/zarr/zarr_array.hpp b/libs/zarr/zarr_array.hpp index f98704aad..c9bd7249d 100644 --- a/libs/zarr/zarr_array.hpp +++ b/libs/zarr/zarr_array.hpp @@ -147,14 +147,14 @@ class ZarrArray { private: using viewh_buffer = Buffer::viewh_buffer; using subviewh_buffer = Buffer::subviewh_buffer; - Store& store; ///< store in which to write Zarr array - std::string_view name; ///< Name of array to write in store. - size_t totnchunks; ///< Total number of chunks of array written to store. - size_t totndata; ///< Total number of elements of data in array written to store. - Chunks chunks; ///< Method to write chunks of array in store. - Buffer buffer; ///< Buffer to hold data before writing chunks to store. - std::string part_zarrmetadata; ///< Metadata required for zarr array excluding array's shape - bool is_backend; ///< true if zarr array is a backend of something else e.g. xarray + Store& store; /**< store in which to write Zarr array */ + std::string_view name; /**< Name of array to write in store. */ + size_t totnchunks; /**< Total number of chunks of array written to store. */ + size_t totndata; /**< Total number of elements of data in array written to store. */ + Chunks chunks; /**< Method to write chunks of array in store. */ + Buffer buffer; /**< Buffer to hold data before writing chunks to store. */ + std::string part_zarrmetadata; /**< Metadata required for zarr array excluding array's shape */ + bool is_backend; /**< true if zarr array is a backend of something else e.g. xarray */ /** * @brief Generates the compulsory metadata for the Zarr array .zarray json file. diff --git a/libs/zarr/zarr_group.hpp b/libs/zarr/zarr_group.hpp index 0ac1baed8..25ec2d159 100644 --- a/libs/zarr/zarr_group.hpp +++ b/libs/zarr/zarr_group.hpp @@ -38,7 +38,7 @@ template struct ZarrGroup { public: - Store& store; ///< Reference to the store object. + Store& store; /**< Reference to the store object. */ /** * @brief Constructs a ZarrGroup with the specified store object. From e87357fc5c3e03ca9a69021aba60eb9126a8ecaf Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Tue, 9 Apr 2024 23:28:50 +0200 Subject: [PATCH 09/35] docs(observers): docstrings and rst file for gbxindex observer --- .../cxx/observers/gbxindex_observer.rst | 17 ++-- libs/observers/gbxindex_observer.hpp | 87 ++++++++++++++++--- 2 files changed, 85 insertions(+), 19 deletions(-) diff --git a/docs/source/cxx/observers/gbxindex_observer.rst b/docs/source/cxx/observers/gbxindex_observer.rst index cb0f6b088..aeac027d8 100644 --- a/docs/source/cxx/observers/gbxindex_observer.rst +++ b/docs/source/cxx/observers/gbxindex_observer.rst @@ -1,12 +1,17 @@ -XXX Observer -============ +Gbxindex Observer +================= -// TODO(CB) write doc +Header file: ```` +`[source] `_ -Header file: ```` -`[source] `_ +.. doxygenstruct:: GbxIndexFunctor + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: -.. doxygenstruct:: XXXObserver +.. doxygenclass:: GbxindexObserver :project: observers :private-members: :protected-members: diff --git a/libs/observers/gbxindex_observer.hpp b/libs/observers/gbxindex_observer.hpp index c3fc03854..23908cd3b 100644 --- a/libs/observers/gbxindex_observer.hpp +++ b/libs/observers/gbxindex_observer.hpp @@ -34,28 +34,49 @@ #include "zarr/dataset.hpp" #include "zarr/xarray_zarr_array.hpp" +/** + * @struct GbxIndexFunctor + * @brief Functor for copying gridbox indexes to a view in device memory. + */ struct GbxIndexFunctor { - viewd_constgbx d_gbxs; // view of gridboxes - Buffer::mirrorviewd_buffer - d_data; // mirror view on device for gbxindex of every gridbox - + viewd_constgbx d_gbxs; /**< View of gridboxes. */ + Buffer::mirrorviewd_buffer d_data; /**< Mirror view on device for gridbox indexes. */ + + /** + * @brief Constructor for GbxIndexFunctor. + * @param d_gbxs View of gridboxes on device. + * @param d_data Mirror view on device of memory to copy gridbox indexes into. + */ GbxIndexFunctor(const viewd_constgbx d_gbxs, Buffer::mirrorviewd_buffer d_data) : d_gbxs(d_gbxs), d_data(d_data) {} - // Functor operator to perform copy of gbxindex of each gridbox to d_data in parallel + /** + * @brief Operator is functor for within a Kokkos::parallel_for loop. + * + * Copies a gridbox's gbxindex to d_data view (for each gridbox in parallel). + * + * @param ii index for the gridbox in the d_gbxs and d_data views. + */ KOKKOS_INLINE_FUNCTION void operator()(const size_t ii) const { d_data(ii) = d_gbxs(ii).get_gbxindex(); } }; -/* template observer which writes gbxindex for every gridbox out to a 1-D array -as a coordinate of an xarray dataset */ +/* @class GbxindexObserver + * @brief Observer to output gridbox indexes to a 1-D array as coordinate of an xarray dataset. + * @tparam Store Type of store for the dataset. + */ template class GbxindexObserver { private: - Dataset &dataset; ///< dataset to write gbxindex data to - std::shared_ptr> xzarr_ptr; ///< pointer to gbxindex array - - /* returns a view in the host memor of the gbxindex of every gridbox in d_gbxs */ + Dataset &dataset; /**< Dataset to write gridbox index data to. */ + std::shared_ptr> + xzarr_ptr; /**< Pointer to gridbox index array in dataset. */ + + /** + * @brief Collects gridbox indexes from g_gbxs into a host memory view. + * @param d_gbxs View of the gridboxes in device memory. + * @return View in host memory of gridbox index of every gridbox in d_gbxs. + */ Buffer::viewh_buffer collect_gbxindexes(const viewd_constgbx d_gbxs) const { const size_t ngbxs(d_gbxs.extent(0)); auto h_data = Buffer::viewh_buffer("h_data", ngbxs); @@ -67,6 +88,12 @@ class GbxindexObserver { } public: + /** + * @brief Constructor for GbxindexObserver. + * @param dataset Dataset to write gridbox index data to. + * @param maxchunk Maximum number of elements in a chunk (1-D vector size). + * @param ngbxs Number of gridboxes in final array. + */ GbxindexObserver(Dataset &dataset, const int maxchunk, const size_t ngbxs) : dataset(dataset), xzarr_ptr(std::make_shared>( @@ -75,8 +102,14 @@ class GbxindexObserver { ~GbxindexObserver() { dataset.write_arrayshape(xzarr_ptr); } - /* write the gbxindex of every gridbox in d_gbxs to the gbxindex array in the dataset and assert - the size of the gbxindex dimension in the dataset is correct */ + /** + * @brief Obsevers the gridboxes' gbxindexes before timestepping. + * + * Write the gbxindex of every gridbox in d_gbxs to the gbxindex array in the dataset and assert + * the size of the gbxindex dimension in the dataset is correct. + * + * @param d_gbxs View of gridboxes on device. + */ void before_timestepping(const viewd_constgbx d_gbxs) const { std::cout << "observer includes gbxindex observer\n"; auto h_data = collect_gbxindexes(d_gbxs); @@ -85,13 +118,41 @@ class GbxindexObserver { "inconsistent size of gbxindex data and dataset dimension"); } + /** + * @brief Placeholder for after timestepping functionality and to make class satisfy observer + * concept. + */ void after_timestepping() const {} + /** + * @brief Placeholder for functionality at the start of each timestep and to make class satisfy + * observer concept. + * @param t_mdl Current model timestep. + * @param d_gbxs View of gridboxes on device. + * @param totsupers View of superdrops on device. + */ void at_start_step(const unsigned int t_mdl, const viewd_constgbx d_gbxs, const viewd_constsupers totsupers) const {} + /** + * @brief Returns the timestep of the next observation. + * + * No observation during timestepping so function returns the largest possible timestep (largest + * unsigned integer). + * + * @param t_mdl Current model timestep. + * @return Next observation timestep. + */ unsigned int next_obs(const unsigned int t_mdl) const { return LIMITVALUES::uintmax; } + /** + * @brief Checks if the current timestep is an observation timestep. + * + * No observation during timestepping so function always returns false. + * + * @param t_mdl Current model timestep. + * @return boolean, false. + */ bool on_step(const unsigned int t_mdl) const { return false; } }; From cabd8cca847b5c845963ba0e0014f17a20cca685 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Tue, 9 Apr 2024 23:42:24 +0200 Subject: [PATCH 10/35] docs(observers): docstrings and rst file for time observer --- docs/source/cxx/observers/time_observer.rst | 15 ++--- libs/observers/gbxindex_observer.hpp | 1 + libs/observers/time_observer.hpp | 65 ++++++++++++++++++--- 3 files changed, 65 insertions(+), 16 deletions(-) diff --git a/docs/source/cxx/observers/time_observer.rst b/docs/source/cxx/observers/time_observer.rst index cb0f6b088..d8cbcfdc8 100644 --- a/docs/source/cxx/observers/time_observer.rst +++ b/docs/source/cxx/observers/time_observer.rst @@ -1,14 +1,15 @@ -XXX Observer -============ +Time Observer +============= -// TODO(CB) write doc +Header file: ```` +`[source] `_ -Header file: ```` -`[source] `_ - -.. doxygenstruct:: XXXObserver +.. doxygenclass:: DoTimeObs :project: observers :private-members: :protected-members: :members: :undoc-members: + +.. doxygenfunction:: TimeObserver + :project: observers diff --git a/libs/observers/gbxindex_observer.hpp b/libs/observers/gbxindex_observer.hpp index 23908cd3b..05fdb888d 100644 --- a/libs/observers/gbxindex_observer.hpp +++ b/libs/observers/gbxindex_observer.hpp @@ -112,6 +112,7 @@ class GbxindexObserver { */ void before_timestepping(const viewd_constgbx d_gbxs) const { std::cout << "observer includes gbxindex observer\n"; + auto h_data = collect_gbxindexes(d_gbxs); dataset.write_to_array(xzarr_ptr, h_data); assert((dataset.get_dimension("gbxindex") == h_data.extent(0)) && diff --git a/libs/observers/time_observer.hpp b/libs/observers/time_observer.hpp index 2b41ad82b..b40d487d5 100644 --- a/libs/observers/time_observer.hpp +++ b/libs/observers/time_observer.hpp @@ -16,7 +16,8 @@ * https://opensource.org/licenses/BSD-3-Clause * ----- * File Description: - * Observer to output time at the start of each observation timestep to an array in a dataset + * Observer to output time at the start of each observation timestep as a coordinate of an Xarray + * dataset */ #ifndef LIBS_OBSERVERS_TIME_OBSERVER_HPP_ @@ -36,17 +37,30 @@ #include "zarr/dataset.hpp" #include "zarr/xarray_zarr_array.hpp" -/* template class for observing time and writing to array as a coordinate of an xarray dataset */ +/** + * @class DoTimeObs + * @brief Template class for functionality to observe time at the start of each timestep and write + * it to a Zarr array as a coordinate of an xarray dataset. + * @tparam Store Type of store for dataset. + */ template class DoTimeObs { private: - Dataset &dataset; ///< dataset to write time data to - std::shared_ptr> xzarr_ptr; ///< pointer to time array in dataset + Dataset &dataset; /**< Dataset to write time data to. */ + std::shared_ptr> + xzarr_ptr; /**< Pointer to time array in dataset. */ std::function - step2dimlesstime; // function to convert timesteps to real time [assumed seconds] + step2dimlesstime; /**< Function to convert timesteps to real time [assumed seconds]. */ - // increment size of time dimension in dataset and write out time data to array in the dataset. - // Note conversion of time from double (8 bytes) to single precision (4 bytes float) in output + /** + * @brief Increment size of time dimension in dataset and write out current time of model to the + * array in the dataset. + * + * Note: conversion of time from double precision (8 bytes double) to single precision (4 bytes + * float) in output. + * + * @param t_mdl Current model time. + */ void at_start_step(const unsigned int t_mdl) const { const auto ntimes = size_t{dataset.get_dimension("time") + 1}; const auto timedim = std::pair({"time", ntimes}); @@ -57,6 +71,12 @@ class DoTimeObs { } public: + /** + * @brief Constructor for DoTimeObs. + * @param dataset Dataset to write time data to. + * @param maxchunk Maximum number of elements in a chunk (1-D vector size). + * @param step2dimlesstime Function to convert model timesteps to a real time [assumed seconds]. + */ DoTimeObs(Dataset &dataset, const size_t maxchunk, const std::function step2dimlesstime) : dataset(dataset), @@ -65,22 +85,49 @@ class DoTimeObs { maxchunk, 0))), step2dimlesstime(step2dimlesstime) {} + /** + * @brief Destructor for DoTimeObs. + */ ~DoTimeObs() { dataset.write_arrayshape(xzarr_ptr); } + /** + * @brief Placeholder for before timestepping functionality and to make class satisfy observer + * concept. + */ void before_timestepping(const viewd_constgbx d_gbxs) const { std::cout << "observer includes time observer\n"; } + /** + * @brief Placeholder for after timestepping functionality and to make class satisfy observer + * concept. + */ void after_timestepping() const {} + /** + * @brief At the start of each timestep when function called, function writes time data to the + * array in a dataset. + * @param t_mdl Current model timestep. + * @param d_gbxs View of gridboxes on device. + * @param totsupers View of superdrops on device. + */ void at_start_step(const unsigned int t_mdl, const viewd_constgbx d_gbxs, const viewd_constsupers totsupers) const { at_start_step(t_mdl); } }; -/* constructs observer which writes time variable out to a 1-D array with a constant timestep -'interval' using an instance of the ConstTstepObserver class */ +/** + * @brief Constructs an observer which writes (real) time at start of each observation timestep to a + * 1-D array with a constant observation timestep "interval". + * + * @tparam Store Type of store for dataset. + * @param interval Observation timestep. + * @param dataset Dataset to write time data to. + * @param maxchunk Maximum number of elements in a chunk (1-D vector size). + * @param step2dimlesstime Function to convert model timesteps to real time (assumed seconds). + * @return Constructed type satisfying observer concept. + */ template inline Observer auto TimeObserver(const unsigned int interval, Dataset &dataset, const int maxchunk, From fc78a1fbe64ece610437e40eed60427634656668 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Tue, 9 Apr 2024 23:54:20 +0200 Subject: [PATCH 11/35] chore: format wiht clang-format and reword note: as _note_: --- .../cartesianboundaryconds.hpp | 15 ++++++------ libs/cartesiandomain/cartesianmotion.cpp | 11 ++++----- .../cartesianmotion_withreset.cpp | 4 ++-- libs/cleoconstants.hpp | 4 ++-- libs/coupldyn_cvode/differentialfuncs.cpp | 13 ++++++---- libs/observers/parallel_write_data.hpp | 14 +++++------ libs/observers/time_observer.hpp | 2 +- libs/superdrops/collisions/breakup.hpp | 24 +++++++++---------- libs/superdrops/collisions/coalbure.hpp | 17 ++++++------- libs/superdrops/collisions/coalescence.cpp | 20 +++++++--------- libs/superdrops/impliciteuler.cpp | 21 ++++++++-------- libs/superdrops/impliciteuler.hpp | 9 ++++--- libs/superdrops/superdrop.hpp | 18 +++++++------- libs/superdrops/superdrop_attrs.hpp | 13 +++++----- libs/superdrops/superdrop_ids.hpp | 14 +++++------ libs/superdrops/terminalvelocity.cpp | 8 +++---- libs/superdrops/terminalvelocity.hpp | 4 ++-- libs/superdrops/thermodynamic_equations.cpp | 5 ++-- libs/superdrops/thermodynamic_equations.hpp | 8 +++---- libs/superdrops/urbg.hpp | 6 ++--- 20 files changed, 109 insertions(+), 121 deletions(-) diff --git a/libs/cartesiandomain/cartesianboundaryconds.hpp b/libs/cartesiandomain/cartesianboundaryconds.hpp index c50f9a875..2ad6f3096 100644 --- a/libs/cartesiandomain/cartesianboundaryconds.hpp +++ b/libs/cartesiandomain/cartesianboundaryconds.hpp @@ -1,4 +1,6 @@ -/* Copyright (c) 2023 MPI-M, Clara Bayley +/* + * Copyright (c) 2024 MPI-M, Clara Bayley + * * * ----- CLEO ----- * File: cartesianboundaryconds.hpp @@ -7,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Thursday 21st December 2023 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -18,23 +20,22 @@ * at the edges of the cartesian domain e.g. for * returning the neighbouring gbxindex and * value of a superdroplet's coord when the superdroplet - * crosses the domain boundary in a particular direction + * crosses the domain boundary in a particular direction. */ #ifndef LIBS_CARTESIANDOMAIN_CARTESIANBOUNDARYCONDS_HPP_ #define LIBS_CARTESIANDOMAIN_CARTESIANBOUNDARYCONDS_HPP_ -/* NOTE: boundary conditions of domain are defined as: +/* _Note:_ boundary conditions of domain are defined as: z: FINITE (see cartesian_coord3nghbrs & boundarycond_coord3) x: PERIODIC (see cartesian_coord3nghbrs & boundarycond_coord1) y: PERIODIC (see cartesian_coord3nghbrs & boundarycond_coord2) */ -#include -#include - #include #include +#include +#include #include "../cleoconstants.hpp" diff --git a/libs/cartesiandomain/cartesianmotion.cpp b/libs/cartesiandomain/cartesianmotion.cpp index 71f5d503b..94557e304 100644 --- a/libs/cartesiandomain/cartesianmotion.cpp +++ b/libs/cartesiandomain/cartesianmotion.cpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Wednesday 6th March 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -18,7 +18,6 @@ * File Description: */ - #include "./cartesianmotion.hpp" KOKKOS_FUNCTION int flag_sdgbxindex(const unsigned int idx, @@ -70,7 +69,7 @@ KOKKOS_FUNCTION void beyonddomain_forwards_coord2(const CartesianMaps &gbxmaps, update to forwards (flag = 1) or backwards (flag = 2) neighbour. Flag = 0 if idx is out of domain value or if coord lies within bounds = {lowerbound, upperbound}. -(Note: lower bound inclusive and upper bound exclusive, +(_Note:_ lower bound inclusive and upper bound exclusive, ie. lowerbound <= coord < upperbound). Flag = 1 if coord < lowerbound, indicating idx should be updated to backwards neighbour. @@ -96,7 +95,7 @@ move to neighbouring gridbox in coord3 direction. Funciton changes value of idx if flag != 0, if flag = 1 idx updated to backwards neighbour gbxindex. if flag = 2 idx updated to forwards neighbour gbxindex. -Note: backwards/forwards functions may change the +_Note:_ backwards/forwards functions may change the superdroplet's attributes e.g. if it leaves the domain. */ KOKKOS_FUNCTION unsigned int change_if_coord3nghbr(const CartesianMaps &gbxmaps, unsigned int idx, Superdrop &drop) { @@ -118,7 +117,7 @@ move to neighbouring gridbox in coord1 direction. Funciton changes value of idx if flag != 0, if flag = 1 idx updated to backwards neighbour gbxindex. if flag = 2 idx updated to forwards neighbour gbxindex. -Note: backwards/forwards functions may change the +_Note:_ backwards/forwards functions may change the superdroplet's attributes e.g. if it leaves the domain. */ KOKKOS_FUNCTION unsigned int change_if_coord1nghbr(const CartesianMaps &gbxmaps, unsigned int idx, Superdrop &drop) { @@ -140,7 +139,7 @@ move to neighbouring gridbox in coord2 direction. Funciton changes value of idx if flag != 0, if flag = 1 idx updated to backwards neighbour gbxindex. if flag = 2 idx updated to forwards neighbour gbxindex. -Note: backwards/forwards functions may change the +_Note:_ backwards/forwards functions may change the superdroplet's attributes e.g. if it leaves the domain. */ KOKKOS_FUNCTION unsigned int change_if_coord2nghbr(const CartesianMaps &gbxmaps, unsigned int idx, Superdrop &drop) { diff --git a/libs/cartesiandomain/cartesianmotion_withreset.cpp b/libs/cartesiandomain/cartesianmotion_withreset.cpp index 120a612f3..1b3ba6619 100644 --- a/libs/cartesiandomain/cartesianmotion_withreset.cpp +++ b/libs/cartesiandomain/cartesianmotion_withreset.cpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Wednesday 6th March 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -41,7 +41,7 @@ move to neighbouring gridbox in coord3 direction. Funciton changes value of idx if flag != 0, if flag = 1 idx updated to backwards neighbour gbxindex. if flag = 2 idx updated to forwards neighbour gbxindex. -Note: backwards/forwards functions may change the +_Note:_ backwards/forwards functions may change the superdroplet's attributes e.g. if it leaves the domain. */ KOKKOS_FUNCTION unsigned int change_if_coord3nghbr_withreset(const ResetSuperdrop &reset_superdrop, const CartesianMaps &gbxmaps, diff --git a/libs/cleoconstants.hpp b/libs/cleoconstants.hpp index b53aa9330..0deda3bec 100644 --- a/libs/cleoconstants.hpp +++ b/libs/cleoconstants.hpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 8th April 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -17,7 +17,7 @@ * ----- * File Description: * header file with namespaces for (physical) constants used by CLEO - * Note: All letters in CAPITALS indicates constants have dimensions + * _Note:_ All letters in CAPITALS indicates constants have dimensions * (or are naturally dimensionless as for IONIC). Only first letter * capitalised indicates value is dimensionless (version of a) constant. */ diff --git a/libs/coupldyn_cvode/differentialfuncs.cpp b/libs/coupldyn_cvode/differentialfuncs.cpp index 4f18059bb..80d345769 100644 --- a/libs/coupldyn_cvode/differentialfuncs.cpp +++ b/libs/coupldyn_cvode/differentialfuncs.cpp @@ -1,4 +1,6 @@ -/* Copyright (c) 2023 MPI-M, Clara Bayley +/* + * Copyright (c) 2024 MPI-M, Clara Bayley + * * * ----- CLEO ----- * File: differentialfuncs.cpp @@ -7,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Thursday 14th December 2023 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -16,7 +18,8 @@ * File Description: * Header file for ODEs which are solved by * CVODE ode solver to model evolution of the - * thermodynamics (p, temp, qv and qc) over time */ + * thermodynamics (p, temp, qv and qc) over time + */ #include "coupldyn_cvode/differentialfuncs.hpp" @@ -44,7 +47,7 @@ double cvode_saturationpressure(const double temp) { /* dp/dt differential equation (dimensionless) describing pressure evolution over time. - note: true dP/dt = dp/dt * P0/TIME0 */ + _Note:_ true dP/dt = dp/dt * P0/TIME0 */ static double dp_dt(const double t, const double wmax, const double tauhalf) { constexpr double zg = 0.0 / (dlc::W0 * dlc::TIME0); // dimensionless z value at ground level constexpr double tempg = 273.15 / dlc::TEMP0; // dimensionless temperature at zg @@ -77,7 +80,7 @@ static double dp_dt(const double t, const double wmax, const double tauhalf) { changes in parcel for adiabatic process (no heat loss). Parcel has water vapour mass mixing ratio (m_v/m_dry) = qv and liquid water mass mixing ratio (m_c/m_dry) = qc. - note: True dTemp/dt = dtemp * TEMP0/TIME0 */ + _Note:_ True dTemp/dt = dtemp * TEMP0/TIME0 */ static double dtemp_dt_adia(const int k, const double pdot, const N_Vector &y) { double p(NV_Ith_S(y, k)); double temp(NV_Ith_S(y, k + 1)); diff --git a/libs/observers/parallel_write_data.hpp b/libs/observers/parallel_write_data.hpp index 5fab1685c..0796c311f 100644 --- a/libs/observers/parallel_write_data.hpp +++ b/libs/observers/parallel_write_data.hpp @@ -34,7 +34,7 @@ struct ParallelGridboxesRangePolicyFunc { /* Parallel loop over gridboxes using Kokkos Range Policy. Kokkos::parallel_for([...]) is equivalent in serial to: for (size_t ii(0); ii < d_gbxs.extent(0); ++ii){[...]} - Note: Functor must have operator with signature: + _Note:_ Functor must have operator with signature: operator()(const size_t ii). */ template @@ -50,7 +50,7 @@ struct ParallelGridboxesTeamPolicyFunc { /* Parallel loop over gridboxes using Kokkos Team Policy. Kokkos::parallel_for([...]) is equivalent in serial to: for (size_t ii(0); ii < d_gbxs.extent(0); ++ii){[...]} - Note: Functor must have operator with signature: + _Note:_ Functor must have operator with signature: operator()(const TeamMember &team_member). */ template @@ -95,11 +95,11 @@ class ParallelWriteGridboxes { * @tparam CRC The type that satisfies the CollectRaggedCount concept. */ template -concept CollectRaggedCount = - requires(CRC crc, const Dataset &ds, const viewd_constsupers totsupers) { - { crc.write_to_array(ds, totsupers) } -> std::same_as; - { crc.write_arrayshape(ds) } -> std::same_as; - }; +concept CollectRaggedCount = requires(CRC crc, const Dataset &ds, + const viewd_constsupers totsupers) { + { crc.write_to_array(ds, totsupers) } -> std::same_as; + { crc.write_arrayshape(ds) } -> std::same_as; +}; /* struct for "ParallelWriteData" (see write_to_dataset_observer.hpp) to collect data from superdroplets in a parallel loop and write it to ragged arrays in a dataset */ diff --git a/libs/observers/time_observer.hpp b/libs/observers/time_observer.hpp index b40d487d5..7687d01e8 100644 --- a/libs/observers/time_observer.hpp +++ b/libs/observers/time_observer.hpp @@ -56,7 +56,7 @@ class DoTimeObs { * @brief Increment size of time dimension in dataset and write out current time of model to the * array in the dataset. * - * Note: conversion of time from double precision (8 bytes double) to single precision (4 bytes + * _Note:_ conversion of time from double precision (8 bytes double) to single precision (4 bytes * float) in output. * * @param t_mdl Current model time. diff --git a/libs/superdrops/collisions/breakup.hpp b/libs/superdrops/collisions/breakup.hpp index e230bbeb6..8b0f7c557 100644 --- a/libs/superdrops/collisions/breakup.hpp +++ b/libs/superdrops/collisions/breakup.hpp @@ -8,7 +8,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 11th March 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -21,20 +21,18 @@ * concept used in Collisions struct */ - #ifndef LIBS_SUPERDROPS_COLLISIONS_BREAKUP_HPP_ #define LIBS_SUPERDROPS_COLLISIONS_BREAKUP_HPP_ -#include +#include #include +#include #include -#include - -#include "./breakup_nfrags.hpp" -#include "./collisions.hpp" #include "../microphysicalprocess.hpp" #include "../superdrop.hpp" +#include "./breakup_nfrags.hpp" +#include "./collisions.hpp" template struct DoBreakup { @@ -142,19 +140,19 @@ KOKKOS_FUNCTION void DoBreakup::breakup_superdroplet_pair(Superdrop &dro superdroplets produces (non-identical) twin superdroplets. Similar to Shima et al. 2009 Section 5.1.3. part (5) option (b). Note implicit assumption that gamma factor = 1. -Note: implicit casting of xi from uint64_t to double. */ +_Note:_ Implicit casting of xi from uint64_t to double. */ template KOKKOS_FUNCTION void DoBreakup::twin_superdroplet_breakup(Superdrop &drop1, Superdrop &drop2) const { const auto old_xi = drop2.get_xi(); // = drop1.xi const auto totnfrags = double{nfrags(drop1, drop2) * old_xi}; - assert(((totnfrags / old_xi) > 2.5) && "nfrags must be > 2.5"); + assert(((totnfrags / old_xi) > 2.5) && "nfrags must be > 2.5"); - const auto new_xi1 = (uint64_t)Kokkos::round(totnfrags / 2); // cast double to uint64_t + const auto new_xi1 = (uint64_t)Kokkos::round(totnfrags / 2); // cast double to uint64_t const auto new_xi2 = (uint64_t)Kokkos::round(totnfrags - new_xi1); // cast double to uint64_t const auto new_xitot = new_xi1 + new_xi2; assert((new_xi2 > old_xi) && "nfrags must increase the drop2's multiplicity during breakup"); - assert((new_xitot > (old_xi*2)) && "nfrags must increase total multiplicity during breakup"); + assert((new_xitot > (old_xi * 2)) && "nfrags must increase total multiplicity during breakup"); const auto sum_rcubed = double{drop1.rcubed() + drop2.rcubed()}; const auto new_rcubed = double{sum_rcubed * old_xi / new_xitot}; @@ -177,7 +175,7 @@ KOKKOS_FUNCTION void DoBreakup::twin_superdroplet_breakup(Superdrop &dro mass via decreasing multiplicity of drop1. Similar to Shima et al. 2009 Section 5.1.3. part (5) option (a). Note implicit assumption that gamma factor = 1. -Note: implicit casting of xi from uint64_t to double. */ +_Note:_ Implicit casting of xi from uint64_t to double. */ template KOKKOS_FUNCTION void DoBreakup::different_superdroplet_breakup(Superdrop &drop1, Superdrop &drop2) const { @@ -189,7 +187,7 @@ KOKKOS_FUNCTION void DoBreakup::different_superdroplet_breakup(Superdrop const auto totnfrags = double{nfrags(drop1, drop2) * old_xi2}; const auto new_xi2 = (uint64_t)Kokkos::round(totnfrags); // cast double to uint64_t - assert(((totnfrags / old_xi2) > 2.5) && "nfrags must be > 2.5"); + assert(((totnfrags / old_xi2) > 2.5) && "nfrags must be > 2.5"); assert((new_xi2 > old_xi2) && "nfrags must increase the drop2's multiplicity during breakup"); assert(((new_xi1 + new_xi2) > (old_xi1 + old_xi2)) && diff --git a/libs/superdrops/collisions/coalbure.hpp b/libs/superdrops/collisions/coalbure.hpp index 31178bb54..d77819461 100644 --- a/libs/superdrops/collisions/coalbure.hpp +++ b/libs/superdrops/collisions/coalbure.hpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 11th March 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -23,23 +23,21 @@ * concept used in Collisions struct */ - #ifndef LIBS_SUPERDROPS_COLLISIONS_COALBURE_HPP_ #define LIBS_SUPERDROPS_COLLISIONS_COALBURE_HPP_ +#include #include #include -#include - +#include "../microphysicalprocess.hpp" +#include "../superdrop.hpp" #include "./breakup.hpp" #include "./breakup_nfrags.hpp" #include "./coalbure_flag.hpp" #include "./coalescence.hpp" #include "./collisionkinetics.hpp" #include "./collisions.hpp" -#include "../microphysicalprocess.hpp" -#include "../superdrop.hpp" /* ie. DoCoalescenceBreakupRebound */ template @@ -49,10 +47,9 @@ struct DoCoalBuRe { DoBreakup bu; Flag coalbure_flag; - /* calculates value of gamma factor in Monte Carlo - collision as in Shima et al. 2009 given probability of - collision. Note: probability is probability of - collision *NOT* collision-coalescence! */ + /* calculates value of gamma factor in Monte Carlo collision as in Shima et al. 2009 given + probability of collision. + _Note:_ Probability is probability of collision *NOT* collision-coalescence! */ KOKKOS_FUNCTION uint64_t collision_gamma(const uint64_t xi1, const uint64_t xi2, const double prob, const double phi) const { diff --git a/libs/superdrops/collisions/coalescence.cpp b/libs/superdrops/collisions/coalescence.cpp index d819f25a1..3bd6a1fdd 100644 --- a/libs/superdrops/collisions/coalescence.cpp +++ b/libs/superdrops/collisions/coalescence.cpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 11th March 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -22,7 +22,6 @@ * used in Collisions struct */ - #include "./coalescence.hpp" /* this operator is used as an "adaptor" for using @@ -46,16 +45,15 @@ KOKKOS_FUNCTION bool DoCoalescence::operator()(Superdrop &drop1, Superdrop &drop /* calculates value of gamma factor in Monte Carlo collision-coalescence as in Shima et al. 2009 */ -KOKKOS_FUNCTION uint64_t DoCoalescence::coalescence_gamma(const uint64_t xi1, - const uint64_t xi2, +KOKKOS_FUNCTION uint64_t DoCoalescence::coalescence_gamma(const uint64_t xi1, const uint64_t xi2, const double prob, const double phi) const { - uint64_t gamma = floor(prob); // if phi >= (prob - floor(prob)) + uint64_t gamma = floor(prob); // if phi >= (prob - floor(prob)) if (phi < (prob - gamma)) { ++gamma; } - const auto maxgamma = xi1 / xi2; // same as floor() for positive ints + const auto maxgamma = xi1 / xi2; // same as floor() for positive ints return Kokkos::fmin(gamma, maxgamma); } @@ -91,13 +89,12 @@ with same xi, r and solute mass. According to Shima et al. 2009 Section 5.1.3. part (5) option (b). In rare case where xi1 = xi2 = gamma = 1, new_xi of drop1 = 0 and drop1 should be removed from domain. -Note: implicit casting of gamma (i.e. therefore droplets' -xi values) from uint64_t to double. */ +_Note:_ Implicit casting of gamma (i.e. therefore droplets' xi values) from uint64_t to double. */ KOKKOS_FUNCTION void DoCoalescence::twin_superdroplet_coalescence(const uint64_t gamma, Superdrop &drop1, Superdrop &drop2) const { - const auto old_xi = drop2.get_xi(); // = drop1.xi - const auto new_xi = old_xi / 2; // same as floor() for positive ints + const auto old_xi = drop2.get_xi(); // = drop1.xi + const auto new_xi = old_xi / 2; // same as floor() for positive ints assert((new_xi < old_xi) && "coalescence must decrease multiplicity"); @@ -119,8 +116,7 @@ KOKKOS_FUNCTION void DoCoalescence::twin_superdroplet_coalescence(const uint64_t /* if xi1 > gamma*xi2 coalescence grows drop2 radius and mass via decreasing multiplicity of drop1. According to Shima et al. 2009 Section 5.1.3. part (5) option (a) -Note: implicit casting of gamma (i.e. therefore droplets' -xi values) from uint64_t to double. */ +_Note:_ Implicit casting of gamma (i.e. therefore droplets' xi values) from uint64_t to double. */ KOKKOS_FUNCTION void DoCoalescence::different_superdroplet_coalescence(const uint64_t gamma, Superdrop &drop1, Superdrop &drop2) const { diff --git a/libs/superdrops/impliciteuler.cpp b/libs/superdrops/impliciteuler.cpp index 19f93066f..22a81d2a6 100644 --- a/libs/superdrops/impliciteuler.cpp +++ b/libs/superdrops/impliciteuler.cpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 11th March 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -24,7 +24,6 @@ * Mahrt, 1st edition." and Shima et al. 2009 */ - #include "./impliciteuler.hpp" /* forward timestep previous radius 'rprev' by delt using an implicit @@ -110,8 +109,9 @@ KOKKOS_FUNCTION double ImplicitEuler::solve_condensation_matsushima( } } -KOKKOS_FUNCTION double ImplicitEuler::substepped_implicitmethod( - const ImplicitIteration &implit, const unsigned int nsubsteps, const double rprev) const { +KOKKOS_FUNCTION double ImplicitEuler::substepped_implicitmethod(const ImplicitIteration &implit, + const unsigned int nsubsteps, + const double rprev) const { auto subr = rprev; for (unsigned int n(0); n < nsubsteps; ++n) { auto init_ziter = double{implit.initialguess(subr)}; @@ -167,7 +167,7 @@ and timesteps, and the maximum number of iterations is small. After 'niters' iterations, convergence criteria is tested and futher iterations undertaken if not yet converged. */ KOKKOS_FUNCTION double ImplicitIteration::newtonraphson_niterations(const double rprev, - double ziter) const { + double ziter) const { // perform 'niters' iterations auto numerator = double{0.0}; for (unsigned int iter(0); iter < niters; ++iter) { @@ -193,9 +193,9 @@ Newton Raphson Method for dr/dt condensation / evaporation ODE. ODE is for radial growth/shrink of each superdroplet due to condensation and diffusion of water vapour according to equations from "An Introduction To Clouds...." -(see note at top of file). Note: z = ziter = radius^2 */ -KOKKOS_FUNCTION double ImplicitIteration::ode_gfunc(const double rprev, - const double rsqrd) const { +(see note at top of file). +_Note:_ z = ziter = radius^2 */ +KOKKOS_FUNCTION double ImplicitIteration::ode_gfunc(const double rprev, const double rsqrd) const { const auto radius = double{Kokkos::sqrt(rsqrd)}; const auto alpha = double{s_ratio - 1 - akoh / radius + bkoh / Kokkos::pow(radius, 3.0)}; @@ -226,8 +226,9 @@ tested and error is raised if method does not converge within 'iterlimit' iterations. Otherwise returns new value for the radius (which is the radius at timestep 't+subdelt'. Refer to section 5.1.2 Shima et al. 2009 and section 3.3.3 of Matsushima et al. 2023 for more details. */ -KOKKOS_FUNCTION double ImplicitIteration::newtonraphson_untilconverged( - const unsigned int iterlimit, const double rprev, double ziter) const { +KOKKOS_FUNCTION double ImplicitIteration::newtonraphson_untilconverged(const unsigned int iterlimit, + const double rprev, + double ziter) const { auto do_iter = bool{true}; auto iter = (unsigned int)1; diff --git a/libs/superdrops/impliciteuler.hpp b/libs/superdrops/impliciteuler.hpp index d0991e80a..481ca7872 100644 --- a/libs/superdrops/impliciteuler.hpp +++ b/libs/superdrops/impliciteuler.hpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 11th March 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -24,14 +24,12 @@ * Mahrt, 1st edition." and Shima et al. 2009 */ - #ifndef LIBS_SUPERDROPS_IMPLICITEULER_HPP_ #define LIBS_SUPERDROPS_IMPLICITEULER_HPP_ -#include - #include #include +#include #include "../cleoconstants.hpp" @@ -102,7 +100,8 @@ struct ImplicitIteration { ODE is for radial growth/shrink of each superdroplet due to condensation and diffusion of water vapour according to equations from "An Introduction To Clouds...." - (see note at top of file). Note: z = ziter = radius^2 */ + (see note at top of file). + _Note:_ z = ziter = radius^2 */ KOKKOS_FUNCTION double ode_gfunc(const double rprev, const double rsqrd) const; diff --git a/libs/superdrops/superdrop.hpp b/libs/superdrops/superdrop.hpp index 8d9997fce..35b4aa2e8 100644 --- a/libs/superdrops/superdrop.hpp +++ b/libs/superdrops/superdrop.hpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Friday 1st March 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -36,14 +36,14 @@ */ class Superdrop { private: - unsigned int sdgbxindex; /**< Index of the gridbox the superdrop occupies */ - double coord3; /**< 3rd spatial coordinate of the superdrop (vertical) */ - double coord1; /**< 1st spatial coordinate of the superdrop (eastwards) */ - double coord2; /**< 2nd spatial coordinate of the superdrop (northwards) */ - SuperdropAttrs attrs; /**< instance of SuperdropAttrs for attributes of the super-droplet */ + unsigned int sdgbxindex; /**< Index of the gridbox the superdrop occupies */ + double coord3; /**< 3rd spatial coordinate of the superdrop (vertical) */ + double coord1; /**< 1st spatial coordinate of the superdrop (eastwards) */ + double coord2; /**< 2nd spatial coordinate of the superdrop (northwards) */ + SuperdropAttrs attrs; /**< instance of SuperdropAttrs for attributes of the super-droplet */ public: - using IDType = IntID; /**< Type of ID to identify superdrop via 8 byte integer */ + using IDType = IntID; /**< Type of ID to identify superdrop via 8 byte integer */ // using IDType = EmptyID; /**< Type of ID for non-existent superdrop identity */ [[no_unique_address]] IDType sdId; /**< instance of super-droplet identity of Superdrop::IDType */ @@ -200,7 +200,7 @@ class Superdrop { * * This function sets the value of the super-droplet's radius to the specified value. * - * Note: see also change_radius which limits super-droplet radius to its dry radius. + * _Note:_ See also change_radius which limits super-droplet radius to its dry radius. * * @param i_radius The value to set for radius. */ @@ -224,7 +224,7 @@ class Superdrop { * if its new radius >= its dry radius. Return is difference in radius accoding to super-droplet's * attributes struct. * - * Note: see also set_radius which allows super-droplet radius less than its dry radius + * _Note:_ See also set_radius which allows super-droplet radius less than its dry radius * * @param newr The value to set the radius >= dry radius. * @return change in radius of the super-droplet. diff --git a/libs/superdrops/superdrop_attrs.hpp b/libs/superdrops/superdrop_attrs.hpp index 3d6800377..da9036ee5 100644 --- a/libs/superdrops/superdrop_attrs.hpp +++ b/libs/superdrops/superdrop_attrs.hpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 11th March 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -24,10 +24,9 @@ #ifndef LIBS_SUPERDROPS_SUPERDROP_ATTRS_HPP_ #define LIBS_SUPERDROPS_SUPERDROP_ATTRS_HPP_ -#include - #include #include // for pi +#include #include "../cleoconstants.hpp" @@ -65,9 +64,9 @@ struct SoluteProperties { struct SuperdropAttrs { SoluteProperties solute; /**< instance of SoluteProperties for pointer-like reference to superdrop's solute properties. */ - uint64_t xi; /**< Multiplicity of superdrop. */ - double radius; /**< Radius of superdrop. */ - double msol; /**< Mass of solute dissolved in superdrop. */ + uint64_t xi; /**< Multiplicity of superdrop. */ + double radius; /**< Radius of superdrop. */ + double msol; /**< Mass of solute dissolved in superdrop. */ /** * @brief Default constructor requirement for use of SuperdropAttrs in Kokkos View @@ -147,7 +146,7 @@ struct SuperdropAttrs { * This function sets the value of the super-droplet's radius to the specified value * with assert that new radius >= dry radius within 10^(-6) micron tolerance. * - * Note: see also change_radius which limits super-droplet radius to its dry radius. + * _Note:_ See also change_radius which limits super-droplet radius to its dry radius. * * @param i_radius The value to set for radius. */ diff --git a/libs/superdrops/superdrop_ids.hpp b/libs/superdrops/superdrop_ids.hpp index dde74df1f..90da6d424 100644 --- a/libs/superdrops/superdrop_ids.hpp +++ b/libs/superdrops/superdrop_ids.hpp @@ -8,7 +8,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: Tobias Kölling (TK) * ----- - * Last Modified: Monday 12th February 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -22,15 +22,14 @@ #ifndef LIBS_SUPERDROPS_SUPERDROP_IDS_HPP_ #define LIBS_SUPERDROPS_SUPERDROP_IDS_HPP_ -#include - #include +#include /** * @brief Struct containing value of SD identity (8 bytes integer). */ struct IntID { - size_t value; /**< Value of the SD identity. */ + size_t value; /**< Value of the SD identity. */ /** * @brief Class for generating unique SD identity. @@ -40,7 +39,8 @@ struct IntID { /** * @brief Generate the next SD identity. * - * Note: This generator is not thread-safe (_id++ is undefined in a multi-threaded environment). + * _Note:_ This generator is not thread-safe (_id++ is undefined in a multi-threaded + * environment). * * @return SD identity. */ @@ -49,7 +49,7 @@ struct IntID { /** * @brief Generate the next SD identity using given value 'id'. * - * Note: This generator assumes the ID was thread-safe generated (i.e., is unique). + * _Note:_ This generator assumes the ID was thread-safe generated (i.e., is unique). * * @param id The value to use for generating the next SD identity. * @return SD identity. @@ -57,7 +57,7 @@ struct IntID { KOKKOS_INLINE_FUNCTION IntID next(const size_t id) { return {id}; } private: - size_t _id = 0; /**< Internal counter for generating SD identities. */ + size_t _id = 0; /**< Internal counter for generating SD identities. */ }; }; diff --git a/libs/superdrops/terminalvelocity.cpp b/libs/superdrops/terminalvelocity.cpp index b997aa656..680e5393c 100644 --- a/libs/superdrops/terminalvelocity.cpp +++ b/libs/superdrops/terminalvelocity.cpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 11th March 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -23,7 +23,6 @@ * requirements of the VelocityFormula concept */ - #include "./terminalvelocity.hpp" /** @@ -51,7 +50,7 @@ double SimmelTerminalVelocity::watermass(const double radius) const { * and Beard (1976) and used in Simmel's parmeterisation of Long 1974's hydrodynamic collision * kernel. For drops with radius >= 1.74mm, terminal velocity is 9.17m/s. * - * Note: Improvement could be made by following Arabas et al. 2015 and Morrison et al. 2005 in + * _Note:_ Improvement could be made by following Arabas et al. 2015 and Morrison et al. 2005 in * multiplying the terminal velocity by the density ratio, rho_dry0/rho_dry, of dry air under * standard conditions (rho_dry0) and in current state (rho_dry). * @@ -66,8 +65,7 @@ double SimmelTerminalVelocity::operator()(const Superdrop &drop) const { constexpr double r3 = 1.73892e-3 / dlc::R0; /* alpha constants converted from [g^-beta m s^-1] into [g^-beta] units */ - constexpr double VELCONST = - (100.0 * dlc::W0); // convert from [cm/s] into dimensionless velocity + constexpr double VELCONST = (100.0 * dlc::W0); // convert from [cm/s] into dimensionless velocity constexpr double a1 = 457950 / VELCONST; constexpr double a2 = 4962 / VELCONST; constexpr double a3 = 1732 / VELCONST; diff --git a/libs/superdrops/terminalvelocity.hpp b/libs/superdrops/terminalvelocity.hpp index a8c0ea86d..46d763716 100644 --- a/libs/superdrops/terminalvelocity.hpp +++ b/libs/superdrops/terminalvelocity.hpp @@ -8,7 +8,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 11th March 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -77,7 +77,7 @@ struct SimmelTerminalVelocity { * and Beard (1976) and used in Simmel's parmeterisation of Long 1974's hydrodynamic collision * kernel. For drops with radius >= 1.74mm, terminal velocity is 9.17m/s. * - * Note: Improvement could be made by following Arabas et al. 2015 and Morrison et al. 2005 in + * _Note:_ Improvement could be made by following Arabas et al. 2015 and Morrison et al. 2005 in * multiplying the terminal velocity by the density ratio, rho_dry0/rho_dry, of dry air under * standard conditions (rho_dry0) and in current state (rho_dry). * diff --git a/libs/superdrops/thermodynamic_equations.cpp b/libs/superdrops/thermodynamic_equations.cpp index 685af69c8..38d34f6c8 100644 --- a/libs/superdrops/thermodynamic_equations.cpp +++ b/libs/superdrops/thermodynamic_equations.cpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 11th March 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -23,7 +23,6 @@ * and Mahrt, 1st edition. */ - #include "./thermodynamic_equations.hpp" /** @@ -35,7 +34,7 @@ * paper for formula is Murray, F. W. (1967) "On the Computation of Saturation Vapor Pressure", * Journal of Applied Meteorology and Climatology 6, 203–204. * - * Note: function starts with conversion from dimentionless to real temperature [Kelvin], + * _Note:_ Function starts with conversion from dimentionless to real temperature [Kelvin], * TEMP = temp*Temp0, and returns dimensionless pressure from real psat = PSAT/P0. * * @param temp The (dimensionless) ambient temperature. diff --git a/libs/superdrops/thermodynamic_equations.hpp b/libs/superdrops/thermodynamic_equations.hpp index 891d641eb..c84437e83 100644 --- a/libs/superdrops/thermodynamic_equations.hpp +++ b/libs/superdrops/thermodynamic_equations.hpp @@ -8,7 +8,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Monday 11th March 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -20,14 +20,12 @@ * Microscale to Climate" by Lohmann, Luond and Mahrt, 1st edition. */ - #ifndef LIBS_SUPERDROPS_THERMODYNAMIC_EQUATIONS_HPP_ #define LIBS_SUPERDROPS_THERMODYNAMIC_EQUATIONS_HPP_ -#include - #include #include +#include #include "../cleoconstants.hpp" #include "./superdrop.hpp" @@ -102,7 +100,7 @@ Kokkos::pair kohler_factors(const Superdrop &drop, const double * paper for formula is Murray, F. W. (1967) "On the Computation of Saturation Vapor Pressure", * Journal of Applied Meteorology and Climatology 6, 203–204. * - * Note: function starts with conversion from dimentionless to real temperature [Kelvin], + * _Note:_ Function starts with conversion from dimentionless to real temperature [Kelvin], * TEMP = temp*Temp0, and returns dimensionless pressure from real psat = PSAT/P0. * * @param temp The (dimensionless) ambient temperature. diff --git a/libs/superdrops/urbg.hpp b/libs/superdrops/urbg.hpp index 9ddf4de76..cc32db633 100644 --- a/libs/superdrops/urbg.hpp +++ b/libs/superdrops/urbg.hpp @@ -8,7 +8,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Friday 9th February 2024 + * Last Modified: Tuesday 9th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -44,7 +44,7 @@ */ template struct URBG { - Kokkos::Random_XorShift64 gen; /**< Kokkos random number generator */ + Kokkos::Random_XorShift64 gen; /**< Kokkos random number generator */ /** * @brief Draws a random 64-bit unsigned integer (uint64_t) from a uniform distribution in the @@ -77,7 +77,7 @@ struct URBG { * * Equivalent to C++98 std::swap but works on device as well as host (gpu compatible). * - * Note: Involves a copy construction and two assignment operations, which may not be efficient + * _Note:_ Involves a copy construction and two assignment operations, which may not be efficient * if Superdrop class stores large quantities of data. * * @param a The first super-droplet. From e6662fb500a3dbed95af221e6383e6723791844f Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Wed, 10 Apr 2024 00:07:32 +0200 Subject: [PATCH 12/35] docs(observers): docstrings and rst file for totnsupers observer --- .../cxx/observers/totnsupers_observer.rst | 15 ++--- libs/observers/time_observer.hpp | 13 ++-- libs/observers/totnsupers_observer.hpp | 63 ++++++++++++++++--- 3 files changed, 69 insertions(+), 22 deletions(-) diff --git a/docs/source/cxx/observers/totnsupers_observer.rst b/docs/source/cxx/observers/totnsupers_observer.rst index cb0f6b088..6f8106742 100644 --- a/docs/source/cxx/observers/totnsupers_observer.rst +++ b/docs/source/cxx/observers/totnsupers_observer.rst @@ -1,14 +1,15 @@ -XXX Observer -============ +TotNsupers Observer +=================== -// TODO(CB) write doc +Header file: ```` +`[source] `_ -Header file: ```` -`[source] `_ - -.. doxygenstruct:: XXXObserver +.. doxygenclass:: DoTotNsupersObs :project: observers :private-members: :protected-members: :members: :undoc-members: + +.. doxygenfunction:: TotNsupersObserver + :project: observers diff --git a/libs/observers/time_observer.hpp b/libs/observers/time_observer.hpp index 7687d01e8..312a6e9e9 100644 --- a/libs/observers/time_observer.hpp +++ b/libs/observers/time_observer.hpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Tuesday 9th April 2024 + * Last Modified: Wednesday 10th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -40,7 +40,7 @@ /** * @class DoTimeObs * @brief Template class for functionality to observe time at the start of each timestep and write - * it to a Zarr array as a coordinate of an xarray dataset. + * it to a Zarr array as a coordinate of an Xarray dataset. * @tparam Store Type of store for dataset. */ template @@ -53,8 +53,8 @@ class DoTimeObs { step2dimlesstime; /**< Function to convert timesteps to real time [assumed seconds]. */ /** - * @brief Increment size of time dimension in dataset and write out current time of model to the - * array in the dataset. + * @brief Increment size of time dimension in dataset and write out current time of model (assumed + * seconds) to the array in the dataset. * * _Note:_ conversion of time from double precision (8 bytes double) to single precision (4 bytes * float) in output. @@ -105,8 +105,9 @@ class DoTimeObs { void after_timestepping() const {} /** - * @brief At the start of each timestep when function called, function writes time data to the - * array in a dataset. + * @brief Adapter to call at start step function which writes the current time of the model + * (assumed seconds) to the array in the dataset. + * * @param t_mdl Current model timestep. * @param d_gbxs View of gridboxes on device. * @param totsupers View of superdrops on device. diff --git a/libs/observers/totnsupers_observer.hpp b/libs/observers/totnsupers_observer.hpp index d11f5baa4..683a8d978 100644 --- a/libs/observers/totnsupers_observer.hpp +++ b/libs/observers/totnsupers_observer.hpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Tuesday 9th April 2024 + * Last Modified: Wednesday 10th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -35,44 +35,89 @@ #include "zarr/dataset.hpp" #include "zarr/xarray_zarr_array.hpp" -/* template observer which writes gbxindex for every gridbox out to a 1-D array -as a coordinate of an xarray dataset */ +/** + * @class DoTotNsupersObs + * @brief 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. + * @tparam Store Type of store for dataset. + */ template class DoTotNsupersObs { private: - Dataset &dataset; ///< dataset to write totnsupers data to - std::shared_ptr> xzarr_ptr; ///< pointer to totnsupers array + Dataset &dataset; /**< dataset to write totnsupers data to */ + std::shared_ptr> xzarr_ptr; /**< pointer to totnsupers array */ + /** + * @brief 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). + * + * @param totsupers View of all the superdroplets to count (on device memory but metadata for + * extent of view is available on host). + */ void at_start_step(const viewd_constsupers totsupers) const { const auto data = static_cast(totsupers.extent(0)); dataset.write_to_array(xzarr_ptr, data); } public: + /** + * @brief Constructor for DoTotNsupersObs. + * @param dataset Dataset to write totnsupers data to. + * @param maxchunk Maximum number of elements in a chunk (1-D vector size). + */ DoTotNsupersObs(Dataset &dataset, const size_t maxchunk) : dataset(dataset), xzarr_ptr(std::make_shared>( dataset.template create_array("totnsupers", "", " inline Observer auto TotNsupersObserver(const unsigned int interval, Dataset &dataset, const int maxchunk) { From c885ac1704434de9695f750262845997706392ad Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Thu, 11 Apr 2024 14:28:46 +0200 Subject: [PATCH 13/35] docs(observers): more docstrings and rst for write_to_dataset_observer --- .../observers/write_to_dataset_observer.rst | 21 ++++-- docs/source/cxx/zarr/xarray_zarr_array.rst | 5 +- libs/observers/write_to_dataset_observer.hpp | 72 +++++++++++++++---- 3 files changed, 75 insertions(+), 23 deletions(-) diff --git a/docs/source/cxx/observers/write_to_dataset_observer.rst b/docs/source/cxx/observers/write_to_dataset_observer.rst index cb0f6b088..a00a68787 100644 --- a/docs/source/cxx/observers/write_to_dataset_observer.rst +++ b/docs/source/cxx/observers/write_to_dataset_observer.rst @@ -1,14 +1,21 @@ -XXX Observer -============ +Template for Observer to Write To Dataset +========================================= -// TODO(CB) write doc +Header file: ```` +`[source] `_ -Header file: ```` -`[source] `_ - -.. doxygenstruct:: XXXObserver +.. doxygenclass:: DoWriteToDataset :project: observers :private-members: :protected-members: :members: :undoc-members: + +.. doxygenfunction:: WriteToDatasetObserver(const unsigned int interval, ParallelWriteData parallel_write) + :project: observers + +.. doxygenfunction:: WriteToDatasetObserver(const unsigned int interval, const Dataset &dataset, CollectData collect_data) + :project: observers + +.. doxygenfunction:: WriteToDatasetObserver(const unsigned int interval, const Dataset &dataset, CollectData collect_data, RaggedCount ragged_count) + :project: observers diff --git a/docs/source/cxx/zarr/xarray_zarr_array.rst b/docs/source/cxx/zarr/xarray_zarr_array.rst index 5d3137b20..48bd417af 100644 --- a/docs/source/cxx/zarr/xarray_zarr_array.rst +++ b/docs/source/cxx/zarr/xarray_zarr_array.rst @@ -13,7 +13,10 @@ Header file: ```` .. doxygenfunction:: vecstr_to_string :project: zarr -.. doxygenfunction:: make_xarray_metadata +.. doxygenfunction:: make_xarray_metadata(const std::string_view units, const std::string_view dtype, const double scale_factor, const std::vector& dimnames) + :project: zarr + +.. doxygenfunction:: make_xarray_metadata(const std::string_view units, const std::string_view dtype, const double scale_factor, const std::vector& dimnames, const std::string_view sampledimname) :project: zarr .. doxygenclass:: XarrayZarrArray diff --git a/libs/observers/write_to_dataset_observer.hpp b/libs/observers/write_to_dataset_observer.hpp index 57058354b..74a7f67ec 100644 --- a/libs/observers/write_to_dataset_observer.hpp +++ b/libs/observers/write_to_dataset_observer.hpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Tuesday 9th April 2024 + * Last Modified: Thursday 11th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -33,41 +33,74 @@ #include "./parallel_write_data.hpp" #include "zarr/dataset.hpp" -/* template class for to call a function during the at_start_step function of an observer -in order to collect variables from gridboxes and/or superdroplets in parallel and then write them -to arrays in a dataset at a constant time interval. */ +/** + * @class DoWriteToDataset + * @brief Templated class for writing data from gridboxes and/or superdroplets to a dataset at the + * constant time intervals by calling the operator of the ParallelWriteData type at the start of + * each step. + * @tparam ParallelWriteData Type of function-like object to call during at_start_step. + */ template class DoWriteToDataset { private: - ParallelWriteData parallel_write; ///< function like object to call during at_start_step + ParallelWriteData parallel_write; /**< Function-like object to call during at_start_step. */ - public: + /** + * @brief Constructor for DoWriteToDataset. + * @param parallel_write Function-like object to call during at_start_step. + */ explicit DoWriteToDataset(ParallelWriteData parallel_write) : parallel_write(parallel_write) {} + /** + * @brief Placeholder for before timestepping functionality and to make class satisfy observer + * concept. + */ void before_timestepping(const viewd_constgbx d_gbxs) const { std::cout << "observer includes write in dataset observer\n"; } + /** + * @brief Placeholder for after timestepping functionality and to make class satisfy observer + * concept. + */ void after_timestepping() const {} + /** + * @brief Calls the parallel_write function during at_start_step. + * @param t_mdl Current model time. + * @param d_gbxs View of gridboxes. + * @param totsupers View of superdroplets. + */ void at_start_step(const unsigned int t_mdl, const viewd_constgbx d_gbxs, const viewd_constsupers totsupers) const { parallel_write(d_gbxs, totsupers); } }; -/* constructs observer which writes some data in parallel according to parallel_write at the start -of a constant timestep 'interval' using instances of the ConstTstepObserver and DoWriteToDataset -classes */ +/** + * @brief Constructs an observer to write data from gridboxes and/or superdroplets to a dataset at a + * constant time interval according to the ParallelWriteData struct. + * @tparam ParallelWriteData Type of function-like object to call during at_start_step. + * @param interval Constant timestep interval. + * @param parallel_write Function-like object to call during at_start_step. + * @return Constructed observer. + */ template inline Observer auto WriteToDatasetObserver(const unsigned int interval, ParallelWriteData parallel_write) { return ConstTstepObserver(interval, DoWriteToDataset(parallel_write)); } -/* constructs observer which writes some data from gridboxes in parallel into arrays in a dataset -according to parallel_write at the start of a constant timestep 'interval' using instances of the -ConstTstepObserver and DoWriteToDataset classes */ +/** + * @brief Constructs an observer to write data from gridboxes to arrays in a dataset at a + * constant time interval using a range policy parallelism over the gridboxes. + * @tparam Store Type of store for dataset. + * @tparam CollectData Type of collect data function. + * @param interval Constant timestep interval. + * @param dataset Dataset to write data to. + * @param collect_data Function to collect data from gridboxes. + * @return Constructed observer. + */ template CollectData> inline Observer auto WriteToDatasetObserver(const unsigned int interval, const Dataset &dataset, @@ -77,9 +110,18 @@ inline Observer auto WriteToDatasetObserver(const unsigned int interval, return ConstTstepObserver(interval, DoWriteToDataset(parallel_write)); } -/* constructs observer which writes some data from superdroplets in parallel into ragged arrays in a -dataset according to parallel_write at the start of a constant timestep 'interval' using instances -of the ConstTstepObserver and DoWriteToDataset classes */ +/** + * @brief Constructs an observer to write data from superdroplets to ragged arrays in a dataset + * at a constant time interval. + * @tparam Store Type of store for dataset. + * @tparam CollectData Type of collect data function. + * @tparam RaggedCount Type of collect ragged count function. + * @param interval Constant timestep interval. + * @param dataset Dataset to write data to. + * @param collect_data Function to collect data from superdroplets. + * @param ragged_count Function to collect ragged count for superdroplet data arrays(s). + * @return Constructed observer. + */ template CollectData, CollectRaggedCount RaggedCount> inline Observer auto WriteToDatasetObserver(const unsigned int interval, From b41588b4d44d1806266fd0dd5df66528ade2c663 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Thu, 11 Apr 2024 15:02:32 +0200 Subject: [PATCH 14/35] docs(observers): docstrings for parallel_write_data structs --- libs/observers/parallel_write_data.hpp | 186 ++++++++++++++++++++----- 1 file changed, 153 insertions(+), 33 deletions(-) diff --git a/libs/observers/parallel_write_data.hpp b/libs/observers/parallel_write_data.hpp index 0796c311f..3a0bfd520 100644 --- a/libs/observers/parallel_write_data.hpp +++ b/libs/observers/parallel_write_data.hpp @@ -9,15 +9,15 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Tuesday 9th April 2024 + * Last Modified: Thursday 11th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License * https://opensource.org/licenses/BSD-3-Clause * ----- * File Description: - * Template for "ParallelWriteData" function-like object (see write_to_dataset_observer.hpp) for - * writing data from gridboxes and/or superdroplets to arrays in a dataset + * Some "ParallelWriteData" function-like objects (see write_to_dataset_observer.hpp) for + * writing data from gridboxes and/or superdroplets to arrays in a dataset. */ #ifndef LIBS_OBSERVERS_PARALLEL_WRITE_DATA_HPP_ @@ -29,14 +29,27 @@ #include "../kokkosaliases.hpp" #include "zarr/dataset.hpp" -/* struct for function-like object to call for parallel_gridboxes_func in ParallelWriteGridboxes */ +/** + * @brief Struct for a function-like object with operator() to call when using type as + * parallel_gridboxes_func object in ParallelWriteGridboxes. + * + * Struct for a function-like object with operator() suitable for parallel_gridboxes_func object in + * ParallelWriteGridboxes in order to loop over gridbxoes using a kokkos range policy. + */ struct ParallelGridboxesRangePolicyFunc { - /* Parallel loop over gridboxes using Kokkos Range Policy. - Kokkos::parallel_for([...]) is equivalent in serial to: - for (size_t ii(0); ii < d_gbxs.extent(0); ++ii){[...]} - _Note:_ Functor must have operator with signature: - operator()(const size_t ii). - */ + /** + * @brief Parallel loop over gridboxes using a Kokkos Range Policy. + * + * Kokkos::parallel_for([...]) is equivalent in serial to: + * for (size_t ii(0); ii < d_gbxs.extent(0); ++ii){[...]}. + * + * _Note:_ type for Functor used in this call must have operator() with signature: + * void operator()(const size_t ii). + * + * @tparam Functor The type of the functor. + * @param functor The functor to be executed in parallel. + * @param d_gbxs The view of gridboxes. + */ template void operator()(const Functor functor, const viewd_constgbx d_gbxs) const { const size_t ngbxs(d_gbxs.extent(0)); @@ -45,14 +58,27 @@ struct ParallelGridboxesRangePolicyFunc { } }; -/* struct for function-like object to call for parallel_gridboxes_func in ParallelWriteGridboxes */ +/** + * @brief Struct for a function-like object with operator() to call when using type as + * parallel_gridboxes_func object in ParallelWriteGridboxes. + * + * Struct for a function-like object with operator() suitable for parallel_gridboxes_func object in + * ParallelWriteGridboxes in order to loop over gridbxoes using a kokkos team policy. + */ struct ParallelGridboxesTeamPolicyFunc { - /* Parallel loop over gridboxes using Kokkos Team Policy. - Kokkos::parallel_for([...]) is equivalent in serial to: - for (size_t ii(0); ii < d_gbxs.extent(0); ++ii){[...]} - _Note:_ Functor must have operator with signature: - operator()(const TeamMember &team_member). - */ + /** + * @brief Parallel loop over gridboxes using a Kokkos Team Policy. + * + * Kokkos::parallel_for([...]) is equivalent in serial to: + * for (size_t ii(0); ii < d_gbxs.extent(0); ++ii){[...]}. + * + * _Note:_ type for Functor used in this call must have operator() with signature: + * void operator()(const TeamMember &team_member). + * + * @tparam Functor The type of the functor. + * @param functor The functor to be executed in parallel. + * @param d_gbxs The view of gridboxes. + */ template void operator()(const Functor functor, const viewd_constgbx d_gbxs) const { const size_t ngbxs(d_gbxs.extent(0)); @@ -60,27 +86,69 @@ struct ParallelGridboxesTeamPolicyFunc { } }; -/* struct for "ParallelWriteData" (see write_to_dataset_observer.hpp) to collect data from -gridboxes in a parallel loop and write it to arrays in a dataset */ +/** + * @brief Struct for "ParallelWriteData" (see write_to_dataset_observer.hpp) to collect data from + * gridboxes in a loop (e.g. using Kokkos::parallel_for with a range or team policy) and then write + * that data to arrays in a dataset. + * + * This struct is responsible for collecting data from gridboxes and writing it to arrays in a + * dataset with a given store. + * + * The ParallelGridboxesFunc type is a function-like object responsible for looping over + * gridboxes in parallel (see ParallelGridboxesRangePolicyFunc or ParallelGridboxesTeamPolicyFunc). + * The CollectData type satisfies the concept for CollectDataForDataset and the signature for the + * operator of the type it returns from its get_functor() call should be compatible with the + * signature of the functor required by the ParallelGridboxesFunc type. + * + * @tparam Store The type of the data store in the dataset. + * @tparam ParallelGridboxesFunc Function-like object for call to loop over gridboxes. + * @tparam CollectData Object satisfying the CollectDataForDataset concept for the given + * store. + */ template CollectData> class ParallelWriteGridboxes { private: - ParallelGridboxesFunc parallel_gridboxes_func; - const Dataset &dataset; ///< dataset to write data to - CollectData collect_data; ///< functions to collect data within gbxs loop and write in dataset + ParallelGridboxesFunc + parallel_gridboxes_func; /**< Function-like object for call to loop over gridboxes.*/ + const Dataset &dataset; /**< Dataset to write data to. */ + CollectData collect_data; /**< CollectData Object satisfying the CollectDataForDataset concept. */ public: + /** + * @brief Constructs a new ParallelWriteGridboxes object. + * + * @param parallel_gridboxes_func Function-like object for call to loop over gridboxes. + * @param dataset The dataset to write data to. + * @param collect_data The object satisfying the CollectDataForDataset concept to collect data. + */ ParallelWriteGridboxes(ParallelGridboxesFunc parallel_gridboxes_func, const Dataset &dataset, CollectData collect_data) : parallel_gridboxes_func(parallel_gridboxes_func), dataset(dataset), collect_data(collect_data) {} + /** + * @brief Destructor for the ParallelWriteGridboxes class. + */ ~ParallelWriteGridboxes() { collect_data.write_arrayshapes(dataset); } - /* Use the CollectData instance's functor to collect data from gridboxes in a parallel loop. + /* Then write the data in the dataset. Inclusion of totsupers so that object can be used as "ParallelWriteData" function in DoWriteToDataset struct */ + + /** + * @brief Executes the operation to collect data from gridboxes and write it to arrays in the + * dataset. + * + * Use the funtor returned by CollectData's get_functor() call to collect data from gridboxes in a + * parallel loop as determined by the parallel_gridboxes_func operator(). + * + * Inclusion of totsupers in function signature so that object can be used as "ParallelWriteData" + * function-like object in DoWriteToDataset struct. + * + * @param d_gbxs The view of gridboxes in device memory. + * @param totsupers The view of superdroplets in device memory. + */ void operator()(const viewd_constgbx d_gbxs, const viewd_constsupers totsupers) const { auto functor = collect_data.get_functor(d_gbxs, totsupers); parallel_gridboxes_func(functor, d_gbxs); @@ -101,19 +169,45 @@ concept CollectRaggedCount = requires(CRC crc, const Dataset &ds, { crc.write_arrayshape(ds) } -> std::same_as; }; -/* struct for "ParallelWriteData" (see write_to_dataset_observer.hpp) to collect data from -superdroplets in a parallel loop and write it to ragged arrays in a dataset */ +/** + * @brief Struct for "ParallelWriteData" (see write_to_dataset_observer.hpp) to collect data from + * superdroplets in a (parallel) loop and then write that data to ragged arrays in a dataset. + * + * This struct is responsible for collecting data from superdroplets and writing it to ragged arrays + * in a dataset with a given store. + * + * The CollectData type satisfies the concept for CollectDataForDataset and the signature for + * the operator of the type it returns from its get_functor() call should be compatible with the + * signature of the functor required by the Kokkos::parallel_for loop over superdroplets. + * + * @tparam Store The type of data store in the dataset. + * @tparam CollectData The object for collecting data satsifying the CollectDataForDataset concept. + * @tparam RaggedCount The type of the function object for writing the ragged count variable in the + * dataset satisfying the CollectRaggedCount concept. + */ template CollectData, CollectRaggedCount RaggedCount> class ParallelWriteSupers { private: - const Dataset &dataset; ///< dataset to write data to - CollectData collect_data; ///< functions to collect data within supers loop and write in dataset - RaggedCount ragged_count; ///< functions to write ragged count variable in dataset + const Dataset &dataset; /**< dataset to write data to */ + CollectData collect_data; + /**< functions to collect data within loop over superdroplets and write it to ragged array(s) + * dataset */ + RaggedCount ragged_count; /**< functions to write ragged count variable to a dataset */ - /* parallel loop over superdroplets using Kokkos Range Policy. - Kokkos::parallel_for([...]) is equivalent in serial to: - for (size_t kk(0); kk < totsupers.extent(0); ++kk){[...]} */ + /** + * @brief Parallel loop over superdroplets using a Kokkos Range Policy. + * + * Kokkos::parallel_for([...]) is equivalent in serial to: + * for (size_t kk(0); kk < totsupers.extent(0); ++kk){[...]} + * + * _Note:_ type for Functor used in this call must have operator() with signature: + * void operator()(const size_t kk). + * + * @tparam Functor The type of the functor. + * @param functor The functor to be executed in parallel. + * @param totsupers The view of superdroplets on device. + */ template void parallel_supers_func(const Functor functor, const viewd_constsupers totsupers) const { const size_t totnsupers(totsupers.extent(0)); @@ -121,18 +215,44 @@ class ParallelWriteSupers { } public: + /** + * @brief Constructs a new ParallelWriteSupers object. + * + * @param dataset The dataset to write data to. + * @param collect_data Object for collecting data satsifying the CollectDataForDataset concept. + * @param ragged_count Object for writing the ragged count variable in the dataset satisfying the + * CollectRaggedCount concept. + */ ParallelWriteSupers(const Dataset &dataset, CollectData collect_data, RaggedCount ragged_count) : dataset(dataset), collect_data(collect_data), ragged_count(ragged_count) {} + /** + * @brief Destructor for the ParallelWriteSupers class. + * + */ ~ParallelWriteSupers() { collect_data.write_ragged_arrayshapes(dataset); ragged_count.write_arrayshape(dataset); } /* Use the CollectData instance's functor to collect data from superdroplets in a parallel loop. - Then write the data in the dataset alongside ragged count for arrays. Inclusion of d_gbxs - so that object can be used as "ParallelWriteData" function in DoWriteToDataset struct */ + */ + + /** + * @brief Executes the operation to collect data from superdroplets and write it to ragged arrays + * in the dataset. + * + * Use the funtor returned by CollectData's get_functor() call to collect data from superdroplets + * in a parallel loop as determined by the parallel_supers_func function call. Then write the data + * in the dataset alongside ragged count for arrays. + * + * Inclusion of d_gbxs in function signature so that object can be used as "ParallelWriteData" + * function-like object in DoWriteToDataset struct. + * + * @param d_gbxs The view of gridboxes in device memory. + * @param totsupers The view of superdroplets in device memory. + */ void operator()(const viewd_constgbx d_gbxs, const viewd_constsupers totsupers) const { collect_data.reallocate_views(totsupers.extent(0)); auto functor = collect_data.get_functor(d_gbxs, totsupers); From ad192122c44de212200eb4aceafbd364f9eb0f24 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Thu, 11 Apr 2024 15:02:58 +0200 Subject: [PATCH 15/35] docs(observers): docstrings for parallel_write_data structs --- libs/observers/parallel_write_data.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libs/observers/parallel_write_data.hpp b/libs/observers/parallel_write_data.hpp index 3a0bfd520..f0ce0b190 100644 --- a/libs/observers/parallel_write_data.hpp +++ b/libs/observers/parallel_write_data.hpp @@ -191,8 +191,7 @@ class ParallelWriteSupers { private: const Dataset &dataset; /**< dataset to write data to */ CollectData collect_data; - /**< functions to collect data within loop over superdroplets and write it to ragged array(s) - * dataset */ + /**< functions to collect data within loop over superdroplets and write to ragged array(s) */ RaggedCount ragged_count; /**< functions to write ragged count variable to a dataset */ /** From b25f76c301db17a1c4b9e037a42db6eda19a47f2 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Thu, 11 Apr 2024 15:07:56 +0200 Subject: [PATCH 16/35] docs(observers): docstrings and rst file for paralle_write_data --- .../cxx/observers/parallel_write_data.rst | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/docs/source/cxx/observers/parallel_write_data.rst b/docs/source/cxx/observers/parallel_write_data.rst index cb0f6b088..6d2ab520b 100644 --- a/docs/source/cxx/observers/parallel_write_data.rst +++ b/docs/source/cxx/observers/parallel_write_data.rst @@ -1,12 +1,34 @@ -XXX Observer -============ +Parallel Write Data +=================== -// TODO(CB) write doc +Header file: ```` +`[source] `_ -Header file: ```` -`[source] `_ +.. doxygenstruct:: ParallelGridboxesRangePolicyFunc + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: + +.. doxygenstruct:: ParallelGridboxesTeamPolicyFunc + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: + +.. doxygenclass:: ParallelWriteGridboxes + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: + +.. doxygenconcept:: CollectRaggedCount + :project: observers -.. doxygenstruct:: XXXObserver +.. doxygenclass:: ParallelWriteSupers :project: observers :private-members: :protected-members: From fb50e4e1996a65e4be5aaadd9b7995ba2c64ecbc Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Thu, 11 Apr 2024 15:10:26 +0200 Subject: [PATCH 17/35] refactor(observers): formatting --- libs/observers/collect_data_for_dataset.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libs/observers/collect_data_for_dataset.hpp b/libs/observers/collect_data_for_dataset.hpp index e6f8e06be..824be5835 100644 --- a/libs/observers/collect_data_for_dataset.hpp +++ b/libs/observers/collect_data_for_dataset.hpp @@ -9,15 +9,16 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Tuesday 9th April 2024 + * Last Modified: Thursday 11th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License * https://opensource.org/licenses/BSD-3-Clause * ----- * File Description: - * Concept of CollectDataForDataset and monoidal structs which can be used by ParallelWriteData - * structs to collect data within parallel loops and write it to arrays in a dataset + * Concept of CollectDataForDataset and monoidal structs which can be used within called to + * ParallelWriteData operator() to collect data within parallel loops and write it to arrays in a + * dataset */ #ifndef LIBS_OBSERVERS_COLLECT_DATA_FOR_DATASET_HPP_ From a960089117ed49da11c91ae03f3c002c92e051cb Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Thu, 11 Apr 2024 15:16:32 +0200 Subject: [PATCH 18/35] docs(observers): docstrings and rst file for collect_data_for_dataset --- .../observers/collect_data_for_dataset.rst | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/docs/source/cxx/observers/collect_data_for_dataset.rst b/docs/source/cxx/observers/collect_data_for_dataset.rst index cb0f6b088..89ee49ad1 100644 --- a/docs/source/cxx/observers/collect_data_for_dataset.rst +++ b/docs/source/cxx/observers/collect_data_for_dataset.rst @@ -1,12 +1,23 @@ -XXX Observer -============ +Collect Data For Dataset +======================== -// TODO(CB) write doc +Header file: ```` +`[source] `_ -Header file: ```` -`[source] `_ +.. doxygenconcept:: CollectDataForDataset + :project: observers + +.. doxygenstruct:: CombinedCollectDataForDataset + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: + +.. doxygenfunction:: operator>>(const CollectData1 a, const CollectData2 b) + :project: observers -.. doxygenstruct:: XXXObserver +.. doxygenstruct:: NullCollectDataForDataset :project: observers :private-members: :protected-members: From c5655f329643fee7b6da3371ec609936032f63d6 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Thu, 11 Apr 2024 15:59:08 +0200 Subject: [PATCH 19/35] docs(observers): docstrings and rst file for generic_collect_data --- .../cxx/observers/generic_collect_data.rst | 17 ++- libs/observers/generic_collect_data.hpp | 130 ++++++++++++++---- 2 files changed, 116 insertions(+), 31 deletions(-) diff --git a/docs/source/cxx/observers/generic_collect_data.rst b/docs/source/cxx/observers/generic_collect_data.rst index cb0f6b088..cfbb297d9 100644 --- a/docs/source/cxx/observers/generic_collect_data.rst +++ b/docs/source/cxx/observers/generic_collect_data.rst @@ -1,12 +1,17 @@ -XXX Observer -============ +Generic Collect Data +==================== -// TODO(CB) write doc +Header file: ```` +`[source] `_ -Header file: ```` -`[source] `_ +.. doxygenstruct:: XarrayAndViews + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: -.. doxygenstruct:: XXXObserver +.. doxygenclass:: GenericCollectData :project: observers :private-members: :protected-members: diff --git a/libs/observers/generic_collect_data.hpp b/libs/observers/generic_collect_data.hpp index 75ac92a8e..54e11d1d3 100644 --- a/libs/observers/generic_collect_data.hpp +++ b/libs/observers/generic_collect_data.hpp @@ -9,15 +9,15 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Tuesday 9th April 2024 + * Last Modified: Thursday 11th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License * https://opensource.org/licenses/BSD-3-Clause * ----- * File Description: - * generic struct satisyfing the CollectDataForDataset concept to collect data a - * variable(s) and write it to xarray(s) in a datatset. + * Very generic struct satisyfing the CollectDataForDataset concept to collect data for a + * variable from gridboxes and/or superdroplets and write it to an xarray in a datatset. */ #ifndef LIBS_OBSERVERS_GENERIC_COLLECT_DATA_HPP_ @@ -31,14 +31,31 @@ #include "zarr/dataset.hpp" #include "zarr/xarray_zarr_array.hpp" +/** + * @brief Struct to 1) manage collecting data into a view in host memory by copying data from the + * device execution space and 2) manage how to write this data to an Xarray for a variable in a + * dataset. + * + * This struct manages an Xarray, a view in host memory and a mirror view in device memory in order + * to collect data for a variable from the execution space and write it to an Xarray in a dataset. + * + * @tparam Store The type of the data store in the Xarray. + * @tparam T The type of the data in the Xarray. + */ template struct XarrayAndViews { - using viewh_data = Buffer::viewh_buffer; // type of view for h_data - using mirrorviewd_data = Buffer::mirrorviewd_buffer; // mirror view type for d_data - XarrayZarrArray xzarr; - viewh_data h_data; // view on host for value of 1 variable from every superdrop - mirrorviewd_data d_data; // mirror view of h_data on device - + using viewh_data = Buffer::viewh_buffer; /**< type of view for h_data */ + using mirrorviewd_data = Buffer::mirrorviewd_buffer; /**< mirror view type for d_data */ + XarrayZarrArray xzarr; /**< Xarray with Zarr backend to write h_data to */ + viewh_data h_data; /**< view on host used to collect some data for the Xarray */ + mirrorviewd_data d_data; /**< mirror view of h_data on device */ + + /** + * @brief Constructs a new XarrayAndViews object. + * + * @param xzarr The Xarray with Zarr backend object. + * @param dataview_size The size of the views for collecting data. + */ XarrayAndViews(const XarrayZarrArray xzarr, const size_t dataview_size) : xzarr(xzarr), h_data("h_data", dataview_size), @@ -47,39 +64,76 @@ struct XarrayAndViews { /* generic struct satisyfing the CollectDataForDataset concept to collect data for a * variable and write it to an xarray in a datatset. */ + +/** + * @brief Generic class satisyfing the CollectDataForDataset concept to collect data for a variable + * and write it to an Xarray in a dataset. + * + * This class provides a functor to collect data into a view in device memory for a single variable + * from superdroplets and/or gridboxes (to be used in a parallel range policy loop over gridboxes + * and/or superdroplets). It also provides functions to then write that collected data to an Xarray + * in a dataset. + * + * @tparam Store The type of the data store of the dataset. + * @tparam T The type of the data in the Xarray. + * @tparam FunctorFunc Type to act as a functor in a Kokkos parallel range policy loop for + * collecting data for a variable from gridbxoes and/or superdroplets + */ template class GenericCollectData { private: - FunctorFunc ffunc; - std::shared_ptr> ptr; // pointer to xarray and views which collect data + FunctorFunc ffunc; /**< functor to collect data into a view during a parallel range policy loop */ + std::shared_ptr> ptr; /**< pointer to xarray and views to collect data */ public: - /* functor to collect 1 variable's data from within a parallel range policy */ + /** + * @brief Generic wrapper to use FunctorFunc type to collect data into a view in device memory + * during a Kokkos::parallel_for loop with a range policy. + */ struct Functor { using mirrorviewd_data = XarrayAndViews::mirrorviewd_data; - FunctorFunc ffunc; - viewd_constgbx d_gbxs; // view of gridboxes on device - viewd_constsupers totsupers; // view of superdroplets on device - mirrorviewd_data d_data; // mirror view for data to collect on device + FunctorFunc ffunc; /**< functor to collect data into d_data during parallel loop */ + viewd_constgbx d_gbxs; /**< view of gridboxes on device */ + viewd_constsupers totsupers; /**< view of superdroplets on device */ + mirrorviewd_data d_data; /**< mirror view on device for data to collect */ Functor(FunctorFunc ffunc, const viewd_constgbx d_gbxs, const viewd_constsupers totsupers, mirrorviewd_data d_data) : ffunc(ffunc), d_gbxs(d_gbxs), totsupers(totsupers), d_data(d_data) {} - /* Functor operator to perform copy of 1 variable in gridboxes and/or superdroplets - to d_data from within a parallel loop using a Kokkos range policy */ + /** + * @brief Adapter from signature of Kokkos::parallel_for with a range policy to call to + * FunctorFunc type for collecting data into d_data from gridboxes and/or superdroplets. + * + * @param nn The index of the data element. + */ KOKKOS_INLINE_FUNCTION void operator()(const size_t nn) const { ffunc(nn, d_gbxs, totsupers, d_data); } }; /* Constructor to initialize GenericCollectData given functor function-like object, - an xarray in a dataset and the size of the data view used to collect data - from within the functor function call. */ + an xarray in a dataset and the size of the data view */ + /** + * @brief Constructs a new GenericCollectData object. + * + * The dataview_size should match the number of elements to collect when ffunc is called during a + * Kokkos::parallel_for loop which uses a range policy over gridboxes and/or superdroplets. + * + * @param ffunc Function-like object for the functor to collect data. + * @param xzarr The Xarray object in a dataset to write for a variable data to. + * @param dataview_size The size of the view to collect data (number of elements). + */ GenericCollectData(const FunctorFunc ffunc, const XarrayZarrArray xzarr, const size_t dataview_size) : ffunc(ffunc), ptr(std::make_shared>(xzarr, dataview_size)) {} - /* return functor for getting 1 variable from every gridbox in parallel range policy */ + /** + * @brief Returns the functor for collecting data. + * + * @param d_gbxs The view of gridboxes on device. + * @param totsupers The view of superdroplets on device. + * @return The functor object to use during a Kokkos:parallel_for range policy loop. + */ Functor get_functor(const viewd_constgbx d_gbxs, const viewd_constsupers totsupers) const { assert(((ptr->d_data.extent(0) == d_gbxs.extent(0)) || (ptr->d_data.extent(0) == totsupers.extent(0))) && @@ -87,29 +141,55 @@ class GenericCollectData { return Functor(ffunc, d_gbxs, totsupers, ptr->d_data); } + /** + * @brief Reallocates the views with a new size. + * + * The size of the view should match the number of elements to collect when ffunc is called during + * a Kokkos::parallel_for loop which uses a range policy over gridboxes and/or superdroplets. + * + * @param size The new size of the views on device and host. + */ void reallocate_views(const size_t size) const { Kokkos::realloc(ptr->h_data, size); Kokkos::realloc(ptr->d_data, size); } - /* copy data from device view directly to host and then write to array in dataset */ + /** + * @brief Deep copies data for an array from the device view to the host and then writes it to an + * array in the dataset. + * + * @param dataset The dataset to write data to. + */ void write_to_arrays(const Dataset &dataset) const { Kokkos::deep_copy(ptr->h_data, ptr->d_data); dataset.write_to_array(ptr->xzarr, ptr->h_data); } - /* copy data from device view directly to host and then write to array in dataset */ + /** + * @brief Deep copies data for a ragged array from the device view to the host and then writes it + * to a ragged array in the dataset. + * + * @param dataset The dataset to write data to. + */ void write_to_ragged_arrays(const Dataset &dataset) const { Kokkos::deep_copy(ptr->h_data, ptr->d_data); dataset.write_to_ragged_array(ptr->xzarr, ptr->h_data); } - /* call function to write shape of array according to dataset */ + /** + * @brief Calls a function to write the shape of an array to the dataset. + * + * @param dataset The dataset to write array shape to. + */ void write_arrayshapes(const Dataset &dataset) const { dataset.write_arrayshape(ptr->xzarr); } - /* call function to write shape of array according to dataset */ + /** + * @brief Calls a function to write the shape of a ragged array to the dataset. + * + * @param dataset The dataset to write array shape to. + */ void write_ragged_arrayshapes(const Dataset &dataset) const { dataset.write_ragged_arrayshape(ptr->xzarr); } From e9782f78a4a15a8d38647cb4a2252695fbc9a991 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Thu, 11 Apr 2024 16:02:10 +0200 Subject: [PATCH 20/35] chore: todos and formatting --- docs/source/usage/contributing.rst | 2 ++ docs/source/usage/requirements.rst | 2 -- libs/cartesiandomain/CMakeLists.txt | 2 +- libs/cartesiandomain/cartesianmotion_withreset.cpp | 4 +--- libs/cartesiandomain/cartesianmotion_withreset.hpp | 13 ++++++------- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/docs/source/usage/contributing.rst b/docs/source/usage/contributing.rst index aa5456607..26f7b7482 100644 --- a/docs/source/usage/contributing.rst +++ b/docs/source/usage/contributing.rst @@ -9,3 +9,5 @@ simply :ref:`contact us`! We welcome your interest and are enthusiastic about both CLEO's computational development and its use for scientific research. + +TODO(CB) update with commit and code formating requirements diff --git a/docs/source/usage/requirements.rst b/docs/source/usage/requirements.rst index 2ea18e456..f943cdda5 100644 --- a/docs/source/usage/requirements.rst +++ b/docs/source/usage/requirements.rst @@ -1,8 +1,6 @@ Requirements ============ -TODO(CB) update requirements with formating of code? - The following requirements ensure CLEO's build, compilation and execution on DKRZ's Levante HPC. If they do not work, please :ref:`contact us ` or `open a new diff --git a/libs/cartesiandomain/CMakeLists.txt b/libs/cartesiandomain/CMakeLists.txt index 35a18f9c1..67d2fa43c 100644 --- a/libs/cartesiandomain/CMakeLists.txt +++ b/libs/cartesiandomain/CMakeLists.txt @@ -14,7 +14,7 @@ set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib) set(SOURCES "cartesianmaps.cpp" "cartesianmotion.cpp" -#"cartesianmotion_withreset.cpp" # TODO(CB) decide to delete file +#"cartesianmotion_withreset.cpp" "createcartesianmaps.cpp" ) # must use STATIC (not(!) SHARED) lib for linking to executable if build is CUDA enabled with Kokkos diff --git a/libs/cartesiandomain/cartesianmotion_withreset.cpp b/libs/cartesiandomain/cartesianmotion_withreset.cpp index 1b3ba6619..f8860ff4d 100644 --- a/libs/cartesiandomain/cartesianmotion_withreset.cpp +++ b/libs/cartesiandomain/cartesianmotion_withreset.cpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Tuesday 9th April 2024 + * Last Modified: Thursday 11th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -24,8 +24,6 @@ * the domain through coord3 domain boundaries */ -// TODO(CB) decide to delete file - #include "./cartesianmotion_withreset.hpp" KOKKOS_FUNCTION unsigned int change_to_backwards_coord3nghbr_withreset( diff --git a/libs/cartesiandomain/cartesianmotion_withreset.hpp b/libs/cartesiandomain/cartesianmotion_withreset.hpp index 65195cbc5..2326a9477 100644 --- a/libs/cartesiandomain/cartesianmotion_withreset.hpp +++ b/libs/cartesiandomain/cartesianmotion_withreset.hpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Wednesday 6th March 2024 + * Last Modified: Thursday 11th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -24,16 +24,15 @@ * the domain through coord3 domain boundaries */ -// TODO(CB) decide to delete file +// TODO(CB) revisit and improve #ifndef LIBS_CARTESIANDOMAIN_CARTESIANMOTION_WITHRESET_HPP_ #define LIBS_CARTESIANDOMAIN_CARTESIANMOTION_WITHRESET_HPP_ -#include -#include - #include #include +#include +#include #include "../cleoconstants.hpp" #include "../kokkosaliases.hpp" @@ -169,7 +168,7 @@ struct ResetSuperdrop { /* returns xi given value of normalised probability distribution at radius and the bin width */ KOKKOS_FUNCTION uint64_t new_xi(const double gbxvol, const double log10rlow, - const double log10rup, const double radius) const { + const double log10rup, const double radius) const { constexpr double numconc = 100000000 * dlc::VOL0; // 100/cm^3, non-dimensionalised const auto rlow = double{Kokkos::pow(10.0, log10rlow)}; @@ -178,7 +177,7 @@ struct ResetSuperdrop { const auto prob = prob_distrib(radius, rlow, rup); const auto xi = double{prob * numconc * gbxvol}; - return (uint64_t) Kokkos::round(xi); + return (uint64_t)Kokkos::round(xi); } KOKKOS_FUNCTION unsigned int operator()(const CartesianMaps &gbxmaps, Superdrop &drop) const { From eb15834f6ff3d58db3eb08f1b1be0df2fa83e418 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Thu, 11 Apr 2024 18:29:31 +0200 Subject: [PATCH 21/35] docs(observers): docstrings and rst file for massmoments_observer --- .../cxx/observers/massmoments_observer.rst | 42 ++- libs/observers/massmoments_observer.cpp | 65 ++-- libs/observers/massmoments_observer.hpp | 283 +++++++++++++++--- 3 files changed, 321 insertions(+), 69 deletions(-) diff --git a/docs/source/cxx/observers/massmoments_observer.rst b/docs/source/cxx/observers/massmoments_observer.rst index cb0f6b088..2ca966210 100644 --- a/docs/source/cxx/observers/massmoments_observer.rst +++ b/docs/source/cxx/observers/massmoments_observer.rst @@ -1,14 +1,44 @@ -XXX Observer -============ +Massmoments Observer +==================== -// TODO(CB) write doc +Header file: ```` +`[source] `_ -Header file: ```` -`[source] `_ +.. doxygenstruct:: MassMomentsFunc + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: + +.. doxygenstruct:: RaindropsMassMomentsFunc + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: -.. doxygenstruct:: XXXObserver +.. doxygenstruct:: CollectMassMoments :project: observers :private-members: :protected-members: :members: :undoc-members: + +.. doxygenfunction:: create_massmoment_xarray + :project: observers + +.. doxygenfunction:: create_massmom0_xarray + :project: observers + +.. doxygenfunction::create_massmom1_xarray + :project: observers + +.. doxygenfunction:: create_massmom2_xarray + :project: observers + +.. doxygenfunction::MassMomentsObserver + :project: observers + +.. doxygenfunction::MassMomentsRaindropsObserver + :project: observers diff --git a/libs/observers/massmoments_observer.cpp b/libs/observers/massmoments_observer.cpp index a8fec513c..aa52b8d73 100644 --- a/libs/observers/massmoments_observer.cpp +++ b/libs/observers/massmoments_observer.cpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Tuesday 9th April 2024 + * Last Modified: Thursday 11th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -22,14 +22,28 @@ #include "./massmoments_observer.hpp" -/* Function performs calculation of 0th, 1st and 2nd moments of the (real) droplet mass distribution -in each gridbox, i.e. 0th, 3rd and 6th moments of the droplet radius distribution for each gridbox. -Calculation is done for all gridboxes in parallel. -Kokkos::parallel_reduce([...]) is equivalent in serial to: -for (size_t kk(0); kk < supers.extent(0); ++kk){[...]}. -Note conversion from 8 to 4byte precision for all mass moments: mom0 from size_t (architecture -dependent usually long unsigned int = 8 bytes) to 8 byte unsigned integer, and mom1 -and mom2 from double (8 bytes) to float (4 bytes) */ +/** + * @brief Functor operator to perform calculation of 0th, 1st, and 2nd moments of the (real) + * droplet mass distribution in each gridbox. + * + * This operator is a functor to perform the calculation of the 0th, 1st, and 2nd moments + * of the droplet mass distribution in each gridbox (i.e. 0th, 3rd, and 6th moments of the + * droplet radius distribution) within a Kokkos::parallel_reduce range policy + * loop over superdroplets. + * + * Kokkos::parallel_reduce([...]) is equivalent in serial to sum over result of: + * for (size_t kk(0); kk < supers.extent(0); ++kk){[...]}. + * + * _Note:_ conversion from 8 to 4-byte precision for all mass moments: mom0 from size_t + * (architecture dependent usually long unsigned int = 8 bytes) to 8 byte unsigned integer, and + * mom1 and mom2 from double (8 bytes) to float (4 bytes). + * + * @param team_member The Kokkos team member. + * @param d_gbxs The view of gridboxes on device. + * @param d_mom0 The mirror view buffer for the 0th mass moment. + * @param d_mom1 The mirror view buffer for the 1st mass moment. + * @param d_mom2 The mirror view buffer for the 2nd mass moment. + */ KOKKOS_FUNCTION void MassMomentsFunc::operator()(const TeamMember &team_member, const viewd_constgbx d_gbxs, Buffer::mirrorviewd_buffer d_mom0, @@ -56,15 +70,30 @@ void MassMomentsFunc::operator()(const TeamMember &team_member, const viewd_cons d_mom0(ii), d_mom1(ii), d_mom2(ii)); // {0th, 1st, 2nd} mass moments } -/* Function performs calculation of 0th, 1st and 2nd moments of the (real) -raindroplet mass distribution in each gridbox, i.e. 0th, 3rd and 6th moments of the raindroplet -radius distribution for each gridbox. A raindrop is droplet with a radius >= rlim = 40microns. -Calculation is done for all gridboxes in parallel. -Kokkos::parallel_reduce([...]) is equivalent in serial to: -for (size_t kk(0); kk < supers.extent(0); ++kk){[...]}. -Note conversion from 8 to 4byte precision for all mass moments: mom0 from size_t (architecture -dependent usually long unsigned int = 8 bytes) to 8 byte unsigned integer, and mom1 -and mom2 from double (8 bytes) to float (4 bytes) */ +/** + * @brief Functor operator to perform calculation of 0th, 1st, and 2nd moments of the (real) + * droplet mass distribution in each gridbox. + * + * This operator is a functor to perform the calculation of the 0th, 1st, and 2nd moments + * of the droplet mass distribution in each gridbox (i.e. 0th, 3rd, and 6th moments of the + * droplet radius distribution) within a Kokkos::parallel_for range policy + * loop over superdroplets. + * + * A raindroplet is a droplet with a radius >= rlim = 40microns. + * + * Kokkos::parallel_reduce([...]) is equivalent in serial to sum over result of: + * for (size_t kk(0); kk < supers.extent(0); ++kk){[...]}. + * + * _Note:_ conversion from 8 to 4-byte precision for all mass moments: mom0 from size_t + * (architecture dependent usually long unsigned int = 8 bytes) to 8 byte unsigned integer, and + * mom1 and mom2 from double (8 bytes) to float (4 bytes). + * + * @param team_member The Kokkos team member. + * @param d_gbxs The view of gridboxes on device. + * @param d_mom0 The mirror view buffer for the 0th mass moment. + * @param d_mom1 The mirror view buffer for the 1st mass moment. + * @param d_mom2 The mirror view buffer for the 2nd mass moment. + */ KOKKOS_FUNCTION void RaindropsMassMomentsFunc::operator()(const TeamMember &team_member, const viewd_constgbx d_gbxs, diff --git a/libs/observers/massmoments_observer.hpp b/libs/observers/massmoments_observer.hpp index ecae3e6ae..719c413a0 100644 --- a/libs/observers/massmoments_observer.hpp +++ b/libs/observers/massmoments_observer.hpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Tuesday 9th April 2024 + * Last Modified: Thursday 11th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -37,15 +37,39 @@ #include "superdrops/superdrop.hpp" #include "zarr/dataset.hpp" +/** + * @brief Functor to perform calculation of 0th, 1st, and 2nd moments of the (real) + * droplet mass distribution in each gridbox. + * + * This operator is a functor to perform the calculation of the 0th, 1st, and 2nd moments + * of the droplet mass distribution in each gridbox within a Kokkos::parallel_for range policy + * loop over superdroplets. The calculation is equivalent to 0th, 3rd, and 6th moments of the + * droplet radius distribution for each gridbox. + * + * _Note:_ the conversion from 8 to 4-byte precision for all three moments. + */ struct MassMomentsFunc { - /* Operator is functor to perform calculation of 0th, 1st and 2nd moments of the (real) - droplet mass distribution in each gridbox, i.e. 0th, 3rd and 6th moments of the droplet - radius distribution for each gridbox. Calculation is done for all gridboxes in parallel. - Kokkos::parallel_reduce([...]) is equivalent in serial to: - for (size_t kk(0); kk < supers.extent(0); ++kk){[...]}. - Note conversion from 8 to 4byte precision for all mass moments: mom0 from size_t (architecture - dependent usually long unsigned int = 8 bytes) to 8 byte unsigned integer, and mom1 - and mom2 from double (8 bytes) to float (4 bytes) */ + /** + * @brief Functor operator to perform calculation of 0th, 1st, and 2nd moments of the (real) + * droplet mass distribution in each gridbox. + * + * This operator is a functor to perform the calculation of the 0th, 1st, and 2nd moments + * of the droplet mass distribution in each gridbox (i.e. 0th, 3rd, and 6th moments of the + * droplet radius distribution) within a Kokkos::parallel_reduce range policy + * loop over superdroplets. + * + * Kokkos::parallel_reduce([...]) is equivalent in serial to sum over result of: + * for (size_t kk(0); kk < supers.extent(0); ++kk){[...]}. + * + * _Note:_ conversion from 8 to 4-byte precision for all mass moments: mom0 from size_t + * (architecture dependent usually long unsigned int = 8 bytes) to 8 byte unsigned integer, and + * mom1 and mom2 from double (8 bytes) to float (4 bytes). + * @param team_member The Kokkos team member. + * @param d_gbxs The view of gridboxes on device. + * @param d_mom0 The mirror view buffer for the 0th mass moment. + * @param d_mom1 The mirror view buffer for the 1st mass moment. + * @param d_mom2 The mirror view buffer for the 2nd mass moment. + */ KOKKOS_FUNCTION void operator()(const TeamMember &team_member, const viewd_constgbx d_gbxs, Buffer::mirrorviewd_buffer d_mom0, @@ -53,16 +77,44 @@ struct MassMomentsFunc { Buffer::mirrorviewd_buffer d_mom2) const; }; +/** + * @brief Functor to perform calculation of 0th, 1st, and 2nd moments of the (real) + * rain-droplet mass distribution in each gridbox. + * + * This operator is a functor to perform the calculation of the 0th, 1st, and 2nd moments + * of the rain-droplet mass distribution in each gridbox within a Kokkos::parallel_for range + * policy loop over superdroplets. The calculation is equivalent to 0th, 3rd, and 6th moments of the + * rain-droplet radius distribution for each gridbox. + * + * A raindroplet is a droplet with a radius >= rlim = 40microns. + * + * _Note:_ the conversion from 8 to 4-byte precision for all three moments. + */ struct RaindropsMassMomentsFunc { - /* Operator is functor to perform calculation of 0th, 1st and 2nd moments of the (real) - raindroplet mass distribution in each gridbox, i.e. 0th, 3rd and 6th moments of the raindroplet - radius distribution for each gridbox. A raindrop is droplet with a radius >= rlim = 40microns. - Calculation is done for all gridboxes in parallel. - Kokkos::parallel_reduce([...]) is equivalent in serial to: - for (size_t kk(0); kk < supers.extent(0); ++kk){[...]}. - Note conversion from 8 to 4byte precision for all mass moments: mom0 from size_t (architecture - dependent usually long unsigned int = 8 bytes) to 8 byte unsigned integer, and mom1 - and mom2 from double (8 bytes) to float (4 bytes) */ + /** + * @brief Functor operator to perform calculation of 0th, 1st, and 2nd moments of the (real) + * droplet mass distribution in each gridbox. + * + * This operator is a functor to perform the calculation of the 0th, 1st, and 2nd moments + * of the droplet mass distribution in each gridbox (i.e. 0th, 3rd, and 6th moments of the + * droplet radius distribution) within a Kokkos::parallel_for range policy + * loop over superdroplets. + * + * A raindroplet is a droplet with a radius >= rlim = 40microns. + * + * Kokkos::parallel_reduce([...]) is equivalent in serial to sum over result of: + * for (size_t kk(0); kk < supers.extent(0); ++kk){[...]}. + * + * _Note:_ conversion from 8 to 4-byte precision for all mass moments: mom0 from size_t + * (architecture dependent usually long unsigned int = 8 bytes) to 8 byte unsigned integer, and + * mom1 and mom2 from double (8 bytes) to float (4 bytes). + * + * @param team_member The Kokkos team member. + * @param d_gbxs The view of gridboxes on device. + * @param d_mom0 The mirror view buffer for the 0th mass moment. + * @param d_mom1 The mirror view buffer for the 1st mass moment. + * @param d_mom2 The mirror view buffer for the 2nd mass moment. + */ KOKKOS_FUNCTION void operator()(const TeamMember &team_member, const viewd_constgbx d_gbxs, Buffer::mirrorviewd_buffer d_mom0, @@ -70,20 +122,30 @@ struct RaindropsMassMomentsFunc { Buffer::mirrorviewd_buffer d_mom2) const; }; -/* struct satifying CollectDataForDataset for collecting the 0th, 1st and 2nd moments of the - * (rain)droplet mass distribution in each gridbox (ie. 0th, 3rd and 6th moments of the radius - * distribution). struct similar to GenericCollectData but specialised with xarrays and a functor - * that stores 3 variables (0th, 1st and 2nd mass moments) and with functor which can act inside a - * kokkos team policy not range policy (see signature of functor's operator() function) */ +/** + * @brief A struct satisfying CollectDataForDataset for collecting the 0th, 1st, and 2nd moments of + * the (rain)droplet mass distribution in each gridbox. + * + * This struct is similar to the GenericCollectData struct but specialized with xarrays and a + * functor that stores three variables (the 0th, 1st, and 2nd mass moments) and with a functor which + * can act inside a Kokkos team policy rather than a range policy. + */ template struct CollectMassMoments { private: FunctorFunc ffunc; - std::shared_ptr> mom0_ptr; // xarray struct for 0th mass moment - std::shared_ptr> mom1_ptr; // xarray struct for 1st mass moment - std::shared_ptr> mom2_ptr; // xarray struct for 2nd mass moment + std::shared_ptr> mom0_ptr; /**< Xarray for 0th mass moment */ + std::shared_ptr> mom1_ptr; /**< Xarray for 1st mass moment */ + std::shared_ptr> mom2_ptr; /**< Xarray for 2nd mass moment */ - /* copy data from device view directly to host and then write to array in dataset */ + /** + * @brief Deep copies data from a device view to the host and then writes the host data to an + * array in the dataset. + * + * @tparam T The data type. + * @param ptr A pointer to a struct with the data views to be copied and the Xarray to write to. + * @param dataset The dataset for the Xarray. + */ template void write_one_array(std::shared_ptr> ptr, const Dataset &dataset) const { @@ -91,7 +153,13 @@ struct CollectMassMoments { dataset.write_to_array(ptr->xzarr, ptr->h_data); } - /* call function to write shape of array according to dataset */ + /** + * @brief Calls a function to write the shape of the array according to the dataset. + * + * @tparam T The data type. + * @param ptr A pointer to struct with the Xarray whose shape must be written. + * @param dataset The dataset to write array shape to. + */ template void write_one_arrayshape(std::shared_ptr> ptr, const Dataset &dataset) const { @@ -99,32 +167,53 @@ struct CollectMassMoments { } public: - /* functor to collect 3 variables from within a parallel team policy */ + /** + * @brief Generic functor to collect all three mass moments from within a Kokkos::parallel_for + * loop over gridboxes with a team policy. + */ struct Functor { using mirrorviewd_mom0 = XarrayAndViews::mirrorviewd_data; using mirrorviewd_mom1 = XarrayAndViews::mirrorviewd_data; using mirrorviewd_mom2 = XarrayAndViews::mirrorviewd_data; - FunctorFunc ffunc; // functor to calculate mass moments within parallel team policy loop - viewd_constgbx d_gbxs; // view of gridboxes on device - mirrorviewd_mom0 d_mom0; // mirror view 0th mass moment on device - mirrorviewd_mom1 d_mom1; // mirror view 1st mass moment on device - mirrorviewd_mom2 d_mom2; // mirror view 2nd mass moment on device + FunctorFunc ffunc; /**< Functor to calculate mass moments within parallel team policy loop */ + viewd_constgbx d_gbxs; /**< View of gridboxes on device */ + mirrorviewd_mom0 d_mom0; /**< Mirror view on device for 0th mass moment */ + mirrorviewd_mom1 d_mom1; /**< Mirror view on device for 1st mass moment */ + mirrorviewd_mom2 d_mom2; /**< Mirror view on device for 2nd mass moment */ + /** + * @brief Constructs a Functor object. + * + * @param ffunc The functor to calculate mass moments within a parallel team policy loop. + * @param d_gbxs The view of gridboxes on the device. + * @param d_mom0 The mirror view for the 0th mass moment on the device. + * @param d_mom1 The mirror view for the 1st mass moment on the device. + * @param d_mom2 The mirror view for the 2nd mass moment on the device. + */ Functor(FunctorFunc ffunc, const viewd_constgbx d_gbxs, mirrorviewd_mom0 d_mom0, mirrorviewd_mom1 d_mom1, mirrorviewd_mom2 d_mom2) : ffunc(ffunc), d_gbxs(d_gbxs), d_mom0(d_mom0), d_mom1(d_mom1), d_mom2(d_mom2) {} - /* Functor operator to perform calculation of massmoments in each gridbox - and then copy to d_data from within a parallel loop using a Kokkos team policy */ + /** + * @brief Adapter to call functor to perform calculation of massmoments in each gridbox + * from within a Kokkos::parallel_for loop with a team policy. + */ KOKKOS_INLINE_FUNCTION void operator()(const TeamMember &team_member) const { ffunc(team_member, d_gbxs, d_mom0, d_mom1, d_mom2); } }; - /* Constructor to initialize CollectMassMoments given functor function-like object, - the xarrays for the 0th, 1st and 2nd mass moments in the dataset and the size of the data view - used to collect data from within the functor function call. */ + /** + * @brief Constructor to initialize CollectMassMoments. + * + * @param ffunc Functor function-like object for calculting mass moments within parallel loop. + * @param xzarr_mom0 Xarray for the 0th mass moment. + * @param xzarr_mom1 Xarray for the 1st mass moment. + * @param xzarr_mom2 Xarray for the 2nd mass moment. + * @param dataview_size Size of the data view used to collect data from within the functor + * function call. + */ CollectMassMoments(const FunctorFunc ffunc, const XarrayZarrArray xzarr_mom0, const XarrayZarrArray xzarr_mom1, const XarrayZarrArray xzarr_mom2, const size_t dataview_size) @@ -133,8 +222,14 @@ struct CollectMassMoments { mom1_ptr(std::make_shared>(xzarr_mom1, dataview_size)), mom2_ptr(std::make_shared>(xzarr_mom2, dataview_size)) {} - /* return functor for getting 0th, 1st and 2nd mass moments from every gridbox in parallel team - * policy */ + /** + * @brief Returns a functor for getting 0th, 1st, and 2nd mass moments from every gridbox + * within a Kokkos::parallel_for loop over gridboxes with a team policy. + * + * @param d_gbxs View of gridboxes on device. + * @param totsupers View of superdroplets on device. + * @return Functor for collecting mass moments. + */ Functor get_functor(const viewd_constgbx d_gbxs, const viewd_constsupers totsupers) const { assert(((mom0_ptr->d_data.extent(0) == d_gbxs.extent(0)) && (mom1_ptr->d_data.extent(0) == d_gbxs.extent(0)) && @@ -143,25 +238,64 @@ struct CollectMassMoments { return Functor(ffunc, d_gbxs, mom0_ptr->d_data, mom1_ptr->d_data, mom2_ptr->d_data); } + /** + * @brief Writes all three mass moments to arrays in the dataset. + * + * @param dataset The dataset to write data to. + */ void write_to_arrays(const Dataset &dataset) const { write_one_array(mom0_ptr, dataset); write_one_array(mom1_ptr, dataset); write_one_array(mom2_ptr, dataset); } + /** + * @brief Writes the shape of all three arrays to the dataset. + * + * @param dataset The dataset to write data to. + */ void write_arrayshapes(const Dataset &dataset) const { write_one_arrayshape(mom0_ptr, dataset); write_one_arrayshape(mom1_ptr, dataset); write_one_arrayshape(mom2_ptr, dataset); } + /** + * @brief Null function to satisfy CollectDataForDataset concept. + * + * @param dataset The dataset to write data to. + */ void write_to_ragged_arrays(const Dataset &dataset) const {} + /** + * @brief Null function to satisfy CollectDataForDataset concept. + * + * @param dataset The dataset to write data to. + */ void write_ragged_arrayshapes(const Dataset &dataset) const {} + /** + * @brief Null function to satisfy CollectDataForDataset concept. + * + * @param sz The size for reallocation of a view. + */ void reallocate_views(const size_t sz) const {} }; +/** + * @brief Creates an XarrayZarrArray for storing the mass moments of each gridbox in a dataset. + * + * @tparam Store The type of data store in the dataset. + * @tparam T The type of the mass moment data to store in the XarrayZarrArray. + * @param dataset The dataset where the XarrayZarrArray will be created. + * @param name The name of the Xarray. + * @param units The units of the mass moment data. + * @param dtype A string representing the data type of the Xarray. + * @param scale_factor The scale factor for the data. + * @param maxchunk The maximum chunk size (number of elements) for the Xarray. + * @param ngbxs The number of gridboxes. + * @return XarrayZarrArray The created XarrayZarrArray. + */ template XarrayZarrArray create_massmoment_xarray(const Dataset &dataset, const std::string_view name, @@ -174,6 +308,19 @@ XarrayZarrArray create_massmoment_xarray(const Dataset &dataset return dataset.template create_array(name, units, dtype, scale_factor, chunkshape, dimnames); } +/** + * @brief Creates an XarrayZarrArray for storing the 0th mass moment in a dataset. + * + * Calls create_massmoment_xarray for data that is represented by 8 byte unsigned integers with + * no units and is called "name" - e.g. the 0th mass moment of a droplet distribution. + * + * @tparam Store The type of data store in the dataset. + * @param dataset The dataset where the XarrayZarrArray will be created. + * @param name The name of the (0th mass moment) Xarray. + * @param maxchunk The maximum chunk size for the Xarray (number of elements). + * @param ngbxs The number of gridboxes. + * @return XarrayZarrArray The created XarrayZarrArray (for the 0th mass moment). + */ template XarrayZarrArray create_massmom0_xarray(const Dataset &dataset, const std::string_view name, @@ -182,6 +329,19 @@ XarrayZarrArray create_massmom0_xarray(const Dataset &da return create_massmoment_xarray(dataset, name, units, " The created XarrayZarrArray (for the 1st mass moment). + */ template XarrayZarrArray create_massmom1_xarray(const Dataset &dataset, const std::string_view name, @@ -192,6 +352,19 @@ XarrayZarrArray create_massmom1_xarray(const Dataset &datas ngbxs); } +/** + * @brief Creates an XarrayZarrArray for storing the 2nd mass moment in a dataset. + * + * Calls create_massmoment_xarray for data that is represented by 4 byte float with + * units "g^2" and is called "name" - e.g. the 2nd mass moment of a droplet distribution. + * + * @tparam Store The type of data store in the dataset. + * @param dataset The dataset where the XarrayZarrArray will be created. + * @param name The name of the (2nd mass moment) Xarray. + * @param maxchunk The maximum chunk size for the Xarray (number of elements). + * @param ngbxs The number of gridboxes. + * @return XarrayZarrArray The created XarrayZarrArray (for the 2nd mass moment). + */ template XarrayZarrArray create_massmom2_xarray(const Dataset &dataset, const std::string_view name, @@ -202,8 +375,18 @@ XarrayZarrArray create_massmom2_xarray(const Dataset &datas ngbxs); } -/* constructs observer which writes mass moments of droplet distribution in each gridbox -with a constant timestep 'interval' using an instance of the WriteToDatasetObserver class */ +/** + * @brief Constructs an observer which writes mass moments of droplet distribution at start of + * each observation timestep to an array with a constant observation timestep "interval". + * + * @tparam Store Type of store for dataset. + * @param interval Observation timestep. + * @param dataset Dataset to write time data to. + * @param maxchunk Maximum number of elements in a chunk (1-D vector size). + * @param ngbxs The number of gridboxes. + * @return Constructed type for writing mass moments of droplet distribution satisfying the + * observer concept. + */ template inline Observer auto MassMomentsObserver(const unsigned int interval, const Dataset &dataset, const int maxchunk, const size_t ngbxs) { @@ -220,8 +403,18 @@ inline Observer auto MassMomentsObserver(const unsigned int interval, const Data return WriteToDatasetObserver(interval, parallel_write); } -/* constructs observer which writes mass moments of raindroplet distribution in each gridbox -with a constant timestep 'interval' using an instance of the WritetoDatasetObserver class */ +/** + * @brief Constructs an observer which writes mass moments of rain-droplet distribution at start + * of each observation timestep to an array with a constant observation timestep "interval". + * + * @tparam Store Type of store for dataset. + * @param interval Observation timestep. + * @param dataset Dataset to write time data to. + * @param maxchunk Maximum number of elements in a chunk (1-D vector size). + * @param ngbxs The number of gridboxes. + * @return Constructed type for writing mass moments of rain-droplet distribution satisfying the + * observer concept. + */ template inline Observer auto MassMomentsRaindropsObserver(const unsigned int interval, const Dataset &dataset, const int maxchunk, From 9305e4e597ab24bb44a2e42dfb6e8703937d61a1 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Thu, 11 Apr 2024 18:37:06 +0200 Subject: [PATCH 22/35] docs(observers): docstrings and rst file for Nsupers observer --- .../source/cxx/observers/nsupers_observer.rst | 18 ++++--- libs/observers/nsupers_observer.hpp | 48 +++++++++++++++---- 2 files changed, 50 insertions(+), 16 deletions(-) diff --git a/docs/source/cxx/observers/nsupers_observer.rst b/docs/source/cxx/observers/nsupers_observer.rst index cb0f6b088..fcda01ae0 100644 --- a/docs/source/cxx/observers/nsupers_observer.rst +++ b/docs/source/cxx/observers/nsupers_observer.rst @@ -1,14 +1,18 @@ -XXX Observer -============ +Nsupers Observer +================ -// TODO(CB) write doc +Header file: ```` +`[source] `_ -Header file: ```` -`[source] `_ - -.. doxygenstruct:: XXXObserver +.. doxygenstruct:: NsupersFunc :project: observers :private-members: :protected-members: :members: :undoc-members: + +.. doxygenfunction:: CollectNsupers + :project: observers + +.. doxygenfunction:: NsupersObserver + :project: observers diff --git a/libs/observers/nsupers_observer.hpp b/libs/observers/nsupers_observer.hpp index decc1c5a1..7383c1401 100644 --- a/libs/observers/nsupers_observer.hpp +++ b/libs/observers/nsupers_observer.hpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Tuesday 9th April 2024 + * Last Modified: Thursday 11th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -38,9 +38,20 @@ #include "gridboxes/gridbox.hpp" #include "zarr/dataset.hpp" -/* Operator is functor to perform copy of the number of superdroplets in each gridbox "nsupers" to -d_data in parallel. Note conversion of nsupers from size_t (architecture dependent usually long -unsigned int = 8 bytes) to single precision (uint32_t = 4 bytes) in output */ +/** + * @brief Functor operator to perform a copy of the number of superdroplets in each gridbox + * "nsupers" 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 nsupers from size_t (architecture-dependent, usually long unsigned int = 8 + * bytes) to single precision (uint32_t = 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 the number of superdroplets. + */ struct NsupersFunc { KOKKOS_INLINE_FUNCTION void operator()(const size_t ii, viewd_constgbx d_gbxs, const viewd_constsupers totsupers, @@ -50,8 +61,17 @@ struct NsupersFunc { } }; -/* constructs CollectDataForDataset for a given Store which writes the number of superdroplets -in each gridbox using an instance of the GenericCollectData class */ +/** + * @brief Constructs type sastifying the CollectDataForDataset concept for a given Store (using an + * instance of the GenericCollectData class) which writes the number of superdroplets in each + * gridbox "nsupers" during the functor call. + * + * @param dataset The dataset to write nsupers to. + * @param maxchunk The maximum chunk size (number of elements). + * @param ngbxs The number of gridboxes. + * @return CollectDataForDataset An instance satisfying the CollectDataForDataset concept for + * collecting the number of superdroplets in each gridbox. + */ template inline CollectDataForDataset auto CollectNsupers(const Dataset &dataset, const int maxchunk, const size_t ngbxs) { @@ -62,9 +82,19 @@ inline CollectDataForDataset auto CollectNsupers(const Dataset &da return GenericCollectData(NsupersFunc{}, xzarr, ngbxs); } -/* constructs observer which writes the number of superdroplets each gridbox -with a constant timestep 'interval' using an instance of the WriteToDatasetObserver class */ -template +/** + * @brief Constructs an observer which writes the number of superdroplets in each gridbox "nsupers" + * at start of each observation timestep to an array with a constant observation timestep + * "interval". + * + * @tparam Store Type of store for dataset. + * @param interval Observation timestep. + * @param dataset Dataset to write time data to. + * @param maxchunk Maximum number of elements in a chunk (1-D vector size). + * @param ngbxs The number of gridboxes. + * @return Observer An observer instance for writing the number of superdroplets. + */ +temp template inline Observer auto NsupersObserver(const unsigned int interval, const Dataset &dataset, const int maxchunk, const size_t ngbxs) { return WriteToDatasetObserver(interval, dataset, CollectNsupers(dataset, maxchunk, ngbxs)); From 13f95803cd401b06336e0df5c12896b457b43cd3 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Thu, 11 Apr 2024 18:38:28 +0200 Subject: [PATCH 23/35] docs(observers): docstrings and rst file for Nsupers observer --- libs/observers/nsupers_observer.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/observers/nsupers_observer.hpp b/libs/observers/nsupers_observer.hpp index 7383c1401..c31d21e8e 100644 --- a/libs/observers/nsupers_observer.hpp +++ b/libs/observers/nsupers_observer.hpp @@ -94,7 +94,7 @@ inline CollectDataForDataset auto CollectNsupers(const Dataset &da * @param ngbxs The number of gridboxes. * @return Observer An observer instance for writing the number of superdroplets. */ -temp template +template inline Observer auto NsupersObserver(const unsigned int interval, const Dataset &dataset, const int maxchunk, const size_t ngbxs) { return WriteToDatasetObserver(interval, dataset, CollectNsupers(dataset, maxchunk, ngbxs)); From 5a83ae29d575e3d40da66acf14d490ebfa136f47 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Thu, 11 Apr 2024 18:49:37 +0200 Subject: [PATCH 24/35] docs(observers): docstrings and rst file for state observer --- docs/source/cxx/observers/state_observer.rst | 16 +++++----------- libs/observers/state_observer.hpp | 20 ++++++++++++++++---- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/docs/source/cxx/observers/state_observer.rst b/docs/source/cxx/observers/state_observer.rst index cb0f6b088..6c4d7c557 100644 --- a/docs/source/cxx/observers/state_observer.rst +++ b/docs/source/cxx/observers/state_observer.rst @@ -1,14 +1,8 @@ -XXX Observer -============ +State Observer +============== -// TODO(CB) write doc +Header file: ```` +`[source] `_ -Header file: ```` -`[source] `_ - -.. doxygenstruct:: XXXObserver +.. doxygefunction:: StateObserver :project: observers - :private-members: - :protected-members: - :members: - :undoc-members: diff --git a/libs/observers/state_observer.hpp b/libs/observers/state_observer.hpp index c431da1b9..6185e7b80 100644 --- a/libs/observers/state_observer.hpp +++ b/libs/observers/state_observer.hpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Tuesday 9th April 2024 + * Last Modified: Thursday 11th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -40,9 +40,21 @@ #include "gridboxes/gridbox.hpp" #include "zarr/dataset.hpp" -/* constructs observer which writes writes thermodynamic and wind velocity variables from the state -of each gridbox with a constant timestep 'interval' using an instance of the WriteToDatasetObserver -class */ +/** + * @brief Constructs an observer which writes the state of a gridbox (thermodynamics and + * wind velocity components) in each gridbox at start of each observation timestep to an array with + * a constant observation timestep "interval". + * + * This function collects thermodynamic properties and wind velocities from the dataset and combines + * them into a single collection of state data. + * + * @tparam Store Type of store for dataset. + * @param interval Observation timestep. + * @param dataset Dataset to write time data to. + * @param maxchunk Maximum number of elements in a chunk (1-D vector size). + * @param ngbxs The number of gridboxes. + * @return Observer An observer instance for writing the state data. + */ template inline Observer auto StateObserver(const unsigned int interval, const Dataset &dataset, const int maxchunk, const size_t ngbxs) { From 91e13a5878c4ae17a4bd3b4ba36062df16a3ffd8 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Thu, 11 Apr 2024 18:51:25 +0200 Subject: [PATCH 25/35] docs(observers): docstrings and rst file for state observer --- docs/source/cxx/observers/state_observer.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/cxx/observers/state_observer.rst b/docs/source/cxx/observers/state_observer.rst index 6c4d7c557..1ad1fd0e3 100644 --- a/docs/source/cxx/observers/state_observer.rst +++ b/docs/source/cxx/observers/state_observer.rst @@ -4,5 +4,5 @@ State Observer Header file: ```` `[source] `_ -.. doxygefunction:: StateObserver +.. doxygenfunction:: StateObserver :project: observers From db6bab3186373af34a6693f45f322dbf4374b936 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Thu, 11 Apr 2024 19:05:28 +0200 Subject: [PATCH 26/35] docs(observers): docstrings and rst file for wind velocities observer --- .../source/cxx/observers/windvel_observer.rst | 33 +++++-- libs/observers/windvel_observer.hpp | 99 ++++++++++++++++--- 2 files changed, 111 insertions(+), 21 deletions(-) diff --git a/docs/source/cxx/observers/windvel_observer.rst b/docs/source/cxx/observers/windvel_observer.rst index cb0f6b088..59da6f4d3 100644 --- a/docs/source/cxx/observers/windvel_observer.rst +++ b/docs/source/cxx/observers/windvel_observer.rst @@ -1,14 +1,35 @@ -XXX Observer -============ +WindVel Observer +================ -// TODO(CB) write doc +Header file: ```` +`[source] `_ -Header file: ```` -`[source] `_ +.. doxygenstruct:: WvelFunc + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: -.. doxygenstruct:: XXXObserver +.. doxygenstruct:: UvelFunc :project: observers :private-members: :protected-members: :members: :undoc-members: + +.. doxygenstruct:: VvelFunc + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: + +.. doxygenfunction:: WindVelObserver + :project: observers + +.. doxygenfunction:: CollectWindVel + :project: observers + +.. doxygenfunction:: WindVelObserver + :project: observers diff --git a/libs/observers/windvel_observer.hpp b/libs/observers/windvel_observer.hpp index dd4431651..801ac1dd9 100644 --- a/libs/observers/windvel_observer.hpp +++ b/libs/observers/windvel_observer.hpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Tuesday 9th April 2024 + * Last Modified: Thursday 11th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -38,9 +38,23 @@ #include "gridboxes/gridbox.hpp" #include "zarr/dataset.hpp" -/* returns CollectDataForDataset which writes a state variable from -each gridbox to an array in a dataset in a given store for a given datatype and using a given -function-like functor */ +/** + * @brief Constructs type sastifying the CollectDataForDataset concept for a given Store (using an + * instance of the GenericCollectData class) which writes a wind velocity component. + * + * Function return type writes a wind velocity component 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. + * + * @param dataset The dataset to write the wind velocity component to. + * @param ffunc The functor function to collect the wind velocity component from within a parallel + * range policy over gridboxes. + * @param maxchunk The maximum chunk size (number of elements). + * @param ngbxs The number of gridboxes. + * @return CollectDataForDataset An instance satisfying the CollectDataForDataset concept for + * collecting a wind velocity component from each gridbox. + */ template CollectDataForDataset auto CollectWindVariable(const Dataset &dataset, const FunctorFunc ffunc, @@ -56,9 +70,19 @@ CollectDataForDataset auto CollectWindVariable(const Dataset &data return GenericCollectData(ffunc, xzarr, ngbxs); } -/* Operator is functor to perform copy of wvel at the centre of each gridbox to d_data -in parallel. Note conversion of wvel from double (8 bytes) to single precision (4 bytes -float) in output */ +/** + * @brief 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 the number of superdroplets. + */ struct WvelFunc { KOKKOS_INLINE_FUNCTION void operator()(const size_t ii, viewd_constgbx d_gbxs, const viewd_constsupers totsupers, @@ -68,9 +92,19 @@ struct WvelFunc { } }; -/* Operator is functor to perform copy of uvel at the centre of each gridbox to d_data -in parallel. Note conversion of uvel from double (8 bytes) to single precision (4 bytes -float) in output */ +/** + * @brief 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 the number of superdroplets. + */ struct UvelFunc { KOKKOS_INLINE_FUNCTION void operator()(const size_t ii, viewd_constgbx d_gbxs, const viewd_constsupers totsupers, @@ -80,9 +114,19 @@ struct UvelFunc { } }; -/* Operator is functor to perform copy of vvel at the centre of each gridbox to d_data -in parallel. Note conversion of vvel from double (8 bytes) to single precision (4 bytes -float) in output */ +/** + * @brief 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 the number of superdroplets. + */ struct VvelFunc { KOKKOS_INLINE_FUNCTION void operator()(const size_t ii, viewd_constgbx d_gbxs, const viewd_constsupers totsupers, @@ -92,8 +136,20 @@ struct VvelFunc { } }; -/* constructs CollectDataForDataset for a given Store which writes the wind velocity at center of -each gridbox using an instance of the GenericCollectData class */ +/** + * @brief 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. + * + * @tparam Store The type of the dataset store. + * @param dataset The dataset to write the wind velocity components to. + * @param maxchunk The maximum chunk size (number of elements). + * @param ngbxs The number of gridboxes. + * @return CollectDataForDataset An instance of CollectDataForDataset for collecting wind + * velocity data. + */ template inline CollectDataForDataset auto CollectWindVel(const Dataset &dataset, const int maxchunk, const size_t ngbxs) { @@ -112,6 +168,19 @@ inline CollectDataForDataset auto CollectWindVel(const Dataset &da /* constructs observer which writes writes the wind velocity at center of each gridbox with a constant timestep 'interval' using an instance of the WriteToDatasetObserver class */ + +/** + * @brief Constructs an observer which writes the wind velocity components in each gridbox (wvel, + * vvel and uvel) at start of each observation timestep to an array with a constant observation + * timestep "interval". + * + * @tparam Store Type of store for dataset. + * @param interval Observation timestep. + * @param dataset Dataset to write time data to. + * @param maxchunk Maximum number of elements in a chunk (1-D vector size). + * @param ngbxs The number of gridboxes. + * @return Observer An observer instance for writing the wind velocity components. + */ template inline Observer auto WindVelObserver(const unsigned int interval, const Dataset &dataset, const int maxchunk, const size_t ngbxs) { From 2aca07e9f3daf602c6bbad1791822c878d3b9d81 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Thu, 11 Apr 2024 19:17:02 +0200 Subject: [PATCH 27/35] docs(observers): docstrings and rst file for wind velocities and thermo observers --- docs/source/cxx/observers/thermo_observer.rst | 40 +++++- .../source/cxx/observers/windvel_observer.rst | 6 +- libs/observers/thermo_observer.hpp | 115 +++++++++++++++--- libs/observers/windvel_observer.hpp | 14 +-- 4 files changed, 138 insertions(+), 37 deletions(-) diff --git a/docs/source/cxx/observers/thermo_observer.rst b/docs/source/cxx/observers/thermo_observer.rst index cb0f6b088..6bcc4dd9b 100644 --- a/docs/source/cxx/observers/thermo_observer.rst +++ b/docs/source/cxx/observers/thermo_observer.rst @@ -1,14 +1,42 @@ -XXX Observer -============ +Thermodynamics Observer +======================= -// TODO(CB) write doc +Header file: ```` +`[source] `_ -Header file: ```` -`[source] `_ +.. doxygenfunction:: CollectThermoVariable + :project: observers + +.. doxygenstruct:: PressFunc + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: -.. doxygenstruct:: XXXObserver +.. doxygenstruct:: TempFunc :project: observers :private-members: :protected-members: :members: :undoc-members: + +.. doxygenstruct:: QvapFunc + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: + +.. doxygenstruct:: QcondFunc + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: + +.. doxygenfunction:: CollectThermo + :project: observers + +.. doxygenfunction:: ThermoObserver + :project: observers diff --git a/docs/source/cxx/observers/windvel_observer.rst b/docs/source/cxx/observers/windvel_observer.rst index 59da6f4d3..60c0c4182 100644 --- a/docs/source/cxx/observers/windvel_observer.rst +++ b/docs/source/cxx/observers/windvel_observer.rst @@ -4,6 +4,9 @@ WindVel Observer Header file: ```` `[source] `_ +.. doxygenfunc:: CollectWindVariable + :project: observers + .. doxygenstruct:: WvelFunc :project: observers :private-members: @@ -25,9 +28,6 @@ Header file: ```` :members: :undoc-members: -.. doxygenfunction:: WindVelObserver - :project: observers - .. doxygenfunction:: CollectWindVel :project: observers diff --git a/libs/observers/thermo_observer.hpp b/libs/observers/thermo_observer.hpp index c4ebe6fbf..74954bfae 100644 --- a/libs/observers/thermo_observer.hpp +++ b/libs/observers/thermo_observer.hpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Tuesday 9th April 2024 + * Last Modified: Thursday 11th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -38,9 +38,23 @@ #include "gridboxes/gridbox.hpp" #include "zarr/dataset.hpp" -/* returns CollectDataForDataset which writes a state variable from -each gridbox to an array in a dataset in a given store for a given datatype and using a given -function-like functor */ +/** + * @brief Constructs type sastifying the CollectDataForDataset concept for a given Store (using an + * instance of the GenericCollectData class) which writes a thermodynamic variable to an Xarray in a + * dataset. + * + * Function return type writes a thermodyanmic varaible "name" to an Xarray as a 4-byte floating + * point type by collecting data according to the given FunctorFunc from within a + * Kokkos::parallel_for loop over gridboxes with a range policy. + * + * @param dataset The dataset to write the variable to. + * @param ffunc The functor function to collect the variable from within a parallel range policy + * over gridboxes. + * @param maxchunk The maximum chunk size (number of elements). + * @param ngbxs The number of gridboxes. + * @return CollectDataForDataset An instance satisfying the CollectDataForDataset concept for + * collecting a 2-D floating point variable (e.g. a thermodynamic variable) from each gridbox. + */ template CollectDataForDataset auto CollectThermoVariable(const Dataset &dataset, const FunctorFunc ffunc, @@ -56,8 +70,19 @@ CollectDataForDataset auto CollectThermoVariable(const Dataset &da return GenericCollectData(ffunc, xzarr, ngbxs); } -/* Operator is functor to perform copy of pressure in each gridbox to d_data in parallel. -Note conversion of pressure from double (8 bytes) to single precision (4 bytes float) in output */ +/** + * @brief Functor operator to perform a copy of the pressure from the state of each gridbox 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 press 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 the number of superdroplets. + */ struct PressFunc { KOKKOS_INLINE_FUNCTION void operator()(const size_t ii, viewd_constgbx d_gbxs, const viewd_constsupers totsupers, @@ -67,9 +92,19 @@ struct PressFunc { } }; -/* Operator is functor to perform copy of temperature in each gridbox to d_data in parallel. -Note conversion of temperature from double (8 bytes) to single precision (4 bytes float) in -output */ +/** + * @brief Functor operator to perform a copy of the temperature from the state of each gridbox 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 temp 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 the number of superdroplets. + */ struct TempFunc { KOKKOS_INLINE_FUNCTION void operator()(const size_t ii, viewd_constgbx d_gbxs, const viewd_constsupers totsupers, @@ -79,9 +114,19 @@ struct TempFunc { } }; -/* Operator is functor to perform copy of vapour mass mixing ratio (qvap) in each gridbox to d_data -in parallel. Note conversion of qvap from double (8 bytes) to single precision (4 bytes float) in -output */ +/** + * @brief Functor operator to perform a copy of the vapour mass mixing ratio "qvap" from the state + * of each gridbox 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 qvap 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 the number of superdroplets. + */ struct QvapFunc { KOKKOS_INLINE_FUNCTION void operator()(const size_t ii, viewd_constgbx d_gbxs, const viewd_constsupers totsupers, @@ -91,9 +136,19 @@ struct QvapFunc { } }; -/* Operator is functor to perform copy of liquid mass mixing ratio (qcond) in each gridbox to d_data -in parallel. Note conversion of qcond from double (8 bytes) to single precision (4 bytes -float) in output */ +/** + * @brief Functor operator to perform a copy of the liquid ass mixing ratio "qcond" from the state + * of each gridbox 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 qcond 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 the number of superdroplets. + */ struct QcondFunc { KOKKOS_INLINE_FUNCTION void operator()(const size_t ii, viewd_constgbx d_gbxs, const viewd_constsupers totsupers, @@ -103,8 +158,20 @@ struct QcondFunc { } }; -/* constructs CollectDataForDataset for a given Store which writes writes thermodynamic variables -from the state of each gridbox using an instance of the GenericCollectData class */ +/** + * @brief Constructs a type satisyfing the CollectDataForDataset concept for collecting multiple + * thermodyanmcis variables from each gridbox and writing them to a dataset. + * + * This function combines CollectDataForDataset types for many thermodynamic variables from each + * gridbox (e.g. press, temp, qvap, qcond, etc.) using instances of the GenericCollectData class. + * + * @tparam Store The type of the dataset store. + * @param dataset The dataset to write the wind velocity components to. + * @param maxchunk The maximum chunk size (number of elements). + * @param ngbxs The number of gridboxes. + * @return CollectDataForDataset An instance of CollectDataForDataset for collecting + * thermodynamics from the state of each gridbox. + */ template inline CollectDataForDataset auto CollectThermo(const Dataset &dataset, const int maxchunk, const size_t ngbxs) { @@ -123,8 +190,18 @@ inline CollectDataForDataset auto CollectThermo(const Dataset &dat return press >> temp >> qvap >> qcond; } -/* constructs observer which writes writes thermodynamic variables from the state of each gridbox -with a constant timestep 'interval' using an instance of the WriteToDatasetObserver class */ +/** + * @brief Constructs an observer which writes thermodyanmcis from each gridbox (e.g. press, temp, + * qvap, etc.) at start of each observation timestep to an array with a constant + * observation timestep "interval". + * + * @tparam Store Type of store for dataset. + * @param interval Observation timestep. + * @param dataset Dataset to write time data to. + * @param maxchunk Maximum number of elements in a chunk (1-D vector size). + * @param ngbxs The number of gridboxes. + * @return Observer An observer instance for writing thermodynamic variables from each gridbox. + */ template inline Observer auto ThermoObserver(const unsigned int interval, const Dataset &dataset, const int maxchunk, const size_t ngbxs) { diff --git a/libs/observers/windvel_observer.hpp b/libs/observers/windvel_observer.hpp index 801ac1dd9..2424bb63a 100644 --- a/libs/observers/windvel_observer.hpp +++ b/libs/observers/windvel_observer.hpp @@ -40,12 +40,12 @@ /** * @brief Constructs type sastifying the CollectDataForDataset concept for a given Store (using an - * instance of the GenericCollectData class) which writes a wind velocity component. + * 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 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. + * 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. * * @param dataset The dataset to write the wind velocity component to. * @param ffunc The functor function to collect the wind velocity component from within a parallel @@ -165,10 +165,6 @@ inline CollectDataForDataset auto CollectWindVel(const Dataset &da return vvel >> uvel >> wvel; } -/* constructs observer which writes writes the wind velocity at center of -each gridbox with a constant timestep 'interval' using an instance of the WriteToDatasetObserver -class */ - /** * @brief Constructs an observer which writes the wind velocity components in each gridbox (wvel, * vvel and uvel) at start of each observation timestep to an array with a constant observation From 881cdd96d11f0a7ee20d61261902b6615e1b3697 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Thu, 11 Apr 2024 19:17:42 +0200 Subject: [PATCH 28/35] docs(observers): docstrings and rst file for wind velocities and thermo observers --- docs/source/cxx/observers/windvel_observer.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/cxx/observers/windvel_observer.rst b/docs/source/cxx/observers/windvel_observer.rst index 60c0c4182..46685fd76 100644 --- a/docs/source/cxx/observers/windvel_observer.rst +++ b/docs/source/cxx/observers/windvel_observer.rst @@ -4,7 +4,7 @@ WindVel Observer Header file: ```` `[source] `_ -.. doxygenfunc:: CollectWindVariable +.. doxygenfunction:: CollectWindVariable :project: observers .. doxygenstruct:: WvelFunc From 8ed7ed9f4b6246aadcb8ec1e591e86999a052955 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Thu, 11 Apr 2024 19:35:05 +0200 Subject: [PATCH 29/35] docs(observers): superdrops docstrings wIP --- .../cxx/observers/superdrops_observer.rst | 10 +- libs/observers/superdrops_observer.hpp | 201 +++++++++++++++--- libs/observers/thermo_observer.hpp | 10 +- libs/observers/windvel_observer.hpp | 8 +- 4 files changed, 189 insertions(+), 40 deletions(-) diff --git a/docs/source/cxx/observers/superdrops_observer.rst b/docs/source/cxx/observers/superdrops_observer.rst index cb0f6b088..44047a2c8 100644 --- a/docs/source/cxx/observers/superdrops_observer.rst +++ b/docs/source/cxx/observers/superdrops_observer.rst @@ -1,10 +1,8 @@ -XXX Observer -============ +Superdrops Observer +=================== -// TODO(CB) write doc - -Header file: ```` -`[source] `_ +Header file: ```` +`[source] `_ .. doxygenstruct:: XXXObserver :project: observers diff --git a/libs/observers/superdrops_observer.hpp b/libs/observers/superdrops_observer.hpp index d6db8df6c..8ee1681f9 100644 --- a/libs/observers/superdrops_observer.hpp +++ b/libs/observers/superdrops_observer.hpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Tuesday 9th April 2024 + * Last Modified: Thursday 11th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -63,9 +63,46 @@ struct RaggedCount { } }; -/* returns CollectDataForDataset which writes a variable (e.g. an attribute) from -each superdroplet to an array in a dataset in a given store for a given datatype and using a given -function-like functor */ +/** + * @brief Constructs type sastifying the CollectDataForDataset concept for a given Store (using an + * instance of the GenericCollectData class) which writes a thermodynamic variable to an Xarray in a + * dataset. + * + * Function return type writes a thermodyanmic varaible "name" to an Xarray as a 4-byte floating + * point type by collecting data according to the given FunctorFunc from within a + * Kokkos::parallel_for loop over gridboxes with a range policy. + * + * @param dataset The dataset to write the variable to. + * @param ffunc The functor function to collect the variable from within a parallel range policy + * over gridboxes. + * @param maxchunk The maximum chunk size (number of elements). + * @param ngbxs The number of gridboxes. + * @return CollectDataForDataset An instance satisfying the CollectDataForDataset concept for + * collecting a 2-D floating point variable (e.g. a thermodynamic variable) from each gridbox. + */ + +/** + * @brief Constructs type sastifying the CollectDataForDataset concept for a given Store (using an + * instance of the GenericCollectData class) which writes a superdroplet variable to a ragged Xarray + * in a dataset. + * + * Function return type writes a superdroplet varaible "name" to a ragged Xarray for a data + * type by collecting data according to the given FunctorFunc from within a + * Kokkos::parallel_for loop over superdroplets with a range policy. + * + * @tparam Store The type of the dataset store. + * @tparam T The type of the superdroplet variable data. + * @tparam FunctorFunc The type of the functor function. + * @param dataset The dataset to collect data from. + * @param ffunc The functor function to apply to collect data. + * @param name The name of the variable. + * @param units The units of the variable. + * @param dtype A string representing the data type of the variable. + * @param scale_factor The scale factor of the variable. + * @param maxchunk The maximum chunk size. + * @return CollectDataForDataset An instance of CollectDataForDataset for collecting + * superdroplet variable data. + */ template CollectDataForDataset auto CollectSuperdropVariable( const Dataset &dataset, const FunctorFunc ffunc, const std::string_view name, @@ -81,8 +118,22 @@ CollectDataForDataset auto CollectSuperdropVariable( } /* Operator is functor to perform copy of value of superdroplet's gridbox index "sdgbxindex" for -each superdroplet in totsupers view to d_data in parallel. Note conversion of sdgbxindex from -unsigned long int (8 bytes) to unsigned int (uint32_t = 4 bytes) */ +each superdroplet in totsupers view to d_data in parallel. Note conversion of + +/** + * @brief Functor operator to perform a copy of the sdgbxindex of each superdroplet to + * d_data within Kokkos::parallel_for loop over superdroplets with a range policy. + * + * Signature of operator such that type can be used by GenericCollectData struct for FunctorFunc. + * + * _Note:_ Conversion of sdgbxindex from unsigned long int (8 bytes) to unsigned int + * (uint32_t = 4 bytes) + * + * @param kk The index of the superdrop. + * @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 the superdroplets' sdgbxindex. + */ struct SdgbxindexFunc { KOKKOS_INLINE_FUNCTION void operator()(const size_t kk, viewd_constgbx d_gbxs, const viewd_constsupers totsupers, @@ -92,6 +143,19 @@ struct SdgbxindexFunc { } }; +/** + * @brief Constructs a collector for each superdroplets' gridbox index data. + * + * This function constructs a type satisfying the CollectDataForDataset to collect each + * superdroplet's gridbox index "sdgbxindex" as a 4 byte unsigned integer and write it to a ragged + * array in a dataset. + * + * @tparam Store The type of the dataset store. + * @param dataset The dataset to collect data from. + * @param maxchunk The maximum chunk size (number of elements). + * @return CollectDataForDataset An instance of CollectDataForDataset for collecting + * sdgbxindex data. + */ template CollectDataForDataset auto CollectSdgbxindex(const Dataset &dataset, const int maxchunk) { @@ -99,9 +163,20 @@ CollectDataForDataset auto CollectSdgbxindex(const Dataset &datase dataset, SdgbxindexFunc{}, "sdgbxindex", "", " auto CollectSdId(const Dataset &dataset, con 1, maxchunk); } -/* Operator is functor to perform copy of xi for each superdroplet in totsupers view to d_data -in parallel. Note conversion of xi from size_t (arch dependent usually 8 bytes) to 8 byte, long -unsigned int (unit64_t) */ +/** + * @brief Functor operator to perform a copy of the multiplicity of each superdroplet to + * d_data within Kokkos::parallel_for loop over superdroplets with a range policy. + * + * Signature of operator such that type can be used by GenericCollectData struct for FunctorFunc. + * + * _Note:_ Conversion of xi from size_t (architecture dependent usually 8 bytes) to 8 byte, long + * unsigned int (unit64_t). + * + * @param kk The index of the superdrop. + * @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 the superdroplets' multiplicity. + */ struct XiFunc { KOKKOS_INLINE_FUNCTION void operator()(const size_t kk, viewd_constgbx d_gbxs, const viewd_constsupers totsupers, @@ -137,8 +223,19 @@ CollectDataForDataset auto CollectXi(const Dataset &dataset, const maxchunk); } -/* Operator is functor to perform copy of radius for each superdroplet in totsupers view to d_data -in parallel. Note conversion of radius from double (8 bytes) to float (4 bytes) */ +/** + * @brief Functor operator to perform a copy of the radius of each superdroplet to + * d_data within Kokkos::parallel_for loop over superdroplets with a range policy. + * + * Signature of operator such that type can be used by GenericCollectData struct for FunctorFunc. + * + * _Note:_ Conversion of radius from double (8 bytes) to float (4 bytes). + * + * @param kk The index of the superdrop. + * @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 the superdroplets' radius. + */ struct RadiusFunc { KOKKOS_INLINE_FUNCTION void operator()(const size_t kk, viewd_constgbx d_gbxs, const viewd_constsupers totsupers, @@ -154,8 +251,19 @@ CollectDataForDataset auto CollectRadius(const Dataset &dataset, c dataset, RadiusFunc{}, "radius", "micro-m", " auto CollectMsol(const Dataset &dataset, con dlc::MASS0grams, maxchunk); } -/* Operator is functor to perform copy of coord3 for each superdroplet in totsupers view -to d_data in parallel. Note conversion of coord3 from double (8 bytes) to float (4 bytes) */ +/** + * @brief Functor operator to perform a copy of the coord3 of each superdroplet to + * d_data within Kokkos::parallel_for loop over superdroplets with a range policy. + * + * Signature of operator such that type can be used by GenericCollectData struct for FunctorFunc. + * + * _Note:_ Conversion of coord3 from double (8 bytes) to float (4 bytes). + * + * @param kk The index of the superdrop. + * @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 the superdroplets' coord3. + */ struct Coord3Func { KOKKOS_INLINE_FUNCTION void operator()(const size_t kk, viewd_constgbx d_gbxs, const viewd_constsupers totsupers, @@ -188,8 +307,19 @@ CollectDataForDataset auto CollectCoord3(const Dataset &dataset, c " auto CollectCoord1(const Dataset &dataset, c " auto CollectCoord2(const Dataset &dataset, c " inline Observer auto SuperdropsObserver(const unsigned int interval, const Dataset &dataset, const int maxchunk, diff --git a/libs/observers/thermo_observer.hpp b/libs/observers/thermo_observer.hpp index 74954bfae..7271da77e 100644 --- a/libs/observers/thermo_observer.hpp +++ b/libs/observers/thermo_observer.hpp @@ -81,7 +81,7 @@ CollectDataForDataset auto CollectThermoVariable(const Dataset &da * @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 the number of superdroplets. + * @param d_data The mirror view buffer for the pressure in each gridbox. */ struct PressFunc { KOKKOS_INLINE_FUNCTION @@ -103,7 +103,7 @@ struct PressFunc { * @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 the number of superdroplets. + * @param d_data The mirror view buffer for the temperature in each gridbox. */ struct TempFunc { KOKKOS_INLINE_FUNCTION @@ -125,7 +125,7 @@ struct TempFunc { * @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 the number of superdroplets. + * @param d_data The mirror view buffer for qvap from each gridbox. */ struct QvapFunc { KOKKOS_INLINE_FUNCTION @@ -147,7 +147,7 @@ struct QvapFunc { * @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 the number of superdroplets. + * @param d_data The mirror view buffer for qcond from each gridbox. */ struct QcondFunc { KOKKOS_INLINE_FUNCTION @@ -192,7 +192,7 @@ inline CollectDataForDataset auto CollectThermo(const Dataset &dat /** * @brief Constructs an observer which writes thermodyanmcis from each gridbox (e.g. press, temp, - * qvap, etc.) at start of each observation timestep to an array with a constant + * qvap, etc.) at start of each observation timestep to a arrays with a constant * observation timestep "interval". * * @tparam Store Type of store for dataset. diff --git a/libs/observers/windvel_observer.hpp b/libs/observers/windvel_observer.hpp index 2424bb63a..b3265f713 100644 --- a/libs/observers/windvel_observer.hpp +++ b/libs/observers/windvel_observer.hpp @@ -81,7 +81,7 @@ CollectDataForDataset auto CollectWindVariable(const Dataset &data * @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 the number of superdroplets. + * @param d_data The mirror view buffer for wvel form each gridbox. */ struct WvelFunc { KOKKOS_INLINE_FUNCTION @@ -103,7 +103,7 @@ struct WvelFunc { * @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 the number of superdroplets. + * @param d_data The mirror view buffer for uvel form each gridbox. */ struct UvelFunc { KOKKOS_INLINE_FUNCTION @@ -125,7 +125,7 @@ struct UvelFunc { * @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 the number of superdroplets. + * @param d_data The mirror view buffer for vvel form each gridbox. */ struct VvelFunc { KOKKOS_INLINE_FUNCTION @@ -167,7 +167,7 @@ inline CollectDataForDataset auto CollectWindVel(const Dataset &da /** * @brief Constructs an observer which writes the wind velocity components in each gridbox (wvel, - * vvel and uvel) at start of each observation timestep to an array with a constant observation + * vvel and uvel) at start of each observation timestep to a arrays with a constant observation * timestep "interval". * * @tparam Store Type of store for dataset. From f3de5ac4fe509185698b85707e050dba9883d0bf Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Thu, 11 Apr 2024 19:39:29 +0200 Subject: [PATCH 30/35] docs(observers): superdrops docstrings wIP --- libs/observers/superdrops_observer.hpp | 98 ++++++++++++++++++++++++-- 1 file changed, 94 insertions(+), 4 deletions(-) diff --git a/libs/observers/superdrops_observer.hpp b/libs/observers/superdrops_observer.hpp index 8ee1681f9..b509d9405 100644 --- a/libs/observers/superdrops_observer.hpp +++ b/libs/observers/superdrops_observer.hpp @@ -117,9 +117,6 @@ CollectDataForDataset auto CollectSuperdropVariable( return GenericCollectData(ffunc, xzarr, 0); } -/* Operator is functor to perform copy of value of superdroplet's gridbox index "sdgbxindex" for -each superdroplet in totsupers view to d_data in parallel. Note conversion of - /** * @brief Functor operator to perform a copy of the sdgbxindex of each superdroplet to * d_data within Kokkos::parallel_for loop over superdroplets with a range policy. @@ -144,7 +141,8 @@ struct SdgbxindexFunc { }; /** - * @brief Constructs a collector for each superdroplets' gridbox index data. + * @brief Constructs a type satisyfing the CollectDataForDataset concept for each superdroplets' + * gridbox index data. * * This function constructs a type satisfying the CollectDataForDataset to collect each * superdroplet's gridbox index "sdgbxindex" as a 4 byte unsigned integer and write it to a ragged @@ -186,6 +184,20 @@ struct SdIdFunc { } }; +/** + * @brief Constructs a type satisyfing the CollectDataForDataset conceptfor each superdroplets' + * identity. + * + * This function constructs a type satisfying the CollectDataForDataset to collect each + * superdroplet's identity "sdId" as a 4 byte unsigned integer and write it to a ragged + * array in a dataset. + * + * @tparam Store The type of the dataset store. + * @param dataset The dataset to collect data from. + * @param maxchunk The maximum chunk size (number of elements). + * @return CollectDataForDataset An instance of CollectDataForDataset for collecting + * sdId data. + */ template CollectDataForDataset auto CollectSdId(const Dataset &dataset, const int maxchunk) { return CollectSuperdropVariable(dataset, SdIdFunc{}, "sdId", "", " An instance of CollectDataForDataset for collecting xi data. + */ template CollectDataForDataset auto CollectXi(const Dataset &dataset, const int maxchunk) { return CollectSuperdropVariable(dataset, XiFunc{}, "xi", "", " An instance of CollectDataForDataset for collecting radius. + */ template CollectDataForDataset auto CollectRadius(const Dataset &dataset, const int maxchunk) { return CollectSuperdropVariable( @@ -273,6 +311,19 @@ struct MsolFunc { } }; +/** + * @brief Constructs a type satisyfing the CollectDataForDataset concept or each superdroplets' + * solute mass. + * + * This function constructs a type satisfying the CollectDataForDataset to collect each + * superdroplet's solute mass "msol" as a 4 byte floating point value and write it to a ragged + * array in a dataset. + * + * @tparam Store The type of the dataset store. + * @param dataset The dataset to collect data from. + * @param maxchunk The maximum chunk size (number of elements). + * @return CollectDataForDataset An instance of CollectDataForDataset for collecting msol. + */ template CollectDataForDataset auto CollectMsol(const Dataset &dataset, const int maxchunk) { return CollectSuperdropVariable(dataset, MsolFunc{}, "msol", "g", " An instance of CollectDataForDataset for collecting coord3. + */ template CollectDataForDataset auto CollectCoord3(const Dataset &dataset, const int maxchunk) { return CollectSuperdropVariable(dataset, Coord3Func{}, "coord3", "m", @@ -329,6 +393,19 @@ struct Coord1Func { } }; +/** + * @brief Constructs a type satisyfing the CollectDataForDataset concept or each superdroplets' + * coord1. + * + * This function constructs a type satisfying the CollectDataForDataset to collect each + * superdroplet's coord1 as a 4 byte floating point value and write it to a ragged + * array in a dataset. + * + * @tparam Store The type of the dataset store. + * @param dataset The dataset to collect data from. + * @param maxchunk The maximum chunk size (number of elements). + * @return CollectDataForDataset An instance of CollectDataForDataset for collecting coord1. + */ template CollectDataForDataset auto CollectCoord1(const Dataset &dataset, const int maxchunk) { return CollectSuperdropVariable(dataset, Coord1Func{}, "coord1", "m", @@ -357,6 +434,19 @@ struct Coord2Func { } }; +/** + * @brief Constructs a type satisyfing the CollectDataForDataset concept or each superdroplets' + * coord2. + * + * This function constructs a type satisfying the CollectDataForDataset to collect each + * superdroplet's coord2 as a 4 byte floating point value and write it to a ragged + * array in a dataset. + * + * @tparam Store The type of the dataset store. + * @param dataset The dataset to collect data from. + * @param maxchunk The maximum chunk size (number of elements). + * @return CollectDataForDataset An instance of CollectDataForDataset for collecting coord2. + */ template CollectDataForDataset auto CollectCoord2(const Dataset &dataset, const int maxchunk) { return CollectSuperdropVariable(dataset, Coord2Func{}, "coord2", "m", From 03f7235715385d65d5cb431559173ef1bee7a020 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Thu, 11 Apr 2024 19:47:10 +0200 Subject: [PATCH 31/35] docs(observers): superdrops docstrings and rst file --- .../cxx/observers/superdrops_observer.rst | 88 ++++++++++++++++++- libs/observers/superdrops_observer.hpp | 57 +++++++----- 2 files changed, 122 insertions(+), 23 deletions(-) diff --git a/docs/source/cxx/observers/superdrops_observer.rst b/docs/source/cxx/observers/superdrops_observer.rst index 44047a2c8..7194a21e1 100644 --- a/docs/source/cxx/observers/superdrops_observer.rst +++ b/docs/source/cxx/observers/superdrops_observer.rst @@ -4,9 +4,95 @@ Superdrops Observer Header file: ```` `[source] `_ -.. doxygenstruct:: XXXObserver +.. doxygenstruct:: RaggedCount :project: observers :private-members: :protected-members: :members: :undoc-members: + +.. doxygenfunction:: CollectSuperdropVariable + :project: observers + +.. doxygenstruct:: SdgbxindexFunc + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: + +.. doxygenfunction:: CollectSdgbxindex + :project: observers + +.. doxygenstruct:: SdIdFunc + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: + +.. doxygenfunction:: CollectSdId + :project: observers + +.. doxygenstruct:: XiFunc + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: + +.. doxygenfunction:: CollectXi + :project: observers + +.. doxygenstruct:: RadiusFunc + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: + +.. doxygenfunction:: CollectRadius + :project: observers + +.. doxygenstruct:: MsolFunc + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: + +.. doxygenfunction:: CollectMsol + :project: observers + +.. doxygenstruct:: Coord3Func + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: + +.. doxygenfunction:: CollectCoord3 + :project: observers + +.. doxygenstruct:: Coord1Func + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: + +.. doxygenfunction:: CollectCoord1 + :project: observers + +.. doxygenstruct:: Coord2Func + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: + +.. doxygenfunction:: CollectCoord2 + :project: observers + +.. doxygenfunction:: SuperdropsObserver + :project: observers diff --git a/libs/observers/superdrops_observer.hpp b/libs/observers/superdrops_observer.hpp index b509d9405..0850bffbc 100644 --- a/libs/observers/superdrops_observer.hpp +++ b/libs/observers/superdrops_observer.hpp @@ -39,48 +39,61 @@ #include "superdrops/superdrop.hpp" #include "zarr/dataset.hpp" +// TODO(CB) docstrings + +/** + * @brief A struct for collecting ragged count data. + * + * This struct is responsible for collecting ragged count data, which represents the count of the + * number of super-droplets written during a write of a ragged array of superdroplet data. + * + * @tparam Store The type of the dataset store. + */ template struct RaggedCount { private: - std::shared_ptr> xzarr_ptr; ///< pointer to raggedcount array + std::shared_ptr> xzarr_ptr; /**< pointer to raggedcount Xarray */ public: + /** + * @brief Constructs a RaggedCount object. + * + * Constructs a RaggedCount object with the specified dataset and maximum chunk size. + * + * @param dataset The dataset to collect data from. + * @param maxchunk The maximum chunk size (number of elements). + */ RaggedCount(const Dataset &dataset, const size_t maxchunk) : xzarr_ptr(std::make_shared>( dataset.template create_raggedcount_array( "raggedcount", "", " &dataset, const viewd_constsupers totsupers) const { const auto totnsupers = static_cast(totsupers.extent(0)); dataset.write_to_array(xzarr_ptr, totnsupers); } + /** + * @brief Writes the shape of the ragged count array to the dataset. + * + * This function writes the shape of the ragged count array to the dataset. + * + * @param dataset The dataset to write data to. + */ void write_arrayshape(const Dataset &dataset) const { dataset.write_arrayshape(xzarr_ptr); } }; -/** - * @brief Constructs type sastifying the CollectDataForDataset concept for a given Store (using an - * instance of the GenericCollectData class) which writes a thermodynamic variable to an Xarray in a - * dataset. - * - * Function return type writes a thermodyanmic varaible "name" to an Xarray as a 4-byte floating - * point type by collecting data according to the given FunctorFunc from within a - * Kokkos::parallel_for loop over gridboxes with a range policy. - * - * @param dataset The dataset to write the variable to. - * @param ffunc The functor function to collect the variable from within a parallel range policy - * over gridboxes. - * @param maxchunk The maximum chunk size (number of elements). - * @param ngbxs The number of gridboxes. - * @return CollectDataForDataset An instance satisfying the CollectDataForDataset concept for - * collecting a 2-D floating point variable (e.g. a thermodynamic variable) from each gridbox. - */ - /** * @brief Constructs type sastifying the CollectDataForDataset concept for a given Store (using an * instance of the GenericCollectData class) which writes a superdroplet variable to a ragged Xarray From 057a817140fd3f0c7eb24f66ac9a0a272e1ca048 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Thu, 11 Apr 2024 19:51:31 +0200 Subject: [PATCH 32/35] docs(observers): docs for observers complete --- docs/source/cxx/observers/superdrops_observer.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/source/cxx/observers/superdrops_observer.rst b/docs/source/cxx/observers/superdrops_observer.rst index 7194a21e1..44fa70623 100644 --- a/docs/source/cxx/observers/superdrops_observer.rst +++ b/docs/source/cxx/observers/superdrops_observer.rst @@ -4,13 +4,6 @@ Superdrops Observer Header file: ```` `[source] `_ -.. doxygenstruct:: RaggedCount - :project: observers - :private-members: - :protected-members: - :members: - :undoc-members: - .. doxygenfunction:: CollectSuperdropVariable :project: observers @@ -94,5 +87,12 @@ Header file: ```` .. doxygenfunction:: CollectCoord2 :project: observers +.. doxygenstruct:: RaggedCount + :project: observers + :private-members: + :protected-members: + :members: + :undoc-members: + .. doxygenfunction:: SuperdropsObserver :project: observers From 8bc81bcc1a1590c000881974ebc08abfd7840532 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Thu, 11 Apr 2024 22:24:38 +0200 Subject: [PATCH 33/35] fix(observers): add missing public declaration back --- libs/observers/write_to_dataset_observer.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/observers/write_to_dataset_observer.hpp b/libs/observers/write_to_dataset_observer.hpp index 74a7f67ec..2eca6e43a 100644 --- a/libs/observers/write_to_dataset_observer.hpp +++ b/libs/observers/write_to_dataset_observer.hpp @@ -45,6 +45,7 @@ class DoWriteToDataset { private: ParallelWriteData parallel_write; /**< Function-like object to call during at_start_step. */ + public: /** * @brief Constructor for DoWriteToDataset. * @param parallel_write Function-like object to call during at_start_step. From aa89802cdfc9d79e8c6a88b268e6cf71f58d0411 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Thu, 11 Apr 2024 22:31:18 +0200 Subject: [PATCH 34/35] refactir(eurec4a1d): renaming of observers and zarr libraries in eurec4a 1d example --- examples/eurec4a1d/src/main_eurec4a1D.cpp | 26 +++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/eurec4a1d/src/main_eurec4a1D.cpp b/examples/eurec4a1d/src/main_eurec4a1D.cpp index 88a907618..6fd4686b9 100644 --- a/examples/eurec4a1d/src/main_eurec4a1D.cpp +++ b/examples/eurec4a1d/src/main_eurec4a1D.cpp @@ -9,7 +9,7 @@ * Author: Clara Bayley (CB) * Additional Contributors: * ----- - * Last Modified: Tuesday 9th April 2024 + * Last Modified: Thursday 11th April 2024 * Modified By: CB * ----- * License: BSD 3-Clause "New" or "Revised" License @@ -39,16 +39,16 @@ #include "initialise/initgbxs_null.hpp" #include "initialise/initsupers_frombinary.hpp" #include "initialise/timesteps.hpp" -#include "observers2/gbxindex_observer.hpp" -#include "observers2/massmoments_observer.hpp" -#include "observers2/nsupers_observer.hpp" -#include "observers2/observers.hpp" -#include "observers2/runstats_observer.hpp" -#include "observers2/state_observer.hpp" -#include "observers2/streamout_observer.hpp" -#include "observers2/superdrops_observer.hpp" -#include "observers2/time_observer.hpp" -#include "observers2/windvel_observer.hpp" +#include "observers/gbxindex_observer.hpp" +#include "observers/massmoments_observer.hpp" +#include "observers/nsupers_observer.hpp" +#include "observers/observers.hpp" +#include "observers/runstats_observer.hpp" +#include "observers/state_observer.hpp" +#include "observers/streamout_observer.hpp" +#include "observers/superdrops_observer.hpp" +#include "observers/time_observer.hpp" +#include "observers/windvel_observer.hpp" #include "runcleo/coupleddynamics.hpp" #include "runcleo/couplingcomms.hpp" #include "runcleo/initialconditions.hpp" @@ -60,8 +60,8 @@ #include "superdrops/microphysicalprocess.hpp" #include "superdrops/motion.hpp" #include "superdrops/terminalvelocity.hpp" -#include "zarr2/dataset.hpp" -#include "zarr2/fsstore.hpp" +#include "zarr/dataset.hpp" +#include "zarr/fsstore.hpp" inline CoupledDynamics auto create_coupldyn(const Config &config, const CartesianMaps &gbxmaps, const unsigned int couplstep, From cc7f39a4cddb5bd8d30c4cb3b253b81fbd30b615 Mon Sep 17 00:00:00 2001 From: "clara.bayley" Date: Thu, 11 Apr 2024 22:48:01 +0200 Subject: [PATCH 35/35] refactor(eurec4a1d): renaming of observers and zarr libraries in eurec4a 1d example --- examples/eurec4a1d/src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/eurec4a1d/src/CMakeLists.txt b/examples/eurec4a1d/src/CMakeLists.txt index 75796619c..a0c55cd6c 100644 --- a/examples/eurec4a1d/src/CMakeLists.txt +++ b/examples/eurec4a1d/src/CMakeLists.txt @@ -9,7 +9,7 @@ project("eurec4a1d") message("PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}") # Set libraries from CLEO to link with executable -set(CLEOLIBS gridboxes initialise observers2 runcleo superdrops zarr2) +set(CLEOLIBS gridboxes initialise observers runcleo superdrops zarr) # create primary executable for CLEO in 1-D coupled to thermodynamics from file setup add_executable(eurec4a1D EXCLUDE_FROM_ALL "main_eurec4a1D.cpp")