ERF
Energy Research and Forecasting: An Atmospheric Modeling Code
eb_ Class Reference

Owns and exposes cell-centered and face-centered EB factories. More...

#include <ERF_EB.H>

Collaboration diagram for eb_:

Public Types

using CutCellList = amrex::Gpu::DeviceVector< amrex::Dim3 >
 

Public Member Functions

 ~eb_ ()
 Destroy the EB factory manager. More...
 
 eb_ (amrex::Geometry const &a_geom, amrex::FArrayBox const &terrain_fab, amrex::Gpu::DeviceVector< amrex::Real > &a_dz_stretched, bool is_anelastic)
 Construct an EB description from terrain data. More...
 
 eb_ ()
 Construct an empty EB factory manager. More...
 
void define (int level, amrex::Geometry const &a_geom, amrex::EB2::Level const *a_eb_level, bool is_anelastic)
 Define the EB level metadata used by this factory manager. More...
 
void make_all_factories (int level, amrex::Geometry const &a_geom, amrex::BoxArray const &ba, amrex::DistributionMapping const &dm, amrex::EB2::Level const &a_eb_level)
 Build cell-centered and staggered EB factories for the level. More...
 
void make_cc_factory (int level, amrex::Geometry const &a_geom, amrex::BoxArray const &ba, amrex::DistributionMapping const &dm, amrex::EB2::Level const &a_eb_level)
 Build only the cell-centered EB factory for the level. More...
 
int nghost_basic () const
 Number of ghost cells needed for basic EB flags. More...
 
int nghost_volume () const
 Number of ghost cells needed for EB volume data. More...
 
int nghost_full () const
 Number of ghost cells needed for full EB geometric data. More...
 
CutCellList const & get_u_cut_cells (int grid_index) const noexcept
 Return cut x-faces owned by a grid, cached when the EB factories are built. More...
 
CutCellList const & get_v_cut_cells (int grid_index) const noexcept
 Return cut y-faces owned by a grid, cached when the EB factories are built. More...
 
CutCellList const & get_w_cut_cells (int grid_index) const noexcept
 Return cut z-faces owned by a grid, cached when the EB factories are built. More...
 
const std::unique_ptr< amrex::EBFArrayBoxFactory > & get_const_factory () const noexcept
 Return the cell-centered EB factory. More...
 
void set_connection_flags (amrex::EBFArrayBoxFactory *factory)
 Disconnect covered neighbors in an EB factory's cell flags. More...
 
void mask_fc_from_cc (amrex::EBFArrayBoxFactory *fc_factory, const amrex::EBFArrayBoxFactory *cc_factory, int idim)
 Enforce FC-CC consistency by marking FC faces as covered when both CC neighbors are covered. More...
 
amrex::EBFArrayBoxFactory const * get_u_const_factory () const noexcept
 Return the native AMReX x-face EB factory. More...
 
amrex::EBFArrayBoxFactory const * get_v_const_factory () const noexcept
 Return the native AMReX y-face EB factory. More...
 
amrex::EBFArrayBoxFactory const * get_w_const_factory () const noexcept
 Return the native AMReX z-face EB factory. More...
 

Private Member Functions

void build_cut_cell_lists (amrex::FabArray< amrex::EBCellFlagFab > const &flags, amrex::Vector< CutCellList > &cut_cells)
 
void make_terrain (amrex::Geometry const &a_geom)
 Build terrain EB geometry for the supplied Geometry. More...
 
template<class F >
void build_level (amrex::Geometry const &a_geom, amrex::EB2::GeometryShop< F > a_gshop)
 Construct EB levels from an AMReX GeometryShop. More...
 
amrex::FabArray< amrex::EBCellFlagFab > & getNonConstEBCellFlags (const amrex::EBFArrayBoxFactory &ebfact)
 Return mutable EB cell flags from an AMReX factory. More...
 
amrex::MultiFab & getNonConstVolFrac (const amrex::EBFArrayBoxFactory &ebfact)
 Return mutable volume fractions from an AMReX factory. More...
 
