ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_ShocTransportStruct.H File Reference
#include <AMReX_ParmParse.H>
#include <algorithm>
#include <cctype>
#include <string>
Include dependency graph for ERF_ShocTransportStruct.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum class  ShocTransportMode { StateUpdate }
 
enum class  ShocMomentumTransport { None , StateUpdate }
 

Functions

const char * shoc_transport_mode_name (ShocTransportMode mode)
 
const char * shoc_momentum_transport_name (ShocMomentumTransport mode)
 
bool shoc_uses_momentum_state_update (ShocMomentumTransport mode)
 
bool shoc_disables_momentum_transport (ShocMomentumTransport mode)
 
std::string shoc_to_lower (std::string value)
 
bool parse_shoc_transport_mode_string (std::string value, ShocTransportMode &mode, std::string &error_message)
 
bool parse_shoc_momentum_transport_string (std::string value, ShocMomentumTransport &mode, std::string &error_message)
 
void read_shoc_transport_modes (ShocTransportMode &transport_mode, ShocMomentumTransport &momentum_transport)
 Read the native SHOC transport modes from the erf.shoc input namespace. More...
 

Enumeration Type Documentation

◆ ShocMomentumTransport

enum ShocMomentumTransport
strong
Enumerator
None 
StateUpdate 

◆ ShocTransportMode

enum ShocTransportMode
strong
Enumerator
StateUpdate 
11 {
13 };

Function Documentation

◆ parse_shoc_momentum_transport_string()

bool parse_shoc_momentum_transport_string ( std::string  value,
ShocMomentumTransport mode,
std::string &  error_message 
)
inline
89 {
90  value = shoc_to_lower(value);
91  if (value == "none") {
93  return true;
94  }
95  if (value == "state_update") {
97  return true;
98  }
99  if (value == "host_diffusion") {
100  error_message =
101  "erf.shoc.momentum_transport = host_diffusion has been removed for native SHOC. Use 'state_update' to retain SHOC momentum transport, or 'none' to disable SHOC momentum transport.";
102  return false;
103  }
104 
105  error_message = "erf.shoc.momentum_transport must be 'none' or 'state_update'";
106  return false;
107 }
std::string shoc_to_lower(std::string value)
Definition: ERF_ShocTransportStruct.H:53

Referenced by read_shoc_transport_modes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_shoc_transport_mode_string()

bool parse_shoc_transport_mode_string ( std::string  value,
ShocTransportMode mode,
std::string &  error_message 
)
inline
64 {
65  value = shoc_to_lower(value);
66  if (value == "state_update") {
68  return true;
69  }
70  if (value == "host_diffusion") {
71  error_message =
72  "erf.shoc.transport_mode = host_diffusion has been removed for native SHOC. Use erf.shoc.transport_mode = state_update.";
73  return false;
74  }
75  if (value == "tendencies") {
76  error_message =
77  "erf.shoc.transport_mode = tendencies has been removed for native SHOC. Use erf.shoc.transport_mode = state_update. Native SHOC now applies its coupled column increment before the dycore to avoid splitting theta and momentum from moisture.";
78  return false;
79  }
80 
81  error_message = "erf.shoc.transport_mode must be 'state_update'";
82  return false;
83 }

Referenced by read_shoc_transport_modes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_shoc_transport_modes()

void read_shoc_transport_modes ( ShocTransportMode transport_mode,
ShocMomentumTransport momentum_transport 
)
inline

Read the native SHOC transport modes from the erf.shoc input namespace.

This is the single parse point shared by SolverChoice and the SHOC runtime options, so the dycore and the SHOC driver can never disagree about which component owns transport. Values that are absent from the inputs leave the incoming modes untouched.

120 {
121  amrex::ParmParse pp("erf.shoc");
122 
123  std::string transport_mode_string;
124  if (pp.query("transport_mode", transport_mode_string)) {
125  std::string error_message;
126  if (!parse_shoc_transport_mode_string(transport_mode_string,
127  transport_mode,
128  error_message)) {
129  amrex::Abort(error_message.c_str());
130  }
131  }
132 
133  std::string momentum_transport_string;
134  if (pp.query("momentum_transport", momentum_transport_string)) {
135  std::string error_message;
136  if (!parse_shoc_momentum_transport_string(momentum_transport_string,
137  momentum_transport,
138  error_message)) {
139  amrex::Abort(error_message.c_str());
140  }
141  }
142 }
ParmParse pp("prob")
bool parse_shoc_momentum_transport_string(std::string value, ShocMomentumTransport &mode, std::string &error_message)
Definition: ERF_ShocTransportStruct.H:86
bool parse_shoc_transport_mode_string(std::string value, ShocTransportMode &mode, std::string &error_message)
Definition: ERF_ShocTransportStruct.H:61

Referenced by SolverChoice::init_params(), and read_shoc_runtime_options().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ shoc_disables_momentum_transport()

bool shoc_disables_momentum_transport ( ShocMomentumTransport  mode)
inline
48 {
49  return (mode == ShocMomentumTransport::None);
50 }

Referenced by ShocDriver::disables_momentum_transport(), and SolverChoice::host_owns_vertical_momentum_diffusion().

Here is the caller graph for this function:

◆ shoc_momentum_transport_name()

const char* shoc_momentum_transport_name ( ShocMomentumTransport  mode)
inline
32 {
33  switch (mode) {
34  case ShocMomentumTransport::None: return "none";
35  case ShocMomentumTransport::StateUpdate: return "state_update";
36  }
37  return "unknown";
38 }

Referenced by ShocDriver::print_debug_summary().

Here is the caller graph for this function:

◆ shoc_to_lower()

std::string shoc_to_lower ( std::string  value)
inline
54 {
55  std::transform(value.begin(), value.end(), value.begin(),
56  [] (unsigned char c) { return static_cast<char>(std::tolower(c)); });
57  return value;
58 }

Referenced by parse_shoc_momentum_transport_string(), and parse_shoc_transport_mode_string().

Here is the caller graph for this function:

◆ shoc_transport_mode_name()

const char* shoc_transport_mode_name ( ShocTransportMode  mode)
inline
23 {
24  switch (mode) {
25  case ShocTransportMode::StateUpdate: return "state_update";
26  }
27  return "unknown";
28 }

Referenced by ShocDriver::print_debug_summary().

Here is the caller graph for this function:

◆ shoc_uses_momentum_state_update()

bool shoc_uses_momentum_state_update ( ShocMomentumTransport  mode)
inline
42 {
43  return (mode == ShocMomentumTransport::StateUpdate);
44 }

Referenced by ShocImplicit::finalize_from_pdf(), and ShocDriver::uses_momentum_state_update().

Here is the caller graph for this function: