Skip to content

Commit af5d94d

Browse files
authored
Merge branch 'development' into jac_cell_display
2 parents e8eddd6 + 3130448 commit af5d94d

File tree

13 files changed

+110
-24
lines changed

13 files changed

+110
-24
lines changed

Docs/source/burn_cell.rst

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _sec:burn_cell:
2+
13
*************
24
``burn_cell``
35
*************
@@ -80,7 +82,7 @@ by setting:
8082

8183
::
8284

83-
unit_test.init_species_all_equal = 1
85+
unit_test.uniform_xn = 1
8486

8587

8688
Controlling time
@@ -139,7 +141,7 @@ choice of network.
139141
network or integrator.
140142

141143

142-
To run the code, enter the burn_cell directory and run::
144+
To run the code, in the ``burn_cell`` directory run::
143145

144146
./main3d.gnu.ex inputs
145147

Docs/source/eos_cell.rst

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
************
2+
``eos_cell``
3+
************
4+
5+
.. index:: eos_cell
6+
7+
``eos_cell`` simply calls the equation of state on an input density, temperature,
8+
and composition, and then outputs the full thermodynamic state. This is mainly
9+
used to understand the thermodynamics one might encounter in a simulation
10+
when using a particular EOS.
11+
12+
Getting Started
13+
===============
14+
15+
The ``eos_cell`` code is located in
16+
``Microphysics/unit_test/eos_cell``. An inputs file which sets the
17+
default parameters for your thermodynamic state is needed to run the
18+
test.
19+
20+
Setting the thermodynamics
21+
--------------------------
22+
23+
The parameters that affect the thermodynamics are:
24+
25+
* ``unit_test.density`` : the initial density
26+
27+
* ``unit_test.temperature`` : the initial temperature
28+
29+
* ``unit_test.small_temp`` : the low temperature cutoff used in the equation of state
30+
31+
* ``unit_test.small_dens`` : the low density cutoff used in the equation of state
32+
33+
The composition can be set in the same way as in ``burn_cell``, either
34+
by setting each mass fraction explicitly via the parameters,
35+
``unit_test.X1``, ``unit_test.X2``, ..., or forcing them to be all
36+
equal via ``unit_test.uniform_xn=1``.
37+
38+
39+
Building and Running the Code
40+
=============================
41+
42+
The code can be built simply as:
43+
44+
.. prompt:: bash
45+
46+
make
47+
48+
.. note::
49+
50+
Even though there are no reactions, a network is still required,
51+
and can be set via the ``NETWORK_DIR`` build variable. By default,
52+
the ``aprox13`` network is used.
53+
54+
The network choice serves only to set the composition, and a
55+
``general_null`` network may also be used.
56+
57+
The build process will automatically create links in the build
58+
directory to any required EOS table.
59+
60+
To run the code, in the ``eos_cell`` directory run::
61+
62+
./main3d.gnu.ex inputs_eos
63+
64+
where ``inputs_eos`` is the provided inputs file. You may edit the
65+
thermodynamic state in that file prior to running.
66+
67+
68+
Output
69+
======
70+
71+
All output is directed to ``stdout`` and simply lists the entries in the
72+
full ``eos_t`` datatype.

Docs/source/getting_started.rst

+13-3
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,27 @@ one-zone burn. In ``Microphysics/`` do:
5858
cd unit_test/burn_cell
5959
make
6060

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

6368
.. prompt:: bash
6469

6570
./main3d.gnu.ex inputs_aprox13
6671

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

74+
This will output information about the starting and final state to the
75+
terminal and produce a file ``state_over_time.txt`` that contains the
76+
thermodynamic history at different points in time.
77+
78+
.. note::
7179

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

7383
Running with AMReX Application Code
7484
===================================

Docs/source/one_zone_tests.rst

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

1313
burn_cell.rst
14+
eos_cell.rst

Docs/source/rp_intro.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The behavior of the network and EOS are controlled by many runtime
66
parameters. These parameters are defined in plain-text files
77
``_parameters`` located in the different directories that hold the
88
microphysics code. At compile time, a script in the AMReX build
9-
system, findparams.py, locates all of the ``_parameters`` files that
9+
system, ``findparams.py``, locates all of the ``_parameters`` files that
1010
are needed for the given choice of network, integrator, and EOS, and
1111
assembles all of the runtime parameters into a set of header files
1212
(using the ``write_probin.py`` script).
@@ -32,4 +32,3 @@ noted in separate tables.
3232
.. toctree::
3333

3434
runtime_parameters
35-

unit_test/_parameters

+3
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,6 @@ X32 real 0.0e0
3939
X33 real 0.0e0
4040
X34 real 0.0e0
4141
X35 real 0.0e0
42+
43+
uniform_xn bool 0
44+

unit_test/burn_cell/_parameters

-2
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,3 @@ density real 1.e7
1717
temperature real 3.e9
1818

1919
skip_initial_normalization bool 0
20-
21-
init_species_all_equal bool 0

unit_test/burn_cell/burn_cell.H

+3-7
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,10 @@ void burn_cell_c()
2121
// Make sure user set all the mass fractions to values in the interval [0, 1]
2222
for (int n = 1; n <= NumSpec; ++n) {
2323

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

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

unit_test/burn_cell_sdc/burn_cell.H

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ void burn_cell_c()
2020
// Make sure user set all the mass fractions to values in the interval [0, 1]
2121
for (int n = 1; n <= NumSpec; ++n) {
2222

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

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

unit_test/eos_cell/eos_cell.H

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void eos_cell_c()
2424
// Make sure user set all the mass fractions to values in the interval [0, 1]
2525
for (int n = 1; n <= NumSpec; ++n) {
2626

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

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

unit_test/jac_cell/jac_cell.H

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void jac_cell_c()
2222
// Make sure user set all the mass fractions to values in the interval [0, 1]
2323
for (int n = 1; n <= NumSpec; ++n) {
2424

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

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

41-
normalize_abundances_burn(burn_state);
41+
if (! unit_test_rp::skip_initial_normalization) {
42+
normalize_abundances_burn(burn_state);
43+
}
4244

4345
// get the energy
4446

unit_test/react_util.H

+7-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ init_t setup_composition(const int nz) {
8888

8989

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

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

169169
AMREX_INLINE AMREX_GPU_HOST_DEVICE
170-
amrex::Real get_xn(const int index) {
170+
amrex::Real get_xn(const int index, bool uniform_composition=false) {
171171

172172
amrex::Real mass_fraction{};
173173

174+
if (uniform_composition) {
175+
mass_fraction = 1.0_rt / NumSpec;
176+
return mass_fraction;
177+
}
178+
174179
switch (index) {
175180

176181
case 1:

unit_test/test_react/_parameters

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ dens_max real 1.e9
55
temp_min real 1.e6
66
temp_max real 1.e15
77

8-
uniform_xn int 0
9-
108
tmax real 0.1e0
119

1210
small_temp real 1.e5

0 commit comments

Comments
 (0)