ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
erf_cloud_chamber_wall_stress Namespace Reference

Functions

bool wall_stress_requires_most_state (const erf_wall_thermodynamics::Boundary &walls) noexcept
 
template<int DIR, bool HIGH>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real stored_tau_from_physical_traction (Real traction) noexcept
 
template<int DIR, bool HIGH>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE GpuArray< Real, AMREX_SPACEDIM > wall_traction_at_cell (int i, int j, int k, const Array4< const Real > &state, const Array4< const Real > &base_state, const Array4< const Real > &u, const Array4< const Real > &v, const Array4< const Real > &w, const erf_wall_thermodynamics::FaceWall &wall, const GpuArray< Real, AMREX_SPACEDIM > &dx_inv, const Real rdOcp, const bool cloudy) noexcept
 
template<int DIR, int TANGENT, bool HIGH>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real averaged_physical_traction_component (int i, int j, int k, const Box &domain, const Array4< const Real > &state, const Array4< const Real > &base_state, const Array4< const Real > &u, const Array4< const Real > &v, const Array4< const Real > &w, const erf_wall_thermodynamics::FaceWall &wall, const GpuArray< Real, AMREX_SPACEDIM > &dx_inv, const Real rdOcp, const bool cloudy) noexcept
 
template<int DIR, int TANGENT, bool HIGH>
AMREX_FORCE_INLINE void apply_tangent_stress (const Box &bx, const Box &domain, const Array4< const Real > &state, const Array4< const Real > &base_state, const Array4< const Real > &u, const Array4< const Real > &v, const Array4< const Real > &w, const Array4< Real > &tau, const erf_wall_thermodynamics::FaceWall &wall, const GpuArray< Real, AMREX_SPACEDIM > &dx_inv, const Real rdOcp, const bool cloudy)
 
template<int DIR, bool HIGH>
AMREX_FORCE_INLINE void apply_face (const Box &bx, const Box &domain, const Array4< const Real > &state, const Array4< const Real > &base_state, const Array4< const Real > &u, const Array4< const Real > &v, const Array4< const Real > &w, const Array4< Real > &tau12, const Array4< Real > &tau13, const Array4< Real > &tau23, const GpuArray< Real, AMREX_SPACEDIM > &dx_inv, const erf_wall_thermodynamics::Boundary &walls, const Real rdOcp, const bool cloudy)
 
void apply (const Box &bx, const Box &domain, const Array4< const Real > &state, const Array4< const Real > &base_state, const Array4< const Real > &u, const Array4< const Real > &v, const Array4< const Real > &w, const Array4< Real > &tau12, const Array4< Real > &tau13, const Array4< Real > &tau23, const GpuArray< Real, AMREX_SPACEDIM > &dx_inv, const erf_wall_thermodynamics::Boundary &walls, const Real rdOcp, const bool cloudy)
 
void apply (const Box &bx, const Box &domain, const Array4< const Real > &state, const Array4< const Real > &u, const Array4< const Real > &v, const Array4< const Real > &w, const Array4< Real > &tau12, const Array4< Real > &tau13, const Array4< Real > &tau23, const GpuArray< Real, AMREX_SPACEDIM > &dx_inv, const erf_wall_thermodynamics::Boundary &walls)
 
bool has_momentum_wall (const erf_wall_thermodynamics::Boundary &walls) noexcept
 

Function Documentation

◆ apply() [1/2]

void erf_cloud_chamber_wall_stress::apply ( const Box &  bx,
const Box &  domain,
const Array4< const Real > &  state,
const Array4< const Real > &  base_state,
const Array4< const Real > &  u,
const Array4< const Real > &  v,
const Array4< const Real > &  w,
const Array4< Real > &  tau12,
const Array4< Real > &  tau13,
const Array4< Real > &  tau23,
const GpuArray< Real, AMREX_SPACEDIM > &  dx_inv,
const erf_wall_thermodynamics::Boundary walls,
const Real  rdOcp,
const bool  cloudy 
)
inline
210 {
213  (base_state.nComp() > BaseState::p0_comp &&
214  state.nComp() > RhoTheta_comp &&
215  (!cloudy || state.nComp() > RhoQ1_comp)),
216  "Cloud Chamber MOST momentum stress requires valid thermodynamic and base-state arrays");
217  apply_face<0,false>(bx, domain, state, base_state, u, v, w, tau12, tau13, tau23, dx_inv, walls, rdOcp, cloudy);
218  apply_face<0,true >(bx, domain, state, base_state, u, v, w, tau12, tau13, tau23, dx_inv, walls, rdOcp, cloudy);
219  apply_face<1,false>(bx, domain, state, base_state, u, v, w, tau12, tau13, tau23, dx_inv, walls, rdOcp, cloudy);
220  apply_face<1,true >(bx, domain, state, base_state, u, v, w, tau12, tau13, tau23, dx_inv, walls, rdOcp, cloudy);
221  apply_face<2,false>(bx, domain, state, base_state, u, v, w, tau12, tau13, tau23, dx_inv, walls, rdOcp, cloudy);
222  apply_face<2,true >(bx, domain, state, base_state, u, v, w, tau12, tau13, tau23, dx_inv, walls, rdOcp, cloudy);
223 }
@ tau12
Definition: ERF_DataStruct.H:40
@ tau23
Definition: ERF_DataStruct.H:40
@ tau13
Definition: ERF_DataStruct.H:40
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:40
#define RhoQ1_comp
Definition: ERF_IndexDefines.H:45
const Real rdOcp
Definition: ERF_InitCustomPert_ABL.H:72
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(m_cloud_chamber_config.active, "Cloud Chamber: initializer reached without a parsed configuration")
Real w
Definition: ERF_Plotfile2DInterpolator.cpp:22
@ p0_comp
Definition: ERF_IndexDefines.H:77
bool wall_stress_requires_most_state(const erf_wall_thermodynamics::Boundary &walls) noexcept
Definition: ERF_CloudChamberWallStress.H:18

Referenced by apply(), and erf_slow_rhs_pre().

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

◆ apply() [2/2]

void erf_cloud_chamber_wall_stress::apply ( const Box &  bx,
const Box &  domain,
const Array4< const Real > &  state,
const Array4< const Real > &  u,
const Array4< const Real > &  v,
const Array4< const Real > &  w,
const Array4< Real > &  tau12,
const Array4< Real > &  tau13,
const Array4< Real > &  tau23,
const GpuArray< Real, AMREX_SPACEDIM > &  dx_inv,
const erf_wall_thermodynamics::Boundary walls 
)
inline
237 {
240  "Cloud Chamber MOST momentum requires the base-state-aware wall-stress overload");
241  apply(bx, domain, state, Array4<const Real>{}, u, v, w,
242  tau12, tau13, tau23, dx_inv, walls, Real(0.0), false);
243 }
amrex::Real Real
Definition: ERF_ShocInterface.H:19
void apply(const Box &bx, const Box &domain, const Array4< const Real > &state, const Array4< const Real > &u, const Array4< const Real > &v, const Array4< const Real > &w, const Array4< Real > &tau12, const Array4< Real > &tau13, const Array4< Real > &tau23, const GpuArray< Real, AMREX_SPACEDIM > &dx_inv, const erf_wall_thermodynamics::Boundary &walls)
Definition: ERF_CloudChamberWallStress.H:225
Here is the call graph for this function:

◆ apply_face()

template<int DIR, bool HIGH>
AMREX_FORCE_INLINE void erf_cloud_chamber_wall_stress::apply_face ( const Box &  bx,
const Box &  domain,
const Array4< const Real > &  state,
const Array4< const Real > &  base_state,
const Array4< const Real > &  u,
const Array4< const Real > &  v,
const Array4< const Real > &  w,
const Array4< Real > &  tau12,
const Array4< Real > &  tau13,
const Array4< Real > &  tau23,
const GpuArray< Real, AMREX_SPACEDIM > &  dx_inv,
const erf_wall_thermodynamics::Boundary walls,
const Real  rdOcp,
const bool  cloudy 
)
165 {
166  if constexpr (HIGH) {
167  if (bx.bigEnd(DIR) != domain.bigEnd(DIR)) { return; }
168  } else {
169  if (bx.smallEnd(DIR) != domain.smallEnd(DIR)) { return; }
170  }
171 
172  const auto wall = walls[2*DIR + (HIGH ? 1 : 0)];
174  return;
175  }
176 
177  if constexpr (DIR == 0) {
178  apply_tangent_stress<DIR,1,HIGH>(bx, domain, state, base_state, u, v, w,
179  tau12, wall, dx_inv, rdOcp, cloudy);
180  apply_tangent_stress<DIR,2,HIGH>(bx, domain, state, base_state, u, v, w,
181  tau13, wall, dx_inv, rdOcp, cloudy);
182  } else if constexpr (DIR == 1) {
183  apply_tangent_stress<DIR,0,HIGH>(bx, domain, state, base_state, u, v, w,
184  tau12, wall, dx_inv, rdOcp, cloudy);
185  apply_tangent_stress<DIR,2,HIGH>(bx, domain, state, base_state, u, v, w,
186  tau23, wall, dx_inv, rdOcp, cloudy);
187  } else {
188  apply_tangent_stress<DIR,0,HIGH>(bx, domain, state, base_state, u, v, w,
189  tau13, wall, dx_inv, rdOcp, cloudy);
190  apply_tangent_stress<DIR,1,HIGH>(bx, domain, state, base_state, u, v, w,
191  tau23, wall, dx_inv, rdOcp, cloudy);
192  }
193 }
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool requires_tangential_momentum(const erf_wall_thermodynamics::FaceWall &wall) noexcept
Definition: ERF_CloudChamberWallFlux.H:465
Here is the call graph for this function:

