@@ -105,30 +105,50 @@ passed into the integration routines. For this reason, we often need
105105to pass both the specific integrator's type (e.g. ``dvode_t ``) and
106106``burn_t `` objects into the lower-level network routines.
107107
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() ``.
109112
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 ``
111121
112122#. Fill the integrator type by calling ``burn_to_integrator() `` to create a
113123 ``dvode_t ``.
114124
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
116129 ``burn_t `` --- as noted above, the auxiliary information that is
117130 not part of the integration state will be obtained from the
118131 ``burn_t ``.
119132
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 ``
122134
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 ``.
124136
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.
126146
127147.. index :: integrator.subtract_internal_energy
128148
129- .. note ::
149+ .. important ::
130150
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
132152 the burn, and not the actual internal energy of the state.
133153
134154 Optionally, by setting ``integrator.subtract_internal_energy=0 ``
@@ -155,7 +175,8 @@ The righthand side of the network is implemented by
155175
156176.. code-block :: c++
157177
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)
159180
160181All of the necessary integration data comes in through state, as:
161182
@@ -245,7 +266,11 @@ The analytic Jacobian is specific to each network and is provided by
245266
246267.. code-block :: c++
247268
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> ``
249274
250275The Jacobian matrix elements are stored in ``jac `` as:
251276
@@ -316,13 +341,9 @@ Thermodynamics and :math:`e` Evolution
316341======================================
317342
318343The 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.
326347
327348At initialization, :math: `e` is set to the value from the EOS consistent
328349with the initial temperature, density, and composition:
@@ -331,28 +352,40 @@ with the initial temperature, density, and composition:
331352
332353 e_0 = e(\rho _0 , T_0 , {X_k}_0 )
333354
334- In the integration routines, this is termed the *energy offset *.
335-
336355 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) ,
338357
339358.. math :: e(t) = e_0 + \int_{t_0}^t f(\dot{Y}_k) dt
340359
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.
360+ .. note ::
361+
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.
365+
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.
344370
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).
352379
353380.. index :: integrator.call_eos_in_rhs
354381
355382.. note ::
356383
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