Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix codeql warnings #279

Merged
merged 8 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Then step into the *PeleLMeX* folder and add the main *PeleLMeX* repository as t

git add remote upstream https://github.com/AMReX-Combustion/PeleLMeX

At any point, you can update the `developement` branch of your local repository with changes implemented in the main *PeleLMeX* repo by pulling from `upstream` :
At any point, you can update the `development` branch of your local repository with changes implemented in the main *PeleLMeX* repo by pulling from `upstream` :

git checkout development
git pull upstream development
Expand Down
2 changes: 1 addition & 1 deletion Docs/sphinx/manual/Tutorials_TripleFlame.rst
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ control the relaxation of the inlet velocity to the steady state velocity of the
that should be of the order of ten times the simulation time-step. ``height`` is the user-defined location where the
triple flame should settle, ``changeMax`` and ``velMax`` control the maximum velocity increment and maximum inlet velocity, respectively.
The user is referred to [CAMCS2006]_ for an overview of the method and corresponding parameters.
The ``pseudo_gravity`` triggers a manufactured force added to the momemtum equation to compensate for the acceleration of different density gases.
The ``pseudo_gravity`` triggers a manufactured force added to the momentum equation to compensate for the acceleration of different density gases.

Once these parameters are set, you continue the previous simulation by uncommenting the first line of the ``IO CONTROL`` block in the input file: ::

Expand Down
2 changes: 0 additions & 2 deletions Exec/RegTests/EnclosedFlame/pelelmex_prob.H
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ pelelmex_initdata(
, const amrex::Real yc = prob_lo[1] + 0.5 * Ly;
, const amrex::Real zc = prob_lo[2] + 0.5 * Lz;);

// constexpr amrex::Real Pi = 3.14159265358979323846264338327950288;

auto eos = pele::physics::PhysicsType::eos();
amrex::GpuArray<amrex::Real, NUM_SPECIES + 4> pmf_vals = {0.0};
amrex::Real molefrac[NUM_SPECIES] = {0.0};
Expand Down
21 changes: 0 additions & 21 deletions Exec/RegTests/EnclosedInjection/pelelmex_prob.H
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,6 @@ pelelmex_initdata(
ProbParm const& prob_parm,
pele::physics::PMF::PmfData::DataContainer const* /*pmf_data*/)
{
// const amrex::Real* prob_lo = geomdata.ProbLo();
// const amrex::Real* prob_hi = geomdata.ProbHi();
// const amrex::Real* dx = geomdata.CellSize();
/*
AMREX_D_TERM(const amrex::Real x = prob_lo[0] + (i + 0.5) * dx[0];
, const amrex::Real y = prob_lo[1] + (j + 0.5) * dx[1];
, const amrex::Real z = prob_lo[2] + (k + 0.5) * dx[2];);

AMREX_D_TERM(const amrex::Real Lx = prob_hi[0] - prob_lo[0];
, const amrex::Real Ly = prob_hi[1] - prob_lo[1];
, const amrex::Real Lz = prob_hi[2] - prob_lo[2]);

constexpr amrex::Real Pi = 3.14159265358979323846264338327950288;
*/
auto eos = pele::physics::PhysicsType::eos();
amrex::Real massfrac[NUM_SPECIES] = {0.0};

Expand Down Expand Up @@ -89,10 +75,6 @@ bcnormal(
amrex::Real Y_jet[NUM_SPECIES] = {0.0};
amrex::Real eta = 0.0;

// const amrex::Real* prob_lo = geomdata.ProbLo();
// const amrex::Real* prob_hi = geomdata.ProbHi();
// const amrex::Real* dx = geomdata.CellSize();

// Simple, air into air injection
X_air[O2_ID] = 0.21;
X_air[N2_ID] = 1.0 - X_air[O2_ID];
Expand Down Expand Up @@ -160,9 +142,6 @@ zero_visc(
// velocity, ...)
if (beta_comp == 0 && nComp == NUM_SPECIES) {
if (dir == 2 && k <= domainBox.smallEnd(dir)) {
// const amrex::Real* prob_lo = geomdata.ProbLo();
// const amrex::Real* prob_hi = geomdata.ProbHi();
// const amrex::Real* dx = geomdata.CellSize();

// Just over whole inlet
for (int n = 0; n < nComp; n++) {
Expand Down
29 changes: 11 additions & 18 deletions Exec/RegTests/HITDecay/pelelmex_prob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ PeleLM::readProbParm() // NOLINT(readability-make-member-function-const)
ofs.close();

// Read initial velocity field
const int nx = local_prob_parm.input_resolution;
const int ny = local_prob_parm.input_resolution;
const int nz = local_prob_parm.input_resolution;
const size_t nx = local_prob_parm.input_resolution;
jrood-nrel marked this conversation as resolved.
Show resolved Hide resolved
const size_t ny = local_prob_parm.input_resolution;
const size_t nz = local_prob_parm.input_resolution;
amrex::Vector<amrex::Real> data(
nx * ny * nz * 6); /* this needs to be double */
if (binfmt != 0) {
Expand All @@ -138,17 +138,12 @@ PeleLM::readProbParm() // NOLINT(readability-make-member-function-const)
}

// Extract position and velocities
amrex::Vector<amrex::Real> xinput;
amrex::Vector<amrex::Real> uinput;
amrex::Vector<amrex::Real> vinput;
amrex::Vector<amrex::Real> winput;
amrex::Vector<amrex::Real> xdiff;
amrex::Vector<amrex::Real> xarray;

xinput.resize(nx * ny * nz);
uinput.resize(nx * ny * nz);
vinput.resize(nx * ny * nz);
winput.resize(nx * ny * nz);
amrex::Vector<amrex::Real> xinput(nx * ny * nz);
amrex::Vector<amrex::Real> uinput(nx * ny * nz);
amrex::Vector<amrex::Real> vinput(nx * ny * nz);
amrex::Vector<amrex::Real> winput(nx * ny * nz);
amrex::Vector<amrex::Real> xdiff(nx);
amrex::Vector<amrex::Real> xarray(nx);

for (long i = 0; i < xinput.size(); i++) {
xinput[i] = data[0 + i * 6];
Expand All @@ -161,11 +156,9 @@ PeleLM::readProbParm() // NOLINT(readability-make-member-function-const)
}

// Get the xarray table and the differences.
xarray.resize(nx);
for (long i = 0; i < xarray.size(); i++) {
xarray[i] = xinput[i];
}
xdiff.resize(nx);
std::adjacent_difference(xarray.begin(), xarray.end(), xdiff.begin());
xdiff[0] = xdiff[1];

Expand All @@ -188,11 +181,11 @@ PeleLM::readProbParm() // NOLINT(readability-make-member-function-const)
local_prob_parm.d_winput =
(amrex::Real*)amrex::The_Arena()->alloc(nx * ny * nz * sizeof(amrex::Real));

for (int i = 0; i < nx; i++) {
for (unsigned long i = 0; i < nx; i++) {
local_prob_parm.d_xarray[i] = xarray[i];
local_prob_parm.d_xdiff[i] = xdiff[i];
}
for (int i = 0; i < nx * ny * nz; i++) {
for (unsigned long i = 0; i < nx * ny * nz; i++) {
local_prob_parm.d_uinput[i] = uinput[i];
local_prob_parm.d_vinput[i] = vinput[i];
local_prob_parm.d_winput[i] = winput[i];
Expand Down
3 changes: 1 addition & 2 deletions Exec/RegTests/HotBubble/pelelmex_prob.H
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ pelelmex_initdata(
, const amrex::Real z = prob_lo[2] + (k + 0.5) * dx[2];);

AMREX_D_TERM(const amrex::Real Lx = prob_hi[0] - prob_lo[0];
, /*const amrex::Real Ly = prob_hi[1] - prob_lo[1];*/
, const amrex::Real Lz = prob_hi[2] - prob_lo[2]);
, , const amrex::Real Lz = prob_hi[2] - prob_lo[2]);

auto eos = pele::physics::PhysicsType::eos();
amrex::Real massfrac[NUM_SPECIES] = {0.0};
Expand Down
13 changes: 1 addition & 12 deletions Exec/RegTests/PeriodicCases/pelelmex_prob.H
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,9 @@ pelelmex_initdata(
pele::physics::PMF::PmfData::DataContainer const* /*pmf_data*/)
{
const amrex::Real* prob_lo = geomdata.ProbLo();
// const amrex::Real* prob_hi = geomdata.ProbHi();
const amrex::Real* dx = geomdata.CellSize();
AMREX_D_TERM(const amrex::Real x = prob_lo[0] + (i + 0.5) * dx[0];
, const amrex::Real y = prob_lo[1] + (j + 0.5) * dx[1];,
/*const amrex::Real z = prob_lo[2] + (k + 0.5) * dx[2];*/);
/*
AMREX_D_TERM(const amrex::Real Lx = prob_hi[0] - prob_lo[0];
, const amrex::Real Ly = prob_hi[1] - prob_lo[1];
, const amrex::Real Lz = prob_hi[2] - prob_lo[2]);
AMREX_D_TERM(const amrex::Real x_c = prob_lo[0] + 0.5 * Lx;
, const amrex::Real y_c = prob_lo[1] + 0.5 * Ly;
, const amrex::Real z_c = prob_lo[2] + 0.5 * Lz);
*/
, const amrex::Real y = prob_lo[1] + (j + 0.5) * dx[1];, );
auto eos = pele::physics::PhysicsType::eos();
constexpr amrex::Real Pi = 3.14159265358979323846264338327950288;

Expand Down Expand Up @@ -224,7 +214,6 @@ pelelmex_initdata(
// constant diffusion coeff. gaussDiff. Use ampgauss to avoid
// undershoot/overshoot of the 2-species mixture.
const amrex::Real deltax = x - prob_parm.xgauss;
// const amrex::Real deltay = y - prob_parm.ygauss;
amrex::Real denom_inv =
prob_parm.ampgauss /
std::sqrt(4 * Pi * prob_parm.gaussTime * prob_parm.gaussDiff);
Expand Down
6 changes: 0 additions & 6 deletions Exec/RegTests/TaylorGreen/pelelmex_prob.H
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,11 @@ pelelmex_initdata(
pele::physics::PMF::PmfData::DataContainer const* /*pmf_data*/)
{
const amrex::Real* prob_lo = geomdata.ProbLo();
// const amrex::Real* prob_hi = geomdata.ProbHi();
const amrex::Real* dx = geomdata.CellSize();

AMREX_D_TERM(const amrex::Real x = prob_lo[0] + (i + 0.5) * dx[0];
, const amrex::Real y = prob_lo[1] + (j + 0.5) * dx[1];
, const amrex::Real z = prob_lo[2] + (k + 0.5) * dx[2];);
/*
AMREX_D_TERM(const amrex::Real Lx = prob_hi[0] - prob_lo[0];
, const amrex::Real Ly = prob_hi[1] - prob_lo[1];
, const amrex::Real Lz = prob_hi[2] - prob_lo[2]);
*/
auto eos = pele::physics::PhysicsType::eos();

amrex::Real massfrac[NUM_SPECIES] = {0.0};
Expand Down
16 changes: 0 additions & 16 deletions Exec/RegTests/TurbInflow/pelelmex_prob.H
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,6 @@ pelelmex_initdata(
ProbParm const& prob_parm,
pele::physics::PMF::PmfData::DataContainer const* /*pmf_data*/)
{
// const amrex::Real* prob_lo = geomdata.ProbLo();
// const amrex::Real* prob_hi = geomdata.ProbHi();
// const amrex::Real* dx = geomdata.CellSize();
/*
AMREX_D_TERM(const amrex::Real x = prob_lo[0] + (i + 0.5) * dx[0];
, const amrex::Real y = prob_lo[1] + (j + 0.5) * dx[1];
, const amrex::Real z = prob_lo[2] + (k + 0.5) * dx[2];);
*/
/* AMREX_D_TERM(const amrex::Real Lx = prob_hi[0] - prob_lo[0];
, const amrex::Real Ly = prob_hi[1] - prob_lo[1];
, const amrex::Real Lz = prob_hi[2] - prob_lo[2]);*/
/*
AMREX_D_TERM(const amrex::Real x_c = prob_lo[0] + 0.5 * Lx;
, const amrex::Real y_c = prob_lo[1] + 0.5 * Ly;
, const amrex::Real z_c = prob_lo[2] + 0.5 * Lz);
*/
auto eos = pele::physics::PhysicsType::eos();

amrex::Real massfrac[NUM_SPECIES] = {0.0};
Expand Down
7 changes: 0 additions & 7 deletions Source/PeleLMeX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,6 @@ PeleLM::getLevelDataPtr(
m_nAux, m_nGrowState, m_use_soret, static_cast<int>(m_do_les));
Real time = getTime(lev, a_time);
fillpatch_state(lev, time, m_leveldata_floating->state, m_nGrowState);
// if (useUMac) {
// // TODO: find a way to get U^{n+1/2} from Umac
// // For now get old time
// Real oldtime = getTime(lev,AmrOldTime);
// fillpatch_velocity(lev, oldtime, m_leveldata_floating->state, VELX,
// m_nGrowState);
// }
return m_leveldata_floating.get();
}

Expand Down
1 change: 0 additions & 1 deletion Source/PeleLMeX_DeriveUserDefined.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ using namespace amrex;
Vector<std::string>
pelelmex_setuserderives()
{
// Vector<std::string> var_names({"derUserDefine_null"});
return {"derUserDefine_null"}; // var_names;
}

Expand Down
1 change: 0 additions & 1 deletion Source/PeleLMeX_Diffusion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,6 @@ PeleLM::addSoretTerm(
Ted_arr);
});

// auto const& rhoY = rhoY_ed.const_array(0);
auto const& T = T_ed.const_array(0);
auto const& gradT_ar = gradT[lev][idim].const_array(mfi);
auto const& beta_ar = beta_ec[idim].const_array(mfi);
Expand Down
5 changes: 0 additions & 5 deletions Source/PeleLMeX_Setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1001,11 +1001,6 @@ PeleLM::derivedSetup()
grow_box_by_one);
#endif
#endif
#endif
#ifdef PELELM_USE_SOOT
// if (do_soot_solve) {
// addSootDerivePlotVars(derive_lst);
// }
#endif
auto it = m_derivePlotVars.begin();
while (it != m_derivePlotVars.end()) {
Expand Down
2 changes: 1 addition & 1 deletion Source/PeleLMeX_Temporals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ PeleLM::writeTemporals()
if (fuelID >= 0 && !(m_chem_integrator == "ReactorNull")) {
fuelConsumptionInt = MFSum(GetVecOfConstPtrs(getIRVect()), fuelID);
for (int lev = 0; lev <= finest_level; ++lev) {
getHeatRelease(lev, kinEnergy[lev].get()); // Re-use kinEnergy container
getHeatRelease(lev, kinEnergy[lev].get()); // Reuse kinEnergy container
}
heatReleaseRateInt = MFSum(GetVecOfConstPtrs(kinEnergy), 0);
}
Expand Down
Loading