Skip to content

Commit

Permalink
Merge branch 'development' into ppm_T
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale committed Dec 7, 2023
2 parents bcf379b + 6f88282 commit 5ec250b
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 23.12

* The radiation solver port to C++ has been completed (#2638, #2648)

# 23.11

* Problem GNUmakefiles have been standardized and now allow for the
Expand Down
10 changes: 9 additions & 1 deletion Docs/source/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,15 @@ By default, 4 output files are created:

The species masses are given in units of solar masses.

Some problems have custom versions of the diagnostics with additional information.
``Castro/Util/scripts/diag_parser.py`` contains Python code for parsing
these output files into Numpy arrays. Usage instructions are included
in the file, along with an example script at
``Castro/Util/scripts/plot_species.py``. This reads a
``species_diag.out`` file provided on the command line and makes a plot
of the total mass fractions over time.

Some problems have custom versions of the diagnostics with additional
information. These are not currently supported by the Python parser.


.. _sec:parallel_io:
Expand Down
21 changes: 17 additions & 4 deletions Util/scripts/diag_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* copy this file into the same directory as your script
Then you can do `from diag_parser import deduplicate, read_diag_file`.
Then you can do `from diag_parser import read_diag_file`.
"""

from pathlib import Path
Expand Down Expand Up @@ -52,10 +52,15 @@
}


def read_diag_file(file_path):
def read_diag_file(file_path, dedupe=True):
"""Reads a Castro diagnostic file into a numpy structured array.
Currently only supports the default files that Castro generates.
The output can be used directly (the functions in numpy.lib.recfunctions
are helpful for this), or converted into a Pandas dataframe (recommended if
you plan to do any non-trivial processing).
Currently only supports the default files that Castro generates, not any of
the problem-specific ones.
"""
if not isinstance(file_path, Path):
file_path = Path(file_path)
Expand Down Expand Up @@ -84,8 +89,16 @@ def read_diag_file(file_path):
dtypes[7] = int # minimum gpu memory free
# already read the first header line, so we don't need to skip any rows
data = np.genfromtxt(
f, delimiter=widths, comments="#", dtype=dtypes, names=True
f,
delimiter=widths,
comments="#",
dtype=dtypes,
names=True,
deletechars="",
replace_space=None,
)
if dedupe:
data = deduplicate(data)
return data


Expand Down
36 changes: 36 additions & 0 deletions Util/scripts/plot_species.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env python3
import sys

import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
from cycler import cycler
from numpy.lib import recfunctions as rfn

from diag_parser import deduplicate, read_diag_file

data = deduplicate(read_diag_file(sys.argv[1]))

mass_columns = [name for name in rfn.get_names(data.dtype) if name.startswith("Mass ")]

# compute the total mass in the domain
total_mass = rfn.apply_along_fields(np.sum, data[mass_columns])

# cycle through colors then line styles
plt.rcParams["axes.prop_cycle"] = (
cycler(linestyle=["-", "--"]) * mpl.rcParamsDefault["axes.prop_cycle"]
)

plt.figure(figsize=(19.20, 10.80))
for col in mass_columns:
plt.plot(data["TIME"], data[col] / total_mass, label=col.removeprefix("Mass "))
plt.xlabel("Time (s)")
plt.ylabel("Mass fraction")
# plt.xscale("log")
plt.yscale("log")

# put the legend to the right of the plot, not overlapping
plt.legend(loc="center left", bbox_to_anchor=(1, 0.5))

plt.tight_layout()
plt.savefig("massfrac_plot.png")
2 changes: 1 addition & 1 deletion external/Microphysics
Submodule Microphysics updated 114 files
2 changes: 1 addition & 1 deletion external/amrex
Submodule amrex updated 78 files
+2 −1 .github/workflows/ascent.yml
+1 −1 .github/workflows/clang.yml
+1 −1 .github/workflows/gcc.yml
+1 −2 .github/workflows/intel.yml
+44 −3 CHANGES
+4 −5 Docs/sphinx_documentation/source/GPU.rst
+21 −0 Docs/sphinx_documentation/source/InputsComputeBackends.rst
+1 −0 Docs/sphinx_documentation/source/Inputs_Chapter.rst
+4 −4 Src/AmrCore/AMReX_FillPatcher.H
+2 −2 Src/AmrCore/AMReX_InterpFaceRegister.H
+27 −33 Src/Base/AMReX.H
+11 −4 Src/Base/AMReX.cpp
+98 −80 Src/Base/AMReX_Algorithm.H
+24 −22 Src/Base/AMReX_Array4.H
+1 −1 Src/Base/AMReX_BCRec.H
+48 −48 Src/Base/AMReX_BaseFab.H
+6 −6 Src/Base/AMReX_BoxArray.H
+11 −8 Src/Base/AMReX_CArena.H
+94 −2 Src/Base/AMReX_CArena.cpp
+1 −3 Src/Base/AMReX_FArrayBox.H
+64 −65 Src/Base/AMReX_FabArray.H
+6 −0 Src/Base/AMReX_FabArrayBase.H
+1 −1 Src/Base/AMReX_FabArrayUtility.H
+41 −45 Src/Base/AMReX_FabConv.H
+106 −98 Src/Base/AMReX_GpuAtomic.H
+15 −14 Src/Base/AMReX_GpuLaunch.H
+5 −5 Src/Base/AMReX_GpuLaunchFunctsG.H
+29 −0 Src/Base/AMReX_GpuQualifiers.H
+27 −25 Src/Base/AMReX_GpuRange.H
+20 −4 Src/Base/AMReX_GpuUtility.H
+40 −36 Src/Base/AMReX_Math.H
+53 −43 Src/Base/AMReX_MultiFab.H
+28 −16 Src/Base/AMReX_MultiFabUtil.H
+1 −4 Src/Base/AMReX_MultiFabUtil.cpp
+12 −3 Src/Base/AMReX_OpenMP.H
+178 −0 Src/Base/AMReX_OpenMP.cpp
+1 −1 Src/Base/AMReX_PlotFileDataImpl.cpp
+62 −47 Src/Base/AMReX_Random.H
+14 −26 Src/Base/AMReX_Random.cpp
+52 −48 Src/Base/AMReX_TableData.H
+2 −2 Src/Base/AMReX_iMultiFab.H
+1 −0 Src/Base/CMakeLists.txt
+1 −0 Src/Base/Make.package
+8 −20 Src/Base/Parser/AMReX_IParser.H
+10 −25 Src/Base/Parser/AMReX_Parser.H
+2 −2 Src/Base/Parser/AMReX_Parser_Y.H
+6 −7 Src/EB/AMReX_EB2_GeometryShop.H
+1 −1 Src/EB/AMReX_EB_utils.cpp
+2 −3 Src/Extern/Conduit/AMReX_Conduit_Blueprint.H
+136 −71 Src/Extern/Conduit/AMReX_Conduit_Blueprint_ParticlesI.H
+2 −2 Src/Extern/SUNDIALS/AMReX_Sundials.H
+22 −22 Src/Extern/SUNDIALS/AMReX_SundialsIntegrator.H
+1 −1 Src/F_Interfaces/Base/AMReX_parallel_mod.F90
+39 −29 Src/LinearSolvers/MLMG/AMReX_MLABecLaplacian.H
+25 −40 Src/LinearSolvers/MLMG/AMReX_MLCGSolver.H
+2 −2 Src/LinearSolvers/MLMG/AMReX_MLCellLinOp.H
+9 −4 Src/LinearSolvers/MLMG/AMReX_MLEBABecLap.H
+10 −0 Src/LinearSolvers/MLMG/AMReX_MLEBABecLap.cpp
+1 −1 Src/LinearSolvers/MLMG/AMReX_MLEBNodeFDLaplacian.H
+17 −17 Src/LinearSolvers/MLMG/AMReX_MLLinOp.H
+2 −2 Src/LinearSolvers/MLMG/AMReX_MLMG.H
+4 −4 Src/LinearSolvers/MLMG/AMReX_MLNodeLap_2D_K.H
+1 −1 Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian.H
+1 −1 Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian.cpp
+1 −1 Src/LinearSolvers/MLMG/AMReX_MLNodeLinOp.cpp
+1 −5 Src/Particle/AMReX_ParticleUtil.H
+1 −0 Tests/LinearSolvers/EBflux_grad/MyTest.H
+4 −0 Tests/LinearSolvers/EBflux_grad/MyTest.cpp
+13 −0 Tests/Particles/Ascent_Insitu_SOA/CMakeLists.txt
+24 −0 Tests/Particles/Ascent_Insitu_SOA/GNUmakefile
+10 −0 Tests/Particles/Ascent_Insitu_SOA/inputs.rt
+306 −0 Tests/Particles/Ascent_Insitu_SOA/main.cpp
+1 −1 Tools/CMake/AMReXSYCL.cmake
+1 −1 Tools/GNUMake/comps/dpcpp.mak
+5 −0 Tools/Plotfile/CMakeLists.txt
+18 −17 Tools/Plotfile/fextrema.cpp
+2 −2 Tools/Plotfile/fsnapshot.cpp
+45 −85 Tools/Plotfile/fvolumesum.cpp

0 comments on commit 5ec250b

Please sign in to comment.