ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_Plotfile2DSampledLevel.H
Go to the documentation of this file.
1 #ifndef ERF_PLOTFILE2DSAMPLED_LEVEL_H_
2 #define ERF_PLOTFILE2DSAMPLED_LEVEL_H_
3 
4 #include <optional>
5 #include <string>
6 
7 #include <AMReX_ParmParse.H>
8 #include <AMReX_REAL.H>
9 #include <AMReX_Vector.H>
10 
11 #include "ERF_Plotfile2DCatalog.H"
13 
14 // User-facing sampled-level definitions for ERF 2D plotfiles. A level set
15 // names a vertical coordinate, target values, and fields to sample. This module
16 // parses and validates those definitions. It does not interpolate fields.
17 
18 namespace plotfile2d
19 {
20 
22 {
23  ModelIndex,
24  HeightMSL,
25  HeightAGL,
26  Pressure
27 };
28 
30 {
31  None,
32  Linear
33 };
34 
36 {
37  std::string type;
39  std::string units;
41  std::string canonical_units;
42  std::string interpolation;
43 };
44 
46 {
47  std::string level_set_name;
48  std::string source_field;
50 };
51 
53 {
54  std::string name;
55  std::string long_name;
56  std::string units;
61  std::optional<SampledLevelMetadata> sampled_level;
62 };
63 
65 {
66  std::string name;
68  std::string units;
69  amrex::Vector<amrex::Real> values;
70  amrex::Vector<std::string> fields;
73 };
74 
75 const char* sampled_coordinate_to_string (SampledCoordinate coordinate) noexcept;
76 const char* sampled_coordinate_tag (SampledCoordinate coordinate) noexcept;
77 const char* sampled_coordinate_default_units (SampledCoordinate coordinate) noexcept;
78 const char* sampled_coordinate_default_interpolation (SampledCoordinate coordinate) noexcept;
79 
80 const char* sampled_interpolation_to_string (SampledInterpolation interpolation) noexcept;
83 std::string validate_sampled_coordinate_string (const std::string& level_set_name,
84  const std::string& value);
85 
86 std::string sampled_level_error_prefix (const std::string& level_set_name,
87  const std::string& parameter_name);
88 
89 std::string sampled_level_value_tag (amrex::Real value, const std::string& units);
90 std::string sampled_output_name (const std::string& field_name,
91  SampledCoordinate coordinate,
93  const std::string& units);
94 
95 std::string validate_sampled_level_definition (const SampledLevelDefinition& level_set);
96 
97 SampledLevelDefinition parse_sampled_level_definition (const std::string& level_set_name,
98  const std::string& pp_prefix);
99 
100 amrex::Vector<std::string> parse_requested_sampled_level_sets (const std::string& pp_prefix,
101  int which);
102 
103 amrex::Vector<Plotfile2DOutputDescriptor> build_sampled_level_output_descriptors_from_definitions (
104  const amrex::Vector<SampledLevelDefinition>& level_sets,
105  const amrex::Vector<std::string>& static_plot_vars,
106  const SolverChoice& solver_choice);
107 
108 amrex::Vector<Plotfile2DOutputDescriptor> build_sampled_level_output_descriptors (
109  const std::string& pp_prefix,
110  int which,
111  const amrex::Vector<std::string>& static_plot_vars,
112  const SolverChoice& solver_choice);
113 
114 } // namespace plotfile2d
115 
116 #endif
Real value
Definition: ERF_HurricaneDiagnostics.cpp:30
std::string units
Definition: ERF_Plotfile2DCatalog.cpp:99
amrex::Real Real
Definition: ERF_ShocInterface.H:19
Definition: ERF_Plotfile2DCatalog.cpp:7
std::string validate_sampled_coordinate_string(const std::string &level_set_name, const std::string &value)
Definition: ERF_Plotfile2DSampledLevel.cpp:196
SampledCoordinate sampled_coordinate_from_string(const std::string &value)
Definition: ERF_Plotfile2DSampledLevel.cpp:162
SampledInterpolation
Definition: ERF_Plotfile2DSampledLevel.H:30
SampledCoordinate
Definition: ERF_Plotfile2DSampledLevel.H:22
SampledLevelDefinition parse_sampled_level_definition(const std::string &level_set_name, const std::string &pp_prefix)
Definition: ERF_Plotfile2DSampledLevel.cpp:308
const char * sampled_coordinate_tag(SampledCoordinate coordinate) noexcept
Definition: ERF_Plotfile2DSampledLevel.cpp:128
std::string validate_sampled_level_definition(const SampledLevelDefinition &level_set)
Definition: ERF_Plotfile2DSampledLevel.cpp:247
DiagnosticCategory
Definition: ERF_Plotfile2DCatalog.H:81
amrex::Vector< std::string > parse_requested_sampled_level_sets(const std::string &pp_prefix, int which)
Definition: ERF_Plotfile2DSampledLevel.cpp:367
SampledInterpolation sampled_interpolation_from_string(const std::string &value)
Definition: ERF_Plotfile2DSampledLevel.cpp:182
const char * sampled_coordinate_to_string(SampledCoordinate coordinate) noexcept
Definition: ERF_Plotfile2DSampledLevel.cpp:116
amrex::Vector< Plotfile2DOutputDescriptor > build_sampled_level_output_descriptors(const std::string &pp_prefix, int which, const amrex::Vector< std::string > &static_plot_vars, const SolverChoice &solver_choice)
Definition: ERF_Plotfile2DSampledLevel.cpp:488
MissingPolicy
Definition: ERF_Plotfile2DCatalog.H:95
const char * sampled_interpolation_to_string(SampledInterpolation interpolation) noexcept
Definition: ERF_Plotfile2DSampledLevel.cpp:152
const char * sampled_coordinate_default_units(SampledCoordinate coordinate) noexcept
Definition: ERF_Plotfile2DSampledLevel.cpp:140
std::string sampled_level_value_tag(amrex::Real value, const std::string &units)
Definition: ERF_Plotfile2DSampledLevel.cpp:225
amrex::Vector< Plotfile2DOutputDescriptor > build_sampled_level_output_descriptors_from_definitions(const amrex::Vector< SampledLevelDefinition > &level_sets, const amrex::Vector< std::string > &static_plot_vars, const SolverChoice &solver_choice)
Definition: ERF_Plotfile2DSampledLevel.cpp:385
const char * sampled_coordinate_default_interpolation(SampledCoordinate coordinate) noexcept
Definition: ERF_Plotfile2DSampledLevel.cpp:146
std::string sampled_output_name(const std::string &field_name, SampledCoordinate coordinate, amrex::Real value, const std::string &units)
Definition: ERF_Plotfile2DSampledLevel.cpp:235
std::string sampled_level_error_prefix(const std::string &level_set_name, const std::string &parameter_name)
Definition: ERF_Plotfile2DSampledLevel.cpp:215
Definition: ERF_DataStruct.H:141
Definition: ERF_Plotfile2DCatalog.H:102
Definition: ERF_Plotfile2DSampledLevel.H:53
std::string units
Definition: ERF_Plotfile2DSampledLevel.H:56
DiagnosticCategory category
Definition: ERF_Plotfile2DSampledLevel.H:57
std::optional< SampledLevelMetadata > sampled_level
Definition: ERF_Plotfile2DSampledLevel.H:61
amrex::Real missing_value
Definition: ERF_Plotfile2DSampledLevel.H:59
MissingPolicy missing_policy
Definition: ERF_Plotfile2DSampledLevel.H:58
std::string name
Definition: ERF_Plotfile2DSampledLevel.H:54
const DiagnosticDescriptor * static_diagnostic
Definition: ERF_Plotfile2DSampledLevel.H:60
std::string long_name
Definition: ERF_Plotfile2DSampledLevel.H:55
Definition: ERF_Plotfile2DSampledLevel.H:65
amrex::Vector< std::string > fields
Definition: ERF_Plotfile2DSampledLevel.H:70
SampledCoordinate coordinate
Definition: ERF_Plotfile2DSampledLevel.H:67
SampledInterpolation interpolation
Definition: ERF_Plotfile2DSampledLevel.H:71
std::string name
Definition: ERF_Plotfile2DSampledLevel.H:66
amrex::Real missing_value
Definition: ERF_Plotfile2DSampledLevel.H:72
amrex::Vector< amrex::Real > values
Definition: ERF_Plotfile2DSampledLevel.H:69
std::string units
Definition: ERF_Plotfile2DSampledLevel.H:68
Definition: ERF_Plotfile2DSampledLevel.H:46
std::string source_field
Definition: ERF_Plotfile2DSampledLevel.H:48
std::string level_set_name
Definition: ERF_Plotfile2DSampledLevel.H:47
SampledVerticalCoordinateMetadata vertical_coordinate
Definition: ERF_Plotfile2DSampledLevel.H:49
Definition: ERF_Plotfile2DSampledLevel.H:36
amrex::Real canonical_value
Definition: ERF_Plotfile2DSampledLevel.H:40
std::string units
Definition: ERF_Plotfile2DSampledLevel.H:39
std::string interpolation
Definition: ERF_Plotfile2DSampledLevel.H:42
std::string canonical_units
Definition: ERF_Plotfile2DSampledLevel.H:41
std::string type
Definition: ERF_Plotfile2DSampledLevel.H:37
amrex::Real value
Definition: ERF_Plotfile2DSampledLevel.H:38