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;
48 AMREX_ALWAYS_ASSERT(all_boxes_touch_bottom);
57 for (
unsigned ii = 0; ii <
m_x_forest.size(); ++ii)
79 const Real dz = hf / Real(nk);
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
105 const Real
x = prob_lo[0] + (i + 0.5) * dx[0];
106 const Real
y = prob_lo[1] + (j + 0.5) * dx[1];
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;
std::unique_ptr< amrex::MultiFab > m_forest_drag
Definition: ERF_ForestDrag.H:39