amrex::MultiCutFab & getNonConstCentroid (const amrex::EBFArrayBoxFactory &ebfact)
 Return mutable cell centroids from an AMReX factory. More...
 
amrex::Array< amrex::MultiCutFab *, AMREX_SPACEDIM > getNonConstAreaFrac (const amrex::EBFArrayBoxFactory &ebfact)
 Return mutable area-fraction arrays from an AMReX factory. More...
 
amrex::Array< amrex::MultiCutFab *, AMREX_SPACEDIM > getNonConstFaceCent (const amrex::EBFArrayBoxFactory &ebfact)
 Return mutable face-centroid arrays from an AMReX factory. More...
 

Private Attributes

int m_has_eb
 
std::string m_type
 
amrex::EBSupport m_support_level
 
int m_write_eb_surface
 
amrex::FabArray< amrex::EBCellFlagFab > * m_cellflags = nullptr
 
amrex::EB2::Level const * m_eb_level
 EB level constructed from building GeometryShop. More...
 
std::unique_ptr< amrex::EBFArrayBoxFactory > m_factory = nullptr
 
eb_aux_ m_u_factory
 
eb_aux_ m_v_factory
 
eb_aux_ m_w_factory
 
std::unique_ptr< amrex::EBFArrayBoxFactory > m_u_factory_fc = nullptr
 
std::unique_ptr< amrex::EBFArrayBoxFactory > m_v_factory_fc = nullptr
 
std::unique_ptr< amrex::EBFArrayBoxFactory > m_w_factory_fc = nullptr
 
amrex::Vector< CutCellList > m_u_cut_cells
 
amrex::Vector< CutCellList > m_v_cut_cells
 
amrex::Vector< CutCellList > m_w_cut_cells
 

Detailed Description

Owns and exposes cell-centered and face-centered EB factories.

The class builds AMReX EB factories for cell-centered state data and, depending on USE_FC_FACTORY, either native AMReX or ERF auxiliary factories for staggered velocity components.

Member Typedef Documentation

◆ CutCellList

using eb_::CutCellList = amrex::Gpu::DeviceVector<amrex::Dim3>

Constructor & Destructor Documentation

◆ ~eb_()

eb_::~eb_ ( )

Destroy the EB factory manager.

56 {
57  // if (m_factory) { m_factory.reset(nullptr); }
58 }

◆ eb_() [1/2]

eb_::eb_ ( amrex::Geometry const &  a_geom,
amrex::FArrayBox const &  terrain_fab,
amrex::Gpu::DeviceVector< amrex::Real > &  a_dz_stretched,
bool  is_anelastic 
)

Construct an EB description from terrain data.

Parameters
a_geomGeometry used to place the terrain EB.
terrain_fabTerrain height data.
a_dz_stretchedDevice vector containing stretched vertical spacing.
is_anelasticWhether the owning level is using anelastic dynamics.

◆ eb_() [2/2]

eb_::eb_ ( )

Construct an empty EB factory manager.

61  : m_has_eb(0),
62  m_support_level(EBSupport::full),
64 { }
amrex::EBSupport m_support_level
Definition: ERF_EB.H:166
int m_has_eb
Definition: ERF_EB.H:159
int m_write_eb_surface
Definition: ERF_EB.H:168

Member Function Documentation

◆ build_cut_cell_lists()

void eb_::build_cut_cell_lists ( amrex::FabArray< amrex::EBCellFlagFab > const &  flags,
amrex::Vector< CutCellList > &  cut_cells 
)
private
181 {
182  BL_PROFILE("eb_::build_cut_cell_lists()");
183 
184  cut_cells.clear();
185  cut_cells.resize(flags.boxArray().size());
186 
187 #ifdef AMREX_USE_GPU
188  for (MFIter mfi(flags, false); mfi.isValid(); ++mfi) {
189  Box const& bx = mfi.validbox();
190  if (flags[mfi].getType(bx) != FabType::singlevalued) {
191  continue;
192  }
193 
194  Array4<EBCellFlag const> const& flag = flags.const_array(mfi);
195  Long const num_candidates = bx.numPts();
196  CutCellList grid_cut_cells(num_candidates);
197  Dim3* const grid_cut_cells_ptr = grid_cut_cells.data();
198 
199  int const num_cut_cells = fill_cut_cell_list(bx, flag, grid_cut_cells_ptr);
200 
201  grid_cut_cells.resize(num_cut_cells);
202  grid_cut_cells.shrink_to_fit();
203  cut_cells[mfi.index()] = std::move(grid_cut_cells);
204  }
205 #else
206  amrex::ignore_unused(flags);
207 #endif
208 }
amrex::Gpu::DeviceVector< amrex::Dim3 > CutCellList
Definition: ERF_EB.H:30

Referenced by make_all_factories().

Here is the caller graph for this function:

◆ build_level()

template<class F >
void eb_::build_level ( amrex::Geometry const &  a_geom,
amrex::EB2::GeometryShop< F >  a_gshop 
)
inlineprivate

Construct EB levels from an AMReX GeometryShop.

Template Parameters
FImplicit-function type stored by the GeometryShop.
Parameters
a_geomGeometry used to build the EB index space.
a_gshopGeometryShop describing the implicit EB.
211  {
212  int const req_lev(0);
213  int const max_lev(2);
214 
215  amrex::EB2::Build(a_gshop, a_geom, req_lev, max_lev);
216  const amrex::EB2::IndexSpace& ebis = amrex::EB2::IndexSpace::top();
217  m_eb_level = &(ebis.getLevel(a_geom));
218  }
amrex::EB2::Level const * m_eb_level
EB level constructed from building GeometryShop.
Definition: ERF_EB.H:173

◆ define()

void eb_::define ( int  level,
amrex::Geometry const &  a_geom,
amrex::EB2::Level const *  a_eb_level,
bool  is_anelastic 
)

Define the EB level metadata used by this factory manager.

Parameters
levelAMR level index.
a_geomGeometry for the level.
a_eb_levelAMReX EB level owned by the global EB index space.
is_anelasticWhether the owning level is using anelastic dynamics.

◆ get_const_factory()

const std::unique_ptr<amrex::EBFArrayBoxFactory>& eb_::get_const_factory ( ) const
inlinenoexcept

Return the cell-centered EB factory.

124 { return m_factory; }
std::unique_ptr< amrex::EBFArrayBoxFactory > m_factory
Definition: ERF_EB.H:175

Referenced by compute_gradp_xy(), compute_gradp_z(), ComputeTurbulentViscosityLES_EB(), erf_make_tau_terms(), erf_slow_rhs_post(), erf_slow_rhs_pre(), ERF::estTimeStep(), and make_buoyancy().

Here is the caller graph for this function:

◆ get_u_const_factory()

amrex::EBFArrayBoxFactory const* eb_::get_u_const_factory ( ) const
inlinenoexcept

Return the native AMReX x-face EB factory.

144 { return m_u_factory_fc.get(); }
std::unique_ptr< amrex::EBFArrayBoxFactory > m_u_factory_fc
Definition: ERF_EB.H:183

Referenced by AdvectionSrcForMom_EB(), compute_gradp_xy(), ComputeStrain_EB(), ComputeTurbulentViscosityLES_EB(), DiffusionSrcForMom_EB(), and make_mom_sources().

Here is the caller graph for this function:

◆ get_u_cut_cells()

CutCellList const& eb_::get_u_cut_cells ( int  grid_index) const
inlinenoexcept

Return cut x-faces owned by a grid, cached when the EB factories are built.

107  {
108  return m_u_cut_cells[grid_index];
109  }
amrex::Vector< CutCellList > m_u_cut_cells
Definition: ERF_EB.H:188

Referenced by DiffusionSrcForMom_EB().

Here is the caller graph for this function:

