Skip to content

Commit

Permalink
Merge branch 'development' into current_path
Browse files Browse the repository at this point in the history
  • Loading branch information
yut23 authored Mar 27, 2024
2 parents 627de5f + 931e173 commit e4cb0ca
Show file tree
Hide file tree
Showing 17 changed files with 193 additions and 120 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: "clang-tidy"

on: [pull_request]
jobs:
clang_tidy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Get submodules
run: |
git submodule update --init
cd external/Microphysics
git fetch; git checkout development
echo "MICROPHYSICS_HOME=$(pwd)" >> $GITHUB_ENV
cd ../amrex
git fetch; git checkout development
echo "AMREX_HOME=$(pwd)" >> $GITHUB_ENV
cd ../..
- name: Install dependencies
run: |
.github/workflows/dependencies_clang-tidy-apt-llvm.sh 17
- name: Compile flame_wave
run: |
echo $AMREX_HOME
echo $MICROPHYSICS_HOME
cd Exec/science/subchandra
make USE_MPI=FALSE USE_CLANG_TIDY=TRUE CLANG_TIDY=clang-tidy-17 CLANG_TIDY_WARN_ERROR=TRUE -j 4
22 changes: 22 additions & 0 deletions .github/workflows/dependencies_clang-tidy-apt-llvm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

set -eu -o pipefail

# `man apt.conf`:
# Number of retries to perform. If this is non-zero APT will retry
# failed files the given number of times.
echo 'Acquire::Retries "3";' | sudo tee /etc/apt/apt.conf.d/80-retries

if [[ ! -f /etc/apt/trusted.gpg.d/apt.llvm.org.asc ]]; then
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
fi

source /etc/os-release # set UBUNTU_CODENAME

sudo add-apt-repository "deb http://apt.llvm.org/${UBUNTU_CODENAME}/ llvm-toolchain-${UBUNTU_CODENAME} main"
sudo add-apt-repository "deb http://apt.llvm.org/${UBUNTU_CODENAME}/ llvm-toolchain-${UBUNTU_CODENAME}-$1 main"

sudo apt-get update

sudo apt-get install -y --no-install-recommends \
clang-tidy-$1 libomp-$1-dev
12 changes: 6 additions & 6 deletions Exec/hydro_tests/Sedov/problem_initialize.H
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ void problem_initialize ()
}
}

Real xn_zone[NumSpec];
for (int n = 0; n < NumSpec; ++n) {
xn_zone[n] = 0.0_rt;
}
Real xn_zone[NumSpec] = {0.0};
xn_zone[0] = 1.0_rt;

eos_t eos_state;
Expand Down Expand Up @@ -96,17 +93,20 @@ void problem_initialize ()
vctr = (4.0_rt / 3.0_rt) * M_PI * problem::r_init * problem::r_init * problem::r_init;

#else

amrex::Abort("Sedov problem unsupported in 3D axisymmetric geometry.");

#endif

}
else if (coord_type == 2) {


#if AMREX_SPACEDIM == 1
// Must have AMREX_SPACEDIM == 1 for this coord_type.

vctr = (4.0_rt / 3.0_rt) * M_PI * problem::r_init * problem::r_init * problem::r_init;
#else
amrex::Abort("Sedov problem unsupported in 2-D or 3-D spherical geometry.");
#endif

}

Expand Down
138 changes: 69 additions & 69 deletions Exec/science/Detonation/ci-benchmarks/sdc_det_plt00040_extrema.out
Original file line number Diff line number Diff line change
@@ -1,79 +1,79 @@
plotfile = det_x_plt00040
time = 5.1558159133685604e-06
time = 5.1558159140336702e-06
variables minimum value maximum value
density 185259613.21 216639295.98
xmom -76364812859 2.9487648003e+16
density 185259659.3 216625503.34
xmom -13760057465 2.9527146771e+16
ymom 0 0
zmom 0 0
rho_E 1.3062473824e+26 2.7890630574e+26
rho_e 1.3062473824e+26 2.7748033958e+26
Temp 50000004.458 7845854782
rho_H1 2.1207015241e-22 0.020000144873
rho_He3 0.0017224909604 0.021023115362
rho_He4 94365290.111 200001891.25
rho_C12 0.020000000212 21243051.967
rho_N14 1.9999977239e-22 0.020000190213
rho_O16 0.019999999996 19209.485639
rho_Ne20 0.019999999996 9734.6358293
rho_Mg24 0.019999999996 23306.635461
rho_Si28 0.019999999996 2013766.0467
rho_S32 0.019999999996 1654854.387
rho_Ar36 0.019999999996 821077.40202
rho_Ca40 0.019999999996 724428.55057
rho_Ti44 0.019999999996 34137.672926
rho_Cr48 0.019999999996 78094.207516
rho_Fe52 0.019999999996 277975.05929
rho_Fe54 0.019999999996 94999519.274
rho_Ni56 0.019999999996 2236723.6985
rho_n 2.1207015241e-22 234580.251
rho_p 0.019999995434 3609846.1745
rho_enuc -4.6916352344e+29 3.5793978339e+32
pressure 5.5236728673e+25 1.1610546577e+26
kineng 0 2.0430835425e+24
soundspeed 612864631.35 895226082.4
Gamma_1 1.359975607 1.3820247131
MachNumber 0 0.16100811998
uplusc 612864631.35 999536286.21
uminusc -895226453.03 -612859846.92
entropy 98214771.47 336273518.24
rho_E 1.3062473821e+26 2.7889438781e+26
rho_e 1.3062473821e+26 2.7747059271e+26
Temp 50000000.026 7845854559
rho_H1 2.1203665799e-22 0.020000114043
rho_He3 0.0017224849005 0.021021778892
rho_He4 94384549.451 200001582.65
rho_C12 0.020000000216 21181006.118
rho_N14 1.9999997268e-22 0.020000159166
rho_O16 0.02 19209.472033
rho_Ne20 0.02 3403.302453
rho_Mg24 0.02 23330.215568
rho_Si28 0.02 2016074.1508
rho_S32 0.02 1656865.76
rho_Ar36 0.02 822126.88981
rho_Ca40 0.02 725125.60248
rho_Ti44 0.02 34184.806642
rho_Cr48 0.02 78126.082381
rho_Fe52 0.02 278040.09021
rho_Fe54 0.02 94986843.638
rho_Ni56 0.02 2239055.987
rho_n 0.020000004562 234580.08802
rho_p 0.019999995438 3609282.9073
rho_enuc -4.6902991452e+29 3.5778382148e+32
pressure 5.5236728651e+25 1.1610543806e+26
kineng 0 2.047804488e+24
soundspeed 612864631.21 895226062.8
Gamma_1 1.3599756296 1.3819790602
MachNumber 0 0.16114515958
uplusc 612864631.21 999634014.46
uminusc -895226128.14 -612860627.32
entropy 98214767.758 336273492.62
magvort 0 0
divu -97902.982158 33744.686211
eint_E 6.5312369121e+17 1.3804344246e+18
eint_e 6.5312369121e+17 1.3804344246e+18
logden 8.267780753 8.3357372357
StateErr_0 185259613.21 216639295.98
StateErr_1 50000004.458 7845854782
StateErr_2 1e-30 9.9999779304e-11
X(H1) 1e-30 9.9999779304e-11
X(He3) 8.9859771063e-12 9.9999601234e-11
X(He4) 0.48406305162 0.9999999982
X(C12) 1.0000000106e-10 0.10016992833
X(N14) 1e-30 1.0000000525e-10
X(O16) 9.999999998e-11 9.6047401986e-05
X(Ne20) 9.999999998e-11 4.5902903915e-05
X(Mg24) 9.999999998e-11 0.00011109993006
X(Si28) 9.999999998e-11 0.010051430746
X(S32) 9.999999998e-11 0.0083423100958
X(Ar36) 9.999999998e-11 0.004162785426
X(Ca40) 9.999999998e-11 0.0037083550771
X(Ti44) 9.999999998e-11 0.00017290662768
X(Cr48) 9.999999998e-11 0.00040059772358
X(Fe52) 9.999999998e-11 0.001337522714
X(Fe54) 9.999999998e-11 0.46488979858
X(Ni56) 9.999999998e-11 0.010324644421
X(n) 1e-30 0.0011729007238
X(p) 9.9999977087e-11 0.017592929732
abar 4.000000001 6.7312458561
Ye 0.49998677577 0.50001556472
x_velocity -381.82392939 138572160.27
divu -97879.954761 33763.419428
eint_E 6.5312369103e+17 1.3804343698e+18
eint_e 6.5312369103e+17 1.3804343698e+18
logden 8.267780861 8.3357095848
StateErr_0 185259659.3 216625503.34
StateErr_1 50000000.026 7845854559
StateErr_2 1e-30 9.9999779324e-11
X(H1) 1e-30 9.9999779324e-11
X(He3) 8.9862145938e-12 9.9999601254e-11
X(He4) 0.48407561714 0.9999999982
X(C12) 1.0000000108e-10 0.099893133188
X(N14) 1e-30 1.0000000432e-10
X(O16) 1e-10 9.6047335509e-05
X(Ne20) 1e-10 1.6050538078e-05
X(Mg24) 1e-10 0.00011120690546
X(Si28) 1e-10 0.010059247336
X(S32) 1e-10 0.0083490446432
X(Ar36) 1e-10 0.0041662673673
X(Ca40) 1e-10 0.0037091533301
X(Ti44) 1e-10 0.00017295101573
X(Cr48) 1e-10 0.00040068985616
X(Fe52) 1e-10 0.0013377863567
X(Fe54) 1e-10 0.46486808681
X(Ni56) 1e-10 0.010336068249
X(n) 1.0000002281e-10 0.001172900139
X(p) 9.9999977027e-11 0.017594951746
abar 4.000000001 6.7310197958
Ye 0.49998669648 0.50001557929
x_velocity -68.800275809 138706560.7
y_velocity 0 0
z_velocity 0 0
t_sound_t_enuc 3.4412406672e-13 0.97497430527
enuc -2.4944881551e+21 1.6522384906e+24
magvel 0 138572160.27
radvel -381.82392939 138572160.27
circvel 0 2
magmom 0 2.9487648003e+16
t_sound_t_enuc 3.4412406685e-13 0.97470686938
enuc -2.4937801624e+21 1.6516237283e+24
magvel 0 138706560.7
radvel -68.800275809 138706560.7
circvel 0 2.8284271247
magmom 0 2.9527146771e+16
angular_momentum_x 0 0
angular_momentum_y 0 0
angular_momentum_z 0 0
Expand Down
9 changes: 7 additions & 2 deletions Exec/science/Detonation/problem_initialize.H
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,15 @@ void problem_initialize ()

if (problem::in14 >= 0) {
problem::xn[problem::in14] = amrex::max(problem::nfrac, problem::smallx);
problem::xn[problem::ihe4] = 1.0_rt - problem::cfrac - problem::nfrac - problem::ofrac - (NumSpec - 3) * problem::smallx;
problem::xn[problem::ihe4] = 1.0_rt - problem::xn[problem::ic12]
- problem::xn[problem::in14]
- problem::xn[problem::io16]
- (NumSpec - 4) * problem::smallx;
}
else {
problem::xn[problem::ihe4] = 1.0_rt - problem::cfrac - problem::ofrac - (NumSpec - 2) * problem::smallx;
problem::xn[problem::ihe4] = 1.0_rt - problem::xn[problem::ic12]
- problem::xn[problem::io16]
- (NumSpec - 3) * problem::smallx;
}

// Set the ambient material
Expand Down
5 changes: 4 additions & 1 deletion Source/driver/Castro_advance_ctu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@
using namespace amrex;

advance_status
Castro::do_advance_ctu (Real time, Real dt)
Castro::do_advance_ctu (Real time, Real dt) // NOLINT(readability-convert-member-functions-to-static)
{
// this routine will advance the old state data (called Sborder here)
// to the new time, for a single level. The new data is called
// S_new here. The update includes reactions (if we are not doing
// SDC), hydro, and the source terms.

amrex::ignore_unused(time);
amrex::ignore_unused(dt);

BL_PROFILE("Castro::do_advance_ctu()");

advance_status status {};
Expand Down
3 changes: 3 additions & 0 deletions Source/driver/Castro_advance_sdc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ Castro::do_advance_sdc (Real time,

// this is the new "formal" SDC integration routine.

amrex::ignore_unused(amr_iteration);
amrex::ignore_unused(amr_ncycle);

// this does the entire update in time for 1 SDC iteration.

BL_PROFILE("Castro::do_advance_sdc()");
Expand Down
2 changes: 1 addition & 1 deletion Source/gravity/Castro_gravity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ void Castro::construct_old_gravity_source(MultiFab& source, MultiFab& state_in,

Real SrE{};

if (castro::grav_source_type == 1 || castro::grav_source_type == 2) {
if (castro::grav_source_type == 1 || castro::grav_source_type == 2) { // NOLINT(bugprone-branch-clone)

// Src = rho u dot g, evaluated with all quantities at t^n

Expand Down
32 changes: 16 additions & 16 deletions Source/gravity/Gravity.H
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public:
/// @param time Current time
/// @param multi_level boolean, do we iterate over all levels or mask off fine grids?
///
void set_mass_offset(amrex::Real time, bool multi_level=true);
void set_mass_offset(amrex::Real time, bool multi_level=true) const;

///
/// Return ``grad_phi_prev`` at given level
Expand Down Expand Up @@ -242,17 +242,17 @@ public:
///
/// Compute the difference between level and composite solves
///
/// @param level level index
/// @param comp_phi MultiFab containing computed phi
/// @param comp_gphi Vector of MultiFabs containing computed grad phi
/// @param cml_phi MultiFab, computed minus level phi
/// @param cml_gphi Vector of MultiFabs, computed minus level grad phi
/// @param level level index
/// @param comp_phi MultiFab containing computed phi
/// @param comp_gphi Vector of MultiFabs containing computed grad phi
/// @param comp_minus_level_phi MultiFab, computed minus level phi
/// @param comp_minus_level_grad_phi Vector of MultiFabs, computed minus level grad phi
///
void create_comp_minus_level_grad_phi(int level,
amrex::MultiFab& comp_phi,
const amrex::Vector<amrex::MultiFab*>& comp_gphi,
amrex::MultiFab& cml_phi,
amrex::Vector<std::unique_ptr<amrex::MultiFab> >& cml_gphi);
amrex::MultiFab& comp_minus_level_phi,
amrex::Vector<std::unique_ptr<amrex::MultiFab> >& comp_minus_level_grad_phi);


///
Expand Down Expand Up @@ -348,7 +348,7 @@ public:
/// @param radial_grav Radial gravity
/// @param grav_vector Gravity vector
///
void interpolate_monopole_grav(int level, RealVector& radial_grav, amrex::MultiFab& grav_vector);
void interpolate_monopole_grav(int level, RealVector& radial_grav, amrex::MultiFab& grav_vector) const;

///
/// Integrate radially outward to find radial mass distribution
Expand All @@ -368,7 +368,7 @@ public:
#ifdef GR_GRAV
RealVector& radial_pres,
#endif
int n1d, int level);
int n1d, int level) const;

///
/// Implement multipole boundary conditions
Expand All @@ -383,7 +383,7 @@ public:
///
/// Initialize multipole gravity
///
void init_multipole_grav();
void init_multipole_grav() const;

#if (AMREX_SPACEDIM == 3)

Expand Down Expand Up @@ -480,31 +480,31 @@ public:
/// @param Rhs MultiFab
/// @param coeffs Vector of MultiFabs
///
void applyMetricTerms(int level,amrex::MultiFab& Rhs, const amrex::Vector<amrex::MultiFab*>& coeffs);
void applyMetricTerms(int level,amrex::MultiFab& Rhs, const amrex::Vector<amrex::MultiFab*>& coeffs) const;

///
///
///
/// @param level Index of level
/// @param cc Cell-centered data
///
void unweight_cc(int level,amrex::MultiFab& cc);
void unweight_cc(int level,amrex::MultiFab& cc) const;

///
///
///
/// @param level Index of level
/// @param edges Edge-based data
///
void unweight_edges(int level, const amrex::Vector<amrex::MultiFab*>& edges);
void unweight_edges(int level, const amrex::Vector<amrex::MultiFab*>& edges) const;
#endif

///
/// @param level Index of level
/// @param phi Gravitational potential
/// @param grav_vector Gravity vector
///
void add_pointmass_to_gravity (int level, amrex::MultiFab& phi, amrex::MultiFab& grav_vector);
void add_pointmass_to_gravity (int level, amrex::MultiFab& phi, amrex::MultiFab& grav_vector) const;

///
/// Get the rhs
Expand Down Expand Up @@ -546,7 +546,7 @@ public:
const amrex::Vector<std::array<amrex::MultiFab*,AMREX_SPACEDIM> >& grad_phi,
const amrex::Vector<amrex::MultiFab*>& res,
const amrex::MultiFab* const crse_bcdata,
amrex::Real rel_eps, amrex::Real abs_eps);
amrex::Real rel_eps, amrex::Real abs_eps) const;


///
Expand Down
Loading

0 comments on commit e4cb0ca

Please sign in to comment.