ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
ERF_InteriorGhostCells.cpp File Reference
#include "ERF_Utils.H"
Include dependency graph for ERF_InteriorGhostCells.cpp:

Functions

void realbdy_interior_bxs_xy (const Box &bx, const Box &domain, const int &width, Box &bx_xlo, Box &bx_xhi, Box &bx_ylo, Box &bx_yhi, const IntVect &ng_vect, const bool get_int_ng)
 
void realbdy_bc_bxs_xy (const Box &bx, const Box &domain, const int &set_width, Box &bx_xlo, Box &bx_xhi, Box &bx_ylo, Box &bx_yhi, const IntVect &ng_vect)
 
void realbdy_compute_interior_ghost_rhs (const double &time, const double &delta_t_d, const double &start_bdy_time, const double &final_bdy_time, const double &bdy_time_interval, const Real &nudge_factor, int width, const Geometry &geom, Vector< MultiFab > &S_rhs, Vector< MultiFab > &S_cur_data, Vector< Vector< FArrayBox >> &bdy_data_xlo, Vector< Vector< FArrayBox >> &bdy_data_xhi, Vector< Vector< FArrayBox >> &bdy_data_ylo, Vector< Vector< FArrayBox >> &bdy_data_yhi, std::unique_ptr< ReadBndryPlanes > &m_r2d, const Real &c_p, const Real &rdOcp)
 
void fine_compute_interior_ghost_rhs (const double &time, const double &delta_t_d, const int &width, const int &set_width, const Geometry &geom, ERFFillPatcher *FPr_c, ERFFillPatcher *FPr_u, ERFFillPatcher *FPr_v, ERFFillPatcher *FPr_w, Vector< BCRec > &domain_bcs_type, Vector< MultiFab > &S_rhs_f, Vector< MultiFab > &S_data_f)
 

Variables

PhysBCFunctNoOp void_bc
 

Function Documentation

◆ fine_compute_interior_ghost_rhs()

void fine_compute_interior_ghost_rhs ( const double &  time,
const double &  delta_t_d,
const int &  width,
const int &  set_width,
const Geometry &  geom,
ERFFillPatcher FPr_c,
ERFFillPatcher FPr_u,
ERFFillPatcher FPr_v,
ERFFillPatcher FPr_w,
Vector< BCRec > &  domain_bcs_type,
Vector< MultiFab > &  S_rhs_f,
Vector< MultiFab > &  S_data_f 
)

Compute the RHS in the fine relaxation zone

