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_ ()
 Construct an empty EB 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, bool cover_zero_area_faces=false)
 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...
 
void clear_factories ()
 Release the factories and cut-face lists built for the level's grids, as for a level that no longer exists. The object itself is kept: other objects hold pointers to it, and the factories are built again when the level is made again. 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, bool cover_zero_area_faces)
 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.

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

◆ eb_()

eb_::eb_ ( )

Construct an empty EB factory manager.

62  : m_has_eb(0),
63  m_support_level(EBSupport::full),
65 { }
amrex::EBSupport m_support_level
Definition: ERF_EB.H:154
int m_has_eb
Definition: ERF_EB.H:147
int m_write_eb_surface
Definition: ERF_EB.H:156

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
204 {
205  BL_PROFILE("eb_::build_cut_cell_lists()");
206 
207  cut_cells.clear();
208  cut_cells.resize(flags.boxArray().size());
209 
210 #ifdef AMREX_USE_GPU
211  for (MFIter mfi(flags, false); mfi.isValid(); ++mfi) {
212  Box const& bx = mfi.validbox();
213  if (flags[mfi].getType(bx) != FabType::singlevalued) {
214  continue;
215  }
216 
217  Array4<EBCellFlag const> const& flag = flags.const_array(mfi);
218  Long const num_candidates = bx.numPts();
219  CutCellList grid_cut_cells(num_candidates);
220  Dim3* const grid_cut_cells_ptr = grid_cut_cells.data();
221 
222  int const num_cut_cells = fill_cut_cell_list(bx, flag, grid_cut_cells_ptr);
223 
224  grid_cut_cells.resize(num_cut_cells);
225  grid_cut_cells.shrink_to_fit();
226  cut_cells[mfi.index()] = std::move(grid_cut_cells);
227  }
228 #else
229  amrex::ignore_unused(flags);
230 #endif
231 }
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.
199  {
200  int const req_lev(0);
201  int const max_lev(2);
202 
203  amrex::EB2::Build(a_gshop, a_geom, req_lev, max_lev);
204  const amrex::EB2::IndexSpace& ebis = amrex::EB2::IndexSpace::top();
205  m_eb_level = &(ebis.getLevel(a_geom));
206  }
amrex::EB2::Level const * m_eb_level
EB level constructed from building GeometryShop.
Definition: ERF_EB.H:161

◆ clear_factories()

void eb_::clear_factories ( )

Release the factories and cut-face lists built for the level's grids, as for a level that no longer exists. The object itself is kept: other objects hold pointers to it, and the factories are built again when the level is made again.

164 {
165  m_factory.reset();
166 #if USE_FC_FACTORY
167  m_u_factory_fc.reset();
168  m_v_factory_fc.reset();
169  m_w_factory_fc.reset();
170 #else
171  m_u_factory.clear();
172  m_v_factory.clear();
173  m_w_factory.clear();
174 #endif
175  m_u_cut_cells.clear();
176  m_v_cut_cells.clear();
177  m_w_cut_cells.clear();
178 }
amrex::Vector< CutCellList > m_w_cut_cells
Definition: ERF_EB.H:178
amrex::Vector< CutCellList > m_v_cut_cells
Definition: ERF_EB.H:177
amrex::Vector< CutCellList > m_u_cut_cells
Definition: ERF_EB.H:176
eb_aux_ m_w_factory
Definition: ERF_EB.H:168
std::unique_ptr< amrex::EBFArrayBoxFactory > m_factory
Definition: ERF_EB.H:163
eb_aux_ m_u_factory
Definition: ERF_EB.H:166
std::unique_ptr< amrex::EBFArrayBoxFactory > m_w_factory_fc
Definition: ERF_EB.H:173
eb_aux_ m_v_factory
Definition: ERF_EB.H:167
std::unique_ptr< amrex::EBFArrayBoxFactory > m_v_factory_fc
Definition: ERF_EB.H:172
std::unique_ptr< amrex::EBFArrayBoxFactory > m_u_factory_fc
Definition: ERF_EB.H:171
void clear()
Release the geometry of the last define(), as for a level that no longer exists.
Definition: ERF_EBAux.cpp:1146
Here is the call graph for this function:

