1#ifndef AMREX_ML_CELL_ABECLAP_H_
2#define AMREX_ML_CELL_ABECLAP_H_
3#include <AMReX_Config.H>
6#include <AMReX_MLCellABecLap_K.H>
25 using FAB =
typename MF::fab_type;
26 using RT =
typename MF::value_type;
107 amrex::Abort(
"MLCellABecLap::getFluxes: How did we get here?");
115 virtual MF
const*
getACoeffs (
int amrlev,
int mglev)
const = 0;
125 MF
const& sol,
bool mult_bcoef)
const final;
130#if defined(AMREX_USE_HYPRE) && (AMREX_SPACEDIM > 1)
135#if defined(AMREX_USE_PETSC) && (AMREX_SPACEDIM > 1)
137 [[nodiscard]] std::unique_ptr<PETScABecLap> makePETSc ()
const override;
148template <
typename MF>
158 this->m_overset_mask.resize(this->m_num_amr_levels);
159 for (
int amrlev = 0; amrlev < this->m_num_amr_levels; ++amrlev) {
160 this->m_overset_mask[amrlev].resize(this->m_num_mg_levels[amrlev]);
164template <
typename MF>
177 this->m_lpinfo_arg = a_info;
179 auto namrlevs =
static_cast<int>(a_geom.
size());
180 this->m_overset_mask.resize(namrlevs);
181 for (
int amrlev = 0; amrlev < namrlevs; ++amrlev)
183 this->m_overset_mask[amrlev].push_back(std::make_unique<iMultiFab>(a_grids[amrlev],
184 a_dmap[amrlev], 1, 1));
185 iMultiFab::Copy(*(this->m_overset_mask[amrlev][0]), *a_overset_mask[amrlev], 0, 0, 1, 0);
188 == a_geom[amrlev].Domain());
193 Box dom = a_geom[0].Domain();
197 iMultiFab const&
fine = *(this->m_overset_mask[amrlev][mglev-1]);
201 fine.DistributionMap(), 1, 1);
204 using ReduceTuple =
typename decltype(reduce_data)::Type;
206#pragma omp parallel if (Gpu::notInLaunchRegion())
210 const Box& bx = mfi.tilebox();
213 reduce_op.
eval(bx, reduce_data,
216 return { coarsen_overset_mask(b, cmsk, fmsk) };
219 ReduceTuple hv = reduce_data.
value(reduce_op);
220 if (amrex::get<0>(hv) == 0) {
221 this->m_overset_mask[amrlev].push_back(std::move(
crse));
229 int max_overset_mask_coarsening_level = this->m_overset_mask[amrlev].size()-1;
231 this->m_overset_mask[amrlev].resize(max_overset_mask_coarsening_level+1);
235 max_overset_mask_coarsening_level);
240 for (
int mglev = 1; mglev < this->m_num_mg_levels[amrlev]; ++mglev) {
241 MF foo(this->m_grids[amrlev][mglev], this->m_dmap[amrlev][mglev], 1, 0,
MFInfo().SetAlloc(
false));
243 auto osm = std::make_unique<iMultiFab>(this->m_grids[amrlev][mglev],
244 this->m_dmap[amrlev][mglev], 1, 1);
245 osm->ParallelCopy(*(this->m_overset_mask[amrlev][mglev]));
246 std::swap(osm, this->m_overset_mask[amrlev][mglev]);
250 for (amrlev = 1; amrlev < this->m_num_amr_levels; ++amrlev) {
251 for (
int mglev = 1; mglev < this->m_num_mg_levels[amrlev]; ++mglev) {
252 this->m_overset_mask[amrlev].push_back(std::make_unique<iMultiFab>(this->m_grids[amrlev][mglev],
253 this->m_dmap[amrlev][mglev],
258 auto const& crsema = this->m_overset_mask[amrlev][mglev]->arrays();
259 auto const& finema = this->m_overset_mask[amrlev][mglev-1]->const_arrays();
260 ParallelFor(*(this->m_overset_mask[amrlev][mglev]),
263 coarsen_overset_mask(i,j,k, crsema[box_no], finema[box_no]);
272#pragma omp parallel if (Gpu::notInLaunchRegion())
276 const Box& bx = mfi.tilebox();
277 Array4<int> const& cmsk = this->m_overset_mask[amrlev][mglev]->array(mfi);
278 Array4<int const> const fmsk = this->m_overset_mask[amrlev][mglev-1]->const_array(mfi);
281 coarsen_overset_mask(i,j,k, cmsk, fmsk);
288 for (amrlev = 0; amrlev < this->m_num_amr_levels; ++amrlev) {
289 for (
int mglev = 0; mglev < this->m_num_mg_levels[amrlev]; ++mglev) {
290 this->m_overset_mask[amrlev][mglev]->setBndry(1);
291 this->m_overset_mask[amrlev][mglev]->FillBoundary(this->m_geom[amrlev][mglev].periodicity());
296template <
typename MF>
303template <
typename MF>
310template <
typename MF>
314 auto const* omask = this->getOversetMask(amrlev, mglev);
316 const int ncomp = this->getNComp();
317 auto const& mskma = omask->const_arrays();
318 auto const& ma = mf.arrays();
322 if (mskma[bno](i,j,k) == 0) { ma[bno](i,j,k,n) =
RT(0.0); }
330template <
typename MF>
338 const int ncomp = this->getNComp();
339 const RT betainv =
RT(1.0) / getBScalar();
340 const int nlevs = this->NAMRLevels();
341 for (
int alev = 0; alev < nlevs; ++alev) {
342 this->compFlux(alev, a_flux[alev], *a_sol[alev], a_loc);
343 for (
int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
344 if (betainv !=
RT(1.0)) {
345 a_flux[alev][idim]->mult(betainv, 0, ncomp);
348 this->addInhomogNeumannFlux(alev, a_flux[alev], *a_sol[alev],
true);
349 for (
int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
350 this->unapplyMetricTerm(alev, 0, *a_flux[alev][idim]);
355template <
typename MF>
359 bool has_inhomog_neumann = this->hasInhomogNeumannBC();
360 bool has_robin = this->hasRobinBC();
362 if (!has_inhomog_neumann && !has_robin) {
return; }
364 int ncomp = this->getNComp();
367 const auto problo = this->m_geom[amrlev][mglev].ProbLoArray();
368 const auto probhi = this->m_geom[amrlev][mglev].ProbHiArray();
370 const RT dxi =
static_cast<RT>(this->m_geom[amrlev][mglev].InvCellSize(0));
371 const RT dyi =
static_cast<RT>((AMREX_SPACEDIM >= 2) ? this->m_geom[amrlev][mglev].InvCellSize(1) :
Real(1.0));
372 const RT dzi =
static_cast<RT>((AMREX_SPACEDIM == 3) ? this->m_geom[amrlev][mglev].InvCellSize(2) :
Real(1.0));
373 const RT xlo =
static_cast<RT>(problo[0]);
374 const RT dx =
static_cast<RT>(this->m_geom[amrlev][mglev].CellSize(0));
375 const Box& domain = this->m_geom[amrlev][mglev].Domain();
377 const RT beta = getBScalar();
380 bool has_bcoef = (bcoef[0] !=
nullptr);
382 const auto& maskvals = this->m_maskvals[amrlev][mglev];
383 const auto& bcondloc = *(this->m_bcondloc[amrlev][mglev]);
384 const auto& bndry = *(this->m_bndry_sol[amrlev]);
390#pragma omp parallel if (Gpu::notInLaunchRegion())
394 const Box& vbx = mfi.validbox();
395 auto const& rhsfab = rhs.array(mfi);
397 const auto & bdlv = bcondloc.bndryLocs(mfi);
398 const auto & bdcv = bcondloc.bndryConds(mfi);
400 for (
int idim = 0; idim < AMREX_SPACEDIM; ++idim)
402 auto const bfab = (has_bcoef)
403 ? bcoef[idim]->const_array(mfi) : foo.const_array();
408 const auto& mlo = maskvals[olo].array(mfi);
409 const auto& mhi = maskvals[ohi].array(mfi);
410 const auto& bvlo = bndry.bndryValues(olo).array(mfi);
411 const auto& bvhi = bndry.bndryValues(ohi).array(mfi);
412 bool outside_domain_lo = !(domain.
contains(blo));
413 bool outside_domain_hi = !(domain.
contains(bhi));
414 if ((!outside_domain_lo) && (!outside_domain_hi)) {
continue; }
415 for (
int icomp = 0; icomp < ncomp; ++icomp) {
416 const BoundCond bctlo = bdcv[icomp][olo];
417 const BoundCond bcthi = bdcv[icomp][ohi];
418 const RT bcllo = bdlv[icomp][olo];
419 const RT bclhi = bdlv[icomp][ohi];
424 if (this->m_has_metric_term && !has_bcoef) {
425#if (AMREX_SPACEDIM == 1)
426 fac *=
static_cast<RT>(problo[0]*problo[0]);
427#elif (AMREX_SPACEDIM == 2)
428 fac *=
static_cast<RT>(problo[0]);
433 mllinop_apply_innu_xlo(i,j,k, rhsfab, mlo, bfab,
435 fac, has_bcoef, icomp);
437 }
else if (idim == 1) {
439 if (this->m_has_metric_term && !has_bcoef) {
442 mllinop_apply_innu_ylo_m(i,j,k, rhsfab, mlo,
444 fac, xlo, dx, icomp);
450 mllinop_apply_innu_ylo(i,j,k, rhsfab, mlo, bfab,
452 fac, has_bcoef, icomp);
459 mllinop_apply_innu_zlo(i,j,k, rhsfab, mlo, bfab,
461 fac, has_bcoef, icomp);
469 if (this->m_has_metric_term && !has_bcoef) {
470#if (AMREX_SPACEDIM == 1)
471 fac *=
static_cast<RT>(probhi[0]*probhi[0]);
472#elif (AMREX_SPACEDIM == 2)
473 fac *=
static_cast<RT>(probhi[0]);
478 mllinop_apply_innu_xhi(i,j,k, rhsfab, mhi, bfab,
480 fac, has_bcoef, icomp);
482 }
else if (idim == 1) {
484 if (this->m_has_metric_term && !has_bcoef) {
487 mllinop_apply_innu_yhi_m(i,j,k, rhsfab, mhi,
489 fac, xlo, dx, icomp);
494 mllinop_apply_innu_yhi(i,j,k, rhsfab, mhi, bfab,
496 fac, has_bcoef, icomp);
503 mllinop_apply_innu_zhi(i,j,k, rhsfab, mhi, bfab,
505 fac, has_bcoef, icomp);
513 auto const& rbc = (*this->m_robin_bcval[amrlev])[mfi].const_array(icomp*3);
517 RT fac = beta*dxi*dxi;
521 / (rbc(i,j,k,1)*dxi + rbc(i,j,k,0)*
RT(0.5));
522 rhsfab(i+1,j,k,icomp) += fac*bfab(i+1,j,k,icomp)*A;
524 }
else if (idim == 1) {
525 RT fac = beta*dyi*dyi;
529 / (rbc(i,j,k,1)*dyi + rbc(i,j,k,0)*
RT(0.5));
530 rhsfab(i,j+1,k,icomp) += fac*bfab(i,j+1,k,icomp)*A;
533 RT fac = beta*dzi*dzi;
537 / (rbc(i,j,k,1)*dzi + rbc(i,j,k,0)*
RT(0.5));
538 rhsfab(i,j,k+1,icomp) += fac*bfab(i,j,k+1,icomp)*A;
545 RT fac = beta*dxi*dxi;
549 / (rbc(i,j,k,1)*dxi + rbc(i,j,k,0)*
RT(0.5));
550 rhsfab(i-1,j,k,icomp) += fac*bfab(i,j,k,icomp)*A;
552 }
else if (idim == 1) {
553 RT fac = beta*dyi*dyi;
557 / (rbc(i,j,k,1)*dyi + rbc(i,j,k,0)*
RT(0.5));
558 rhsfab(i,j-1,k,icomp) += fac*bfab(i,j,k,icomp)*A;
561 RT fac = beta*dzi*dzi;
565 / (rbc(i,j,k,1)*dzi + rbc(i,j,k,0)*
RT(0.5));
566 rhsfab(i,j,k-1,icomp) += fac*bfab(i,j,k,icomp)*A;
577template <
typename MF>
581 bool mult_bcoef)
const
589 RT fac = mult_bcoef ?
RT(-1.0) :
RT(1.0);
591 bool has_inhomog_neumann = this->hasInhomogNeumannBC();
592 bool has_robin = this->hasRobinBC();
594 if (!has_inhomog_neumann && !has_robin) {
return; }
596 int ncomp = this->getNComp();
599 const auto dxinv = this->m_geom[amrlev][mglev].InvCellSize();
600 const Box domain = this->m_geom[amrlev][mglev].growPeriodicDomain(1);
604 bcoef = getBCoeffs(amrlev,mglev);
607 const auto& bndry = *this->m_bndry_sol[amrlev];
613#pragma omp parallel if (Gpu::notInLaunchRegion())
617 Box const& vbx = mfi.validbox();
623 const RT dxi =
static_cast<RT>(dxinv[idim]);
625 for (
int icomp = 0; icomp < ncomp; ++icomp) {
626 auto const& phi = sol.const_array(mfi,icomp);
627 auto const& bv = bndry.bndryValues(ori).multiFab().const_array(mfi,icomp);
628 auto const& bc = bcoef[idim] ? bcoef[idim]->const_array(mfi,icomp)
630 auto const& f = grad[idim]->array(mfi,icomp);
632 if (this->m_lobc_orig[icomp][idim] ==
639 RT b = bc ? bc(ii,jj,kk) :
RT(1.0);
640 f(ii,jj,kk) = fac*b*bv(i,j,k);
642 }
else if (this->m_lobc_orig[icomp][idim] ==
644 auto const& rbc = (*this->m_robin_bcval[amrlev])[mfi].const_array(icomp*3);
651 (rbc(i,j,k,1)*dxi + rbc(i,j,k,0)*
RT(0.5));
652 RT RA = rbc(i,j,k,2) * tmp;
653 RT RB = (rbc(i,j,k,1)*dxi - rbc(i,j,k,0)*
RT(0.5)) * tmp;
654 RT b = bc ? bc(ii,jj,kk) :
RT(1.0);
655 f(ii,jj,kk) = fac*b*dxi*((
RT(1.0)-RB)*phi(ii,jj,kk)-RA);
659 if (this->m_hibc_orig[icomp][idim] ==
663 RT b = bc ? bc(i,j,k) :
RT(1.0);
664 f(i,j,k) = fac*b*bv(i,j,k);
666 }
else if (this->m_hibc_orig[icomp][idim] ==
668 auto const& rbc = (*this->m_robin_bcval[amrlev])[mfi].const_array(icomp*3);
672 (rbc(i,j,k,1)*dxi + rbc(i,j,k,0)*
RT(0.5));
673 RT RA = rbc(i,j,k,2) * tmp;
674 RT RB = (rbc(i,j,k,1)*dxi - rbc(i,j,k,0)*
RT(0.5)) * tmp;
675 RT b = bc ? bc(i,j,k) :
RT(1.0);
676 f(i,j,k) = fac*b*dxi*(RA+(RB-
RT(1.0))*
677 phi(i-os.
x,j-os.
y,k-os.
z));
687template <
typename MF>
691 if (m_overset_mask[amrlev][0]) {
692 const int ncomp = this->getNComp();
695 auto const& osma = m_overset_mask[amrlev][0]->const_arrays();
696 auto const& rhsa = rhs.arrays();
700 if (osma[box_no](i,j,k) == 0) {
701 rhsa[box_no](i,j,k,n) =
RT(0.0);
711#pragma omp parallel if (Gpu::notInLaunchRegion())
715 const Box& bx = mfi.tilebox();
716 auto const& rfab = rhs.array(mfi);
717 auto const& osm = m_overset_mask[amrlev][0]->const_array(mfi);
720 if (osm(i,j,k) == 0) { rfab(i,j,k,n) =
RT(0.0); }
727#if defined(AMREX_USE_HYPRE) && (AMREX_SPACEDIM > 1)
728template <
typename MF>
729std::unique_ptr<Hypre>
732 if constexpr (!std::is_same<MF,MultiFab>()) {
733 amrex::Abort(
"MLCellABecLap Hypre interface only supports MultiFab");
735 const BoxArray& ba = this->m_grids[0].back();
736 const DistributionMapping& dm = this->m_dmap[0].back();
737 const Geometry& geom = this->m_geom[0].back();
738 const auto& factory = *(this->m_factory[0].back());
739 MPI_Comm comm = this->BottomCommunicator();
741 const int mglev = this->NMGLevels(0)-1;
743 auto om = getOversetMask(0, mglev);
745 auto hypre_solver =
amrex::makeHypre(ba, dm, geom, comm, hypre_interface, om);
747 hypre_solver->setScalars(getAScalar(), getBScalar());
749 auto ac = getACoeffs(0, mglev);
752 hypre_solver->setACoeffs(*ac);
756 MultiFab alpha(ba,dm,1,0,MFInfo(),factory);
758 hypre_solver->setACoeffs(alpha);
761 auto bc = getBCoeffs(0, mglev);
764 hypre_solver->setBCoeffs(bc);
768 Array<MultiFab,AMREX_SPACEDIM> beta;
769 for (
int idim = 0; idim < AMREX_SPACEDIM; ++idim)
772 dm, 1, 0, MFInfo(), factory);
773 beta[idim].setVal(1.0);
777 hypre_solver->setIsMatrixSingular(this->isBottomSingular());
785#if defined(AMREX_USE_PETSC) && (AMREX_SPACEDIM > 1)
786template <
typename MF>
787std::unique_ptr<PETScABecLap>
788MLCellABecLapT<MF>::makePETSc ()
const
790 if constexpr (!std::is_same<MF,MultiFab>()) {
791 amrex::Abort(
"MLCellABecLap PETSc interface only supports MultiFab");
793 const BoxArray& ba = this->m_grids[0].back();
794 const DistributionMapping& dm = this->m_dmap[0].back();
795 const Geometry& geom = this->m_geom[0].back();
796 const auto& factory = *(this->m_factory[0].back());
797 MPI_Comm comm = this->BottomCommunicator();
799 auto petsc_solver =
makePetsc(ba, dm, geom, comm);
801 petsc_solver->setScalars(getAScalar(), getBScalar());
803 const int mglev = this->NMGLevels(0)-1;
804 auto ac = getACoeffs(0, mglev);
807 petsc_solver->setACoeffs(*ac);
811 MultiFab alpha(ba,dm,1,0,MFInfo(),factory);
813 petsc_solver->setACoeffs(alpha);
816 auto bc = getBCoeffs(0, mglev);
819 petsc_solver->setBCoeffs(bc);
823 Array<MultiFab,AMREX_SPACEDIM> beta;
824 for (
int idim = 0; idim < AMREX_SPACEDIM; ++idim)
827 dm, 1, 0, MFInfo(), factory);
828 beta[idim].setVal(1.0);
838extern template class MLCellABecLapT<MultiFab>;
#define BL_PROFILE(a)
Definition AMReX_BLProfiler.H:551
#define AMREX_ALWAYS_ASSERT(EX)
Definition AMReX_BLassert.H:50
#define AMREX_HOST_DEVICE_PARALLEL_FOR_3D(...)
Definition AMReX_GpuLaunchMacrosC.nolint.H:110
#define AMREX_HOST_DEVICE_FOR_3D(...)
Definition AMReX_GpuLaunchMacrosC.nolint.H:106
#define AMREX_HOST_DEVICE_PARALLEL_FOR_4D(...)
Definition AMReX_GpuLaunchMacrosC.nolint.H:111
#define AMREX_GPU_DEVICE
Definition AMReX_GpuQualifiers.H:18
#define AMREX_GPU_HOST_DEVICE
Definition AMReX_GpuQualifiers.H:20
Array4< Real > fine
Definition AMReX_InterpFaceRegister.cpp:90
Array4< Real const > crse
Definition AMReX_InterpFaceRegister.cpp:92
#define AMREX_D_DECL(a, b, c)
Definition AMReX_SPACE.H:171
Maintain an identifier for boundary condition types.
Definition AMReX_BoundCond.H:25
__host__ __device__ bool contains(const IntVectND< dim > &p) const noexcept
Return true if argument is contained within BoxND.
Definition AMReX_Box.H:233
__host__ __device__ bool coarsenable(const IntVectND< dim > &refrat, const IntVectND< dim > &min_width) const noexcept
Return whether this Box is coarsenable.
Definition AMReX_Box.H:802
__host__ __device__ BoxND & coarsen(int ref_ratio) noexcept
Coarsen BoxND by given (positive) refinement ratio. NOTE: if type(dir) = CELL centered: lo <- lo/rati...
Definition AMReX_Box.H:754
const FAB & get(const MFIter &mfi) const noexcept
Return a constant reference to the FAB associated with mfi.
Definition AMReX_FabArray.H:511
Definition AMReX_FabFactory.H:50
Interface
HYPRE interface modes supported.
Definition AMReX_Hypre.H:37
__host__ static __device__ constexpr IntVectND< dim > TheDimensionVector(int d) noexcept
This static member function returns a reference to a constant IntVectND object, all of whose dim argu...
Definition AMReX_IntVect.H:790
Iterator for looping ever tiles and boxes of amrex::FabArray based containers.
Definition AMReX_MFIter.H:88
bool isValid() const noexcept
Is the iterator valid i.e. is it associated with a FAB?
Definition AMReX_MFIter.H:172
Cell-centered operator that exposes ABec Laplacian helpers to derived classes.
Definition AMReX_MLCellABecLap.H:22
void addInhomogNeumannFlux(int amrlev, const Array< MF *, 3 > &grad, MF const &sol, bool mult_bcoef) const final
Add inhomogeneous Neumann/Robin flux contributions into grad from sol (include b when mult_bcoef is t...
Definition AMReX_MLCellABecLap.H:579
MLCellABecLapT(const MLCellABecLapT< MF > &)=delete
void getFluxes(const Vector< MF * > &a_flux, const Vector< MF * > &a_sol) const final
Guard overload that aborts if called (cell-centered flux extraction requires per-direction face array...
Definition AMReX_MLCellABecLap.H:104
LPInfo m_lpinfo_arg
Definition AMReX_MLCellABecLap.H:143
virtual MF const * getACoeffs(int amrlev, int mglev) const =0
Cell-centered a coefficient MultiFab for AMR level amrlev and MG level mglev.
void getFluxes(const Vector< Array< MF *, 3 > > &a_flux, const Vector< MF * > &a_sol, Location a_loc) const final
Fill per-face fluxes using the supplied solution hierarchy.
Definition AMReX_MLCellABecLap.H:332
MLCellABecLapT< MF > & operator=(const MLCellABecLapT< MF > &)=delete
MLCellABecLapT(MLCellABecLapT< MF > &&)=delete
virtual Array< MF const *, 3 > getBCoeffs(int amrlev, int mglev) const =0
Face-centered b coefficients for AMR level amrlev and MG level mglev.
typename MF::value_type RT
Definition AMReX_MLCellABecLap.H:26
void setDirichletNodesToZero(int amrlev, int mglev, MF &mf) const override
Zero out Dirichlet nodes on (amrlev,mglev) so that GMRES can treat them as known.
Definition AMReX_MLCellABecLap.H:312
void applyOverset(int amrlev, MF &rhs) const override
Zero RHS entries in rhs that are covered by overset masks on level amrlev.
Definition AMReX_MLCellABecLap.H:689
virtual RT getBScalar() const =0
Scalar applied to b on the current operator.
iMultiFab const * getOversetMask(int amrlev, int mglev) const
Overset mask for (amrlev,mglev); returns nullptr when not defined.
Definition AMReX_MLCellABecLap.H:71
bool needsUpdate() const override
Does it need update if it's reused?
Definition AMReX_MLCellABecLap.H:75
typename MLLinOpT< MF >::Location Location
Definition AMReX_MLCellABecLap.H:28
typename MF::fab_type FAB
Definition AMReX_MLCellABecLap.H:25
Vector< Vector< std::unique_ptr< iMultiFab > > > m_overset_mask
Definition AMReX_MLCellABecLap.H:141
void define(const Vector< Geometry > &a_geom, const Vector< BoxArray > &a_grids, const Vector< DistributionMapping > &a_dmap, const LPInfo &a_info=LPInfo(), const Vector< FabFactory< FAB > const * > &a_factory={})
Describe the AMR hierarchy when overset masks are not required.
Definition AMReX_MLCellABecLap.H:150
bool supportInhomogNeumannBC() const noexcept override
Definition AMReX_MLCellABecLap.H:145
void prepareForSolve() override
Standard hook called before MLMG iterates (fixes BC data, etc.).
Definition AMReX_MLCellABecLap.H:305
~MLCellABecLapT() override=default
virtual RT getAScalar() const =0
Scalar applied to a on the current operator.
void applyInhomogNeumannTerm(int amrlev, MF &rhs) const final
Apply stored Neumann data to the RHS rhs on AMR level amrlev.
Definition AMReX_MLCellABecLap.H:357
void update() override
Average coefficients/metrics when marked dirty.
Definition AMReX_MLCellABecLap.H:298
Definition AMReX_MLCellLinOp.H:31
void update() override
Update for reuse.
Definition AMReX_MLCellLinOp.H:942
void prepareForSolve() override
Prepare multilevel metadata before MLMG iterates (coefficients, BC caches, etc.).
Definition AMReX_MLCellLinOp.H:1948
void define(const Vector< Geometry > &a_geom, const Vector< BoxArray > &a_grids, const Vector< DistributionMapping > &a_dmap, const LPInfo &a_info=LPInfo(), const Vector< FabFactory< FAB > const * > &a_factory={})
Bind the operator to an AMR hierarchy.
Definition AMReX_MLCellLinOp.H:648
bool needsUpdate() const override
Does it need update if it's reused?
Definition AMReX_MLCellLinOp.H:93
An Iterator over the Orientation of Faces of a Box.
Definition AMReX_Orientation.H:135
__host__ __device__ bool isValid() const noexcept
Is the iterator valid?
Definition AMReX_Orientation.H:156
Encapsulation of the Orientation of the Faces of a Box.
Definition AMReX_Orientation.H:29
__host__ __device__ bool isLow() const noexcept
Returns true if Orientation is low.
Definition AMReX_Orientation.H:89
__host__ __device__ int coordDir() const noexcept
Returns the coordinate direction.
Definition AMReX_Orientation.H:83
@ low
Definition AMReX_Orientation.H:34
@ high
Definition AMReX_Orientation.H:34
Definition AMReX_Reduce.H:438
Type value()
Definition AMReX_Reduce.H:473
Definition AMReX_Reduce.H:597
void eval(MF const &mf, IntVect const &nghost, D &reduce_data, F &&f)
Definition AMReX_Reduce.H:731
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition AMReX_Vector.H:29
Long size() const noexcept
Definition AMReX_Vector.H:54
A Collection of IArrayBoxes.
Definition AMReX_iMultiFab.H:34
static void Copy(iMultiFab &dst, const iMultiFab &src, int srccomp, int dstcomp, int numcomp, int nghost)
Copy from src to dst including nghost ghost cells. The two iMultiFabs MUST have the same underlying B...
Definition AMReX_iMultiFab.cpp:51
amrex_real Real
Floating Point Type for Fields.
Definition AMReX_REAL.H:79
__host__ __device__ BoxND< dim > adjCellHi(const BoxND< dim > &b, int dir, int len=1) noexcept
Return the BoxND of length len adjacent to b on the high end along coordinate direction dir.
Definition AMReX_Box.H:1848
__host__ __device__ BoxND< dim > convert(const BoxND< dim > &b, const IntVectND< dim > &typ) noexcept
Return a copy of b converted to the nodal flags typ.
Definition AMReX_Box.H:1630
__host__ __device__ BoxND< dim > adjCellLo(const BoxND< dim > &b, int dir, int len=1) noexcept
Return the BoxND of length len adjacent to b on the low end along coordinate direction dir.
Definition AMReX_Box.H:1817
__host__ __device__ BoxND< dim > coarsen(const BoxND< dim > &b, int ref_ratio) noexcept
Return a copy of b coarsened by the isotropic ratio ref_ratio.
Definition AMReX_Box.H:1469
__host__ __device__ BoxND< dim > adjCell(const BoxND< dim > &b, Orientation face, int len=1) noexcept
Similar to adjCellLo and adjCellHi except that it operates on the given face of BoxND b.
Definition AMReX_Box.H:1880
__host__ __device__ BoxND< dim > refine(const BoxND< dim > &b, int ref_ratio) noexcept
Return a copy of b refined by the isotropic ratio ref_ratio.
Definition AMReX_Box.H:1510
std::array< T, N > Array
Definition AMReX_Array.H:31
void Min(KeyValuePair< K, V > &vi, MPI_Comm comm)
Definition AMReX_ParallelReduce.H:161
void streamSynchronize() noexcept
Definition AMReX_GpuDevice.H:310
bool inLaunchRegion() noexcept
Definition AMReX_GpuControl.H:88
bool notInLaunchRegion() noexcept
Definition AMReX_GpuControl.H:89
bool inNoSyncRegion() noexcept
Definition AMReX_GpuControl.H:148
MPI_Comm CommunicatorSub() noexcept
sub-communicator for current frame
Definition AMReX_ParallelContext.H:70
int MPI_Comm
Definition AMReX_ccse-mpi.H:51
Definition AMReX_Amr.cpp:50
__host__ __device__ void ignore_unused(const Ts &...)
No-op helper that marks variables as intentionally unused.
Definition AMReX.H:259
std::array< T const *, 3 > GetArrOfConstPtrs(const std::array< T, 3 > &a) noexcept
Create an array of const-qualified pointers from an array of objects.
Definition AMReX_Array.H:1079
void ParallelFor(TypeList< CTOs... > ctos, std::array< int, sizeof...(CTOs)> const &runtime_options, T N, F &&f)
Definition AMReX_CTOParallelForImpl.H:202
BoxND< 3 > Box
Box is an alias for amrex::BoxND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:35
bool isMFIterSafe(const FabArrayBase &x, const FabArrayBase &y)
Definition AMReX_MFIter.H:252
IntVectND< 3 > IntVect
IntVect is an alias for amrex::IntVectND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:38
std::unique_ptr< Hypre > makeHypre(const BoxArray &grids, const DistributionMapping &dmap, const Geometry &geom, MPI_Comm comm_, Hypre::Interface interface, const iMultiFab *overset_mask)
Factory that instantiates the requested HYPRE interface.
Definition AMReX_Hypre.cpp:12
bool TilingIfNotGPU() noexcept
Definition AMReX_MFIter.H:12
std::unique_ptr< PETScABecLap > makePetsc(const BoxArray &grids, const DistributionMapping &dmap, const Geometry &geom, MPI_Comm comm_)
Factory helper that instantiates a PETSc ABec Laplacian on one level.
Definition AMReX_PETSc.cpp:58
void Abort(const std::string &msg)
Print a fatal-error message to stderr and abort execution.
Definition AMReX.cpp:241
A multidimensional array accessor.
Definition AMReX_Array4.H:288
A simple struct holding 3 int values for a 3D index.
Definition AMReX_Dim3.H:24
int x
Definition AMReX_Dim3.H:24
int z
Definition AMReX_Dim3.H:24
int y
Definition AMReX_Dim3.H:24
Configuration knobs for multilevel linear operators (grid agglomeration, metrics, etc....
Definition AMReX_MLLinOp.H:51
int max_coarsening_level
Definition AMReX_MLLinOp.H:60
Location
Definition AMReX_MLLinOp.H:119
FabArray memory allocation information.
Definition AMReX_FabArray.H:68
Definition AMReX_MFIter.H:20
MFItInfo & SetDynamic(bool f) noexcept
Definition AMReX_MFIter.H:43