Skip to content

Commit

Permalink
Update default isotope mix to 50-50 DT with correct masses.
Browse files Browse the repository at this point in the history
Minor modifications to test cases. Relative differences are O(1e-4) level.

Precursor to refactor setting Ai, Aimp based on constants.ION_PROPERTIES. The refactor should now pass the tests.

PiperOrigin-RevId: 713340227
  • Loading branch information
jcitrin authored and Torax team committed Jan 8, 2025
1 parent f27552c commit b8866e1
Show file tree
Hide file tree
Showing 62 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion torax/config/plasma_composition.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class PlasmaComposition(
"""Configuration for the plasma composition."""

# amu of main ion (if multiple isotope, make average)
Ai: float = 2.5
Ai: float = 2.51505
# charge of main ion
Zi: float = 1.0
# needed for qlknn and fusion power
Expand Down
5 changes: 2 additions & 3 deletions torax/physics.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@

_trapz = jax.scipy.integrate.trapezoid

_DEUTERIUM_MASS_AMU = 2.014

# Many variable names in this file use scientific or mathematical notation, so
# disable pylint complaints.
# pylint: disable=invalid-name
Expand Down Expand Up @@ -485,7 +483,8 @@ def calculate_plh_scaling_factor(
)

# Scale to average isotope mass.
P_LH_hi_dens = P_LH_hi_dens_D * _DEUTERIUM_MASS_AMU / core_profiles.Ai
A_deuterium = constants.ION_PROPERTIES_DICT['D']['A']
P_LH_hi_dens = P_LH_hi_dens_D * A_deuterium / core_profiles.Ai

# Calculate low density branch of P_LH (in units of nref) from Eq 3 Ryter 2014
ne_min_P_LH = (
Expand Down
2 changes: 1 addition & 1 deletion torax/tests/physics.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ def test_calculate_plh_scaling_factor(self):
physics.calculate_plh_scaling_factor(geo, core_profiles)
)
expected_PLH_hi_dens = (
2.15 * 2**0.782 * 5**0.772 * 2**0.975 * 6**0.999 * (2.014 / 3)
2.15 * 2**0.782 * 5**0.772 * 2**0.975 * 6**0.999 * (2.0141 / 3)
)
expected_PLH_low_dens = 0.36 * 10**0.27 * 5**1.25 * 6**1.23 * 3**0.08
expected_ne_min_P_LH = 0.7 * 10**0.34 * 5**0.62 * 2.0**-0.95 * 3**0.4 / 10
Expand Down
Binary file modified torax/tests/test_data/test_all_transport_crank_nicolson.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_all_transport_fusion_qlknn.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_bohmgyrobohm_all.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_bootstrap.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_bremsstrahlung.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_bremsstrahlung_time_dependent_Zimp.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_cgmheat.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_changing_config_after.nc
Binary file not shown.
2 changes: 1 addition & 1 deletion torax/tests/test_data/test_changing_config_after.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
'runtime_params': {
'plasma_composition': {
# physical inputs
'Ai': 2.5, # amu of main ion (if multiple isotope, make average)
'Ai': 2.51505, # amu of main ion (bundled isotope average)
'Zeff': 1.8, # needed for qlknn and fusion power
# effective impurity charge state assumed for matching
# dilution=0.862.
Expand Down
Binary file modified torax/tests/test_data/test_changing_config_before.nc
Binary file not shown.
2 changes: 1 addition & 1 deletion torax/tests/test_data/test_changing_config_before.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
'runtime_params': {
'plasma_composition': {
# physical inputs
'Ai': 2.5, # amu of main ion (if multiple isotope, make average)
'Ai': 2.51505, # amu of main ion (bundled isotope average)
'Zeff': 1.6, # needed for qlknn and fusion power
# effective impurity charge state assumed for matching
# dilution=0.862.
Expand Down
Binary file modified torax/tests/test_data/test_chease.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_eqdsk.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_explicit.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_fixed_dt.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_fusion_power.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_implicit.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_implicit_short_optimizer.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_iterbaseline_mockup.nc
Binary file not shown.
2 changes: 1 addition & 1 deletion torax/tests/test_data/test_iterbaseline_mockup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
'runtime_params': {
'plasma_composition': {
# physical inputs
'Ai': 2.5, # amu of main ion (if multiple isotope, make average)
'Ai': 2.51505, # amu of main ion (bundled isotope average)
'Zeff': 1.74, # needed for qlknn and fusion power
# effective impurity charge state assumed for matching
# dilution=0.862
Expand Down
Binary file modified torax/tests/test_data/test_iterhybrid_mockup.nc
Binary file not shown.
2 changes: 1 addition & 1 deletion torax/tests/test_data/test_iterhybrid_mockup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
'runtime_params': {
'plasma_composition': {
# physical inputs
'Ai': 2.5, # amu of main ion (if multiple isotope, make average)
'Ai': 2.51505, # amu of main ion (bundled isotope average)
'Zeff': 1.6, # needed for qlknn and fusion power
# effective impurity charge state assumed for matching
# dilution=0.862.
Expand Down
Binary file modified torax/tests/test_data/test_iterhybrid_newton.nc
Binary file not shown.
2 changes: 1 addition & 1 deletion torax/tests/test_data/test_iterhybrid_newton.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
'runtime_params': {
'plasma_composition': {
# physical inputs
'Ai': 2.5, # amu of main ion (if multiple isotope, make average)
'Ai': 2.51505, # amu of main ion (bundled isotope average)
'Zeff': 1.6, # needed for qlknn and fusion power
# effective impurity charge state assumed for matching
# dilution=0.862.
Expand Down
Binary file modified torax/tests/test_data/test_iterhybrid_predictor_corrector.nc
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
'runtime_params': {
'plasma_composition': {
# physical inputs
'Ai': 2.5, # amu of main ion (if multiple isotope, make average)
'Ai': 2.51505, # amu of main ion (bundled isotope average)
'Zeff': 1.6, # needed for qlknn and fusion power
# effective impurity charge state assumed for matching
# dilution=0.862.
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
'runtime_params': {
'plasma_composition': {
# physical inputs
'Ai': 2.5, # amu of main ion (if multiple isotope, make average)
'Ai': 2.51505, # amu of main ion (bundled isotope average)
'Zeff': 1.6, # needed for qlknn and fusion power
# effective impurity charge state assumed for matching
# dilution=0.862.
Expand Down
Binary file not shown.
Binary file not shown.
Binary file modified torax/tests/test_data/test_iterhybrid_rampup.nc
Binary file not shown.
2 changes: 1 addition & 1 deletion torax/tests/test_data/test_iterhybrid_rampup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
'runtime_params': {
'plasma_composition': {
# physical inputs
'Ai': 2.5, # amu of main ion (if multiple isotope, make average)
'Ai': 2.51505, # amu of main ion (bundled isotope average)
'Zeff': 1.6, # needed for qlknn and fusion power
# effective impurity charge state assumed for matching
# dilution=0.862.
Expand Down
2 changes: 1 addition & 1 deletion torax/tests/test_data/test_iterhybrid_rampup_short.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
'runtime_params': {
'plasma_composition': {
# physical inputs
'Ai': 2.5, # amu of main ion (if multiple isotope, make average)
'Ai': 2.51505, # amu of main ion (bundled isotope average)
'Zeff': 1.6, # needed for qlknn and fusion power
# effective impurity charge state assumed for matching
# dilution=0.862.
Expand Down
Binary file modified torax/tests/test_data/test_ne_qlknn_deff_veff.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_ne_qlknn_defromchie.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_ohmic_power.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_particle_sources_cgm.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_particle_sources_constant.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_pc_method_ne.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_pedestal.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_prescribed_generic_current_source.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_prescribed_timedependent_ne.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_psi_and_heat.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_psi_heat_dens.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_psichease_ip_chease.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_psichease_ip_parameters.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_psichease_prescribed_johm.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_psichease_prescribed_jtot.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_psiequation.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_qei.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_qei_chease_highdens.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_qlknnheat.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_semiimplicit_convection.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_time_dependent_circular_geo.nc
Binary file not shown.
Binary file modified torax/tests/test_data/test_timedependence.nc
Binary file not shown.

0 comments on commit b8866e1

Please sign in to comment.