Skip to content

Commit

Permalink
Merge branch 'development' into network_docs
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale authored Jan 17, 2025
2 parents 2dae3be + 4de2802 commit 69296c5
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 45 deletions.
24 changes: 22 additions & 2 deletions Docs/source/data_structures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ network, and they will come in through the ``network_properties.H`` header file.
There is a lot more information that can be saved here, such as the
partial derivatives of the thermodynamic state variables with respect
to each other. To see a complete list, examine the ``eos_type.H``
file: ``Castro/Microphysics/interfaces/eos_type.H``.
file.

Networks
========
Expand Down Expand Up @@ -111,10 +111,30 @@ to access the different components of the state:

* ``neqs`` : the total number of variables we are integrating.

It is assumed that the first ``nspec`` are the species.
It is assumed that the first ``nspec`` are the species.

* ``net_ienuc`` : the index of the specific internal energy in the solution vector

For :ref:`sdc-evolution`, it also defines integer indices for the
``burn_t y[]`` array:

* ``SFS``: the first species

* ``SEINT`` the energy

and then a number of components that are not evolved:

* ``SRHO`` density

* ``SMX``, ``SMY``, ``SMZ`` : the momenta

* ``SEDEN`` : the total energy density

* ``SFX`` : the first auxiliary quantity

with the total number of state variables ``SVAR`` and the number of evolved
variables ``SVAR_EVOLVE``.

Integrators
===========

Expand Down
5 changes: 5 additions & 0 deletions Docs/source/nse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,11 @@ reaction network. It solves for the chemical potentials of the proton
and neutron and from there gets the abundances of each of the nuclei
under the assumption of NSE, following the procedure outlined in :cite:`Calder_2007`.

.. important::

Self-consistent NSE does not support the templated C++ networks
(like ``aprox13``). You should use a pynucastro-generated network.

The solve is done using a port of the hybrid Powell method from
MINPACK (we ported the solver to templated C++).

Expand Down
2 changes: 2 additions & 0 deletions Docs/source/sdc.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _sdc-evolution:

*****************************
Spectral Deferred Corrections
*****************************
Expand Down
17 changes: 6 additions & 11 deletions Docs/source/templated_networks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -384,16 +384,11 @@ Linear Algebra

The VODE integrator needs routines to do LU factorization and back
substitution. We build off of the linpack ``dgefa`` and ``dgesl``
routines, but because we know at compile time which Jacobian terms are
non-zero, we are able to use ``constexpr`` for-loops to only do the
calculations on non-zero elements. This greatly reduces the amount of work
in the linear algebra.
routines, using ``constexpr`` for-loops that know the network size
at compile time.

Note:

* Currently we are still storing a dense Jacobian -- we just skip computation
on the elements that are 0.
.. note::

* These routines do not perform pivoting. This does not seem to be an
issue for the types of matrices we solve with reactions (since they are
all of the form :math:`I - \tau J`, where :math:`tau` is the timestep).
These routines do not perform pivoting. This does not seem to be an
issue for the types of matrices we solve with reactions (since they are
all of the form :math:`I - \tau J`, where :math:`tau` is the timestep).
13 changes: 3 additions & 10 deletions interfaces/eos.H
Original file line number Diff line number Diff line change
Expand Up @@ -394,14 +394,13 @@ void check_inputs (const I input, T& state)

template <typename I, typename T>
AMREX_GPU_HOST_DEVICE AMREX_INLINE
void eos (const I input, T& state, bool use_raw_inputs = false)
void eos (const I input, T& state)
{
static_assert(std::is_same_v<I, eos_input_t>, "input must be an eos_input_t");

// Input arguments

bool has_been_reset = false;
bool use_composition_routine = true;

// Local variables

Expand All @@ -411,15 +410,9 @@ void eos (const I input, T& state, bool use_raw_inputs = false)
}
#endif

if (use_raw_inputs) {
use_composition_routine = false;
}

if constexpr (has_xn<T>::value) {
if (use_composition_routine) {
// Get abar, zbar, etc.
composition(state);
}
// Get abar, zbar, etc.
composition(state);
}

// Force the inputs to be valid.
Expand Down
16 changes: 0 additions & 16 deletions networks/Make.package
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,6 @@ include $(MICROPHYSICS_UTIL_PATH)/Make.package

ifeq ($(USE_REACT), TRUE)

# for backwards compatibility
DEFINES += -DNETWORK_HAS_CXX_IMPLEMENTATION

ifeq ($(INTEGRATOR_DIR), VODE90)
override INTEGRATOR_DIR = VODE
$(warning VODE90 has been renamed VODE)
endif

ifeq ($(INTEGRATOR_DIR), VODE)
ifeq ($(USE_CLEANED_CORRECTOR), TRUE)
DEFINES += -DCLEAN_INTEGRATOR_CORRECTION
endif
endif

VPATH_LOCATIONS += $(MICROPHYSICS_HOME)/networks

CEXE_headers += rhs.H
Expand Down Expand Up @@ -98,8 +84,6 @@ AUTO_BUILD_SOURCES += $(NETWORK_OUTPUT_PATH)/network_properties.H
net_prop_debug: $(NETWORK_OUTPUT_PATH)/network_properties.H

ifneq ($(NETWORK_DIR), general_null)
$(NETWORK_OUTPUT_PATH)/network_properties.F90: $(NETWORK_OUTPUT_PATH)/network_properties.H

NAUX := $(shell PYTHONPATH=$(MICROPHYSICS_HOME)/networks/general_null $(MICROPHYSICS_HOME)/networks/get_naux.py --microphysics_path "$(MICROPHYSICS_HOME)" --defines "$(DEFINES)" --net "$(NETWORK_DIR)")
DEFINES += "-DNAUX_NET=$(NAUX)"

Expand Down
3 changes: 0 additions & 3 deletions unit_test/test_aprox_rates/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@ void main_main ()
// for C++
plot_t vars;

// for F90
Vector<std::string> varnames;

// C++ test
vars = init_variables();

Expand Down
3 changes: 0 additions & 3 deletions unit_test/test_conductivity/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@ void main_main ()
// for C++
plot_t vars;

// for F90
Vector<std::string> varnames;

// C++ test
vars = init_variables();

Expand Down

0 comments on commit 69296c5

Please sign in to comment.