Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
marchdf committed Sep 19, 2023
1 parent b50b0cd commit 441aafe
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 37 deletions.
5 changes: 3 additions & 2 deletions Source/DiffusionOp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,8 @@ DiffusionTensorOp::compute_divtau(
#else
m_apply_op->setScalars(0.0, -scale);
for (int lev = 0; lev <= finest_level; ++lev) {
if (have_density != 0) { // alpha being zero, not sure that this does anything.
if (have_density != 0) { // alpha being zero, not sure that this does
// anything.
m_apply_op->setACoeffs(lev, *a_density[lev]);
}
int doZeroVisc = 0;
Expand Down Expand Up @@ -1194,7 +1195,7 @@ DiffusionTensorOp::diffuse_velocity(
auto const& rhs_a = rhs[lev].array(mfi);
auto const& vel_a = a_vel[lev]->const_array(mfi);
auto const& rho_a = (have_density) != 0 ? a_density[lev]->const_array(mfi)
: Array4<const Real>{};
: Array4<const Real>{};
amrex::ParallelFor(
bx, AMREX_SPACEDIM,
[=, rho_incomp = m_pelelm->m_rho,
Expand Down
18 changes: 12 additions & 6 deletions Source/PeleLMBC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,8 @@ PeleLM::fillpatch_state(
PhysBCFunct<GpuBndryFuncFab<PeleLMCCFillExtDirState>> bndry_func(
geom[lev], fetchBCRecArray(0, nCompState),
PeleLMCCFillExtDirState{
lprobparm, lpmfdata, m_nAux, static_cast<int>(turb_inflow.is_initialized())});
lprobparm, lpmfdata, m_nAux,
static_cast<int>(turb_inflow.is_initialized())});
FillPatchSingleLevel(
a_state, IntVect(nGhost), a_time,
{&(m_leveldata_old[lev]->state), &(m_leveldata_new[lev]->state)},
Expand All @@ -352,11 +353,13 @@ PeleLM::fillpatch_state(
PhysBCFunct<GpuBndryFuncFab<PeleLMCCFillExtDirState>> crse_bndry_func(
geom[lev - 1], fetchBCRecArray(0, nCompState),
PeleLMCCFillExtDirState{
lprobparm, lpmfdata, m_nAux, static_cast<int>(turb_inflow.is_initialized())});
lprobparm, lpmfdata, m_nAux,
static_cast<int>(turb_inflow.is_initialized())});
PhysBCFunct<GpuBndryFuncFab<PeleLMCCFillExtDirState>> fine_bndry_func(
geom[lev], fetchBCRecArray(0, nCompState),
PeleLMCCFillExtDirState{
lprobparm, lpmfdata, m_nAux, static_cast<int>(turb_inflow.is_initialized())});
lprobparm, lpmfdata, m_nAux,
static_cast<int>(turb_inflow.is_initialized())});
FillPatchTwoLevels(
a_state, IntVect(nGhost), a_time,
{&(m_leveldata_old[lev - 1]->state), &(m_leveldata_new[lev - 1]->state)},
Expand Down Expand Up @@ -734,11 +737,13 @@ PeleLM::fillcoarsepatch_state(
PhysBCFunct<GpuBndryFuncFab<PeleLMCCFillExtDirState>> crse_bndry_func(
geom[lev - 1], fetchBCRecArray(0, nCompState),
PeleLMCCFillExtDirState{
lprobparm, lpmfdata, m_nAux, static_cast<int>(turb_inflow.is_initialized())});
lprobparm, lpmfdata, m_nAux,
static_cast<int>(turb_inflow.is_initialized())});
PhysBCFunct<GpuBndryFuncFab<PeleLMCCFillExtDirState>> fine_bndry_func(
geom[lev], fetchBCRecArray(0, nCompState),
PeleLMCCFillExtDirState{
lprobparm, lpmfdata, m_nAux, static_cast<int>(turb_inflow.is_initialized())});
lprobparm, lpmfdata, m_nAux,
static_cast<int>(turb_inflow.is_initialized())});
InterpFromCoarseLevel(
a_state, IntVect(nGhost), a_time, m_leveldata_new[lev - 1]->state, 0, 0,
nCompState, geom[lev - 1], geom[lev], crse_bndry_func, 0, fine_bndry_func,
Expand Down Expand Up @@ -861,7 +866,8 @@ PeleLM::setInflowBoundaryVel(MultiFab& a_vel, int lev, TimeStamp a_time)
PhysBCFunct<GpuBndryFuncFab<PeleLMCCFillExtDirState>> bndry_func(
geom[lev], dummyVelBCRec,
PeleLMCCFillExtDirState{
lprobparm, lpmfdata, m_nAux, static_cast<int>(turb_inflow.is_initialized())});
lprobparm, lpmfdata, m_nAux,
static_cast<int>(turb_inflow.is_initialized())});

bndry_func(a_vel, 0, AMREX_SPACEDIM, a_vel.nGrowVect(), time, 0);

Expand Down
20 changes: 12 additions & 8 deletions Source/PeleLMDiffusion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,12 @@ PeleLM::computeDifferentialDiffusionTerms(
// wbar term During initialization, don't bother getting the wbar fluxes
// separately
Vector<std::array<MultiFab*, AMREX_SPACEDIM>> wbarFluxVec =
((is_init != 0) || (m_use_wbar == 0)) ? Vector<std::array<MultiFab*, AMREX_SPACEDIM>>{}
: GetVecOfArrOfPtrs(diffData->wbar_fluxes);
((is_init != 0) || (m_use_wbar == 0))
? Vector<std::array<MultiFab*, AMREX_SPACEDIM>>{}
: GetVecOfArrOfPtrs(diffData->wbar_fluxes);
Vector<std::array<MultiFab*, AMREX_SPACEDIM>> soretFluxVec =
(m_use_soret) != 0 ? GetVecOfArrOfPtrs(diffData->soret_fluxes)
: Vector<std::array<MultiFab*, AMREX_SPACEDIM>>{};
: Vector<std::array<MultiFab*, AMREX_SPACEDIM>>{};
#ifdef AMREX_USE_EB
if (m_isothermalEB) {
computeDifferentialDiffusionFluxes(
Expand All @@ -108,7 +109,8 @@ PeleLM::computeDifferentialDiffusionTerms(
// If doing species balances, compute face domain integrals
// using level 0 since we've averaged down the fluxes already
// Factor for SDC is 0.5 is for Dn and -0.5 for Dnp1
if ((m_sdcIter == 0 || m_sdcIter == m_nSDCmax) && (m_do_speciesBalance != 0)) {
if (
(m_sdcIter == 0 || m_sdcIter == m_nSDCmax) && (m_do_speciesBalance != 0)) {
Real sdc_weight = (a_time == AmrOldTime) ? 0.5 : -0.5;
addRhoYFluxes(GetArrOfConstPtrs(fluxes[0]), geom[0], sdc_weight);
}
Expand Down Expand Up @@ -1040,8 +1042,9 @@ PeleLM::differentialDiffusionUpdate(
(m_use_wbar) != 0
? diffData->Dwbar[lev].const_array(mfi)
: diffData->Dhat[lev].const_array(mfi); // Dummy unused Array4
auto const& dT = (m_use_soret) != 0 ? diffData->DT[lev].const_array(mfi)
: diffData->Dhat[lev].const_array(mfi);
auto const& dT = (m_use_soret) != 0
? diffData->DT[lev].const_array(mfi)
: diffData->Dhat[lev].const_array(mfi);

amrex::ParallelFor(
bx, NUM_SPECIES,
Expand Down Expand Up @@ -1421,8 +1424,9 @@ PeleLM::getScalarDiffForce(
(m_use_wbar) != 0
? diffData->Dwbar[lev].const_array(mfi, 0)
: diffData->Dn[lev].const_array(mfi, 0); // Dummy unsed Array4
auto const& dT = (m_use_soret) != 0 ? diffData->DT[lev].const_array(mfi, 0)
: diffData->Dn[lev].const_array(mfi, 0);
auto const& dT = (m_use_soret) != 0
? diffData->DT[lev].const_array(mfi, 0)
: diffData->Dn[lev].const_array(mfi, 0);

amrex::ParallelFor(
bx,
Expand Down
2 changes: 1 addition & 1 deletion Source/PeleLMEos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ PeleLM::calcDivU(

MultiFab RhoYdot;
if ((m_do_react != 0) && (m_skipInstantRR == 0)) {
if (is_init != 0) { // Either pre-divU, divU or press initial iterations
if (is_init != 0) { // Either pre-divU, divU or press initial iterations
if (m_dt > 0.0) { // divU ite -> use I_R
auto* ldataR_p = getLevelDataReactPtr(lev);
RhoYdot.define(grids[lev], dmap[lev], nCompIR(), 0);
Expand Down
4 changes: 3 additions & 1 deletion Source/PeleLMEvolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ PeleLM::Evolve()
(plt_justDidIt == 0) && m_nstep > 0) {
WritePlotFile();
}
if ((m_check_int > 0 || m_check_per > 0.) && (chk_justDidIt == 0) && m_nstep > 0) {
if (
(m_check_int > 0 || m_check_per > 0.) && (chk_justDidIt == 0) &&
m_nstep > 0) {
WriteCheckPointFile();
}
}
Expand Down
14 changes: 8 additions & 6 deletions Source/PeleLMRegrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ PeleLM::regrid(int lbase, amrex::Real time, bool initial)
(m_loadBalanceEffRatioThreshold > 0.0) &&
(ParallelDescriptor::MyProc() ==
ParallelDescriptor::IOProcessorNumber())) {
remakeLevel =
(static_cast<int>(remakeLevel != 0) ||
(testEfficiency > m_loadBalanceEffRatioThreshold * currentEfficiency));
remakeLevel = static_cast<int>(
(remakeLevel != 0) ||
(testEfficiency >
m_loadBalanceEffRatioThreshold * currentEfficiency));
}
ParallelDescriptor::Bcast(
&remakeLevel, 1, ParallelDescriptor::IOProcessorNumber());
Expand Down Expand Up @@ -220,9 +221,10 @@ PeleLM::regrid(int lbase, amrex::Real time, bool initial)
(m_loadBalanceEffRatioThreshold > 0.0) &&
(ParallelDescriptor::MyProc() ==
ParallelDescriptor::IOProcessorNumber())) {
remakeLevel = (static_cast<int>(remakeLevel != 0) ||
(testEfficiency > m_loadBalanceEffRatioThreshold *
currentEfficiency));
remakeLevel = static_cast<int>(
(remakeLevel != 0) ||
(testEfficiency >
m_loadBalanceEffRatioThreshold * currentEfficiency));
}
ParallelDescriptor::Bcast(
&remakeLevel, 1, ParallelDescriptor::IOProcessorNumber());
Expand Down
26 changes: 14 additions & 12 deletions Source/PeleLMUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ PeleLM::fluxDivergence(
Real scale)
{
BL_PROFILE("PeleLMeX::fluxDivergence()");
if (intensiveFluxes != 0) { // Fluxes are intensive -> need area scaling in div
if (intensiveFluxes != 0) { // Fluxes are intensive -> need area scaling in
// div
for (int lev = 0; lev <= finest_level; ++lev) {
intFluxDivergenceLevel(
lev, *a_divergence[lev], div_comp, a_fluxes[lev], flux_comp, ncomp,
Expand Down Expand Up @@ -47,7 +48,8 @@ PeleLM::fluxDivergence(
{

BL_PROFILE("PeleLMeX::fluxDivergence()");
if (intensiveFluxes != 0) { // Fluxes are intensive -> need area scaling in div
if (intensiveFluxes != 0) { // Fluxes are intensive -> need area scaling in
// div
for (int lev = 0; lev <= finest_level; ++lev) {
intFluxDivergenceLevelEB(
lev, *a_divergence[lev], div_comp, a_fluxes[lev], flux_comp,
Expand Down Expand Up @@ -777,8 +779,8 @@ PeleLM::loadBalanceChemLev(int a_lev)
if (
(m_loadBalanceEffRatioThreshold > 0.0) &&
(ParallelDescriptor::MyProc() == ParallelDescriptor::IOProcessorNumber())) {
updateDmap =
static_cast<int>(testEfficiency > m_loadBalanceEffRatioThreshold * currentEfficiency);
updateDmap = static_cast<int>(
testEfficiency > m_loadBalanceEffRatioThreshold * currentEfficiency);
}
ParallelDescriptor::Bcast(
&updateDmap, 1, ParallelDescriptor::IOProcessorNumber());
Expand Down Expand Up @@ -953,7 +955,7 @@ PeleLM::initProgressVariable()
if (hasUserC != 0) {
pp.query("progressVariable.format", Cformat);
if (Cformat.compare("Cantera") == 0) { // use a Cantera-like format with
// <entry>:<weight>, default to 0.0
// <entry>:<weight>, default to 0.0
// Weights
Vector<std::string> stringIn;
Vector<Real> weightsIn(NUM_SPECIES + 1, 0.0);
Expand All @@ -980,9 +982,9 @@ PeleLM::initProgressVariable()
m_C0 += coldState[i] * m_Cweights[i];
m_C1 += hotState[i] * m_Cweights[i];
}
} else if (Cformat.compare(
"RealList") == 0) { // use a list of Real. MUST contains an entry
// for each species+Temp
} else if (Cformat.compare("RealList") == 0) { // use a list of Real. MUST
// contains an entry
// for each species+Temp
// Weights
Vector<Real> weightsIn;
int entryCount = pp.countval("progressVariable.weights");
Expand Down Expand Up @@ -1655,7 +1657,7 @@ PeleLM::initMixtureFraction()
if (hasUserMF != 0) {
pp.query("mixtureFraction.format", MFformat);
if (MFformat.compare("Cantera") == 0) { // use a Cantera-like format with
// <SpeciesName>:<Value>, default in 0.0
// <SpeciesName>:<Value>, default in 0.0
std::string MFCompoType;
pp.query("mixtureFraction.type", MFCompoType);
Vector<std::string> compositionIn;
Expand All @@ -1667,9 +1669,9 @@ PeleLM::initMixtureFraction()
compositionIn.resize(entryCount);
pp.getarr("mixtureFraction.fuelTank", compositionIn, 0, entryCount);
parseComposition(compositionIn, MFCompoType, YF);
} else if (MFformat.compare(
"RealList") == 0) { // use a list of Real. MUST contains an entry
// for each species in the mixture
} else if (MFformat.compare("RealList") == 0) { // use a list of Real. MUST
// contains an entry
// for each species in the mixture
std::string MFCompoType;
pp.query("mixtureFraction.type", MFCompoType);
if (MFCompoType.compare("mass") == 0) {
Expand Down
2 changes: 1 addition & 1 deletion Source/PeleLM_K.H
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ buildAdvectionForcing(
for (int n = 0; n < NUM_SPECIES; n++) {
y[n] = rhoY(i, j, k, n) * rhoinv; // get y
forceY(i, j, k, n) = dn(i, j, k, n); // forceY = Dnk
if (do_react != 0) {
if (do_react != 0) {
forceY(i, j, k, n) += r(i, j, k, n); // + Rk
}
forceT(i, j, k) -= forceY(i, j, k, n) * hi_spec[n] *
Expand Down

0 comments on commit 441aafe

Please sign in to comment.