◆ get_v_const_factory()

amrex::EBFArrayBoxFactory const* eb_::get_v_const_factory ( ) const
inlinenoexcept

Return the native AMReX y-face EB factory.

146 { return m_v_factory_fc.get(); }
std::unique_ptr< amrex::EBFArrayBoxFactory > m_v_factory_fc
Definition: ERF_EB.H:184

Referenced by AdvectionSrcForMom_EB(), compute_gradp_xy(), ComputeStrain_EB(), ComputeTurbulentViscosityLES_EB(), DiffusionSrcForMom_EB(), and make_mom_sources().

Here is the caller graph for this function:

◆ get_v_cut_cells()

CutCellList const& eb_::get_v_cut_cells ( int  grid_index) const
inlinenoexcept

Return cut y-faces owned by a grid, cached when the EB factories are built.

113  {
114  return m_v_cut_cells[grid_index];
115  }
amrex::Vector< CutCellList > m_v_cut_cells
Definition: ERF_EB.H:189

Referenced by DiffusionSrcForMom_EB().

Here is the caller graph for this function:

◆ get_w_const_factory()

amrex::EBFArrayBoxFactory const* eb_::get_w_const_factory ( ) const
inlinenoexcept

Return the native AMReX z-face EB factory.

148 { return m_w_factory_fc.get(); }
std::unique_ptr< amrex::EBFArrayBoxFactory > m_w_factory_fc
Definition: ERF_EB.H:185

Referenced by AdvectionSrcForMom_EB(), compute_gradp_z(), ComputeStrain_EB(), ComputeTurbulentViscosityLES_EB(), DiffusionSrcForMom_EB(), and make_mom_sources().

Here is the caller graph for this function:

◆ get_w_cut_cells()

CutCellList const& eb_::get_w_cut_cells ( int  grid_index) const
inlinenoexcept

Return cut z-faces owned by a grid, cached when the EB factories are built.

119  {
120  return m_w_cut_cells[grid_index];
121  }
amrex::Vector< CutCellList > m_w_cut_cells
Definition: ERF_EB.H:190

Referenced by DiffusionSrcForMom_EB().

Here is the caller graph for this function:

◆ getNonConstAreaFrac()

amrex::Array<amrex::MultiCutFab*, AMREX_SPACEDIM> eb_::getNonConstAreaFrac ( const amrex::EBFArrayBoxFactory &  ebfact)
inlineprivate

Return mutable area-fraction arrays from an AMReX factory.

247  {
248  auto afrac_const = ebfact.getAreaFrac();
249  amrex::Array<amrex::MultiCutFab*, AMREX_SPACEDIM> afrac;
250  for (int dir = 0; dir < AMREX_SPACEDIM; ++dir) {
251  afrac[dir] = const_cast<amrex::MultiCutFab*>(afrac_const[dir]);
252  }
253  return afrac;
254  }

◆ getNonConstCentroid()

amrex::MultiCutFab& eb_::getNonConstCentroid ( const amrex::EBFArrayBoxFactory &  ebfact)
inlineprivate

Return mutable cell centroids from an AMReX factory.

239  {
240  const amrex::MultiCutFab& vcent_const = ebfact.getCentroid();
241  return const_cast<amrex::MultiCutFab&>(vcent_const);
242  }

◆ getNonConstEBCellFlags()

amrex::FabArray<amrex::EBCellFlagFab>& eb_::getNonConstEBCellFlags ( const amrex::EBFArrayBoxFactory &  ebfact)
inlineprivate

Return mutable EB cell flags from an AMReX factory.

223  {
224  const amrex::FabArray<amrex::EBCellFlagFab>& flags_const = ebfact.getMultiEBCellFlagFab();
225  return const_cast<amrex::FabArray<amrex::EBCellFlagFab>&>(flags_const);
226  }

Referenced by mask_fc_from_cc(), and set_connection_flags().

Here is the caller graph for this function:

◆ getNonConstFaceCent()