◆ get_const_factory()

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

Return the cell-centered EB factory.

110 { return m_factory; }

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.

132 { return m_u_factory_fc.get(); }

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.

93  {
94  return m_u_cut_cells[grid_index];
95  }

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.

134 { return m_v_factory_fc.get(); }

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.

99  {
100  return m_v_cut_cells[grid_index];
101  }

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.

136 { return m_w_factory_fc.get(); }

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.

105  {
106  return m_w_cut_cells[grid_index];
107  }

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.

235  {
236  auto afrac_const = ebfact.getAreaFrac();
237  amrex::Array<amrex::MultiCutFab*, AMREX_SPACEDIM> afrac;
238  for (int dir = 0; dir < AMREX_SPACEDIM; ++dir) {
239  afrac[dir] = const_cast<amrex::MultiCutFab*>(afrac_const[dir]);
240  }
241  return afrac;
242  }

◆ getNonConstCentroid()

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

Return mutable cell centroids from an AMReX factory.

227  {
228  const amrex::MultiCutFab& vcent_const = ebfact.getCentroid();
229  return const_cast<amrex::MultiCutFab&>(vcent_const);
230  }

◆ getNonConstEBCellFlags()

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

Return mutable EB cell flags from an AMReX factory.

211  {
212  const amrex::FabArray<amrex::EBCellFlagFab>& flags_const = ebfact.getMultiEBCellFlagFab();
213  return const_cast<amrex::FabArray<amrex::EBCellFlagFab>&>(flags_const);
214  }

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.

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

◆ getNonConstVolFrac()

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

Return mutable volume fractions from an AMReX factory.

