Skip to content

Commit

Permalink
Merge branch 'development' into mrf
Browse files Browse the repository at this point in the history
  • Loading branch information
baperry2 committed Oct 21, 2024
2 parents 66e442e + b9ebe80 commit 43fc968
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 44 deletions.
5 changes: 3 additions & 2 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ Checks: 'bugprone-*,
-readability-identifier-naming,
-readability-isolate-declaration,
-readability-avoid-const-params-in-decls,
-readability-avoid-nested-conditional-operator,
-readability-math-missing-parentheses,
-readability-static-accessed-through-instance,
-readability-identifier-length,
-readability-function-cognitive-complexity,
-readability-function-size'
WarningsAsErrors: ''
HeaderFilterRegex: 'PeleC\/Source|PeleC\/Exec|PeleC\/Submodules\/PelePhysics\/Source|PeleC\/Submodules\/PelePhysics\/Mechanism'
AnalyzeTemporaryDtors: false
HeaderFilterRegex: 'PeleC\/Source|PeleC\/Exec|PeleC\/Submodules\/PelePhysics\/Source|PeleC\/Submodules\/PelePhysics\/Mechanisms'
FormatStyle: none
User: user
CheckOptions:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ jobs:
# exit ${return}
Lint-clang-tidy:
needs: Formatting
runs-on: macos-13
runs-on: macos-latest
steps:
- name: Clone
uses: actions/checkout@v4
Expand All @@ -594,9 +594,10 @@ jobs:
echo "CCACHE_COMPRESSLEVEL=1" >> $GITHUB_ENV
echo "CCACHE_LOGFILE=${{github.workspace}}/ccache.log.txt" >> $GITHUB_ENV
echo "CCACHE_MAXSIZE=500M" >> $GITHUB_ENV
- name: Install Ccache
- name: Dependencies
run: |
brew install ccache
brew install llvm
- name: Set Up Ccache
uses: actions/cache@v4
with:
Expand All @@ -606,7 +607,7 @@ jobs:
ccache-${{github.workflow}}-${{github.job}}-git-
- name: Configure
run: |
export PATH=$(brew --prefix llvm@15)/bin:${PATH}
export PATH=$(brew --prefix llvm)/bin:${PATH}
cmake -B${{runner.workspace}}/build-clang-tidy \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
Expand All @@ -622,8 +623,7 @@ jobs:
- name: Check
working-directory: ${{runner.workspace}}/build-clang-tidy
run: |
#set -eu -o pipefail
export PATH=$(brew --prefix llvm@15)/bin:${PATH}
export PATH=$(brew --prefix llvm)/bin:${PATH}
cmake --build . --parallel ${{env.NPROCS}} 2>&1 | tee -a clang-tidy-full-report.txt
egrep "warning:|error:" clang-tidy-full-report.txt \
| egrep -v "Submodules/amrex|Submodules/sundials" \
Expand Down
6 changes: 2 additions & 4 deletions Source/InitEB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PeleC::initialize_eb2_structs()
amrex::Print() << "Initializing EB2 structs" << std::endl;

static_assert(
std::is_standard_layout<EBBndryGeom>::value,
std::is_standard_layout_v<EBBndryGeom>,
"EBBndryGeom is not standard layout");

const auto& ebfactory =
Expand Down Expand Up @@ -615,9 +615,7 @@ PeleC::extend_signed_distance(
+((j - jj) * dx[1] * (j - jj) * dx[1]),
+((k - kk) * dx[2] * (k - kk) * dx[2])));
const amrex::Real distToEB = distToCell + sd_cc(ii, jj, kk);
if (distToEB < closestEBDist) {
closestEBDist = distToEB;
}
closestEBDist = amrex::min(distToEB, closestEBDist);
}
}
}
Expand Down
19 changes: 19 additions & 0 deletions Source/LES.H
Original file line number Diff line number Diff line change
Expand Up @@ -1109,5 +1109,24 @@ pc_vreman_sfs_term(
flx(iv, UEDEN) = flx(iv, UEDEN) * a(iv);
}