amrex::Array<amrex::MultiCutFab*, AMREX_SPACEDIM> eb_::getNonConstFaceCent ( const amrex::EBFArrayBoxFactory &  ebfact)
inlineprivate

Return mutable face-centroid arrays from an AMReX factory.

259  {
260  auto fcent_const = ebfact.getFaceCent();
261  amrex::Array<amrex::MultiCutFab*, AMREX_SPACEDIM> fcent;
262  for (int dir = 0; dir < AMREX_SPACEDIM; ++dir) {
263  fcent[dir] = const_cast<amrex::MultiCutFab*>(fcent_const[dir]);
264  }
265  return fcent;
266  }

◆ getNonConstVolFrac()

amrex::MultiFab& eb_::getNonConstVolFrac ( const amrex::EBFArrayBoxFactory &  ebfact)
inlineprivate

Return mutable volume fractions from an AMReX factory.

231  {
232  const amrex::MultiFab& vfrac_const = ebfact.getVolFrac();
233  return const_cast<amrex::MultiFab&>(vfrac_const);
234  }

Referenced by mask_fc_from_cc().

Here is the caller graph for this function:

◆ make_all_factories()

void eb_::make_all_factories ( int  level,
amrex::Geometry const &  a_geom,
amrex::BoxArray const &  ba,
amrex::DistributionMapping const &  dm,
amrex::EB2::Level const &  a_eb_level 
)

Build cell-centered and staggered EB factories for the level.

