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

Functions

void set_covered_face_velocity (MultiFab &vel_new, MultiFab &vel_old, const MultiFab &volfrac, int dir)
 
void set_test_mapfactor (MultiFab &mf, const Geometry &geom, const Real amp)
 

Function Documentation

◆ set_covered_face_velocity()

void erf_detail_MakeNewArrays::set_covered_face_velocity ( MultiFab &  vel_new,
MultiFab &  vel_old,
const MultiFab &  volfrac,
int  dir 
)
32 {
33  const IntVect offset = IntVect::TheDimensionVector(dir);
34  const int di = offset[0], dj = offset[1], dk = offset[2];
35  for (MFIter mfi(vel_new); mfi.isValid(); ++mfi) {
36  const Box& bx = mfi.fabbox();
37  Box available_faces = convert(volfrac[mfi].box(), vel_new.ixType());
38  available_faces.grow(dir, -1);
39  AMREX_ALWAYS_ASSERT_WITH_MESSAGE(available_faces.contains(bx),
40  "Covered-face velocity initialization requires both adjacent cell volumes");
41  const auto vf = volfrac.const_array(mfi);
42  const auto vnew = vel_new.array(mfi);
43  const auto vold = vel_old.array(mfi);
44  ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
45  if (vf(i,j,k) == zero && vf(i-di,j-dj,k-dk) == zero) {
46  vnew(i,j,k) = zero;
47  vold(i,j,k) = zero;
48  }
49  });
50  }
51 }
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(axis >=0 &&axis< AMREX_SPACEDIM, "prob.axis must be 0, 1 or 2")
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);})
constexpr amrex::Real zero
Definition: ERF_NumericalConstants.H:36
AMREX_FORCE_INLINE IntVect offset(const int face_dir, const int normal)
Definition: ERF_ReadBndryPlanes.cpp:36
real(c_double), private di
Definition: ERF_module_mp_morr_two_moment.F90:203

Referenced by ERF::init_stuff().

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

◆ set_test_mapfactor()

void erf_detail_MakeNewArrays::set_test_mapfactor ( MultiFab &  mf,
const Geometry &  geom,
const Real  amp 
)
58 {
59  const auto dx = geom.CellSizeArray();
60  const auto plo = geom.ProbLoArray();
61  const auto phi = geom.ProbHiArray();
62  const IntVect nodal = mf.ixType().toIntVect();
63  for (MFIter mfi(mf); mfi.isValid(); ++mfi) {
64  const Array4<Real> m_arr = mf.array(mfi);
65  ParallelFor(mfi.fabbox(), [=] AMREX_GPU_DEVICE (int ii, int jj, int kk) noexcept
66  {
67  const Real x = plo[0] + (ii + (nodal[0] ? Real(0) : Real(0.5))) * dx[0];
68  const Real y = plo[1] + (jj + (nodal[1] ? Real(0) : Real(0.5))) * dx[1];
69  m_arr(ii,jj,kk) = Real(1) + amp * std::sin(Real(2)*PI*(x-plo[0])/(phi[0]-plo[0]))
70  * std::cos(Real(2)*PI*(y-plo[1])/(phi[1]-plo[1]));
71  });
72  }
73 }
GpuArray< Real, AMREX_SPACEDIM > plo
Definition: ERF_ActuatorSpreading.cpp:131
GpuArray< Real, AMREX_SPACEDIM > dx
Definition: ERF_ActuatorSpreading.cpp:131
constexpr amrex::Real PI
Definition: ERF_NumericalConstants.H:46
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real phi(amrex::Real d, amrex::Real z0, amrex::Real psi) noexcept
Definition: ERF_ImmersedWallCell.H:176

Referenced by ERF::init_stuff().

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