-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from fusion-energy/merging_energy_distributions
Improved energy distributions including DD, TT and DT reactions
- Loading branch information
Showing
22 changed files
with
1,145 additions
and
1,174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
from openmc_plasma_source import tokamak_convert_a_alpha_to_R_Z, tokamak_ion_temperature | ||
|
||
sample_size = 20000 | ||
minor_radius = 292.258 | ||
major_radius = 906 | ||
|
||
# create a sample of (a, alpha) coordinates | ||
a = np.random.random(sample_size) * minor_radius | ||
alpha = np.random.random(sample_size) * 2 * np.pi | ||
|
||
temperatures = tokamak_ion_temperature( | ||
r=a, | ||
mode="L", | ||
pedestal_radius=0.8 * minor_radius, | ||
ion_temperature_pedestal=6.09, | ||
ion_temperature_centre=45.9, | ||
ion_temperature_beta=2, | ||
ion_temperature_peaking_factor=8.06, | ||
ion_temperature_separatrix=0.1, | ||
major_radius=major_radius, | ||
) | ||
|
||
RZ = tokamak_convert_a_alpha_to_R_Z( | ||
a=a, | ||
alpha=alpha, | ||
shafranov_factor=0.44789, | ||
minor_radius=minor_radius, | ||
major_radius=major_radius, | ||
triangularity=0.270, | ||
elongation=1.557, | ||
) | ||
|
||
plt.scatter(RZ[0], RZ[1], c=temperatures) | ||
plt.gca().set_aspect("equal") | ||
plt.xlabel("R [cm]") | ||
plt.ylabel("Z [cm]") | ||
plt.colorbar(label="Ion temperature [eV]") | ||
|
||
plt.savefig("tokamak_source_ion_temperature.png") | ||
print("written tokamak_source_ion_temperature.png") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
from openmc_plasma_source import ( | ||
tokamak_ion_temperature, | ||
tokamak_convert_a_alpha_to_R_Z, | ||
tokamak_neutron_source_density, | ||
tokamak_ion_density, | ||
) | ||
|
||
sample_size = 20000 | ||
minor_radius = 292.258 | ||
major_radius = 906 | ||
mode = "L" | ||
ion_density_centre = 45.9 | ||
|
||
# create a sample of (a, alpha) coordinates | ||
a = np.random.random(sample_size) * minor_radius | ||
alpha = np.random.random(sample_size) * 2 * np.pi | ||
|
||
temperatures = tokamak_ion_temperature( | ||
r=a, | ||
mode=mode, | ||
pedestal_radius=0.8 * minor_radius, | ||
ion_temperature_pedestal=6.09, | ||
ion_temperature_centre=ion_density_centre, | ||
ion_temperature_beta=2, | ||
ion_temperature_peaking_factor=8.06, | ||
ion_temperature_separatrix=0.1, | ||
major_radius=major_radius, | ||
) | ||
|
||
densities = tokamak_ion_density( | ||
mode=mode, | ||
ion_density_centre=ion_density_centre, | ||
ion_density_peaking_factor=1, | ||
ion_density_pedestal=1.09e20, | ||
major_radius=major_radius, | ||
pedestal_radius=0.8 * minor_radius, | ||
ion_density_separatrix=3e19, | ||
r=a, | ||
) | ||
|
||
neutron_source_density = tokamak_neutron_source_density(densities, temperatures, "DD") | ||
|
||
RZ = tokamak_convert_a_alpha_to_R_Z( | ||
a=a, | ||
alpha=alpha, | ||
shafranov_factor=0.44789, | ||
minor_radius=minor_radius, | ||
major_radius=major_radius, | ||
triangularity=0.270, | ||
elongation=1.557, | ||
) | ||
|
||
plt.scatter(RZ[0], RZ[1], c=neutron_source_density) | ||
plt.gca().set_aspect("equal") | ||
plt.xlabel("R [cm]") | ||
plt.ylabel("Z [cm]") | ||
plt.colorbar(label="neutron source density") | ||
|
||
plt.savefig("tokamak_source_neutron_source_density.png") | ||
print("written tokamak_source_neutron_source_density.png") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
from openmc_plasma_source import ( | ||
tokamak_ion_temperature, | ||
tokamak_convert_a_alpha_to_R_Z, | ||
tokamak_neutron_source_density, | ||
tokamak_ion_density, | ||
) | ||
|
||
sample_size = 20000 | ||
minor_radius = 292.258 | ||
major_radius = 906 | ||
mode = "L" | ||
ion_density_centre = 45.9 | ||
|
||
# create a sample of (a, alpha) coordinates | ||
a = np.random.random(sample_size) * minor_radius | ||
alpha = np.random.random(sample_size) * 2 * np.pi | ||
|
||
temperatures = tokamak_ion_temperature( | ||
r=a, | ||
mode=mode, | ||
pedestal_radius=0.8 * minor_radius, | ||
ion_temperature_pedestal=6.09, | ||
ion_temperature_centre=ion_density_centre, | ||
ion_temperature_beta=2, | ||
ion_temperature_peaking_factor=8.06, | ||
ion_temperature_separatrix=0.1, | ||
major_radius=major_radius, | ||
) | ||
|
||
densities = tokamak_ion_density( | ||
mode=mode, | ||
ion_density_centre=ion_density_centre, | ||
ion_density_peaking_factor=1, | ||
ion_density_pedestal=1.09e20, | ||
major_radius=major_radius, | ||
pedestal_radius=0.8 * minor_radius, | ||
ion_density_separatrix=3e19, | ||
r=a, | ||
) | ||
|
||
neutron_source_density = tokamak_neutron_source_density(densities, temperatures, "DD") | ||
|
||
strengths = neutron_source_density / sum(neutron_source_density) | ||
|
||
RZ = tokamak_convert_a_alpha_to_R_Z( | ||
a=a, | ||
alpha=alpha, | ||
shafranov_factor=0.44789, | ||
minor_radius=minor_radius, | ||
major_radius=major_radius, | ||
triangularity=0.270, | ||
elongation=1.557, | ||
) | ||
|
||
plt.scatter(RZ[0], RZ[1], c=strengths) | ||
plt.gca().set_aspect("equal") | ||
plt.xlabel("R [cm]") | ||
plt.ylabel("Z [cm]") | ||
plt.colorbar(label="neutron emission strength") | ||
|
||
plt.savefig("tokamak_source_neutron_emission_strength.png") | ||
print("written tokamak_source_neutron_emission_strength.png") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.