NeutroWater API
The easiest way to get started with NeutroWater is to look at the Example. NeutroWater includes a Python API that enables running the simulation and analyzing the results. The three public modules are listed and documented below:
Module | Usage |
---|---|
neutrowater.diffusing_neutrons |
Simulation set-up and running. |
neutrowater.post.plot |
Plotting neutron trajectories. |
neutrowater.post.measure |
Post simulation analysis on neutrons. |
neutrowater.diffusing_neutrons
This module provides a class to simulate the diffusion of neutrons in a medium.
Classes:
Name | Description |
---|---|
Parameters |
Class to store the parameters for the simulation. |
DiffusingNeutrons |
Class to simulate the diffusion of neutrons in a medium. |
DiffusingNeutrons
Class that simulates multiple neutrons from diffusing in a medium.
Parameters: |
|
---|
Source code in neutrowater/diffusing_neutrons.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
diffuse(nCollisions)
Let the neutrons diffuse in the medium.
Parameters: |
|
---|
Source code in neutrowater/diffusing_neutrons.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
|
Parameters
dataclass
Class to store the parameters for the simulation.
Parameters: |
|
---|
Source code in neutrowater/diffusing_neutrons.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
|
neutrowater.post.plot
This module provides a function to plot the trajectories of the neutrons.
Functions:
Name | Description |
---|---|
trajectories |
Show the trajectories of the neutrons. |
trajectories(diffusing_neutrons)
Show the trajectories of the neutrons.
Parameters: |
|
---|
Source code in neutrowater/post/plot.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
|
neutrowater.post.measure
This module provides a class to measure the properties of the neutrons.
Classes:
Name | Description |
---|---|
Measurer |
Class to measure the properties of the neutrons after the simulation. |
Measurer
Class to measure the properties of the neutrons after the simulation.
Methods:
Name | Description |
---|---|
positions |
Get the positions of the neutrons. |
energies |
Get the energies of the neutrons. |
number_total |
Get the total number of neutrons. |
number_escaped |
Get the number of neutrons that escaped the tank. |
number_thermal |
Get the number of neutrons that are thermalized. |
thermalize_positions |
Get the positions of the neutrons where their energy is thermal for the first time. |
thermalize_distances |
Get the distance of the neutrons where their energy is thermal for the first time. |
number_absorbed |
Get the number of neutrons that were absorbed. |
absorbed_positions |
Get the positions of the neutrons that were absorbed. |
absorbed_distances |
Get the distances of the neutrons that were absorbed. |
flux |
Get the flux of the neutrons at a given radius r. |
energy_spectrum |
Get the energy spectrum of the neutrons at a given radius r. |
energy_spectrum_escaped |
Get the energy spectrum of the neutrons that escaped the tank. |
number_above_energy |
Get the number of neutrons with energy above a given energy. |
Source code in neutrowater/post/measure.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
|
absorbed_distances()
Get the distances of the neutrons that were absorbed.
Returns: |
|
---|
Source code in neutrowater/post/measure.py
155 156 157 158 159 160 161 162 |
|
absorbed_positions()
Get the positions of the neutrons that were absorbed.
Returns: |
|
---|
Source code in neutrowater/post/measure.py
141 142 143 144 145 146 147 148 149 150 151 152 153 |
|
energies()
Get the energies of the neutrons.
Returns: |
|
---|
Source code in neutrowater/post/measure.py
50 51 52 53 54 55 56 57 58 |
|
energy_spectrum(r)
Get the energy spectrum of the neutrons at a given radius r.
Parameters: |
|
---|
Returns: |
|
---|
Source code in neutrowater/post/measure.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
|
energy_spectrum_escaped()
Get the energy spectrum of the neutrons that escaped the tank.
Returns: |
|
---|
Source code in neutrowater/post/measure.py
206 207 208 209 210 211 212 213 214 215 216 217 |
|
flux(r)
Get the flux of the neutrons at a given radius r.
Parameters: |
|
---|
Returns: |
|
---|
Source code in neutrowater/post/measure.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
|
number_above_energy(E)
Get the number of neutrons with energy above a given energy.
Parameters: |
|
---|
Returns: |
|
---|
Source code in neutrowater/post/measure.py
219 220 221 222 223 224 225 226 227 228 229 |
|
number_absorbed()
Get the number of neutrons that were absorbed.
Returns: |
|
---|
Source code in neutrowater/post/measure.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
number_escaped()
Get the number of neutrons that escaped the tank.
Returns: |
|
---|
Source code in neutrowater/post/measure.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
|
number_thermal()
Get the number of neutrons that are thermalized.
Returns: |
|
---|
Source code in neutrowater/post/measure.py
85 86 87 88 89 90 91 92 93 94 95 96 |
|
number_total()
Get the total number of neutrons.
Returns: |
|
---|
Source code in neutrowater/post/measure.py
60 61 62 63 64 65 66 67 |
|
positions()
Get the positions of the neutrons.
Returns: |
|
---|
Source code in neutrowater/post/measure.py
40 41 42 43 44 45 46 47 48 |
|
thermalize_distances()
Get the distance of the neutrons where their energy is thermal for the first time.
Returns: |
|
---|
Source code in neutrowater/post/measure.py
116 117 118 119 120 121 122 123 124 |
|
thermalize_positions()
Get the positions of the neutrons where their energy is thermal for the first time.
Returns: |
|
---|
Source code in neutrowater/post/measure.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
|