From e245adff229e72a185b2b26fb55a0a9b59d24b09 Mon Sep 17 00:00:00 2001 From: "Marc T. Henry de Frahan" Date: Mon, 18 Sep 2023 16:36:36 -0600 Subject: [PATCH] Fix readability-implicit-bool-conversion (#251) --- Source/DiffusionOp.cpp | 49 ++++++++++++------------ Source/PeleLM.cpp | 12 +++--- Source/PeleLMAdvance.cpp | 24 ++++++------ Source/PeleLMAdvection.cpp | 28 +++++++------- Source/PeleLMBC.cpp | 32 +++++++++------- Source/PeleLMBCfill.H | 4 +- Source/PeleLMData.cpp | 36 +++++++++--------- Source/PeleLMDeriveFunc.cpp | 18 ++++----- Source/PeleLMDiagnostics.cpp | 2 +- Source/PeleLMDiffusion.cpp | 74 +++++++++++++++++++----------------- Source/PeleLM_K.H | 10 ++--- 11 files changed, 150 insertions(+), 139 deletions(-) diff --git a/Source/DiffusionOp.cpp b/Source/DiffusionOp.cpp index 92c551cf..3387b8d8 100644 --- a/Source/DiffusionOp.cpp +++ b/Source/DiffusionOp.cpp @@ -21,8 +21,8 @@ DiffusionOp::DiffusionOp(PeleLM* a_pelelm, int ncomp) // Solve LPInfo LPInfo info_solve; - info_solve.setAgglomeration(1); - info_solve.setConsolidation(1); + info_solve.setAgglomeration(true); + info_solve.setConsolidation(true); info_solve.setMaxCoarseningLevel(m_mg_max_coarsening_level); // Apply LPInfo (no coarsening) @@ -121,10 +121,10 @@ DiffusionOp::diffuse_scalar( AMREX_ASSERT(m_ncomp == 1 || m_ncomp == ncomp); AMREX_ASSERT(a_phi[0]->nComp() >= phi_comp + ncomp); AMREX_ASSERT(a_rhs[0]->nComp() >= rhs_comp + ncomp); - if (have_fluxes) { + if (have_fluxes != 0) { AMREX_ASSERT(a_flux[0][0]->nComp() >= flux_comp + ncomp); } - if (have_bcoeff) { + if (have_bcoeff != 0) { AMREX_ASSERT(a_bcoeff[0]->nComp() >= bcoeff_comp + ncomp); AMREX_ASSERT(a_bcrec.size() >= ncomp); } @@ -150,7 +150,7 @@ DiffusionOp::diffuse_scalar( const Box& gbx = mfi.growntilebox(); auto const& a_phi_arr = a_phi[lev]->const_array(mfi, phi_comp); auto const& a_rho_arr = - (have_density) + (have_density) != 0 ? a_density[lev]->const_array(mfi) : a_phi[lev]->const_array(mfi); // Get dummy Array4 if no density auto const& phi_arr = phi[lev].array(mfi); @@ -158,7 +158,7 @@ DiffusionOp::diffuse_scalar( gbx, ncomp, [a_phi_arr, a_rho_arr, phi_arr, have_density] AMREX_GPU_DEVICE(int i, int j, int k, int n) noexcept { - if (have_density) { + if (have_density != 0) { phi_arr(i, j, k, n) = a_phi_arr(i, j, k, n) / a_rho_arr(i, j, k); } else { phi_arr(i, j, k, n) = a_phi_arr(i, j, k, n); @@ -173,11 +173,11 @@ DiffusionOp::diffuse_scalar( // => \alpha = 1.0, A is a_acoeff if provided, 1.0 otherwise // => \beta = a_dt, B face centered diffusivity bcoeff^{np1,k} - Real alpha = (isPoissonSolve) ? 0.0 : 1.0; + Real alpha = (isPoissonSolve) != 0 ? 0.0 : 1.0; Real beta = a_dt; m_scal_solve_op->setScalars(alpha, beta); for (int lev = 0; lev <= finest_level; ++lev) { - if (have_acoeff) { + if (have_acoeff != 0) { m_scal_solve_op->setACoeffs(lev, *a_acoeff[lev]); } else { m_scal_solve_op->setACoeffs(lev, 1.0); @@ -200,14 +200,14 @@ DiffusionOp::diffuse_scalar( // Set aliases and bcoeff comp for (int lev = 0; lev <= finest_level; ++lev) { - if (have_fluxes) { + if (have_fluxes != 0) { for (int idim = 0; idim < AMREX_SPACEDIM; idim++) { fluxes[lev][idim] = new MultiFab( *a_flux[lev][idim], amrex::make_alias, flux_comp + comp, m_ncomp); } } - if (have_bcoeff) { + if (have_bcoeff != 0) { int doZeroVisc = 1; int addTurbContrib = 1; Vector subBCRec = { @@ -251,7 +251,7 @@ DiffusionOp::diffuse_scalar( GetVecOfPtrs(component), GetVecOfConstPtrs(rhs), m_mg_rtol, m_mg_atol); // Need to get the fluxes - if (have_fluxes) { + if (have_fluxes != 0) { #ifdef AMREX_USE_EB mlmg.getFluxes(fluxes, MLMG::Location::FaceCentroid); #else @@ -278,7 +278,7 @@ DiffusionOp::diffuse_scalar( const Box& bx = mfi.tilebox(); auto const& a_phi_arr = a_phi[lev]->array(mfi, phi_comp); auto const& a_rho_arr = - (have_density) + (have_density) != 0 ? a_density[lev]->const_array(mfi) : a_phi[lev]->const_array(mfi); // Get dummy Array4 if no density auto const& phi_arr = phi[lev].const_array(mfi); @@ -286,7 +286,7 @@ DiffusionOp::diffuse_scalar( bx, ncomp, [a_phi_arr, a_rho_arr, phi_arr, have_density] AMREX_GPU_DEVICE(int i, int j, int k, int n) noexcept { - if (have_density) { + if (have_density != 0) { a_phi_arr(i, j, k, n) = phi_arr(i, j, k, n) * a_rho_arr(i, j, k); } else { a_phi_arr(i, j, k, n) = phi_arr(i, j, k, n); @@ -622,7 +622,7 @@ DiffusionOp::computeDiffFluxes( const Box& gbx = mfi.growntilebox(); auto const& a_phi_arr = a_phi[lev]->const_array(mfi, phi_comp); auto const& a_rho_arr = - (have_density) + (have_density) != 0 ? a_density[lev]->const_array(mfi) : a_phi[lev]->const_array(mfi); // Get dummy Array4 if no density auto const& phi_arr = phi[lev].array(mfi); @@ -630,7 +630,7 @@ DiffusionOp::computeDiffFluxes( gbx, ncomp, [a_phi_arr, a_rho_arr, phi_arr, have_density] AMREX_GPU_DEVICE(int i, int j, int k, int n) noexcept { - if (have_density) { + if (have_density != 0) { phi_arr(i, j, k, n) = a_phi_arr(i, j, k, n) / a_rho_arr(i, j, k); } else { phi_arr(i, j, k, n) = a_phi_arr(i, j, k, n); @@ -702,7 +702,7 @@ DiffusionOp::computeDiffFluxes( } // Average down if requested - if (do_avgDown) { + if (do_avgDown != 0) { avgDownFluxes(a_flux, flux_comp, ncomp); } } @@ -869,7 +869,7 @@ DiffusionOp::computeGradient( a_phi[lev]->Factory()); MultiFab::Copy(phi[lev], *a_phi[lev], 0, 0, 1, 1); m_gradient_op->setLevelBC(lev, &phi[lev]); - if (need_laplacian) { + if (need_laplacian != 0) { laps.emplace_back(*a_laps[lev], amrex::make_alias, 0, 1); } else { laps.emplace_back( @@ -885,7 +885,7 @@ DiffusionOp::computeGradient( #else mlmg.getFluxes(a_grad, GetVecOfPtrs(phi), MLMG::Location::FaceCenter); #endif - if (do_avgDown) { + if (do_avgDown != 0) { avgDownFluxes(a_grad, 0, 1); } } @@ -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) { // 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; @@ -1123,7 +1124,7 @@ DiffusionTensorOp::compute_divtau( mlmg.apply(a_divtau, GetVecOfPtrs(vel)); #endif - if (have_density) { + if (have_density != 0) { for (int lev = 0; lev <= finest_level; ++lev) { #ifdef AMREX_USE_OMP #pragma omp parallel if (Gpu::notInLaunchRegion()) @@ -1163,7 +1164,7 @@ DiffusionTensorOp::diffuse_velocity( m_solve_op->setScalars(1.0, a_dt); for (int lev = 0; lev <= finest_level; ++lev) { - if (have_density) { + if (have_density != 0) { m_solve_op->setACoeffs(lev, *a_density[lev]); } else { m_solve_op->setACoeffs(lev, m_pelelm->m_rho); @@ -1193,15 +1194,15 @@ DiffusionTensorOp::diffuse_velocity( Box const& bx = mfi.tilebox(); auto const& rhs_a = rhs[lev].array(mfi); auto const& vel_a = a_vel[lev]->const_array(mfi); - auto const& rho_a = (have_density) ? a_density[lev]->const_array(mfi) - : Array4{}; + auto const& rho_a = (have_density) != 0 ? a_density[lev]->const_array(mfi) + : Array4{}; amrex::ParallelFor( bx, AMREX_SPACEDIM, [=, rho_incomp = m_pelelm->m_rho, is_incomp = m_pelelm ->m_incompressible] AMREX_GPU_DEVICE(int i, int j, int k, int n) noexcept { - if (is_incomp) { + if (is_incomp != 0) { rhs_a(i, j, k, n) = rho_incomp * vel_a(i, j, k, n); } else { rhs_a(i, j, k, n) = rho_a(i, j, k) * vel_a(i, j, k, n); diff --git a/Source/PeleLM.cpp b/Source/PeleLM.cpp index df480629..d52b2799 100644 --- a/Source/PeleLM.cpp +++ b/Source/PeleLM.cpp @@ -14,7 +14,7 @@ PeleLM::PeleLM() = default; PeleLM::~PeleLM() { - if (!m_incompressible) { + if (m_incompressible == 0) { trans_parms.deallocate(); m_reactor->close(); } @@ -47,7 +47,7 @@ PeleLM::getLevelDataPtr( } else { m_leveldata_floating.reset(new LevelData( grids[lev], dmap[lev], *m_factory[lev], m_incompressible, m_has_divu, - m_nAux, m_nGrowState, m_use_soret, m_do_les)); + m_nAux, m_nGrowState, m_use_soret, static_cast(m_do_les))); Real time = getTime(lev, a_time); fillpatch_state(lev, time, m_leveldata_floating->state, m_nGrowState); // if (useUMac) { @@ -64,7 +64,7 @@ PeleLM::getLevelDataPtr( PeleLM::LevelDataReact* PeleLM::getLevelDataReactPtr(int lev) { - if (m_do_react) { + if (m_do_react != 0) { return m_leveldatareact[lev].get(); } else { return nullptr; @@ -77,7 +77,7 @@ PeleLM::getStateVect(const TimeStamp& a_time) Vector> r; r.reserve(finest_level + 1); if (a_time == AmrOldTime) { - if (m_incompressible) { + if (m_incompressible != 0) { for (int lev = 0; lev <= finest_level; ++lev) { r.push_back(std::make_unique( m_leveldata_old[lev]->state, amrex::make_alias, 0, AMREX_SPACEDIM)); @@ -89,7 +89,7 @@ PeleLM::getStateVect(const TimeStamp& a_time) } } } else { - if (m_incompressible) { + if (m_incompressible != 0) { for (int lev = 0; lev <= finest_level; ++lev) { r.push_back(std::make_unique( m_leveldata_new[lev]->state, amrex::make_alias, 0, AMREX_SPACEDIM)); @@ -279,7 +279,7 @@ PeleLM::getIRVect() void PeleLM::averageDownState(const PeleLM::TimeStamp& a_time) { - int nCompState = (m_incompressible) ? AMREX_SPACEDIM : NVAR; + int nCompState = (m_incompressible) != 0 ? AMREX_SPACEDIM : NVAR; for (int lev = finest_level; lev > 0; --lev) { auto* ldataFine_p = getLevelDataPtr(lev, a_time); auto* ldataCrse_p = getLevelDataPtr(lev - 1, a_time); diff --git a/Source/PeleLMAdvance.cpp b/Source/PeleLMAdvance.cpp index 7587202d..6ac4e4f3 100644 --- a/Source/PeleLMAdvance.cpp +++ b/Source/PeleLMAdvance.cpp @@ -22,12 +22,12 @@ PeleLM::Advance(int is_initIter) //---------------------------------------------------------------- // Deal with ambient pressure - if (m_closed_chamber) { + if (m_closed_chamber != 0) { m_pNew = m_pOld; } // Put together new typical values - if (!is_initIter && m_nstep > 0 && m_nstep % m_resetTypValInt == 0) { + if ((is_initIter == 0) && m_nstep > 0 && m_nstep % m_resetTypValInt == 0) { setTypicalValues(AmrNewTime); } @@ -54,7 +54,7 @@ PeleLM::Advance(int is_initIter) } //---------------------------------------------------------------- - if (m_verbose) { + if (m_verbose != 0) { amrex::Print() << " STEP [" << m_nstep << "] - Time: " << m_cur_time << ", dt " << m_dt << "\n"; } @@ -85,7 +85,7 @@ PeleLM::Advance(int is_initIter) initTemporals(); // Reset velocity flux on boundary faces if doing closed chamber - if (m_closed_chamber) { + if (m_closed_chamber != 0) { for (int idim = 0; idim < AMREX_SPACEDIM; idim++) { m_domainUmacFlux[2 * idim] = 0.0; m_domainUmacFlux[2 * idim + 1] = 0.0; @@ -98,7 +98,7 @@ PeleLM::Advance(int is_initIter) // compute t^{n} data calcViscosity(AmrOldTime); - if (!m_incompressible) { + if (m_incompressible == 0) { calcDiffusivity(AmrOldTime); #ifdef PELE_USE_EFIELD poissonSolveEF(AmrOldTime); @@ -120,7 +120,7 @@ PeleLM::Advance(int is_initIter) } #endif - if (!m_incompressible) { + if (m_incompressible == 0) { floorSpecies(AmrOldTime); //---------------------------------------------------------------- @@ -139,7 +139,7 @@ PeleLM::Advance(int is_initIter) BL_PROFILE_VAR_START(PLM_SETUP); //---------------------------------------------------------------- copyTransportOldToNew(); - if (!m_incompressible) { + if (m_incompressible == 0) { copyDiffusionOldToNew(diffData); #ifdef PELE_USE_EFIELD ionDriftVelocity(advData); @@ -150,7 +150,7 @@ PeleLM::Advance(int is_initIter) //---------------------------------------------------------------- // Scalar advance - if (m_incompressible) { + if (m_incompressible != 0) { Real MACStart = 0.0; if (m_verbose > 1) { MACStart = ParallelDescriptor::second(); @@ -187,7 +187,7 @@ PeleLM::Advance(int is_initIter) clipSootMoments(); } #endif - if (m_has_divu) { + if (m_has_divu != 0) { int is_initialization = 0; // Not here int computeDiffusionTerm = 1; // Yes, re-evaluate the diffusion term after the last chemistry solve @@ -207,7 +207,7 @@ PeleLM::Advance(int is_initIter) VelAdvStart = ParallelDescriptor::second(); } // Re-evaluate viscosity only if scalar updated - if (!m_incompressible) { + if (m_incompressible == 0) { calcViscosity(AmrNewTime); } @@ -237,7 +237,7 @@ PeleLM::Advance(int is_initIter) //---------------------------------------------------------------- // Deal with ambient pressure - if (m_closed_chamber && !is_initIter) { + if ((m_closed_chamber != 0) && (is_initIter == 0)) { m_pOld = m_pNew; } @@ -281,7 +281,7 @@ PeleLM::oneSDC( calcDiffusivity(AmrNewTime); computeDifferentialDiffusionTerms(AmrNewTime, diffData); - if (m_has_divu) { + if (m_has_divu != 0) { int is_initialization = 0; // Not here int computeDiffusionTerm = 0; // Nope, we just did that int do_avgDown = 1; // Always diff --git a/Source/PeleLMAdvection.cpp b/Source/PeleLMAdvection.cpp index ab6f23ad..3d244fee 100644 --- a/Source/PeleLMAdvection.cpp +++ b/Source/PeleLMAdvection.cpp @@ -57,7 +57,7 @@ PeleLM::computeVelocityAdvTerm(std::unique_ptr& advData) // Get divU MultiFab divu( grids[lev], dmap[lev], 1, m_nGrowdivu, MFInfo(), Factory(lev)); - if (m_incompressible) { + if (m_incompressible != 0) { divu.setVal(0.0); } else { Real time = getTime(lev, AmrOldTime); @@ -101,7 +101,7 @@ PeleLM::computeVelocityAdvTerm(std::unique_ptr& advData) #ifdef AMREX_USE_EB ebfact, #endif - m_Godunov_ppm, m_Godunov_ForceInTrans, is_velocity, + m_Godunov_ppm != 0, m_Godunov_ForceInTrans != 0, is_velocity, fluxes_are_area_weighted, m_advection_type, m_Godunov_ppm_limiter); } #ifdef AMREX_USE_EB @@ -136,7 +136,7 @@ PeleLM::computeVelocityAdvTerm(std::unique_ptr& advData) MultiFab divu( grids[lev], dmap[lev], 1, m_nGrowdivu, MFInfo(), Factory(lev)); - if (m_incompressible) { + if (m_incompressible != 0) { divu.setVal(0.0); } else { Real time = getTime(lev, AmrOldTime); @@ -338,7 +338,7 @@ PeleLM::computeScalarAdvTerms(std::unique_ptr& advData) // Get divU MultiFab divu( grids[lev], dmap[lev], 1, m_nGrowdivu, MFInfo(), Factory(lev)); - if (m_incompressible) { + if (m_incompressible != 0) { divu.setVal(0.0); } else { MultiFab::Copy(divu, advData->mac_divu[lev], 0, 0, 1, m_nGrowdivu); @@ -440,7 +440,7 @@ PeleLM::computeScalarAdvTerms(std::unique_ptr& advData) #ifdef AMREX_USE_EB ebfact, #endif - m_Godunov_ppm, m_Godunov_ForceInTrans, is_velocity, + m_Godunov_ppm != 0, m_Godunov_ForceInTrans != 0, is_velocity, fluxes_are_area_weighted, m_advection_type, m_Godunov_ppm_limiter); #endif } @@ -528,7 +528,7 @@ PeleLM::computeScalarAdvTerms(std::unique_ptr& advData) #ifdef AMREX_USE_EB ebfact, #endif - m_Godunov_ppm, m_Godunov_ForceInTrans, is_velocity, + m_Godunov_ppm != 0, m_Godunov_ForceInTrans != 0, is_velocity, fluxes_are_area_weighted, m_advection_type, m_Godunov_ppm_limiter); } @@ -613,7 +613,7 @@ PeleLM::computeScalarAdvTerms(std::unique_ptr& advData) #ifdef AMREX_USE_EB ebfact, #endif - m_Godunov_ppm, m_Godunov_ForceInTrans, is_velocity, + m_Godunov_ppm != 0, m_Godunov_ForceInTrans != 0, is_velocity, fluxes_are_area_weighted, m_advection_type, m_Godunov_ppm_limiter); } #ifdef AMREX_USE_EB @@ -639,13 +639,13 @@ PeleLM::computeScalarAdvTerms(std::unique_ptr& advData) // If balances are required, compute face domain integrals // using level 0 since we've averaged down the fluxes already if (m_sdcIter == m_nSDCmax) { - if (m_do_massBalance) { + if (m_do_massBalance != 0) { addMassFluxes(GetArrOfConstPtrs(fluxes[0]), geom[0]); } - if (m_do_energyBalance) { + if (m_do_energyBalance != 0) { addRhoHFluxes(GetArrOfConstPtrs(fluxes[0]), geom[0]); } - if (m_do_speciesBalance) { + if (m_do_speciesBalance != 0) { addRhoYFluxes(GetArrOfConstPtrs(fluxes[0]), geom[0]); } } @@ -678,7 +678,7 @@ PeleLM::computeScalarAdvTerms(std::unique_ptr& advData) MultiFab divu( grids[lev], dmap[lev], 1, m_nGrowdivu, MFInfo(), Factory(lev)); - if (m_incompressible) { + if (m_incompressible != 0) { divu.setVal(0.0); } else { Real time = getTime(lev, AmrOldTime); @@ -801,7 +801,7 @@ PeleLM::computePassiveAdvTerms( // Get divU MultiFab divu( grids[lev], dmap[lev], 1, m_nGrowdivu, MFInfo(), Factory(lev)); - if (m_incompressible) { + if (m_incompressible != 0) { divu.setVal(0.0); } else { MultiFab::Copy(divu, advData->mac_divu[lev], 0, 0, 1, m_nGrowdivu); @@ -846,7 +846,7 @@ PeleLM::computePassiveAdvTerms( #ifdef AMREX_USE_EB ebfact, #endif - m_Godunov_ppm, m_Godunov_ForceInTrans, is_velocity, + m_Godunov_ppm != 0, m_Godunov_ForceInTrans != 0, is_velocity, fluxes_are_area_weighted, m_advection_type, m_Godunov_ppm_limiter); } #ifdef AMREX_USE_EB @@ -880,7 +880,7 @@ PeleLM::computePassiveAdvTerms( MultiFab divu( grids[lev], dmap[lev], 1, m_nGrowdivu, MFInfo(), Factory(lev)); - if (m_incompressible) { + if (m_incompressible != 0) { divu.setVal(0.0); } else { Real time = getTime(lev, AmrOldTime); diff --git a/Source/PeleLMBC.cpp b/Source/PeleLMBC.cpp index f1482636..fc4b51d2 100644 --- a/Source/PeleLMBC.cpp +++ b/Source/PeleLMBC.cpp @@ -112,7 +112,7 @@ PeleLM::setBoundaryConditions() } } - if (!m_incompressible) { + if (m_incompressible == 0) { // Density for (int idim = 0; idim < AMREX_SPACEDIM; idim++) { m_bcrec_state[DENSITY].setLo(idim, density_bc[lo_bc[idim]]); @@ -146,7 +146,7 @@ PeleLM::setBoundaryConditions() } // divU - if (m_has_divu) { + if (m_has_divu != 0) { for (int idim = 0; idim < AMREX_SPACEDIM; idim++) { m_bcrec_divu.setLo(idim, divu_bc[lo_bc[idim]]); m_bcrec_divu.setHi(idim, divu_bc[hi_bc[idim]]); @@ -228,8 +228,8 @@ PeleLM::fillPatchState(int lev, const TimeStamp& a_time) Real time = getTime(lev, a_time); fillpatch_state(lev, time, ldata_p->state, m_nGrowState); - if (!m_incompressible) { - if (m_has_divu) { + if (m_incompressible == 0) { + if (m_has_divu != 0) { fillpatch_divu(lev, time, ldata_p->divu, ldata_p->divu.nGrow()); } } @@ -292,7 +292,7 @@ PeleLM::fillPatchState(int lev, Real a_time, int nGrow) BL_PROFILE("PeleLMeX::fillPatchState()"); std::unique_ptr mf; - if (m_incompressible) { + if (m_incompressible != 0) { mf.reset(new MultiFab( grids[lev], dmap[lev], AMREX_SPACEDIM, nGrow, MFInfo(), Factory(lev))); } else { @@ -331,7 +331,7 @@ PeleLM::fillpatch_state( pele::physics::PMF::PmfData::DataContainer const* lpmfdata = pmf_data.getDeviceData(); - int nCompState = (m_incompressible) ? AMREX_SPACEDIM : NVAR; + int nCompState = (m_incompressible) != 0 ? AMREX_SPACEDIM : NVAR; fillTurbInflow(a_state, VELX, lev, a_time); @@ -339,7 +339,8 @@ PeleLM::fillpatch_state( PhysBCFunct> bndry_func( geom[lev], fetchBCRecArray(0, nCompState), PeleLMCCFillExtDirState{ - lprobparm, lpmfdata, m_nAux, turb_inflow.is_initialized()}); + lprobparm, lpmfdata, m_nAux, + static_cast(turb_inflow.is_initialized())}); FillPatchSingleLevel( a_state, IntVect(nGhost), a_time, {&(m_leveldata_old[lev]->state), &(m_leveldata_new[lev]->state)}, @@ -352,11 +353,13 @@ PeleLM::fillpatch_state( PhysBCFunct> crse_bndry_func( geom[lev - 1], fetchBCRecArray(0, nCompState), PeleLMCCFillExtDirState{ - lprobparm, lpmfdata, m_nAux, turb_inflow.is_initialized()}); + lprobparm, lpmfdata, m_nAux, + static_cast(turb_inflow.is_initialized())}); PhysBCFunct> fine_bndry_func( geom[lev], fetchBCRecArray(0, nCompState), PeleLMCCFillExtDirState{ - lprobparm, lpmfdata, m_nAux, turb_inflow.is_initialized()}); + lprobparm, lpmfdata, m_nAux, + static_cast(turb_inflow.is_initialized())}); FillPatchTwoLevels( a_state, IntVect(nGhost), a_time, {&(m_leveldata_old[lev - 1]->state), &(m_leveldata_new[lev - 1]->state)}, @@ -724,7 +727,7 @@ PeleLM::fillcoarsepatch_state( pele::physics::PMF::PmfData::DataContainer const* lpmfdata = pmf_data.getDeviceData(); - int nCompState = (m_incompressible) ? AMREX_SPACEDIM : NVAR; + int nCompState = (m_incompressible) != 0 ? AMREX_SPACEDIM : NVAR; fillTurbInflow(a_state, VELX, lev, a_time); @@ -734,11 +737,13 @@ PeleLM::fillcoarsepatch_state( PhysBCFunct> crse_bndry_func( geom[lev - 1], fetchBCRecArray(0, nCompState), PeleLMCCFillExtDirState{ - lprobparm, lpmfdata, m_nAux, turb_inflow.is_initialized()}); + lprobparm, lpmfdata, m_nAux, + static_cast(turb_inflow.is_initialized())}); PhysBCFunct> fine_bndry_func( geom[lev], fetchBCRecArray(0, nCompState), PeleLMCCFillExtDirState{ - lprobparm, lpmfdata, m_nAux, turb_inflow.is_initialized()}); + lprobparm, lpmfdata, m_nAux, + static_cast(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, @@ -861,7 +866,8 @@ PeleLM::setInflowBoundaryVel(MultiFab& a_vel, int lev, TimeStamp a_time) PhysBCFunct> bndry_func( geom[lev], dummyVelBCRec, PeleLMCCFillExtDirState{ - lprobparm, lpmfdata, m_nAux, turb_inflow.is_initialized()}); + lprobparm, lpmfdata, m_nAux, + static_cast(turb_inflow.is_initialized())}); bndry_func(a_vel, 0, AMREX_SPACEDIM, a_vel.nGrowVect(), time, 0); diff --git a/Source/PeleLMBCfill.H b/Source/PeleLMBCfill.H index 5697db54..ea06b7e8 100644 --- a/Source/PeleLMBCfill.H +++ b/Source/PeleLMBCfill.H @@ -66,7 +66,7 @@ struct PeleLMCCFillExtDirState // If using TurbInflow, pass in the turbulent data. User can overwrite // if needed - if (m_do_turbInflow) { + if (m_do_turbInflow != 0) { if (n >= VELX && n < DENSITY) { if (!isnan( state(iv, VELX + n))) { // During fillcoarsepatch, get here @@ -97,7 +97,7 @@ struct PeleLMCCFillExtDirState // If using TurbInflow, pass in the turbulent data. User can overwrite // if needed - if (m_do_turbInflow) { + if (m_do_turbInflow != 0) { if (n >= VELX && n < DENSITY) { if (!isnan( state(iv, VELX + n))) { // During fillcoarsepatch, get here diff --git a/Source/PeleLMData.cpp b/Source/PeleLMData.cpp index e2faa1ec..9304b6e2 100644 --- a/Source/PeleLMData.cpp +++ b/Source/PeleLMData.cpp @@ -13,7 +13,7 @@ PeleLM::LevelData::LevelData( int a_use_soret, int a_do_les) { - if (a_incompressible) { + if (a_incompressible != 0) { state.define(ba, dm, AMREX_SPACEDIM, a_nGrowState, MFInfo(), factory); } else { state.define(ba, dm, NVAR, a_nGrowState, MFInfo(), factory); @@ -22,23 +22,23 @@ PeleLM::LevelData::LevelData( press.define( amrex::convert(ba, IntVect::TheNodeVector()), dm, 1, 1, MFInfo(), factory); visc_cc.define(ba, dm, 1, 1, MFInfo(), factory); - if (a_do_les) { + if (a_do_les != 0) { for (int i = 0; i < AMREX_SPACEDIM; ++i) { visc_turb_fc[i].define( amrex::convert(ba, IntVect::TheDimensionVector(i)), dm, 1, 0, MFInfo(), factory); - if (!a_incompressible) { + if (a_incompressible == 0) { lambda_turb_fc[i].define( amrex::convert(ba, IntVect::TheDimensionVector(i)), dm, 1, 0, MFInfo(), factory); } } } - if (!a_incompressible) { - if (a_has_divu) { + if (a_incompressible == 0) { + if (a_has_divu != 0) { divu.define(ba, dm, 1, 1, MFInfo(), factory); } - if (a_use_soret) { + if (a_use_soret != 0) { diff_cc.define(ba, dm, 2 * NUM_SPECIES + 2, 1, MFInfo(), factory); } else { diff_cc.define(ba, dm, NUM_SPECIES + 2, 1, MFInfo(), factory); @@ -98,7 +98,7 @@ PeleLM::AdvanceDiffData::AdvanceDiffData( int a_use_soret, int is_init) { - if (is_init) { // All I need is a container for a single diffusion term + if (is_init != 0) { // All I need is a container for a single diffusion term // Resize Vectors Dnp1.resize(a_finestLevel + 1); @@ -112,11 +112,11 @@ PeleLM::AdvanceDiffData::AdvanceDiffData( Dn.resize(a_finestLevel + 1); Dnp1.resize(a_finestLevel + 1); Dhat.resize(a_finestLevel + 1); - if (a_use_wbar) { + if (a_use_wbar != 0) { Dwbar.resize(a_finestLevel + 1); wbar_fluxes.resize(a_finestLevel + 1); } - if (a_use_soret) { + if (a_use_soret != 0) { DT.resize(a_finestLevel + 1); soret_fluxes.resize(a_finestLevel + 1); } @@ -129,7 +129,7 @@ PeleLM::AdvanceDiffData::AdvanceDiffData( ba[lev], dm[lev], NUM_SPECIES + 2, nGrowAdv, MFInfo(), *factory[lev]); Dhat[lev].define( ba[lev], dm[lev], NUM_SPECIES + 2, nGrowAdv, MFInfo(), *factory[lev]); - if (a_use_wbar) { + if (a_use_wbar != 0) { Dwbar[lev].define( ba[lev], dm[lev], NUM_SPECIES, nGrowAdv, MFInfo(), *factory[lev]); for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) { @@ -139,7 +139,7 @@ PeleLM::AdvanceDiffData::AdvanceDiffData( faceba, dm[lev], NUM_SPECIES, 0, MFInfo(), *factory[lev]); } } - if (a_use_soret) { + if (a_use_soret != 0) { DT[lev].define( ba[lev], dm[lev], NUM_SPECIES, nGrowAdv, MFInfo(), *factory[lev]); for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) { @@ -165,7 +165,7 @@ PeleLM::AdvanceAdvData::AdvanceAdvData( // Resize Vectors umac.resize(a_finestLevel + 1); AofS.resize(a_finestLevel + 1); - if (!a_incompressible) { + if (a_incompressible == 0) { chi.resize(a_finestLevel + 1); Forcing.resize(a_finestLevel + 1); mac_divu.resize(a_finestLevel + 1); @@ -186,7 +186,7 @@ PeleLM::AdvanceAdvData::AdvanceAdvData( faceba, dm[lev], NUM_IONS, nGrowMAC, MFInfo(), *factory[lev]); #endif } - if (a_incompressible) { + if (a_incompressible != 0) { AofS[lev].define( ba[lev], dm[lev], AMREX_SPACEDIM, 0, MFInfo(), *factory[lev]); } else { @@ -212,7 +212,7 @@ PeleLM::copyStateNewToOld(int nGhost) { AMREX_ASSERT(nGhost <= m_nGrowState); for (int lev = 0; lev <= finest_level; lev++) { - if (m_incompressible) { + if (m_incompressible != 0) { MultiFab::Copy( m_leveldata_old[lev]->state, m_leveldata_new[lev]->state, 0, 0, AMREX_SPACEDIM, nGhost); @@ -220,7 +220,7 @@ PeleLM::copyStateNewToOld(int nGhost) MultiFab::Copy( m_leveldata_old[lev]->state, m_leveldata_new[lev]->state, 0, 0, NVAR, nGhost); - if (m_has_divu) { + if (m_has_divu != 0) { MultiFab::Copy( m_leveldata_old[lev]->divu, m_leveldata_new[lev]->divu, 0, 0, 1, std::min(nGhost, 1)); @@ -246,7 +246,7 @@ PeleLM::copyStateOldToNew(int nGhost) { AMREX_ASSERT(nGhost <= m_nGrowState); for (int lev = 0; lev <= finest_level; lev++) { - if (m_incompressible) { + if (m_incompressible != 0) { MultiFab::Copy( m_leveldata_new[lev]->state, m_leveldata_old[lev]->state, 0, 0, AMREX_SPACEDIM, nGhost); @@ -254,7 +254,7 @@ PeleLM::copyStateOldToNew(int nGhost) MultiFab::Copy( m_leveldata_new[lev]->state, m_leveldata_old[lev]->state, 0, 0, NVAR, nGhost); - if (m_has_divu) { + if (m_has_divu != 0) { MultiFab::Copy( m_leveldata_new[lev]->divu, m_leveldata_old[lev]->divu, 0, 0, 1, std::min(nGhost, 1)); @@ -269,7 +269,7 @@ PeleLM::copyTransportOldToNew() for (int lev = 0; lev <= finest_level; lev++) { MultiFab::Copy( m_leveldata_new[lev]->visc_cc, m_leveldata_old[lev]->visc_cc, 0, 0, 1, 1); - if (!m_incompressible) { + if (m_incompressible == 0) { MultiFab::Copy( m_leveldata_new[lev]->diff_cc, m_leveldata_old[lev]->diff_cc, 0, 0, NUM_SPECIES + 2, 1); diff --git a/Source/PeleLMDeriveFunc.cpp b/Source/PeleLMDeriveFunc.cpp index ab7ed3ce..f9d19c84 100644 --- a/Source/PeleLMDeriveFunc.cpp +++ b/Source/PeleLMDeriveFunc.cpp @@ -897,7 +897,7 @@ pelelm_derkineticenergy( { AMREX_ASSERT(derfab.box().contains(bx)); AMREX_ASSERT(statefab.box().contains(bx)); - if (a_pelelm->m_incompressible) { + if (a_pelelm->m_incompressible != 0) { auto const vel = statefab.array(VELX); auto der = derfab.array(dcomp); amrex::ParallelFor( @@ -947,7 +947,7 @@ pelelm_derenstrophy( , const amrex::Real idz = geom.InvCellSize(2);); auto const& dat_arr = statefab.const_array(VELX); - auto const& rho_arr = (a_pelelm->m_incompressible) + auto const& rho_arr = (a_pelelm->m_incompressible) != 0 ? Array4{} : statefab.const_array(DENSITY); auto const& ens_arr = derfab.array(dcomp); @@ -1120,7 +1120,7 @@ pelelm_derenstrophy( [=, incomp = a_pelelm->m_incompressible, rho = a_pelelm->m_rho] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { Real l_rho = rho; - if (!incomp) { + if (incomp == 0) { l_rho = rho_arr(i, j, k); } #if (AMREX_SPACEDIM == 2) @@ -1254,7 +1254,7 @@ pelelm_derprogvar( prog_var(i, j, k) += (rhoY(i, j, k, n) * Cweights[n]) * rho_inv; } prog_var(i, j, k) += temp(i, j, k) * Cweights[NUM_SPECIES]; - if (revert) { + if (revert != 0) { prog_var(i, j, k) = 1.0 - (prog_var(i, j, k) - C0_lcl) * denom_inv; } else { prog_var(i, j, k) = (prog_var(i, j, k) - C0_lcl) * denom_inv; @@ -1284,7 +1284,7 @@ pelelm_dervisc( AMREX_ASSERT(statefab.box().contains(bx)); AMREX_ASSERT(derfab.nComp() >= dcomp + ncomp); - if (a_pelelm->m_incompressible) { + if (a_pelelm->m_incompressible != 0) { derfab.setVal(a_pelelm->m_mu, bx, dcomp, 1); } else { auto const& rhoY = statefab.const_array(FIRSTSPEC); @@ -1320,7 +1320,7 @@ pelelm_derdiffc( AMREX_ASSERT(derfab.box().contains(bx)); AMREX_ASSERT(statefab.box().contains(bx)); AMREX_ASSERT(derfab.nComp() >= dcomp + ncomp); - if (a_pelelm->m_use_soret) { + if (a_pelelm->m_use_soret != 0) { AMREX_ASSERT(ncomp == 2 * NUM_SPECIES); } else { AMREX_ASSERT(ncomp == NUM_SPECIES); @@ -1332,7 +1332,7 @@ pelelm_derdiffc( auto lambda = dummies.array(0); auto mu = dummies.array(1); auto const* ltransparm = a_pelelm->trans_parms.device_trans_parm(); - if (a_pelelm->m_use_soret) { + if (a_pelelm->m_use_soret != 0) { auto rhotheta = derfab.array(dcomp + NUM_SPECIES); amrex::ParallelFor( bx, [rhoY, T, rhoD, rhotheta, lambda, mu, @@ -1341,7 +1341,7 @@ pelelm_derdiffc( i, j, k, rhoY, T, rhoD, rhotheta, lambda, mu, ltransparm); }); } else { - if (a_pelelm->m_unity_Le) { + if (a_pelelm->m_unity_Le != 0) { amrex::Real ScInv = a_pelelm->m_Schmidt_inv; amrex::Real PrInv = a_pelelm->m_Prandtl_inv; amrex::ParallelFor( @@ -1395,7 +1395,7 @@ pelelm_derlambda( amrex::ParallelFor( bx, [rhoY, T, rhoD, lambda, mu, ltransparm, unity_Le, ScInv, PrInv] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { - if (unity_Le) { + if (unity_Le != 0) { getTransportCoeffUnityLe( i, j, k, ScInv, PrInv, rhoY, T, rhoD, lambda, mu, ltransparm); } else { diff --git a/Source/PeleLMDiagnostics.cpp b/Source/PeleLMDiagnostics.cpp index 0051fe4d..c3cf424a 100644 --- a/Source/PeleLMDiagnostics.cpp +++ b/Source/PeleLMDiagnostics.cpp @@ -79,7 +79,7 @@ PeleLM::doDiagnostics() // redundantly derived each time int mf_idx = 0; const PeleLMDeriveRec* rec = derive_lst.get(m_diagVars[v]); - if (rec) { + if (rec != nullptr) { mf_idx = rec->variableComp(m_diagVars[v]); } MultiFab::Copy(*diagMFVec[lev].get(), *mf, mf_idx, v, 1, 1); diff --git a/Source/PeleLMDiffusion.cpp b/Source/PeleLMDiffusion.cpp index 6ed04855..23213c94 100644 --- a/Source/PeleLMDiffusion.cpp +++ b/Source/PeleLMDiffusion.cpp @@ -88,11 +88,12 @@ PeleLM::computeDifferentialDiffusionTerms( // wbar term During initialization, don't bother getting the wbar fluxes // separately Vector> wbarFluxVec = - (is_init || !m_use_wbar) ? Vector>{} - : GetVecOfArrOfPtrs(diffData->wbar_fluxes); + ((is_init != 0) || (m_use_wbar == 0)) + ? Vector>{} + : GetVecOfArrOfPtrs(diffData->wbar_fluxes); Vector> soretFluxVec = - (m_use_soret) ? GetVecOfArrOfPtrs(diffData->soret_fluxes) - : Vector>{}; + (m_use_soret) != 0 ? GetVecOfArrOfPtrs(diffData->soret_fluxes) + : Vector>{}; #ifdef AMREX_USE_EB if (m_isothermalEB) { computeDifferentialDiffusionFluxes( @@ -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) { + 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); } @@ -152,7 +154,7 @@ PeleLM::computeDifferentialDiffusionTerms( #endif // Get the wbar term if appropriate - if (!is_init && m_use_wbar) { + if ((is_init == 0) && (m_use_wbar != 0)) { #ifdef AMREX_USE_EB fluxDivergenceRD( GetVecOfConstPtrs(getSpeciesVect(a_time)), 0, @@ -168,7 +170,7 @@ PeleLM::computeDifferentialDiffusionTerms( } // Get the Soret term if appropriate - if (!is_init && m_use_soret) { + if ((is_init == 0) && (m_use_soret != 0)) { #ifdef AMREX_USE_EB fluxDivergenceRD( GetVecOfConstPtrs(getSpeciesVect(a_time)), 0, GetVecOfPtrs(diffData->DT), @@ -254,9 +256,9 @@ PeleLM::computeDifferentialDiffusionFluxes( #endif // Add the wbar term - if (m_use_wbar) { + if (m_use_wbar != 0) { int need_wbar_fluxes = (a_wbarfluxes.empty()) ? 0 : 1; - if (!need_wbar_fluxes) { + if (need_wbar_fluxes == 0) { addWbarTerm( a_fluxes, {}, GetVecOfConstPtrs(getSpeciesVect(a_time)), GetVecOfConstPtrs(getDensityVect(a_time)), @@ -270,9 +272,9 @@ PeleLM::computeDifferentialDiffusionFluxes( } // Add the Soret term - if (m_use_soret) { + if (m_use_soret != 0) { int need_soret_fluxes = (a_soretfluxes.empty()) ? 0 : 1; - if (!need_soret_fluxes) { + if (need_soret_fluxes == 0) { addSoretTerm( a_fluxes, {}, GetVecOfConstPtrs(getSpeciesVect(a_time)), GetVecOfConstPtrs(getTempVect(a_time)), @@ -415,7 +417,7 @@ PeleLM::addWbarTerm( lev, 0, NUM_SPECIES, doZeroVisc, bcRecSpec, *a_beta[lev], addTurbContrib); const Box& domain = geom[lev].Domain(); - bool use_harmonic_avg = m_harm_avg_cen2edge ? true : false; + bool use_harmonic_avg = m_harm_avg_cen2edge != 0 ? true : false; #ifdef AMREX_USE_OMP #pragma omp parallel if (Gpu::notInLaunchRegion()) @@ -453,7 +455,7 @@ PeleLM::addWbarTerm( auto const& beta_ar = beta_ec[idim].const_array(mfi); auto const& spFlux_ar = a_spfluxes[lev][idim]->array(mfi); auto const& spwbarFlux_ar = - (need_wbar_fluxes) + (need_wbar_fluxes) != 0 ? a_spwbarfluxes[lev][idim]->array(mfi) : a_spfluxes[lev][idim]->array(mfi); // Dummy unused Array4 @@ -481,7 +483,7 @@ PeleLM::addWbarTerm( spFlux_ar(i, j, k, n) -= y[n] / WBAR * beta_ar(i, j, k, n) * gradWbar_ar(i, j, k); } - if (need_wbar_fluxes) { + if (need_wbar_fluxes != 0) { for (int n = 0; n < NUM_SPECIES; n++) { spwbarFlux_ar(i, j, k, n) = -y[n] / WBAR * beta_ar(i, j, k, n) * gradWbar_ar(i, j, k); @@ -539,7 +541,7 @@ PeleLM::addSoretTerm( lev, NUM_SPECIES + 2, NUM_SPECIES, doZeroVisc, bcRecSpec, *a_beta[lev]); const Box& domain = geom[lev].Domain(); - bool use_harmonic_avg = m_harm_avg_cen2edge ? true : false; + bool use_harmonic_avg = m_harm_avg_cen2edge != 0 ? true : false; #ifdef AMREX_USE_OMP #pragma omp parallel if (Gpu::notInLaunchRegion()) @@ -606,7 +608,7 @@ PeleLM::addSoretTerm( auto const& beta_ar = beta_ec[idim].const_array(mfi); auto const& spFlux_ar = a_spfluxes[lev][idim]->array(mfi); auto const& spsoretFlux_ar = - (need_soret_fluxes) + (need_soret_fluxes) != 0 ? a_spsoretfluxes[lev][idim]->array(mfi) : a_spfluxes[lev][idim]->array(mfi); // Dummy unused Array4 @@ -630,7 +632,7 @@ PeleLM::addSoretTerm( beta_ar(i, j, k, n) * gradT_ar(i, j, k) / T(i, j, k); } - if (need_soret_fluxes) { + if (need_soret_fluxes != 0) { for (int n = 0; n < NUM_SPECIES; n++) { spsoretFlux_ar(i, j, k, n) = -beta_ar(i, j, k, n) * gradT_ar(i, j, k) / T(i, j, k); @@ -958,7 +960,7 @@ PeleLM::differentialDiffusionUpdate( // Add lagged Wbar term // Computed in computeDifferentialDiffusionTerms at t^{n} if first SDC // iteration, t^{np1,k} otherwise - if (m_use_wbar) { + if (m_use_wbar != 0) { for (int lev = 0; lev <= finest_level; ++lev) { auto* ldata_p = getLevelDataPtr(lev, AmrNewTime); @@ -982,7 +984,7 @@ PeleLM::differentialDiffusionUpdate( } } } - if (m_use_soret) { + if (m_use_soret != 0) { for (int lev = 0; lev <= finest_level; ++lev) { auto* ldata_p = getLevelDataPtr(lev, AmrNewTime); @@ -1037,11 +1039,12 @@ PeleLM::differentialDiffusionUpdate( auto const& dhat = diffData->Dhat[lev].const_array(mfi); auto const& force = advData->Forcing[lev].const_array(mfi, 0); auto const& dwbar = - (m_use_wbar) + (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) ? 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, @@ -1049,10 +1052,10 @@ PeleLM::differentialDiffusionUpdate( use_soret = m_use_soret] AMREX_GPU_DEVICE(int i, int j, int k, int n) noexcept { rhoY(i, j, k, n) = force(i, j, k, n) + dt * dhat(i, j, k, n); - if (use_wbar) { + if (use_wbar != 0) { rhoY(i, j, k, n) -= dt * dwbar(i, j, k, n); } - if (use_soret) { + if (use_soret != 0) { rhoY(i, j, k, n) -= dt * dT(i, j, k, n); } }); @@ -1064,7 +1067,7 @@ PeleLM::differentialDiffusionUpdate( // If doing species balances, compute face domain integrals // using level 0 since we've averaged down the fluxes already - if (m_sdcIter == m_nSDCmax && m_do_speciesBalance) { + if (m_sdcIter == m_nSDCmax && (m_do_speciesBalance != 0)) { addRhoYFluxes(GetArrOfConstPtrs(fluxes[0]), geom[0]); } //------------------------------------------------------------------------ @@ -1131,7 +1134,7 @@ PeleLM::differentialDiffusionUpdate( //------------------------------------------------------------------------ // delta(T) iterations - if (m_deltaT_verbose) { + if (m_deltaT_verbose != 0) { Print() << " Iterative solve for deltaT \n"; } @@ -1213,7 +1216,7 @@ PeleLM::differentialDiffusionUpdate( // Check for convergence failure if ((dTiter == m_deltaTIterMax - 1) && (deltaT_norm > m_deltaT_norm_max)) { - if (m_crashOnDeltaTFail) { + if (m_crashOnDeltaTFail != 0) { Abort("deltaT_iters not converged !"); } else { Print() << "deltaT_iters not converged !\n"; @@ -1305,7 +1308,7 @@ PeleLM::deltaTIter_update( MultiFab::Add(ldata_p->state, *a_Tsave[lev], 0, TEMP, 1, 0); } - if (m_deltaT_verbose) { + if (m_deltaT_verbose != 0) { Print() << " DeltaT solve norm [" << a_dtiter << "] = " << a_deltaT_norm << "\n"; } @@ -1418,11 +1421,12 @@ PeleLM::getScalarDiffForce( auto const& fY = advData->Forcing[lev].array(mfi, 0); auto const& fT = advData->Forcing[lev].array(mfi, NUM_SPECIES); auto const& dwbar = - (m_use_wbar) + (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) ? 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, @@ -1434,12 +1438,12 @@ PeleLM::getScalarDiffForce( buildDiffusionForcing( i, j, k, dn, ddn, dnp1k, ddnp1k, r, a, dp0dt, is_closed_ch, do_react, fY, fT); - if (use_wbar) { + if (use_wbar != 0) { for (int n = 0; n < NUM_SPECIES; n++) { fY(i, j, k, n) += dwbar(i, j, k, n); } } - if (use_soret) { + if (use_soret != 0) { for (int n = 0; n < NUM_SPECIES; n++) { fY(i, j, k, n) += dT(i, j, k, n); } @@ -1470,7 +1474,7 @@ PeleLM::computeDivTau( // Get the density component BCRec to get viscosity on faces auto bcRec = fetchBCRecArray(DENSITY, 1); - if (use_density) { + if (use_density != 0) { getDiffusionTensorOp()->compute_divtau( a_divtau, GetVecOfConstPtrs(getVelocityVect(a_time)), GetVecOfConstPtrs(getDensityVect(a_time)), @@ -1491,7 +1495,7 @@ PeleLM::diffuseVelocity() // CrankNicholson 0.5 coeff const Real dt_lcl = 0.5 * m_dt; - if (m_incompressible) { + if (m_incompressible != 0) { getDiffusionTensorOp()->diffuse_velocity( GetVecOfPtrs(getVelocityVect(AmrNewTime)), {}, GetVecOfConstPtrs(getViscosityVect(AmrNewTime)), bcRec[0], dt_lcl); diff --git a/Source/PeleLM_K.H b/Source/PeleLM_K.H index 54bd53ad..571cb879 100644 --- a/Source/PeleLM_K.H +++ b/Source/PeleLM_K.H @@ -317,7 +317,7 @@ compute_divu( (specEnthDiff(i, j, k) + tempDiff(i, j, k) + extRhoH(i, j, k)) * denominv; for (int n = 0; n < NUM_SPECIES; n++) { amrex::Real specTerm = specDiff(i, j, k, n) + extRhoY(i, j, k, n); - if (do_react) { + if (do_react != 0) { specTerm += rhoYdot(i, j, k, n); } divu(i, j, k) += specTerm * (mwtinv[n] * Wbar * rhoinv - hi[n] * denominv); @@ -711,7 +711,7 @@ makeVelForce( // Switch between incompressible/low-Mach rhos amrex::Real rho_lcl = 0.0; - if (is_incomp) { + if (is_incomp != 0) { rho_lcl = rho_incomp; } else { rho_lcl = rho(i, j, k); @@ -723,7 +723,7 @@ makeVelForce( } // Pseudo-gravity for active control - if (pseudo_gravity) { + if (pseudo_gravity != 0) { force(i, j, k, pseudo_gravity_dir) += dV_control * rho_lcl; } @@ -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) { + 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] * @@ -891,7 +891,7 @@ buildDiffusionForcing( for (int n = 0; n < NUM_SPECIES; n++) { forceY(i, j, k, n) = a(i, j, k, n) + 0.5_rt * (dn(i, j, k, n) - dnp1k(i, j, k, n)); - if (do_react) { + if (do_react != 0) { forceY(i, j, k, n) += r(i, j, k, n); } }