◆ apply_tangent_stress()

template<int DIR, int TANGENT, bool HIGH>
AMREX_FORCE_INLINE void erf_cloud_chamber_wall_stress::apply_tangent_stress ( const Box &  bx,
const Box &  domain,
const Array4< const Real > &  state,
const Array4< const Real > &  base_state,
const Array4< const Real > &  u,
const Array4< const Real > &  v,
const Array4< const Real > &  w,
const Array4< Real > &  tau,
const erf_wall_thermodynamics::FaceWall wall,
const GpuArray< Real, AMREX_SPACEDIM > &  dx_inv,
const Real  rdOcp,
const bool  cloudy 
)
127 {
128  Box target = amrex::surroundingNodes(amrex::surroundingNodes(bx, DIR), TANGENT);
129  const int face = HIGH ? domain.bigEnd(DIR) + 1 : domain.smallEnd(DIR);
130  target.setSmall(DIR, face);
131  target.setBig(DIR, face);
132  target.setSmall(TANGENT,
133  amrex::max(target.smallEnd(TANGENT), domain.smallEnd(TANGENT)));
134  target.setBig(TANGENT,
135  amrex::min(target.bigEnd(TANGENT), domain.bigEnd(TANGENT) + 1));
136  if (target.isEmpty()) { return; }
137 
138  amrex::ParallelFor(target,
139  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
140  {
141  const Real traction = averaged_physical_traction_component<DIR,TANGENT,HIGH>(
142  i, j, k, domain, state, base_state, u, v, w, wall, dx_inv,
143  rdOcp, cloudy);
144  tau(i,j,k) = stored_tau_from_physical_traction<DIR,HIGH>(traction);
145  });
146 }
ParallelFor(fab_box, [=] AMREX_GPU_DEVICE(int i, int j, int k) { qrcuten_arr(i, j, k)=Real(0);qscuten_arr(i, j, k)=Real(0);qicuten_arr(i, j, k)=Real(0);})
Here is the call graph for this function:

◆ averaged_physical_traction_component()

template<int DIR, int TANGENT, bool HIGH>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real erf_cloud_chamber_wall_stress::averaged_physical_traction_component ( int  i,
int  j,
int  k,
const Box &  domain,
const Array4< const Real > &  state,
const Array4< const Real > &  base_state,
const Array4< const Real > &  u,
const Array4< const Real > &  v,
const Array4< const Real > &  w,
const erf_wall_thermodynamics::FaceWall wall,
const GpuArray< Real, AMREX_SPACEDIM > &  dx_inv,
const Real  rdOcp,
const bool  cloudy 
)
noexcept
94 {
95  int cell_lo[AMREX_SPACEDIM] = {i, j, k};
96  int cell_hi[AMREX_SPACEDIM] = {i, j, k};
97  const int node = cell_lo[TANGENT];
98  cell_lo[TANGENT] = amrex::max(domain.smallEnd(TANGENT), node - 1);
99  cell_hi[TANGENT] = amrex::min(domain.bigEnd(TANGENT), node);
100  cell_lo[DIR] = HIGH ? domain.bigEnd(DIR) : domain.smallEnd(DIR);
101  cell_hi[DIR] = cell_lo[DIR];
102 
103  const auto traction_lo = wall_traction_at_cell<DIR,HIGH>(
104  cell_lo[0], cell_lo[1], cell_lo[2], state, base_state, u, v, w, wall,
105  dx_inv, rdOcp, cloudy);
106  const auto traction_hi = wall_traction_at_cell<DIR,HIGH>(
107  cell_hi[0], cell_hi[1], cell_hi[2], state, base_state, u, v, w, wall,
108  dx_inv, rdOcp, cloudy);
109  return Real(0.5) * (traction_lo[TANGENT] + traction_hi[TANGENT]);
110 }