Parameters
[in]timecurrent (elapsed) time
[in]delta_ttimestep
[in]widthnumber of cells in (relaxation+specified) zone
[in]set_widthnumber of cells in (specified) zone
[in]FPr_ccons fine patch container
[in]FPr_uuvel fine patch container
[in]FPr_vvvel fine patch container
[in]FPr_wwvel fine patch container
[in]boxes_at_levelboxes at current level
[in]domain_bcs_typeboundary condition types
[out]S_rhsRHS to be computed here
[in]S_datacurrent value of the solution
648 {
649  BL_PROFILE_REGION("fine_compute_interior_ghost_RHS()");
650 
651  Real delta_t = static_cast<Real>(delta_t_d);
652 
653  // Relaxation constants
654  Real F1 = one/(Real(10.)*delta_t);
655  Real F2 = one/(Real(50.)*delta_t);
656 
657  // Vector of MFs to hold data (dm differs w/ fine patch)
658  Vector<MultiFab> fmf_p_v;
659 
660  // Loop over the variables
661  for (int ivar_idx = 0; ivar_idx < IntVars::NumTypes; ++ivar_idx)
662  {
663  // Fine mfs
664  MultiFab& fmf = S_data_f[ivar_idx];
665  MultiFab& rhs = S_rhs_f [ivar_idx];
666 
667  // NOTE: These temporary MFs and copy operations are horrible
668  // for memory usage and efficiency. However, we need to
669  // have access to ghost cells in the cons array to convert
670  // from primitive u/v/w to momentum. Furthermore, the BA
671  // for the fine patches in ERFFillPatcher don't match the
672  // BA for the data/RHS. For this reason, the data is copied
673  // to a vector of MFs (with ghost cells) so the BAs match
674  // the BA of data/RHS and we have access to rho to convert
675  // prim to conserved.
676 
677  // Temp MF on box (distribution map differs w/ fine patch)
678  int num_var = fmf.nComp();
679  fmf_p_v.emplace_back(fmf.boxArray(), fmf.DistributionMap(), num_var, fmf.nGrowVect());
680  MultiFab& fmf_p = fmf_p_v[ivar_idx];
681  MultiFab::Copy(fmf_p,fmf, 0, 0, num_var, fmf.nGrowVect());
682 
683  // Integer mask MF
684  int set_mask_val;
685  int relax_mask_val;
686  iMultiFab* mask;
687 
688  // Fill fine patch on interior halo region
689  //==========================================================
690  if (ivar_idx == IntVars::cons)
691  {
692  FPr_c->FillRelax(fmf_p, time, void_bc, domain_bcs_type);
693  mask = FPr_c->GetMask();
694  set_mask_val = FPr_c->GetSetMaskVal();
695  relax_mask_val = FPr_c->GetRelaxMaskVal();
696  }
697  else if (ivar_idx == IntVars::xmom)
698  {
699  FPr_u->FillRelax(fmf_p, time, void_bc, domain_bcs_type);
700  mask = FPr_u->GetMask();
701  set_mask_val = FPr_u->GetSetMaskVal();
702  relax_mask_val = FPr_u->GetRelaxMaskVal();
703 
704 #ifdef _OPENMP
705 #pragma omp parallel if (Gpu::notInLaunchRegion())
706 #endif
707  for ( MFIter mfi(fmf_p,TilingIfNotGPU()); mfi.isValid(); ++mfi)
708  {
709  Box tbx = mfi.tilebox();
710 
711  const Array4<Real>& prim_arr = fmf_p.array(mfi);
712  const Array4<const Real>& rho_arr = fmf_p_v[0].const_array(mfi);
713  const Array4<const int>& mask_arr = mask->const_array(mfi);
714 
715  ParallelFor(tbx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
716  {
717  if (mask_arr(i,j,k) == relax_mask_val) {
718  Real rho_interp = myhalf * ( rho_arr(i-1,j,k) + rho_arr(i,j,k) );
719  prim_arr(i,j,k) *= rho_interp;
720  }
721  });
722  } // mfi
723  }
724  else if (ivar_idx == IntVars::ymom)
725  {
726  FPr_v->FillRelax(fmf_p, time, void_bc, domain_bcs_type);
727  mask = FPr_v->GetMask();
728  set_mask_val = FPr_v->GetSetMaskVal();
729  relax_mask_val = FPr_v->GetRelaxMaskVal();
730 
731 #ifdef _OPENMP
732 #pragma omp parallel if (Gpu::notInLaunchRegion())
733 #endif
734  for ( MFIter mfi(fmf_p,TilingIfNotGPU()); mfi.isValid(); ++mfi)
735  {
736  Box tbx = mfi.tilebox();
737 
738  const Array4<Real>& prim_arr = fmf_p.array(mfi);
739  const Array4<const Real>& rho_arr = fmf_p_v[0].const_array(mfi);
740  const Array4<const int>& mask_arr = mask->const_array(mfi);
741 
742  ParallelFor(tbx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
743  {
744  if (mask_arr(i,j,k) == relax_mask_val) {
745  Real rho_interp = myhalf * ( rho_arr(i,j-1,k) + rho_arr(i,j,k) );
746  prim_arr(i,j,k) *= rho_interp;
747  }
748  });
749  } // mfi
750  }
751  else if (ivar_idx == IntVars::zmom)
752  {
753  FPr_w->FillRelax(fmf_p, time, void_bc, domain_bcs_type);
754  mask = FPr_w->GetMask();
755  set_mask_val = FPr_w->GetSetMaskVal();
756  relax_mask_val = FPr_w->GetRelaxMaskVal();
757 
758 #ifdef _OPENMP
759 #pragma omp parallel if (Gpu::notInLaunchRegion())
760 #endif
761  for ( MFIter mfi(fmf_p,TilingIfNotGPU()); mfi.isValid(); ++mfi)
762  {
763  Box tbx = mfi.tilebox();
764 
765  const Array4<Real>& prim_arr = fmf_p.array(mfi);
766  const Array4<const Real>& rho_arr = fmf_p_v[0].const_array(mfi);
767  const Array4<const int>& mask_arr = mask->const_array(mfi);
768 
769  ParallelFor(tbx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
770  {
771  if (mask_arr(i,j,k) == relax_mask_val) {
772  Real rho_interp = myhalf * ( rho_arr(i,j,k-1) + rho_arr(i,j,k) );
773  prim_arr(i,j,k) *= rho_interp;
774  }
775  });
776  } // mfi
777  } else {
778  Abort("Dont recognize this variable type in fine_compute_interior_ghost_RHS");
779  }
780 
781 
782  // Zero RHS in set region
783  //==========================================================
784 #ifdef _OPENMP
785 #pragma omp parallel if (Gpu::notInLaunchRegion())
786 #endif
787  for ( MFIter mfi(rhs,TilingIfNotGPU()); mfi.isValid(); ++mfi)
788  {
789  Box tbx = mfi.tilebox();
790  const Array4<Real>& rhs_arr = rhs.array(mfi);
791  const Array4<const int>& mask_arr = mask->const_array(mfi);
792 
793  ParallelFor(tbx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
794  {
795  if (mask_arr(i,j,k) == set_mask_val) {
796  rhs_arr(i,j,k) = zero;
797  }
798  });
799  } // mfi
800 
801  // For Laplacian stencil
802  rhs.FillBoundary(geom.periodicity());
803 
804 
805  // Compute RHS in relaxation region
806  //==========================================================
807 #ifdef _OPENMP
808 #pragma omp parallel if (Gpu::notInLaunchRegion())
809 #endif
810  for ( MFIter mfi(fmf_p,TilingIfNotGPU()); mfi.isValid(); ++mfi)
811  {
812  Box tbx = mfi.tilebox();
813  const Array4<Real>& rhs_arr = rhs.array(mfi);
814  const Array4<const Real>& fine_arr = fmf_p.const_array(mfi);
815  const Array4<const Real>& data_arr = fmf.const_array(mfi);
816  const Array4<const int>& mask_arr = mask->const_array(mfi);
817 
818  Box vbx = mfi.validbox();
819  const auto& vbx_lo = lbound(vbx);
820  const auto& vbx_hi = ubound(vbx);
821 
822  int icomp = 0;
823 
824  int Spec_z = set_width;
825  int Relax_z = width - Spec_z;
826  Real num = Real(Spec_z + Relax_z);
827  Real denom = Real(Relax_z - 1);
828  ParallelFor(tbx, num_var, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept
829  {
830  if (mask_arr(i,j,k) == relax_mask_val) {
831 
832  // Indices
833  Real n_ind(-1); // Set to -1 to quiet compiler warning
834  int ii(width-1); int jj(width-1);
835  bool near_x_lo_wall(false); bool near_x_hi_wall(false);
836  bool near_y_lo_wall(false); bool near_y_hi_wall(false);
837  bool mask_x_found(false); bool mask_y_found(false);
838 
839  // Near x-wall
840  if ((i-vbx_lo.x) < width) {
841  near_x_lo_wall = true;
842  ii = i-vbx_lo.x;
843  if (mask_arr(vbx_lo.x,j,k) == 2) mask_x_found = true;
844  } else if ((vbx_hi.x-i) < width) {
845  near_x_hi_wall = true;
846  ii = vbx_hi.x-i;
847  if (mask_arr(vbx_hi.x,j,k) == 2) mask_x_found = true;
848  }
849 
850  // Near y-wall
851  if ((j-vbx_lo.y) < width) {
852  near_y_lo_wall = true;
853  jj = j-vbx_lo.y;
854  if (mask_arr(i,vbx_lo.y,k) == 2) mask_y_found = true;
855  } else if ((vbx_hi.y-j) < width) {
856  near_y_hi_wall = true;
857  jj = vbx_hi.y-j;
858  if (mask_arr(i,vbx_hi.y,k) == 2) mask_y_found = true;
859  }
860 
861  // Found a nearby masked cell (valid n_ind)
862  if (mask_x_found && mask_y_found) {
863  n_ind = std::min(ii,jj) + one;
864  } else if (mask_x_found) {
865  n_ind = ii + one;
866  } else if (mask_y_found) {
867  n_ind = jj + one;
868  // Pesky corner cell
869  } else {
870  if (near_x_lo_wall || near_x_hi_wall) {
871  Real dj_min{width-one};
872  int j_lb = std::max(vbx_lo.y,j-width);
873  int j_ub = std::min(vbx_hi.y,j+width);
874  int li = (near_x_lo_wall) ? vbx_lo.x : vbx_hi.x;
875  for (int lj(j_lb); lj<=j_ub; ++lj) {
876  if (mask_arr(li,lj,k) == 2) {
877  mask_y_found = true;
878  dj_min = std::min(dj_min,(Real) std::abs(lj-j));
879  }
880  }
881  if (mask_y_found) {
882  Real mag = std::sqrt( Real(dj_min*dj_min + ii*ii) );
883  n_ind = std::min(mag,width-one) + one;
884  } else {
885  Abort("Mask not found near x wall!");
886  }
887  } else if (near_y_lo_wall || near_y_hi_wall) {
888  Real di_min{width-one};
889  int i_lb = std::max(vbx_lo.x,i-width);
890  int i_ub = std::min(vbx_hi.x,i+width);
891  int lj = (near_y_lo_wall) ? vbx_lo.y : vbx_hi.y;
892  for (int li(i_lb); li<=i_ub; ++li) {
893  if (mask_arr(li,lj,k) == 2) {
894  mask_x_found = true;
895  di_min = std::min(di_min,(Real) std::abs(li-i));
896  }
897  }
898  if (mask_x_found) {
899  Real mag = std::sqrt( Real(di_min*di_min + jj*jj) );
900  n_ind = std::min(mag,width-one) + one;
901  } else {
902  Abort("Mask not found near y wall!");
903  }
904  } else {
905  Abort("Relaxation cell must be near a wall!");
906  }
907  }
908 
909  Real Factor = (num - n_ind)/denom;
910  Real d = data_arr(i ,j ,k ,n+icomp) + delta_t*rhs_arr(i , j , k ,n+icomp);
911  Real d_ip1 = data_arr(i+1,j ,k ,n+icomp) + delta_t*rhs_arr(i+1, j , k ,n+icomp);
912  Real d_im1 = data_arr(i-1,j ,k ,n+icomp) + delta_t*rhs_arr(i-1, j , k ,n+icomp);
913  Real d_jp1 = data_arr(i ,j+1,k ,n+icomp) + delta_t*rhs_arr(i , j+1, k ,n+icomp);
914  Real d_jm1 = data_arr(i ,j-1,k ,n+icomp) + delta_t*rhs_arr(i , j-1, k ,n+icomp);
915  Real delta = fine_arr(i ,j ,k,n) - d;
916  Real delta_xp = fine_arr(i+1,j ,k,n) - d_ip1;
917  Real delta_xm = fine_arr(i-1,j ,k,n) - d_im1;
918  Real delta_yp = fine_arr(i ,j+1,k,n) - d_jp1;
919  Real delta_ym = fine_arr(i ,j-1,k,n) - d_jm1;
920  Real Laplacian = delta_xp + delta_xm + delta_yp + delta_ym - Real(4.0)*delta;
921  rhs_arr(i,j,k,n) += (F1*delta - F2*Laplacian) * Factor;
922  }
923  });
924  } // mfi
925  } // ivar_idx
926 }
constexpr amrex::Real one
Definition: ERF_Constants.H:9
constexpr amrex::Real zero
Definition: ERF_Constants.H:8
constexpr amrex::Real myhalf
Definition: ERF_Constants.H:13
@ num
Definition: ERF_DataStruct.H:24
for(int i=0;i< m_num_species;i++)
Definition: ERF_InitCustomPert_MultiSpeciesBubble.H:48
PhysBCFunctNoOp void_bc
Definition: ERF_InteriorGhostCells.cpp:5
ParallelFor(grown_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
auto rho_arr
Definition: ERF_UpdateWSubsidence_SineMassFlux.H:3
amrex::iMultiFab * GetMask()
Definition: ERF_FillPatcher.H:43
void FillRelax(amrex::MultiFab &mf, double time, BC &cbc, amrex::Vector< amrex::BCRec > const &bcs)
Definition: ERF_FillPatcher.H:105
int GetSetMaskVal()
Definition: ERF_FillPatcher.H:39
int GetRelaxMaskVal()
Definition: ERF_FillPatcher.H:41
@ NumTypes
Definition: ERF_IndexDefines.H:197
@ ymom
Definition: ERF_IndexDefines.H:195
@ cons
Definition: ERF_IndexDefines.H:193
@ zmom
Definition: ERF_IndexDefines.H:196
@ xmom
Definition: ERF_IndexDefines.H:194
Here is the call graph for this function:

◆ realbdy_bc_bxs_xy()

void realbdy_bc_bxs_xy ( const Box &  bx,
const Box &  domain,
const int &  set_width,
Box &  bx_xlo,
Box &  bx_xhi,
Box &  bx_ylo,
Box &  bx_yhi,
const IntVect &  ng_vect 
)

Get the boxes for looping over interior/exterior ghost cells for use by fillpatch, erf_slow_rhs_pre, and erf_slow_rhs_post.

Parameters
[in]bxbox to intersect with 4 halo regions
[in]domainbox of the whole domain
[in]widthnumber of cells in (relaxation+specified) zone
[in]set_widthnumber of cells in (specified) zone
[out]bx_xlohalo box at x_lo boundary
[out]bx_xhihalo box at x_hi boundary
[out]bx_ylohalo box at y_lo boundary
[out]bx_yhihalo box at y_hi boundary
[in]ng_vectnumber of ghost cells in each direction
[in]get_int_ngflag to get ghost cells inside the domain
101 {
102  AMREX_ALWAYS_ASSERT(bx.ixType() == domain.ixType());
103 
104  // Domain bounds without ghost cells
105  const auto& dom_lo = lbound(domain);
106  const auto& dom_hi = ubound(domain);
107 
108  // Four boxes matching the domain
109  Box gdom_xlo(domain); Box gdom_xhi(domain);
110  Box gdom_ylo(domain); Box gdom_yhi(domain);
111 
112  // Get offsets from box index type
113  IntVect iv_type = bx.ixType().toIntVect();
114  int offx = (iv_type[0]==1) ? 0 : -1;
115  int offy = (iv_type[1]==1) ? 0 : -1;
116 
117  // Stagger the boxes based upon index type
118  gdom_xlo += IntVect(offx,0,0); gdom_xhi += IntVect(-offx,0,0);
119  gdom_ylo += IntVect(0,offy,0); gdom_yhi += IntVect(0,-offy,0);
120 
121  // Trim the boxes to only include internal ghost cells
122  gdom_xlo.setBig(0,dom_lo.x+set_width+offx-1); gdom_xhi.setSmall(0,dom_hi.x-set_width-offx+1);
123  gdom_ylo.setBig(1,dom_lo.y+set_width+offy-1); gdom_yhi.setSmall(1,dom_hi.y-set_width-offy+1);
124 
125  // Remove overlapping corners from y-face boxes
126  gdom_ylo.setSmall(0,gdom_xlo.bigEnd(0)+1); gdom_ylo.setBig(0,gdom_xhi.smallEnd(0)-1);
127  gdom_yhi.setSmall(0,gdom_xlo.bigEnd(0)+1); gdom_yhi.setBig(0,gdom_xhi.smallEnd(0)-1);
128 
129  // Grow boxes to get external ghost cells only
130  gdom_xlo.growLo(0,ng_vect[0]+offx); gdom_xhi.growHi(0,ng_vect[0]+offx);
131  gdom_xlo.grow (1,ng_vect[1] ); gdom_xhi.grow (1,ng_vect[1] );
132  gdom_ylo.growLo(1,ng_vect[1]+offy); gdom_yhi.growHi(1,ng_vect[1]+offy);
133 
134  // Populate everything
135  bx_xlo = (bx & gdom_xlo);
136  bx_xhi = (bx & gdom_xhi);
137  bx_ylo = (bx & gdom_ylo);
138  bx_yhi = (bx & gdom_yhi);
139 }
AMREX_ALWAYS_ASSERT(bx.length()[2]==khi+1)
const auto & dom_hi
Definition: ERF_SetupVertDiff.H:2
const auto & dom_lo
Definition: ERF_SetupVertDiff.H:1
Here is the call graph for this function:

◆ realbdy_compute_interior_ghost_rhs()

void realbdy_compute_interior_ghost_rhs ( const double &  time,
const double &  delta_t_d,
const double &  start_bdy_time,
const double &  final_bdy_time,
const double &  bdy_time_interval,
const Real nudge_factor,
int  width,
const Geometry &  geom,
Vector< MultiFab > &  S_rhs,
Vector< MultiFab > &  S_cur_data,
Vector< Vector< FArrayBox >> &  bdy_data_xlo,
Vector< Vector< FArrayBox >> &  bdy_data_xhi,
Vector< Vector< FArrayBox >> &  bdy_data_ylo,
Vector< Vector< FArrayBox >> &  bdy_data_yhi,
std::unique_ptr< ReadBndryPlanes > &  m_r2d,
const Real c_p,
const Real rdOcp 
)

Compute the RHS in the relaxation zone

Parameters
[in]timecurrent (total) time
[in]delta_ttimestep
[in]start_bdy_timefull time of the first time slice of boundary data
[in]final_bdy_timefull time of the last time slice of boundary data
[in]bdy_time_intervaltime interval between boundary condition time stamps
[in]widthnumber of cells in (relaxation+specified) zone
[in]set_widthnumber of cells in (specified) zone
[in]geomcontainer for geometric information
[out]S_rhsRHS to be computed here
[in]S_datacurrent value of the solution
[in]bdy_data_xloboundary data on interior of low x-face
[in]bdy_data_xhiboundary data on interior of high x-face
[in]bdy_data_yloboundary data on interior of low y-face
[in]bdy_data_yhiboundary data on interior of high y-face
178 {
179  BL_PROFILE_REGION("realbdy_compute_interior_ghost_RHS()");
180 
181  Real delta_t = static_cast<Real>(delta_t_d);
182 
183  //
184  // Note that time (= start_time+old_stage_time) is measured as total time
185  // start_bdy_time and final_bdy_time are also measured as total time
186  //
187 
188  // Get bndry data if we have it
189  Vector<int> bnd_map = {BCVars::xvel_bc, BCVars::yvel_bc, BCVars::RhoTheta_bc_comp};
190  Array4<Real> bdatxlo, bdatxhi, bdatylo, bdatyhi;
191  Array4<Real> btenxlo, btenxhi, btenylo, btenyhi;
192  if (m_r2d) {
193  // Index is [plane orientation] and [level]
194  Vector<std::unique_ptr<PlaneVector>>& bndry_data = m_r2d->interp_in_time(time);
195  bdatxlo = (*bndry_data[0])[0].array();
196  bdatylo = (*bndry_data[1])[0].array();
197  bdatxhi = (*bndry_data[3])[0].array();
198  bdatyhi = (*bndry_data[4])[0].array();
199 
200  Vector<std::unique_ptr<PlaneVector>>& bndry_tend = m_r2d->get_tendency(time);
201  btenxlo = (*bndry_tend[0])[0].array();
202  btenylo = (*bndry_tend[1])[0].array();
203  btenxhi = (*bndry_tend[3])[0].array();
204  btenyhi = (*bndry_tend[4])[0].array();
205  }
206 
207  // Relaxation constants
208  Real F1 = one/(nudge_factor*delta_t);
209 
210  // Time interpolation
211  double dT_d = bdy_time_interval;
212 
213  int n_time = static_cast<int>( (time-start_bdy_time) / dT_d);
214  int n_time_p1 = n_time + 1;
215  Real alpha = static_cast<Real>(((time-start_bdy_time) - n_time * dT_d) / dT_d);
216 
217  // Do not over run the last bdy file
218  if (time >= final_bdy_time) {
219  n_time = static_cast<int>( (final_bdy_time - start_bdy_time)/ dT_d);
220  n_time_p1 = n_time;
221  alpha = zero;
222  }
223 
225  Real oma = one - alpha;
226 
227  // Temporary FABs for storage (owned/filled on all ranks)
228  FArrayBox U_xlo, U_xhi, U_ylo, U_yhi;
229  FArrayBox V_xlo, V_xhi, V_ylo, V_yhi;
230  FArrayBox T_xlo, T_xhi, T_ylo, T_yhi;
231 
232  // Variable index map (WRFBdyVars -> Vars)
233  Vector<int> var_map = {Vars::xvel, Vars::yvel, Vars::cons };
234  Vector<int> ivar_map = {IntVars::xmom, IntVars::ymom, IntVars::cons};
235 
236  // Variable icomp map
237  Vector<int> comp_map = {0, 0, RhoTheta_comp};
238 
239  // Indices
240  int ivarU = RealBdyVars::U;
241  int ivarV = RealBdyVars::V;
242  int ivarT = RealBdyVars::T;
243  int BdyEnd = RealBdyVars::NumTypes-1;
244 
245 
246  // NOTE: The sizing of the temporary BDY FABS is
247  // GLOBAL and occurs over the entire BDY region.
248 
249  // Size the FABs
250  //==========================================================
251  for (int ivar(ivarU); ivar < BdyEnd; ivar++) {
252  int ivar_idx = var_map[ivar];
253  Box domain = geom.Domain();
254  auto ixtype = S_cur_data[ivar_idx].boxArray().ixType();
255  domain.convert(ixtype);
256 
257  // NOTE: Ghost cells needed for idx type mismatch between mask and data (do_upwind)
258  IntVect ng_vect(0);
259  //IntVect ng_vect(1,1,0);
260  Box gdom(domain); gdom.grow(ng_vect);
261  Box bx_xlo, bx_xhi, bx_ylo, bx_yhi;
262  realbdy_interior_bxs_xy(gdom, domain, width,
263  bx_xlo, bx_xhi,
264  bx_ylo, bx_yhi,
265  ng_vect, true);
266 
267  // Size the FABs
268  if (ivar == ivarU) {
269  U_xlo.resize(bx_xlo,1,The_Async_Arena()); U_xhi.resize(bx_xhi,1,The_Async_Arena());
270  U_ylo.resize(bx_ylo,1,The_Async_Arena()); U_yhi.resize(bx_yhi,1,The_Async_Arena());
271  } else if (ivar == ivarV) {
272  V_xlo.resize(bx_xlo,1,The_Async_Arena()); V_xhi.resize(bx_xhi,1,The_Async_Arena());
273  V_ylo.resize(bx_ylo,1,The_Async_Arena()); V_yhi.resize(bx_yhi,1,The_Async_Arena());
274  } else if (ivar == ivarT){
275  T_xlo.resize(bx_xlo,1,The_Async_Arena()); T_xhi.resize(bx_xhi,1,The_Async_Arena());
276  T_ylo.resize(bx_ylo,1,The_Async_Arena()); T_yhi.resize(bx_yhi,1,The_Async_Arena());
277  } else {
278  continue;
279  }
280  } // ivar
281 
282 
283  // NOTE: These operations use the BDY FABS and RHO. The
284  // use of RHO to go from PRIM -> CONS requires that
285  // these operations be LOCAL. So we have allocated
286  // enough space to do global operations (1 rank) but
287  // will fill a subset of that data that the rank owns.
288 
289  // Populate FABs from bdy interpolation (primitive vars)
290  //==========================================================
291  for (int ivar(ivarU); ivar < BdyEnd; ivar++) {
292  int ivar_idx = var_map[ivar];
293  Box domain = geom.Domain();
294  auto ixtype = S_cur_data[ivar_idx].boxArray().ixType();
295  domain.convert(ixtype);
296  const auto& dom_lo = lbound(domain);
297  const auto& dom_hi = ubound(domain);
298 
299  // BndryReg idx and limiting
300  int bdy_comp = bnd_map[ivar];
301  const auto& dom_cc_lo = lbound(geom.Domain());
302  const auto& dom_cc_hi = ubound(geom.Domain());
303 
304 #ifdef _OPENMP
305 #pragma omp parallel if (Gpu::notInLaunchRegion())
306 #endif
307  for (MFIter mfi(S_cur_data[ivar_idx],TilingIfNotGPU()); mfi.isValid(); ++mfi) {
308  // NOTE: Ghost cells needed for idx type mismatch between mask and data (do_upwind)
309  IntVect ng_vect(0);
310  //IntVect ng_vect(1,1,0);
311  Box gtbx = grow(mfi.tilebox(ixtype.toIntVect()),ng_vect);
312  Box tbx_xlo, tbx_xhi, tbx_ylo, tbx_yhi;
313  realbdy_interior_bxs_xy(gtbx, domain, width,
314  tbx_xlo, tbx_xhi,
315  tbx_ylo, tbx_yhi,
316  ng_vect, true);
317 
318  Array4<Real> arr_xlo; Array4<Real> arr_xhi;
319  Array4<Real> arr_ylo; Array4<Real> arr_yhi;
320  if (ivar == ivarU) {
321  arr_xlo = U_xlo.array(); arr_xhi = U_xhi.array();
322  arr_ylo = U_ylo.array(); arr_yhi = U_yhi.array();
323  } else if (ivar == ivarV) {
324  arr_xlo = V_xlo.array(); arr_xhi = V_xhi.array();
325  arr_ylo = V_ylo.array(); arr_yhi = V_yhi.array();
326  } else if (ivar == ivarT){
327  arr_xlo = T_xlo.array(); arr_xhi = T_xhi.array();
328  arr_ylo = T_ylo.array(); arr_yhi = T_yhi.array();
329  } else {
330  continue;
331  }
332 
333  // Boundary data at fixed time intervals
334  const auto& bdatxlo_n = bdy_data_xlo[n_time ][ivar].const_array();
335  const auto& bdatxlo_np1 = bdy_data_xlo[n_time_p1][ivar].const_array();
336  const auto& bdatxhi_n = bdy_data_xhi[n_time ][ivar].const_array();
337  const auto& bdatxhi_np1 = bdy_data_xhi[n_time_p1][ivar].const_array();
338  const auto& bdatylo_n = bdy_data_ylo[n_time ][ivar].const_array();
339  const auto& bdatylo_np1 = bdy_data_ylo[n_time_p1][ivar].const_array();
340  const auto& bdatyhi_n = bdy_data_yhi[n_time ][ivar].const_array();
341  const auto& bdatyhi_np1 = bdy_data_yhi[n_time_p1][ivar].const_array();
342 
343  // Current density to convert to conserved vars
344  Array4<Real> r_arr = S_cur_data[IntVars::cons].array(mfi);
345 
346  // Limiting offset
347  int offset = width - 1;
348 
349  // Populate with interpolation (protect from ghost cells)
350  ParallelFor(tbx_xlo, tbx_xhi,
351  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
352  {
353  int ii = std::max(i , dom_lo.x); ii = std::min(ii, dom_lo.x+offset);
354  int jj = std::max(j , dom_lo.y); jj = std::min(jj, dom_hi.y);
355 
356  Real rho_interp;
357  if (ivar==ivarU) {
358  rho_interp = myhalf * ( r_arr(i-1,j ,k) + r_arr(i,j,k) );
359  } else if (ivar==ivarV) {
360  rho_interp = myhalf * ( r_arr(i ,j-1,k) + r_arr(i,j,k) );
361  } else {
362  rho_interp = r_arr(i,j,k);
363  }
364 
365  if (bdatxlo) {
366  int ii2 = std::min(std::max(i , dom_cc_lo.x), dom_cc_hi.x);
367  int jj2 = std::min(std::max(j , dom_cc_lo.y), dom_cc_hi.y);
368  arr_xlo(i,j,k) = rho_interp * bdatxlo(ii2,jj2,k,bdy_comp);
369  } else {
370  arr_xlo(i,j,k) = rho_interp * ( oma * bdatxlo_n (ii,jj,k,0)
371  + alpha * bdatxlo_np1(ii,jj,k,0) );
372  }
373  },
374  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
375  {
376  int ii = std::max(i , dom_hi.x-offset); ii = std::min(ii, dom_hi.x);
377  int jj = std::max(j , dom_lo.y); jj = std::min(jj, dom_hi.y);
378 
379  Real rho_interp;
380  if (ivar==ivarU) {
381  rho_interp = myhalf * ( r_arr(i-1,j ,k) + r_arr(i,j,k) );
382  } else if (ivar==ivarV) {
383  rho_interp = myhalf * ( r_arr(i ,j-1,k) + r_arr(i,j,k) );
384  } else {
385  rho_interp = r_arr(i,j,k);
386  }
387 
388  if (bdatxhi) {
389  int ii2 = std::min(std::max(i , dom_cc_lo.x), dom_cc_hi.x);
390  int jj2 = std::min(std::max(j , dom_cc_lo.y), dom_cc_hi.y);
391  arr_xhi(i,j,k) = rho_interp * bdatxhi(ii2,jj2,k,bdy_comp);
392  } else {
393  arr_xhi(i,j,k) = rho_interp * ( oma * bdatxhi_n (ii,jj,k,0)
394  + alpha * bdatxhi_np1(ii,jj,k,0) );
395  }
396  });
397 
398  ParallelFor(tbx_ylo, tbx_yhi,
399  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
400  {
401  int ii = std::max(i , dom_lo.x); ii = std::min(ii, dom_hi.x);
402  int jj = std::max(j , dom_lo.y); jj = std::min(jj, dom_lo.y+offset);
403 
404  Real rho_interp;
405  if (ivar==ivarU) {
406  rho_interp = myhalf * ( r_arr(i-1,j ,k) + r_arr(i,j,k) );
407  } else if (ivar==ivarV) {
408  rho_interp = myhalf * ( r_arr(i ,j-1,k) + r_arr(i,j,k) );
409  } else {
410  rho_interp = r_arr(i,j,k);
411  }
412 
413  if (bdatylo) {
414  int ii2 = std::min(std::max(i , dom_cc_lo.x), dom_cc_hi.x);
415  int jj2 = std::min(std::max(j , dom_cc_lo.y), dom_cc_hi.y);
416  arr_ylo(i,j,k) = rho_interp * bdatylo(ii2,jj2,k,bdy_comp);
417  } else {
418  arr_ylo(i,j,k) = rho_interp * ( oma * bdatylo_n (ii,jj,k,0)
419  + alpha * bdatylo_np1(ii,jj,k,0) );
420  }
421  },
422  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
423  {
424  int ii = std::max(i , dom_lo.x); ii = std::min(ii, dom_hi.x);
425  int jj = std::max(j , dom_hi.y-offset); jj = std::min(jj, dom_hi.y);
426 
427  Real rho_interp;
428  if (ivar==ivarU) {
429  rho_interp = myhalf * ( r_arr(i-1,j ,k) + r_arr(i,j,k) );
430  } else if (ivar==ivarV) {
431  rho_interp = myhalf * ( r_arr(i ,j-1,k) + r_arr(i,j,k) );
432  } else {
433  rho_interp = r_arr(i,j,k);
434  }
435 
436  if (bdatyhi) {
437  int ii2 = std::min(std::max(i , dom_cc_lo.x), dom_cc_hi.x);
438  int jj2 = std::min(std::max(j , dom_cc_lo.y), dom_cc_hi.y);
439  arr_yhi(i,j,k) = rho_interp * bdatyhi(ii2,jj2,k,bdy_comp);
440  } else {
441  arr_yhi(i,j,k) = rho_interp * ( oma * bdatyhi_n (ii,jj,k,0)
442  + alpha * bdatyhi_np1(ii,jj,k,0) );
443  }
444  });
445  } // mfi
446  } // ivar
447 
448 
449  // Compute RHS in relaxation region
450  //==========================================================
451  auto dx = geom.CellSizeArray();
452  auto ProbLo = geom.ProbLoArray();
453  auto ProbHi = geom.ProbHiArray();
454 
455  for (int ivar(ivarU); ivar < BdyEnd; ivar++) {
456  int ivar_idx = ivar_map[ivar];
457  int icomp = comp_map[ivar];
458 
459  Box domain = geom.Domain();
460  domain.convert(S_cur_data[ivar_idx].boxArray().ixType());
461  IntVect ng_vect(0);
462 
463 #ifdef _OPENMP
464 #pragma omp parallel if (Gpu::notInLaunchRegion())
465 #endif
466  for (MFIter mfi(S_cur_data[ivar_idx],TilingIfNotGPU()); mfi.isValid(); ++mfi)
467  {
468  Box tbx = mfi.tilebox();
469  Box tbx_xlo, tbx_xhi, tbx_ylo, tbx_yhi;
470  realbdy_interior_bxs_xy(tbx, domain, width,
471  tbx_xlo, tbx_xhi,
472  tbx_ylo, tbx_yhi,
473  ng_vect);
474 
475  Array4<Real> rhs_arr; Array4<Real> data_arr;
476  Array4<Real> arr_xlo; Array4<Real> arr_xhi;
477  Array4<Real> arr_ylo; Array4<Real> arr_yhi;
478  if (ivar == ivarU) {
479  arr_xlo = U_xlo.array(); arr_xhi = U_xhi.array();
480  arr_ylo = U_ylo.array(); arr_yhi = U_yhi.array();
481  rhs_arr = S_rhs[IntVars::xmom].array(mfi);
482  data_arr = S_cur_data[IntVars::xmom].array(mfi);
483  } else if (ivar == ivarV) {
484  arr_xlo = V_xlo.array(); arr_xhi = V_xhi.array();
485  arr_ylo = V_ylo.array(); arr_yhi = V_yhi.array();
486  rhs_arr = S_rhs[IntVars::ymom].array(mfi);
487  data_arr = S_cur_data[IntVars::ymom].array(mfi);
488  } else if (ivar == ivarT){
489  arr_xlo = T_xlo.array(); arr_xhi = T_xhi.array();
490  arr_ylo = T_ylo.array(); arr_yhi = T_yhi.array();
491  rhs_arr = S_rhs[IntVars::cons].array(mfi);
492  data_arr = S_cur_data[IntVars::cons].array(mfi);
493  } else {
494  continue;
495  }
496 
498  width, dx, ProbLo, ProbHi, F1,
499  tbx_xlo , tbx_xhi , tbx_ylo , tbx_yhi ,
500  arr_xlo , arr_xhi , arr_ylo , arr_yhi ,
501  data_arr, rhs_arr , c_p, rdOcp);
502  } // mfi
503  } // ivar
504 
505  // Set normal velocity RHS at the boundary
506  //==========================================================
507  Box domain = geom.Domain();
508  Box domainx = convert(domain, IntVect(1,0,0));
509  Box domainy = convert(domain, IntVect(0,1,0));
510 
511  int ilo = domainx.smallEnd(0);
512  int ihi = domainx.bigEnd(0);
513  int jlo = domainy.smallEnd(1);
514  int jhi = domainy.bigEnd(1);
515 
516 #ifdef _OPENMP
517 #pragma omp parallel if (Gpu::notInLaunchRegion())
518 #endif
519  for (MFIter mfi(S_cur_data[IntVars::cons],TilingIfNotGPU()); mfi.isValid(); ++mfi)
520  {
521  Box tbx = mfi.nodaltilebox(0);
522  Box tbx_lo, tbx_hi;
523  if (tbx.smallEnd(0) == ilo) {
524  tbx_lo = makeSlab(tbx,0,ilo);
525  }
526  if (tbx.bigEnd(0) == ihi) {
527  tbx_hi = makeSlab(tbx,0,ihi);
528  }
529 
530  Box tby = mfi.nodaltilebox(1);
531  Box tby_lo, tby_hi;
532  if (tby.smallEnd(1) == jlo) {
533  tby_lo = makeSlab(tby,1,jlo);
534  }
535  if (tby.bigEnd(1) == jhi) {
536  tby_hi = makeSlab(tby,1,jhi);
537  }
538 
539  Array4<Real> rhs_xmom = S_rhs[IntVars::xmom].array(mfi);
540  Array4<Real> rhs_ymom = S_rhs[IntVars::ymom].array(mfi);
541 
542  Array4<const Real> rhs_cons = S_rhs[IntVars::cons].const_array(mfi);
543  Array4<const Real> cons_arr = S_cur_data[IntVars::cons].const_array(mfi);
544 
545  const auto& bdatxlo_n = bdy_data_xlo[n_time ][ivarU].const_array();
546  const auto& bdatxlo_np1 = bdy_data_xlo[n_time_p1][ivarU].const_array();
547  const auto& bdatxhi_n = bdy_data_xhi[n_time ][ivarU].const_array();
548  const auto& bdatxhi_np1 = bdy_data_xhi[n_time_p1][ivarU].const_array();
549 
550  const auto& bdatylo_n = bdy_data_ylo[n_time ][ivarV].const_array();
551  const auto& bdatylo_np1 = bdy_data_ylo[n_time_p1][ivarV].const_array();
552  const auto& bdatyhi_n = bdy_data_yhi[n_time ][ivarV].const_array();
553  const auto& bdatyhi_np1 = bdy_data_yhi[n_time_p1][ivarV].const_array();
554 
555  Real dT = static_cast<Real>(bdy_time_interval);
556 
557  ParallelFor(tbx_lo, tbx_hi,
558  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
559  {
560  Real rho_tend = rhs_cons(i,j,k);
561  Real rho_val = Real(0.5) * (cons_arr(i,j,k) + cons_arr(i-1,j,k));
562  Real u_tend, u_val;
563  if (btenxlo) {
564  u_tend = btenxlo(i,j,k,BCVars::xvel_bc);
565  u_val = bdatxlo(i,j,k,BCVars::xvel_bc);
566  } else {
567  u_tend = (bdatxlo_np1(i,j,k) - bdatxlo_n(i,j,k)) / dT;
568  u_val = oma * bdatxlo_n(i,j,k) + alpha * bdatxlo_np1(i,j,k);
569  }
570  rhs_xmom(i,j,k) = rho_val * u_tend + u_val * rho_tend;
571  },
572  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
573  {
574  Real rho_tend = rhs_cons(i,j,k);
575  Real rho_val = Real(0.5) * (cons_arr(i,j,k) + cons_arr(i-1,j,k));
576  Real u_tend, u_val;
577  if (btenxhi) {
578  u_tend = btenxhi(i,j,k,BCVars::xvel_bc);
579  u_val = bdatxhi(i,j,k,BCVars::xvel_bc);
580  } else {
581  u_tend = (bdatxhi_np1(i,j,k) - bdatxhi_n(i,j,k)) / dT;
582  u_val = oma * bdatxhi_n(i,j,k) + alpha * bdatxhi_np1(i,j,k);
583  }
584  rhs_xmom(i,j,k) = rho_val * u_tend + u_val * rho_tend;
585  });
586 
587  ParallelFor(tby_lo, tby_hi,
588  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
589  {
590  Real rho_tend = rhs_cons(i,j,k);
591  Real rho_val = Real(0.5) * (cons_arr(i,j,k) + cons_arr(i,j-1,k));
592  Real v_tend, v_val;
593  if (btenylo) {
594  v_tend = btenylo(i,j,k,BCVars::yvel_bc);
595  v_val = bdatylo(i,j,k,BCVars::yvel_bc);
596  } else {
597  v_tend = (bdatylo_np1(i,j,k) - bdatylo_n(i,j,k)) / dT;
598  v_val = oma * bdatylo_n(i,j,k) + alpha * bdatylo_np1(i,j,k);
599  }
600  rhs_ymom(i,j,k) = rho_val * v_tend + v_val * rho_tend;
601  },
602  [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
603  {
604  Real rho_tend = rhs_cons(i,j,k);
605  Real rho_val = Real(0.5) * (cons_arr(i,j,k) + cons_arr(i,j-1,k));
606  Real v_tend, v_val;
607  if (btenyhi) {
608  v_tend = btenyhi(i,j,k,BCVars::yvel_bc);
609  v_val = bdatyhi(i,j,k,BCVars::yvel_bc);
610  } else {
611  v_tend = (bdatyhi_np1(i,j,k) - bdatyhi_n(i,j,k)) / dT;
612  v_val = oma * bdatyhi_n(i,j,k) + alpha * bdatyhi_np1(i,j,k);
613  }
614  rhs_ymom(i,j,k) = rho_val * v_tend + v_val * rho_tend;
615  });
616  } // mfi
617 }
#define RhoTheta_comp
Definition: ERF_IndexDefines.H:37
const Real dx
Definition: ERF_InitCustomPert_ABL.H:23
const Real rdOcp
Definition: ERF_InitCustomPert_Bomex.H:16
void realbdy_interior_bxs_xy(const Box &bx, const Box &domain, const int &width, Box &bx_xlo, Box &bx_xhi, Box &bx_ylo, Box &bx_yhi, const IntVect &ng_vect, const bool get_int_ng)
Definition: ERF_InteriorGhostCells.cpp:23
AMREX_FORCE_INLINE IntVect offset(const int face_dir, const int normal)
Definition: ERF_ReadBndryPlanes.cpp:28
AMREX_GPU_HOST AMREX_FORCE_INLINE void realbdy_compute_relaxation(const int &icomp, const int &num_var, const int &width, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &dx, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &ProbLo, const amrex::GpuArray< amrex::Real, AMREX_SPACEDIM > &ProbHi, const amrex::Real &F1, const amrex::Box &bx_xlo, const amrex::Box &bx_xhi, const amrex::Box &bx_ylo, const amrex::Box &bx_yhi, const amrex::Array4< const amrex::Real > &arr_xlo, const amrex::Array4< const amrex::Real > &arr_xhi, const amrex::Array4< const amrex::Real > &arr_ylo, const amrex::Array4< const amrex::Real > &arr_yhi, const amrex::Array4< const amrex::Real > &data_arr, const amrex::Array4< amrex::Real > &rhs_arr, const amrex::Real &c_p, const amrex::Real &rdOcp, const int bdy_moist_nudge_type=0)
Definition: ERF_Utils.H:240
@ RhoTheta_bc_comp
Definition: ERF_IndexDefines.H:88
@ yvel_bc
Definition: ERF_IndexDefines.H:103
@ xvel_bc
Definition: ERF_IndexDefines.H:102
@ U
Definition: ERF_IndexDefines.H:123
@ NumTypes
Definition: ERF_IndexDefines.H:127
@ T
Definition: ERF_IndexDefines.H:125
@ V
Definition: ERF_IndexDefines.H:124
@ xvel
Definition: ERF_IndexDefines.H:176
@ cons
Definition: ERF_IndexDefines.H:175
@ yvel
Definition: ERF_IndexDefines.H:177
real(kind=kind_phys), parameter, public alpha
Definition: ERF_module_mp_wsm6.F90:44
Here is the call graph for this function:

◆ realbdy_interior_bxs_xy()

void realbdy_interior_bxs_xy ( const Box &  bx,
const Box &  domain,
const int &  width,
Box &  bx_xlo,
Box &  bx_xhi,
Box &  bx_ylo,
Box &  bx_yhi,
const IntVect &  ng_vect,
const bool  get_int_ng 
)

Get the boxes for looping over interior/exterior ghost cells for use by fillpatch, erf_slow_rhs_pre, and erf_slow_rhs_post.

Parameters
[in]bxbox to intersect with 4 halo regions
[in]domainbox of the whole domain
[in]widthnumber of cells in (relaxation+specified) zone
[in]set_widthnumber of cells in (specified) zone
[out]bx_xlohalo box at x_lo boundary
[out]bx_xhihalo box at x_hi boundary
[out]bx_ylohalo box at y_lo boundary
[out]bx_yhihalo box at y_hi boundary
[in]ng_vectnumber of ghost cells in each direction
[in]get_int_ngflag to get ghost cells inside the domain
32 {
33  AMREX_ALWAYS_ASSERT(bx.ixType() == domain.ixType());
34 
35  //==================================================================
36  // NOTE: X-face boxes take ownership of the overlapping region.
37  // With exterior ghost cells (ng_vect != 0), the x-face
38  // boxes will have exterior ghost cells in both x & y.
39  //==================================================================
40 
41  // Domain bounds without ghost cells
42  const auto& dom_lo = lbound(domain);
43  const auto& dom_hi = ubound(domain);
44 
45  // Four boxes matching the domain
46  Box gdom_xlo(domain); Box gdom_xhi(domain);
47  Box gdom_ylo(domain); Box gdom_yhi(domain);
48 
49  // Trim the boxes to only include internal ghost cells
50  gdom_xlo.setBig(0,dom_lo.x+width-1); gdom_xhi.setSmall(0,dom_hi.x-width+1);
51  gdom_ylo.setBig(1,dom_lo.y+width-1); gdom_yhi.setSmall(1,dom_hi.y-width+1);
52 
53  // Remove overlapping corners from y-face boxes
54  gdom_ylo.setSmall(0,gdom_xlo.bigEnd(0)+1); gdom_ylo.setBig(0,gdom_xhi.smallEnd(0)-1);
55  gdom_yhi.setSmall(0,gdom_xlo.bigEnd(0)+1); gdom_yhi.setBig(0,gdom_xhi.smallEnd(0)-1);
56 
57  // Grow boxes to get external ghost cells only
58  gdom_xlo.growLo(0,ng_vect[0]); gdom_xhi.growHi(0,ng_vect[0]);
59  gdom_xlo.grow (1,ng_vect[1]); gdom_xhi.grow (1,ng_vect[1]);
60  gdom_ylo.growLo(1,ng_vect[1]); gdom_yhi.growHi(1,ng_vect[1]);
61 
62  // Grow boxes to get internal ghost cells
63  if (get_int_ng) {
64  gdom_xlo.growHi(0,ng_vect[0]); gdom_xhi.growLo(0,ng_vect[0]);
65  gdom_ylo.grow (0,ng_vect[0]); gdom_yhi.grow (0,ng_vect[0]);
66  gdom_ylo.growHi(1,ng_vect[1]); gdom_yhi.growLo(1,ng_vect[1]);
67  }
68 
69  // Populate everything
70  bx_xlo = (bx & gdom_xlo);
71  bx_xhi = (bx & gdom_xhi);
72  bx_ylo = (bx & gdom_ylo);
73  bx_yhi = (bx & gdom_yhi);
74 }

Referenced by realbdy_compute_interior_ghost_rhs().

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

Variable Documentation

◆ void_bc

PhysBCFunctNoOp void_bc