Parameters
levelAMR level index.
a_geomGeometry for the level.
baBoxArray over which factories are defined.
dmDistributionMapping for the BoxArray.
a_eb_levelAMReX EB level used to populate factory data.
72 {
73 #if USE_FC_FACTORY
74  for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
75  if (!a_eb_level.hasFCData(idim)) {
76  Abort("ERF: native face-centered EB data are unavailable at level " +
77  std::to_string(level) + ", direction " + std::to_string(idim) +
78  ". EB2::BuildFC() must successfully build data before factory construction.");
79  }
80  }
81 #endif
82 
83  Print() << "making EB factory\n";
84  m_factory = std::make_unique<EBFArrayBoxFactory>(a_eb_level, a_geom, ba, dm,
86 
87  // Correct cell connectivity
89 
90 #if USE_FC_FACTORY
91  // Native AMReX FC factories (EB2::BuildFC called in initializeEB).
92  { int const idim(0);
93  Print() << "making EB staggered u-factory\n";
94  m_u_factory_fc = std::make_unique<EBFArrayBoxFactory>(
95  a_eb_level, a_geom, ba, dm,
96  Vector<int>{nghost_basic(), nghost_volume(), nghost_full()},
97  m_support_level, idim);
98  eb_::mask_fc_from_cc(m_u_factory_fc.get(), m_factory.get(), idim);
100  }
101 
102  { int const idim(1);
103  Print() << "making EB staggered v-factory\n";
104  m_v_factory_fc = std::make_unique<EBFArrayBoxFactory>(
105  a_eb_level, a_geom, ba, dm,
106  Vector<int>{nghost_basic(), nghost_volume(), nghost_full()},
107  m_support_level, idim);
108  eb_::mask_fc_from_cc(m_v_factory_fc.get(), m_factory.get(), idim);
110  }
111 
112  { int const idim(2);
113  Print() << "making EB staggered w-factory\n";
114  m_w_factory_fc = std::make_unique<EBFArrayBoxFactory>(
115  a_eb_level, a_geom, ba, dm,
116  Vector<int>{nghost_basic(), nghost_volume(), nghost_full()},
117  m_support_level, idim);
118  eb_::mask_fc_from_cc(m_w_factory_fc.get(), m_factory.get(), idim);
120  }
121 #else
122  // Original: eb_aux_ factories
123  { int const idim(0);
124  Print() << "making EB staggered u-factory\n";
125  m_u_factory.define(level, idim, a_geom, ba, dm,
126  Vector<int>{nghost_basic(), nghost_volume(), nghost_full()},
127  m_factory.get());
128  }
129 
130  { int const idim(1);
131  Print() << "making EB staggered v-factory\n";
132  m_v_factory.define(level, idim, a_geom, ba, dm,
133  Vector<int>{nghost_basic(), nghost_volume(), nghost_full()},
134  m_factory.get());
135  }
136 
137  { int const idim(2);
138  Print() << "making EB staggered w-factory\n";
139  m_w_factory.define(level, idim, a_geom, ba, dm,
140  Vector<int>{nghost_basic(), nghost_volume(), nghost_full()},
141  m_factory.get());
142  }
143 #endif
144 
145 #if USE_FC_FACTORY
146  build_cut_cell_lists(m_u_factory_fc->getMultiEBCellFlagFab(), m_u_cut_cells);
147  build_cut_cell_lists(m_v_factory_fc->getMultiEBCellFlagFab(), m_v_cut_cells);
148  build_cut_cell_lists(m_w_factory_fc->getMultiEBCellFlagFab(), m_w_cut_cells);
149 #else
153 #endif
154  Print() << "\nDone making EB factory at level = " << level << ".\n\n";
155 }
void build_cut_cell_lists(amrex::FabArray< amrex::EBCellFlagFab > const &flags, amrex::Vector< CutCellList > &cut_cells)
Definition: ERF_EB.cpp:179
void mask_fc_from_cc(amrex::EBFArrayBoxFactory *fc_factory, const amrex::EBFArrayBoxFactory *cc_factory, int idim)
Enforce FC-CC consistency by marking FC faces as covered when both CC neighbors are covered.
Definition: ERF_EB.cpp:260
eb_aux_ m_w_factory
Definition: ERF_EB.H:180
int nghost_volume() const
Number of ghost cells needed for EB volume data.
Definition: ERF_EB.H:92
eb_aux_ m_u_factory
Definition: ERF_EB.H:178
eb_aux_ m_v_factory
Definition: ERF_EB.H:179
int nghost_full() const
Number of ghost cells needed for full EB geometric data.
Definition: ERF_EB.H:94
int nghost_basic() const
Number of ghost cells needed for basic EB flags.
Definition: ERF_EB.H:90
void set_connection_flags(amrex::EBFArrayBoxFactory *factory)
Disconnect covered neighbors in an EB factory's cell flags.
Definition: ERF_EB.cpp:216
void define(int const &a_level, int const &a_idim, amrex::Geometry const &a_geom, amrex::BoxArray const &a_grids, amrex::DistributionMapping const &a_dmap, amrex::Vector< int > const &a_ngrow, amrex::EBFArrayBoxFactory const *a_factory)
Define face-centered EB geometry for one staggered direction.
Definition: ERF_EBAux.cpp:24
const amrex::FabArray< amrex::EBCellFlagFab > & getMultiEBCellFlagFab() const
Return the reconstructed EB cell flags.
Definition: ERF_EBAux.cpp:1146
Here is the call graph for this function:

◆ make_cc_factory()

void eb_::make_cc_factory ( int  level,
amrex::Geometry const &  a_geom,
amrex::BoxArray const &  ba,
amrex::DistributionMapping const &  dm,
amrex::EB2::Level const &  a_eb_level 
)

Build only the cell-centered EB factory for the level.

Parameters
levelAMR level index.
a_geomGeometry for the level.
baBoxArray over which the factory is defined.
dmDistributionMapping for the BoxArray.
a_eb_levelAMReX EB level used to populate factory data.
163 {
164  Print() << "making EB factory\n";
165  m_factory = std::make_unique<EBFArrayBoxFactory>(a_eb_level, a_geom, ba, dm,
166  Vector<int>{nghost_basic(), nghost_volume(), nghost_full()}, m_support_level);
167 
168  // Correct cell connectivity
170 
171  m_u_cut_cells.clear();
172  m_v_cut_cells.clear();
173  m_w_cut_cells.clear();
174 
175  Print() << "\nDone making EB factory at level " << level << ".\n\n";
176 }
Here is the call graph for this function:

