mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Enable from_njoy methods to use evaluation from ENDF tape containing multiple
materials
This commit is contained in:
parent
4841345570
commit
08fd6b9cb1
3 changed files with 34 additions and 9 deletions
|
|
@ -791,16 +791,19 @@ class IncidentNeutron(EqualityMixin):
|
|||
return data
|
||||
|
||||
@classmethod
|
||||
def from_njoy(cls, filename, temperatures=None, **kwargs):
|
||||
def from_njoy(cls, filename, temperatures=None, evaluation=None, **kwargs):
|
||||
"""Generate incident neutron data by running NJOY.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
filename : str
|
||||
Path to ENDF evaluation
|
||||
Path to ENDF file
|
||||
temperatures : iterable of float
|
||||
Temperatures in Kelvin to produce data at. If omitted, data is
|
||||
produced at room temperature (293.6 K)
|
||||
evaluation : openmc.data.endf.Evaluation, optional
|
||||
If the ENDF file contains multiple material evaluations, this
|
||||
argument indicates which evaluation to use.
|
||||
**kwargs
|
||||
Keyword arguments passed to :func:`openmc.data.njoy.make_ace`
|
||||
|
||||
|
|
@ -815,6 +818,7 @@ class IncidentNeutron(EqualityMixin):
|
|||
ace_file = os.path.join(tmpdir, 'ace')
|
||||
xsdir_file = os.path.join(tmpdir, 'xsdir')
|
||||
pendf_file = os.path.join(tmpdir, 'pendf')
|
||||
kwargs['evaluation'] = evaluation
|
||||
make_ace(filename, temperatures, ace_file, xsdir_file,
|
||||
pendf_file, **kwargs)
|
||||
|
||||
|
|
@ -825,7 +829,7 @@ class IncidentNeutron(EqualityMixin):
|
|||
data.add_temperature_from_ace(table)
|
||||
|
||||
# Add fission energy release data
|
||||
ev = Evaluation(filename)
|
||||
ev = evaluation if evaluation is not None else Evaluation(filename)
|
||||
if (1, 458) in ev.section:
|
||||
data.fission_energy = FissionEnergyRelease.from_endf(ev, data)
|
||||
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ def make_pendf(filename, pendf='pendf', error=0.001, stdout=False):
|
|||
|
||||
def make_ace(filename, temperatures=None, ace='ace', xsdir='xsdir', pendf=None,
|
||||
error=0.001, broadr=True, heatr=True, gaspr=True, purr=True,
|
||||
acer=True, **kwargs):
|
||||
acer=True, evaluation=None, **kwargs):
|
||||
"""Generate incident neutron ACE file from an ENDF file
|
||||
|
||||
Parameters
|
||||
|
|
@ -245,6 +245,9 @@ def make_ace(filename, temperatures=None, ace='ace', xsdir='xsdir', pendf=None,
|
|||
Indicating whether to add probability table when running NJOY
|
||||
acer : bool, optional
|
||||
Indicating whether to generate ACE file when running NJOY
|
||||
evaluation : str, optional
|
||||
If the ENDF file contains multiple material evaluations, this argument
|
||||
indicates which evaluation should be used.
|
||||
**kwargs
|
||||
Keyword arguments passed to :func:`openmc.data.njoy.run`
|
||||
|
||||
|
|
@ -254,7 +257,7 @@ def make_ace(filename, temperatures=None, ace='ace', xsdir='xsdir', pendf=None,
|
|||
If the NJOY process returns with a non-zero status
|
||||
|
||||
"""
|
||||
ev = endf.Evaluation(filename)
|
||||
ev = evaluation if evaluation is not None else endf.Evaluation(filename)
|
||||
mat = ev.material
|
||||
zsymam = ev.target['zsymam']
|
||||
|
||||
|
|
@ -352,7 +355,8 @@ def make_ace(filename, temperatures=None, ace='ace', xsdir='xsdir', pendf=None,
|
|||
|
||||
|
||||
def make_ace_thermal(filename, filename_thermal, temperatures=None,
|
||||
ace='ace', xsdir='xsdir', error=0.001, **kwargs):
|
||||
ace='ace', xsdir='xsdir', error=0.001, evaluation=None,
|
||||
evaluation_thermal=None, **kwargs):
|
||||
"""Generate thermal scattering ACE file from ENDF files
|
||||
|
||||
Parameters
|
||||
|
|
@ -370,6 +374,12 @@ def make_ace_thermal(filename, filename_thermal, temperatures=None,
|
|||
Path of xsdir file to write
|
||||
error : float, optional
|
||||
Fractional error tolerance for NJOY processing
|
||||
evaluation : openmc.data.endf.Evaluation, optional
|
||||
If the ENDF neutron sublibrary file contains multiple material
|
||||
evaluations, this argument indicates which evaluation to use.
|
||||
evaluation_thermal : openmc.data.endf.Evaluation, optional
|
||||
If the ENDF thermal scattering sublibrary file contains multiple
|
||||
material evaluations, this argument indicates which evaluation to use.
|
||||
**kwargs
|
||||
Keyword arguments passed to :func:`openmc.data.njoy.run`
|
||||
|
||||
|
|
@ -379,11 +389,12 @@ def make_ace_thermal(filename, filename_thermal, temperatures=None,
|
|||
If the NJOY process returns with a non-zero status
|
||||
|
||||
"""
|
||||
ev = endf.Evaluation(filename)
|
||||
ev = evaluation if evaluation is not None else endf.Evaluation(filename)
|
||||
mat = ev.material
|
||||
zsymam = ev.target['zsymam']
|
||||
|
||||
ev_thermal = endf.Evaluation(filename_thermal)
|
||||
ev_thermal = (evaluation_thermal if evaluation_thermal is not None
|
||||
else endf.Evaluation(filename_thermal))
|
||||
mat_thermal = ev_thermal.material
|
||||
zsymam_thermal = ev_thermal.target['zsymam']
|
||||
|
||||
|
|
|
|||
|
|
@ -610,7 +610,8 @@ class ThermalScattering(EqualityMixin):
|
|||
return table
|
||||
|
||||
@classmethod
|
||||
def from_njoy(cls, filename, filename_thermal, temperatures=None, **kwargs):
|
||||
def from_njoy(cls, filename, filename_thermal, temperatures=None,
|
||||
evaluation=None, evaluation_thermal=None, **kwargs):
|
||||
"""Generate incident neutron data by running NJOY.
|
||||
|
||||
Parameters
|
||||
|
|
@ -623,6 +624,13 @@ class ThermalScattering(EqualityMixin):
|
|||
Temperatures in Kelvin to produce data at. If omitted, data is
|
||||
produced at all temperatures in the ENDF thermal scattering
|
||||
sublibrary.
|
||||
evaluation : openmc.data.endf.Evaluation, optional
|
||||
If the ENDF neutron sublibrary file contains multiple material
|
||||
evaluations, this argument indicates which evaluation to use.
|
||||
evaluation_thermal : openmc.data.endf.Evaluation, optional
|
||||
If the ENDF thermal scattering sublibrary file contains multiple
|
||||
material evaluations, this argument indicates which evaluation to
|
||||
use.
|
||||
**kwargs
|
||||
Keyword arguments passed to :func:`openmc.data.njoy.make_ace_thermal`
|
||||
|
||||
|
|
@ -636,6 +644,8 @@ class ThermalScattering(EqualityMixin):
|
|||
# Run NJOY to create an ACE library
|
||||
ace_file = os.path.join(tmpdir, 'ace')
|
||||
xsdir_file = os.path.join(tmpdir, 'xsdir')
|
||||
kwargs['evaluation'] = evaluation
|
||||
kwargs['evaluation_thermal'] = evaluation_thermal
|
||||
make_ace_thermal(filename, filename_thermal, temperatures,
|
||||
ace_file, xsdir_file, **kwargs)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue