You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The package simply extends the default ```openmc.Source``` to provides additional functions that:
15
+
The package simply extends the default ```openmc.IndependentSourceBase``` to provides additional functions that:
16
16
17
17
- extract the positions, directions and energy of particles
18
-
- visualise an ```osp.SourceWithPlotting``` with respect to:
18
+
- visualise an ```openmc.IndependentSourceBase``` with respect to:
19
19
- direction
20
20
- energy
21
21
- position
22
22
23
+
Or just sample the with ```openmc.Model.sample_initial_particles```
24
+
23
25
# Example plots
24
26
25
27
Below are some basic examples, for more examples see the [examples folder](https://github.com/fusion-energy/openmc_source_plotter/tree/main/examples) for example usage scripts.
@@ -29,13 +31,13 @@ Below are some basic examples, for more examples see the [examples folder](https
29
31
30
32
```python
31
33
import openmc
32
-
import openmc_source_plotter # extends openmc.Source with plotting functions
34
+
import openmc_source_plotter # extends openmc.IndependentSource with plotting functions
33
35
34
36
# initialises a new source object
35
-
my_source = openmc.Source()
37
+
my_source = openmc.IndependentSource()
36
38
37
-
# sets the energy distribution to a Muir distribution neutrons for DT fusion neutrons
import openmc_source_plotter # extends openmc.Source with plotting functions
125
+
import openmc_source_plotter # extends openmc.IndependentSource with plotting functions
124
126
125
127
# initialises a new source object
126
-
my_source = openmc.Source()
128
+
my_source = openmc.IndependentSource()
127
129
128
130
# the distribution of radius is just a single value
129
131
radius = openmc.stats.Discrete([10], [1])
@@ -149,6 +151,39 @@ plot.show()
149
151
150
152

151
153
154
+
155
+
## Extract particle objects
156
+
157
+
A list of ```openmc.Particle``` objects can be obtained using ```model.sample_initial_particles()``` or ```openmc.SourceBase.sample_initial_particles()```
158
+
159
+
```python
160
+
import openmc
161
+
import openmc_source_plotter # extents openmc.Model with sample_initial_particles method
>>>[<SourceParticle: neutron at E=1.440285e+07 eV>, <SourceParticle: neutron at E=1.397691e+07 eV>, <SourceParticle: neutron at E=1.393681e+07 eV>, <SourceParticle: neutron at E=1.470896e+07 eV>, <SourceParticle: neutron at E=1.460563e+07 eV>, <SourceParticle: neutron at E=1.420684e+07 eV>, <SourceParticle: neutron at E=1.413932e+07 eV>, <SourceParticle: neutron at E=1.412428e+07 eV>, <SourceParticle: neutron at E=1.464779e+07 eV>, <SourceParticle: neutron at E=1.391648e+07 eV>]
180
+
181
+
print(particles[0].E)
182
+
>>>1.440285e+07
183
+
```
184
+
185
+
## Related packages
186
+
152
187
Tokamak sources can also be plotted using the [openmc-plasma-source](https://github.com/fusion-energy/openmc-plasma-source) package
0 commit comments