219  {
220  const amrex::MultiFab& vfrac_const = ebfact.getVolFrac();
221  return const_cast<amrex::MultiFab&>(vfrac_const);
222  }

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,
bool  cover_zero_area_faces = false 
)

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.
cover_zero_area_facesCover FC faces with zero CC area fraction.
74 {
75 #if USE_FC_FACTORY
76  for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
77  if (!a_eb_level.hasFCData(idim)) {
78  Abort("ERF: native face-centered EB data are unavailable at level " +
79  std::to_string(level) + ", direction " + std::to_string(idim) +
80  ". EB2::BuildFC() must successfully build data before factory construction.");
81  }
82  }
83 #endif
84 
85  Print() << "making EB factory\n";
86  m_factory = std::make_unique<EBFArrayBoxFactory>(a_eb_level, a_geom, ba, dm,
88 
89  // Correct cell connectivity
91 
92 #if USE_FC_FACTORY
93  if (cover_zero_area_faces) {
94  Print() << "covering staggered EB cells at faces with zero area fraction\n";
95  }
96  // Native AMReX FC factories (EB2::BuildFC called in initializeEB).
97  { int const idim(0);
98  Print() << "making EB staggered u-factory\n";
99  m_u_factory_fc = std::make_unique<EBFArrayBoxFactory>(
100  a_eb_level, a_geom, ba, dm,
101  Vector<int>{nghost_basic(), nghost_volume(), nghost_full()},
102  m_support_level, idim);
103  eb_::mask_fc_from_cc(m_u_factory_fc.get(), m_factory.get(), idim, cover_zero_area_faces);
105  }
106 
107  { int const idim(1);
108  Print() << "making EB staggered v-factory\n";
109  m_v_factory_fc = std::make_unique<EBFArrayBoxFactory>(
110  a_eb_level, a_geom, ba, dm,
111  Vector<int>{nghost_basic(), nghost_volume(), nghost_full()},
112  m_support_level, idim);
113  eb_::mask_fc_from_cc(m_v_factory_fc.get(), m_factory.get(), idim, cover_zero_area_faces);
115  }
116 
117  { int const idim(2);
118  Print() << "making EB staggered w-factory\n";
119  m_w_factory_fc = std::make_unique<EBFArrayBoxFactory>(
120  a_eb_level, a_geom, ba, dm,
121  Vector<int>{nghost_basic(), nghost_volume(), nghost_full()},
122  m_support_level, idim);
123  eb_::mask_fc_from_cc(m_w_factory_fc.get(), m_factory.get(), idim, cover_zero_area_faces);
125  }
126 #else
127  // Original: eb_aux_ factories
128  { int const idim(0);
129  Print() << "making EB staggered u-factory\n";
130  m_u_factory.define(level, idim, a_geom, ba, dm,
131  Vector<int>{nghost_basic(), nghost_volume(), nghost_full()},
132  m_factory.get());
133  }
134 
135  { int const idim(1);
136  Print() << "making EB staggered v-factory\n";
137  m_v_factory.define(level, idim, a_geom, ba, dm,
138  Vector<int>{nghost_basic(), nghost_volume(), nghost_full()},
139  m_factory.get());
140  }
141 
142  { int const idim(2);
143  Print() << "making EB staggered w-factory\n";
144  m_w_factory.define(level, idim, a_geom, ba, dm,
145  Vector<int>{nghost_basic(), nghost_volume(), nghost_full()},
146  m_factory.get());
147  }
148 #endif
149 
150 #if USE_FC_FACTORY
151  build_cut_cell_lists(m_u_factory_fc->getMultiEBCellFlagFab(), m_u_cut_cells);
152  build_cut_cell_lists(m_v_factory_fc->getMultiEBCellFlagFab(), m_v_cut_cells);
153  build_cut_cell_lists(m_w_factory_fc->getMultiEBCellFlagFab(), m_w_cut_cells);
154 #else
158 #endif
159  Print() << "\nDone making EB factory at level = " << level << ".\n\n";
160 }
void mask_fc_from_cc(amrex::EBFArrayBoxFactory *fc_factory, const amrex::EBFArrayBoxFactory *cc_factory, int idim, bool cover_zero_area_faces)
Enforce FC-CC consistency by marking FC faces as covered when both CC neighbors are covered.
Definition: ERF_EB.cpp:284
void build_cut_cell_lists(amrex::FabArray< amrex::EBCellFlagFab > const &flags, amrex::Vector< CutCellList > &cut_cells)
Definition: ERF_EB.cpp:202
int nghost_volume() const
Number of ghost cells needed for EB volume data.
Definition: ERF_EB.H:78
int nghost_full() const
Number of ghost cells needed for full EB geometric data.
Definition: ERF_EB.H:80
int nghost_basic() const
Number of ghost cells needed for basic EB flags.
Definition: ERF_EB.H:76
void set_connection_flags(amrex::EBFArrayBoxFactory *factory)
Disconnect covered neighbors in an EB factory's cell flags.
Definition: ERF_EB.cpp:239
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:1161
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.
186 {
187  Print() << "making EB factory\n";
188  m_factory = std::make_unique<EBFArrayBoxFactory>(a_eb_level, a_geom, ba, dm,
189  Vector<int>{nghost_basic(), nghost_volume(), nghost_full()}, m_support_level);
190 
191  // Correct cell connectivity
193 
194  m_u_cut_cells.clear();
195  m_v_cut_cells.clear();
196  m_w_cut_cells.clear();
197 
198  Print() << "\nDone making EB factory at level " << level << ".\n\n";
199 }
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,
bool  cover_zero_area_faces 
)

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)
cover_zero_area_facesAlso cover faces with zero CC area fraction

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. If cover_zero_area_faces, faces with zero CC area fraction are covered too.