void computeTangentialVelDerivs(
const amrex::Array<const amrex::Box, AMREX_SPACEDIM>& eboxes,
amrex::Array<amrex::FArrayBox, AMREX_SPACEDIM>& tander_ec,
amrex::GpuArray<amrex::Array4<amrex::Real>, AMREX_SPACEDIM>& tanders,
const amrex::Array4<amrex::Real>& q_ar,
const amrex::GpuArray<amrex::Real, AMREX_SPACEDIM> dx);

void resizeAndSetFlux(
const amrex::Array<const amrex::Box, AMREX_SPACEDIM>& eboxes,
amrex::GpuArray<amrex::Array4<amrex::Real>, AMREX_SPACEDIM>& flx,
amrex::Array<amrex::FArrayBox, AMREX_SPACEDIM>& flux_ec);

void computeFluxDiv(
amrex::MultiFab& LESTerm,
const amrex::MFIter& mfi,
const amrex::Box& vbox,
amrex::GpuArray<amrex::Array4<amrex::Real>, AMREX_SPACEDIM>& flx,
const amrex::MultiFab& volume);

#endif // AMREX_SPACEDIM == 3
#endif
61 changes: 33 additions & 28 deletions Source/LES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ PeleC::getLESTerm(

void
computeTangentialVelDerivs(
const amrex::Box eboxes[AMREX_SPACEDIM],
amrex::FArrayBox tander_ec[AMREX_SPACEDIM],
const amrex::Array<const amrex::Box, AMREX_SPACEDIM>& eboxes,
amrex::Array<amrex::FArrayBox, AMREX_SPACEDIM>& tander_ec,
amrex::GpuArray<amrex::Array4<amrex::Real>, AMREX_SPACEDIM>& tanders,
const amrex::Array4<amrex::Real>& q_ar,
const amrex::GpuArray<amrex::Real, AMREX_SPACEDIM> dx)
Expand All @@ -176,9 +176,9 @@ computeTangentialVelDerivs(

void
resizeAndSetFlux(
const amrex::Box eboxes[AMREX_SPACEDIM],
const amrex::Array<const amrex::Box, AMREX_SPACEDIM>& eboxes,
amrex::GpuArray<amrex::Array4<amrex::Real>, AMREX_SPACEDIM>& flx,
amrex::FArrayBox flux_ec[AMREX_SPACEDIM])
amrex::Array<amrex::FArrayBox, AMREX_SPACEDIM>& flux_ec)
{
for (int dir = 0; dir < AMREX_SPACEDIM; dir++) {
flux_ec[dir].resize(eboxes[dir], NVAR, amrex::The_Async_Arena());
Expand Down Expand Up @@ -215,7 +215,7 @@ PeleC::updateFluxRegistersLES(
amrex::Real dt,
const amrex::MFIter& mfi,
amrex::FabType typ,
const std::array<amrex::FArrayBox const*, AMREX_SPACEDIM>& flux_ec)
const amrex::Array<amrex::FArrayBox const*, AMREX_SPACEDIM>& flux_ec)
{
if (do_reflux && reflux_factor != 0) {
amrex::FArrayBox dm_as_fine(
Expand Down Expand Up @@ -287,16 +287,17 @@ PeleC::getSmagorinskyLESTerm(
}

// Get the tangential derivatives
amrex::FArrayBox tander_ec[AMREX_SPACEDIM];
const amrex::Box eboxes[AMREX_SPACEDIM] = {AMREX_D_DECL(
amrex::surroundingNodes(cbox, 0), amrex::surroundingNodes(cbox, 1),
amrex::surroundingNodes(cbox, 2))};
amrex::Array<amrex::FArrayBox, AMREX_SPACEDIM> tander_ec;
const amrex::Array<const amrex::Box, AMREX_SPACEDIM> eboxes = {
AMREX_D_DECL(
amrex::surroundingNodes(cbox, 0), amrex::surroundingNodes(cbox, 1),
amrex::surroundingNodes(cbox, 2))};
amrex::GpuArray<amrex::Array4<amrex::Real>, AMREX_SPACEDIM> tanders;

computeTangentialVelDerivs(eboxes, tander_ec, tanders, q_ar, dx);

// Compute extensive LES fluxes, F.A
amrex::FArrayBox flux_ec[AMREX_SPACEDIM];
amrex::Array<amrex::FArrayBox, AMREX_SPACEDIM> flux_ec;
const amrex::GpuArray<
const amrex::Array4<const amrex::Real>, AMREX_SPACEDIM>
a{{AMREX_D_DECL(
Expand Down Expand Up @@ -324,7 +325,7 @@ PeleC::getSmagorinskyLESTerm(
// Refluxing
updateFluxRegistersLES(
reflux_factor, LESTerm, dt, mfi, typ,
{AMREX_D_DECL(&flux_ec[0], &flux_ec[1], &flux_ec[2])});
{AMREX_D_DECL(flux_ec.data(), &flux_ec[1], &flux_ec[2])});
} // End of MFIter scope
} // End of OMP scope
#endif
Expand Down Expand Up @@ -521,9 +522,10 @@ PeleC::getDynamicSmagorinskyLESTerm(
// 6. Get the SFS term

// First step: move everything needed to compute fluxes to ec (faces)
const amrex::Box eboxes[AMREX_SPACEDIM] = {AMREX_D_DECL(
amrex::surroundingNodes(cbox, 0), amrex::surroundingNodes(cbox, 1),
amrex::surroundingNodes(cbox, 2))};
const amrex::Array<const amrex::Box, AMREX_SPACEDIM> eboxes = {
AMREX_D_DECL(
amrex::surroundingNodes(cbox, 0), amrex::surroundingNodes(cbox, 1),
amrex::surroundingNodes(cbox, 2))};
amrex::FArrayBox coeff_ec[AMREX_SPACEDIM];
amrex::FArrayBox alphaij_ec[AMREX_SPACEDIM];
amrex::FArrayBox alpha_ec[AMREX_SPACEDIM];
Expand Down Expand Up @@ -579,7 +581,7 @@ PeleC::getDynamicSmagorinskyLESTerm(

// Compute the fluxes at the faces: all values passed are at faces
// except for Q, V, and Lterm
amrex::FArrayBox flux_ec[AMREX_SPACEDIM];
amrex::Array<amrex::FArrayBox, AMREX_SPACEDIM> flux_ec;
const amrex::GpuArray<
const amrex::Array4<const amrex::Real>, AMREX_SPACEDIM>
a{{AMREX_D_DECL(
Expand All @@ -604,7 +606,7 @@ PeleC::getDynamicSmagorinskyLESTerm(
// Refluxing
updateFluxRegistersLES(
reflux_factor, LESTerm, dt, mfi, typ,
{AMREX_D_DECL(&flux_ec[0], &flux_ec[1], &flux_ec[2])});
{AMREX_D_DECL(flux_ec.data(), &flux_ec[1], &flux_ec[2])});
}
}
#endif
Expand Down Expand Up @@ -673,15 +675,17 @@ PeleC::getWALELESTerm(
}

// Get the tangential derivatives
amrex::FArrayBox tander_ec[AMREX_SPACEDIM];
const amrex::Box eboxes[AMREX_SPACEDIM] = {AMREX_D_DECL(
amrex::surroundingNodes(cbox, 0), amrex::surroundingNodes(cbox, 1),
amrex::surroundingNodes(cbox, 2))};
amrex::Array<amrex::FArrayBox, AMREX_SPACEDIM> tander_ec;
const amrex::Array<const amrex::Box, AMREX_SPACEDIM> eboxes = {
AMREX_D_DECL(
amrex::surroundingNodes(cbox, 0), amrex::surroundingNodes(cbox, 1),
amrex::surroundingNodes(cbox, 2))};
amrex::GpuArray<amrex::Array4<amrex::Real>, AMREX_SPACEDIM> tanders;
computeTangentialVelDerivs(eboxes, tander_ec, tanders, q_ar, dx);

// Compute extensive LES fluxes, F.A
amrex::FArrayBox flux_ec[AMREX_SPACEDIM];
amrex::Array<amrex::FArrayBox, AMREX_SPACEDIM> flux_ec;

const amrex::GpuArray<
const amrex::Array4<const amrex::Real>, AMREX_SPACEDIM>
a{{AMREX_D_DECL(
Expand Down Expand Up @@ -709,7 +713,7 @@ PeleC::getWALELESTerm(
// Refluxing
updateFluxRegistersLES(
reflux_factor, LESTerm, dt, mfi, typ,
{AMREX_D_DECL(&flux_ec[0], &flux_ec[1], &flux_ec[2])});
{AMREX_D_DECL(flux_ec.data(), &flux_ec[1], &flux_ec[2])});
} // End of MFIter scope
} // End of OMP scope
#endif
Expand Down Expand Up @@ -778,16 +782,17 @@ PeleC::getVremanLESTerm(
}

// Get the tangential derivatives
amrex::FArrayBox tander_ec[AMREX_SPACEDIM];
const amrex::Box eboxes[AMREX_SPACEDIM] = {AMREX_D_DECL(
amrex::surroundingNodes(cbox, 0), amrex::surroundingNodes(cbox, 1),
amrex::surroundingNodes(cbox, 2))};
amrex::Array<amrex::FArrayBox, AMREX_SPACEDIM> tander_ec;
const amrex::Array<const amrex::Box, AMREX_SPACEDIM> eboxes = {
AMREX_D_DECL(
amrex::surroundingNodes(cbox, 0), amrex::surroundingNodes(cbox, 1),
amrex::surroundingNodes(cbox, 2))};
amrex::GpuArray<amrex::Array4<amrex::Real>, AMREX_SPACEDIM> tanders;

computeTangentialVelDerivs(eboxes, tander_ec, tanders, q_ar, dx);

// Compute extensive LES fluxes, F.A
amrex::FArrayBox flux_ec[AMREX_SPACEDIM];
amrex::Array<amrex::FArrayBox, AMREX_SPACEDIM> flux_ec;
const amrex::GpuArray<
const amrex::Array4<const amrex::Real>, AMREX_SPACEDIM>
a{{AMREX_D_DECL(
Expand Down Expand Up @@ -815,7 +820,7 @@ PeleC::getVremanLESTerm(
// Refluxing
updateFluxRegistersLES(
reflux_factor, LESTerm, dt, mfi, typ,
{AMREX_D_DECL(&flux_ec[0], &flux_ec[1], &flux_ec[2])});
{AMREX_D_DECL(flux_ec.data(), &flux_ec[1], &flux_ec[2])});
} // End of MFIter scope
} // End of OMP scope
#endif
Expand Down
4 changes: 2 additions & 2 deletions Source/PeleC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2074,8 +2074,8 @@ PeleC::init_les()
amrex::Print() << "WARNING: LES is not supported for multi-component systems"
<< std::endl;
#endif
if (std::is_same<
pele::physics::PhysicsType::eos_type, pele::physics::eos::SRK>::value) {
if (std::is_same_v<
pele::physics::PhysicsType::eos_type, pele::physics::eos::SRK>) {
amrex::Abort("LES is not supported for non-ideal equations of state");
}
}
Expand Down
7 changes: 7 additions & 0 deletions Source/Sources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ PeleC::construct_old_source(
case rot_src:
construct_old_rot_source(time, dt);
break;

default:
amrex::Abort("Unrecognized source term");
break;
} // end switch
}

Expand Down Expand Up @@ -104,6 +108,9 @@ PeleC::construct_new_source(
construct_new_rot_source(time, dt);
break;

default:
amrex::Abort("Unrecognized source term");
break;
} // end switch
}

Expand Down
4 changes: 2 additions & 2 deletions Source/Utilities.H
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ pc_rst_int_e(
amrex::Real omega = 0.0,
amrex::Real rad = 0.0)
{
if (std::is_same<
pele::physics::PhysicsType::eos_type, pele::physics::eos::SRK>::value) {
if (std::is_same_v<
pele::physics::PhysicsType::eos_type, pele::physics::eos::SRK>) {
if ((!allow_small_energy) || (!allow_negative_energy)) {
amrex::Error("Small/negative energy must be allowed for nonideal EOS");
}
Expand Down

0 comments on commit 43fc968

Please sign in to comment.