diff --git a/Source/PeleLMeX.H b/Source/PeleLMeX.H index c1b90bac..b3528b8d 100644 --- a/Source/PeleLMeX.H +++ b/Source/PeleLMeX.H @@ -381,7 +381,7 @@ public: const amrex::Vector& a_sigma, const amrex::Vector& rhs_cc, const amrex::Vector& rhs_nd, - int increment_gp, + int incremental, amrex::Real scaling_factor); /** @@ -522,8 +522,8 @@ public: int beta_comp, int ncomp, int doZeroVisc, - amrex::Vector a_bcrec, - const amrex::MultiFab& a_diff_cc, + amrex::Vector bcrec, + const amrex::MultiFab& beta_cc, int addTurbContrib = 0); /** @@ -1025,7 +1025,7 @@ public: void fillpatch_species( int lev, amrex::Real a_time, - amrex::MultiFab& a_rhoY, + amrex::MultiFab& a_species, int rhoY_comp, int nGhost); void fillpatch_temp( @@ -1042,7 +1042,7 @@ public: int lev, amrex::Real a_time, amrex::MultiFab& a_I_R, int nGhost); void fillpatch_forces( amrex::Real a_time, - amrex::Vector const& a_velForces, + amrex::Vector const& a_force, int nGrowForce); void fillpatch_chemFunctCall( int lev, amrex::Real a_time, amrex::MultiFab& a_fctC, int nGhost); diff --git a/Source/PeleLMeX_Advection.cpp b/Source/PeleLMeX_Advection.cpp index 56c73bb2..65f89bac 100644 --- a/Source/PeleLMeX_Advection.cpp +++ b/Source/PeleLMeX_Advection.cpp @@ -145,7 +145,7 @@ PeleLM::computeVelocityAdvTerm(std::unique_ptr& advData) bool fluxes_are_area_weighted = false; #ifdef AMREX_USE_EB - auto ldata_p = getLevelDataPtr(lev, AmrOldTime); + auto* ldata_p = getLevelDataPtr(lev, AmrOldTime); //---------------------------------------------------------------- // Use a temporary MF to hold divergence before redistribution int nGrow_divT = 3; @@ -483,6 +483,7 @@ PeleLM::computeScalarAdvTerms(std::unique_ptr& advData) }); } else // Regular boxes #endif + { amrex::ParallelFor( ebx, [rho_ed, rhoY_ed] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { @@ -491,6 +492,7 @@ PeleLM::computeScalarAdvTerms(std::unique_ptr& advData) rho_ed(i, j, k) += rhoY_ed(i, j, k, n); } }); + } } } @@ -687,7 +689,7 @@ PeleLM::computeScalarAdvTerms(std::unique_ptr& advData) bool fluxes_are_area_weighted = false; #ifdef AMREX_USE_EB - auto ldata_p = getLevelDataPtr(lev, AmrOldTime); + auto* ldata_p = getLevelDataPtr(lev, AmrOldTime); //---------------------------------------------------------------- // Use a temporary MF to hold divergence before redistribution int nGrow_divTmp = 3; @@ -889,7 +891,7 @@ PeleLM::computePassiveAdvTerms( bool fluxes_are_area_weighted = false; #ifdef AMREX_USE_EB - auto ldata_p = getLevelDataPtr(lev, AmrOldTime); + auto* ldata_p = getLevelDataPtr(lev, AmrOldTime); //---------------------------------------------------------------- // Use a temporary MF to hold divergence before redistribution int nGrow_divTmp = 3; diff --git a/Source/PeleLMeX_Derive.H b/Source/PeleLMeX_Derive.H index fa1e2793..b3fffebe 100644 --- a/Source/PeleLMeX_Derive.H +++ b/Source/PeleLMeX_Derive.H @@ -11,36 +11,36 @@ // Forward declaration of PeleLM class PeleLM; -typedef void (*PeleLMDeriveFunc)( - PeleLM* a_pelelm, - const amrex::Box& bx, - amrex::FArrayBox& derfab, - int dcomp, - int ncomp, - const amrex::FArrayBox& statefab, - const amrex::FArrayBox& reactfab, - const amrex::FArrayBox& pressfab, - const amrex::Geometry& geomdata, - amrex::Real time, - const amrex::Vector& bcrec, - int level); - -typedef void (*PeleLMMFVecDeriveFunc)( - amrex::Vector derfab, - int dcomp, - int ncomp, - amrex::Vector statefab, - amrex::Vector reactfab, - amrex::Vector pressfab, - const amrex::Geometry& geomdata, - amrex::Real time, - const amrex::Vector& bcrec); +using PeleLMDeriveFunc = void (*)( + PeleLM*, + const amrex::Box&, + amrex::FArrayBox&, + int, + int, + const amrex::FArrayBox&, + const amrex::FArrayBox&, + const amrex::FArrayBox&, + const amrex::Geometry&, + amrex::Real, + const amrex::Vector&, + int); + +using PeleLMMFVecDeriveFunc = void (*)( + amrex::Vector, + int, + int, + amrex::Vector, + amrex::Vector, + amrex::Vector, + const amrex::Geometry&, + amrex::Real, + const amrex::Vector&); class PeleLMDeriveRec { friend class PeleLMDeriveList; public: - typedef amrex::Box (*DeriveBoxMap)(const amrex::Box&); + using DeriveBoxMap = amrex::Box (*)(const amrex::Box&); static amrex::Box TheSameBox(const amrex::Box& box) noexcept; static amrex::Box GrowBoxByOne(const amrex::Box& box) noexcept; @@ -66,7 +66,7 @@ public: * * \param name */ - int variableComp(const std::string& variableName) const noexcept; + int variableComp(const std::string& a_name) const noexcept; /** * \brief The IndexType of the derived type. @@ -232,9 +232,9 @@ public: void add( const std::string& name, amrex::IndexType result_type, - int nvar_derive, + int nvar_der, PeleLMDeriveFunc der_func, - PeleLMDeriveRec::DeriveBoxMap box_map, + PeleLMDeriveRec::DeriveBoxMap bx_map, amrex::Interpolater* interp = &amrex::pc_interp); /** @@ -251,10 +251,10 @@ public: void add( const std::string& name, amrex::IndexType result_type, - int nvar_derive, - amrex::Vector& var_names, + int nvar_der, + amrex::Vector& vars, PeleLMDeriveFunc der_func, - PeleLMDeriveRec::DeriveBoxMap box_map, + PeleLMDeriveRec::DeriveBoxMap bx_map, amrex::Interpolater* interp = &amrex::pc_interp); /** @@ -270,8 +270,8 @@ public: void add( const std::string& name, amrex::IndexType result_type, - int nvar_derive, - PeleLMDeriveRec::DeriveBoxMap box_map, + int nvar_der, + PeleLMDeriveRec::DeriveBoxMap bx_map, amrex::Interpolater* interp = &amrex::pc_interp); /** @@ -288,9 +288,9 @@ public: void add( const std::string& name, amrex::IndexType result_type, - int nvar_derive, - amrex::Vector& var_names, - PeleLMDeriveRec::DeriveBoxMap box_map, + int nvar_der, + amrex::Vector& vars, + PeleLMDeriveRec::DeriveBoxMap bx_map, amrex::Interpolater* interp = &amrex::pc_interp); std::list& dlist(); diff --git a/Source/PeleLMeX_DeriveFunc.cpp b/Source/PeleLMeX_DeriveFunc.cpp index ed30481b..388040cd 100644 --- a/Source/PeleLMeX_DeriveFunc.cpp +++ b/Source/PeleLMeX_DeriveFunc.cpp @@ -291,7 +291,7 @@ pelelmex_dermgvort( auto const& vort_arr = derfab.array(dcomp); #ifdef AMREX_USE_EB - const EBFArrayBox& ebfab = static_cast(statefab); + const auto& ebfab = static_cast(statefab); const EBCellFlagFab& flags = ebfab.getEBCellFlagFab(); auto typ = flags.getType(bx); @@ -453,7 +453,7 @@ pelelmex_dervort( auto const& vort_arr = derfab.array(dcomp); #ifdef AMREX_USE_EB - const EBFArrayBox& ebfab = static_cast(statefab); + const auto& ebfab = static_cast(statefab); const EBCellFlagFab& flags = ebfab.getEBCellFlagFab(); auto typ = flags.getType(bx); @@ -627,7 +627,7 @@ pelelmex_dercoord( #ifdef AMREX_USE_EB AMREX_ASSERT(statefab.box().contains(bx)); - const EBFArrayBox& ebfab = static_cast(statefab); + const auto& ebfab = static_cast(statefab); const EBCellFlagFab& flags = ebfab.getEBCellFlagFab(); auto typ = flags.getType(bx); @@ -712,7 +712,7 @@ pelelmex_derQcrit( auto const& qcrit_arr = derfab.array(dcomp); #ifdef AMREX_USE_EB - const EBFArrayBox& ebfab = static_cast(statefab); + const auto& ebfab = static_cast(statefab); const EBCellFlagFab& flags = ebfab.getEBCellFlagFab(); auto typ = flags.getType(bx); @@ -984,7 +984,7 @@ pelelmex_derenstrophy( auto const& ens_arr = derfab.array(dcomp); #ifdef AMREX_USE_EB - const EBFArrayBox& ebfab = static_cast(statefab); + const auto& ebfab = static_cast(statefab); const EBCellFlagFab& flags = ebfab.getEBCellFlagFab(); auto typ = flags.getType(bx); @@ -1356,7 +1356,8 @@ pelelmex_derdiffc( AMREX_ASSERT(derfab.nComp() >= dcomp + ncomp); if (a_pelelm->m_use_soret != 0) { AMREX_ASSERT(ncomp == 2 * NUM_SPECIES); - } else { + } + if (a_pelelm->m_use_soret == 0) { AMREX_ASSERT(ncomp == NUM_SPECIES); } FArrayBox dummies(bx, 2, The_Async_Arena()); diff --git a/Source/PeleLMeX_DiffusionOp.cpp b/Source/PeleLMeX_DiffusionOp.cpp index 09cc1610..d07b8338 100644 --- a/Source/PeleLMeX_DiffusionOp.cpp +++ b/Source/PeleLMeX_DiffusionOp.cpp @@ -425,12 +425,8 @@ DiffusionOp::diffuse_scalar( Array bcoeff_ec = m_pelelm->getDiffusivity( lev, bcoeff_comp + comp, m_ncomp, doZeroVisc, subBCRec, *a_bcoeff[lev]); -#ifdef AMREX_USE_EB m_scal_solve_op->setBCoeffs( lev, GetArrOfConstPtrs(bcoeff_ec), MLMG::Location::FaceCentroid); -#else - m_scal_solve_op->setBCoeffs(lev, GetArrOfConstPtrs(bcoeff_ec)); -#endif } else { m_scal_solve_op->setBCoeffs(lev, 1.0); } @@ -463,11 +459,7 @@ DiffusionOp::diffuse_scalar( // Need to get the fluxes if (have_fluxes != 0) { -#ifdef AMREX_USE_EB mlmg.getFluxes(fluxes, MLMG::Location::FaceCentroid); -#else - mlmg.getFluxes(fluxes, MLMG::Location::FaceCenter); -#endif for (int lev = 0; lev <= finest_level; ++lev) { for (int idim = 0; idim < AMREX_SPACEDIM; idim++) { diff --git a/Source/PeleLMeX_EB.cpp b/Source/PeleLMeX_EB.cpp index 4dbaca45..9638f4cb 100644 --- a/Source/PeleLMeX_EB.cpp +++ b/Source/PeleLMeX_EB.cpp @@ -310,7 +310,7 @@ PeleLM::setCoveredState(int lev, const TimeStamp& a_time) { AMREX_ASSERT(a_time == AmrOldTime || a_time == AmrNewTime); - auto ldata_p = getLevelDataPtr(lev, a_time); + auto* ldata_p = getLevelDataPtr(lev, a_time); if (m_incompressible != 0) { EB_set_covered(ldata_p->state, 0, AMREX_SPACEDIM, coveredState_h); @@ -333,8 +333,8 @@ PeleLM::initialRedistribution() // Jungle with Old/New states: fillPatch old and redistribute // from Old->New to end up with proper New state - auto ldataOld_p = getLevelDataPtr(lev, AmrOldTime); - auto ldataNew_p = getLevelDataPtr(lev, AmrNewTime); + auto* ldataOld_p = getLevelDataPtr(lev, AmrOldTime); + auto* ldataNew_p = getLevelDataPtr(lev, AmrNewTime); auto const& fact = EBFactory(lev); @@ -536,7 +536,7 @@ PeleLM::getEBDiff( Array faceCentroid = ebfact.getFaceCent(); // Get diffusivity cell-centered - auto ldata_p = getLevelDataPtr(a_lev, a_time); + auto* ldata_p = getLevelDataPtr(a_lev, a_time); MFItInfo mfi_info; if (Gpu::notInLaunchRegion()) { diff --git a/Source/PeleLMeX_Utils.cpp b/Source/PeleLMeX_Utils.cpp index d2f58a7e..c5203906 100644 --- a/Source/PeleLMeX_Utils.cpp +++ b/Source/PeleLMeX_Utils.cpp @@ -1928,8 +1928,9 @@ PeleLM::extendSignedDistance(MultiFab* a_signDist, Real a_extendFactor) +((j - jj) * dx[1] * (j - jj) * dx[1]), +((k - kk) * dx[2] * (k - kk) * dx[2]))); Real distToEB = distToCell + sd_cc(ii, jj, kk); - if (distToEB < closestEBDist) + if (distToEB < closestEBDist) { closestEBDist = distToEB; + } } } }