288 {
289 
290  FabArray<EBCellFlagFab>& fc_cellflag = getNonConstEBCellFlags(*fc_factory);
291  MultiFab& fc_volfrac = getNonConstVolFrac(*fc_factory);
292  const FabArray<EBCellFlagFab>& cc_cellflag = cc_factory->getMultiEBCellFlagFab();
293  const auto cc_afrac = cc_factory->getAreaFrac();
294 
295  for (MFIter mfi(fc_cellflag, false); mfi.isValid(); ++mfi) {
296  const Box face_box = mfi.nodaltilebox(idim);
297  const Box gbx = amrex::grow(face_box, fc_cellflag.nGrow()-1);
298 
299  Array4<EBCellFlag> const& fc_flag = fc_cellflag.array(mfi);
300  Array4<Real> const& fc_vfrac = fc_volfrac.array(mfi);
301  Array4<EBCellFlag const> const& cc_flag = cc_cellflag.const_array(mfi);
302 
303  if (cover_zero_area_faces && cc_cellflag[mfi].getType() == FabType::singlevalued) {
304  Array4<Real const> const& ap = cc_afrac[idim]->const_array(mfi);
305  const Box abx = gbx & (*cc_afrac[idim])[mfi].box();
306  ParallelFor(abx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
307  if (ap(i,j,k) == Real(0.0)) {
308  fc_vfrac(i,j,k) = Real(0.0);
309  fc_flag(i,j,k).setCovered();
310  }
311  });
312  }
313 
314  if (idim == 0) {
315  ParallelFor(gbx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
316  if (cc_flag(i-1,j,k).isCovered() && cc_flag(i,j,k).isCovered()) {
317  fc_vfrac(i,j,k) = Real(0.0);
318  fc_flag(i,j,k).setCovered();
319  }
320  });
321  } else if (idim == 1) {
322  ParallelFor(gbx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
323  if (cc_flag(i,j-1,k).isCovered() && cc_flag(i,j,k).isCovered()) {
324  fc_vfrac(i,j,k) = Real(0.0);
325  fc_flag(i,j,k).setCovered();
326  }
327  });
328  } else if (idim == 2) {
329  ParallelFor(gbx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept {
330  if (cc_flag(i,j,k-1).isCovered() && cc_flag(i,j,k).isCovered()) {
331  fc_vfrac(i,j,k) = Real(0.0);
332  fc_flag(i,j,k).setCovered();
333  }
334  });
335  }
336  }
337 }
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::FabArray< amrex::EBCellFlagFab > & getNonConstEBCellFlags(const amrex::EBFArrayBoxFactory &ebfact)
Return mutable EB cell flags from an AMReX factory.
Definition: ERF_EB.H:210
amrex::MultiFab & getNonConstVolFrac(const amrex::EBFArrayBoxFactory &ebfact)
Return mutable volume fractions from an AMReX factory.
Definition: ERF_EB.H:218

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.

76 { 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.

80 { 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.

78 { 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.

240 {
241  // Get non-const reference to EBCellFlagFab FabArray
242  FabArray<EBCellFlagFab>& cellflag = getNonConstEBCellFlags(*factory);
243 
244  const MultiFab& volfrac = factory->getVolFrac();
245 
246  for (MFIter mfi(cellflag, false); mfi.isValid(); ++mfi) {
247  const Box& bx = mfi.validbox();
248  const Box gbx = amrex::grow(bx, cellflag.nGrow()-1); // Leave one cell layer
249 
250  Array4<EBCellFlag> const& flag = cellflag.array(mfi);
251  Array4<Real const> const& vfrac = volfrac.const_array(mfi);
252 
253  ParallelFor(gbx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
254  {
255  for(int kk(-1); kk<=1; kk++) {
256  for(int jj(-1); jj<=1; jj++) {
257  for(int ii(-1); ii<=1; ii++)
258  {
259  if (vfrac(i+ii,j+jj,k+kk) == zero) {
260  flag(i,j,k).setDisconnected(ii,jj,kk);
261  }
262  }}}
263  });
264 
265  ParallelFor(gbx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept
266  {
267  if (vfrac(i,j,k)==zero) {
268  flag(i,j,k).setCovered();
269  }
270  });
271 
272  }
273 }
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

◆ 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

◆ 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

◆ 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: