diff --git a/.github/workflows/c-linter.yml b/.github/workflows/c-linter.yml index d575a2f236..a779df810a 100644 --- a/.github/workflows/c-linter.yml +++ b/.github/workflows/c-linter.yml @@ -2,6 +2,10 @@ name: cpp-linter on: [pull_request] +concurrency: + group: ${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }} + cancel-in-progress: true + jobs: cpp-linter: runs-on: ubuntu-latest diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml new file mode 100644 index 0000000000..f712591a4b --- /dev/null +++ b/.github/workflows/clang-tidy.yml @@ -0,0 +1,36 @@ +name: "clang-tidy" + +on: [pull_request] + +concurrency: + group: ${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }} + cancel-in-progress: true + +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 + diff --git a/.github/workflows/compiler-warnings.yml b/.github/workflows/compiler-warnings.yml index e8092be3d3..bdc0c627ac 100644 --- a/.github/workflows/compiler-warnings.yml +++ b/.github/workflows/compiler-warnings.yml @@ -1,6 +1,11 @@ name: "compiler warnings" on: [pull_request] + +concurrency: + group: ${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }} + cancel-in-progress: true + jobs: compiler_warnings: runs-on: ubuntu-latest diff --git a/.github/workflows/dependencies_clang-tidy-apt-llvm.sh b/.github/workflows/dependencies_clang-tidy-apt-llvm.sh new file mode 100755 index 0000000000..b64cd619eb --- /dev/null +++ b/.github/workflows/dependencies_clang-tidy-apt-llvm.sh @@ -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 diff --git a/.github/workflows/detonation-sdc-compare.yml b/.github/workflows/detonation-sdc-compare.yml index b8fe7e8568..46038aa534 100644 --- a/.github/workflows/detonation-sdc-compare.yml +++ b/.github/workflows/detonation-sdc-compare.yml @@ -1,6 +1,11 @@ name: detonation-sdc on: [pull_request] + +concurrency: + group: ${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }} + cancel-in-progress: true + jobs: detonation-sdc: runs-on: ubuntu-latest diff --git a/.github/workflows/flame_wave-compare.yml b/.github/workflows/flame_wave-compare.yml index 46ad5b4285..e7cf5cbc4b 100644 --- a/.github/workflows/flame_wave-compare.yml +++ b/.github/workflows/flame_wave-compare.yml @@ -1,6 +1,11 @@ name: flame_wave on: [pull_request] + +concurrency: + group: ${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }} + cancel-in-progress: true + jobs: flame_wave-2d: runs-on: ubuntu-latest diff --git a/.github/workflows/gpu_action.yml b/.github/workflows/gpu_action.yml index 95d65496b0..3c6af431e1 100644 --- a/.github/workflows/gpu_action.yml +++ b/.github/workflows/gpu_action.yml @@ -1,6 +1,11 @@ name: GPU compilation on: [pull_request] + +concurrency: + group: ${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }} + cancel-in-progress: true + jobs: gpu-compilation: runs-on: ubuntu-latest diff --git a/.github/workflows/wdmerger_collision-compare.yml b/.github/workflows/wdmerger_collision-compare.yml index 99551f09dd..8f12f71c89 100644 --- a/.github/workflows/wdmerger_collision-compare.yml +++ b/.github/workflows/wdmerger_collision-compare.yml @@ -1,6 +1,11 @@ name: wdmerger_collision on: [pull_request] + +concurrency: + group: ${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }} + cancel-in-progress: true + jobs: wdmerger_collision-2d: runs-on: ubuntu-latest diff --git a/CHANGES.md b/CHANGES.md index 7aeb11c743..d9ec031954 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,20 @@ +# 24.04 + + * Some clang-tidy fixes (#2779, #2780, #2781, #2784, #2786, #2787, #2790, + #2791, #2792, #2793, #2797, #2798, #2799, #2800, #2801, #2804) + + * Fix species initialization in the Detonation problem (#2806) + and let it work with NSE (#2765) + + * Sync up with AMReX changes (#2794) + + * wdmerger now reports composition of initial stars (#2767) + + * flame_wave now checks if the `atm_delta` is too small (#2782) + and stores X(ash) (#2773) + + * a bounds issue in the true SDC integration was fixed (#2775) + # 24.03 * Documentation updates (#2742, #2752, #2753) diff --git a/Docs/source/io.rst b/Docs/source/io.rst index e9dc10993c..1e6191f6f4 100644 --- a/Docs/source/io.rst +++ b/Docs/source/io.rst @@ -304,6 +304,8 @@ Derived variables +-----------------------------------+---------------------------------------------------+-----------------------------+-----------------------------------------+ | variable name | description | derive routine | units | +===================================+===================================================+=============================+=========================================+ +| ``abar`` | Mean atomic mass | ``derabar`` | :math:`\amu` | ++-----------------------------------+---------------------------------------------------+-----------------------------+-----------------------------------------+ | ``angular_momentum_x``, | Angular momentum / volume in the x, y, or z dir | ``derangmomx``, | :math:`{\rm g~cm^{-1}~s^{-1}}` | | ``angular_momentum_y``, | computed as :math:`[(\rho \ub) \times {\bf r}]_n` | ``derangmomy``, | | | ``angular_momentum_z`` | where :math:`{\bf r}` is the distance from | ``derangmomz`` | | @@ -328,6 +330,8 @@ Derived variables | | :math:`s = s(\rho, e, X_k)`, where `e` is | | | | | computed from :math:`(\rho e)` | | | +-----------------------------------+---------------------------------------------------+-----------------------------+-----------------------------------------+ +| ``enuc`` | Nuclear energy generation rate / gram | ``derenuc`` | :math:`{\rm erg~g^{-1}~s^{-1}}` | ++-----------------------------------+---------------------------------------------------+-----------------------------+-----------------------------------------+ | ``Ertot`` | Total radiation energy density | ``derertot`` | | | | (for multigroup radiation problems) | | | +-----------------------------------+---------------------------------------------------+-----------------------------+-----------------------------------------+ @@ -391,8 +395,6 @@ Derived variables | ``y_velocity``, | :math:`\ub = (\rho \ub)/\rho` | | | | ``z_velocity`` | | | | +-----------------------------------+---------------------------------------------------+-----------------------------+-----------------------------------------+ -| ``enuc`` | Nuclear energy generation rate / gram | ``derenuc`` | :math:`{\rm erg~g^{-1}~s^{-1}}` | -+-----------------------------------+---------------------------------------------------+-----------------------------+-----------------------------------------+ problem-specific plotfile variables ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/Exec/Make.auto_source b/Exec/Make.auto_source index 178e0f43e2..596542809d 100644 --- a/Exec/Make.auto_source +++ b/Exec/Make.auto_source @@ -67,6 +67,8 @@ AUTO_BUILD_SOURCES += $(CASTRO_AUTO_SOURCE_DIR)/castro_params.H CPP_PARAMETERS := $(TOP)/Source/driver/_cpp_parameters +$(CASTRO_AUTO_SOURCE_DIR)/runtime_params.cpp: $(CASTRO_AUTO_SOURCE_DIR)/castro_params.H + $(CASTRO_AUTO_SOURCE_DIR)/castro_params.H: $(CPP_PARAMETERS) @if [ ! -d $(CASTRO_AUTO_SOURCE_DIR) ]; then mkdir -p $(CASTRO_AUTO_SOURCE_DIR); fi PYTHONPATH=$(MICROPHYSICS_HOME)/util/build_scripts $(TOP)/Source/driver/parse_castro_params.py -o $(CASTRO_AUTO_SOURCE_DIR) $(CPP_PARAMETERS) diff --git a/Exec/hydro_tests/Sedov/problem_initialize.H b/Exec/hydro_tests/Sedov/problem_initialize.H index b056e41349..fb0eb76814 100644 --- a/Exec/hydro_tests/Sedov/problem_initialize.H +++ b/Exec/hydro_tests/Sedov/problem_initialize.H @@ -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; @@ -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 } diff --git a/Exec/science/Detonation/ci-benchmarks/sdc_det_plt00040_extrema.out b/Exec/science/Detonation/ci-benchmarks/sdc_det_plt00040_extrema.out index b23a288448..5d48f26c1b 100644 --- a/Exec/science/Detonation/ci-benchmarks/sdc_det_plt00040_extrema.out +++ b/Exec/science/Detonation/ci-benchmarks/sdc_det_plt00040_extrema.out @@ -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 diff --git a/Exec/science/Detonation/problem_initialize.H b/Exec/science/Detonation/problem_initialize.H index 58205bbf24..c625a16440 100644 --- a/Exec/science/Detonation/problem_initialize.H +++ b/Exec/science/Detonation/problem_initialize.H @@ -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 diff --git a/Source/diffusion/Make.package b/Source/diffusion/Make.package index d39ddec718..be1fe61fbe 100644 --- a/Source/diffusion/Make.package +++ b/Source/diffusion/Make.package @@ -8,5 +8,4 @@ CEXE_sources += diffusion_util.cpp CEXE_sources += Castro_diffusion.cpp CEXE_sources += Diffusion.cpp -CEXE_sources += diffusion_params.cpp CEXE_headers += Diffusion.H diff --git a/Source/diffusion/diffusion_params.cpp b/Source/diffusion/diffusion_params.cpp deleted file mode 100644 index 2518c14740..0000000000 --- a/Source/diffusion/diffusion_params.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include - -#include - -#include - -#include diff --git a/Source/driver/Castro_advance_ctu.cpp b/Source/driver/Castro_advance_ctu.cpp index 911a2780e9..44b5cc57a8 100644 --- a/Source/driver/Castro_advance_ctu.cpp +++ b/Source/driver/Castro_advance_ctu.cpp @@ -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 {}; diff --git a/Source/driver/Castro_advance_sdc.cpp b/Source/driver/Castro_advance_sdc.cpp index 83b226c7bc..01c5f653be 100644 --- a/Source/driver/Castro_advance_sdc.cpp +++ b/Source/driver/Castro_advance_sdc.cpp @@ -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()"); diff --git a/Source/driver/Castro_io.cpp b/Source/driver/Castro_io.cpp index e66a8b5ac9..9b08cc95a3 100644 --- a/Source/driver/Castro_io.cpp +++ b/Source/driver/Castro_io.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -578,10 +579,7 @@ Castro::writeJobInfo (const std::string& dir, const Real io_time) jobInfoFile << "output date / time: " << std::put_time(std::localtime(&now), "%c\n") << "\n"; - char currentDir[FILENAME_MAX]; - if (getcwd(currentDir, FILENAME_MAX) != nullptr) { - jobInfoFile << "output dir: " << currentDir << "\n"; - } + jobInfoFile << "output dir: " << std::filesystem::current_path() << "\n"; jobInfoFile << "I/O time (s): " << io_time << "\n"; diff --git a/Source/driver/Castro_setup.cpp b/Source/driver/Castro_setup.cpp index c4a5327e64..0d3c8190d3 100644 --- a/Source/driver/Castro_setup.cpp +++ b/Source/driver/Castro_setup.cpp @@ -20,137 +20,153 @@ using std::string; using namespace amrex; -static Box the_same_box (const Box& b) { return b; } -static Box grow_box_by_one (const Box& b) { return amrex::grow(b,1); } +using BndryFunc = StateDescriptor::BndryFunc; -typedef StateDescriptor::BndryFunc BndryFunc; +namespace { -// -// Components are: -// Interior, Inflow, Outflow, Symmetry, SlipWall, NoSlipWall -// -static int scalar_bc[] = - { - amrex::BCType::int_dir, amrex::BCType::ext_dir, amrex::BCType::foextrap, amrex::BCType::reflect_even, amrex::BCType::reflect_even, amrex::BCType::reflect_even - }; - -static int norm_vel_bc[] = - { - amrex::BCType::int_dir, amrex::BCType::ext_dir, amrex::BCType::foextrap, amrex::BCType::reflect_odd, amrex::BCType::reflect_odd, amrex::BCType::reflect_odd - }; + Box the_same_box (const Box& b) { return b; } + Box grow_box_by_one (const Box& b) { return amrex::grow(b,1); } -static int tang_vel_bc[] = - { - amrex::BCType::int_dir, amrex::BCType::ext_dir, amrex::BCType::foextrap, amrex::BCType::reflect_even, amrex::BCType::reflect_even, amrex::BCType::reflect_even - }; + // + // Components are: + // Interior, Inflow, Outflow, Symmetry, SlipWall, NoSlipWall + // + int scalar_bc[] = + { + amrex::BCType::int_dir, + amrex::BCType::ext_dir, + amrex::BCType::foextrap, + amrex::BCType::reflect_even, + amrex::BCType::reflect_even, + amrex::BCType::reflect_even + }; + + int norm_vel_bc[] = + { + amrex::BCType::int_dir, + amrex::BCType::ext_dir, + amrex::BCType::foextrap, + amrex::BCType::reflect_odd, + amrex::BCType::reflect_odd, + amrex::BCType::reflect_odd + }; + + int tang_vel_bc[] = + { + amrex::BCType::int_dir, + amrex::BCType::ext_dir, + amrex::BCType::foextrap, + amrex::BCType::reflect_even, + amrex::BCType::reflect_even, + amrex::BCType::reflect_even + }; #ifdef MHD -static int mag_field_bc[] = -{ - amrex::BCType::int_dir, amrex::BCType::ext_dir, amrex::BCType::foextrap, amrex::BCType::reflect_even, amrex::BCType::foextrap, amrex::BCType::hoextrap -}; + int mag_field_bc[] = + { + amrex::BCType::int_dir, + amrex::BCType::ext_dir, + amrex::BCType::foextrap, + amrex::BCType::reflect_even, + amrex::BCType::foextrap, + amrex::BCType::hoextrap + }; #endif -static -void -set_scalar_bc (BCRec& bc, const BCRec& phys_bc) -{ - const int* lo_bc = phys_bc.lo(); - const int* hi_bc = phys_bc.hi(); - for (int i = 0; i < AMREX_SPACEDIM; i++) + void + set_scalar_bc (BCRec& bc, const BCRec& phys_bc) { - bc.setLo(i,scalar_bc[lo_bc[i]]); - bc.setHi(i,scalar_bc[hi_bc[i]]); + const int* lo_bc = phys_bc.lo(); + const int* hi_bc = phys_bc.hi(); + for (int i = 0; i < AMREX_SPACEDIM; i++) + { + bc.setLo(i,scalar_bc[lo_bc[i]]); + bc.setHi(i,scalar_bc[hi_bc[i]]); + } } -} -static -void -set_x_vel_bc(BCRec& bc, const BCRec& phys_bc) -{ - const int* lo_bc = phys_bc.lo(); - const int* hi_bc = phys_bc.hi(); - bc.setLo(0,norm_vel_bc[lo_bc[0]]); - bc.setHi(0,norm_vel_bc[hi_bc[0]]); + void + set_x_vel_bc(BCRec& bc, const BCRec& phys_bc) + { + const int* lo_bc = phys_bc.lo(); + const int* hi_bc = phys_bc.hi(); + bc.setLo(0,norm_vel_bc[lo_bc[0]]); + bc.setHi(0,norm_vel_bc[hi_bc[0]]); #if (AMREX_SPACEDIM >= 2) - bc.setLo(1,tang_vel_bc[lo_bc[1]]); - bc.setHi(1,tang_vel_bc[hi_bc[1]]); + bc.setLo(1,tang_vel_bc[lo_bc[1]]); + bc.setHi(1,tang_vel_bc[hi_bc[1]]); #endif #if (AMREX_SPACEDIM == 3) - bc.setLo(2,tang_vel_bc[lo_bc[2]]); - bc.setHi(2,tang_vel_bc[hi_bc[2]]); + bc.setLo(2,tang_vel_bc[lo_bc[2]]); + bc.setHi(2,tang_vel_bc[hi_bc[2]]); #endif -} + } -static -void -set_y_vel_bc(BCRec& bc, const BCRec& phys_bc) -{ - const int* lo_bc = phys_bc.lo(); - const int* hi_bc = phys_bc.hi(); - bc.setLo(0,tang_vel_bc[lo_bc[0]]); - bc.setHi(0,tang_vel_bc[hi_bc[0]]); + void + set_y_vel_bc(BCRec& bc, const BCRec& phys_bc) + { + const int* lo_bc = phys_bc.lo(); + const int* hi_bc = phys_bc.hi(); + bc.setLo(0,tang_vel_bc[lo_bc[0]]); + bc.setHi(0,tang_vel_bc[hi_bc[0]]); #if (AMREX_SPACEDIM >= 2) - bc.setLo(1,norm_vel_bc[lo_bc[1]]); - bc.setHi(1,norm_vel_bc[hi_bc[1]]); + bc.setLo(1,norm_vel_bc[lo_bc[1]]); + bc.setHi(1,norm_vel_bc[hi_bc[1]]); #endif #if (AMREX_SPACEDIM == 3) - bc.setLo(2,tang_vel_bc[lo_bc[2]]); - bc.setHi(2,tang_vel_bc[hi_bc[2]]); + bc.setLo(2,tang_vel_bc[lo_bc[2]]); + bc.setHi(2,tang_vel_bc[hi_bc[2]]); #endif -} + } -static -void -set_z_vel_bc(BCRec& bc, const BCRec& phys_bc) -{ - const int* lo_bc = phys_bc.lo(); - const int* hi_bc = phys_bc.hi(); - bc.setLo(0,tang_vel_bc[lo_bc[0]]); - bc.setHi(0,tang_vel_bc[hi_bc[0]]); + void + set_z_vel_bc(BCRec& bc, const BCRec& phys_bc) + { + const int* lo_bc = phys_bc.lo(); + const int* hi_bc = phys_bc.hi(); + bc.setLo(0,tang_vel_bc[lo_bc[0]]); + bc.setHi(0,tang_vel_bc[hi_bc[0]]); #if (AMREX_SPACEDIM >= 2) - bc.setLo(1,tang_vel_bc[lo_bc[1]]); - bc.setHi(1,tang_vel_bc[hi_bc[1]]); + bc.setLo(1,tang_vel_bc[lo_bc[1]]); + bc.setHi(1,tang_vel_bc[hi_bc[1]]); #endif #if (AMREX_SPACEDIM == 3) - bc.setLo(2,norm_vel_bc[lo_bc[2]]); - bc.setHi(2,norm_vel_bc[hi_bc[2]]); + bc.setLo(2,norm_vel_bc[lo_bc[2]]); + bc.setHi(2,norm_vel_bc[hi_bc[2]]); #endif -} - + } #ifdef MHD -static -void -set_mag_field_bc(BCRec& bc, const BCRec& phys_bc) -{ - const int* lo_bc = phys_bc.lo(); - const int* hi_bc = phys_bc.hi(); - for (int i = 0; i < AMREX_SPACEDIM; i++) + void + set_mag_field_bc(BCRec& bc, const BCRec& phys_bc) { - bc.setLo(i, mag_field_bc[lo_bc[i]]); - bc.setHi(i, mag_field_bc[hi_bc[i]]); + const int* lo_bc = phys_bc.lo(); + const int* hi_bc = phys_bc.hi(); + for (int i = 0; i < AMREX_SPACEDIM; i++) + { + bc.setLo(i, mag_field_bc[lo_bc[i]]); + bc.setHi(i, mag_field_bc[hi_bc[i]]); + } } -} #endif -// In some cases we want to replace inflow boundaries with -// first-order extrapolation boundaries. This is intended to -// be used for state data that the user is not going to -// provide inflow boundary conditions for, like gravity -// and reactions, and it works in conjunction with the -// generic_fill boundary routine. + // In some cases we want to replace inflow boundaries with + // first-order extrapolation boundaries. This is intended to + // be used for state data that the user is not going to + // provide inflow boundary conditions for, like gravity + // and reactions, and it works in conjunction with the + // generic_fill boundary routine. -static -void -replace_inflow_bc (BCRec& bc) -{ - for (int dir = 0; dir < AMREX_SPACEDIM; ++dir) { - if (bc.lo(dir) == amrex::BCType::ext_dir) { - bc.setLo(dir, amrex::BCType::foextrap); - } - if (bc.hi(dir) == amrex::BCType::ext_dir) { - bc.setHi(dir, amrex::BCType::foextrap); + void + replace_inflow_bc (BCRec& bc) + { + for (int dir = 0; dir < AMREX_SPACEDIM; ++dir) { + if (bc.lo(dir) == amrex::BCType::ext_dir) { + bc.setLo(dir, amrex::BCType::foextrap); + } + if (bc.hi(dir) == amrex::BCType::ext_dir) { + bc.setHi(dir, amrex::BCType::foextrap); + } } } } diff --git a/Source/driver/Make.package b/Source/driver/Make.package index c4ca1e4313..85febd5698 100644 --- a/Source/driver/Make.package +++ b/Source/driver/Make.package @@ -1,7 +1,7 @@ # these are the files that should be needed for any Castro build CEXE_sources += Castro.cpp -CEXE_sources += runparams_defaults.cpp +CEXE_sources += runtime_params.cpp CEXE_sources += Castro_advance.cpp CEXE_sources += Castro_advance_ctu.cpp ifeq ($(USE_TRUE_SDC), TRUE) diff --git a/Source/driver/castro_limits.H b/Source/driver/castro_limits.H index 0111b43432..31ddeb93a9 100644 --- a/Source/driver/castro_limits.H +++ b/Source/driver/castro_limits.H @@ -1,6 +1,6 @@ #ifndef CASTRO_LIMITS_H #define CASTRO_LIMITS_H -#define MAX_LEV 15 +constexpr int MAX_LEV{15}; #endif diff --git a/Source/driver/parse_castro_params.py b/Source/driver/parse_castro_params.py index aedeea6624..89f91a8ea7 100755 --- a/Source/driver/parse_castro_params.py +++ b/Source/driver/parse_castro_params.py @@ -1,9 +1,9 @@ #!/usr/bin/env python3 -""" -This script parses the list of C++ runtime parameters and writes the -necessary header files and Fortran routines to make them available -in Castro's C++ routines. +"""This script parses the list of C++ runtime parameters and writes +the necessary header and source files to make them available in +Castro's C++ routines. They are available in 2 ways: as global +parameter and in the form of a single struct. parameters have the format: @@ -41,9 +41,6 @@ -- name_params.H (for castro, included in Castro.H): sets up the namespace and extern parameters - -- name_declares.H (for castro, included in Castro.cpp): - declares the runtime parameters - -- name_queries.H (for castro, included in Castro.cpp): does the parmparse query to override the default in C++ @@ -51,6 +48,9 @@ this tests the current value against the default and outputs into a file + -- runtime_params.cpp + has the actual definition of the variables (without extern) + """ import argparse @@ -129,12 +129,12 @@ def read_param_file(infile): return params -def write_headers(params, out_directory, struct_name): +def write_headers_and_source(params, out_directory, struct_name): # output # find all the namespaces - namespaces = {q.namespace for q in params} + namespaces = sorted({q.namespace for q in params}) for nm in namespaces: @@ -142,32 +142,6 @@ def write_headers(params, out_directory, struct_name): # sort by repr since None may be present ifdefs = sorted({q.ifdef for q in params_nm}, key=repr) - # write name_declares.H - try: - cd = open(f"{out_directory}/{nm}_declares.H", "w", encoding="UTF-8") - except OSError: - sys.exit(f"unable to open {nm}_declares.H for writing") - - cd.write(CWARNING) - cd.write(f"#ifndef {nm.upper()}_DECLARES_H\n") - cd.write(f"#define {nm.upper()}_DECLARES_H\n") - - cd.write("\n") - cd.write(f"namespace {nm} {{\n") - - for ifdef in ifdefs: - if ifdef is None: - for p in [q for q in params_nm if q.ifdef is None]: - cd.write(p.get_declare_string()) - else: - cd.write(f"#ifdef {ifdef}\n") - for p in [q for q in params_nm if q.ifdef == ifdef]: - cd.write(p.get_declare_string()) - cd.write("#endif\n") - cd.write("}\n\n") - cd.write("#endif\n") - cd.close() - # write name_params.H try: cp = open(f"{out_directory}/{nm}_params.H", "w", encoding="UTF-8") @@ -238,7 +212,44 @@ def write_headers(params, out_directory, struct_name): jo.close() + # write a single C++ source file that actually defines the parameters + # (one file for all namespaces) + try: + pf = open(f"{out_directory}/runtime_params.cpp", "w", encoding="UTF-8") + except OSError: + sys.exit(f"unable to open runtime_params.cpp") + + pf.write("#include \n") + pf.write("#include \n") + pf.write("#include \n\n") + + for nm in namespaces: + pf.write(f"#include <{nm}_params.H>\n") + pf.write("\n") + + for nm in namespaces: + params_nm = [q for q in params if q.namespace == nm] + # sort by repr since None may be present + ifdefs = sorted({q.ifdef for q in params_nm}, key=repr) + + pf.write(f"namespace {nm} {{\n") + + for ifdef in ifdefs: + if ifdef is None: + for p in [q for q in params_nm if q.ifdef is None]: + pf.write(p.get_declare_string()) + else: + pf.write(f"#ifdef {ifdef}\n") + for p in [q for q in params_nm if q.ifdef == ifdef]: + pf.write(p.get_declare_string()) + pf.write("#endif\n") + pf.write("}\n\n") + + pf.close() + # now write a single file that contains all of the parameter structs + # to minimize padding, we want to sort on type + try: sf = open(f"{out_directory}/{struct_name}_type.H", "w", encoding="UTF-8") except OSError: @@ -255,20 +266,25 @@ def write_headers(params, out_directory, struct_name): params_nm = [q for q in params if q.namespace == nm] # sort by repr since None may be present ifdefs = sorted({q.ifdef for q in params_nm}, key=repr) - sf.write(f"struct {nm}_t {{\n") print("namespace = ", nm) for ifdef in ifdefs: + params_if = [q for q in params_nm if q.ifdef == ifdef] + types = sorted(set(q.dtype for q in params_if)) + if ifdef is None: - for p in [q for q in params_nm if q.ifdef is None]: - sf.write(p.get_struct_entry()) + for tt in types: + params_type = [q for q in params_if if q.dtype == tt] + for p in params_type: + sf.write(p.get_struct_entry()) else: sf.write(f"#ifdef {ifdef}\n") - for p in [q for q in params_nm if q.ifdef == ifdef]: - sf.write(p.get_struct_entry()) + for tt in types: + params_type = [q for q in params_if if q.dtype == tt] + for p in params_type: + sf.write(p.get_struct_entry()) sf.write("#endif\n") - sf.write("};\n\n") # now the parent struct @@ -295,7 +311,7 @@ def main(): args = parser.parse_args() p = read_param_file(args.input_file[0]) - write_headers(p, args.o, args.s) + write_headers_and_source(p, args.o, args.s) if __name__ == "__main__": main() diff --git a/Source/driver/runparams_defaults.cpp b/Source/driver/runparams_defaults.cpp deleted file mode 100644 index c9f5ed1de6..0000000000 --- a/Source/driver/runparams_defaults.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include - -#include - -#include - diff --git a/Source/driver/sum_integrated_quantities.cpp b/Source/driver/sum_integrated_quantities.cpp index 1a38867a05..a92c65d885 100644 --- a/Source/driver/sum_integrated_quantities.cpp +++ b/Source/driver/sum_integrated_quantities.cpp @@ -511,10 +511,7 @@ Castro::sum_integrated_quantities () log << std::setw(intwidth) << timestep; - if (time == 0.0_rt) { - log << std::fixed; - } - else if (time < 1.e-4_rt || time > 1.e4_rt) { + if (time < 1.e-4_rt || time > 1.e4_rt) { log << std::scientific; } else { diff --git a/Source/gravity/Castro_gravity.cpp b/Source/gravity/Castro_gravity.cpp index ed8a2406e0..bf9dc4f6b7 100644 --- a/Source/gravity/Castro_gravity.cpp +++ b/Source/gravity/Castro_gravity.cpp @@ -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 diff --git a/Source/gravity/Gravity.H b/Source/gravity/Gravity.H index af7ff177fa..0f6aba88ac 100644 --- a/Source/gravity/Gravity.H +++ b/Source/gravity/Gravity.H @@ -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 @@ -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& comp_gphi, - amrex::MultiFab& cml_phi, - amrex::Vector >& cml_gphi); + amrex::MultiFab& comp_minus_level_phi, + amrex::Vector >& comp_minus_level_grad_phi); /// @@ -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 @@ -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 @@ -383,7 +383,7 @@ public: /// /// Initialize multipole gravity /// - void init_multipole_grav(); + void init_multipole_grav() const; #if (AMREX_SPACEDIM == 3) @@ -480,7 +480,7 @@ public: /// @param Rhs MultiFab /// @param coeffs Vector of MultiFabs /// - void applyMetricTerms(int level,amrex::MultiFab& Rhs, const amrex::Vector& coeffs); + void applyMetricTerms(int level,amrex::MultiFab& Rhs, const amrex::Vector& coeffs) const; /// /// @@ -488,7 +488,7 @@ public: /// @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; /// /// @@ -496,7 +496,7 @@ public: /// @param level Index of level /// @param edges Edge-based data /// - void unweight_edges(int level, const amrex::Vector& edges); + void unweight_edges(int level, const amrex::Vector& edges) const; #endif /// @@ -504,7 +504,7 @@ public: /// @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 @@ -546,7 +546,7 @@ public: const amrex::Vector >& grad_phi, const amrex::Vector& res, const amrex::MultiFab* const crse_bcdata, - amrex::Real rel_eps, amrex::Real abs_eps); + amrex::Real rel_eps, amrex::Real abs_eps) const; /// diff --git a/Source/gravity/Gravity.cpp b/Source/gravity/Gravity.cpp index 606562c843..02c02c0ea0 100644 --- a/Source/gravity/Gravity.cpp +++ b/Source/gravity/Gravity.cpp @@ -1318,7 +1318,7 @@ Gravity::test_composite_phi (int crse_level) } void -Gravity::interpolate_monopole_grav(int level, RealVector& radial_grav, MultiFab& grav_vector) +Gravity::interpolate_monopole_grav(int level, RealVector& radial_grav, MultiFab& grav_vector) const { BL_PROFILE("Gravity::interpolate_monopole_grav()"); @@ -1434,7 +1434,7 @@ Gravity::compute_radial_mass(const Box& bx, #ifdef GR_GRAV RealVector& radial_pres_local, #endif - int n1d, int level) + int n1d, int level) const { const Geometry& geom = parent->Geom(level); @@ -1599,7 +1599,7 @@ Gravity::compute_radial_mass(const Box& bx, } void -Gravity::init_multipole_grav() +Gravity::init_multipole_grav() const { if (gravity::lnum < 0) { amrex::Abort("lnum negative"); @@ -1691,7 +1691,7 @@ Gravity::init_multipole_grav() multipole::parity_q0(l) = 1.0_rt; if (l % 2 != 0) { - if (AMREX_SPACEDIM == 3 && (multipole::doReflectionLo(2) || multipole::doReflectionHi(2))) { + if (AMREX_SPACEDIM == 3 && (multipole::doReflectionLo(2) || multipole::doReflectionHi(2))) { // NOLINT(bugprone-branch-clone) multipole::parity_q0(l) = 0.0_rt; } else if (AMREX_SPACEDIM == 2 && parent->Geom(0).Coord() == 1) { @@ -1725,7 +1725,7 @@ Gravity::init_multipole_grav() if (AMREX_SPACEDIM == 3) { multipole::parity_qC_qS(l,m) = 1.0_rt; } - else if (AMREX_SPACEDIM == 2 && parent->Geom(0).Coord() == 1) { + else if (AMREX_SPACEDIM == 2 && parent->Geom(0).Coord() == 1) { // NOLINT(bugprone-branch-clone) multipole::parity_qC_qS(l,m) = 0.0_rt; } else if (AMREX_SPACEDIM == 1 && parent->Geom(0).Coord() == 2) { @@ -2847,7 +2847,7 @@ Gravity::fill_direct_sum_BCs(int crse_level, int fine_level, const Vector& coeffs) +Gravity::applyMetricTerms(int level, MultiFab& Rhs, const Vector& coeffs) const { BL_PROFILE("Gravity::applyMetricTerms()"); @@ -2877,7 +2877,7 @@ Gravity::applyMetricTerms(int level, MultiFab& Rhs, const Vector& coe } void -Gravity::unweight_cc(int level, MultiFab& cc) +Gravity::unweight_cc(int level, MultiFab& cc) const { BL_PROFILE("Gravity::unweight_cc()"); @@ -2896,7 +2896,7 @@ Gravity::unweight_cc(int level, MultiFab& cc) } void -Gravity::unweight_edges(int level, const Vector& edges) +Gravity::unweight_edges(int level, const Vector& edges) const { BL_PROFILE("Gravity::unweight_edges()"); @@ -2949,7 +2949,7 @@ Gravity::make_mg_bc () } void -Gravity::set_mass_offset (Real time, bool multi_level) +Gravity::set_mass_offset (Real time, bool multi_level) const { BL_PROFILE("Gravity::set_mass_offset()"); @@ -2999,7 +2999,7 @@ Gravity::set_mass_offset (Real time, bool multi_level) } void -Gravity::add_pointmass_to_gravity (int level, MultiFab& phi, MultiFab& grav_vector) +Gravity::add_pointmass_to_gravity (int level, MultiFab& phi, MultiFab& grav_vector) const { BL_PROFILE("Gravity::add_pointmass_to_gravity()"); @@ -3094,8 +3094,7 @@ Gravity::make_radial_gravity(int level, Real time, RealVector& radial_grav) // Create MultiFab with NUM_STATE components and no ghost cells MultiFab S(grids[lev],dmap[lev],NUM_STATE,0); - if ( eps == 0.0 ) - { + if ( eps == 0.0 ) { // NOLINT(bugprone-branch-clone,-warnings-as-errors) // Old and new time are identical; this should only happen if // dt is smaller than roundoff compared to the current time, // in which case we're probably in trouble anyway, @@ -3713,7 +3712,7 @@ Gravity::actual_solve_with_mlmg (int crse_level, int fine_level, const amrex::Vector >& grad_phi, const amrex::Vector& res, const amrex::MultiFab* const crse_bcdata, - amrex::Real rel_eps, amrex::Real abs_eps) + amrex::Real rel_eps, amrex::Real abs_eps) const { BL_PROFILE("Gravity::actual_solve_with_mlmg()"); diff --git a/Source/gravity/Make.package b/Source/gravity/Make.package index f94894307f..6708aab63d 100644 --- a/Source/gravity/Make.package +++ b/Source/gravity/Make.package @@ -2,7 +2,6 @@ # this is included if USE_GRAV = TRUE CEXE_sources += Gravity.cpp -CEXE_sources += gravity_params.cpp CEXE_headers += Gravity.H CEXE_headers += Gravity_util.H CEXE_headers += Castro_gravity.H diff --git a/Source/gravity/gravity_params.cpp b/Source/gravity/gravity_params.cpp deleted file mode 100644 index c80baeadc7..0000000000 --- a/Source/gravity/gravity_params.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include - -#include - -#include - -#include - - diff --git a/Source/hydro/Castro_ctu_hydro.cpp b/Source/hydro/Castro_ctu_hydro.cpp index c1a29ae0c2..0ad62f029b 100644 --- a/Source/hydro/Castro_ctu_hydro.cpp +++ b/Source/hydro/Castro_ctu_hydro.cpp @@ -14,8 +14,11 @@ using namespace amrex; advance_status -Castro::construct_ctu_hydro_source(Real time, Real dt) +Castro::construct_ctu_hydro_source(Real time, Real dt) // NOLINT(readability-convert-member-functions-to-static) { + amrex::ignore_unused(time); + amrex::ignore_unused(dt); + advance_status status {}; if (!do_hydro) { diff --git a/Source/hydro/Castro_mol.cpp b/Source/hydro/Castro_mol.cpp index 23a004c719..eb6314769c 100644 --- a/Source/hydro/Castro_mol.cpp +++ b/Source/hydro/Castro_mol.cpp @@ -199,7 +199,7 @@ Castro::mol_ppm_reconstruct(const Box& bx, void -Castro::mol_consup(const Box& bx, +Castro::mol_consup(const Box& bx, // NOLINT(readability-convert-member-functions-to-static) #ifdef SHOCK_VAR Array4 const& shk, #endif diff --git a/Source/hydro/Castro_mol_hydro.cpp b/Source/hydro/Castro_mol_hydro.cpp index 4d7e0f32db..fbcc8c6171 100644 --- a/Source/hydro/Castro_mol_hydro.cpp +++ b/Source/hydro/Castro_mol_hydro.cpp @@ -21,6 +21,8 @@ void Castro::construct_mol_hydro_source(Real time, Real dt, MultiFab& A_update) { + amrex::ignore_unused(time); + #ifdef RADIATION amrex::Abort("Error: radiation not supported for the MOL hydro source term"); #else @@ -648,6 +650,8 @@ Castro::construct_mol_hydro_source(Real time, Real dt, MultiFab& A_update) } Array4 pradial_fab = pradial.array(); +#endif +#if AMREX_SPACEDIM == 1 Array4 const qex_arr = qe[0].array(); #endif diff --git a/Source/hydro/advection_util.H b/Source/hydro/advection_util.H index 1669869dc4..cde9eaaba6 100644 --- a/Source/hydro/advection_util.H +++ b/Source/hydro/advection_util.H @@ -23,6 +23,9 @@ void src_to_prim(int i, int j, int k, const Real dt, #endif Array4 const& srcQ) { + + amrex::ignore_unused(dt); + for (int n = 0; n < NQSRC; ++n) { srcQ(i,j,k,n) = 0.0_rt; } diff --git a/Source/hydro/trans.cpp b/Source/hydro/trans.cpp index 9c85de9df1..acbc4947df 100644 --- a/Source/hydro/trans.cpp +++ b/Source/hydro/trans.cpp @@ -64,7 +64,7 @@ Castro::trans_single(const Box& bx, void -Castro::actual_trans_single(const Box& bx, +Castro::actual_trans_single(const Box& bx, // NOLINT(readability-convert-member-functions-to-static) int idir_t, int idir_n, int d, Array4 const& q_arr, Array4 const& qo_arr, @@ -521,7 +521,7 @@ Castro::trans_final(const Box& bx, void -Castro::actual_trans_final(const Box& bx, +Castro::actual_trans_final(const Box& bx, // NOLINT(readability-convert-member-functions-to-static) int idir_n, int idir_t1, int idir_t2, int d, Array4 const& q_arr, Array4 const& qo_arr, diff --git a/Source/mhd/Castro_mhd.H b/Source/mhd/Castro_mhd.H index 3451fefe37..a15a323207 100644 --- a/Source/mhd/Castro_mhd.H +++ b/Source/mhd/Castro_mhd.H @@ -31,7 +31,7 @@ void consup_mhd(const amrex::Box& bx, const Real dt, - amrex::Array4 const& update, + amrex::Array4 const& U_new, amrex::Array4 const& flux0, amrex::Array4 const& flux1, amrex::Array4 const& flux2); diff --git a/Source/mhd/mhd_util.H b/Source/mhd/mhd_util.H index 7b7cce3eba..7f9097e4f5 100644 --- a/Source/mhd/mhd_util.H +++ b/Source/mhd/mhd_util.H @@ -23,7 +23,7 @@ eos_soundspeed_mhd(Real& c, Real as, Real ca, Real bd) { AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void -qflux(Real* qflx, Real* flx, Real* q_zone) { +qflux(Real* qflx, const Real* flx, const Real* q_zone) { // Calculate the C to P Jacobian applied to the fluxes @@ -78,7 +78,7 @@ qflux(Real* qflx, Real* flx, Real* q_zone) { AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void -electric(Real* q_zone, Real& E_zone, const int comp) { +electric(const Real* q_zone, Real& E_zone, const int comp) { // this takes the cell-center primitive state, q_zone, and computes the cell-center // electric field, E_zone, using Faraday's law: @@ -99,7 +99,7 @@ electric(Real* q_zone, Real& E_zone, const int comp) { AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void -ConsToPrim(Real* q_zone, Real* U_zone) { +ConsToPrim(Real* q_zone, const Real* U_zone) { // calculate the primitive variables from the conserved // U has NUM_STATE+3 components diff --git a/Source/radiation/Make.package b/Source/radiation/Make.package index 5a0023f4da..dfaa525b1b 100644 --- a/Source/radiation/Make.package +++ b/Source/radiation/Make.package @@ -5,7 +5,6 @@ CEXE_sources += HypreExtMultiABec.cpp CEXE_sources += HypreMultiABec.cpp CEXE_sources += HypreABec.cpp CEXE_sources += Radiation.cpp -CEXE_sources += radiation_params.cpp CEXE_sources += RadSolve.cpp CEXE_sources += RadBndry.cpp CEXE_sources += RadMultiGroup.cpp diff --git a/Source/radiation/radiation_params.cpp b/Source/radiation/radiation_params.cpp deleted file mode 100644 index 5c10888946..0000000000 --- a/Source/radiation/radiation_params.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include - -#include - -#include - -#include - -#include diff --git a/Source/reactions/Castro_react.cpp b/Source/reactions/Castro_react.cpp index bc070c7359..3e6ff3949b 100644 --- a/Source/reactions/Castro_react.cpp +++ b/Source/reactions/Castro_react.cpp @@ -12,8 +12,8 @@ using namespace amrex; #ifndef TRUE_SDC advance_status -Castro::do_old_reactions (Real time, Real dt) -{ +Castro::do_old_reactions (Real time, Real dt) { // NOLINT(readability-convert-member-functions-to-static) + amrex::ignore_unused(time); amrex::ignore_unused(dt); diff --git a/Source/sources/Castro_sources.cpp b/Source/sources/Castro_sources.cpp index f99aac52dc..67d736a6d7 100644 --- a/Source/sources/Castro_sources.cpp +++ b/Source/sources/Castro_sources.cpp @@ -522,7 +522,7 @@ Castro::print_all_source_changes(Real dt, bool is_new) // and the hydro advance. advance_status -Castro::pre_advance_operators (Real time, Real dt) +Castro::pre_advance_operators (Real time, Real dt) // NOLINT(readability-convert-member-functions-to-static) { amrex::ignore_unused(time); amrex::ignore_unused(dt); @@ -560,7 +560,7 @@ Castro::pre_advance_operators (Real time, Real dt) // but before the hydro advance. advance_status -Castro::pre_hydro_operators (Real time, Real dt) +Castro::pre_hydro_operators (Real time, Real dt) // NOLINT(readability-convert-member-functions-to-static) { amrex::ignore_unused(time); amrex::ignore_unused(dt); @@ -585,7 +585,7 @@ Castro::pre_hydro_operators (Real time, Real dt) // but before the corrector sources. advance_status -Castro::post_hydro_operators (Real time, Real dt) +Castro::post_hydro_operators (Real time, Real dt) // NOLINT(readability-convert-member-functions-to-static) { amrex::ignore_unused(time); amrex::ignore_unused(dt); @@ -602,8 +602,11 @@ Castro::post_hydro_operators (Real time, Real dt) // Perform all operations that occur after the corrector sources. advance_status -Castro::post_advance_operators (Real time, Real dt) +Castro::post_advance_operators (Real time, Real dt) // NOLINT(readability-convert-member-functions-to-static) { + amrex::ignore_unused(time); + amrex::ignore_unused(dt); + advance_status status {}; #ifndef TRUE_SDC diff --git a/Util/scripts/write_probdata.py b/Util/scripts/write_probdata.py index 68cb716aac..2cd7cdd398 100755 --- a/Util/scripts/write_probdata.py +++ b/Util/scripts/write_probdata.py @@ -237,8 +237,8 @@ def write_probin(prob_param_files, cxx_prefix): size = p.size if (size == "nspec"): size = "NumSpec" - fout.write(f" for (int n = 0; n < {size}; n++) {{\n") - fout.write(f" problem::{p.name}[n] = {p.default_format(lang='C++')};\n") + fout.write(f" for (auto & e : problem::{p.name}) {{\n") + fout.write(f" e = {p.default_format(lang='C++')};\n") fout.write(f" }}\n") else: fout.write(f" {p.get_default_string()}") diff --git a/external/Microphysics b/external/Microphysics index 02d46a67cf..dfc746f5f3 160000 --- a/external/Microphysics +++ b/external/Microphysics @@ -1 +1 @@ -Subproject commit 02d46a67cf5852509cc35db7850e5f87da495679 +Subproject commit dfc746f5f35ab0e9a32025ca325f83232826f420 diff --git a/external/amrex b/external/amrex index d737886d57..bb7d5cfbfd 160000 --- a/external/amrex +++ b/external/amrex @@ -1 +1 @@ -Subproject commit d737886d574d4f1c0cf76323337b666ecd5bb4e0 +Subproject commit bb7d5cfbfd503f2f014746c32a9646a6ef6dcc5b