ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_FireSurfaceHeight.cpp File Reference
Include dependency graph for ERF_FireSurfaceHeight.cpp:

Functions

void compute_fire_surface_height (MultiFab &fire_surface_z, const MultiFab *z_phys_nd, const Geometry &geom_atm, const FireGrid &fg)
 
void compute_fire_column_grounds (MultiFab &fire_col_ground, const MultiFab *z_phys_nd, const Geometry &geom_atm, const FireGrid &fg)
 

Function Documentation

◆ compute_fire_column_grounds()

void compute_fire_column_grounds ( MultiFab &  fire_col_ground,
const MultiFab *  z_phys_nd,
const Geometry &  geom_atm,
const FireGrid &  fg 
)
49 {
50  if (z_phys_nd == nullptr) {
51  fire_col_ground.setVal(geom_atm.ProbLo(2));
52  return;
53  }
54 
55  const int C = fg.C;
56  // Atmospheric index of the fire region's lower corner (FireGrid::atm_lo)
57  const int atm_nlo_x = fg.atm_lo[0];
58  const int atm_nlo_y = fg.atm_lo[1];
59 
60  for (MFIter mfi(fire_col_ground, TilingIfNotGPU()); mfi.isValid(); ++mfi) {
61  const Box& bx = mfi.tilebox();
62  Array4<Real> zg = fire_col_ground.array(mfi);
63  Array4<const Real> z_nd = z_phys_nd->array(mfi);
64 
65  ParallelFor(bx, [=] AMREX_GPU_DEVICE (const IntVect& iv) {
66  const int i_f = iv[0];
67  const int j_f = iv[1];
68 
69  // Lower-left column of the bilinear stencil, in atmospheric indices
70  const Real gx = (Real(i_f) + Real(0.5)) / Real(C) - Real(0.5);
71  const Real gy = (Real(j_f) + Real(0.5)) / Real(C) - Real(0.5);
72  const int i0 = static_cast<int>(std::floor(gx));
73  const int j0 = static_cast<int>(std::floor(gy));
74 
75  for (int c = 0; c < 4; ++c) {
76  const int ia = i0 + (c & 1);
77  const int ja = j0 + ((c >> 1) & 1);
78 
79  // Cell (ia,ja) sits between nodes (ia,ja) and (ia+1,ja+1)
80  const int i_n = ia + atm_nlo_x;
81  const int j_n = ja + atm_nlo_y;
82 
83  zg(i_f, j_f, 0, c) = Real(0.25) * (z_nd(i_n, j_n, 0)
84  + z_nd(i_n + 1, j_n, 0)
85  + z_nd(i_n, j_n + 1, 0)
86  + z_nd(i_n + 1, j_n + 1, 0));
87  }
88  });
89  }
90 }
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);})
amrex::Real Real
Definition: ERF_ShocInterface.H:19
@ fg
Definition: ERF_AdvanceMorrison.cpp:111
Here is the call graph for this function:

◆ compute_fire_surface_height()

void compute_fire_surface_height ( MultiFab &  fire_surface_z,
const MultiFab *  z_phys_nd,
const Geometry &  geom_atm,
const FireGrid &  fg 
)
10 {
11  // Without nodal heights (callers other than ERF, which always passes
12  // them): a flat ground at the floor of the domain.
13  if (z_phys_nd == nullptr) {
14  fire_surface_z.setVal(geom_atm.ProbLo(2));
15  return;
16  }
17 
18  const int C = fg.C;
19  // Atmospheric index of the fire region's lower corner (FireGrid::atm_lo)
20  const int atm_nlo_x = fg.atm_lo[0];
21  const int atm_nlo_y = fg.atm_lo[1];
22 
23  for (MFIter mfi(fire_surface_z, TilingIfNotGPU()); mfi.isValid(); ++mfi) {
24  const Box& bx = mfi.tilebox();
25  Array4<Real> zs = fire_surface_z.array(mfi);
26  Array4<const Real> z_nd = z_phys_nd->array(mfi);
27 
28  ParallelFor(bx, [=] AMREX_GPU_DEVICE (const IntVect& iv) {
29  const int i_f = iv[0];
30  const int j_f = iv[1];
31 
32  // Atmospheric cell holding this fire cell, and its four k = 0 nodes
33  const int i_n_lo = i_f / C + atm_nlo_x;
34  const int j_n_lo = j_f / C + atm_nlo_y;
35 
36  zs(i_f, j_f, 0) = Real(0.25) * (z_nd(i_n_lo, j_n_lo, 0)
37  + z_nd(i_n_lo + 1, j_n_lo, 0)
38  + z_nd(i_n_lo, j_n_lo + 1, 0)
39  + z_nd(i_n_lo + 1, j_n_lo + 1, 0));
40  });
41  }
42 }
Here is the call graph for this function: