Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
AMReX_FillPatcher.H
Go to the documentation of this file.
1#ifndef AMREX_FILLPATCHER_H_
2#define AMREX_FILLPATCHER_H_
3#include <AMReX_Config.H>
4
6#include <utility>
7
13namespace amrex {
14
76template <class MF = MultiFab>
78{
79public:
80
95 FillPatcher (BoxArray const& fba, DistributionMapping const& fdm,
96 Geometry const& fgeom,
97 BoxArray const& cba, DistributionMapping const& cdm, // NOLINT
98 Geometry const& cgeom,
99 IntVect const& nghost, int ncomp, InterpBase* interp,
100#ifdef AMREX_USE_EB
101 EB2::IndexSpace const* eb_index_space = EB2::TopIndexSpaceIfPresent());
102#else
103 EB2::IndexSpace const* eb_index_space = nullptr);
104#endif
105
129 template <typename BC,
130 typename PreInterpHook=NullInterpHook<MF>,
131 typename PostInterpHook=NullInterpHook<MF> >
132 void fill (MF& mf, IntVect const& nghost, Real time,
133 Vector<MF*> const& cmf, Vector<Real> const& ct,
134 Vector<MF*> const& fmf, Vector<Real> const& ft,
135 int scomp, int dcomp, int ncomp,
136 BC& cbc, int cbccomp, BC& fbc, int fbccomp,
137 Vector<BCRec> const& bcs, int bcscomp,
138 PreInterpHook const& pre_interp = {},
139 PostInterpHook const& post_interp = {});
140
160 template <typename BC,
161 typename PreInterpHook=NullInterpHook<MF>,
162 typename PostInterpHook=NullInterpHook<MF> >
163 void fillCoarseFineBoundary (MF& mf, IntVect const& nghost, Real time,
164 Vector<MF*> const& cmf,
165 Vector<Real> const& ct,
166 int scomp, int dcomp, int ncomp,
167 BC& cbc, int cbccomp,
168 Vector<BCRec> const& bcs, int bcscomp,
169 PreInterpHook const& pre_interp = {},
170 PostInterpHook const& post_interp = {});
171
181 template <std::size_t order>
182 requires (order == 3 || order == 4)
183 void storeRKCoarseData (Real time, Real dt, MF const& S_old,
184 Array<MF,order> const& RK_k);
185
202 template <typename BC>
203 void fillRK (int stage, int iteration, int ncycle, MF& mf, Real time,
204 BC& cbc, BC& fbc, Vector<BCRec> const& bcs);
205
207 [[nodiscard]] InterpBase* interp () const noexcept { return m_interp; }
208
209private:
210
211 BoxArray m_fba;
212 BoxArray m_cba;
215 Geometry m_fgeom;
216 Geometry m_cgeom;
217 IntVect m_nghost;
218 int m_ncomp;
219 InterpBase* m_interp;
220 EB2::IndexSpace const* m_eb_index_space = nullptr;
221 MF m_sfine;
222 IntVect m_ratio;
224 std::unique_ptr<MF> m_cf_crse_data_tmp;
225 std::unique_ptr<MF> m_cf_fine_data;
226 Real m_dt_coarse = std::numeric_limits<Real>::lowest();
227
228 FabArrayBase::FPinfo const& getFPinfo ();
229};
230
231template <class MF>
233 Geometry const& fgeom,
234 BoxArray const& cba, DistributionMapping const& cdm, // NOLINT
235 Geometry const& cgeom,
236 IntVect const& nghost, int ncomp, InterpBase* interp,
237 EB2::IndexSpace const* eb_index_space)
238 : m_fba(fba),
239 m_cba(cba),
240 m_fdm(fdm),
241 m_cdm(cdm),
242 m_fgeom(fgeom),
243 m_cgeom(cgeom),
244 m_nghost(nghost),
245 m_ncomp(ncomp),
246 m_interp(interp),
247 m_eb_index_space(eb_index_space),
248 m_sfine(fba, fdm, 1, nghost, MFInfo().SetAlloc(false))
249{
250 static_assert(IsFabArray<MF>::value,
251 "FillPatcher<MF>: MF must be FabArray type");
253
254 for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
255 m_ratio[idim] = m_fgeom.Domain().length(idim) / m_cgeom.Domain().length(idim);
256 }
257 AMREX_ASSERT(m_fgeom.Domain() == amrex::refine(m_cgeom.Domain(),m_ratio));
258}
259
260template <class MF>
261template <typename BC, typename PreInterpHook, typename PostInterpHook>
262void
263FillPatcher<MF>::fill (MF& mf, IntVect const& nghost, Real time,
264 Vector<MF*> const& cmf, Vector<Real> const& ct,
265 Vector<MF*> const& fmf, Vector<Real> const& ft,
266 int scomp, int dcomp, int ncomp,
267 BC& cbc, int cbccomp,
268 BC& fbc, int fbccomp,
269 Vector<BCRec> const& bcs, int bcscomp,
270 PreInterpHook const& pre_interp,
271 PostInterpHook const& post_interp)
272{
273 BL_PROFILE("FillPatcher::fill()");
274
275 AMREX_ALWAYS_ASSERT(!cmf.empty() && cmf.size() == ct.size() &&
276 !fmf.empty() && fmf.size() == ft.size() &&
277 m_fba == fmf[0]->boxArray() && m_fdm == fmf[0]->DistributionMap());
278
279 fillCoarseFineBoundary(mf, nghost, time, cmf, ct, scomp, dcomp, ncomp,
280 cbc, cbccomp, bcs, bcscomp, pre_interp, post_interp);
281
282 FillPatchSingleLevel(mf, nghost, time, fmf, ft, scomp, dcomp, ncomp,
283 m_fgeom, fbc, fbccomp);
284}
285
286template <class MF>
289{
290 const InterpolaterBoxCoarsener& coarsener = m_interp->BoxCoarsener(m_ratio);
291 return FabArrayBase::TheFPinfo(m_sfine, m_sfine, m_nghost, coarsener,
292 m_fgeom, m_cgeom, m_eb_index_space);
293}
294
295template <class MF>
296template <typename BC, typename PreInterpHook, typename PostInterpHook>
297void
299 Vector<MF*> const& cmf,
300 Vector<Real> const& ct,
301 int scomp, int dcomp, int ncomp,
302 BC& cbc, int cbccomp,
303 Vector<BCRec> const& bcs, int bcscomp,
304 PreInterpHook const& pre_interp,
305 PostInterpHook const& post_interp)
306{
307 BL_PROFILE("FillPatcher::fillCFB");
308
309 AMREX_ALWAYS_ASSERT(!cmf.empty() && cmf.size() == ct.size() &&
310 nghost.allLE(m_nghost) &&
311 m_fba == mf.boxArray() &&
312 m_fdm == mf.DistributionMap() &&
313 m_cba == cmf[0]->boxArray() &&
314 m_cdm == cmf[0]->DistributionMap() &&
315 m_ncomp >= ncomp &&
316 m_ncomp == cmf[0]->nComp());
317
318 auto const& fpc = getFPinfo();
319
320 if ( ! fpc.ba_crse_patch.empty())
321 {
322 if (m_cf_fine_data == nullptr) {
323 m_cf_fine_data = std::make_unique<MF>
324 (detail::make_mf_fine_patch<MF>(fpc, m_ncomp));
325 }
326
327 int ncmfs = cmf.size();
328 for (int icmf = 0; icmf < ncmfs; ++icmf) {
329 Real t = ct[icmf];
330 auto it = std::find_if(m_cf_crse_data.begin(), m_cf_crse_data.end(),
331 [=] (auto const& x) {
332 return amrex::almostEqual(x.first,t,5);
333 });
334
335 if (it == std::end(m_cf_crse_data)) {
336 MF mf_crse_patch = detail::make_mf_crse_patch<MF>(fpc, m_ncomp);
337 mf_crse_patch.ParallelCopy(*cmf[icmf], m_cgeom.periodicity());
338
339 std::pair<Real,std::unique_ptr<MF>> tmp;
340 tmp.first = t;
341 tmp.second = std::make_unique<MF>(std::move(mf_crse_patch));
342 m_cf_crse_data.push_back(std::move(tmp));
343 }
344 }
345
346 if (m_cf_crse_data_tmp == nullptr) {
347 m_cf_crse_data_tmp = std::make_unique<MF>
348 (detail::make_mf_crse_patch<MF>(fpc, m_ncomp));
349 }
350
351 // Big enough to cover the coarse patch and the interp stencil
352 IntVect const ng_space_interp = m_nghost/m_ratio + 8;
353 Box domain = m_cgeom.growPeriodicDomain(ng_space_interp);
354 domain.convert(mf.ixType());
355
356 int idata = -1;
357 if (m_cf_crse_data.size() == 1) {
358 idata = 0;
359 } else if (m_cf_crse_data.size() == 2) {
360 Real const teps = std::abs(m_cf_crse_data[1].first -
361 m_cf_crse_data[0].first) * 1.e-3_rt;
362 if (time > m_cf_crse_data[0].first - teps &&
363 time < m_cf_crse_data[0].first + teps) {
364 idata = 0;
365 } else if (time > m_cf_crse_data[1].first - teps &&
366 time < m_cf_crse_data[1].first + teps) {
367 idata = 1;
368 } else {
369 idata = 2;
370 }
371 }
372
373 if (idata == 0 || idata == 1) {
374 auto const& dst = m_cf_crse_data_tmp->arrays();
375 auto const& src = m_cf_crse_data[idata].second->const_arrays();
376 amrex::ParallelFor(*m_cf_crse_data_tmp, IntVect(0), ncomp,
377 [=] AMREX_GPU_DEVICE (int bi, int i, int j, int k, int n) noexcept
378 {
379 if (domain.contains(i,j,k)) {
380 dst[bi](i,j,k,n) = src[bi](i,j,k,n+scomp);
381 }
382 });
383 } else if (idata == 2) {
384 Real t0 = m_cf_crse_data[0].first;
385 Real t1 = m_cf_crse_data[1].first;
386 Real alpha = (t1-time)/(t1-t0);
387 Real beta = (time-t0)/(t1-t0);
388 auto const& a = m_cf_crse_data_tmp->arrays();
389 auto const& a0 = m_cf_crse_data[0].second->const_arrays();
390 auto const& a1 = m_cf_crse_data[1].second->const_arrays();
391 amrex::ParallelFor(*m_cf_crse_data_tmp, IntVect(0), ncomp,
392 [=] AMREX_GPU_DEVICE (int bi, int i, int j, int k, int n) noexcept
393 {
394 if (domain.contains(i,j,k)) {
395 a[bi](i,j,k,n)
396 = alpha*a0[bi](i,j,k,scomp+n)
397 + beta*a1[bi](i,j,k,scomp+n);
398 }
399 });
400 }
401 else
402 {
403 amrex::Abort("FillPatcher: High order interpolation in time not supported. Or FillPatcher was not properly deleted.");
404 }
405 // Sync required: user callback cbc may read fab on host (e.g. if pinned)
407
408 cbc(*m_cf_crse_data_tmp, 0, ncomp, m_cf_crse_data_tmp->nGrowVect(), time, cbccomp);
409
410 detail::call_interp_hook(pre_interp, *m_cf_crse_data_tmp, 0, ncomp);
411
412 FillPatchInterp(*m_cf_fine_data, scomp, *m_cf_crse_data_tmp, 0,
413 ncomp, IntVect(0), m_cgeom, m_fgeom,
414 amrex::grow(amrex::convert(m_fgeom.Domain(),
415 mf.ixType()),nghost),
416 m_ratio, m_interp, bcs, bcscomp);
417
418 detail::call_interp_hook(post_interp, *m_cf_fine_data, scomp, ncomp);
419
420 mf.ParallelCopy(*m_cf_fine_data, scomp, dcomp, ncomp, IntVect{0}, nghost);
421 }
422}
423
424template <typename MF>
425template <std::size_t order>
426requires (order == 3 || order == 4)
427void FillPatcher<MF>::storeRKCoarseData (Real /*time*/, Real dt, MF const& S_old,
428 Array<MF,order> const& RK_k)
429{
430 BL_PROFILE("FillPatcher::storeRKCoarseData()");
431 m_dt_coarse = dt;
432 m_cf_crse_data.resize(order+1);
433
434 auto const& fpc = getFPinfo();
435
436 for (auto& tmf : m_cf_crse_data) {
437 tmf.first = std::numeric_limits<Real>::lowest(); // because we don't need it
438 tmf.second = std::make_unique<MF>(detail::make_mf_crse_patch<MF>(fpc, m_ncomp));
439 }
440 m_cf_crse_data[0].second->ParallelCopy(S_old, m_cgeom.periodicity());
441 for (std::size_t i = 0; i < order; ++i) {
442 m_cf_crse_data[i+1].second->ParallelCopy(RK_k[i], m_cgeom.periodicity());
443 }
444}
445
446template <typename MF>
447template <typename BC>
448void FillPatcher<MF>::fillRK (int stage, int iteration, int ncycle,
449 MF& mf, Real time, BC& cbc, BC& fbc,
450 Vector<BCRec> const& bcs)
451{
452 BL_PROFILE("FillPatcher::fillRK()");
453 int rk_order = m_cf_crse_data.size()-1;
454 if (rk_order != 3 && rk_order != 4) {
455 amrex::Abort("FillPatcher: unsupported RK order "+std::to_string(rk_order));
456 return;
457 }
458 AMREX_ASSERT(stage > 0 && stage <= rk_order);
459
460 auto const& fpc = getFPinfo();
461 if (m_cf_crse_data_tmp == nullptr) {
462 m_cf_crse_data_tmp = std::make_unique<MF>
463 (detail::make_mf_crse_patch<MF>(fpc, m_ncomp));
464 }
465
466 auto const& u = m_cf_crse_data_tmp->arrays();
467 auto const& u0 = m_cf_crse_data[0].second->const_arrays();
468 auto const& k1 = m_cf_crse_data[1].second->const_arrays();
469 auto const& k2 = m_cf_crse_data[2].second->const_arrays();
470 auto const& k3 = m_cf_crse_data[3].second->const_arrays();
471
472 Real dtc = m_dt_coarse;
473 Real r = Real(1) / Real(ncycle);
474 Real xsi = Real(iteration-1) / Real(ncycle);
475
476 IntVect const ng_space_interp = m_nghost/m_ratio + 8;
477 Box cdomain = m_cgeom.growPeriodicDomain(ng_space_interp);
478 cdomain.convert(m_cf_crse_data_tmp->ixType());
479
480 if (rk_order == 3) {
481 // coefficients for U
482 Real b1 = xsi - Real(5./6.)*xsi*xsi;
483 Real b2 = Real(1./6.)*xsi*xsi;
484 Real b3 = Real(2./3)*xsi*xsi;
485 // coefficients for Ut
486 Real c1 = Real(1.) - Real(5./3.)*xsi;
487 Real c2 = Real(1./3.)*xsi;
488 Real c3 = Real(4./3.)*xsi;
489 // coefficients for Utt
490 constexpr Real d1 = Real(-5./3.);
491 constexpr Real d2 = Real(1./3.);
492 constexpr Real d3 = Real(4./3.);
493 if (stage == 1) {
494 amrex::ParallelFor(*m_cf_crse_data_tmp, IntVect(0), m_ncomp,
495 [=] AMREX_GPU_DEVICE (int bi, int i, int j, int k, int n) noexcept
496 {
497 if (cdomain.contains(i,j,k)) {
498 Real kk1 = k1[bi](i,j,k,n);
499 Real kk2 = k2[bi](i,j,k,n);
500 Real kk3 = k3[bi](i,j,k,n);
501 Real uu = b1*kk1 + b2*kk2 + b3*kk3;
502 u[bi](i,j,k,n) = u0[bi](i,j,k,n) + dtc*uu;
503 }
504 });
505 } else if (stage == 2) {
506 amrex::ParallelFor(*m_cf_crse_data_tmp, IntVect(0), m_ncomp,
507 [=] AMREX_GPU_DEVICE (int bi, int i, int j, int k, int n) noexcept
508 {
509 if (cdomain.contains(i,j,k)) {
510 Real kk1 = k1[bi](i,j,k,n);
511 Real kk2 = k2[bi](i,j,k,n);
512 Real kk3 = k3[bi](i,j,k,n);
513 Real uu = b1*kk1 + b2*kk2 + b3*kk3;
514 Real ut = c1*kk1 + c2*kk2 + c3*kk3;
515 u[bi](i,j,k,n) = u0[bi](i,j,k,n) + dtc*(uu + r*ut);
516 }
517 });
518 } else if (stage == 3) {
519 amrex::ParallelFor(*m_cf_crse_data_tmp, IntVect(0), m_ncomp,
520 [=] AMREX_GPU_DEVICE (int bi, int i, int j, int k, int n) noexcept
521 {
522 if (cdomain.contains(i,j,k)) {
523 Real kk1 = k1[bi](i,j,k,n);
524 Real kk2 = k2[bi](i,j,k,n);
525 Real kk3 = k3[bi](i,j,k,n);
526 Real uu = b1*kk1 + b2*kk2 + b3*kk3;
527 Real ut = c1*kk1 + c2*kk2 + c3*kk3;
528 Real utt = d1*kk1 + d2*kk2 + d3*kk3;
529 u[bi](i,j,k,n) = u0[bi](i,j,k,n) + dtc*
530 (uu + Real(0.5)*r*ut + Real(0.25)*r*r*utt);
531 }
532 });
533 }
534 } else if (rk_order == 4) {
535 auto const& k4 = m_cf_crse_data[4].second->const_arrays();
536 Real xsi2 = xsi*xsi;
537 Real xsi3 = xsi2*xsi;
538 // coefficients for U
539 Real b1 = xsi - Real(1.5)*xsi2 + Real(2./3.)*xsi3;
540 Real b2 = xsi2 - Real(2./3.)*xsi3;
541 Real b3 = b2;
542 Real b4 = Real(-0.5)*xsi2 + Real(2./3.)*xsi3;
543 // coefficients for Ut
544 Real c1 = Real(1.) - Real(3.)*xsi + Real(2.)*xsi2;
545 Real c2 = Real(2.)*xsi - Real(2.)*xsi2;
546 Real c3 = c2;
547 Real c4 = -xsi + Real(2.)*xsi2;
548 // coefficients for Utt
549 Real d1 = Real(-3.) + Real(4.)*xsi;
550 Real d2 = Real( 2.) - Real(4.)*xsi;
551 Real d3 = d2;
552 Real d4 = Real(-1.) + Real(4.)*xsi;
553 // coefficients for Uttt
554 constexpr Real e1 = Real( 4.);
555 constexpr Real e2 = Real(-4.);
556 constexpr Real e3 = Real(-4.);
557 constexpr Real e4 = Real( 4.);
558 if (stage == 1) {
559 amrex::ParallelFor(*m_cf_crse_data_tmp, IntVect(0), m_ncomp,
560 [=] AMREX_GPU_DEVICE (int bi, int i, int j, int k, int n) noexcept
561 {
562 if (cdomain.contains(i,j,k)) {
563 Real kk1 = k1[bi](i,j,k,n);
564 Real kk2 = k2[bi](i,j,k,n);
565 Real kk3 = k3[bi](i,j,k,n);
566 Real kk4 = k4[bi](i,j,k,n);
567 Real uu = b1*kk1 + b2*kk2 + b3*kk3 + b4*kk4;
568 u[bi](i,j,k,n) = u0[bi](i,j,k,n) + dtc*uu;
569 }
570 });
571 } else if (stage == 2) {
572 amrex::ParallelFor(*m_cf_crse_data_tmp, IntVect(0), m_ncomp,
573 [=] AMREX_GPU_DEVICE (int bi, int i, int j, int k, int n) noexcept
574 {
575 if (cdomain.contains(i,j,k)) {
576 Real kk1 = k1[bi](i,j,k,n);
577 Real kk2 = k2[bi](i,j,k,n);
578 Real kk3 = k3[bi](i,j,k,n);
579 Real kk4 = k4[bi](i,j,k,n);
580 Real uu = b1*kk1 + b2*kk2 + b3*kk3 + b4*kk4;
581 Real ut = c1*kk1 + c2*kk2 + c3*kk3 + c4*kk4;
582 u[bi](i,j,k,n) = u0[bi](i,j,k,n) + dtc*(uu + Real(0.5)*r*ut);
583 }
584 });
585 } else if (stage == 3 || stage == 4) {
586 Real r2 = r*r;
587 Real r3 = r2*r;
588 Real at = (stage == 3) ? Real(0.5)*r : r;
589 Real att = (stage == 3) ? Real(0.25)*r2 : Real(0.5)*r2;
590 Real attt = (stage == 3) ? Real(0.0625)*r3 : Real(0.125)*r3;
591 Real akk = (stage == 3) ? Real(-4.) : Real(4.);
592 amrex::ParallelFor(*m_cf_crse_data_tmp, IntVect(0), m_ncomp,
593 [=] AMREX_GPU_DEVICE (int bi, int i, int j, int k, int n) noexcept
594 {
595 if (cdomain.contains(i,j,k)) {
596 Real kk1 = k1[bi](i,j,k,n);
597 Real kk2 = k2[bi](i,j,k,n);
598 Real kk3 = k3[bi](i,j,k,n);
599 Real kk4 = k4[bi](i,j,k,n);
600 Real uu = b1*kk1 + b2*kk2 + b3*kk3 + b4*kk4;
601 Real ut = c1*kk1 + c2*kk2 + c3*kk3 + c4*kk4;
602 Real utt = d1*kk1 + d2*kk2 + d3*kk3 + d4*kk4;
603 Real uttt = e1*kk1 + e2*kk2 + e3*kk3 + e4*kk4;
604 u[bi](i,j,k,n) = u0[bi](i,j,k,n) + dtc *
605 (uu + at*ut + att*utt + attt*(uttt+akk*(kk3-kk2)));
606 }
607 });
608 }
609 }
610 // Sync required: user callback cbc may read fab on host (e.g. if pinned)
612
613 cbc(*m_cf_crse_data_tmp, 0, m_ncomp, m_cf_crse_data_tmp->nGrowVect(), time, 0);
614
615 if (m_cf_fine_data == nullptr) {
616 m_cf_fine_data = std::make_unique<MF>(detail::make_mf_fine_patch<MF>(fpc, m_ncomp));
617 }
618
619 FillPatchInterp(*m_cf_fine_data, 0, *m_cf_crse_data_tmp, 0,
620 m_ncomp, IntVect(0), m_cgeom, m_fgeom,
621 amrex::grow(amrex::convert(m_fgeom.Domain(),
622 mf.ixType()),m_nghost),
623 m_ratio, m_interp, bcs, 0);
624
625 // xxxxx We can optimize away this ParallelCopy by making a special fpinfo.
626 mf.ParallelCopy(*m_cf_fine_data, 0, 0, m_ncomp, IntVect(0), m_nghost);
627
628 mf.FillBoundary(m_fgeom.periodicity());
629 fbc(mf, 0, m_ncomp, m_nghost, time, 0);
630}
631
632}
633
634#endif
#define BL_PROFILE(a)
Definition AMReX_BLProfiler.H:562
#define AMREX_ASSERT(EX)
Definition AMReX_BLassert.H:38
#define AMREX_ALWAYS_ASSERT(EX)
Definition AMReX_BLassert.H:50
High-level FillPatch helpers for AMR coarse-to-fine synchronization.
#define AMREX_GPU_DEVICE
Definition AMReX_GpuQualifiers.H:18
GpuArray< Real, 3 > beta
Definition AMReX_MLEBNodeFDLaplacian.cpp:1099
Reference-counted collection of Boxes.
Definition AMReX_BoxArray.H:681
IndexType ixType() const noexcept
Return index type of this BoxArray.
Definition AMReX_BoxArray.H:1268
__host__ __device__ IntVectND< dim > length() const noexcept
Return the length of the BoxND.
Definition AMReX_Box.H:167
__host__ __device__ BoxND & convert(IndexTypeND< dim > typ) noexcept
Convert the BoxND from the current type into the argument type. This may change the BoxND coordinates...
Definition AMReX_Box.H:1008
__host__ __device__ bool contains(const IntVectND< dim > &p) const noexcept
Return true if argument is contained within BoxND.
Definition AMReX_Box.H:233
Calculates the distribution of FABs to MPI processes.
Definition AMReX_DistributionMapping.H:51
Definition AMReX_EB2.H:28
static const FPinfo & TheFPinfo(const FabArrayBase &srcfa, const FabArrayBase &dstfa, const IntVect &dstng, const BoxConverter &coarsener, const Geometry &fgeom, const Geometry &cgeom, const EB2::IndexSpace *)
Definition AMReX_FabArrayBase.cpp:2074
FillPatcher is for filling a fine level MultiFab/FabArray.
Definition AMReX_FillPatcher.H:78
InterpBase * interp() const noexcept
Interpolater this FillPatcher was built with.
Definition AMReX_FillPatcher.H:207
void storeRKCoarseData(Real time, Real dt, MF const &S_old, Array< MF, order > const &RK_k)
Store coarse AMR level data for RK3 and RK4.
Definition AMReX_FillPatcher.H:427
void fillCoarseFineBoundary(MF &mf, IntVect const &nghost, Real time, Vector< MF * > const &cmf, Vector< Real > const &ct, int scomp, int dcomp, int ncomp, BC &cbc, int cbccomp, Vector< BCRec > const &bcs, int bcscomp, PreInterpHook const &pre_interp={}, PostInterpHook const &post_interp={})
Function to fill data at coarse/fine boundary only.
Definition AMReX_FillPatcher.H:298
void fill(MF &mf, IntVect const &nghost, Real time, Vector< MF * > const &cmf, Vector< Real > const &ct, Vector< MF * > const &fmf, Vector< Real > const &ft, int scomp, int dcomp, int ncomp, BC &cbc, int cbccomp, BC &fbc, int fbccomp, Vector< BCRec > const &bcs, int bcscomp, PreInterpHook const &pre_interp={}, PostInterpHook const &post_interp={})
Function to fill data.
Definition AMReX_FillPatcher.H:263
void fillRK(int stage, int iteration, int ncycle, MF &mf, Real time, BC &cbc, BC &fbc, Vector< BCRec > const &bcs)
Fill ghost cells of fine AMR level for RK3 and RK4.
Definition AMReX_FillPatcher.H:448
FillPatcher(BoxArray const &fba, DistributionMapping const &fdm, Geometry const &fgeom, BoxArray const &cba, DistributionMapping const &cdm, Geometry const &cgeom, IntVect const &nghost, int ncomp, InterpBase *interp, EB2::IndexSpace const *eb_index_space=EB2::TopIndexSpaceIfPresent())
Constructor of FillPatcher.
Definition AMReX_FillPatcher.H:232
Rectangular problem domain geometry.
Definition AMReX_Geometry.H:85
const Box & Domain() const noexcept
Returns our rectangular domain.
Definition AMReX_Geometry.H:244
__host__ __device__ bool cellCentered() const noexcept
True if the IndexTypeND is CELL based in all directions.
Definition AMReX_IndexType.H:102
__host__ __device__ bool nodeCentered() const noexcept
True if the IndexTypeND is NODE based in all directions.
Definition AMReX_IndexType.H:108
__host__ __device__ constexpr bool allLE(const IntVectND< dim > &rhs) const noexcept
Returns true if this is less than or equal to argument for all components. NOTE: This is NOT a strict...
Definition AMReX_IntVect.H:492
Definition AMReX_InterpBase.H:34
Definition AMReX_InterpBase.H:20
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
amrex_real Real
Floating Point Type for Fields.
Definition AMReX_REAL.H:80
__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 > grow(const BoxND< dim > &b, int i) noexcept
Return a copy of b grown uniformly by i cells in every direction.
Definition AMReX_Box.H:1326
__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
const IndexSpace * TopIndexSpaceIfPresent() noexcept
Return the top IndexSpace if one has been built (nullptr otherwise).
Definition AMReX_EB2.cpp:93
void streamSynchronize() noexcept
Definition AMReX_GpuDevice.H:310
Definition AMReX_Amr.cpp:50
void ParallelFor(TypeList< CTOs... > ctos, std::array< int, sizeof...(CTOs)> const &runtime_options, T N, F &&f)
Definition AMReX_CTOParallelForImpl.H:202
void FillPatchSingleLevel(MF &mf, IntVect const &nghost, Real time, const Vector< MF * > &smf, const Vector< Real > &stime, int scomp, int dcomp, int ncomp, const Geometry &geom, BC &physbcf, int bcfcomp)
FillPatch with data from the current level.
Definition AMReX_FillPatchUtil_I.H:75
IntVectND< 3 > IntVect
IntVect is an alias for amrex::IntVectND instantiated with AMREX_SPACEDIM.
Definition AMReX_BaseFwd.H:38
void Abort(const std::string &msg)
Print a fatal-error message to stderr and abort execution.
Definition AMReX.cpp:242
void FillPatchInterp(MultiFab &mf_fine_patch, int fcomp, MultiFab const &mf_crse_patch, int ccomp, int ncomp, IntVect const &ng, const Geometry &cgeom, const Geometry &fgeom, Box const &dest_domain, const IntVect &ratio, MFInterpolater *mapper, const Vector< BCRec > &bcs, int bcscomp)
Helper that applies a MFInterpolater to fill a fine patch from a coarse patch.
Definition AMReX_FillPatchUtil.cpp:138
Definition AMReX_FabArrayBase.H:322
Definition AMReX_TypeTraits.H:27
FabArray memory allocation information.
Definition AMReX_FabArray.H:73
Definition AMReX_FillPatchUtil.H:39