ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_WriteBndryPlanes.cpp File Reference
#include "AMReX_Gpu.H"
#include "AMReX_ParmParse.H"
#include "AMReX_PlotFileUtil.H"
#include "AMReX_MultiFabUtil.H"
#include "ERF_WriteBndryPlanes.H"
#include "ERF_IndexDefines.H"
#include "ERF_Derive.H"
Include dependency graph for ERF_WriteBndryPlanes.cpp:

Functions

void br_shift (OrientationIter oit, const BndryRegister &b1, BndryRegister &b2)
 

Function Documentation

◆ br_shift()

void br_shift ( OrientationIter  oit,
const BndryRegister &  b1,
BndryRegister &  b2 
)

Copies the contents of one boundary register to another in either x or y dimensions.

Parameters
oitOrientation iterator used for determining which dimension we are to copy
b1Boundary register containing the source data
b2Boundary register containing the destination data
19 {
20  auto ori = oit();
21  int ncomp = b1[ori].nComp();
22  if (ori.coordDir() < 2) {
23 #ifdef AMREX_USE_OMP
24 #pragma omp parallel if (Gpu::notInLaunchRegion())
25 #endif
26  for (FabSetIter bfsi(b1[ori]); bfsi.isValid(); ++bfsi) {
27  int idx = bfsi.index();
28  const Box& bx1 = b1[ori].boxArray()[idx];
29  const Box& bx2 = b2[ori].boxArray()[idx];
30 
31  // Copy onto a boundary register based on a box starting at (0,0,0)
32  Array4<Real> dest_arr = b2[ori][idx].array();
33  Array4<Real const> src_arr = b1[ori][idx].const_array();
34  int ioff = bx1.smallEnd(0) - bx2.smallEnd(0);
35  int joff = bx1.smallEnd(1) - bx2.smallEnd(1);
36  ParallelFor(bx2, ncomp,
37  [=] AMREX_GPU_DEVICE(int i, int j, int k, int n) noexcept
38  {
39  dest_arr(i,j,k,n) = src_arr(i+ioff,j+joff,k,n);
40  });
41  }
42  }
43 }
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);} } })

Referenced by WriteBndryPlanes::write_planes().

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