Skip to content

Commit

Permalink
Use new fillpatcher (#551)
Browse files Browse the repository at this point in the history
  • Loading branch information
marchdf authored Oct 10, 2022
1 parent 7c4802f commit 5899909
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 21 deletions.
16 changes: 9 additions & 7 deletions Source/Advance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ PeleC::do_mol_advance(
if (verbose != 0) {
amrex::Print() << "... Computing MOL source term at t^{n} " << std::endl;
}
FillPatch(*this, Sborder, numGrow() + nGrowF, time, State_Type, 0, NVAR);
FillPatcherFill(Sborder, 0, NVAR, numGrow() + nGrowF, time, State_Type, 0);
amrex::Real flux_factor = 0;
getMOLSrcTerm(Sborder, molSrc, time, dt, flux_factor);

Expand Down Expand Up @@ -118,7 +118,8 @@ PeleC::do_mol_advance(
if (verbose != 0) {
amrex::Print() << "... Computing MOL source term at t^{n+1} " << std::endl;
}
FillPatch(*this, Sborder, numGrow() + nGrowF, time + dt, State_Type, 0, NVAR);
FillPatcherFill(
Sborder, 0, NVAR, numGrow() + nGrowF, time + dt, State_Type, 0);
flux_factor = mol_iters > 1 ? 0 : 1;
getMOLSrcTerm(Sborder, molSrc, time, dt, flux_factor);

Expand Down Expand Up @@ -164,8 +165,8 @@ PeleC::do_mol_advance(
amrex::Print() << "... Re-computing MOL source term at t^{n+1} (iter = "
<< mol_iter << " of " << mol_iters << ")" << std::endl;
}
FillPatch(
*this, Sborder, numGrow() + nGrowF, time + dt, State_Type, 0, NVAR);
FillPatcherFill(
Sborder, 0, NVAR, numGrow() + nGrowF, time + dt, State_Type, 0);
flux_factor = mol_iter == mol_iters ? 1 : 0;
getMOLSrcTerm(Sborder, molSrc_new, time, dt, flux_factor);

Expand Down Expand Up @@ -281,7 +282,7 @@ PeleC::do_sdc_iteration(
#endif

if (fill_Sborder) {
FillPatch(*this, Sborder, nGrow_Sborder, time, State_Type, 0, NVAR);
FillPatcherFill(Sborder, 0, NVAR, nGrow_Sborder, time, State_Type, 0);
}

if (sub_iteration == 0) {
Expand Down Expand Up @@ -409,7 +410,7 @@ PeleC::do_sdc_iteration(
amrex::Print() << "... Computing diffusion terms at t^(n+1,"
<< sub_iteration + 1 << ")" << std::endl;
}
FillPatch(*this, Sborder, numGrow(), time + dt, State_Type, 0, NVAR);
FillPatcherFill(Sborder, 0, NVAR, numGrow(), time + dt, State_Type, 0);
amrex::Real flux_factor_new = sub_iteration == sub_ncycle - 1 ? 0.5 : 0;
getMOLSrcTerm(Sborder, *new_sources[diff_src], time, dt, flux_factor_new);
}
Expand All @@ -430,7 +431,8 @@ PeleC::do_sdc_iteration(
amrex::Print() << "moveKick ... updating velocity only\n";

if (!do_diffuse) { // Else, this was already done above. No need to redo
FillPatch(*this, Sborder, nGrow_Sborder, time + dt, State_Type, 0, NVAR);
FillPatcherFill(
Sborder, 0, NVAR, nGrow_Sborder, time + dt, State_Type, 0);
}

new_sources[spray_src]->setVal(0.);
Expand Down
8 changes: 4 additions & 4 deletions Source/Diffusion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -540,14 +540,14 @@ PeleC::getMOLSrcTerm(
});
}

if (level < parent->finestLevel()) {
getFluxReg(level + 1).CrseAdd(
if ((level < parent->finestLevel()) && (fr_as_crse != nullptr)) {
fr_as_crse->CrseAdd(
mfi, {{AMREX_D_DECL(&flux_ec[0], &flux_ec[1], &flux_ec[2])}},
dxD.data(), dt, amrex::RunOn::Device);
}

if (level > 0) {
getFluxReg(level).FineAdd(
if ((level > 0) && (fr_as_fine != nullptr)) {
fr_as_fine->FineAdd(
mfi, {{AMREX_D_DECL(&flux_ec[0], &flux_ec[1], &flux_ec[2])}},
dxD.data(), dt, amrex::RunOn::Device);
}
Expand Down
2 changes: 1 addition & 1 deletion Source/IO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ PeleC::restart(amrex::Amr& papa, std::istream& is, bool bReadSpecial)
*/

if (level > 0 && do_reflux) {
flux_reg.define(
flux_reg = std::make_unique<amrex::EBFluxRegister>(
grids, papa.boxArray(level - 1), dmap, papa.DistributionMap(level - 1),
geom, papa.Geom(level - 1), papa.refRatio(level - 1), level, NVAR);

Expand Down
10 changes: 4 additions & 6 deletions Source/PeleC.H
Original file line number Diff line number Diff line change
Expand Up @@ -520,8 +520,8 @@ public:

static bool eb_in_domain;

amrex::EBFluxRegister flux_reg;
amrex::EBFluxRegister& getFluxReg();
std::unique_ptr<amrex::EBFluxRegister> flux_reg;
amrex::EBFluxRegister& getFluxReg() const;
amrex::EBFluxRegister& getFluxReg(int lev);

static bool ebInitialized();
Expand Down Expand Up @@ -659,8 +659,6 @@ protected:
amrex::MultiFab mms_source;
#endif

// bool FillPatchedOldState_ok;

// There can be only one Diffusion object, it covers all levels:
static class Diffusion* diffusion;

Expand Down Expand Up @@ -810,9 +808,9 @@ pc_check_initial_species(

AMREX_FORCE_INLINE
amrex::EBFluxRegister&
PeleC::getFluxReg()
PeleC::getFluxReg() const
{
return flux_reg;
return *flux_reg;
}

AMREX_FORCE_INLINE
Expand Down
8 changes: 6 additions & 2 deletions Source/PeleC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ PeleC::PeleC(
}

if (do_reflux && level > 0) {
flux_reg.define(
flux_reg = std::make_unique<amrex::EBFluxRegister>(
bl, papa.boxArray(level - 1), dm, papa.DistributionMap(level - 1),
level_geom, papa.Geom(level - 1), papa.refRatio(level - 1), level, NVAR);

Expand Down Expand Up @@ -1014,6 +1014,10 @@ PeleC::post_timestep(int
// Clean up any aberrant state data generated by the reflux.
// amrex::MultiFab& S_new_crse = get_new_data(State_Type);
// clean_state(S_new_crse);

// fillpatcher on level+1 needs to be reset because data on this
// level have changed.
getLevel(level + 1).resetFillPatcher();
}

// Re-compute temperature after all the other updates.
Expand Down Expand Up @@ -1230,7 +1234,7 @@ PeleC::reflux()
PeleC& fine_level = getLevel(level + 1);
amrex::MultiFab& S_crse = get_new_data(State_Type);
amrex::MultiFab& S_fine = fine_level.get_new_data(State_Type);
fine_level.flux_reg.Reflux(S_crse, vfrac, S_fine, fine_level.vfrac);
getFluxReg(level + 1).Reflux(S_crse, vfrac, S_fine, fine_level.vfrac);

if (!amrex::DefaultGeometry().IsCartesian() && eb_in_domain) {
amrex::Abort("rz not yet compatible with EB");
Expand Down
2 changes: 1 addition & 1 deletion Submodules/AMReX
Submodule AMReX updated 61 files
+2 −2 .github/workflows/clang.yml
+2 −2 .github/workflows/cuda.yml
+8 −8 .github/workflows/gcc.yml
+2 −2 .github/workflows/hip.yml
+1 −1 .github/workflows/intel.yml
+2 −2 .github/workflows/macos.yml
+44 −0 CHANGES
+1 −1 Docs/sphinx_documentation/source/SWFFT.rst
+24 −5 Src/Amr/AMReX_AmrLevel.H
+60 −0 Src/Amr/AMReX_AmrLevel.cpp
+4 −0 Src/AmrCore/AMReX_ErrorList.H
+180 −40 Src/AmrCore/AMReX_ErrorList.cpp
+8 −3 Src/AmrCore/AMReX_FillPatchUtil.H
+343 −0 Src/AmrCore/AMReX_FillPatcher.H
+48 −0 Src/AmrCore/AMReX_Interp_C.H
+69 −0 Src/AmrCore/AMReX_Interpolater.H
+93 −0 Src/AmrCore/AMReX_Interpolater.cpp
+1 −0 Src/AmrCore/CMakeLists.txt
+2 −0 Src/AmrCore/Make.package
+52 −1 Src/Base/AMReX_Algorithm.H
+49 −0 Src/Base/AMReX_Array4.H
+1 −1 Src/Base/AMReX_FArrayBox.H
+4 −0 Src/Base/AMReX_Geometry.H
+16 −4 Src/Base/AMReX_Geometry.cpp
+107 −0 Src/Base/AMReX_GpuLaunch.H
+52 −0 Src/Base/AMReX_GpuLaunchFunctsG.H
+56 −0 Src/Base/AMReX_GpuLaunchMacrosG.H
+0 −1 Src/Base/AMReX_GpuTypes.H
+0 −1 Src/Base/AMReX_Math.H
+12 −0 Src/Base/AMReX_MultiFabUtil.H
+154 −0 Src/Base/AMReX_MultiFabUtil.cpp
+25 −1 Src/Base/AMReX_Orientation.H
+0 −1 Src/Base/AMReX_RandomEngine.H
+0 −2 Src/Base/AMReX_VisMF.H
+1 −0 Src/EB/AMReX_EB2_GeometryShop.H
+3 −3 Src/EB/AMReX_distFcnElement.H
+1 −0 Src/LinearSolvers/MLMG/AMReX_MLEBNodeFDLaplacian.H
+2 −1 Src/LinearSolvers/MLMG/AMReX_MLEBTensorOp.H
+151 −149 Src/LinearSolvers/MLMG/AMReX_MLEBTensorOp.cpp
+40 −18 Src/LinearSolvers/MLMG/AMReX_MLEBTensorOp_bc.cpp
+120 −18 Src/LinearSolvers/MLMG/AMReX_MLEBTensor_2D_K.H
+499 −40 Src/LinearSolvers/MLMG/AMReX_MLEBTensor_3D_K.H
+139 −0 Src/LinearSolvers/MLMG/AMReX_MLEBTensor_K.H
+8 −0 Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian_misc.cpp
+106 −34 Src/LinearSolvers/MLMG/AMReX_MLTensorOp.cpp
+112 −48 Src/LinearSolvers/MLMG/AMReX_MLTensorOp_grad.cpp
+287 −95 Src/LinearSolvers/MLMG/AMReX_MLTensor_2D_K.H
+1,889 −955 Src/LinearSolvers/MLMG/AMReX_MLTensor_3D_K.H
+117 −0 Src/LinearSolvers/MLMG/AMReX_MLTensor_K.H
+0 −4 Src/Particle/AMReX_ParticleInit.H
+19 −1 Src/Particle/AMReX_WriteBinaryParticleData.H
+2 −1 Tests/Amr/Advection_AmrCore/Source/AdvancePhiAllLevels.cpp
+2 −1 Tests/Amr/Advection_AmrCore/Source/AdvancePhiAtLevel.cpp
+9 −2 Tests/Amr/Advection_AmrCore/Source/AmrCoreAdv.H
+46 −16 Tests/Amr/Advection_AmrCore/Source/AmrCoreAdv.cpp
+1 −1 Tests/Amr/Advection_AmrCore/Source/Src_K/Make.package
+1 −1 Tests/Amr/Advection_AmrLevel/Source/AmrLevelAdv.H
+22 −15 Tests/Amr/Advection_AmrLevel/Source/AmrLevelAdv.cpp
+8 −4 Tools/C_scripts/makebuildinfo_C.py
+7 −3 Tools/GNUMake/comps/gnu.mak
+1 −1 Tools/GNUMake/comps/llvm.mak

0 comments on commit 5899909

Please # to comment.