Hii
I was trying to model a tokamak source using openmc_plasma_source utility in openmc and I added following lines to source definition as given in the test code (similar to tokamak_source.py in example folder of utility) to print neutron_source_density attributes as it is shown in graphs of the same.
data=my_plasma.neutron_source_density
print(data)
I got 1000 diff points denoting neutron density(/src/cm3/s), till this no issue.
but as soon as I re-run I got those 1000 points different. I calculated average of neutron source density in each case which differs by 1-3 percent. I don’ t understand that why this distribution nos. are changing, does’nt it should be same at every run when no change in any other input?
I am sorry if I asked something very trivial but I really have no idea.
I am putting here input code which I tried (changed tokamak_source.py file with my parameters)
import openmc
from openmc_plasma_source import TokamakSource
import openmc_plasma_source.plotting as plt2
import matplotlib.pyplot as plt
from matplotlib.colors import Normalize
import matplotlib as mpl
from matplotlib import cm
import numpy as np
minimal geometry
sphere_surface = openmc.Sphere(r=1000.0, boundary_type=“vacuum”)
cell = openmc.Cell(region=-sphere_surface)
geometry = openmc.Geometry([cell])
create a plasma source
my_plasma = TokamakSource(
elongation=2,
ion_density_centre=1.78e20,
ion_density_peaking_factor=1,
ion_density_pedestal=1.78e20,
ion_density_separatrix=3e19,
ion_temperature_centre=45.9,
ion_temperature_centre=4.71,
ion_temperature_centre=45.9,
ion_temperature_peaking_factor=8.06,
ion_temperature_pedestal=6.09,
ion_temperature_pedestal=0.427,
ion_temperature_pedestal=6.09,
ion_temperature_separatrix=0.1,
major_radius=9.06,
minor_radius=2.92258,
major_radius=150,
minor_radius=90,
pedestal_radius=0.8 * 90,
mode="H",
shafranov_factor=0.44789,
triangularity=0.270,
triangularity=0.5,
ion_temperature_beta=4,
ion_temperature_beta=3.86,
)
Tell OpenMC we’re going to use our custom source
settings = openmc.Settings()
settings.run_mode = “fixed source”
settings.batches = 10
settings.particles = 1000
settings.source = my_plasma.sources
model = openmc.model.Model(
materials=None, geometry=geometry, settings=settings
)
model.run()
data=my_plasma.neutron_source_density
print(data)
create a figure and axis
fig, ax = plt.subplots()
plot the tokamak source with a color scale
norm = Normalize()
scatter = plt2.scatter_tokamak_source(my_plasma, quantity=“neutron_source_density”, ax=ax, cmap=‘viridis’, norm=norm)
create a ScalarMappable object for the colorbar
sm = plt.cm.ScalarMappable(cmap=‘viridis’, norm=norm )
#sm = plt.cm.ScalarMappable(cmap=‘viridis’)
sm.set_array()
add a colorbar
plt.colorbar(sm, ax=ax, label=‘Neutron Source Density [per cm^3/s]’)
show the plot
plt.show()
plt2.plot_tokamak_source_3D(my_plasma, quantity=“neutron_source_density”)
show the plot
plt.show()
data=my_plasma.neutron_source_density
print(data)