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
8namespace amrex {
9
71template <class MF = MultiFab>
73{
74public:
75
90 FillPatcher (BoxArray const& fba, DistributionMapping const& fdm,
91 Geometry const& fgeom,
92 BoxArray const& cba, DistributionMapping const& cdm, // NOLINT
93 Geometry const& cgeom,
94 IntVect const& nghost, int ncomp, InterpBase* interp,
95#ifdef AMREX_USE_EB
96 EB2::IndexSpace const* eb_index_space = EB2::TopIndexSpaceIfPresent());
97#else
98 EB2::IndexSpace const* eb_index_space = nullptr);
99#endif
100
124 template <typename BC,
125 typename PreInterpHook=NullInterpHook<MF>,
126 typename PostInterpHook=NullInterpHook<MF> >
127 void fill (MF& mf, IntVect const& nghost, Real time,
128 Vector<MF*> const& cmf, Vector<Real> const& ct,
129 Vector<MF*> const& fmf, Vector<Real> const& ft,
130 int scomp, int dcomp, int ncomp,
131 BC& cbc, int cbccomp, BC& fbc, int fbccomp,
132 Vector<BCRec> const& bcs, int bcscomp,
133 PreInterpHook const& pre_interp = {},
134 PostInterpHook const& post_interp = {});
135
155 template <typename BC,
156 typename PreInterpHook=NullInterpHook<MF>,
157 typename PostInterpHook=NullInterpHook<MF> >
158 void fillCoarseFineBoundary (MF& mf, IntVect const& nghost, Real time,
159 Vector<MF*> const& cmf,
160 Vector<Real> const& ct,
161 int scomp, int dcomp, int ncomp,
162 BC& cbc, int cbccomp,
163 Vector<BCRec> const& bcs, int bcscomp,
164 PreInterpHook const& pre_interp = {},
165 PostInterpHook const& post_interp = {});
166
176 template <std::size_t order>
177 void storeRKCoarseData (Real time, Real dt, MF const& S_old,
178 Array<MF,order> const& RK_k);
179
196 template <typename BC>
197 void fillRK (int stage, int iteration, int ncycle, MF& mf, Real time,
198 BC& cbc, BC& fbc, Vector<BCRec> const& bcs);
199
200private:
201
215 std::unique_ptr<MF> m_cf_crse_data_tmp;
216 std::unique_ptr<MF> m_cf_fine_data;
217 Real m_dt_coarse = std::numeric_limits<Real>::lowest();
218
220};
221
222template <class MF>
224 Geometry const& fgeom,
225 BoxArray const& cba, DistributionMapping const& cdm, // NOLINT
226 Geometry const& cgeom,
227 IntVect const& nghost, int ncomp, InterpBase* interp,
228 EB2::IndexSpace const* eb_index_space)
229 : m_fba(fba),
230 m_cba(cba),
231 m_fdm(fdm),
232 m_cdm(cdm),
233 m_fgeom(fgeom),
234 m_cgeom(cgeom),
235 m_nghost(nghost),
236 m_ncomp(ncomp),
237 m_interp(interp),
238 m_eb_index_space(eb_index_space),
239 m_sfine(fba, fdm, 1, nghost, MFInfo().SetAlloc(false))
240{
241 static_assert(IsFabArray<MF>::value,
242 "FillPatcher<MF>: MF must be FabArray type");
244
245 for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) {
246 m_ratio[idim] = m_fgeom.Domain().length(idim) / m_cgeom.Domain().length(idim);
247 }
249}
250
251template <class MF>
252template <typename BC, typename PreInterpHook, typename PostInterpHook>
253void
254FillPatcher<MF>::fill (MF& mf, IntVect const& nghost, Real time,
255 Vector<MF*> const& cmf, Vector<Real> const& ct,
256 Vector<MF*> const& fmf, Vector<Real> const& ft,
257 int scomp, int dcomp, int ncomp,
258 BC& cbc, int cbccomp,
259 BC& fbc, int fbccomp,
260 Vector<BCRec> const& bcs, int bcscomp,
261 PreInterpHook const& pre_interp,
262 PostInterpHook const& post_interp)
263{
264 BL_PROFILE("FillPatcher::fill()");
265
266 AMREX_ALWAYS_ASSERT(m_fba == fmf[0]->boxArray() &&
267 m_fdm == fmf[0]->DistributionMap());
268
269 fillCoarseFineBoundary(mf, nghost, time, cmf, ct, scomp, dcomp, ncomp,
270 cbc, cbccomp, bcs, bcscomp, pre_interp, post_interp);
271
272 FillPatchSingleLevel(mf, nghost, time, fmf, ft, scomp, dcomp, ncomp,
273 m_fgeom, fbc, fbccomp);
274}
275
276template <class MF>
279{
280 const InterpolaterBoxCoarsener& coarsener = m_interp->BoxCoarsener(m_ratio);
281 return FabArrayBase::TheFPinfo(m_sfine, m_sfine, m_nghost, coarsener,
282 m_fgeom, m_cgeom, m_eb_index_space);
283}
284
285template <class MF>
286template <typename BC, typename PreInterpHook, typename PostInterpHook>
287void
288FillPatcher<MF>::fillCoarseFineBoundary (MF& mf, IntVect const& nghost, Real time,
289 Vector<MF*> const& cmf,
290 Vector<Real> const& ct,
291 int scomp, int dcomp, int ncomp,
292 BC& cbc, int cbccomp,
293 Vector<BCRec> const& bcs, int bcscomp,
294 PreInterpHook const& pre_interp,
295 PostInterpHook const& post_interp)
296{
297 BL_PROFILE("FillPatcher::fillCFB");
298
299 AMREX_ALWAYS_ASSERT(nghost.allLE(m_nghost) &&
300 m_fba == mf.boxArray() &&
301 m_fdm == mf.DistributionMap() &&
302 m_cba == cmf[0]->boxArray() &&
303 m_cdm == cmf[0]->DistributionMap() &&
304 m_ncomp >= ncomp &&
305 m_ncomp == cmf[0]->nComp());
306
307 auto const& fpc = getFPinfo();
308
309 if ( ! fpc.ba_crse_patch.empty())
310 {
311 if (m_cf_fine_data == nullptr) {
312 m_cf_fine_data = std::make_unique<MF>
313 (detail::make_mf_fine_patch<MF>(fpc, m_ncomp));
314 }
315
316 int ncmfs = cmf.size();
317 for (int icmf = 0; icmf < ncmfs; ++icmf) {
318 Real t = ct[icmf];
319 auto it = std::find_if(m_cf_crse_data.begin(), m_cf_crse_data.end(),
320 [=] (auto const& x) {
321 return amrex::almostEqual(x.first,t,5);
322 });
323
324 if (it == std::end(m_cf_crse_data)) {
325 MF mf_crse_patch = detail::make_mf_crse_patch<MF>(fpc, m_ncomp);
326 mf_crse_patch.ParallelCopy(*cmf[icmf], m_cgeom.periodicity());
327
328 std::pair<Real,std::unique_ptr<MF>> tmp;
329 tmp.first = t;
330 tmp.second = std::make_unique<MF>(std::move(mf_crse_patch));
331 m_cf_crse_data.push_back(std::move(tmp));
332 }
333 }
334
335 if (m_cf_crse_data_tmp == nullptr) {
336 m_cf_crse_data_tmp = std::make_unique<MF>
337 (detail::make_mf_crse_patch<MF>(fpc, m_ncomp));
338 }
339
340 int const ng_space_interp = 8; // Need to be big enough
341 Box domain = m_cgeom.growPeriodicDomain(ng_space_interp);
342 domain.convert(mf.ixType());
343
344 int idata = -1;
345 if (m_cf_crse_data.size() == 1) {
346 idata = 0;
347 } else if (m_cf_crse_data.size() == 2) {
348 Real const teps = std::abs(m_cf_crse_data[1].first -
349 m_cf_crse_data[0].first) * 1.e-3_rt;
350 if (time > m_cf_crse_data[0].first - teps &&
351 time < m_cf_crse_data[0].first + teps) {
352 idata = 0;
353 } else if (time > m_cf_crse_data[1].first - teps &&
354 time < m_cf_crse_data[1].first + teps) {
355 idata = 1;
356 } else {
357 idata = 2;
358 }
359 }
360
361 if (idata == 0 || idata == 1) {
362 auto const& dst = m_cf_crse_data_tmp->arrays();
363 auto const& src = m_cf_crse_data[idata].second->const_arrays();
364 amrex::ParallelFor(*m_cf_crse_data_tmp, IntVect(0), ncomp,
365 [=] AMREX_GPU_DEVICE (int bi, int i, int j, int k, int n) noexcept
366 {
367 if (domain.contains(i,j,k)) {
368 dst[bi](i,j,k,n) = src[bi](i,j,k,n+scomp);
369 }
370 });
371 } else if (idata == 2) {
372 Real t0 = m_cf_crse_data[0].first;
373 Real t1 = m_cf_crse_data[1].first;
374 Real alpha = (t1-time)/(t1-t0);
375 Real beta = (time-t0)/(t1-t0);
376 auto const& a = m_cf_crse_data_tmp->arrays();
377 auto const& a0 = m_cf_crse_data[0].second->const_arrays();
378 auto const& a1 = m_cf_crse_data[1].second->const_arrays();
379 amrex::ParallelFor(*m_cf_crse_data_tmp, IntVect(0), ncomp,
380 [=] AMREX_GPU_DEVICE (int bi, int i, int j, int k, int n) noexcept
381 {
382 if (domain.contains(i,j,k)) {
383 a[bi](i,j,k,n)
384 = alpha*a0[bi](i,j,k,scomp+n)
385 + beta*a1[bi](i,j,k,scomp+n);
386 }
387 });
388 }
389 else
390 {
391 amrex::Abort("FillPatcher: High order interpolation in time not supported. Or FillPatcher was not properly deleted.");
392 }
394
395 cbc(*m_cf_crse_data_tmp, 0, ncomp, m_cf_crse_data_tmp->nGrowVect(), time, cbccomp);
396
397 detail::call_interp_hook(pre_interp, *m_cf_crse_data_tmp, 0, ncomp);
398
399 FillPatchInterp(*m_cf_fine_data, scomp, *m_cf_crse_data_tmp, 0,
400 ncomp, IntVect(0), m_cgeom, m_fgeom,
401 amrex::grow(amrex::convert(m_fgeom.Domain(),
402 mf.ixType()),nghost),
403 m_ratio, m_interp, bcs, bcscomp);
404
405 detail::call_interp_hook(post_interp, *m_cf_fine_data, scomp, ncomp);
406
407 mf.ParallelCopy(*m_cf_fine_data, scomp, dcomp, ncomp, IntVect{0}, nghost);
408 }
409}
410
411template <typename MF>
412template <std::size_t order>
413void FillPatcher<MF>::storeRKCoarseData (Real /*time*/, Real dt, MF const& S_old,
414 Array<MF,order> const& RK_k)
415{
416 BL_PROFILE("FillPatcher::storeRKCoarseData()");
417 m_dt_coarse = dt;
418 m_cf_crse_data.resize(order+1);
419
420 auto const& fpc = getFPinfo();
421
422 for (auto& tmf : m_cf_crse_data) {
423 tmf.first = std::numeric_limits<Real>::lowest(); // because we don't need it
424 tmf.second = std::make_unique<MF>(detail::make_mf_crse_patch<MF>(fpc, m_ncomp));
425 }
426 m_cf_crse_data[0].second->ParallelCopy(S_old, m_cgeom.periodicity());
427 for (std::size_t i = 0; i < order; ++i) {
428 m_cf_crse_data[i+1].second->ParallelCopy(RK_k[i], m_cgeom.periodicity());
429 }
430}
431
432template <typename MF>
433template <typename BC>
434void FillPatcher<MF>::fillRK (int stage, int iteration, int ncycle,
435 MF& mf, Real time, BC& cbc, BC& fbc,
436 Vector<BCRec> const& bcs)
437{
438 BL_PROFILE("FillPatcher::fillRK()");
439 int rk_order = m_cf_crse_data.size()-1;
440 if (rk_order != 3 && rk_order != 4) {
441 amrex::Abort("FillPatcher: unsupported RK order "+std::to_string(rk_order));
442 return;
443 }
444 AMREX_ASSERT(stage > 0 && stage <= rk_order);
445
446 auto const& fpc = getFPinfo();
447 if (m_cf_crse_data_tmp == nullptr) {
448 m_cf_crse_data_tmp = std::make_unique<MF>
449 (detail::make_mf_crse_patch<MF>(fpc, m_ncomp));
450 }
451
452 auto const& u = m_cf_crse_data_tmp->arrays();
453 auto const& u0 = m_cf_crse_data[0].second->const_arrays();
454 auto const& k1 = m_cf_crse_data[1].second->const_arrays();
455 auto const& k2 = m_cf_crse_data[2].second->const_arrays();
456 auto const& k3 = m_cf_crse_data[3].second->const_arrays();
457
458 Real dtc = m_dt_coarse;
459 Real r = Real(1) / Real(ncycle);
460 Real xsi = Real(iteration-1) / Real(ncycle);
461
462 int const ng_space_interp = 8; // Need to be big enough
463 Box cdomain = m_cgeom.growPeriodicDomain(ng_space_interp);
464 cdomain.convert(m_cf_crse_data_tmp->ixType());
465
466 if (rk_order == 3) {
467 // coefficients for U
468 Real b1 = xsi - Real(5./6.)*xsi*xsi;
469 Real b2 = Real(1./6.)*xsi*xsi;
470 Real b3 = Real(2./3)*xsi*xsi;
471 // coefficients for Ut
472 Real c1 = Real(1.) - Real(5./3.)*xsi;
473 Real c2 = Real(1./3.)*xsi;
474 Real c3 = Real(4./3.)*xsi;
475 // coefficients for Utt
476 constexpr Real d1 = Real(-5./3.);
477 constexpr Real d2 = Real(1./3.);
478 constexpr Real d3 = Real(4./3.);
479 if (stage == 1) {
480 amrex::ParallelFor(*m_cf_crse_data_tmp, IntVect(0), m_ncomp,
481 [=] AMREX_GPU_DEVICE (int bi, int i, int j, int k, int n) noexcept
482 {
483 if (cdomain.contains(i,j,k)) {
484 Real kk1 = k1[bi](i,j,k,n);
485 Real kk2 = k2[bi](i,j,k,n);
486 Real kk3 = k3[bi](i,j,k,n);
487 Real uu = b1*kk1 + b2*kk2 + b3*kk3;
488 u[bi](i,j,k,n) = u0[bi](i,j,k,n) + dtc*uu;
489 }
490 });
491 } else if (stage == 2) {
492 amrex::ParallelFor(*m_cf_crse_data_tmp, IntVect(0), m_ncomp,
493 [=] AMREX_GPU_DEVICE (int bi, int i, int j, int k, int n) noexcept
494 {
495 if (cdomain.contains(i,j,k)) {
496 Real kk1 = k1[bi](i,j,k,n);
497 Real kk2 = k2[bi](i,j,k,n);
498 Real kk3 = k3[bi](i,j,k,n);
499 Real uu = b1*kk1 + b2*kk2 + b3*kk3;
500 Real ut = c1*kk1 + c2*kk2 + c3*kk3;
501 u[bi](i,j,k,n) = u0[bi](i,j,k,n) + dtc*(uu + r*ut);
502 }
503 });
504 } else if (stage == 3) {
505 amrex::ParallelFor(*m_cf_crse_data_tmp, IntVect(0), m_ncomp,
506 [=] AMREX_GPU_DEVICE (int bi, int i, int j, int k, int n) noexcept
507 {
508 if (cdomain.contains(i,j,k)) {
509 Real kk1 = k1[bi](i,j,k,n);
510 Real kk2 = k2[bi](i,j,k,n);
511 Real kk3 = k3[bi](i,j,k,n);
512 Real uu = b1*kk1 + b2*kk2 + b3*kk3;
513 Real ut = c1*kk1 + c2*kk2 + c3*kk3;
514 Real utt = d1*kk1 + d2*kk2 + d3*kk3;
515 u[bi](i,j,k,n) = u0[bi](i,j,k,n) + dtc*
516 (uu + Real(0.5)*r*ut + Real(0.25)*r*r*utt);
517 }
518 });
519 }
520 } else if (rk_order == 4) {
521 auto const& k4 = m_cf_crse_data[4].second->const_arrays();
522 Real xsi2 = xsi*xsi;
523 Real xsi3 = xsi2*xsi;
524 // coefficients for U
525 Real b1 = xsi - Real(1.5)*xsi2 + Real(2./3.)*xsi3;
526 Real b2 = xsi2 - Real(2./3.)*xsi3;
527 Real b3 = b2;
528 Real b4 = Real(-0.5)*xsi2 + Real(2./3.)*xsi3;
529 // coefficients for Ut
530 Real c1 = Real(1.) - Real(3.)*xsi + Real(2.)*xsi2;
531 Real c2 = Real(2.)*xsi - Real(2.)*xsi2;
532 Real c3 = c2;
533 Real c4 = -xsi + Real(2.)*xsi2;
534 // coefficients for Utt
535 Real d1 = Real(-3.) + Real(4.)*xsi;
536 Real d2 = Real( 2.) - Real(4.)*xsi;
537 Real d3 = d2;
538 Real d4 = Real(-1.) + Real(4.)*xsi;
539 // coefficients for Uttt
540 constexpr Real e1 = Real( 4.);
541 constexpr Real e2 = Real(-4.);
542 constexpr Real e3 = Real(-4.);
543 constexpr Real e4 = Real( 4.);
544 if (stage == 1) {
545 amrex::ParallelFor(*m_cf_crse_data_tmp, IntVect(0), m_ncomp,
546 [=] AMREX_GPU_DEVICE (int bi, int i, int j, int k, int n) noexcept
547 {
548 if (cdomain.contains(i,j,k)) {
549 Real kk1 = k1[bi](i,j,k,n);
550 Real kk2 = k2[bi](i,j,k,n);
551 Real kk3 = k3[bi](i,j,k,n);
552 Real kk4 = k4[bi](i,j,k,n);
553 Real uu = b1*kk1 + b2*kk2 + b3*kk3 + b4*kk4;
554 u[bi](i,j,k,n) = u0[bi](i,j,k,n) + dtc*uu;
555 }
556 });
557 } else if (stage == 2) {
558 amrex::ParallelFor(*m_cf_crse_data_tmp, IntVect(0), m_ncomp,
559 [=] AMREX_GPU_DEVICE (int bi, int i, int j, int k, int n) noexcept
560 {
561 if (cdomain.contains(i,j,k)) {
562 Real kk1 = k1[bi](i,j,k,n);
563 Real kk2 = k2[bi](i,j,k,n);
564 Real kk3 = k3[bi](i,j,k,n);
565 Real kk4 = k4[bi](i,j,k,n);
566 Real uu = b1*kk1 + b2*kk2 + b3*kk3 + b4*kk4;
567 Real ut = c1*kk1 + c2*kk2 + c3*kk3 + c4*kk4;
568 u[bi](i,j,k,n) = u0[bi](i,j,k,n) + dtc*(uu + Real(0.5)*r*ut);
569 }
570 });
571 } else if (stage == 3 || stage == 4) {
572 Real r2 = r*r;
573 Real r3 = r2*r;
574 Real at = (stage == 3) ? Real(0.5)*r : r;
575 Real att = (stage == 3) ? Real(0.25)*r2 : Real(0.5)*r2;
576 Real attt = (stage == 3) ? Real(0.0625)*r3 : Real(0.125)*r3;
577 Real akk = (stage == 3) ? Real(-4.) : Real(4.);
578 amrex::ParallelFor(*m_cf_crse_data_tmp, IntVect(0), m_ncomp,
579 [=] AMREX_GPU_DEVICE (int bi, int i, int j, int k, int n) noexcept
580 {
581 if (cdomain.contains(i,j,k)) {
582 Real kk1 = k1[bi](i,j,k,n);
583 Real kk2 = k2[bi](i,j,k,n);
584 Real kk3 = k3[bi](i,j,k,n);
585 Real kk4 = k4[bi](i,j,k,n);
586 Real uu = b1*kk1 + b2*kk2 + b3*kk3 + b4*kk4;
587 Real ut = c1*kk1 + c2*kk2 + c3*kk3 + c4*kk4;
588 Real utt = d1*kk1 + d2*kk2 + d3*kk3 + d4*kk4;
589 Real uttt = e1*kk1 + e2*kk2 + e3*kk3 + e4*kk4;
590 u[bi](i,j,k,n) = u0[bi](i,j,k,n) + dtc *
591 (uu + at*ut + att*utt + attt*(uttt+akk*(kk3-kk2)));
592 }
593 });
594 }
595 }
597
598 cbc(*m_cf_crse_data_tmp, 0, m_ncomp, m_cf_crse_data_tmp->nGrowVect(), time, 0);
599
600 if (m_cf_fine_data == nullptr) {
601 m_cf_fine_data = std::make_unique<MF>(detail::make_mf_fine_patch<MF>(fpc, m_ncomp));
602 }
603
604 FillPatchInterp(*m_cf_fine_data, 0, *m_cf_crse_data_tmp, 0,
605 m_ncomp, IntVect(0), m_cgeom, m_fgeom,
606 amrex::grow(amrex::convert(m_fgeom.Domain(),
607 mf.ixType()),m_nghost),
608 m_ratio, m_interp, bcs, 0);
609
610 // xxxxx We can optimize away this ParallelCopy by making a special fpinfo.
611 mf.ParallelCopy(*m_cf_fine_data, 0, 0, m_ncomp, IntVect(0), m_nghost);
612
613 mf.FillBoundary(m_fgeom.periodicity());
614 fbc(mf, 0, m_ncomp, m_nghost, time, 0);
615}
616
617}
618
619#endif
#define BL_PROFILE(a)
Definition AMReX_BLProfiler.H:551
#define AMREX_ASSERT(EX)
Definition AMReX_BLassert.H:38
#define AMREX_ALWAYS_ASSERT(EX)
Definition AMReX_BLassert.H:50
#define AMREX_GPU_DEVICE
Definition AMReX_GpuQualifiers.H:18
A collection of Boxes stored in an Array.
Definition AMReX_BoxArray.H:551
IndexType ixType() const noexcept
Return index type of this BoxArray.
Definition AMReX_BoxArray.H:841
__host__ __device__ IntVectND< dim > length() const noexcept
Return the length of the BoxND.
Definition AMReX_Box.H:149
__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:930
__host__ __device__ bool contains(const IntVectND< dim > &p) const noexcept
Returns true if argument is contained within BoxND.
Definition AMReX_Box.H:207
Calculates the distribution of FABs to MPI processes.
Definition AMReX_DistributionMapping.H:41
Definition AMReX_EB2.H:26
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:2068
FillPatcher is for filling a fine level MultiFab/FabArray.
Definition AMReX_FillPatcher.H:73
Geometry m_cgeom
Definition AMReX_FillPatcher.H:207
Vector< std::pair< Real, std::unique_ptr< MF > > > m_cf_crse_data
Definition AMReX_FillPatcher.H:214
Geometry m_fgeom
Definition AMReX_FillPatcher.H:206
DistributionMapping m_cdm
Definition AMReX_FillPatcher.H:205
InterpBase * m_interp
Definition AMReX_FillPatcher.H:210
BoxArray m_fba
Definition AMReX_FillPatcher.H:202
std::unique_ptr< MF > m_cf_fine_data
Definition AMReX_FillPatcher.H:216
std::unique_ptr< MF > m_cf_crse_data_tmp
Definition AMReX_FillPatcher.H:215
BoxArray m_cba
Definition AMReX_FillPatcher.H:203
IntVect m_nghost
Definition AMReX_FillPatcher.H:208
int m_ncomp
Definition AMReX_FillPatcher.H:209
EB2::IndexSpace const * m_eb_index_space
Definition AMReX_FillPatcher.H:211
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:288
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:254
IntVect m_ratio
Definition AMReX_FillPatcher.H:213
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:434
MF m_sfine
Definition AMReX_FillPatcher.H:212
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:413
DistributionMapping m_fdm
Definition AMReX_FillPatcher.H:204
FabArrayBase::FPinfo const & getFPinfo()
Definition AMReX_FillPatcher.H:278
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:223
Real m_dt_coarse
Definition AMReX_FillPatcher.H:217
Rectangular problem domain geometry.
Definition AMReX_Geometry.H:73
const Box & Domain() const noexcept
Returns our rectangular domain.
Definition AMReX_Geometry.H:210
__host__ __device__ bool cellCentered() const noexcept
True if the IndexTypeND is CELL based in all directions.
Definition AMReX_IndexType.H:101
__host__ __device__ bool nodeCentered() const noexcept
True if the IndexTypeND is NODE based in all directions.
Definition AMReX_IndexType.H:107
__host__ __device__ 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:398
Definition AMReX_InterpBase.H:26
Definition AMReX_InterpBase.H:15
This class is a thin wrapper around std::vector. Unlike vector, Vector::operator[] provides bound che...
Definition AMReX_Vector.H:28
Long size() const noexcept
Definition AMReX_Vector.H:53
const IndexSpace * TopIndexSpaceIfPresent() noexcept
Definition AMReX_EB2.cpp:76
void streamSynchronize() noexcept
Definition AMReX_GpuDevice.H:260
auto call_interp_hook(F const &f, MF &mf, int icomp, int ncomp) -> decltype(f(mf[0], Box(), icomp, ncomp))
Definition AMReX_FillPatchUtil_I.H:10
Definition AMReX_Amr.cpp:49
__host__ __device__ BoxND< dim > convert(const BoxND< dim > &b, const IntVectND< dim > &typ) noexcept
Returns a BoxND with different type.
Definition AMReX_Box.H:1453
std::enable_if_t< std::is_integral_v< T > > ParallelFor(TypeList< CTOs... > ctos, std::array< int, sizeof...(CTOs)> const &runtime_options, T N, F &&f)
Definition AMReX_CTOParallelForImpl.H:191
DistributionMapping const & DistributionMap(FabArrayBase const &fa)
Definition AMReX_FabArrayBase.cpp:2867
std::enable_if_t< IsFabArray< MF >::value > 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:73
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)
Definition AMReX_FillPatchUtil.cpp:140
IntVectND< 3 > IntVect
Definition AMReX_BaseFwd.H:30
__host__ __device__ BoxND< dim > grow(const BoxND< dim > &b, int i) noexcept
Grow BoxND in all directions by given amount.
Definition AMReX_Box.H:1229
void Abort(const std::string &msg)
Print out message to cerr and exit via abort().
Definition AMReX.cpp:230
__host__ __device__ BoxND< dim > refine(const BoxND< dim > &b, int ref_ratio) noexcept
Definition AMReX_Box.H:1360
BoxArray const & boxArray(FabArrayBase const &fa)
Definition AMReX_FabArrayBase.cpp:2862
std::array< T, N > Array
Definition AMReX_Array.H:24
Definition AMReX_FabArrayBase.H:305
Definition AMReX_TypeTraits.H:29
FabArray memory allocation information.
Definition AMReX_FabArray.H:66
Definition AMReX_FillPatchUtil.H:34