Skip to content

Commit

Permalink
Merge branch 'development' into detonation_nse_net_input
Browse files Browse the repository at this point in the history
  • Loading branch information
yut23 authored Mar 7, 2024
2 parents 4b22854 + 465a83f commit a4e9634
Show file tree
Hide file tree
Showing 96 changed files with 1,655 additions and 735 deletions.
7 changes: 6 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Checks: >
clang-diagnostic-*,
cppcoreguidelines-*,
-cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-avoid-goto,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-init-variables,
Expand All @@ -17,11 +16,17 @@ Checks: >
-cppcoreguidelines-non-private-member-variables-in-classes,
-cppcoreguidelines-owning-memory,
-cppcoreguidelines-pro-*,
misc-*,
-misc-const-correctness,
-misc-include-cleaner,
-misc-non-private-member-variables-in-classes,
modernize-*,
-modernize-avoid-c-arrays,
-modernize-use-trailing-return-type,
-modernize-use-using,
performance-*,
-performance-avoid-endl,
portability-*,
readability-*,
-readability-avoid-const-params-in-decls,
-readability-braces-around-statements,
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-ifdefs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
fetch-depth: 0

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: "pip"
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/docs-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
branches:
- development

env:
# enable color output from Sphinx
FORCE_COLOR: "1"

jobs:
docs:
runs-on: ubuntu-latest
Expand All @@ -33,7 +37,10 @@ jobs:
- name: Build docs
run: |
cd Docs/
make SPHINXOPTS=-v NO_DOXYGEN=TRUE html
# remove missing TOC entries that would otherwise be generated by
# doxygen to avoid warnings about missing references
sed -i -e 's/^ filelist$//; s/^ classlist$//' source/index.rst
make SPHINXOPTS='-v -W --keep-going' NO_DOXYGEN=TRUE html
- name: Check links
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/good_defines.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ AMREX_PARTICLES
AMREX_SPACEDIM
AMREX_USE_CUDA
AMREX_USE_GPU
AMREX_USE_HIP
AMREX_USE_OMP
AUX_THERMO
BL_FORT_USE_LOWERCASE
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ Docs/source/namespacelist.rst
Docs/source/runtime_parameters.rst
Docs/source/*_files.rst
Docs/source/preprocessed_files
Docs/source/yt_example.rst
Docs/source/yt_example_files/


amr_diag.out
Expand Down
12 changes: 12 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# 24.02

* Lot's of code fixes from coverity and clang-tidy (#2736, #2734,
#2735, #2731, #2732, #2733)

* Fix the boundary condition logic at a wall for Detonation (#2722)

* Reimplement the shock detection algorithm to account for sources
and do a better job in multidimensions (#2711, #2710, #2709, #2704)

* Start the process of moving the runtime parameters to structs (#2688)

# 24.01

* An option for unlimited PPM reconstruction was added (#2670)
Expand Down
38 changes: 19 additions & 19 deletions Diagnostics/DustCollapse/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,18 @@ int main(int argc, char* argv[])
#if (AMREX_SPACEDIM == 1)
int nbins = domain.length(0);
#elif (AMREX_SPACEDIM == 2)
auto x_maxdist = fmax(fabs(problo[0]), fabs(probhi[0]));
auto y_maxdist = fmax(fabs(problo[1] - yctr), fabs(probhi[1] - yctr));
auto x_maxdist = std::max(std::abs(problo[0]), std::abs(probhi[0]));
auto y_maxdist = std::max(std::abs(problo[1] - yctr), std::abs(probhi[1] - yctr));

auto max_dist = sqrt(x_maxdist*x_maxdist + y_maxdist*y_maxdist);
auto max_dist = std::sqrt(x_maxdist*x_maxdist + y_maxdist*y_maxdist);

int nbins = int(max_dist / dx_fine);
#else
auto x_maxdist = fmax(fabs(problo[0] - xctr), fabs(probhi[0] - xctr));
auto y_maxdist = fmax(fabs(problo[1] - yctr), fabs(probhi[1] - yctr));
auto z_maxdist = fmax(fabs(problo[2] - zctr), fabs(probhi[2] - zctr));
auto x_maxdist = std::max(std::abs(problo[0] - xctr), std::abs(probhi[0] - xctr));
auto y_maxdist = std::max(std::abs(problo[1] - yctr), std::abs(probhi[1] - yctr));
auto z_maxdist = std::max(std::abs(problo[2] - zctr), std::abs(probhi[2] - zctr));

auto max_dist = sqrt(x_maxdist*x_maxdist + y_maxdist*y_maxdist +
auto max_dist = std::sqrt(x_maxdist*x_maxdist + y_maxdist*y_maxdist +
z_maxdist*z_maxdist);

int nbins = int(max_dist / dx_fine);
Expand Down Expand Up @@ -147,7 +147,7 @@ int main(int argc, char* argv[])
// over levels, we will compare to the finest level index space to
// determine if we've already output here
int mask_size = domain.length().max();
Vector<int> imask(pow(mask_size, AMREX_SPACEDIM), 1);
Vector<int> imask(std::pow(mask_size, AMREX_SPACEDIM), 1);

// counter
int cnt = 0;
Expand All @@ -172,17 +172,17 @@ int main(int argc, char* argv[])
const Box& bx = mfi.tilebox();

#if (AMREX_SPACEDIM == 1)
fdustcollapse1d(ARLIM_3D(bx.loVect()), ARLIM_3D(bx.hiVect()),
fdustcollapse1d(AMREX_ARLIM_3D(bx.loVect()), AMREX_ARLIM_3D(bx.hiVect()),
BL_TO_FORTRAN_FAB(lev_data_mf[mfi]),
nbins, dens.dataPtr(),
imask.dataPtr(), mask_size, r1, dens_comp, &cnt);
#elif (AMREX_SPACEDIM == 2)

fdustcollapse2d(ARLIM_3D(bx.loVect()), ARLIM_3D(bx.hiVect()),
fdustcollapse2d(AMREX_ARLIM_3D(bx.loVect()), AMREX_ARLIM_3D(bx.hiVect()),
BL_TO_FORTRAN_FAB(lev_data_mf[mfi]),
nbins, dens.dataPtr(), volcount.dataPtr(),
imask.dataPtr(), mask_size, r1,
ZFILL(level_dx), dx_fine, yctr, dens_comp);
AMREX_ZFILL(level_dx), dx_fine, yctr, dens_comp);
#else
fdustcollapse3d(bx.loVect(), bx.hiVect(),
BL_TO_FORTRAN_FAB(lev_data_mf[mfi]),
Expand Down Expand Up @@ -210,21 +210,21 @@ int main(int argc, char* argv[])
// analytic expression for the radius as a function of time t = 0.00
Real max_dens = 1.e9;

if (fabs(data.Time()) <= 1.e-8)
if (std::abs(data.Time()) <= 1.e-8)
max_dens = 1.e9;
else if (fabs(data.Time() - 0.01) <= 1.e-8)
else if (std::abs(data.Time() - 0.01) <= 1.e-8)
max_dens = 1.043345e9;
else if (fabs(data.Time() - 0.02) <= 1.e-8)
else if (std::abs(data.Time() - 0.02) <= 1.e-8)
max_dens = 1.192524e9;
else if (fabs(data.Time() - 0.03) <= 1.e-8)
else if (std::abs(data.Time() - 0.03) <= 1.e-8)
max_dens = 1.527201e9;
else if (fabs(data.Time() - 0.04) <= 1.e-8)
else if (std::abs(data.Time() - 0.04) <= 1.e-8)
max_dens = 2.312884e9;
else if (fabs(data.Time() - 0.05) <= 1.e-8)
else if (std::abs(data.Time() - 0.05) <= 1.e-8)
max_dens = 4.779133e9;
else if (fabs(data.Time() - 0.06) <= 1.e-8)
else if (std::abs(data.Time() - 0.06) <= 1.e-8)
max_dens = 24.472425e9;
else if (fabs(data.Time() - 0.065) <= 1.e-8)
else if (std::abs(data.Time() - 0.065) <= 1.e-8)
max_dens = 423.447291e9;
else {
Print() << "Dont know the maximum density at this time: " << data.Time() <<std::endl;
Expand Down
2 changes: 1 addition & 1 deletion Diagnostics/Radiation/Radiation_utils.H
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void WriteSlicefile(const int nbins, const Vector<Real> r,
slicefile << std::setw(w) << r[i];

for (auto it=vars.begin(); it!=vars.end(); ++it) {
if(fabs((*it)[i]) < SMALL) (*it)[i] = 0.0;
if(std::abs((*it)[i]) < SMALL) (*it)[i] = 0.0;
slicefile << std::setw(w) << (*it)[i];
}

Expand Down
12 changes: 6 additions & 6 deletions Diagnostics/Radiation/gaussian_pulse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ int main(int argc, char* argv[])

// compute the size of the radially-binned array -- we'll do it to
// the furtherest corner of the domain
double x_maxdist = max(fabs(probhi[0] - xctr), fabs(problo[0] - xctr));
double y_maxdist = max(fabs(probhi[1] - yctr), fabs(problo[1] - yctr));
double maxdist = sqrt(x_maxdist*x_maxdist + y_maxdist*y_maxdist);
double x_maxdist = std::max(std::abs(probhi[0] - xctr), std::abs(problo[0] - xctr));
double y_maxdist = std::max(std::abs(probhi[1] - yctr), std::abs(problo[1] - yctr));
double maxdist = std::sqrt(x_maxdist*x_maxdist + y_maxdist*y_maxdist);

double dx_fine = *(std::min_element(dx.begin(), dx.end()));

Expand Down Expand Up @@ -102,7 +102,7 @@ int main(int argc, char* argv[])
// over levels, we will compare to the finest level index space to
// determine if we've already output here
int mask_size = domain.length().max();
Vector<int> imask(pow(mask_size, AMREX_SPACEDIM), 1);
Vector<int> imask(std::pow(mask_size, AMREX_SPACEDIM), 1);

// loop over the data, starting at the finest grid, and if we haven't
// already stored data in that grid location (according to imask),
Expand All @@ -123,11 +123,11 @@ int main(int argc, char* argv[])
for (MFIter mfi(lev_data_mf, true); mfi.isValid(); ++mfi) {
const Box& bx = mfi.tilebox();

fgaussian_pulse(ARLIM_3D(bx.loVect()), ARLIM_3D(bx.hiVect()),
fgaussian_pulse(AMREX_ARLIM_3D(bx.loVect()), AMREX_ARLIM_3D(bx.hiVect()),
BL_TO_FORTRAN_FAB(lev_data_mf[mfi]),
nbins, rad_bin.dataPtr(), ncount.dataPtr(),
imask.dataPtr(), mask_size, r1,
rad_comp, ZFILL(dx), dx_fine, xctr, yctr);
rad_comp, AMREX_ZFILL(dx), dx_fine, xctr, yctr);

}

Expand Down
8 changes: 4 additions & 4 deletions Diagnostics/Radiation/lgt_frnt1d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ int main(int argc, char* argv[])

// compute the size of the radially-binned array -- we'll do it to
// the furtherest corner of the domain
double maxdist = fabs(probhi[0] - problo[0]);
double maxdist = std::abs(probhi[0] - problo[0]);
double dx_fine = *(std::min_element(dx.begin(), dx.end()));
int nbins = int(maxdist / dx_fine);

Expand Down Expand Up @@ -93,7 +93,7 @@ int main(int argc, char* argv[])
// over levels, we will compare to the finest level index space to
// determine if we've already output here
int mask_size = domain.length().max();
Vector<int> imask(pow(mask_size, AMREX_SPACEDIM), 1);
Vector<int> imask(std::pow(mask_size, AMREX_SPACEDIM), 1);

// loop over the data, starting at the finest grid, and if we haven't
// already stored data in that grid location (according to imask),
Expand All @@ -114,13 +114,13 @@ int main(int argc, char* argv[])
for (MFIter mfi(lev_data_mf, true); mfi.isValid(); ++mfi) {
const Box& bx = mfi.tilebox();

flgt_frnt1d(ARLIM_3D(bx.loVect()), ARLIM_3D(bx.hiVect()),
flgt_frnt1d(AMREX_ARLIM_3D(bx.loVect()), AMREX_ARLIM_3D(bx.hiVect()),
BL_TO_FORTRAN_FAB(lev_data_mf[mfi]),
nbins, dens_bin.dataPtr(), vel_bin.dataPtr(),
pres_bin.dataPtr(), rad_bin.dataPtr(),
imask.dataPtr(), mask_size, r1,
dens_comp, xmom_comp, pres_comp, rad_comp,
ZFILL(dx), dx_fine);
AMREX_ZFILL(dx), dx_fine);
}

// adjust r1 for the next lowest level
Expand Down
6 changes: 3 additions & 3 deletions Diagnostics/Radiation/rad_shock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ int main(int argc, char* argv[])
// over levels, we will compare to the finest level index space to
// determine if we've already output here
int mask_size = domain.length().max();
Vector<int> imask(pow(mask_size, AMREX_SPACEDIM), 1);
Vector<int> imask(std::pow(mask_size, AMREX_SPACEDIM), 1);

// counter
auto cnt = 0;
Expand Down Expand Up @@ -135,7 +135,7 @@ int main(int argc, char* argv[])
for (MFIter mfi(lev_data_mf, true); mfi.isValid(); ++mfi) {
const Box& bx = mfi.tilebox();

fradshock(ARLIM_3D(bx.loVect()), ARLIM_3D(bx.hiVect()),
fradshock(AMREX_ARLIM_3D(bx.loVect()), AMREX_ARLIM_3D(bx.hiVect()),
problo.dataPtr(), probhi.dataPtr(),
BL_TO_FORTRAN_FAB(lev_data_mf[mfi]),
nbins, vars_bin.dataPtr(),
Expand Down Expand Up @@ -214,7 +214,7 @@ int main(int argc, char* argv[])
slicefile << std::setw(w) << vars_bin[isv[i]+((*it)+1)*nbins];

auto it = comps.end()-1;
slicefile << std::setw(w) << pow(vars_bin[isv[i]+((*it)+1)*nbins] / arad, 0.25);
slicefile << std::setw(w) << std::pow(vars_bin[isv[i]+((*it)+1)*nbins] / arad, 0.25);

slicefile << std::endl;
}
Expand Down
2 changes: 1 addition & 1 deletion Diagnostics/Radiation/rad_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ int main(int argc, char* argv[])

Real rhoe, rad;

fradsource(ARLIM_3D(bx.loVect()), ARLIM_3D(bx.hiVect()),
fradsource(AMREX_ARLIM_3D(bx.loVect()), AMREX_ARLIM_3D(bx.hiVect()),
BL_TO_FORTRAN_FAB(lev_data_mf[mfi]),
&rhoe, &rad, rhoe_comp, rad_comp);

Expand Down
8 changes: 4 additions & 4 deletions Diagnostics/Radiation/rad_sphere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ int main(int argc, char* argv[])
// over levels, we will compare to the finest level index space to
// determine if we've already output here
int mask_size = domain.length()[0];
Vector<int> imask(pow(mask_size, AMREX_SPACEDIM), 1);
Vector<int> imask(std::pow(mask_size, AMREX_SPACEDIM), 1);

// counter
int cnt = 0;
Expand All @@ -163,12 +163,12 @@ int main(int argc, char* argv[])
for (MFIter mfi(lev_data_mf, true); mfi.isValid(); ++mfi) {
const Box& bx = mfi.tilebox();

fradsphere(ARLIM_3D(bx.loVect()), ARLIM_3D(bx.hiVect()),
ZFILL(problo), ZFILL(probhi),
fradsphere(AMREX_ARLIM_3D(bx.loVect()), AMREX_ARLIM_3D(bx.hiVect()),
AMREX_ZFILL(problo), AMREX_ZFILL(probhi),
BL_TO_FORTRAN_FAB(lev_data_mf[mfi]),
nbins, vars_bin.dataPtr(),
imask.dataPtr(), mask_size, r1,
ZFILL(dx), &cnt);
AMREX_ZFILL(dx), &cnt);
}

// adjust r1 for the next lowest level
Expand Down
2 changes: 1 addition & 1 deletion Diagnostics/Radiation/rhd_shocktube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ int main(int argc, char* argv[])
for (MFIter mfi(lev_data_mf, true); mfi.isValid(); ++mfi) {
const Box& bx = mfi.tilebox();

frhdshocktube(ARLIM_3D(bx.loVect()), ARLIM_3D(bx.hiVect()),
frhdshocktube(AMREX_ARLIM_3D(bx.loVect()), AMREX_ARLIM_3D(bx.hiVect()),
BL_TO_FORTRAN_FAB(lev_data_mf[mfi]),
nbins, dens_bin.dataPtr(), vel_bin.dataPtr(),
pres_bin.dataPtr(), rad_bin.dataPtr(),
Expand Down
10 changes: 5 additions & 5 deletions Diagnostics/Sedov/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ int main(int argc, char* argv[])

#else
double x_maxdist = amrex::max(std::abs(probhi[0] - xctr),
std::fabs(problo[0] - xctr));
std::abs(problo[0] - xctr));
double y_maxdist = amrex::max(std::abs(probhi[1] - yctr),
std::abs(problo[1] - yctr));
double z_maxdist = amrex::max(std::abs(probhi[2] - zctr),
Expand Down Expand Up @@ -342,10 +342,10 @@ int main(int argc, char* argv[])
// write the data in columns
const auto SMALL = 1.e-20;
for (auto i = 0; i < nbins; i++) {
if (fabs(dens_bin[i]) < SMALL) dens_bin[i] = 0.0;
if (fabs( vel_bin[i]) < SMALL) vel_bin[i] = 0.0;
if (fabs(pres_bin[i]) < SMALL) pres_bin[i] = 0.0;
if (fabs( e_bin[i]) < SMALL) e_bin[i] = 0.0;
if (std::abs(dens_bin[i]) < SMALL) dens_bin[i] = 0.0;
if (std::abs( vel_bin[i]) < SMALL) vel_bin[i] = 0.0;
if (std::abs(pres_bin[i]) < SMALL) pres_bin[i] = 0.0;
if (std::abs( e_bin[i]) < SMALL) e_bin[i] = 0.0;

slicefile << std::setw(w) << r[i] << std::setw(w) << dens_bin[i] << std::setw(w) << vel_bin[i] << std::setw(w) << pres_bin[i] << std::setw(w) << e_bin[i] << std::endl;
}
Expand Down
10 changes: 5 additions & 5 deletions Docs/rp.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
from more_itertools import unique_everseen

MAIN_HEADER = """
+--------------------------------------------+-------------------------------------------------------------+---------------+
| parameter | description | default value |
+============================================+=============================================================+===============+
+--------------------------------------------+-------------------------------------------------------------+-----------------------------+
| parameter | description | default value |
+============================================+=============================================================+=============================+
"""

SEPARATOR = """
+--------------------------------------------+-------------------------------------------------------------+---------------+
+--------------------------------------------+-------------------------------------------------------------+-----------------------------+
"""

ENTRY = """
| {:42} | {:59} | {:13} |
| {:42} | {:59} | {:27} |
"""

WRAP_LEN = 59
Expand Down
Loading

0 comments on commit a4e9634

Please sign in to comment.