Skip to content

Commit 45c9777

Browse files
authored
document burn_cell_sdc (#1747)
1 parent d90e290 commit 45c9777

7 files changed

+163
-7
lines changed

Docs/source/burn_cell.rst

+2
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ normalization. This normalization can be disabled by setting:
6363
unit_test.skip_initial_normalization = 1
6464

6565

66+
.. _sec:burn_cell_time:
67+
6668
Controlling time
6769
----------------
6870

Docs/source/burn_cell_sdc.rst

+144
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
.. _sec:burn_cell_sdc:
2+
3+
*****************
4+
``burn_cell_sdc``
5+
*****************
6+
7+
.. index:: burn_cell_sdc
8+
9+
``burn_cell_sdc`` is a simple one-zone burn analogous to :ref:`sec:burn_cell` that
10+
exercises the simplified-SDC code paths in the integrator.
11+
The system that is evolved
12+
has the form:
13+
14+
.. math::
15+
16+
\begin{align*}
17+
\frac{d(\rho X_k)}{dt} &= \Adv{\rho X_k}^{n+1/2} + \rho \dot{\omega}_k(\rho, X_k, T) \\
18+
\frac{d(\rho e)}{dt} &= \Adv{\rho e}^{n+1/2} + \rho \epsilon(\rho, X_k, T)
19+
\end{align*}
20+
21+
with density constructed as needed via:
22+
23+
$$\rho(t) = \rho^n + \Adv{\rho}^{n+1/2} (t - t^n)$$
24+
25+
In this system, we now need to specify the advective terms for the unit test.
26+
27+
.. note::
28+
29+
This test can also be used with NSE to test how the integration
30+
bails out into NSE if the ``in_nse()`` test is true.
31+
32+
33+
34+
35+
Getting Started
36+
===============
37+
38+
The ``burn_cell_sdc`` code is located in
39+
``Microphysics/unit_test/burn_cell_sdc``. By default, ``USE_SIMPLIFIED_SDC=TRUE``
40+
is set in the ``GNUmakefile``.
41+
42+
43+
Setting the thermodynamics
44+
--------------------------
45+
46+
The parameters that affect the thermodynamics are:
47+
48+
* ``unit_test.density`` : the initial density
49+
50+
* ``unit_test.temperature`` : the initial temperature
51+
52+
* ``unit_test.rhoe`` : the initial $(rho e)$. If this is not set (or
53+
set to be $< 0$), then it will be computed from the temperature
54+
using the EOS.
55+
56+
The composition can be set either by specifying individual mass fractions
57+
or setting ``unit_test.uniform_xn`` as described in :ref:`sec:defining_unit_test_composition`.
58+
59+
Aux composition
60+
---------------
61+
62+
When built with ``USE_NSE_TABLE=TRUE`` (see :ref:`tabulated_nse`) or with
63+
``USE_AUX_THERMO=TRUE`` (see :ref:`aux_eos_comp`) then the auxiliary
64+
composition, $Y_e$, $\bar{A}$, $\langle
65+
B/A\rangle$, is defined.
66+
67+
The auxiliary composition can either be initialized directly via
68+
``unit_test.Aux1``, ``unit_test.Aux2``, and ``unit_test.Aux3``, or
69+
their values can be computed at initialization from the mass fractions
70+
if ``unit_test.recompute_aux=1`` is set.
71+
72+
73+
74+
Advective terms
75+
---------------
76+
77+
But default, the advective terms are set to zero. In this mode,
78+
``burn_cell_sdc`` largely mimics ``burn_cell`` (although with a
79+
slightly different ODE system integrated).
80+
81+
The advective terms can be set manually via
82+
83+
* ``unit_test.Adv_rho`` : $\Adv{\rho}^{n+1/2}$
84+
* ``unit_test.Adv_rhoe`` : $\Adv{\rho e}^{n+1/2}$
85+
* ``unit_test.Adv_X1``, ``unit_test.Adv_X2``, ... : $\Adv{\rho X_1}^{n+1/2}$, $\Adv{\rho X_2}^{n+1/2}$, ... (up to $X_{35}$)
86+
* ``unit_test.Adv_Aux1``, ``unit_test.Adv_Aux2``, ``unit_test.Adv_Aux3`` : $\Adv{\rho \alpha_1}^{n+1/2}$, $\Adv{\rho \alpha_2}^{n+1/2}$, $\Adv{\rho \alpha_3}^{n+1/2}$
87+
88+
89+
90+
91+
Controlling time
92+
----------------
93+
94+
The integration time and output frequency are controlled by the
95+
same set of parameters as in ``burn_cell``. see :ref:`sec:burn_cell_time`.
96+
97+
98+
Integration parameters
99+
----------------------
100+
101+
The tolerances, choice of Jacobian, and other integration parameters
102+
can be set via the usual Microphysics runtime parameters, e.g.
103+
``integrator.atol_spec``.
104+
105+
106+
Rerunning a burn fail
107+
---------------------
108+
109+
.. index:: parse_integration_failure.py, USE_GPU_PRINTF
110+
111+
When a network integration encounters a failure, it will output the
112+
entire burn state to ``stdout`` (for GPU builds, this needs to be
113+
enabled explicitly by building with ``USE_GPU_PRINTF``).
114+
115+
The script ``unit_test/burn_cell_sdc/parse_integration_failure.py``
116+
can be used to parse the output (copy and paste the full error into a
117+
file) and produce the runtime parameter settings needed to reproduce
118+
the burn. This is especially important with SDC, since it will contain
119+
all of the advective terms.
120+
121+
122+
Building and Running the Code
123+
=============================
124+
125+
The code can be built simply as:
126+
127+
.. prompt:: bash
128+
129+
make
130+
131+
and the network and integrator can be changed using the normal
132+
Microphysics build system parameters.
133+
134+
.. important::
135+
136+
You need to do a ``make clean`` before rebuilding with a different
137+
network or integrator.
138+
139+
140+
To run the code, in the ``burn_cell_sdc`` directory run::
141+
142+
./main3d.gnu.ex inputs
143+
144+
where ``inputs`` is the name of your inputs file.

Docs/source/eos.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ the input and ``state`` is a C++ struct that holds all of the
1515
thermodynamic information.
1616

1717

18-
Interface and Modes
18+
Interface and modes
1919
===================
2020

2121
.. index:: eos_t, eos_re_t, eos_rep_t, eos_rh_t, chem_eos_t
@@ -85,7 +85,7 @@ stored in ``eos_t.aux[]``.
8585

8686
.. _aux_eos_comp:
8787

88-
Auxiliary Composition
88+
Auxiliary composition
8989
---------------------
9090

9191
.. index:: USE_AUX_THERMO
@@ -139,7 +139,7 @@ Many equations of state also need :math:`\bar{Z}` which is easily computed as
139139
\bar{Z} = \bar{A} Y_e
140140
141141
142-
Composition Derivatives
142+
Composition derivatives
143143
-----------------------
144144

145145
.. index:: eos_extra_t, eos_re_extra_t, eos_rep_extra_t
@@ -161,7 +161,7 @@ to compute :math:`\partial p/\partial X_k |_{\rho, T, X_j}`, :math:`\partial e/\
161161

162162

163163

164-
Initialization and Cutoff Values
164+
Initialization and cutoff values
165165
================================
166166

167167

@@ -178,7 +178,7 @@ max ( ``small_temp``, T ).
178178
User’s are encourage to do their own validation of inputs before calling
179179
the EOS.
180180

181-
EOS Structure
181+
EOS structure
182182
=============
183183

184184
Each EOS should have two main routines through which it interfaces to the

Docs/source/one_zone_tests.rst

+1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ have analysis scripts, which we describe in the next sections.
1313
:hidden:
1414

1515
burn_cell.rst
16+
burn_cell_sdc.rst
1617
eos_cell.rst
1718
jac_cell.rst

Docs/source/unit_test_runtime_parameters.rst

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Most of the unit tests require a composition to be defined (for the
2525
initial mass-fractions, $X_k$). There are a few ways this can be done
2626
(depending on the test).
2727

28+
2829
* One-zone (``*_cell``) tests (see :ref:`sec:one_zone_tests`) usually do one of:
2930

3031
* *Explicitly setting the individual mass fractions.* This is
@@ -46,6 +47,7 @@ initial mass-fractions, $X_k$). There are a few ways this can be done
4647
is initialized to ``1 / NumSpec``.
4748

4849
* Comprehensive tests (see :ref:`sec:comprehensive_tests`) need many different compositions, since they are creating a cube
50+
4951
of varying thermodynamic properties, and thus require a prescription
5052
to create the composition. This is done by setting ``unit_test.primary_species_1``,
5153
``unit_test.primary_species_2``, and ``unit_test.primary_species_3`` to one of the

Docs/source/unit_tests.rst

+1
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ One-zone tests
131131
* ``burn_cell_sdc`` :
132132

133133
similar to ``burn_cell`` except this uses the SDC integration code paths.
134+
See :ref:`sec:burn_cell_sdc` for more information.
134135

135136
* ``eos_cell`` :
136137

unit_test/burn_cell_sdc/parse_integration_failure.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,16 @@ def doit(string):
4747
# figure out if it is the VODE failure or burn_t that was provided
4848

4949
is_vode = False
50+
51+
density = None
52+
temperature = None
5053
rhoe = None
5154
tmax = None
52-
55+
xn = None
5356
aux = None
57+
A_rho = None
58+
A_rhoe = None
59+
A_X_k = None
5460
A_aux_k = None
5561

5662
for line in string:
@@ -163,7 +169,7 @@ def doit(string):
163169

164170
if __name__ == "__main__":
165171
err_file = sys.argv[1]
166-
with open(err_file, "r") as f:
172+
with open(err_file) as f:
167173
lines = f.readlines()
168174

169175
doit(lines)

0 commit comments

Comments
 (0)