◆ has_momentum_wall()

bool erf_cloud_chamber_wall_stress::has_momentum_wall ( const erf_wall_thermodynamics::Boundary walls)
inlinenoexcept
247 {
248  for (const auto& wall : walls) {
250  return true;
251  }
252  }
253  return false;
254 }

Referenced by erf_slow_rhs_pre().

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

◆ stored_tau_from_physical_traction()

template<int DIR, bool HIGH>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE Real erf_cloud_chamber_wall_stress::stored_tau_from_physical_traction ( Real  traction)
noexcept
37 {
38  amrex::ignore_unused(DIR);
39  return HIGH ? -traction : traction;
40 }

◆ wall_stress_requires_most_state()

bool erf_cloud_chamber_wall_stress::wall_stress_requires_most_state ( const erf_wall_thermodynamics::Boundary walls)
inlinenoexcept
20 {
21  for (const auto& wall : walls) {
22  if (wall.momentum.model == erf_wall_thermodynamics::MomentumModel::BulkAero &&
23  wall.momentum.provider == erf_wall_thermodynamics::CoefficientProvider::MOST) {
24  return true;
25  }
26  }
27  return false;
28 }

Referenced by apply().

Here is the caller graph for this function:

◆ wall_traction_at_cell()

template<int DIR, bool HIGH>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE GpuArray<Real, AMREX_SPACEDIM> erf_cloud_chamber_wall_stress::wall_traction_at_cell ( int  i,
int  j,
int  k,
const Array4< const Real > &  state,
const Array4< const Real > &  base_state,
const Array4< const Real > &  u,
const Array4< const Real > &  v,
const Array4< const Real > &  w,
const erf_wall_thermodynamics::FaceWall wall,
const GpuArray< Real, AMREX_SPACEDIM > &  dx_inv,
const Real  rdOcp,
const bool  cloudy 
)
noexcept
57 {
58  const auto u_t = erf_cloud_chamber_wall_flux::
59  relative_tangential_velocity_cell_centered(DIR, i, j, k, u, v, w, wall);
61  const Real rho = state(i,j,k,Rho_comp);
62  const bool most_momentum =
66  rho, u_t, U_t, Real(0.5) / dx_inv[DIR],
67  most_momentum ? state(i,j,k,RhoTheta_comp) / rho : Real(0.0),
68  most_momentum && cloudy ? state(i,j,k,RhoQ1_comp) / rho : Real(0.0),
69  most_momentum ? base_state(i,j,k,BaseState::p0_comp) : Real(0.0),
70  most_momentum ? rdOcp : Real(0.0),
71  DIR == 2 ? (HIGH ? -1 : 1) : 0};
73  traction_on_fluid;
74 }
#define Rho_comp
Definition: ERF_IndexDefines.H:39
@ rho
Definition: ERF_Kessler.H:25
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real tangential_magnitude(const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &u_t) noexcept
Definition: ERF_CloudChamberWallFlux.H:651
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE WallFlux evaluate_momentum_traction(const erf_wall_thermodynamics::FaceWall &wall, const MomentumWallSample &sample) noexcept
Definition: ERF_CloudChamberWallFlux.H:730
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > relative_tangential_velocity_cell_centered(int dir, int i, int j, int k, const amrex::Array4< const amrex::Real > &u, const amrex::Array4< const amrex::Real > &v, const amrex::Array4< const amrex::Real > &w, const erf_wall_thermodynamics::FaceWall &wall) noexcept
Definition: ERF_CloudChamberWallFlux.H:630
Definition: ERF_CloudChamberWallFlux.H:82
MomentumTransfer momentum
Definition: ERF_WallThermodynamics.H:64
CoefficientProvider provider
Definition: ERF_WallThermodynamics.H:49
MomentumModel model
Definition: ERF_WallThermodynamics.H:48
Here is the call graph for this function: