Skip to content

Commit

Permalink
commented out plotly part of examples
Browse files Browse the repository at this point in the history
  • Loading branch information
shimwell committed Mar 8, 2024
1 parent 5520c3f commit da849c8
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ jobs:
python examples/point_source_example.py
python examples/ring_source_example.py
python examples/tokamak_source_example.py
python examples/plot_tokamak_ion_temperature.py
python examples/plot_tokamak_neutron_source_density.py
python examples/plot_tokamak_neutron_source_strengths.py
25 changes: 16 additions & 9 deletions examples/point_source_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
import numpy as np

import openmc
from openmc_source_plotter import plot_source_energy

from openmc_plasma_source import fusion_point_source

# just making use of a local cross section xml file, replace with your own cross sections or comment out
Expand All @@ -28,11 +26,20 @@
settings.particles = 1000
settings.source = my_source

model = openmc.model.Model(materials=None, geometry=geometry, settings=settings)

plot = plot_source_energy(
this=settings,
n_samples=100000,
energy_bins=np.linspace(0, 16e6, 1000),
yaxis_type="log",
)
plot.show()
model.run()


# optionally if you would like to plot the energy of particles then another package can be used
# https://github.com/fusion-energy/openmc_source_plotter

# from openmc_source_plotter import plot_source_energy

# plot = plot_source_energy(
# this=settings,
# n_samples=1000000, # increase this value for a smoother plot
# energy_bins=np.linspace(0, 16e6, 1000),
# yaxis_type="log",
# )
# plot.show()
14 changes: 13 additions & 1 deletion examples/ring_source_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from pathlib import Path

import openmc

from openmc_plasma_source import fusion_ring_source

# just making use of a local cross section xml file, replace with your own cross sections or comment out
Expand Down Expand Up @@ -31,3 +30,16 @@
model = openmc.model.Model(materials=None, geometry=geometry, settings=settings)

model.run()


# optionally if you would like to plot the location of particles then another package can be used
# https://github.com/fusion-energy/openmc_source_plotter

# from openmc_source_plotter import plot_source_position

# plot = plot_source_position(
# this=settings,
# n_samples = 2000,
# )

# plot.show()
21 changes: 17 additions & 4 deletions examples/tokamak_source_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


# minimal geometry
sphere_surface = openmc.Sphere(r=1000.0, boundary_type="vacuum")
sphere_surface = openmc.Sphere(r=100000.0, boundary_type="vacuum")
cell = openmc.Cell(region=-sphere_surface)
geometry = openmc.Geometry([cell])

Expand All @@ -24,9 +24,9 @@
ion_temperature_peaking_factor=8.06,
ion_temperature_pedestal=6.09,
ion_temperature_separatrix=0.1,
major_radius=9.06,
minor_radius=2.92258,
pedestal_radius=0.8 * 2.92258,
major_radius=906,
minor_radius=292.258,
pedestal_radius=0.8 * 292.258,
mode="H",
shafranov_factor=0.44789,
triangularity=0.270,
Expand All @@ -45,3 +45,16 @@
model = openmc.model.Model(materials=None, geometry=geometry, settings=settings)

model.run()


# optionally if you would like to plot the direction of particles then another package can be used
# https://github.com/fusion-energy/openmc_source_plotter

# from openmc_source_plotter import plot_source_direction

# plot = plot_source_direction(
# this=settings,
# n_samples=200
# )

# plot.show()

0 comments on commit da849c8

Please sign in to comment.