Skip to content

Commit

Permalink
Merge branch 'development' into jac_cell_display
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale authored Feb 7, 2025
2 parents e8eddd6 + 3130448 commit af5d94d
Show file tree
Hide file tree
Showing 13 changed files with 110 additions and 24 deletions.
6 changes: 4 additions & 2 deletions Docs/source/burn_cell.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _sec:burn_cell:

*************
``burn_cell``
*************
Expand Down Expand Up @@ -80,7 +82,7 @@ by setting:

::

unit_test.init_species_all_equal = 1
unit_test.uniform_xn = 1


Controlling time
Expand Down Expand Up @@ -139,7 +141,7 @@ choice of network.
network or integrator.


To run the code, enter the burn_cell directory and run::
To run the code, in the ``burn_cell`` directory run::

./main3d.gnu.ex inputs

Expand Down
72 changes: 72 additions & 0 deletions Docs/source/eos_cell.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
************
``eos_cell``
************

.. index:: eos_cell

``eos_cell`` simply calls the equation of state on an input density, temperature,
and composition, and then outputs the full thermodynamic state. This is mainly
used to understand the thermodynamics one might encounter in a simulation
when using a particular EOS.

Getting Started
===============

The ``eos_cell`` code is located in
``Microphysics/unit_test/eos_cell``. An inputs file which sets the
default parameters for your thermodynamic state is needed to run the
test.

Setting the thermodynamics
--------------------------

The parameters that affect the thermodynamics are:

* ``unit_test.density`` : the initial density

* ``unit_test.temperature`` : the initial temperature

* ``unit_test.small_temp`` : the low temperature cutoff used in the equation of state

* ``unit_test.small_dens`` : the low density cutoff used in the equation of state

The composition can be set in the same way as in ``burn_cell``, either
by setting each mass fraction explicitly via the parameters,
``unit_test.X1``, ``unit_test.X2``, ..., or forcing them to be all
equal via ``unit_test.uniform_xn=1``.


Building and Running the Code
=============================

The code can be built simply as:

.. prompt:: bash

make

.. note::

Even though there are no reactions, a network is still required,
and can be set via the ``NETWORK_DIR`` build variable. By default,
the ``aprox13`` network is used.

The network choice serves only to set the composition, and a
``general_null`` network may also be used.

The build process will automatically create links in the build
directory to any required EOS table.

To run the code, in the ``eos_cell`` directory run::

./main3d.gnu.ex inputs_eos

where ``inputs_eos`` is the provided inputs file. You may edit the
thermodynamic state in that file prior to running.


Output
======

All output is directed to ``stdout`` and simply lists the entries in the
full ``eos_t`` datatype.
16 changes: 13 additions & 3 deletions Docs/source/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,27 @@ one-zone burn. In ``Microphysics/`` do:
cd unit_test/burn_cell
make

This will create an executable called ``main3d.gnu.ex``. Then you can run it as:
This will create an executable called ``main3d.gnu.ex``.
By default, the test is built with the 13-isotope ``aprox13`` network,
``helmholtz`` EOS, and VODE integrator.


Then you can run it as:

.. prompt:: bash

./main3d.gnu.ex inputs_aprox13

By default, the test is built with the 13-isotope ``aprox13`` network,
``helmholtz`` EOS, and VODE integrator.
Here ``inputs_aprox13`` is the inputs file that sets options.

This will output information about the starting and final state to the
terminal and produce a file ``state_over_time.txt`` that contains the
thermodynamic history at different points in time.

.. note::

See the :ref:`sec:burn_cell` documentation for more details on this
unit test and how to visualize the output.

Running with AMReX Application Code
===================================
Expand Down
1 change: 1 addition & 0 deletions Docs/source/one_zone_tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ have analysis scripts, which we describe in the next sections.
:hidden:

burn_cell.rst
eos_cell.rst
3 changes: 1 addition & 2 deletions Docs/source/rp_intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The behavior of the network and EOS are controlled by many runtime
parameters. These parameters are defined in plain-text files
``_parameters`` located in the different directories that hold the
microphysics code. At compile time, a script in the AMReX build
system, findparams.py, locates all of the ``_parameters`` files that
system, ``findparams.py``, locates all of the ``_parameters`` files that
are needed for the given choice of network, integrator, and EOS, and
assembles all of the runtime parameters into a set of header files
(using the ``write_probin.py`` script).
Expand All @@ -32,4 +32,3 @@ noted in separate tables.
.. toctree::

runtime_parameters

3 changes: 3 additions & 0 deletions unit_test/_parameters
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ X32 real 0.0e0
X33 real 0.0e0
X34 real 0.0e0
X35 real 0.0e0

uniform_xn bool 0

2 changes: 0 additions & 2 deletions unit_test/burn_cell/_parameters
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,3 @@ density real 1.e7
temperature real 3.e9

skip_initial_normalization bool 0

init_species_all_equal bool 0
10 changes: 3 additions & 7 deletions unit_test/burn_cell/burn_cell.H
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,10 @@ void burn_cell_c()
// Make sure user set all the mass fractions to values in the interval [0, 1]
for (int n = 1; n <= NumSpec; ++n) {

if (unit_test_rp::init_species_all_equal) {
massfractions[n-1] = 1.0_rt / static_cast<amrex::Real>(NumSpec);
} else {
massfractions[n-1] = get_xn(n);
massfractions[n-1] = get_xn(n, unit_test_rp::uniform_xn);

if (massfractions[n-1] < 0 || massfractions[n-1] > 1) {
amrex::Error("mass fraction for " + short_spec_names_cxx[n-1] + " not initialized in the interval [0,1]!");
}
if (massfractions[n-1] < 0 || massfractions[n-1] > 1) {
amrex::Error("mass fraction for " + short_spec_names_cxx[n-1] + " not initialized in the interval [0,1]!");
}
}

Expand Down
2 changes: 1 addition & 1 deletion unit_test/burn_cell_sdc/burn_cell.H
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void burn_cell_c()
// Make sure user set all the mass fractions to values in the interval [0, 1]
for (int n = 1; n <= NumSpec; ++n) {

massfractions[n-1] = get_xn(n);
massfractions[n-1] = get_xn(n, unit_test_rp::uniform_xn);

if (massfractions[n-1] < 0 || massfractions[n-1] > 1) {
amrex::Error("mass fraction for " + short_spec_names_cxx[n-1] + " not initialized in the interval [0,1]!");
Expand Down
2 changes: 1 addition & 1 deletion unit_test/eos_cell/eos_cell.H
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void eos_cell_c()
// Make sure user set all the mass fractions to values in the interval [0, 1]
for (int n = 1; n <= NumSpec; ++n) {

massfractions[n-1] = get_xn(n);
massfractions[n-1] = get_xn(n, unit_test_rp::uniform_xn);

if (massfractions[n-1] < 0 || massfractions[n-1] > 1) {
amrex::Error("mass fraction for " + short_spec_names_cxx[n-1] + " not initialized in the interval [0,1]!");
Expand Down
6 changes: 4 additions & 2 deletions unit_test/jac_cell/jac_cell.H
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void jac_cell_c()
// Make sure user set all the mass fractions to values in the interval [0, 1]
for (int n = 1; n <= NumSpec; ++n) {

massfractions[n-1] = get_xn(n);
massfractions[n-1] = get_xn(n, unit_test_rp::uniform_xn);

if (massfractions[n-1] < 0 || massfractions[n-1] > 1) {
amrex::Error("mass fraction for " + short_spec_names_cxx[n-1] + " not initialized in the interval [0,1]!");
Expand All @@ -38,7 +38,9 @@ void jac_cell_c()
burn_state.xn[n] = massfractions[n];
}

normalize_abundances_burn(burn_state);
if (! unit_test_rp::skip_initial_normalization) {
normalize_abundances_burn(burn_state);
}

// get the energy

Expand Down
9 changes: 7 additions & 2 deletions unit_test/react_util.H
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ init_t setup_composition(const int nz) {


AMREX_INLINE AMREX_GPU_HOST_DEVICE
void get_xn(const int k, const init_t cd, amrex::Real *xn_zone, int uniform_composition = 0) {
void get_xn(const int k, const init_t cd, amrex::Real *xn_zone, bool uniform_composition=false) {

for (int n = 0; n < NumSpec; n++) {
xn_zone[n] = 0.0_rt;
Expand Down Expand Up @@ -167,10 +167,15 @@ void get_xn(const int k, const init_t cd, amrex::Real *xn_zone, int uniform_comp
///

AMREX_INLINE AMREX_GPU_HOST_DEVICE
amrex::Real get_xn(const int index) {
amrex::Real get_xn(const int index, bool uniform_composition=false) {

amrex::Real mass_fraction{};

if (uniform_composition) {
mass_fraction = 1.0_rt / NumSpec;
return mass_fraction;
}

switch (index) {

case 1:
Expand Down
2 changes: 0 additions & 2 deletions unit_test/test_react/_parameters
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ dens_max real 1.e9
temp_min real 1.e6
temp_max real 1.e15

uniform_xn int 0

tmax real 0.1e0

small_temp real 1.e5
Expand Down

0 comments on commit af5d94d

Please sign in to comment.