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 , HostDiffusion }
 
enum class  ShocMomentumTransport { None , StateUpdate , HostDiffusion }
 

Functions

const char * shoc_transport_mode_name (ShocTransportMode mode)
 
const char * shoc_momentum_transport_name (ShocMomentumTransport mode)
 
bool shoc_uses_state_update (ShocTransportMode mode)
 
bool shoc_uses_host_diffusion (ShocTransportMode mode)
 
bool shoc_uses_momentum_state_update (ShocMomentumTransport mode)
 
bool shoc_uses_momentum_host_diffusion (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 
HostDiffusion 

◆ ShocTransportMode

enum ShocTransportMode
strong
Enumerator
StateUpdate 
HostDiffusion 
11 {
14 };

Function Documentation

◆ parse_shoc_momentum_transport_string()

bool parse_shoc_momentum_transport_string ( std::string  value,
ShocMomentumTransport mode,
std::string &  error_message 
)
inline
110 {
111  value = shoc_to_lower(value);
112  if (value == "none") {
114  return true;
115  }
116  if (value == "state_update") {
118  return true;
119  }
120  if (value == "host_diffusion") {
122  return true;
123  }
124 
125  error_message = "erf.shoc.momentum_transport must be 'none', 'state_update', or 'host_diffusion'";
126  return false;
127 }
std::string shoc_to_lower(std::string value)
Definition: ERF_ShocTransportStruct.H:75

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
86 {
87  value = shoc_to_lower(value);
88  if (value == "state_update") {
90  return true;
91  }
92  if (value == "host_diffusion") {
94  return true;
95  }
96  if (value == "tendencies") {
97  error_message =
98  "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.";
99  return false;
100  }
101 
102  error_message = "erf.shoc.transport_mode must be 'state_update' or 'host_diffusion'";
103  return false;
104 }

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.

140 {
141  amrex::ParmParse pp("erf.shoc");
142 
143  std::string transport_mode_string;
144  if (pp.query("transport_mode", transport_mode_string)) {
145  std::string error_message;
146  if (!parse_shoc_transport_mode_string(transport_mode_string,
147  transport_mode,
148  error_message)) {
149  amrex::Abort(error_message.c_str());
150  }
151  }
152 
153  std::string momentum_transport_string;
154  if (pp.query("momentum_transport", momentum_transport_string)) {
155  std::string error_message;
156  if (!parse_shoc_momentum_transport_string(momentum_transport_string,
157  momentum_transport,
158  error_message)) {
159  amrex::Abort(error_message.c_str());
160  }
161  }
162 }
ParmParse pp("prob")
bool parse_shoc_momentum_transport_string(std::string value, ShocMomentumTransport &mode, std::string &error_message)
Definition: ERF_ShocTransportStruct.H:107
bool parse_shoc_transport_mode_string(std::string value, ShocTransportMode &mode, std::string &error_message)
Definition: ERF_ShocTransportStruct.H:83

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
70 {
71  return (mode == ShocMomentumTransport::None);
72 }

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
35 {
36  switch (mode) {
37  case ShocMomentumTransport::None: return "none";
38  case ShocMomentumTransport::StateUpdate: return "state_update";
39  case ShocMomentumTransport::HostDiffusion: return "host_diffusion";
40  }
41  return "unknown";
42 }

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
76 {
77  std::transform(value.begin(), value.end(), value.begin(),
78  [] (unsigned char c) { return static_cast<char>(std::tolower(c)); });
79  return value;
80 }

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
25 {
26  switch (mode) {
27  case ShocTransportMode::StateUpdate: return "state_update";
28  case ShocTransportMode::HostDiffusion: return "host_diffusion";
29  }
30  return "unknown";
31 }

Referenced by ShocDriver::print_debug_summary().

Here is the caller graph for this function:

◆ shoc_uses_host_diffusion()

bool shoc_uses_host_diffusion ( ShocTransportMode  mode)
inline

◆ shoc_uses_momentum_host_diffusion()

bool shoc_uses_momentum_host_diffusion ( ShocMomentumTransport  mode)
inline

◆ shoc_uses_momentum_state_update()

bool shoc_uses_momentum_state_update ( ShocMomentumTransport  mode)
inline
58 {
59  return (mode == ShocMomentumTransport::StateUpdate);
60 }

Referenced by ShocDriver::uses_momentum_state_update().

Here is the caller graph for this function:

◆ shoc_uses_state_update()

bool shoc_uses_state_update ( ShocTransportMode  mode)
inline
46 {
47  return (mode == ShocTransportMode::StateUpdate);
48 }

Referenced by shoc_driver_state_update_layout_supported(), and ShocDriver::uses_state_update().

Here is the caller graph for this function: