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 some clang-tidy issues on wdconvect #457

Merged
merged 1 commit into from
May 16, 2024
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
27 changes: 15 additions & 12 deletions Exec/science/wdconvect/MaestroInitData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,24 @@ using namespace amrex;
using namespace problem_rp;

// initializes data on a specific level
void Maestro::InitLevelData(const int lev, const Real time, const MFIter& mfi,
void Maestro::InitLevelData(const int lev, const Real time, const MFIter& mfi, // NOLINT(readability-convert-member-functions-to-static)
const Array4<Real> scal, const Array4<Real> vel) {
Abort("Planar InitLevelData not implemented.");
amrex::ignore_unused(lev);
amrex::ignore_unused(time);
amrex::ignore_unused(mfi);
amrex::ignore_unused(scal);
amrex::ignore_unused(vel);

amrex::Abort("Planar InitLevelData not implemented.");
}

void Maestro::InitLevelDataSphr(const int lev, const Real time, MultiFab& scal,
MultiFab& vel) {

amrex::ignore_unused(time);

// timer for profiling
BL_PROFILE_VAR("Maestro::InitLevelDataSphr()", InitLevelDataSphr);
const int max_lev = base_geom.max_radial_level + 1;

#ifdef _OPENMP
#pragma omp parallel
Expand Down Expand Up @@ -57,11 +65,11 @@ void Maestro::InitLevelDataSphr(const int lev, const Real time, MultiFab& scal,
}
}

Put1dArrayOnCart(lev, temp_vec, temp_mf, 0, 0, bcs_f, 0);
Put1dArrayOnCart(lev, temp_vec, temp_mf, false, false, bcs_f, 0);
MultiFab::Copy(scal, temp_mf, 0, Temp, 1, 0);

// initialize p0_cart
Put1dArrayOnCart(lev, p0_init, p0_cart, 0, 0);
Put1dArrayOnCart(lev, p0_init, p0_cart, false, false);

// initialize species
for (auto comp = 0; comp < NumSpec; ++comp) {
Expand All @@ -70,7 +78,7 @@ void Maestro::InitLevelDataSphr(const int lev, const Real time, MultiFab& scal,
temp_arr(l, r) = s0_init_arr(l, r, FirstSpec + comp);
}
}
Put1dArrayOnCart(lev, temp_vec, temp_mf, 0, 0, bcs_s, FirstSpec + comp);
Put1dArrayOnCart(lev, temp_vec, temp_mf, false, false, bcs_s, FirstSpec + comp);
MultiFab::Copy(scal, temp_mf, 0, FirstSpec + comp, 1, 0);
}

Expand Down Expand Up @@ -162,7 +170,6 @@ void Maestro::InitLevelDataSphr(const int lev, const Real time, MultiFab& scal,


const auto prob_lo = geom[lev].ProbLoArray();
const auto prob_hi = geom[lev].ProbHiArray();
const auto dx = geom[lev].CellSizeArray();

const auto center_p = center;
Expand All @@ -179,11 +186,7 @@ void Maestro::InitLevelDataSphr(const int lev, const Real time, MultiFab& scal,
const Real z = prob_lo[2] + (Real(k) + 0.5) * dx[2] - center_p[2];

// set perturbational velocity to zero
Real vpert[3];

for (auto n = 0; n < 3; ++n) {
vpert[n] = 0.0;
}
Real vpert[3]{};

// compute distance to the center of the star
Real rloc = std::sqrt(x * x + y * y + z * z);
Expand Down
19 changes: 16 additions & 3 deletions Exec/science/wdconvect/MaestroTagging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,36 @@
using namespace amrex;
using namespace problem_rp;

void Maestro::RetagArray(const Box& bx, const int lev) {
void Maestro::RetagArray(const Box& bx, const int lev) { // NOLINT(readability-convert-member-functions-to-static)

amrex::ignore_unused(bx);
amrex::ignore_unused(lev);

// timer for profiling
BL_PROFILE_VAR("Maestro::RetagArray()", RetagArray);

Abort("Error: RetagArray should not be called for spherical");
}

void Maestro::TagBoxes(TagBoxArray& tags, const MFIter& mfi, const int lev,
void Maestro::TagBoxes(TagBoxArray& tags, const MFIter& mfi, const int lev, // NOLINT(readability-convert-member-functions-to-static)
const Real time) {

amrex::ignore_unused(tags);
amrex::ignore_unused(mfi);
amrex::ignore_unused(lev);
amrex::ignore_unused(time);

// timer for profiling
BL_PROFILE_VAR("Maestro::TagBoxes()", TagBoxes);

Abort("Error: TagBoxes should not be called for spherical");
}

void Maestro::StateError(TagBoxArray& tags, const MultiFab& state_mf,
void Maestro::StateError(TagBoxArray& tags, const MultiFab& state_mf, // NOLINT(readability-convert-member-functions-to-static)
const MFIter& mfi, const int lev, const Real time) {

amrex::ignore_unused(time);

// timer for profiling
BL_PROFILE_VAR("Maestro::StateError()", StateError);

Expand Down
3 changes: 2 additions & 1 deletion Source/Maestro.H
Original file line number Diff line number Diff line change
Expand Up @@ -957,11 +957,12 @@ class Maestro : public amrex::AmrCore {
int comp, int bccomp, const bool is_vel,
const bool is_conservative) const;
#else
static
void MakeDivU(const amrex::Box& bx, amrex::Array4<amrex::Real> const divu,
amrex::Array4<amrex::Real> const umac,
amrex::Array4<amrex::Real> const vmac,
amrex::Array4<amrex::Real> const wmac,
const amrex::GpuArray<Real, AMREX_SPACEDIM> dx) const;
const amrex::GpuArray<Real, AMREX_SPACEDIM> dx);

void MakeEdgeScalPredictor(const amrex::MFIter& mfi,
amrex::Array4<amrex::Real> const slx,
Expand Down
7 changes: 4 additions & 3 deletions Source/MaestroDt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -664,13 +664,14 @@ void Maestro::FirstDt() {
Real spdy = spd.max<RunOn::Device>(tileBox, 0) / dx[1];
Real pforcey =
vel_force[lev][mfi].maxabs<RunOn::Device>(tileBox, 1);
#if AMREX_SPACEDIM == 2
Real spdz = spdy * 0.1; // for 2d make sure this is < spdy
uz /= AMREX_SPACEDIM == 2 ? dx[1] : dx[2];
#if (AMREX_SPACEDIM == 3)
spdz = spd.max<RunOn::Device>(tileBox, 0) / dx[2];
#else
Real spdz = spd.max<RunOn::Device>(tileBox, 0) / dx[2];
Real pforcez =
vel_force[lev][mfi].maxabs<RunOn::Device>(tileBox, 2);
#endif
uz /= AMREX_SPACEDIM == 2 ? dx[1] : dx[2];

// use advective constraint unless velocities are zero everywhere
// in which case we use the sound speed
Expand Down
2 changes: 1 addition & 1 deletion Source/MaestroMakeEdgeScalars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ void Maestro::MakeEdgeScalEdges(
void Maestro::MakeDivU(const Box& bx, Array4<Real> const divu,
Array4<Real> const umac, Array4<Real> const vmac,
Array4<Real> const wmac,
const GpuArray<Real, AMREX_SPACEDIM> dx) const {
const GpuArray<Real, AMREX_SPACEDIM> dx) {
// timer for profiling
BL_PROFILE_VAR("Maestro::MakeDivU()", MakeDivU);

Expand Down
33 changes: 15 additions & 18 deletions Source/MaestroMakeFlux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -794,12 +794,11 @@ void Maestro::MakeRhoHFlux(
rhoh0mac_edgez.array(mfi);

ParallelFor(xbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) {
if (have_h) {
// enthalpy edge state is h
// this is not supported on irregular-spaced base state
} else if (have_hprime) {
// enthalpy edge state is h'
// this is not supported on irregular-spaced base state
if (have_h || have_rhoh) {
// have_h: enthalpy edge state is h
// this is not supported on irregular-spaced base state
// have_hprime: enthalpy edge state is h'
// this is not supported on irregular-spaced base state
} else if (have_rhoh) {
sfluxx(i, j, k, RhoH) =
umacx(i, j, k) * sedgex(i, j, k, RhoH);
Expand All @@ -817,12 +816,11 @@ void Maestro::MakeRhoHFlux(
});

ParallelFor(ybx, [=] AMREX_GPU_DEVICE(int i, int j, int k) {
if (have_h) {
// enthalpy edge state is h
// this is not supported on irregular-spaced base state
} else if (have_hprime) {
// enthalpy edge state is h'
// this is not supported on irregular-spaced base state
if (have_h || have_hprime) {
// have_h: enthalpy edge state is h
// this is not supported on irregular-spaced base state
// have_hprime: enthalpy edge state is h'
// this is not supported on irregular-spaced base state
} else if (have_rhoh) {
sfluxy(i, j, k, RhoH) =
vmac(i, j, k) * sedgey(i, j, k, RhoH);
Expand All @@ -839,12 +837,11 @@ void Maestro::MakeRhoHFlux(
});

ParallelFor(zbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) {
if (have_h) {
// enthalpy edge state is h
// this is not supported on irregular-spaced base state
} else if (have_hprime) {
// enthalpy edge state is h'
// this is not supported on irregular-spaced base state
if (have_h || have_hprime) {
// have_h: enthalpy edge state is h
// this is not supported on irregular-spaced base state
// have_hprime: enthalpy edge state is h'
// this is not supported on irregular-spaced base state
} else if (have_rhoh) {
sfluxz(i, j, k, RhoH) =
wmac(i, j, k) * sedgez(i, j, k, RhoH);
Expand Down
2 changes: 1 addition & 1 deletion Source/MaestroMakeUtrans.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ void Maestro::MakeUtrans(

// impose hi side bc's
} else if (j == domhi[1] + 1) {
switch (bchi) {
switch (bchi) { // NOLINT(bugprone-switch-missing-default-case)
case amrex::PhysBCType::inflow:
vly = utilde_arr(i, j + 1, k, 1);
vry = utilde_arr(i, j + 1, k, 1);
Expand Down
Loading