40 const auto&
dx = geom.CellSizeArray();
41 const auto&
prob_lo = geom.ProbLoArray();
43 bool all_boxes_touch_bottom =
true;
44 for (
int i = 0; i < ba.size(); i++) {
45 if (ba[i].smallEnd(2) != geom.ProbLo(2)) {
46 all_boxes_touch_bottom =
false;
58 for (
unsigned ii = 0; ii <
m_x_forest.size(); ++ii)
81 treeZm = laimaxf * hf;
82 for (
int k(0); k<nk; ++k) {
83 ratio = (hf - treeZm) / (hf - ztree);
85 expFun += std::pow(ratio,
Real(6.0)) *
86 std::exp(6 * (1 - ratio));
88 expFun += std::pow(ratio,
myhalf) *
89 std::exp(
myhalf * (1 - ratio));
93 af = laif / (expFun *
dz);
98 Box gtbx = mfi.growntilebox();
100 const Array4<const Real>& z_cc = z_phys_cc->const_array(mfi);
101 const Array4<const Real>& z_nd = z_phys_nd->const_array(mfi);
103 ParallelFor(gtbx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k) noexcept
110 const Real z_sfc =
fourth * ( z_nd(i,j ,0) + z_nd(i+1,j ,0)
111 +z_nd(i,j+1,0) + z_nd(i+1,j+1,0));
115 const Real radius = std::sqrt((
x - xf) * (
x - xf) +
116 (
y - yf) * (
y - yf));
120 if ((
z <= hf) && (radius <= (
myhalf * df))) {
122 Real ratio = (hf - treeZm) / (hf -
z);
124 factor = std::pow(ratio,
Real(6.0)) *
125 std::exp(
Real(6.0) * (
one - ratio));
126 }
else if (
z <= hf) {
127 factor = std::pow(ratio,
myhalf) *
131 levelDrag(i, j, k) = cdf * af * factor;
constexpr amrex::Real one
Definition: ERF_Constants.H:7
constexpr amrex::Real fourth
Definition: ERF_Constants.H:12
constexpr amrex::Real zero
Definition: ERF_Constants.H:6
constexpr amrex::Real myhalf
Definition: ERF_Constants.H:11
const Real dx
Definition: ERF_InitCustomPert_ABL.H:23
AMREX_ALWAYS_ASSERT(bx.length()[2]==khi+1)
const Real dz
Definition: ERF_InitCustomPert_Bubble.H:25
ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { const auto prob_lo=geomdata.ProbLo();const auto dx=geomdata.CellSize();const Real x=(prob_lo[0]+(i+myhalf) *dx[0])/mf_m(i, j, 0);const Real z=z_cc(i, j, k);Real L=std::sqrt(std::pow((x - x_c)/x_r, 2)+std::pow((z - z_c)/z_r, 2));if(L<=one) { Real dT=T_pert *(std::cos(PI *L)+one)/two;Real Tbar_hse=p_hse(i, j, k)/(R_d *r_hse(i, j, k));Real theta_perturbed=(Tbar_hse+dT) *std::pow(p_0/p_hse(i, j, k), rdOcp);Real theta_0=(Tbar_hse) *std::pow(p_0/p_hse(i, j, k), rdOcp);if(const_rho) { state_pert(i, j, k, RhoTheta_comp)=r_hse(i, j, k) *(theta_perturbed - theta_0);} else { state_pert(i, j, k, Rho_comp)=getRhoThetagivenP(p_hse(i, j, k))/theta_perturbed - r_hse(i, j, k);} } })
const amrex::Real * prob_lo
Definition: ERF_InitCustomPert_IsentropicVortex.H:16
std::unique_ptr< amrex::MultiFab > m_forest_drag
Definition: ERF_ForestDrag.H:39