pynucastro.reduction.drgep_module module#
Classes and methods for implementing DRGEP reduction.
- pynucastro.reduction.drgep_module.calc_interaction_matrix(net, rvals)[source]#
Calculate direct interaction coefficients. This returns an N x N matrix, where N is the number of nuclei in
net
.- Parameters:
net (RateCollection) – The network we are reducing (can be a subclass of
RateCollection
)rvals (dict(Rate)) – A dictionary of reaction rate values, including all density, temperature, and composition dependencies. This is typically the result of
evaluate_rates
- Return type:
- pynucastro.reduction.drgep_module.drgep(net, conds, targets, tols, returnobj='net', use_mpi=False)[source]#
Apply the Directed Relation Graph with Error Propagation (DRGEP) reduction method to a network. This implementation is based on the description in Pepiot-Desjardins and Pitsch [2008] and Niemeyer and Sung [2011].
- Parameters:
net (RateCollection) – The network to reduce (can be a subclass of
RateCollection
)conds (Iterable) – The set of thermodynamic conditions to reduce over. This is a sequence of tuples: (
Composition
, density, temperature)targets (Iterable(Nucleus) or Iterable(str)) – A collection of target nuclei (or a single target nucleus) to run the graph search algorithm from.
tols (Iterable(float) or float) – Tolerance(s) or cutoff threshold(s) to use for paths from each of the target nuclei. Nuclei whose interaction coefficients do not meet the specified tolerance will have their interaction coefficients set to 0.0. If supplied as a single number then that value is used for all targets.
returnobj (str) –
The type of object to return. Valid options are:
’net’ : a reduced network (default)
’nuclei’ : unique nuclei with nonzero interaction coefficients, ordered so the interaction coefficients are descending
’coeff’ : the interaction coefficients as a numpy.ndarray, with entries corresponding to nuclei in
net.unique_nuclei
).
use_mpi (bool) – Do we divide up the set of conditions across MPI processes?
- Returns:
result – The return type depends on the value of
returnobj
- Return type:
RateCollection or List(Nucleus) or numpy.ndarray
- pynucastro.reduction.drgep_module.drgep_dijkstras(net, r_AB, target, adj_nuc)[source]#
Implement modified Dijkstra’s algorithm to find paths that maximize the overall interaction coefficient between the target and each other nucleus in the net.
- Parameters:
net (RateCollection) – The network we are reducing (can be a subclass of
RateCollection
)r_AB (numpy.ndarray) – The interaction coefficient matrix
target (Nucleus) – The nucleus on which we are running the graph search
adj_nuc (dict(Nucleus)) – A dictionary giving the set of nuclei that are connected to the key nucleus.
- Return type:
- pynucastro.reduction.drgep_module.get_adj_nuc(net)[source]#
Get set of adjacent nuclei for each nucleus in the net.
- Parameters:
net (RateCollection) – The network we are reducing (can be a subclass of
RateCollection
)- Return type: