ndiffusion.make_materials¶
- ndiffusion.make_materials(data_list, G, descending_energy=None, scatter_orientation='to_from')[source]¶
Build a configured Materials object from a list of cross-section dicts.
Each dict (e.g., the result of
np.load("material.npz")) must contain:D- diffusion coefficients, shape(G,)Siga- absorption cross sections, shape(G,)Scat- scatter matrix, shape(G, G),scatter[g_to][g_from]by default (see scatter_orientation)nuSigf- nu-fission cross sections, shape(G,)or(G, G)
Optional keys:
Removal- precomputed removal cross sections, shape(G,).If present, skips removal computation and does not zero the scatter diagonal.
Sigais then unused and may be omitted (this is the pathndiffusion.make_materials_from_transport()takes).
chi- fission spectrum, shape(G,). Defaults to all-zeroswhen absent (activates fission-matrix mode in the solver when
nuSigfis also a matrix).
Removal computation and the scatter diagonal¶
The solver convention is
scatter[g_to][g_from]with the self-scatter diagonal excluded (it cancels out of the removal term). WhenRemovalis not supplied, this function derives it asSiga[g] + (total out-scatter from g) - Scat[g, g]and then zeroes the diagonal ofScatin place. WhenRemovalis supplied the data is taken as-is and the diagonal is left untouched - the caller is then responsible for providing aScatmatrix consistent with thatRemoval.The “total out-scatter from g” is the column sum
sum_{g_to} Scat[g_to][g]onceScatis in the solver’s[g_to][g_from]order - that is,axis=0. Which axis that is in the input depends on how the caller stored the matrix, so it is selected byscatter_orientation, as inndiffusion.transport_to_diffusion(). A"from_to"matrix is transposed into solver order first, keeping the stored transfer matrix and the derived removal consistent.- param data_list:
Ordered list of cross-section data containers, one per material.
- type data_list:
list of dict-like
- param G:
Number of energy groups.
- type G:
int
- param descending_energy:
Deprecated - use scatter_orientation, which names the array orientation this argument actually selected.
Trueis equivalent toscatter_orientation="to_from"and warns;Falseraises, because it summed the out-scatter over one axis while passing the matrix through untransposed - passscatter_orientation="from_to"instead.- type descending_energy:
bool or None, optional
- param scatter_orientation:
Storage order of the input
Scatmatrix."to_from"(default) is the solver’s own convention,Scat[g_to][g_from], and is used as-is;"from_to"is the usual transport-library convention,Scat[g_from][g_to], and is transposed into solver order. Applies whether or notRemovalis supplied.- type scatter_orientation:
{“to_from”, “from_to”}, optional
- returns:
Fully configured Materials object ready to pass to a solver.
- rtype:
Materials