SAPPHIRE 1-in-N event fluence
Model API name: sapphire-1-in-n-event-fluence
SAPPHIRE 1-in-N event fluence model.
Version: v1
Model developer:
Model provision:
Model references:
External Input: trajectory
Input | Value |
---|---|
Model name |
sapre
sapre_upload
|
trajectory
|
Model result name | trajectory |
Quantity | trajectory |
Input group: sep / multiplicity: one
Input | Description | Valid values | Default | Quantity |
---|---|---|---|---|
lowestIonSpecies | Atomic number of the lightest ion. |
min: 1 max: 92 note: Must be less than highestIonSpecies |
1 | number |
highestIonSpecies | Atomic number of the heaviest ion. |
min: 1 max: 92 note: Must be greater than lowestIonSpecies |
92 | number |
eventFrequency | Event frequency. |
1=1 in 10 years 2=1 in 20 years 3=1 in 50 years 4=1 in 100 years 5=1 in 300 years 6=1 in 1000 years 7=1 in 10000 years |
4 | number |
dataSet | Dataset to use |
sapphire=SAPPHIRE sapphire-hex=SAPPHIRE-HEX |
sapphire | number |
geomagnetic shielding
Input | Description | Valid values | Default | Quantity |
---|---|---|---|---|
useGeomagneticShielding | Include geomagnetic shielding |
0=No 1=Yes |
0 | number |
arrivalDirection |
Specify arrival direction (only when using geomagnetic shielding).
Used if useGeomagneticShielding==1 |
0=All directions 1=Vertical only |
0 | number |
magnetosphereState |
State of the magnetosphere (only when using geomagnetic shielding).
Used if useGeomagneticShielding==1 |
0=Quiet 1=Stormy |
0 | number |
method |
Method (only when using geomagnetic shielding).
Used if useGeomagneticShielding==1 |
0=Stormer with eccentric dipole 1=Smart and Shea (1967) with IGRF 2=Stormer upgrade |
0 | number |
magneticFieldMoment |
Magnetic field moment.
Only when using geomagnetic shielding. Used if useGeomagneticShielding==1 |
0=McIlwain 1=Unchanged -1=CREME-86 -2=CREME-96 |
1 | number |
|
None
# coding=utf-8
import numpy as np
import matplotlib.pyplot as plt
from nom_client.nom_client import NoMClient
nom_client = NoMClient("SAPPHIRE 1-in-N event fluence example")
sapre_model_gto = nom_client.get_model('sapre')
sapre_model_gto.set_params(orbitType="GEN")
sapre_gto_result = nom_client.run_model(sapre_model_gto)
print(sapre_gto_result)
# Get the model specification from the server.
sapphire_model = nom_client.get_model('sapphire-1-in-n-event-fluence')
sapphire_model.set_external_input(external_input_name="trajectory", external_input=sapre_gto_result)
# Geomagnetic shielding
sapphire_results_no_geo_sheilding = nom_client.run_model(sapphire_model)
sapphire_model.set_params(useGeomagneticShielding=1)
sapphire_results_geo_sheilding = nom_client.run_model(sapphire_model)
sep_proton_spectrum_no_geo_sheilding = sapphire_results_no_geo_sheilding.get_model_result_by_name(result_name="sep_proton_spectrum")
differential_fluence_no_geo_sheilding = sep_proton_spectrum_no_geo_sheilding.get_variable_data(variable_name="differential_fluence")
sep_proton_spectrum_geo_sheilding = sapphire_results_geo_sheilding.get_model_result_by_name(result_name="sep_proton_spectrum")
differential_fluence_geo_sheilding = sep_proton_spectrum_geo_sheilding.get_variable_data(variable_name="differential_fluence")
energy = sep_proton_spectrum_no_geo_sheilding.get_variable_data(variable_name="energy")[0] # same energies with or without geo shielding
energy = np.array(energy)
fig, ax = plt.subplots()
flux_units = sep_proton_spectrum_no_geo_sheilding['differential_fluence'].units
for fl_data in [differential_fluence_no_geo_sheilding, differential_fluence_geo_sheilding]:
plt.loglog(energy, fl_data.T, '-', linewidth=2.0, markersize=12.0)
plt.rc('font', size=12)
plt.grid(True)
plt.legend(labels=["No shielding (default)", "Shielding"])
plt.xlabel("Energy")
plt.ylabel(f"Flux ({flux_units})")
plt.show()
# Datasets
datasets = ["sapphire", "sapphire-hex"]
dataset_labels = ["sapphire (default)", "sapphire-hex"]
flux_results_per_dataset = []
for dataset in datasets:
sapphire_model.set_params(dataSet=dataset)
results = nom_client.run_model(sapphire_model)
sep_proton_spectrum = results.get_model_result_by_name(result_name="sep_proton_spectrum")
flux = sep_proton_spectrum.get_variable_data(variable_name="differential_fluence")
flux_results_per_dataset.append(flux)
for fl_data in flux_results_per_dataset:
plt.loglog(energy, fl_data.T, '-', linewidth=2.0, markersize=12.0)
plt.rc('font', size=12)
plt.grid(True)
plt.legend(labels=dataset_labels)
plt.xlabel("Energy")
plt.ylabel(f"Flux ({flux_units})")
plt.show()
# Confience levels
event_frequencies = [1, 2, 3, 4, 5, 6, 7]
event_frequency_labels = ["1-in-10 years", "1-in-20 years", "1-in-50 years", "1-in-100 years", "1-in-300 years", "1-in-1000 years", "1-in-10000 years"]
flux_results_per_conflevel = []
for event_frequency in event_frequencies:
sapphire_model.set_params(eventFrequency=event_frequency)
results = nom_client.run_model(sapphire_model)
sep_proton_spectrum = results.get_model_result_by_name(result_name="sep_proton_spectrum")
flux = sep_proton_spectrum.get_variable_data(variable_name="differential_fluence")
flux_results_per_conflevel.append(flux)
for fl_data in flux_results_per_conflevel:
plt.loglog(energy, fl_data.T, '-', linewidth=2.0, markersize=12.0)
plt.rc('font', size=12)
plt.grid(True)
plt.legend(labels=event_frequency_labels)
plt.xlabel("Energy")
plt.ylabel(f"Flux ({flux_units})")
plt.show()
No references