39 const auto&
dx = geom.CellSizeArray();
40 const auto&
prob_lo = geom.ProbLoArray();
42 bool all_boxes_touch_bottom =
true;
43 for (
int i = 0; i < ba.size(); i++) {
44 if (ba[i].smallEnd(2) != geom.ProbLo(2)) {
45 all_boxes_touch_bottom =
false;
57 for (
unsigned ii = 0; ii <
m_x_forest.size(); ++ii)
80 treeZm = laimaxf * hf;
81 for (
int k(0); k<nk; ++k) {
82 ratio = (hf - treeZm) / (hf - ztree);
84 expFun += std::pow(ratio, 6.0) *
85 std::exp(6 * (1 - ratio));
87 expFun += std::pow(ratio, 0.5) *
88 std::exp(0.5 * (1 - ratio));
92 af = laif / (expFun * dz);
97 Box gtbx = mfi.growntilebox();
99 const Array4<const Real>& z_cc = z_phys_cc->const_array(mfi);
100 const Array4<const Real>& z_nd = z_phys_nd->const_array(mfi);
102 ParallelFor(gtbx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k) noexcept
109 const Real z_sfc = 0.25 * ( z_nd(i,j ,0) + z_nd(i+1,j ,0)
110 +z_nd(i,j+1,0) + z_nd(i+1,j+1,0));
111 const Real z = std::max((z_cc(i,j,k)-z_sfc),0.0);
114 const Real radius = std::sqrt((
x - xf) * (
x - xf) +
115 (
y - yf) * (
y - yf));
119 if ((
z <= hf) && (radius <= (0.5 * df))) {
121 Real ratio = (hf - treeZm) / (hf -
z);
123 factor = std::pow(ratio, 6.0) *
124 std::exp(6.0 * (1.0 - ratio));
125 }
else if (
z <= hf) {
126 factor = std::pow(ratio, 0.5) *
127 std::exp(0.5 * (1.0 - ratio));
130 levelDrag(i, j, k) = cdf * af * factor;
const auto dx
Definition: ERF_InitCustomPertVels_ParticleTests.H:15
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+0.5) *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<=1.0) { Real dT=T_pert *(std::cos(PI *L)+1.0)/2.0;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
AMREX_ALWAYS_ASSERT(bx.length()[2]==khi+1)
std::unique_ptr< amrex::MultiFab > m_forest_drag
Definition: ERF_ForestDrag.H:39