Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
AMReX_MLCellABecLap.H
Go to the documentation of this file.
1#ifndef AMREX_ML_CELL_ABECLAP_H_
2#define AMREX_ML_CELL_ABECLAP_H_
3#include <AMReX_Config.H>
4
5#include <AMReX_MLCellLinOp.H>
6#include <AMReX_MLCellABecLap_K.H>
7
8namespace amrex {
9
18template <typename MF>
20class MLCellABecLapT // NOLINT(cppcoreguidelines-virtual-class-destructor)
21 : public MLCellLinOpT<MF>
22{
23public:
24
25 using FAB = typename MF::fab_type;
26 using RT = typename MF::value_type;
27
29
30 MLCellABecLapT () = default;
31 ~MLCellABecLapT () override = default;
32
37
47 void define (const Vector<Geometry>& a_geom,
48 const Vector<BoxArray>& a_grids,
49 const Vector<DistributionMapping>& a_dmap,
50 const LPInfo& a_info = LPInfo(),
51 const Vector<FabFactory<FAB> const*>& a_factory = {});
52
63 void define (const Vector<Geometry>& a_geom,
64 const Vector<BoxArray>& a_grids,
65 const Vector<DistributionMapping>& a_dmap,
66 const Vector<iMultiFab const*>& a_overset_mask,
67 const LPInfo& a_info = LPInfo(),
68 const Vector<FabFactory<FAB> const*>& a_factory = {});
69
71 [[nodiscard]] iMultiFab const* getOversetMask (int amrlev, int mglev) const {
72 return m_overset_mask[amrlev][mglev].get();
73 }
74
75 [[nodiscard]] bool needsUpdate () const override {
77 }
79 void update () override;
80
82 void prepareForSolve () override;
83
88 void setDirichletNodesToZero (int amrlev, int mglev, MF& mf) const override;
89
97 void getFluxes (const Vector<Array<MF*,AMREX_SPACEDIM> >& a_flux,
98 const Vector<MF*>& a_sol,
99 Location a_loc) const final;
104 void getFluxes (const Vector<MF*>& a_flux,
105 const Vector<MF*>& a_sol) const final {
106 amrex::ignore_unused(a_flux, a_sol);
107 amrex::Abort("MLCellABecLap::getFluxes: How did we get here?");
108 }
109
111 virtual RT getAScalar () const = 0;
113 virtual RT getBScalar () const = 0;
115 virtual MF const* getACoeffs (int amrlev, int mglev) const = 0;
117 virtual Array<MF const*,AMREX_SPACEDIM> getBCoeffs (int amrlev, int mglev) const = 0;
118
120 void applyInhomogNeumannTerm (int amrlev, MF& rhs) const final;
121
124 int amrlev, const Array<MF*,AMREX_SPACEDIM>& grad,
125 MF const& sol, bool mult_bcoef) const final;
126
128 void applyOverset (int amrlev, MF& rhs) const override;
129
131 [[nodiscard]] virtual MF const* getEBBCoeffs (int /*amrlev*/, int /*mglev*/) const { return nullptr; }
132
133 [[nodiscard]] std::unique_ptr<MLAlgMG> makeAlgMG (int mglev) const override;
134 [[nodiscard]] bool supportsAlgMG () const override { return std::is_same_v<MF,MultiFab>; }
135
138 [[nodiscard]] Array<MF,AMREX_SPACEDIM> makeDefaultBCoeffs (int mglev) const;
139
140#if defined(AMREX_USE_HYPRE) && (AMREX_SPACEDIM > 1)
142 [[nodiscard]] std::unique_ptr<Hypre> makeHypre (Hypre::Interface hypre_interface) const override;
143#endif
144
145#if defined(AMREX_USE_PETSC) && (AMREX_SPACEDIM > 1)
147 [[nodiscard]] std::unique_ptr<PETScABecLap> makePETSc () const override;
148#endif
149
150protected:
152
154
155 [[nodiscard]] bool supportInhomogNeumannBC () const noexcept override { return true; }
156};
157
158template <typename MF>
159void
161 const Vector<BoxArray>& a_grids,
162 const Vector<DistributionMapping>& a_dmap,
163 const LPInfo& a_info,
164 const Vector<FabFactory<FAB> const*>& a_factory)
165{
166 MLCellLinOpT<MF>::define(a_geom, a_grids, a_dmap, a_info, a_factory);
167
168 this->m_overset_mask.resize(this->m_num_amr_levels);
169 for (int amrlev = 0; amrlev < this->m_num_amr_levels; ++amrlev) {
170 this->m_overset_mask[amrlev].resize(this->m_num_mg_levels[amrlev]);
171 }
172}
173
174template <typename MF>
175void
177 const Vector<BoxArray>& a_grids,
178 const Vector<DistributionMapping>& a_dmap,
179 const Vector<iMultiFab const*>& a_overset_mask,
180 const LPInfo& a_info,
181 const Vector<FabFactory<FAB> const*>& a_factory)
182{
183 BL_PROFILE("MLCellABecLap::define(overset)");
184
185 AMREX_ALWAYS_ASSERT(!this->hasHiddenDimension());
186
187 this->m_lpinfo_arg = a_info;
188
189 auto namrlevs = static_cast<int>(a_geom.size());
190 this->m_overset_mask.resize(namrlevs);
191 for (int amrlev = 0; amrlev < namrlevs; ++amrlev)
192 {
193 this->m_overset_mask[amrlev].push_back(std::make_unique<iMultiFab>(a_grids[amrlev],
194 a_dmap[amrlev], 1, 1));
195 iMultiFab::Copy(*(this->m_overset_mask[amrlev][0]), *a_overset_mask[amrlev], 0, 0, 1, 0);
196 if (amrlev > 1) {
197 AMREX_ALWAYS_ASSERT(amrex::refine(a_geom[amrlev-1].Domain(),2)
198 == a_geom[amrlev].Domain());
199 }
200 }
201
202 int amrlev = 0;
203 Box dom = a_geom[0].Domain();
204 for (int mglev = 1; mglev <= a_info.max_coarsening_level; ++mglev)
205 {
206 AMREX_ALWAYS_ASSERT(this->mg_coarsen_ratio == 2);
207 iMultiFab const& fine = *(this->m_overset_mask[amrlev][mglev-1]);
208 if (dom.coarsenable(2) && fine.boxArray().coarsenable(2)) {
209 dom.coarsen(2);
210 auto crse = std::make_unique<iMultiFab>(amrex::coarsen(fine.boxArray(),2),
211 fine.DistributionMap(), 1, 1);
212 ReduceOps<ReduceOpSum> reduce_op;
213 ReduceData<int> reduce_data(reduce_op);
214 using ReduceTuple = typename decltype(reduce_data)::Type;
215#ifdef AMREX_USE_OMP
216#pragma omp parallel if (Gpu::notInLaunchRegion())
217#endif
218 for (MFIter mfi(*crse, TilingIfNotGPU()); mfi.isValid(); ++mfi)
219 {
220 const Box& bx = mfi.tilebox();
221 Array4<int const> const& fmsk = fine.const_array(mfi);
222 Array4<int> const& cmsk = crse->array(mfi);
223 reduce_op.eval(bx, reduce_data,
224 [=] AMREX_GPU_HOST_DEVICE (Box const& b) -> ReduceTuple
225 {
226 return { coarsen_overset_mask(b, cmsk, fmsk) };
227 });
228 }
229 ReduceTuple hv = reduce_data.value(reduce_op);
230 if (amrex::get<0>(hv) == 0) {
231 this->m_overset_mask[amrlev].push_back(std::move(crse));
232 } else {
233 break;
234 }
235 } else {
236 break;
237 }
238 }
239 int max_overset_mask_coarsening_level = this->m_overset_mask[amrlev].size()-1;
240 ParallelAllReduce::Min(max_overset_mask_coarsening_level, ParallelContext::CommunicatorSub());
241 this->m_overset_mask[amrlev].resize(max_overset_mask_coarsening_level+1);
242
243 LPInfo linfo = a_info;
244 linfo.max_coarsening_level = std::min(a_info.max_coarsening_level,
245 max_overset_mask_coarsening_level);
246 // The overset masks above are coarsened isotropically by 2, so the MG
247 // levels must be too, or the masks and the grids end up in different
248 // index spaces.
249 linfo.do_semicoarsening = false;
250
251 MLCellLinOpT<MF>::define(a_geom, a_grids, a_dmap, linfo, a_factory);
252
253 amrlev = 0;
254 for (int mglev = 1; mglev < this->m_num_mg_levels[amrlev]; ++mglev) {
255 MF foo(this->m_grids[amrlev][mglev], this->m_dmap[amrlev][mglev], 1, 0, MFInfo().SetAlloc(false));
256 if (! amrex::isMFIterSafe(*(this->m_overset_mask[amrlev][mglev]), foo)) {
257 auto osm = std::make_unique<iMultiFab>(this->m_grids[amrlev][mglev],
258 this->m_dmap[amrlev][mglev], 1, 1);
259 osm->ParallelCopy(*(this->m_overset_mask[amrlev][mglev]));
260 std::swap(osm, this->m_overset_mask[amrlev][mglev]);
261 }
262 }
263
264 for (amrlev = 1; amrlev < this->m_num_amr_levels; ++amrlev) {
265 for (int mglev = 1; mglev < this->m_num_mg_levels[amrlev]; ++mglev) { // for ref_ratio 4
266 this->m_overset_mask[amrlev].push_back(std::make_unique<iMultiFab>(this->m_grids[amrlev][mglev],
267 this->m_dmap[amrlev][mglev],
268 1, 1));
269
270#ifdef AMREX_USE_GPU
271 if (Gpu::inLaunchRegion() && this->m_overset_mask[amrlev][mglev]->isFusingCandidate()) {
272 auto const& crsema = this->m_overset_mask[amrlev][mglev]->arrays();
273 auto const& finema = this->m_overset_mask[amrlev][mglev-1]->const_arrays();
274 ParallelFor(*(this->m_overset_mask[amrlev][mglev]),
275 [=] AMREX_GPU_DEVICE (int box_no, int i, int j, int k) noexcept
276 {
277 coarsen_overset_mask(i,j,k, crsema[box_no], finema[box_no]);
278 });
279 if (!Gpu::inNoSyncRegion()) {
281 }
282 } else
283#endif
284 {
285#ifdef AMREX_USE_OMP
286#pragma omp parallel if (Gpu::notInLaunchRegion())
287#endif
288 for (MFIter mfi(*(this->m_overset_mask[amrlev][mglev]), TilingIfNotGPU()); mfi.isValid(); ++mfi)
289 {
290 const Box& bx = mfi.tilebox();
291 Array4<int> const& cmsk = this->m_overset_mask[amrlev][mglev]->array(mfi);
292 Array4<int const> const fmsk = this->m_overset_mask[amrlev][mglev-1]->const_array(mfi);
294 {
295 coarsen_overset_mask(i,j,k, cmsk, fmsk);
296 });
297 }
298 }
299 }
300 }
301
302 for (amrlev = 0; amrlev < this->m_num_amr_levels; ++amrlev) {
303 for (int mglev = 0; mglev < this->m_num_mg_levels[amrlev]; ++mglev) {
304 this->m_overset_mask[amrlev][mglev]->setBndry(1);
305 this->m_overset_mask[amrlev][mglev]->FillBoundary(this->m_geom[amrlev][mglev].periodicity());
306 }
307 }
308}
309
310template <typename MF>
311void
316
317template <typename MF>
318void
323
324template <typename MF>
325void
326MLCellABecLapT<MF>::setDirichletNodesToZero (int amrlev, int mglev, MF& mf) const
327{
328 auto const* omask = this->getOversetMask(amrlev, mglev);
329 if (omask) {
330 const int ncomp = this->getNComp();
331 auto const& mskma = omask->const_arrays();
332 auto const& ma = mf.arrays();
333 ParallelFor(mf, IntVect(0), ncomp,
334 [=] AMREX_GPU_DEVICE (int bno, int i, int j, int k, int n)
335 {
336 if (mskma[bno](i,j,k) == 0) { ma[bno](i,j,k,n) = RT(0.0); }
337 });
338 if (!Gpu::inNoSyncRegion()) {
340 }
341 }
342}
343
344template <typename MF>
345void
347 const Vector<MF*>& a_sol,
348 Location a_loc) const
349{
350 BL_PROFILE("MLMG::getFluxes()");
351
352 const int ncomp = this->getNComp();
353 const RT betainv = RT(1.0) / getBScalar();
354 const int nlevs = this->NAMRLevels();
355 // Without b coefficients, the metric factor is in the flux kernels, not in
356 // b, so it must be removed before the boundary faces are set using b = 1.
357 const bool has_bcoef = (getBCoeffs(0,0)[0] != nullptr);
358 for (int alev = 0; alev < nlevs; ++alev) {
359 this->compFlux(alev, a_flux[alev], *a_sol[alev], a_loc);
360 for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
361 if (betainv != RT(1.0)) {
362 a_flux[alev][idim]->mult(betainv, 0, ncomp);
363 }
364 if (!has_bcoef) {
365 this->unapplyMetricTerm(alev, 0, *a_flux[alev][idim]);
366 }
367 }
368 this->addInhomogNeumannFlux(alev, a_flux[alev], *a_sol[alev], true);
369 if (has_bcoef) {
370 for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
371 this->unapplyMetricTerm(alev, 0, *a_flux[alev][idim]);
372 }
373 }
374 }
375}
376
377template <typename MF>
378void
380{
381 bool has_inhomog_neumann = this->hasInhomogNeumannBC();
382 bool has_robin = this->hasRobinBC();
383
384 // A preconditioner must be linear, so it gets no inhomogeneous terms.
385 if (this->m_precond_mode) { return; }
386 if (!has_inhomog_neumann && !has_robin) { return; }
387
388 int ncomp = this->getNComp();
389 const int mglev = 0;
390
391 const auto problo = this->m_geom[amrlev][mglev].ProbLoArray();
392 const auto probhi = this->m_geom[amrlev][mglev].ProbHiArray();
393 amrex::ignore_unused(probhi);
394 const RT dxi = static_cast<RT>(this->m_geom[amrlev][mglev].InvCellSize(0));
395 const RT dyi = static_cast<RT>((AMREX_SPACEDIM >= 2) ? this->m_geom[amrlev][mglev].InvCellSize(1) : Real(1.0));
396 const RT dzi = static_cast<RT>((AMREX_SPACEDIM == 3) ? this->m_geom[amrlev][mglev].InvCellSize(2) : Real(1.0));
397 const RT xlo = static_cast<RT>(problo[0]);
398 const RT dx = static_cast<RT>(this->m_geom[amrlev][mglev].CellSize(0));
399 const Box& domain = this->m_geom[amrlev][mglev].Domain();
400
401 const RT beta = getBScalar();
402 Array<MF const*, AMREX_SPACEDIM> const& bcoef = getBCoeffs(amrlev,mglev);
403 FAB foo(Box(IntVect(0),IntVect(1)));
404 bool has_bcoef = (bcoef[0] != nullptr);
405
406 const auto& maskvals = this->m_maskvals[amrlev][mglev];
407 const auto& bcondloc = *(this->m_bcondloc[amrlev][mglev]);
408 const auto& bndry = *(this->m_bndry_sol[amrlev]);
409
410 MFItInfo mfi_info;
411 if (Gpu::notInLaunchRegion()) { mfi_info.SetDynamic(true); }
412
413#ifdef AMREX_USE_OMP
414#pragma omp parallel if (Gpu::notInLaunchRegion())
415#endif
416 for (MFIter mfi(rhs, mfi_info); mfi.isValid(); ++mfi)
417 {
418 const Box& vbx = mfi.validbox();
419 auto const& rhsfab = rhs.array(mfi);
420
421 const auto & bdlv = bcondloc.bndryLocs(mfi);
422 const auto & bdcv = bcondloc.bndryConds(mfi);
423
424 for (int idim = 0; idim < AMREX_SPACEDIM; ++idim)
425 {
426 auto const bfab = (has_bcoef)
427 ? bcoef[idim]->const_array(mfi) : foo.const_array();
428 const Orientation olo(idim,Orientation::low);
429 const Orientation ohi(idim,Orientation::high);
430 const Box blo = amrex::adjCellLo(vbx, idim);
431 const Box bhi = amrex::adjCellHi(vbx, idim);
432 const auto& mlo = maskvals[olo].array(mfi);
433 const auto& mhi = maskvals[ohi].array(mfi);
434 const auto& bvlo = bndry.bndryValues(olo).array(mfi);
435 const auto& bvhi = bndry.bndryValues(ohi).array(mfi);
436 bool outside_domain_lo = !(domain.contains(blo));
437 bool outside_domain_hi = !(domain.contains(bhi));
438 if ((!outside_domain_lo) && (!outside_domain_hi)) { continue; }
439 for (int icomp = 0; icomp < ncomp; ++icomp) {
440 const BoundCond bctlo = bdcv[icomp][olo];
441 const BoundCond bcthi = bdcv[icomp][ohi];
442 const RT bcllo = bdlv[icomp][olo];
443 const RT bclhi = bdlv[icomp][ohi];
444 if (this->m_lobc_orig[icomp][idim] == LinOpBCType::inhomogNeumann && outside_domain_lo)
445 {
446 if (idim == 0) {
447 RT fac = beta*dxi;
448 if (this->m_has_metric_term && !has_bcoef) {
449#if (AMREX_SPACEDIM == 1)
450 fac *= static_cast<RT>(problo[0]*problo[0]);
451#elif (AMREX_SPACEDIM == 2)
452 fac *= static_cast<RT>(problo[0]);
453#endif
454 }
455 AMREX_HOST_DEVICE_FOR_3D(blo, i, j, k,
456 {
457 mllinop_apply_innu_xlo(i,j,k, rhsfab, mlo, bfab,
458 bctlo, bcllo, bvlo,
459 fac, has_bcoef, icomp);
460 });
461 } else if (idim == 1) {
462 RT fac = beta*dyi;
463 if (this->m_has_metric_term && !has_bcoef) {
464 AMREX_HOST_DEVICE_FOR_3D(blo, i, j, k,
465 {
466 mllinop_apply_innu_ylo_m(i,j,k, rhsfab, mlo,
467 bctlo, bcllo, bvlo,
468 fac, xlo, dx, icomp);
469 });
470 }
471 else {
472 AMREX_HOST_DEVICE_FOR_3D(blo, i, j, k,
473 {
474 mllinop_apply_innu_ylo(i,j,k, rhsfab, mlo, bfab,
475 bctlo, bcllo, bvlo,
476 fac, has_bcoef, icomp);
477 });
478 }
479 } else {
480 RT fac = beta*dzi;
481 AMREX_HOST_DEVICE_FOR_3D(blo, i, j, k,
482 {
483 mllinop_apply_innu_zlo(i,j,k, rhsfab, mlo, bfab,
484 bctlo, bcllo, bvlo,
485 fac, has_bcoef, icomp);
486 });
487 }
488 }
489 if (this->m_hibc_orig[icomp][idim] == LinOpBCType::inhomogNeumann && outside_domain_hi)
490 {
491 if (idim == 0) {
492 RT fac = beta*dxi;
493 if (this->m_has_metric_term && !has_bcoef) {
494#if (AMREX_SPACEDIM == 1)
495 fac *= static_cast<RT>(probhi[0]*probhi[0]);
496#elif (AMREX_SPACEDIM == 2)
497 fac *= static_cast<RT>(probhi[0]);
498#endif
499 }
500 AMREX_HOST_DEVICE_FOR_3D(bhi, i, j, k,
501 {
502 mllinop_apply_innu_xhi(i,j,k, rhsfab, mhi, bfab,
503 bcthi, bclhi, bvhi,
504 fac, has_bcoef, icomp);
505 });
506 } else if (idim == 1) {
507 RT fac = beta*dyi;
508 if (this->m_has_metric_term && !has_bcoef) {
509 AMREX_HOST_DEVICE_FOR_3D(bhi, i, j, k,
510 {
511 mllinop_apply_innu_yhi_m(i,j,k, rhsfab, mhi,
512 bcthi, bclhi, bvhi,
513 fac, xlo, dx, icomp);
514 });
515 } else {
516 AMREX_HOST_DEVICE_FOR_3D(bhi, i, j, k,
517 {
518 mllinop_apply_innu_yhi(i,j,k, rhsfab, mhi, bfab,
519 bcthi, bclhi, bvhi,
520 fac, has_bcoef, icomp);
521 });
522 }
523 } else {
524 RT fac = beta*dzi;
525 AMREX_HOST_DEVICE_FOR_3D(bhi, i, j, k,
526 {
527 mllinop_apply_innu_zhi(i,j,k, rhsfab, mhi, bfab,
528 bcthi, bclhi, bvhi,
529 fac, has_bcoef, icomp);
530 });
531 }
532 }
533
534 if (has_robin) {
535 // For Robin BC, see comments in AMReX_MLABecLaplacian.cpp above
536 // function applyRobinBCTermsCoeffs.
537 auto const& rbc = (*this->m_robin_bcval[amrlev])[mfi].const_array(icomp*3);
538 if (this->m_lobc_orig[icomp][idim] == LinOpBCType::Robin && outside_domain_lo)
539 {
540 if (idim == 0) {
541 RT fac = beta*dxi*dxi;
542 AMREX_HOST_DEVICE_FOR_3D(blo, i, j, k,
543 {
544 RT A = rbc(i,j,k,2)
545 / (rbc(i,j,k,1)*dxi + rbc(i,j,k,0)*RT(0.5));
546 rhsfab(i+1,j,k,icomp) += fac*bfab(i+1,j,k,icomp)*A;
547 });
548 } else if (idim == 1) {
549 RT fac = beta*dyi*dyi;
550 AMREX_HOST_DEVICE_FOR_3D(blo, i, j, k,
551 {
552 RT A = rbc(i,j,k,2)
553 / (rbc(i,j,k,1)*dyi + rbc(i,j,k,0)*RT(0.5));
554 rhsfab(i,j+1,k,icomp) += fac*bfab(i,j+1,k,icomp)*A;
555 });
556 } else {
557 RT fac = beta*dzi*dzi;
558 AMREX_HOST_DEVICE_FOR_3D(blo, i, j, k,
559 {
560 RT A = rbc(i,j,k,2)
561 / (rbc(i,j,k,1)*dzi + rbc(i,j,k,0)*RT(0.5));
562 rhsfab(i,j,k+1,icomp) += fac*bfab(i,j,k+1,icomp)*A;
563 });
564 }
565 }
566 if (this->m_hibc_orig[icomp][idim] == LinOpBCType::Robin && outside_domain_hi)
567 {
568 if (idim == 0) {
569 RT fac = beta*dxi*dxi;
570 AMREX_HOST_DEVICE_FOR_3D(bhi, i, j, k,
571 {
572 RT A = rbc(i,j,k,2)
573 / (rbc(i,j,k,1)*dxi + rbc(i,j,k,0)*RT(0.5));
574 rhsfab(i-1,j,k,icomp) += fac*bfab(i,j,k,icomp)*A;
575 });
576 } else if (idim == 1) {
577 RT fac = beta*dyi*dyi;
578 AMREX_HOST_DEVICE_FOR_3D(bhi, i, j, k,
579 {
580 RT A = rbc(i,j,k,2)
581 / (rbc(i,j,k,1)*dyi + rbc(i,j,k,0)*RT(0.5));
582 rhsfab(i,j-1,k,icomp) += fac*bfab(i,j,k,icomp)*A;
583 });
584 } else {
585 RT fac = beta*dzi*dzi;
586 AMREX_HOST_DEVICE_FOR_3D(bhi, i, j, k,
587 {
588 RT A = rbc(i,j,k,2)
589 / (rbc(i,j,k,1)*dzi + rbc(i,j,k,0)*RT(0.5));
590 rhsfab(i,j,k-1,icomp) += fac*bfab(i,j,k,icomp)*A;
591 });
592 }
593 }
594 }
595 }
596 }
597
598 }
599}
600
601template <typename MF>
602void
604 int amrlev, const Array<MF*,AMREX_SPACEDIM>& grad, MF const& sol,
605 bool mult_bcoef) const
606{
607 /*
608 * if (mult_bcoef == true)
609 * grad is -bceof*grad phi
610 * else
611 * grad is grad phi
612 */
613 RT fac = mult_bcoef ? RT(-1.0) : RT(1.0);
614
615 bool has_inhomog_neumann = this->hasInhomogNeumannBC();
616 bool has_robin = this->hasRobinBC();
617
618 if (!has_inhomog_neumann && !has_robin) { return; }
619
620 int ncomp = this->getNComp();
621 const int mglev = 0;
622
623 const auto dxinv = this->m_geom[amrlev][mglev].InvCellSize();
624 const Box domain = this->m_geom[amrlev][mglev].growPeriodicDomain(1);
625
626 Array<MF const*, AMREX_SPACEDIM> bcoef = {AMREX_D_DECL(nullptr,nullptr,nullptr)};
627 if (mult_bcoef) {
628 bcoef = getBCoeffs(amrlev,mglev);
629 }
630
631 const auto& bndry = *this->m_bndry_sol[amrlev];
632
633 MFItInfo mfi_info;
634 if (Gpu::notInLaunchRegion()) { mfi_info.SetDynamic(true); }
635
636#ifdef AMREX_USE_OMP
637#pragma omp parallel if (Gpu::notInLaunchRegion())
638#endif
639 for (MFIter mfi(sol, mfi_info); mfi.isValid(); ++mfi)
640 {
641 Box const& vbx = mfi.validbox();
642 for (OrientationIter orit; orit.isValid(); ++orit) {
643 const Orientation ori = orit();
644 const int idim = ori.coordDir();
645 const Box& ccb = amrex::adjCell(vbx, ori);
646 const Dim3 os = IntVect::TheDimensionVector(idim).dim3();
647 const RT dxi = static_cast<RT>(dxinv[idim]);
648 if (! domain.contains(ccb)) {
649 for (int icomp = 0; icomp < ncomp; ++icomp) {
650 auto const& phi = sol.const_array(mfi,icomp);
651 auto const& bv = bndry.bndryValues(ori).multiFab().const_array(mfi,icomp);
652 auto const& bc = bcoef[idim] ? bcoef[idim]->const_array(mfi,icomp)
654 auto const& f = grad[idim]->array(mfi,icomp);
655 if (ori.isLow()) {
656 if (this->m_lobc_orig[icomp][idim] ==
658 AMREX_HOST_DEVICE_FOR_3D(ccb, i, j, k,
659 {
660 int ii = i+os.x;
661 int jj = j+os.y;
662 int kk = k+os.z;
663 RT b = bc ? bc(ii,jj,kk) : RT(1.0);
664 f(ii,jj,kk) = fac*b*bv(i,j,k);
665 });
666 } else if (this->m_lobc_orig[icomp][idim] ==
668 auto const& rbc = (*this->m_robin_bcval[amrlev])[mfi].const_array(icomp*3);
669 AMREX_HOST_DEVICE_FOR_3D(ccb, i, j, k,
670 {
671 int ii = i+os.x;
672 int jj = j+os.y;
673 int kk = k+os.z;
674 RT tmp = RT(1.0) /
675 (rbc(i,j,k,1)*dxi + rbc(i,j,k,0)*RT(0.5));
676 RT RA = rbc(i,j,k,2) * tmp;
677 RT RB = (rbc(i,j,k,1)*dxi - rbc(i,j,k,0)*RT(0.5)) * tmp;
678 RT b = bc ? bc(ii,jj,kk) : RT(1.0);
679 f(ii,jj,kk) = fac*b*dxi*((RT(1.0)-RB)*phi(ii,jj,kk)-RA);
680 });
681 }
682 } else {
683 if (this->m_hibc_orig[icomp][idim] ==
685 AMREX_HOST_DEVICE_FOR_3D(ccb, i, j, k,
686 {
687 RT b = bc ? bc(i,j,k) : RT(1.0);
688 f(i,j,k) = fac*b*bv(i,j,k);
689 });
690 } else if (this->m_hibc_orig[icomp][idim] ==
692 auto const& rbc = (*this->m_robin_bcval[amrlev])[mfi].const_array(icomp*3);
693 AMREX_HOST_DEVICE_FOR_3D(ccb, i, j, k,
694 {
695 RT tmp = RT(1.0) /
696 (rbc(i,j,k,1)*dxi + rbc(i,j,k,0)*RT(0.5));
697 RT RA = rbc(i,j,k,2) * tmp;
698 RT RB = (rbc(i,j,k,1)*dxi - rbc(i,j,k,0)*RT(0.5)) * tmp;
699 RT b = bc ? bc(i,j,k) : RT(1.0);
700 f(i,j,k) = fac*b*dxi*(RA+(RB-RT(1.0))*
701 phi(i-os.x,j-os.y,k-os.z));
702 });
703 }
704 }
705 }
706 }
707 }
708 }
709}
710
711template <typename MF>
712void
713MLCellABecLapT<MF>::applyOverset (int amrlev, MF& rhs) const
714{
715 if (m_overset_mask[amrlev][0]) {
716 const int ncomp = this->getNComp();
717#ifdef AMREX_USE_GPU
718 if (Gpu::inLaunchRegion() && m_overset_mask[amrlev][0]->isFusingCandidate()) {
719 auto const& osma = m_overset_mask[amrlev][0]->const_arrays();
720 auto const& rhsa = rhs.arrays();
721 ParallelFor(*m_overset_mask[amrlev][0], IntVect(0), ncomp,
722 [=] AMREX_GPU_DEVICE (int box_no, int i, int j, int k, int n) noexcept
723 {
724 if (osma[box_no](i,j,k) == 0) {
725 rhsa[box_no](i,j,k,n) = RT(0.0);
726 }
727 });
728 if (!Gpu::inNoSyncRegion()) {
730 }
731 } else
732#endif
733 {
734#ifdef AMREX_USE_OMP
735#pragma omp parallel if (Gpu::notInLaunchRegion())
736#endif
737 for (MFIter mfi(*m_overset_mask[amrlev][0],TilingIfNotGPU()); mfi.isValid(); ++mfi)
738 {
739 const Box& bx = mfi.tilebox();
740 auto const& rfab = rhs.array(mfi);
741 auto const& osm = m_overset_mask[amrlev][0]->const_array(mfi);
742 AMREX_HOST_DEVICE_PARALLEL_FOR_4D(bx, ncomp, i, j, k, n,
743 {
744 if (osm(i,j,k) == 0) { rfab(i,j,k,n) = RT(0.0); }
745 });
746 }
747 }
748 }
749}
750
751template <typename MF>
754{
755 const int amrlev = 0;
757 for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
758 beta[idim].define(amrex::convert(this->m_grids[amrlev][mglev],
760 this->m_dmap[amrlev][mglev], 1, 0,
761 MFInfo().SetArena(The_Async_Arena()),
762 *(this->m_factory[amrlev][mglev]));
763 beta[idim].setVal(RT(1.0));
764 this->applyMetricTerm(amrlev, mglev, beta[idim]);
765 }
766 return beta;
767}
768
769template <typename MF>
770std::unique_ptr<MLAlgMG>
772{
773 if constexpr (!std::is_same<MF,MultiFab>()) {
775 amrex::Abort("MLCellABecLap: AlgMG only supports MultiFab");
776 return nullptr;
777 } else {
778 const int amrlev = 0;
779 const BoxArray& ba = this->m_grids[amrlev][mglev];
780 const DistributionMapping& dm = this->m_dmap[amrlev][mglev];
781 const Geometry& geom = this->m_geom[amrlev][mglev];
782 const auto& factory = *(this->m_factory[amrlev][mglev]);
783
784 auto const& bcondloc = *(this->m_bcondloc[amrlev][mglev]);
787 for (MFIter mfi(bctype); mfi.isValid(); ++mfi) {
788 for (OrientationIter oit; oit; oit++) {
789 int const cdir = oit();
790 bctype[mfi][cdir] = bcondloc.bndryConds(mfi, 0)[cdir];
791 bcl[mfi][cdir] = bcondloc.bndryLocs(mfi, 0)[cdir];
792 }
793 }
794
795 auto ac = getACoeffs(amrlev, mglev);
796 auto bc = getBCoeffs(amrlev, mglev);
798 if (bc[0] == nullptr) {
799 beta = makeDefaultBCoeffs(mglev);
801 }
802 return std::make_unique<MLAlgMG>(mglev, ba, dm, geom, factory,
803 getOversetMask(amrlev, mglev),
804 getAScalar(), getBScalar(), ac, bc,
805 getEBBCoeffs(amrlev, mglev), bctype, bcl,
806 this->getMaxOrder());
807 }
808}
809
810#if defined(AMREX_USE_HYPRE) && (AMREX_SPACEDIM > 1)
811template <typename MF>
812std::unique_ptr<Hypre>
814{
815 if constexpr (!std::is_same<MF,MultiFab>()) {
816 amrex::Abort("MLCellABecLap Hypre interface only supports MultiFab");
817 } else {
818 const BoxArray& ba = this->m_grids[0].back();
819 const DistributionMapping& dm = this->m_dmap[0].back();
820 const Geometry& geom = this->m_geom[0].back();
821 const auto& factory = *(this->m_factory[0].back());
822 MPI_Comm comm = this->BottomCommunicator();
823
824 const int mglev = this->NMGLevels(0)-1;
825
826 auto om = getOversetMask(0, mglev);
827
828 auto hypre_solver = amrex::makeHypre(ba, dm, geom, comm, hypre_interface, om);
829
830 hypre_solver->setScalars(getAScalar(), getBScalar());
831
832 auto ac = getACoeffs(0, mglev);
833 if (ac)
834 {
835 hypre_solver->setACoeffs(*ac);
836 }
837 else
838 {
839 MultiFab alpha(ba,dm,1,0,MFInfo().SetArena(The_Async_Arena()),factory);
840 alpha.setVal(0.0);
841 hypre_solver->setACoeffs(alpha);
842 }
843
844 auto bc = getBCoeffs(0, mglev);
845 if (bc[0])
846 {
847 hypre_solver->setBCoeffs(bc);
848 }
849 else
850 {
851 auto beta = makeDefaultBCoeffs(mglev);
852 hypre_solver->setBCoeffs(amrex::GetArrOfConstPtrs(beta));
853 }
854 hypre_solver->setIsMatrixSingular(this->isBottomSingular());
855
856 return hypre_solver;
857 }
858 return nullptr;
859}
860#endif
861
862#if defined(AMREX_USE_PETSC) && (AMREX_SPACEDIM > 1)
863template <typename MF>
864std::unique_ptr<PETScABecLap>
865MLCellABecLapT<MF>::makePETSc () const
866{
867 if constexpr (!std::is_same<MF,MultiFab>()) {
868 amrex::Abort("MLCellABecLap PETSc interface only supports MultiFab");
869 } else {
870 const BoxArray& ba = this->m_grids[0].back();
871 const DistributionMapping& dm = this->m_dmap[0].back();
872 const Geometry& geom = this->m_geom[0].back();
873 const auto& factory = *(this->m_factory[0].back());
874 MPI_Comm comm = this->BottomCommunicator();
875
876 auto petsc_solver = makePetsc(ba, dm, geom, comm);
877
878 petsc_solver->setScalars(getAScalar(), getBScalar());
879
880 const int mglev = this->NMGLevels(0)-1;
881 auto ac = getACoeffs(0, mglev);
882 if (ac)
883 {
884 petsc_solver->setACoeffs(*ac);
885 }
886 else
887 {
888 MultiFab alpha(ba,dm,1,0,MFInfo().SetArena(The_Async_Arena()),factory);
889 alpha.setVal(0.0);
890 petsc_solver->setACoeffs(alpha);
891 }
892
893 auto bc = getBCoeffs(0, mglev);
894 if (bc[0])
895 {
896 petsc_solver->setBCoeffs(bc);
897 }
898 else
899 {
900 auto beta = makeDefaultBCoeffs(mglev);
901 petsc_solver->setBCoeffs(amrex::GetArrOfConstPtrs(beta));
902 }
903 return petsc_solver;
904 }
905 return nullptr;
906}
907#endif
908
909extern template class MLCellABecLapT<MultiFab>;
910
913
914}
915
916#endif
#define BL_PROFILE(a)
Definition AMReX_BLProfiler.H:562
#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
GpuArray< Real, 3 > beta
Definition AMReX_MLEBNodeFDLaplacian.cpp:1834
#define AMREX_D_DECL(a, b, c)
Definition AMReX_SPACE.H:171
Maintain an identifier for boundary condition types.
Definition AMReX_BoundCond.H:25
Reference-counted collection of Boxes.
Definition AMReX_BoxArray.H:681
__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
Calculates the distribution of FABs to MPI processes.
Definition AMReX_DistributionMapping.H:51
const FAB & get(const MFIter &mfi) const noexcept
Return a constant reference to the FAB associated with mfi.
Definition AMReX_FabArray.H:558
Abstract factory interface for creating, aliasing, and destroying FAB objects.
Definition AMReX_FabFactory.H:73
Rectangular problem domain geometry.
Definition AMReX_Geometry.H:85
Interface
HYPRE interface modes supported.
Definition AMReX_Hypre.H:70
__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
a one-thingy-per-box distributed object
Definition AMReX_LayoutData.H:13
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:176
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:603
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
Array< MF, 3 > makeDefaultBCoeffs(int mglev) const
Definition AMReX_MLCellABecLap.H:753
LPInfo m_lpinfo_arg
Definition AMReX_MLCellABecLap.H:153
virtual MF const * getACoeffs(int amrlev, int mglev) const =0
Cell-centered a coefficient MultiFab for AMR level amrlev and MG level mglev.
std::unique_ptr< MLAlgMG > makeAlgMG(int mglev) const override
Build the algebraic system of MG level mglev of AMR level 0 for the AlgMG solver. Operators that hypr...
Definition AMReX_MLCellABecLap.H:771
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:346
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:326
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:713
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:151
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:160
bool supportInhomogNeumannBC() const noexcept override
Definition AMReX_MLCellABecLap.H:155
void prepareForSolve() override
Standard hook called before MLMG iterates (fixes BC data, etc.).
Definition AMReX_MLCellABecLap.H:319
~MLCellABecLapT() override=default
bool supportsAlgMG() const override
True if makeAlgMG is implemented for this operator.
Definition AMReX_MLCellABecLap.H:134
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:379
void update() override
Average coefficients/metrics when marked dirty.
Definition AMReX_MLCellABecLap.H:312
virtual MF const * getEBBCoeffs(int, int) const
EB Dirichlet b coefficient for the matrix assembly (nullptr without EB).
Definition AMReX_MLCellABecLap.H:131
Definition AMReX_MLCellLinOp.H:31
void update() override
Update for reuse.
Definition AMReX_MLCellLinOp.H:948
void prepareForSolve() override
Prepare multilevel metadata before MLMG iterates (coefficients, BC caches, etc.).
Definition AMReX_MLCellLinOp.H:1961
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:734
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:80
__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
Arena * The_Async_Arena()
Definition AMReX_Arena.cpp:839
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:273
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:256
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:67
void Abort(const std::string &msg)
Print a fatal-error message to stderr and abort execution.
Definition AMReX.cpp:244
A multidimensional array accessor.
Definition AMReX_Array4.H:289
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:53
bool do_semicoarsening
Definition AMReX_MLLinOp.H:56
int max_coarsening_level
Definition AMReX_MLLinOp.H:62
Location
Definition AMReX_MLLinOp.H:121
FabArray memory allocation information.
Definition AMReX_FabArray.H:73
Definition AMReX_MFIter.H:20
MFItInfo & SetDynamic(bool f) noexcept
Definition AMReX_MFIter.H:43