◆ make_terrain()

void eb_::make_terrain ( amrex::Geometry const &  a_geom)
private

Build terrain EB geometry for the supplied Geometry.

Parameters
a_geomGeometry used to define the EB index space.

◆ mask_fc_from_cc()

void eb_::mask_fc_from_cc ( amrex::EBFArrayBoxFactory *  fc_factory,
const amrex::EBFArrayBoxFactory *  cc_factory,
int  idim 
)

Enforce FC-CC consistency by marking FC faces as covered when both CC neighbors are covered.

Mask FC faces as covered when both neighboring CC cells are covered.

Parameters
fc_factoryFace-centered factory to modify (non-const)
cc_factoryCell-centered factory to read neighbor states (const)
idimDirection of face centering (0=x, 1=y, 2=z)

For each face in the FC factory, if BOTH neighboring cell-centered cells are marked as covered, this function sets the FC face's volume fraction to zero and marks it as covered. This maintains consistency between CC and FC EB representations.

263 {
264 
265  FabArray<EBCellFlagFab>& fc_cellflag = getNonConstEBCellFlags(*fc_factory);
266  MultiFab& fc_volfrac = getNonConstVolFrac(*fc_factory);
267  const FabArray<EBCellFlagFab>& cc_cellflag = cc_factory->getMultiEBCellFlagFab();
268 
269  for (MFIter mfi(fc_cellflag, false); mfi.isValid(); ++mfi) {
270  const Box face_box = mfi.nodaltilebox(idim);
271  const Box gbx = amrex::grow(face_box, fc_cellflag.nGrow()-1);
272 
273  Array4<EBCellFlag> const& fc_flag = fc_cellflag.array(mfi);
274  Array4<Real> const& fc_vfrac = fc_volfrac.array(mfi);
275  Array4<EBCellFlag const> const& cc_flag = cc_cellflag.const_array(mfi);
276 
277  if (idim == 0) {
278  ParallelFor(gbx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
279  if (cc_flag(i-1,j,k).isCovered() && cc_flag(i,j,k).isCovered()) {
280  fc_vfrac(i,j,k) = Real(0.0);
281  fc_flag(i,j,k).setCovered();
282  }
283  });
284  } else if (idim == 1) {
285  ParallelFor(gbx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
286  if (cc_flag(i,j-1,k).isCovered() && cc_flag(i,j,k).isCovered()) {
287  fc_vfrac(i,j,k) = Real(0.0);
288  fc_flag(i,j,k).setCovered();
289  }
290  });
291  } else if (idim == 2) {
292  ParallelFor(gbx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
293  if (cc_flag(i,j,k-1).isCovered() && cc_flag(i,j,k).isCovered()) {
294  fc_vfrac(i,j,k) = Real(0.0);
295  fc_flag(i,j,k).setCovered();
296  }
297  });
298  }
299  }
300 }
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
amrex::FabArray< amrex::EBCellFlagFab > & getNonConstEBCellFlags(const amrex::EBFArrayBoxFactory &ebfact)
Return mutable EB cell flags from an AMReX factory.
Definition: ERF_EB.H:222
amrex::MultiFab & getNonConstVolFrac(const amrex::EBFArrayBoxFactory &ebfact)
Return mutable volume fractions from an AMReX factory.
Definition: ERF_EB.H:230

Referenced by make_all_factories().

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

◆ nghost_basic()

int eb_::nghost_basic ( ) const
inline

Number of ghost cells needed for basic EB flags.

90 { return 5; } // nghost_eb_basic ()

Referenced by make_all_factories(), and make_cc_factory().

Here is the caller graph for this function:

◆ nghost_full()

int eb_::nghost_full ( ) const
inline

Number of ghost cells needed for full EB geometric data.

94 { return 4; } // nghost_eb_full ()

