Skip to content

Commit

Permalink
Merge branch 'development' into ppm_source_tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale authored Nov 8, 2023
2 parents 7b0343c + 640a831 commit 01f092c
Show file tree
Hide file tree
Showing 402 changed files with 43,286 additions and 29,372 deletions.
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ Checks: >
mpi-*,
openmp-*
HeaderFilterRegex: '(/Source/*/|/Util/model_parser_cxx|^\./|^tmp_build_dir/castro_sources/*/).*\.H$'
HeaderFilterRegex: '(/Source/*/|/Util/model_parser|^\./|^tmp_build_dir/castro_sources/*/).*\.H$'
2 changes: 1 addition & 1 deletion .github/workflows/c-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
python3 external/cpp-linter-action/run_on_changed_files.py ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} \
-ignore-files="amrex|Microphysics" \
-config-file="${GITHUB_WORKSPACE}/.clang-tidy" \
-header-filter='/Source/|/Util/model_parser_cxx|^\./' \
-header-filter='/Source/|/Util/model_parser|^\./' \
-run-linter
- name: Archive clang tidy report
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/check-makefiles.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: check makefiles

on:
push:
branches:
- development
- main
pull_request:
branches:
- development

jobs:
check-ifdefs:
runs-on: ubuntu-latest

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

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Cache pip
uses: actions/cache@v3
with:
# this path is specific to Ubuntu
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Run check-ifdefs
run: |
python .github/workflows/check_makefiles.py
46 changes: 46 additions & 0 deletions .github/workflows/check-params.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: check runtime params

on:
push:
branches:
- development
- main
pull_request:
branches:
- development

jobs:
check-runtime-params:
runs-on: ubuntu-latest

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

- name: Get submodules
run: |
git submodule update --init
cd external/Microphysics
git fetch; git checkout development
cd ../amrex
git fetch; git checkout development
cd ../..
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Cache pip
uses: actions/cache@v3
with:
# this path is specific to Ubuntu
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Run check-params
run: |
PYTHONPATH=external/Microphysics/util/build_scripts python .github/workflows/check_params.py .
46 changes: 46 additions & 0 deletions .github/workflows/check_makefiles.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import re
import sys
from pathlib import Path

correct_params = {
"DEBUG": "FALSE",
"USE_MPI": "TRUE",
"USE_OMP": "FALSE",
"COMP": "gnu",
"USE_CUDA": "FALSE",
"USE_HIP": "FALSE",
"PRECISION": "DOUBLE",
"PROFILE": "FALSE"}


def find_source_files():
p = Path("./Exec")
files = list(p.glob(r"**/GNUmakefile"))
return files

def check_makefile(makefile):

with open(makefile) as mf:
for _line in mf:
if idx := _line.find("#") >= 0:
line = _line[:idx]
else:
line = _line

for key in correct_params:
if key in line:
try:
k, v = re.split(":=|\?=|=", line)
except ValueError:
sys.exit(f"invalid line: {line}")

if not v.strip() == correct_params[key]:
sys.exit(f"invalid param {key} in {makefile}")

if __name__ == "__main__":

for f in find_source_files():
check_makefile(f)



76 changes: 76 additions & 0 deletions .github/workflows/check_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import argparse
import importlib
import os
import re
from pathlib import Path
import sys

# some parameters that are not defined in _cpp_parameters

whitelist = ["castro.lo_bc",
"castro.hi_bc",
"gravity.abs_tol",
"gravity.rel_tol"]

# we don't have all of the radiation parametrs in the _cpp_parameters
# yet, so we won't check these namespaces

namespace_ignore = ["radiation", "radsolve"]

def doit(castro_dir):

castro = Path(os.path.abspath(castro_dir))

# import the module that defines the Castro runtime params
sys.path.append(str(castro / "Source" / "driver/"))
import parse_castro_params

# read in the parameters defined in _cpp_parameters
param_file = castro / "Source" / "driver" / "_cpp_parameters"
params = parse_castro_params.read_param_file(str(param_file))

namespaces = set(p.namespace for p in params)
runtime_parameters = [f"{p.namespace}.{p.name}" for p in params]

pattern = re.compile(r"[A-Za-z0-9_]+\.[A-Za-z0-9_]+", re.IGNORECASE)

# loop over all the inputs files
exec_path = castro / "Exec"
for f in exec_path.glob("**/inputs*"):

if os.path.isdir(f):
continue

# find all the params in each namespace
with open(f) as infile:
print(f"working on {f}")
for line in infile:
# remove comments
idx = line.find("#")
if idx > 0:
line = line[idx:]

found_param = pattern.match(line)
if not found_param:
continue

p = found_param.group(0)
nm = p.split(".")[0]
if nm in namespaces and nm not in namespace_ignore:
if not (p in runtime_parameters or p in whitelist):
sys.exit(f"Error: {p} not valid")


if __name__ == "__main__":

# we need the top-level Castro directory

p = argparse.ArgumentParser()
p.add_argument("castro_dir", type=str, nargs=1,
help="top level Castro directory")

args = p.parse_args()

doit(args.castro_dir[0])


4 changes: 2 additions & 2 deletions .github/workflows/good_defines.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ AMREX_USE_CUDA
AMREX_USE_GPU
AMREX_USE_OMP
AUX_THERMO
AUX_UPDATE
BL_FORT_USE_LOWERCASE
BL_FORT_USE_UNDERSCORE
BL_FORT_USE_UPPERCASE
BL_LANG_FORT
BL_LAZY
BL_USE_SETBUF
CXX_MODEL_PARSER
MODEL_PARSER
DIFFUSION
DO_PROBLEM_POST_INIT
DO_PROBLEM_POST_RESTART
Expand All @@ -34,6 +33,7 @@ NSE_TABLE
RADIATION
RAD_INTERP
REACTIONS
RNG_STATE_INIT
ROTATION
SCREENING
SHOCK_VAR
Expand Down
55 changes: 54 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,56 @@
# 23.11

* Problem GNUmakefiles have been standardized and now allow for the
problem to be compiled elsewhere (#2640, #2641, #2642, #2643)

* The true-SDC Newton solver has been made more robust and faster
(#2586, #2602, #2605, #2606)

* Several problems that required the initial model grid spacing to
be specified in the inputs file now automatically compute it as
needed, including `flame_wave` (#2610), `convective_flame`,
`bubble_convergence`, and `hse_convergence` (#2624), `double_bubble`,
`gamma_law_bubble`, and `hse_convergence_general` (#2612)

* Outflow boundary conditions for the 4th order solver have been changed
to no longer use the one-sided stencil (#2607)

* The ca_rad_source hook in Fortran has been removed. The existing
problem_rad_source() hook in C++ can be used instead. (#2626)

* The compile option USE_AUX_UPDATE has been removed. If you want to
manually update the auxiliary parameters, you can use an external
source term or you can use the problem post-timestep hook. (#2614)

* The pressure is now always included in the x-momentum flux in 1-d
Cartesian, and this fixes an issue at jumps in refinement with the
pressure gradient (#2468)

* A bug was fixed in the 4th order diffusion operator that was introduced
when it was originally converted to C++ (#2592)

* The 2nd order Radau integrator had the wrong quadrature weights
(#2594)

# 23.10

* True-SDC no longer evolves density as part of the reaction system
and now uses the same ODE code path as simplified-SDC. This means
we don't need our own custom VODE righthand side functions (#2559,
#2560, #2567, #2578, #2580, #2584)

* The true SDC runtime parameter `sdc_solve_for_rhoe` has been
removed. (#2572)

* The true SDC runtime parameters `sdc_solver_tol_spec`,
`sdc_solver_tol_ener`, `sdc_solver_atol` have been removed.
Instead the Microphysics integration tolerance parameters should
be used. (#2571)

* The true SDC runtime parameter `sdc_newton_use_analytic_jac` has
been removed. Instead the Microphysics integrator `jacobian`
parameter should be used (#2573)

# 23.08

* Time evolution without subcycling on the fine levels, which is enabled via
Expand Down Expand Up @@ -29,7 +82,7 @@
# 23.06

* The job_info file now reports the integrator used (#2463)

* 1-d cylindrical geometry was fixed (#2465, #2470)

# 23.05
Expand Down
2 changes: 1 addition & 1 deletion Diagnostics/DustCollapse/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Bpack := ./Make.package
Blocs := .
# EXTERN_SEARCH = .

CASTRO_HOME := ../..
CASTRO_HOME ?= ../..

INCLUDE_LOCATIONS += $(AMREX_HOME)/Src/Extern/amrdata
include $(AMREX_HOME)/Src/Extern/amrdata/Make.package
Expand Down
2 changes: 1 addition & 1 deletion Diagnostics/Radiation/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Bpack := ./Make.package
Blocs := .
# EXTERN_SEARCH = .

CASTRO_HOME := ../..
CASTRO_HOME ?= ../..

INCLUDE_LOCATIONS += $(AMREX_HOME)/Src/Extern/amrdata
include $(AMREX_HOME)/Src/Extern/amrdata/Make.package
Expand Down
2 changes: 1 addition & 1 deletion Diagnostics/Sedov/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Bpack := ./Make.package
Blocs := .
# EXTERN_SEARCH = .

CASTRO_HOME := ../..
CASTRO_HOME ?= ../..

#INCLUDE_LOCATIONS += $(AMREX_HOME)/Src/Extern/amrdata
#include $(AMREX_HOME)/Src/Extern/amrdata/Make.package
Expand Down
5 changes: 3 additions & 2 deletions Diagnostics/Sedov/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ std::pair<Real, Real> get_coord_info(const Array<Real, AMREX_SPACEDIM>& p,
AMREX_ASSERT(coord == 2);

r_zone = p[0] - center[0];
Real r_r = problo[0]+static_cast<Real>(i+1)*dx_level[0];
Real r_l = problo[0]+static_cast<Real>(i)*dx_level[0];

Real r_r = p[0] + 0.5_rt * dx_level[0];
Real r_l = p[0] - 0.5_rt * dx_level[0];
vol = (4.0_rt/3.0_rt) * M_PI * dx_level[0] *
(r_r*r_r + r_l*r_r + r_l*r_l);

Expand Down
4 changes: 3 additions & 1 deletion Docs/source/AMR.rst
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ fine cell data above it.)

The synchronization consists of two parts:

.. index:: castro.do_reflux

- Step 1: Hyperbolic reflux

In the hyperbolic reflux step, we update the conserved variables with
Expand All @@ -159,7 +161,7 @@ The synchronization consists of two parts:
where :math:`V` is the volume of the cell and the correction from
:math:`\delta\Fb` is supported only on coarse cells adjacent to fine grids.

Note: this can be enabled/disabled via castro.do_reflux. Generally,
Note: this can be enabled/disabled via ``castro.do_reflux``. Generally,
it should be enabled (1).

Also note that for axisymmetric or 1D spherical coordinates, the
Expand Down
Loading

0 comments on commit 01f092c

Please sign in to comment.