1 #ifndef AMREX_MLMGBNDRY_H_
2 #define AMREX_MLMGBNDRY_H_
3 #include <AMReX_Config.H>
31 LinOpBCType a_crse_fine_bc_type = LinOpBCType::Dirichlet);
36 LinOpBCType a_crse_fine_bc_type = LinOpBCType::Dirichlet);
42 const Real* dx,
IntVect const& ratio,
47 LinOpBCType a_crse_fine_bc_type);
50 template <
typename MF>
56 template <
typename MF>
61 LinOpBCType a_crse_fine_bc_type)
63 setLOBndryConds(lo, hi,
IntVect(ratio), a_loc, a_crse_fine_bc_type);
66 template <
typename MF>
71 LinOpBCType a_crse_fine_bc_type)
74 const Real* dx = this->geom.CellSize();
75 const Box& domain = this->geom.Domain();
78 AMREX_ASSERT(a_crse_fine_bc_type == LinOpBCType::Dirichlet ||
79 a_crse_fine_bc_type == LinOpBCType::Neumann);
87 const int i = fsi.index();
88 const Box& grd = ba[i];
92 for (
int icomp = 0; icomp < this->
nComp(); ++icomp) {
94 setBoxBC(bloc, bct, grd, domain, lo[icomp], hi[icomp], dx, ratio, a_loc,
97 is_periodic, a_crse_fine_bc_type);
98 for (
int idim = 0; idim < 2*AMREX_SPACEDIM; ++idim) {
99 bctag[idim][icomp] = bct[idim];
105 template <
typename MF>
108 const Box& bx,
const Box& domain,
111 const Real* dx,
IntVect const& ratio,
116 LinOpBCType a_crse_fine_bc_type)
118 using T =
typename MF::value_type;
125 if (domain[face] == bx[face] && !is_periodic[dir])
128 bloc[face] =
static_cast<T
>
129 (face.
isLow() ? domain_bloc_lo[dir] : domain_bloc_hi[dir]);
130 const auto linop_bc = face.
isLow() ? lo[dir] : hi[dir];
131 if (linop_bc == LinOpBCType::Dirichlet) {
133 }
else if (linop_bc == LinOpBCType::Neumann) {
135 }
else if (linop_bc == LinOpBCType::reflect_odd) {
138 amrex::Abort(
"MLMGBndry::setBoxBC: Unknown LinOpBCType");
144 bctag[face] =
static_cast<int>(a_crse_fine_bc_type);
145 bloc[face] =
static_cast<T
>(ratio[dir] > 0 ? Real(0.5)*
static_cast<Real
>(ratio[dir])*dx[dir]
146 : interior_bloc[dir]);
#define AMREX_ASSERT(EX)
Definition: AMReX_BLassert.H:38
#define AMREX_LO_NEUMANN
Definition: AMReX_LO_BCTYPES.H:6
#define AMREX_LO_DIRICHLET
Definition: AMReX_LO_BCTYPES.H:5
#define AMREX_LO_REFLECT_ODD
Definition: AMReX_LO_BCTYPES.H:7
#define AMREX_D_DECL(a, b, c)
Definition: AMReX_SPACE.H:104
Array< value_type, 2 *AMREX_SPACEDIM > RealTuple
Some useful typedefs.
Definition: AMReX_BndryData.H:82
A collection of Boxes stored in an Array.
Definition: AMReX_BoxArray.H:549
Calculates the distribution of FABs to MPI processes.
Definition: AMReX_DistributionMapping.H:41
Definition: AMReX_FabSet.H:149
Rectangular problem domain geometry.
Definition: AMReX_Geometry.H:73
An InterpBndryData object adds to a BndryData object the ability to manipulate and set the data store...
Definition: AMReX_InterpBndryData.H:40
bool isValid() const noexcept
Is the iterator valid i.e. is it associated with a FAB?
Definition: AMReX_MFIter.H:141
Definition: AMReX_MLMGBndry.H:12
Array< BoundCond, 2 *BL_SPACEDIM > BCTuple
Definition: AMReX_MLMGBndry.H:15
void setLOBndryConds(const Vector< Array< LinOpBCType, AMREX_SPACEDIM > > &lo, const Vector< Array< LinOpBCType, AMREX_SPACEDIM > > &hi, int ratio, const RealVect &a_loc, LinOpBCType a_crse_fine_bc_type=LinOpBCType::Dirichlet)
Definition: AMReX_MLMGBndry.H:58
static void setBoxBC(RealTuple &bloc, BCTuple &bctag, const Box &bx, const Box &domain, const Array< LinOpBCType, AMREX_SPACEDIM > &lo, const Array< LinOpBCType, AMREX_SPACEDIM > &hi, const Real *dx, IntVect const &ratio, const RealVect &interior_bloc, const Array< Real, AMREX_SPACEDIM > &domain_bloc_lo, const Array< Real, AMREX_SPACEDIM > &domain_bloc_hi, const GpuArray< int, AMREX_SPACEDIM > &is_periodic, LinOpBCType a_crse_fine_bc_type)
Definition: AMReX_MLMGBndry.H:107
MLMGBndryT(const MLMGBndryT< MF > &rhs)=delete
MLMGBndryT< MF > & operator=(const MLMGBndryT< MF > &rhs)=delete
MLMGBndryT(const BoxArray &_grids, const DistributionMapping &_dmap, int _ncomp, const Geometry &_geom)
Definition: AMReX_MLMGBndry.H:51
MLMGBndryT(MLMGBndryT< MF > &&rhs)=delete
An Iterator over the Orientation of Faces of a Box.
Definition: AMReX_Orientation.H:135
Encapsulation of the Orientation of the Faces of a Box.
Definition: AMReX_Orientation.H:29
AMREX_GPU_HOST_DEVICE int coordDir() const noexcept
Returns the coordinate direction.
Definition: AMReX_Orientation.H:83
AMREX_GPU_HOST_DEVICE bool isLow() const noexcept
Returns true if Orientation is low.
Definition: AMReX_Orientation.H:89
@ low
Definition: AMReX_Orientation.H:34
A Real vector in SpaceDim-dimensional space.
Definition: AMReX_RealVect.H:32
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition: AMReX_Vector.H:27
static int fi(amrex::Real t, N_Vector y_data, N_Vector y_rhs, void *user_data)
Definition: AMReX_SundialsIntegrator.H:49
Definition: AMReX_Amr.cpp:49
int nComp(FabArrayBase const &fa)
IntVectND< AMREX_SPACEDIM > IntVect
Definition: AMReX_BaseFwd.H:30
void Abort(const std::string &msg)
Print out message to cerr and exit via abort().
Definition: AMReX.cpp:225
std::array< T, N > Array
Definition: AMReX_Array.H:24
Definition: AMReX_Array.H:34