ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
erf_cloud_chamber::Config Struct Reference

#include <ERF_CloudChamber.H>

Inheritance diagram for erf_cloud_chamber::Config:
Collaboration diagram for erf_cloud_chamber::Config:

Public Member Functions

const erf_wall_thermodynamics::Boundary & transport_boundary () const &
 
const erf_wall_thermodynamics::Boundary & transport_boundary () const &&=delete
 
erf_wall_thermodynamics::SidewallBandViews temperature_band_views () const &noexcept
 
erf_wall_thermodynamics::SidewallBandViews temperature_band_views () const &&=delete
 
bool has_wall_rate_channel () const
 

Static Public Member Functions

static bool has_bulk_scalar_wall (const erf_wall_thermodynamics::Boundary &walls) noexcept
 

Private Attributes

std::optional< erf_wall_thermodynamics::Boundary > m_boundary
 
std::array< SidewallTemperatureBands, 4 > m_bands
 

Friends

Config parse_config (const amrex::Geometry &, MoistureType, const DiffChoice &)
 

Additional Inherited Members

- Public Attributes inherited from erf_cloud_chamber::Initialization
bool active = false
 
bool has_moisture = false
 
bool physical_initialization = false
 
amrex::Real initial_temperature_bottom = amrex::Real(0.0)
 
amrex::Real initial_temperature_top = amrex::Real(0.0)
 
amrex::Real initial_relative_humidity = amrex::Real(0.0)
 
amrex::Real temperature_perturbation_amplitude = amrex::Real(0.0)
 
amrex::Real theta_bottom = amrex::Real(0.0)
 
amrex::Real theta_top = amrex::Real(0.0)
 
amrex::Real theta_perturbation_amplitude = amrex::Real(0.0)
 
amrex::Real qv_bottom = amrex::Real(0.0)
 
amrex::Real qv_top = amrex::Real(0.0)
 
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > prob_lo = {}
 
amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > prob_hi = {}
 

Member Function Documentation

◆ has_bulk_scalar_wall()

static bool erf_cloud_chamber::Config::has_bulk_scalar_wall ( const erf_wall_thermodynamics::Boundary &  walls)
inlinestaticnoexcept
72  {
74  for (const auto& wall : walls) {
75  if ((wall.heat_is_conductive() && wall.heat.model == ScalarModel::BulkAero) ||
76  (wall.vapor_is_wet() && wall.vapor.model == ScalarModel::BulkAero)) {
77  return true;
78  }
79  }
80  return false;
81  }
ScalarModel
Definition: ERF_WallThermodynamics.H:32

◆ has_wall_rate_channel()

bool erf_cloud_chamber::Config::has_wall_rate_channel ( ) const
inline
84  {
85  for (const auto& wall : transport_boundary()) {
86  if (wall.has_wall_rate_channel()) { return true; }
87  }
88  return false;
89  }
const erf_wall_thermodynamics::Boundary & transport_boundary() const &
Definition: ERF_CloudChamber.H:59
Here is the call graph for this function:

◆ temperature_band_views() [1/2]

erf_wall_thermodynamics::SidewallBandViews erf_cloud_chamber::Config::temperature_band_views ( ) const &&
delete

◆ temperature_band_views() [2/2]

erf_wall_thermodynamics::SidewallBandViews erf_cloud_chamber::Config::temperature_band_views ( ) const &
inlinenoexcept
66  {
67  return {m_bands[0].view(), m_bands[1].view(), m_bands[2].view(), m_bands[3].view()};
68  }
std::array< SidewallTemperatureBands, 4 > m_bands
Definition: ERF_CloudChamber.H:94

Referenced by erf_slow_rhs_post(), and erf_slow_rhs_pre().

Here is the caller graph for this function:

◆ transport_boundary() [1/2]

const erf_wall_thermodynamics::Boundary& erf_cloud_chamber::Config::transport_boundary ( ) const &
inline
60  {
61  return m_boundary.value();
62  }
std::optional< erf_wall_thermodynamics::Boundary > m_boundary
Definition: ERF_CloudChamber.H:93

Referenced by erf_slow_rhs_post(), erf_slow_rhs_pre(), and has_wall_rate_channel().

Here is the caller graph for this function:

◆ transport_boundary() [2/2]

const erf_wall_thermodynamics::Boundary& erf_cloud_chamber::Config::transport_boundary ( ) const &&
delete

Friends And Related Function Documentation

◆ parse_config

Config parse_config ( const amrex::Geometry &  geom,
MoistureType  selected_moisture_model,
const DiffChoice &  dc 
)
friend
1076 {
1077  Config config;
1078  static_cast<Initialization&>(config) = parse_initialization(
1079  geom.ProbLo(), geom.ProbHi(), selected_moisture_model);
1080  if (config.physical_initialization && dc.molec_diff_type != MolecDiffType::ConstantAlpha) {
1081  amrex::Error("Cloud Chamber: physical wall transfer requires erf.molec_diff_type = ConstantAlpha");
1082  }
1083  // max_level == 0 and ConstantDz were checked above. This is the only geometry
1084  // from which the RHS, timestep and roughness validation get their face metadata.
1086  const auto dx_inv = geom.InvCellSizeArray();
1089  for (int n = 0; n < 2 * AMREX_SPACEDIM; ++n) {
1090  const std::string face = face_name(faces[n]);
1091  amrex::ParmParse pp_face(face.c_str());
1092  reject_unsupported_face_keys(pp_face, face);
1093  std::string type;
1094  if (!pp_face.query("type", type) ||
1095  amrex::toLower(type) != "noslipwall") {
1096  amrex::Error("Cloud Chamber: " + face + ".type must be NoSlipWall");
1097  }
1098  auto& wall = walls[n];
1099  auto transfer_contract = read_wall_transfer_contract(pp_face, face);
1100  const std::string transfer_error =
1101  wall_transfer_contract_error(transfer_contract, face);
1102  if (!transfer_error.empty()) {
1103  amrex::Error(transfer_error);
1104  }
1105  const bool any_channel_key =
1106  transfer_contract.momentum_model_specified ||
1107  transfer_contract.heat_model_specified ||
1108  transfer_contract.vapor_model_specified ||
1109  transfer_contract.coefficient_source_specified ||
1110  transfer_contract.momentum_coefficient_specified ||
1111  transfer_contract.heat_coefficient_specified ||
1112  transfer_contract.vapor_coefficient_specified ||
1113  transfer_contract.z0_m_specified ||
1114  transfer_contract.z0_h_specified ||
1115  transfer_contract.z0_q_specified;
1116  if (!config.physical_initialization && any_channel_key) {
1117  amrex::Error("Cloud Chamber: per-channel wall transfer keys require physical temperature initialization");
1118  }
1119  if (config.physical_initialization) {
1120  if (pp_face.contains("theta") || pp_face.contains("qv") ||
1121  pp_face.contains("theta_grad") || pp_face.contains("qv_grad")) {
1122  amrex::Error("Cloud Chamber: physical walls cannot combine temperature/moisture with legacy theta/qv wall keys");
1123  }
1124  std::string moisture;
1125  pp_face.get("moisture", moisture);
1126  moisture = amrex::toLower(moisture);
1127  if (moisture == "dry") {
1129  } else if (moisture == "wet") {
1131  if (!config.has_moisture) {
1132  amrex::Error("Cloud Chamber: wet walls require an active moisture model");
1133  }
1134  } else {
1135  amrex::Error("Cloud Chamber: " + face + ".moisture must be dry or wet");
1136  }
1137  if (transfer_contract.momentum_model == "law_of_wall_momentum") {
1138  transfer_contract.momentum_model = "neutral_roughness_log";
1139  }
1140  wall.momentum.model =
1141  transfer_contract.momentum_model == "neutral_roughness_log" ?
1143  (is_bulk_model(transfer_contract.momentum_model) ?
1146  wall.heat.model =
1147  is_bulk_model(transfer_contract.heat_model) ?
1149  (transfer_contract.heat_model == "neutral_roughness_log" ?
1152  wall.vapor.model =
1153  is_bulk_model(transfer_contract.vapor_model) ?
1155  (transfer_contract.vapor_model == "neutral_roughness_log" ?
1158  wall.momentum.z0_m = transfer_contract.z0_m;
1159  wall.momentum.C_D = transfer_contract.momentum_coefficient;
1160  wall.heat.z0 = transfer_contract.z0_h;
1161  wall.vapor.z0 = transfer_contract.z0_q;
1162  if (wall.momentum.model == erf_wall_thermodynamics::MomentumModel::BulkAero) {
1163  wall.momentum.provider = transfer_contract.coefficient_source == "most" ?
1166  }
1167  if (wall.heat.model == erf_wall_thermodynamics::ScalarModel::BulkAero) {
1168  wall.heat.provider = transfer_contract.coefficient_source == "most" ?
1171  wall.heat.coefficient = transfer_contract.heat_coefficient;
1172  }
1173  if (wall.vapor.model == erf_wall_thermodynamics::ScalarModel::BulkAero) {
1174  wall.vapor.provider = transfer_contract.coefficient_source == "most" ?
1177  wall.vapor.coefficient = transfer_contract.vapor_coefficient;
1178  }
1179  } else {
1180  if (!pp_face.query("theta", wall.thermal.temperature_K)) {
1181  amrex::Error("Cloud Chamber: missing required " + face + ".theta");
1182  }
1184  wall.moisture = config.has_moisture ?
1187  if (config.has_moisture && !pp_face.contains("qv")) {
1188  amrex::Error("Cloud Chamber: legacy cloudy walls require " + face + ".qv");
1189  }
1190  }
1191  const auto heat_error = parse_wall_heat(pp_face, face, config.physical_initialization, wall,
1192  geom, n < 4 ? &config.m_bands[n] : nullptr);
1193  if (!heat_error.empty()) { amrex::Error(heat_error); }
1194  const auto coupled_error = wall_coupled_most_roughness_error(wall, face);
1195  if (!coupled_error.empty()) { amrex::Error(coupled_error); }
1196  if (config.physical_initialization) {
1197  // After parse_wall_heat: only conductive heat gets a molecular speed.
1198  const auto speed_error = set_wall_transport_speeds(
1199  wall, transfer_contract, dc, dx_inv[n/2], face);
1200  if (!speed_error.empty()) { amrex::Error(speed_error); }
1201  }
1202  for (int d = 0; d < AMREX_SPACEDIM; ++d) {
1203  if (pp_face.contains("velocity")) {
1204  amrex::Error("Cloud Chamber: wall velocity metadata is not active; use NoSlipWall with zero velocity");
1205  }
1206  wall.wall_velocity[d] = amrex::Real(0.0);
1207  }
1208  const auto wetness_error = parse_wall_wetness(pp_face, face, wall);
1209  if (!wetness_error.empty()) { amrex::Error(wetness_error); }
1210  }
1211  validate_wall_roughness_geometry(walls, geom.CellSizeArray());
1212  config.m_boundary = walls;
1213  return config;
1214 }
const auto config
Definition: ERF_InitCustomPert_CloudChamber.H:38
WallFace
Definition: ERF_CloudChamber.H:34
std::string parse_wall_heat(amrex::ParmParse &pp, const std::string &face, bool physical, erf_wall_thermodynamics::FaceWall &wall, const amrex::Geometry &geom, SidewallTemperatureBands *sidewall_bands)
Definition: ERF_CloudChamber.H:648
std::string wall_transfer_contract_error(const WallTransferContract &contract, const std::string &face)
Definition: ERF_CloudChamber.H:472
std::string wall_coupled_most_roughness_error(const erf_wall_thermodynamics::FaceWall &wall, const std::string &face)
Definition: ERF_CloudChamber.H:711
WallTransferContract read_wall_transfer_contract(const amrex::ParmParse &pp, const std::string &face)
Definition: ERF_CloudChamber.H:433
std::string face_name(WallFace face)
Definition: ERF_CloudChamber.H:374
std::string parse_wall_wetness(amrex::ParmParse &pp, const std::string &face, erf_wall_thermodynamics::FaceWall &wall)
Definition: ERF_CloudChamber.H:393
void validate_wall_roughness_geometry(const erf_wall_thermodynamics::Boundary &walls, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &dx)
Definition: ERF_CloudChamber.H:828
void reject_unsupported_face_keys(amrex::ParmParse &pp, const std::string &face)
Definition: ERF_CloudChamber.H:766
bool is_bulk_model(const std::string &model)
Definition: ERF_CloudChamber.H:466
Initialization parse_initialization(const amrex::Real *problo, const amrex::Real *probhi, const MoistureType selected_moisture_model)
Definition: ERF_CloudChamber.H:836
std::string set_wall_transport_speeds(erf_wall_thermodynamics::FaceWall &wall, const WallTransferContract &contract, const DiffChoice &dc, amrex::Real dx_inv, const std::string &face)
Definition: ERF_CloudChamber.H:1025
amrex::GpuArray< FaceWall, 2 *AMREX_SPACEDIM > Boundary
Definition: ERF_WallThermodynamics.H:133
MolecDiffType molec_diff_type
Selected molecular transport model.
Definition: ERF_DiffStruct.H:97

Member Data Documentation

◆ m_bands

std::array<SidewallTemperatureBands, 4> erf_cloud_chamber::Config::m_bands
private

Referenced by temperature_band_views().

◆ m_boundary

std::optional<erf_wall_thermodynamics::Boundary> erf_cloud_chamber::Config::m_boundary
private

Referenced by transport_boundary().


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