Referenced by make_all_factories(), and make_cc_factory().

Here is the caller graph for this function:

◆ nghost_volume()

int eb_::nghost_volume ( ) const
inline

Number of ghost cells needed for EB volume data.

92 { return 5; } // nghost_eb_volume ()

Referenced by make_all_factories(), and make_cc_factory().

Here is the caller graph for this function:

◆ set_connection_flags()

void eb_::set_connection_flags ( amrex::EBFArrayBoxFactory *  factory)

Disconnect covered neighbors in an EB factory's cell flags.

Reset cell flags to disconnect cells with zero volume fraction.

Parameters
factoryFactory whose non-const flag data are updated.

The factory EBCellFlagFab data are updated through a non-const reference.

217 {
218  // Get non-const reference to EBCellFlagFab FabArray
219  FabArray<EBCellFlagFab>& cellflag = getNonConstEBCellFlags(*factory);
220 
221  const MultiFab& volfrac = factory->getVolFrac();
222 
223  for (MFIter mfi(cellflag, false); mfi.isValid(); ++mfi) {
224  const Box& bx = mfi.validbox();
225  const Box gbx = amrex::grow(bx, cellflag.nGrow()-1); // Leave one cell layer
226 
227  Array4<EBCellFlag> const& flag = cellflag.array(mfi);
228  Array4<Real const> const& vfrac = volfrac.const_array(mfi);
229 
230  ParallelFor(gbx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
231  {
232  for(int kk(-1); kk<=1; kk++) {
233  for(int jj(-1); jj<=1; jj++) {
234  for(int ii(-1); ii<=1; ii++)
235  {
236  if (vfrac(i+ii,j+jj,k+kk) == zero) {
237  flag(i,j,k).setDisconnected(ii,jj,kk);
238  }
239  }}}
240  });
241 
242  ParallelFor(gbx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
243  {
244  if (vfrac(i,j,k)==zero) {
245  flag(i,j,k).setCovered();
246  }
247  });
248 
249  }
250 }
constexpr amrex::Real zero
Definition: ERF_NumericalConstants.H:36

Referenced by make_all_factories(), and make_cc_factory().

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

Member Data Documentation

◆ m_cellflags

amrex::FabArray<amrex::EBCellFlagFab>* eb_::m_cellflags = nullptr
private

◆ m_eb_level

amrex::EB2::Level const* eb_::m_eb_level
private

EB level constructed from building GeometryShop.

Referenced by build_level().

◆ m_factory

std::unique_ptr<amrex::EBFArrayBoxFactory> eb_::m_factory = nullptr
private

◆ m_has_eb

int eb_::m_has_eb
private

◆ m_support_level

amrex::EBSupport eb_::m_support_level
private

◆ m_type

std::string eb_::m_type
private

◆ m_u_cut_cells

amrex::Vector<CutCellList> eb_::m_u_cut_cells
private

◆ m_u_factory

eb_aux_ eb_::m_u_factory
private

Referenced by make_all_factories().

◆ m_u_factory_fc

std::unique_ptr<amrex::EBFArrayBoxFactory> eb_::m_u_factory_fc = nullptr
private

◆ m_v_cut_cells

amrex::Vector<CutCellList> eb_::m_v_cut_cells
private

◆ m_v_factory

eb_aux_ eb_::m_v_factory
private

Referenced by make_all_factories().

◆ m_v_factory_fc

std::unique_ptr<amrex::EBFArrayBoxFactory> eb_::m_v_factory_fc = nullptr
private

◆ m_w_cut_cells

amrex::Vector<CutCellList> eb_::m_w_cut_cells
private

◆ m_w_factory

eb_aux_ eb_::m_w_factory
private

Referenced by make_all_factories().

◆ m_w_factory_fc

std::unique_ptr<amrex::EBFArrayBoxFactory> eb_::m_w_factory_fc = nullptr
private

◆ m_write_eb_surface

int eb_::m_write_eb_surface
private

The documentation for this class was generated from the following files: