@@ -14,13 +14,13 @@ The equations we integrate to do a nuclear burn are:
14
14
:label: eq:spec_integrate
15
15
16
16
.. math ::
17
- \frac {de}{dt} = f (\rho ,X_k,T)
17
+ \frac {de}{dt} = \epsilon (\rho ,X_k,T)
18
18
:label: eq:enuc_integrate
19
19
20
20
Here, :math: `X_k` is the mass fraction of species :math: `k`, :math: `e`
21
21
is the specific nuclear energy created through reactions. Also needed
22
22
are density :math: `\rho `, temperature :math: `T`, and the specific
23
- heat. The function :math: `f ` provides the energy release from
23
+ heat. The function :math: `\epsilon ` provides the energy release from
24
24
reactions and can often be expressed in terms of the instantaneous
25
25
reaction terms, :math: `\dot {X}_k`. As noted in the previous section,
26
26
this is implemented in a network-specific manner.
@@ -46,7 +46,7 @@ energy. This allows us to easily call the EOS during the burn to obtain the temp
46
46
:label: eq:spec_n_integrate
47
47
48
48
.. math ::
49
- \frac {de}{dt} = f (\rho ,n_k,T)
49
+ \frac {de}{dt} = \epsilon (\rho ,n_k,T)
50
50
:label: eq:enuc_n_integrate
51
51
52
52
The effect of this flag in the integrators is that we don't worry
@@ -105,30 +105,50 @@ passed into the integration routines. For this reason, we often need
105
105
to pass both the specific integrator's type (e.g. ``dvode_t ``) and
106
106
``burn_t `` objects into the lower-level network routines.
107
107
108
- The overall flow of the integrator is (using VODE as the example):
108
+ Below we outline the overall flow of the integrator (using VODE as the
109
+ example). Most of the setup and cleanup after calling the particular
110
+ integration routine is the same for all integrators, and is handled by
111
+ the functions ``integrator_setup() `` and ``integrator_cleanup() ``.
109
112
110
- #. Call the EOS directly on the input ``burn_t `` state using :math: `\rho ` and :math: `T` as inputs.
113
+ .. index :: integrator.scale_system, burn_to_integrator, integrator_to_burn
114
+ .. index :: integrator.call_eos_in_rhs, integrator.subtract_internal_energy, integrator.burner_verbose
115
+
116
+ #. Call the EOS directly on the input ``burn_t `` state using
117
+ :math: `\rho ` and :math: `T` as inputs.
118
+
119
+ #. Scale the absolute energy tolerance if we are using
120
+ ``integrator.scale_system ``
111
121
112
122
#. Fill the integrator type by calling ``burn_to_integrator() `` to create a
113
123
``dvode_t ``.
114
124
115
- #. call the ODE integrator, ``dvode() ``, passing in the ``dvode_t `` _and_ the
125
+ #. Save the initial thermodynamic state for diagnostics and optionally
126
+ subtracting off the initial energy later.
127
+
128
+ #. Call the ODE integrator, ``dvode() ``, passing in the ``dvode_t `` *and * the
116
129
``burn_t `` --- as noted above, the auxiliary information that is
117
130
not part of the integration state will be obtained from the
118
131
``burn_t ``.
119
132
120
- #. subtract off the energy offset---we now store just the energy released
121
- in the ``dvode_t `` integration state.
133
+ #. Convert back to a ``burn_t `` by calling ``integrator_to_burn ``
122
134
123
- #. convert back to a `` burn_t `` by calling ``integrator_to_burn ``
135
+ #. Recompute the temperature if we are using ``integrator.call_eos_in_rhs ``.
124
136
125
- #. normalize the abundances so they sum to 1.
137
+ #. If we set ``integrator.subtract_internal_energy ``, then subtract
138
+ off the energy offset, the energy stored is now just that generated
139
+ by reactions.
140
+
141
+ #. Normalize the abundances so they sum to 1 (except if ``integrator.use_number_density `` is set).
142
+
143
+ #. Output statistics on the integration if we set ``integrator.burner_verbose ``.
144
+ This is not recommended for big simulations, as it will output information
145
+ for every zone's burn.
126
146
127
147
.. index :: integrator.subtract_internal_energy
128
148
129
- .. note ::
149
+ .. important ::
130
150
131
- Upon exit, ``burn_t burn_state.e `` is the energy *released * during
151
+ By default, upon exit, ``burn_t burn_state.e `` is the energy *released * during
132
152
the burn, and not the actual internal energy of the state.
133
153
134
154
Optionally, by setting ``integrator.subtract_internal_energy=0 ``
@@ -155,7 +175,8 @@ The righthand side of the network is implemented by
155
175
156
176
.. code-block :: c++
157
177
158
- void actual_rhs(burn_t& state, Array1D<Real, 1, neqs>& ydot)
178
+ AMREX_GPU_HOST_DEVICE AMREX_INLINE
179
+ void actual_rhs(burn_t& state, amrex::Array1D<amrex::Real, 1, neqs>& ydot)
159
180
160
181
All of the necessary integration data comes in through state, as:
161
182
@@ -245,7 +266,11 @@ The analytic Jacobian is specific to each network and is provided by
245
266
246
267
.. code-block :: c++
247
268
248
- void actual_jac(burn_t& state, MathArray2D<1, neqs, 1, neqs>& jac)
269
+ template<class MatrixType>
270
+ AMREX_GPU_HOST_DEVICE AMREX_INLINE
271
+ void actual_jac(const burn_t& state, MatrixType& jac)
272
+
273
+ where the ``MatrixType `` is most commonly ``MathArray2D<1, neqs, 1, neqs> ``
249
274
250
275
The Jacobian matrix elements are stored in ``jac `` as:
251
276
@@ -316,13 +341,9 @@ Thermodynamics and :math:`e` Evolution
316
341
======================================
317
342
318
343
The thermodynamic equation in our system is the evolution of the internal energy,
319
- :math: `e`.
320
-
321
- .. note ::
322
-
323
- When the system is integrated in an operator-split approach, the
324
- energy equation accounts for only the nuclear energy release and
325
- not pdV work.
344
+ :math: `e`. During the course of the integration, we ensure that the temperature stay
345
+ below the value ``integrator.MAX_TEMP `` (defaulting to ``1.e11 ``) by clamping the
346
+ temperature if necessary.
326
347
327
348
At initialization, :math: `e` is set to the value from the EOS consistent
328
349
with the initial temperature, density, and composition:
@@ -331,28 +352,40 @@ with the initial temperature, density, and composition:
331
352
332
353
e_0 = e(\rho _0 , T_0 , {X_k}_0 )
333
354
334
- In the integration routines, this is termed the *energy offset *.
335
-
336
355
As the system is integrated, :math: `e` is updated to account for the
337
- nuclear energy release,
356
+ nuclear energy release (and thermal neutrino losses),
357
+
358
+ .. math :: e(t) = e_0 + \int_{t_0}^t \epsilon(\dot{Y}_k) dt
359
+
360
+ .. note ::
338
361
339
- .. math :: e(t) = e_0 + \int_{t_0}^t f(\dot{Y}_k) dt
362
+ When the system is integrated in an operator-split approach, the
363
+ energy equation accounts for only the nuclear energy release and
364
+ not pdV work.
340
365
341
- As noted above, upon exit, we subtract off this initial offset, so ``state.e `` in
342
- the returned ``burn_t `` type from the ``actual_integrator ``
343
- call represents the energy *release * during the burn.
366
+ If ``integrator.subtract_internal_energy `` is set, then, on exit, we
367
+ subtract off this initial $e_0$, so ``state.e `` in the returned
368
+ ``burn_t `` type from the ``actual_integrator `` call represents the
369
+ energy *release * during the burn.
344
370
345
- Integration of Equation :eq: `eq:enuc_integrate `
346
- requires an evaluation of the temperature at each integration step
347
- (since the RHS for the species is given in terms of :math: `T`, not :math: `e`).
348
- This involves an EOS call and is the default behavior of the integration.
349
- Note also that for the Jacobian, we need the specific heat, :math: `c_v`, since we
350
- usually calculate derivatives with respect to temperature (as this is the form
351
- the rates are commonly provided in).
371
+ Integration of Equation :eq: `eq:enuc_integrate ` requires an evaluation
372
+ of the temperature at each integration step (since the RHS for the
373
+ species is given in terms of :math: `T`, not :math: `e`). This involves
374
+ an EOS call and is the default behavior of the integration.
375
+
376
+ Note also that for the Jacobian, we need the specific heat,
377
+ :math: `c_v`, since we usually calculate derivatives with respect to
378
+ temperature (as this is the form the rates are commonly provided in).
352
379
353
380
.. index :: integrator.call_eos_in_rhs
354
381
355
382
.. note ::
356
383
357
- If desired, the EOS call can be skipped and the temperature and $c_v$ kept
358
- frozen over the entire time interval of the integration by setting ``integrator.call_eos_in_rhs=0 ``.
384
+ If desired, the EOS call can be skipped and the temperature and
385
+ $c_v$ kept frozen over the entire time interval of the integration
386
+ by setting ``integrator.call_eos_in_rhs=0 ``.
387
+
388
+ .. index :: integrator.integrate_energy
389
+
390
+ We also provide the option to completely remove the energy equation from
391
+ the system by setting ``integrator.integrate_energy=0 ``.
0 commit comments