Skip to content

Commit

Permalink
merged energy distributions
Browse files Browse the repository at this point in the history
  • Loading branch information
shimwell committed Aug 1, 2024
1 parent e860a74 commit 6feab5a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 20 deletions.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ keywords = ["python", "neutron", "fusion", "source", "openmc", "energy", "tokama
dependencies = [
"numpy>=1.9",
"matplotlib>=3.2.2",
"NeSST>=1.0.0"
"NeSST>=1.1.0"
]

[project.urls]
Expand All @@ -37,7 +37,7 @@ write_to = "src/_version.py"
tests = [
"pytest>=5.4.3",
"hypothesis",
"NeSST>=1.0.0"
"NeSST>=1.1.0"
]

[tool.setuptools]
Expand Down
16 changes: 6 additions & 10 deletions src/openmc_plasma_source/fuel_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,14 @@ def get_neutron_energy_distribution(

# DT, DD and TT reaction
else:
strength_DT = 1.0
strength_DD = nst.yield_from_dt_yield_ratio(
"dd", strength_DT, ion_temperature, fuel["D"], fuel["T"]
"DD", 1.0, ion_temperature, fuel["D"], fuel["T"]
)
strength_TT = nst.yield_from_dt_yield_ratio(
"tt", strength_DT, ion_temperature, fuel["D"], fuel["T"]
"TT", 1.0, ion_temperature, fuel["D"], fuel["T"]
)

total_strength = sum([strength_TT, strength_DD, strength_DT])
total_strength = sum([strength_TT, strength_DD, 1.0])

dNdE_TT = strength_TT * nst.dNdE_TT(E_pspec, ion_temperature)

Expand All @@ -200,9 +199,6 @@ def get_neutron_energy_distribution(
# normal could be done with Muir but in this case we have the mean and std dev from NeSST
# dt_source = openmc.stats.muir(e0=DTmean * 1e6, m_rat=5, kt=ion_temperature)

# todo look into combining distributions openmc.data.combine_distributions()
return {
"TT": [tt_source, strength_TT / total_strength],
"DD": [dd_source, strength_DD / total_strength],
"DT": [dt_source, strength_DT / total_strength],
}
openmc_univariate = [tt_source, dd_source, dt_source]
probabilities = [strength_TT / total_strength, strength_DD / total_strength, 1.0 / total_strength]
return openmc.data.combine_distributions(openmc_univariate, probabilities)
14 changes: 6 additions & 8 deletions src/openmc_plasma_source/point_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,14 @@ def fusion_point_source(

sources = []

energy_distributions, strengths = get_neutron_energy_distribution(
energy_distribution = get_neutron_energy_distribution(
ion_temperature=temperature, fuel=fuel
)

for energy_distribution, strength in zip(energy_distributions, strengths):
source = openmc.IndependentSource()
source.energy = energy_distribution
source.space = openmc.stats.Point(coordinate)
source.angle = openmc.stats.Isotropic()
source.strength = strength
sources.append(source)
source = openmc.IndependentSource()
source.energy = energy_distribution
source.space = openmc.stats.Point(coordinate)
source.angle = openmc.stats.Isotropic()
sources.append(source)

return sources

0 comments on commit 6feab5a

Please sign in to comment.