pyopensn.xs.MultiGroupXS
- class pyopensn.xs.MultiGroupXS
Multi-group cross section.
Wrapper of
opensn::MultiGroupXS.The Python API currently has two types of methods:
Creation/loading methods such as
CreateSimpleOneGroup,LoadFromOpenSn, andLoadFromOpenMCpopulate an existing object.Scalemutates the current object.Combinereturns a new cross-section object and does not mutate inputs.
- static Combine(combinations: list[tuple[pyopensn.xs.MultiGroupXS, float]]) pyopensn.xs.MultiGroupXS
Return a new combined cross-section.
- Parameters:
combinations (List[Tuple[pyopensn.xs.MultiGroupXS, float]]) – List of
(cross_section, density)pairs. The density values are linear weights used to combine raw cross sections.- Returns:
A new combined cross-section object. The input cross sections are not modified.
- Return type:
Notes
Let \(d_i\) be the supplied density for cross section \(i\).
Raw XS terms are density-weighted sums: \(\sigma = \sum_i d_i \sigma_i\) (e.g. total, absorption, fission, transfer, production).
Named custom 1D XS are preserved and combined with the same density weighting.
Fission spectra and precursor yields are weighted by fissile density fraction so their sums remain normalized.
All inputs must have the same number of groups.
If inverse velocity is present, all inputs must have identical values.
Examples
>>> xs_1 = MultiGroupXS() >>> xs_1.CreateSimpleOneGroup(sigma_t=1, c=0.5) >>> xs_2 = MultiGroupXS() >>> xs_2.CreateSimpleOneGroup(sigma_t=2, c=1./3.) >>> combo = [ ... ( xs_1, 0.5 ), ... ( xs_2, 3.0 ) ... ] >>> xs_combined = MultiGroupXS.Combine(combo)
- CreateSimpleOneGroup(self: pyopensn.xs.MultiGroupXS, sigma_t: float, c: float, velocity: float = 0.0) None
Populate this object with a one-group cross section.
- Parameters:
sigma_t (float) – Total cross section.
c (float) – Scattering ratio.
velocity (float, optional) – Group velocity. If provided and positive, inverse velocity is populated with 1.0/velocity.
Notes
This method mutates
selfby replacing its current contents.
- GetScaleFactor(self: pyopensn.xs.MultiGroupXS) float
Get the scaling factor.
- LoadFromOpenMC(self: pyopensn.xs.MultiGroupXS, file_name: str, dataset_name: str, temperature: float, extra_xs_names: list[str] = []) None
Load multi-group cross sections from an OpenMC cross-section file into this object.
Notes
This method mutates
selfby replacing its current contents.
- LoadFromOpenSn(self: pyopensn.xs.MultiGroupXS, file_name: str) None
Load multi-group cross sections from an OpenSn cross section input file into this object.
Format is as follows (for transfers, gprime denotes the departing group and g is the arrival group).
# Add comment lines, as needed NUM_GROUPS ng NUM_MOMENTS nmom SIGMA_T_BEGIN 0 value . . ng-1 value SIGMA_T_END SIGMA_A_BEGIN 0 value . . ng-1 value SIGMA_A_END TRANSFER_MOMENTS_BEGIN M_GFROM_GTO_VAL 0 0 0 value . M_GFROM_GTO_VAL moment gfrom gto value . M_GFROM_GTO_VAL nmom-1 ng-1 ng-1 value TRANSFER_MOMENTS_END
Notes
This method mutates
selfby replacing its current contents.
- Scale(self: pyopensn.xs.MultiGroupXS, factor: float) None
Scale the cross sections in-place.
Notes
Scaling does not compound. Each call scales from the original baseline data. Named custom 1D XS are scaled along with the standard 1D cross-section data.
- __init__(self: pyopensn.xs.MultiGroupXS) None
Create an empty multi-group cross section.
- property chi
Get neutron fission spectrum.
- custom_xs_names(self: pyopensn.xs.MultiGroupXS) list[str]
Get a list of custom XS entries.
- get_custom_xs(self: pyopensn.xs.MultiGroupXS, name: str) memoryview
Get a custom XS vector.
- has_custom_xs(self: pyopensn.xs.MultiGroupXS, name: str) bool
Check if a custom XS is available.
- property inv_velocity
Get inverse velocity.
- property is_fissionable
Check if the material is fissile.
- property nu_delayed_sigma_f
Get delayed neutron production due to fission.
- property nu_prompt_sigma_f
Get prompt neutron production due to fission.
- property nu_sigma_f
Get neutron production due to fission.
- property num_groups
Get number of energy groups.
- property num_precursors
Get number of precursors.
- property scattering_order
Get Legendre scattering order.
- property sigma_a
Get absorption cross section.
- property sigma_f
Get fission cross section.
- property sigma_t
Get total cross section.