SpECTRE  v2024.09.29
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
NumericData Class Reference

Load numeric data from volume data files. More...

#include <NumericData.hpp>

Classes

struct  ExtrapolateIntoExcisions
 
struct  FileGlob
 
struct  ObservationStep
 
struct  Subgroup
 

Public Types

using options = implementation defined
 

Public Member Functions

 NumericData (const NumericData &)=default
 
NumericDataoperator= (const NumericData &)=default
 
 NumericData (NumericData &&)=default
 
NumericDataoperator= (NumericData &&)=default
 
 NumericData (std::string file_glob, std::string subgroup, int observation_step, bool extrapolate_into_excisions)
 
const std::stringfile_glob () const
 
const std::stringsubgroup () const
 
int observation_step () const
 
bool extrapolate_into_excisions () const
 
template<typename DataType , size_t Dim, typename... RequestedTags>
tuples::TaggedTuple< RequestedTags... > variables (const tnsr::I< DataType, Dim > &x, tmpl::list< RequestedTags... >) const
 
template<size_t Dim, typename... RequestedTags>
tuples::TaggedTuple< RequestedTags... > variables (const tnsr::I< DataVector, Dim > &x, const Mesh< Dim > &, const InverseJacobian< DataVector, Dim, Frame::ElementLogical, Frame::Inertial > &, tmpl::list< RequestedTags... >) const
 
void pup (PUP::er &p)
 

Static Public Attributes

static constexpr Options::String help
 

Protected Attributes

std::string file_glob_ {}
 
std::string subgroup_ {}
 
int observation_step_ {}
 
bool extrapolate_into_excisions_ {}
 

Detailed Description

Load numeric data from volume data files.

This class loads all requested tags from volume data files using spectre::Exporter::interpolate_to_points. This is an easy and useful alternative to importers::ElementDataReader to load numeric data with the following advantages:

  • No need to work with parallel components, actions, or phases to load numeric data. Also, no need to parse numeric data options separately from analytic data options. Just include this class in the list of analytic data classes for the executable.
  • The data is interpolated and returned in serial, just like analytic data.
  • The data can be re-interpolated to any set of points on request, which is an easy way to handle AMR or other domain changes.

However, it also comes with the following caveats:

  • The volume data files must have datasets with the same names as the tags being loaded. For example, if the tag being loaded is gr::Tags::Shift, then the volume data files must have datasets named Shift_x, Shift_y, and Shift_z. If you need processing of the data before it can be used, e.g. to load some datasets and compute other derived quantities from them, then consider writing a custom class or use importers::ElementDataReader.
  • Reading in data on the same grid that it was written on may not give you the same data back, at least not on Gauss-Lobatto grids. This is because grid points on element boundaries are disambiguated by block_logical_coordinates and element_logical_coordinates, so a boundary point may be written by one element but read back in from its neighbor. To avoid this, consider using importers::ElementDataReader which has functionality to read in data on the same grid that it was written on. This is not possible with this class because it is not aware of the element structure (it operates in a pointwise manner).
  • Large datasets may not fit in memory. Each element will open the H5 files and interpolate data from them, so this may not fit in memory if the datasets are large and/or many elements are doing this at the same time. To avoid this, consider using importers::ElementDataReader which reads one H5 file at a time on the node level.

Member Data Documentation

◆ help

constexpr Options::String NumericData::help
staticconstexpr
Initial value:
=
"Numeric data loaded from volume data files"

The documentation for this class was generated from the following file: