Skip to content

Commit 83ced63

Browse files
committed
add more docs
1 parent d1a8b7b commit 83ced63

File tree

5 files changed

+103
-2
lines changed

5 files changed

+103
-2
lines changed

.github/workflows/jac_cell.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- name: Run jac_cell
3535
run: |
3636
cd unit_test/jac_cell
37-
./main3d.gnu.ex inputs_aprox13 > test.out
37+
./main3d.gnu.ex inputs > test.out
3838
3939
- name: Compare to stored output
4040
run: |

Docs/source/jac_cell.rst

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
.. _sec:jac_cell:
2+
3+
************
4+
``jac_cell``
5+
************
6+
7+
.. index:: jac_cell, numerical_jacobian.H
8+
9+
``jac_cell`` is used to test the accuracy of an analytic Jacobian
10+
provided by a network, but comparing to a finite-difference
11+
approximation. Given a thermodynamic state, ``jac_cell`` evaluates
12+
the analytic Jacobian as well as a numerical approximation to it, and
13+
then outputs (to ``stdout``) the Jacobian elements side-by-side for
14+
each method of computing the Jacobian.
15+
16+
.. note::
17+
18+
Some integrators, like VODE, have their own numerical Jacobian
19+
routines. This test uses the implementation in
20+
``integration/util/numerical_jacobian.H``, which closely follows the ideas
21+
of the VODE numerical approximation, as described in :cite:`lsode`.
22+
23+
24+
Getting Started
25+
===============
26+
27+
The ``jac_cell`` code is located in
28+
``Microphysics/unit_test/jac_cell``. An inputs file which sets the
29+
default parameters for your thermodynamic state is needed to run the
30+
test.
31+
32+
Setting the thermodynamics
33+
--------------------------
34+
35+
The parameters that affect the thermodynamics are:
36+
37+
* ``unit_test.density`` : the initial density
38+
39+
* ``unit_test.temperature`` : the initial temperature
40+
41+
* ``unit_test.small_temp`` : the low temperature cutoff used in the equation of state
42+
43+
* ``unit_test.small_dens`` : the low density cutoff used in the equation of state
44+
45+
While the mass fractions can be set individually (using
46+
``unit_test.X1``, ``unit_test.X2``, ...), it is recommended to use
47+
``unit_test.uniform_xn=1`` to initialize all the mass fractions to be
48+
equal.
49+
50+
51+
Building and Running the Code
52+
=============================
53+
54+
The code can be built simply as:
55+
56+
.. prompt:: bash
57+
58+
make
59+
60+
.. note::
61+
62+
By default, this will build with the ``aprox13`` network, which
63+
uses the C++ templating method (:ref:`sec:templated_rhs`) of
64+
building the analytic Jacobian at compile-time. The network can be
65+
changed via the build parameter ``NETWORK_DIR``.
66+
67+
.. important::
68+
69+
The screening routines provided by Microphysics do not return the
70+
derivative of the screening factor with respect to composition. This
71+
means that the analytic Jacobian provided by the network will ignore
72+
this contribution, but the numerical Jacobian will implicitly include
73+
it.
74+
75+
To compare just the network Jacobian elements, it is suggested that
76+
you build with ``SCREEN_METHOD=null``.
77+
78+
79+
The build process will automatically create links in the build
80+
directory to any required EOS table.
81+
82+
To run the code, in the ``jac_cell`` directory run::
83+
84+
./main3d.gnu.ex inputs
85+
86+
where ``inputs`` is the provided inputs file. You may edit the
87+
thermodynamic state in that file prior to running.
88+
89+
90+
Output
91+
======
92+
93+
All output is directed to ``stdout``. Example output is shown below
94+
(this output includes screening, highlighting the difference that the
95+
screening composition derivatives make):
96+
97+
98+
.. literalinclude:: ../../unit_test/jac_cell/ci-benchmarks/jac_cell_aprox13.out

Docs/source/one_zone_tests.rst

+1
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ have analysis scripts, which we describe in the next sections.
1212

1313
burn_cell.rst
1414
eos_cell.rst
15+
jac_cell.rst

Docs/source/templated_networks.rst

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _sec:templated_rhs:
2+
13
*********************************
24
Templated Network Righthand Sides
35
*********************************

Docs/source/unit_tests.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ One-zone tests
140140
for a single thermodynamic state, compute the analytic Jacobian
141141
(using the functions provided by the network) and a numerical
142142
finite-difference approximation to the Jacobian and output them,
143-
element-by-element, to the display.
143+
element-by-element, to the display. See :ref:`sec:jac_cell` for more information.
144144

145145
* ``nse_table_cell`` :
146146

0 commit comments

Comments
 (0)