From 8e056a85f83ac2d94b51424e43c62d76d729fa2d Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 8 May 2025 13:26:23 +0100 Subject: [PATCH 01/37] :memo: Add guidelines for fusion rates and fusion rate densities in style guide --- .../proc-pages/development/standards.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/documentation/proc-pages/development/standards.md b/documentation/proc-pages/development/standards.md index ad35016833..37510e03b5 100644 --- a/documentation/proc-pages/development/standards.md +++ b/documentation/proc-pages/development/standards.md @@ -385,6 +385,23 @@ The above is concurrent with that of general efficiencies given [below](#efficie -------------- + +##### Fusion rates + +- Fusion rates should start with the `fusrat_` prefix. + +This should be used for units of reactions per second. + +--------------------- + +##### Fusion rate densities + +- Fusion rate densities should start with the `fusden_` prefix. + +This should be used for units of reactions per cubic metre, per second ($\text{reactions} \ \text{m}^{-3}\text{s}^{-1}$). + +--------------------- + ##### Variables representing fractions If a variable is intended to demonstrate a fraction of a value or distribution etc. Then it should start with the `f_` prefix. From 8c4e0b4d4474feddf5856678e15dfb9bc8e53a3b Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 8 May 2025 13:37:42 +0100 Subject: [PATCH 02/37] =?UTF-8?q?=F0=9F=94=84=20Rename=20fusion=5Fpower=20?= =?UTF-8?q?to=20p=5Ffusion=5Ftotal=5Fmw?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../proc-pages/development/add-vars.md | 8 ++-- .../proc-pages/development/standards.md | 4 +- .../data/csv_output_large_tokamak_MFILE.DAT | 12 ++--- examples/data/large_tokamak_1_MFILE.DAT | 12 ++--- examples/data/large_tokamak_2_MFILE.DAT | 12 ++--- examples/data/large_tokamak_3_MFILE.DAT | 12 ++--- examples/data/large_tokamak_4_MFILE.DAT | 12 ++--- examples/data/large_tokamak_nof_2_MFILE.DAT | 12 ++--- examples/data/large_tokamak_nof_MFILE.DAT | 12 ++--- examples/scan.ipynb | 4 +- process/availability.py | 6 +-- process/costs.py | 2 +- process/costs_2015.py | 10 ++-- process/current_drive.py | 2 +- process/evaluators.py | 2 +- process/fusion_reactions.py | 8 ++-- process/hcpb.py | 24 +++++----- process/ife.py | 24 ++++++---- process/io/mfile_comparison.py | 8 ++-- process/io/plot_proc.py | 4 +- process/io/sankey_funcs.py | 18 ++++--- process/io/variable_metadata.py | 2 +- process/objectives.py | 2 +- process/physics.py | 8 ++-- process/power.py | 20 ++++---- process/stellarator.py | 4 +- process/vacuum.py | 4 +- source/fortran/constraint_equations.f90 | 8 ++-- source/fortran/physics_variables.f90 | 2 +- .../data/large_tokamak_1_MFILE.DAT | 12 ++--- .../data/large_tokamak_2_MFILE.DAT | 12 ++--- .../data/large_tokamak_3_MFILE.DAT | 12 ++--- .../data/large_tokamak_4_MFILE.DAT | 12 ++--- .../integration/data/large_tokamak_MFILE.DAT | 12 ++--- .../input_files/st_regression.IN.DAT | 2 +- tests/unit/test_availability.py | 2 +- tests/unit/test_ccfe_hcpb.py | 48 +++++++++++-------- tests/unit/test_costs_1990.py | 16 ++++--- tests/unit/test_costs_2015.py | 10 ++-- tests/unit/test_fusion_reactions.py | 6 ++- tests/unit/test_ife.py | 6 +-- tests/unit/test_power.py | 10 ++-- tests/unit/test_vacuum.py | 2 +- tracking/tracking_data.py | 2 +- 44 files changed, 226 insertions(+), 196 deletions(-) diff --git a/documentation/proc-pages/development/add-vars.md b/documentation/proc-pages/development/add-vars.md index fea2ffb10f..24a1c6ea1c 100644 --- a/documentation/proc-pages/development/add-vars.md +++ b/documentation/proc-pages/development/add-vars.md @@ -247,15 +247,15 @@ Constraint equations are added to *PROCESS* in the following way: !! Logic change during pre-factoring: err, symbol, units will be assigned only if present. !! ffuspow : input real : f-value for maximum fusion power !! powfmax : input real : maximum fusion power (MW) - !! fusion_power : input real : fusion power (MW) + !! p_fusion_total_mw : input real : fusion power (MW) use constraint_variables, only: ffuspow, powfmax - use physics_variables, only: fusion_power + use physics_variables, only: p_fusion_total_mw implicit none type (constraint_args_type), intent(out) :: args - args%cc = 1.0D0 - ffuspow * powfmax/fusion_power + args%cc = 1.0D0 - ffuspow * powfmax/p_fusion_total_mw args%con = powfmax * (1.0D0 - args%cc) - args%err = fusion_power * args%cc + args%err = p_fusion_total_mw * args%cc args%symbol = '<' args%units = 'MW' diff --git a/documentation/proc-pages/development/standards.md b/documentation/proc-pages/development/standards.md index 37510e03b5..ce008c8e38 100644 --- a/documentation/proc-pages/development/standards.md +++ b/documentation/proc-pages/development/standards.md @@ -449,7 +449,7 @@ Inside PROCESS all variables should be in SI units unless otherwise stated. For ```fortran ! Fusion power [W] -fusion_power = 1000.0d6 +p_fusion_total = 1000.0d6 ``` If a variable is not in SI units then its units should be put at the end of of the variable name. @@ -457,7 +457,7 @@ Example: ```fortran ! Fusion power [MW] -fusion_power_MW = 1000.0d0 +p_fusion_total_mw = 1000.0d0 ``` !!! note diff --git a/examples/data/csv_output_large_tokamak_MFILE.DAT b/examples/data/csv_output_large_tokamak_MFILE.DAT index e39a595edf..6360e8cd10 100644 --- a/examples/data/csv_output_large_tokamak_MFILE.DAT +++ b/examples/data/csv_output_large_tokamak_MFILE.DAT @@ -415,7 +415,7 @@ Greenwald_model_________________________________________________________ (dlimit(7))___________________ 7.4748E+19 OP Deuterium_fuel_fraction_________________________________________________ (fdeut)_______________________ 5.0000E-01 Tritium_fuel_fraction___________________________________________________ (ftrit)_______________________ 5.0000E-01 - Total_fusion_power_(MW)_________________________________________________ (powfmw)______________________ 1.5926E+03 OP + Total_fusion_power_(MW)_________________________________________________ (p_fusion_total_mw)______________________ 1.5926E+03 OP _=____D-T_fusion_power_(MW)_____________________________________________ (pdt)_________________________ 1.5907E+03 OP __+___D-D_fusion_power_(MW)_____________________________________________ (pdd)_________________________ 1.8966E+00 OP __+_D-He3_fusion_power_(MW)_____________________________________________ (pdhe3)_______________________ 0.0000E+00 OP @@ -941,7 +941,7 @@ Blanket_line_density_(tonne/m2)_________________________________________ (x_blanket)___________________ 2.2911E+00 Unit_nuclear_heating_in_TF_coil_(W/GW)__________________________________ (tfc_nuc_heating)_____________ 1.3678E+04 Total_nuclear_heating_in_TF_coil_(MW)___________________________________ (ptfnuc.)_____________________ 2.1784E-02 - powfmw__________________________________________________________________ (powfmw.)_____________________ 1.5926E+03 + powfmw__________________________________________________________________ (p_fusion_total_mw.)_____________________ 1.5926E+03 total_mass_of_the_TF_coils_(kg)_________________________________________ (m_tf_coils_total)_______________________ 1.0511E+07 # Pumping for primary coolant (helium) # Pressure_drop_in_FW_and_blanket_coolant_incl._hx_and_pipes_(Pa)_________ (dp_he)_______________________ 5.5000E+05 @@ -1144,7 +1144,7 @@ Ohmic_heating_(MW)______________________________________________________ (p_plasma_ohmic_mw.)_____________________ 6.6172E-01 Injected_power_deposited_in_plasma_(MW)_________________________________ (p_hcd_injected_total_mw)______________________ 7.5213E+01 Total_(MW)______________________________________________________________ ______________________________ 3.7935E+02 - Fusion_power_(MW)_______________________________________________________ (powfmw)______________________ 1.5926E+03 + Fusion_power_(MW)_______________________________________________________ (p_fusion_total_mw)______________________ 1.5926E+03 Power_from_energy_multiplication_in_blanket_and_shield_(MW)_____________ (emultmw)_____________________ 3.0312E+02 Injected_power_(MW)_____________________________________________________ (p_hcd_injected_total_mw.)_____________________ 7.5213E+01 Ohmic_power_(MW)________________________________________________________ (p_plasma_ohmic_mw.)_____________________ 6.6172E-01 @@ -1169,15 +1169,15 @@ Total_(MW)______________________________________________________________ (tot_plant_power)_____________ 8.5391E+02 Total_(MW)______________________________________________________________ ______________________________ 8.5391E+02 Gross_electrical_output*_(MW)___________________________________________ (pgrossmw)____________________ 8.5391E+02 - Fusion_power_(MW)_______________________________________________________ (powfmw)______________________ 1.5926E+03 + Fusion_power_(MW)_______________________________________________________ (p_fusion_total_mw)______________________ 1.5926E+03 Power_from_energy_multiplication_in_blanket_and_shield_(MW)_____________ (emultmw)_____________________ 3.0312E+02 Total_(MW)______________________________________________________________ ______________________________ 1.8958E+03 Net_electrical_output_(MW) _____________________________________________ (pnetelmw)____________________ 4.0000E+02 Heat_rejected_by_main_power_conversion_circuit_(MW)_____________________ (rejected_main)_______________ 1.2809E+03 Heat_rejected_by_other_cooling_circuits_(MW)____________________________ (psechtmw)____________________ 2.1566E+02 Total_(MW)______________________________________________________________ ______________________________ 1.8965E+03 - Net_electric_power_/_total_nuclear_power_(%)____________________________ (pnetelmw/(powfmw+emultmw)____ 2.1100E+01 - Net_electric_power_/_total_fusion_power_(%)_____________________________ (pnetelmw/powfmw)_____________ 2.5116E+01 + Net_electric_power_/_total_nuclear_power_(%)____________________________ (pnetelmw/(p_fusion_total_mw+emultmw)____ 2.1100E+01 + Net_electric_power_/_total_fusion_power_(%)_____________________________ (pnetelmw/p_fusion_total_mw)_____________ 2.5116E+01 Gross_electric_power*_/_high_grade_heat_(%)_____________________________ (etath)_______________________ 4.0000E+01 Recirculating_power_fraction____________________________________________ (cirpowfr)____________________ 5.3156E-01 # Water usage during plant operation (secondary cooling) # diff --git a/examples/data/large_tokamak_1_MFILE.DAT b/examples/data/large_tokamak_1_MFILE.DAT index 9c7161a03e..be83abfbeb 100644 --- a/examples/data/large_tokamak_1_MFILE.DAT +++ b/examples/data/large_tokamak_1_MFILE.DAT @@ -416,7 +416,7 @@ Greenwald_model_________________________________________________________ (dlimit(7))___________________ 7.4445E+19 OP Deuterium_fuel_fraction_________________________________________________ (fdeut)_______________________ 5.0000E-01 Tritium_fuel_fraction___________________________________________________ (ftrit)_______________________ 5.0000E-01 - Total_fusion_power_(MW)_________________________________________________ (powfmw)______________________ 1.6202E+03 OP + Total_fusion_power_(MW)_________________________________________________ (p_fusion_total_mw)______________________ 1.6202E+03 OP _=____D-T_fusion_power_(MW)_____________________________________________ (pdt)_________________________ 1.6182E+03 OP __+___D-D_fusion_power_(MW)_____________________________________________ (pdd)_________________________ 1.9494E+00 OP __+_D-He3_fusion_power_(MW)_____________________________________________ (pdhe3)_______________________ 0.0000E+00 OP @@ -936,7 +936,7 @@ Blanket_line_density_(tonne/m2)_________________________________________ (x_blanket)___________________ 2.2911E+00 Unit_nuclear_heating_in_TF_coil_(W/GW)__________________________________ (tfc_nuc_heating)_____________ 1.4866E+04 Total_nuclear_heating_in_TF_coil_(MW)___________________________________ (ptfnuc.)_____________________ 2.4085E-02 - powfmw__________________________________________________________________ (powfmw.)_____________________ 1.6202E+03 + powfmw__________________________________________________________________ (p_fusion_total_mw.)_____________________ 1.6202E+03 total_mass_of_the_TF_coils_(kg)_________________________________________ (m_tf_coils_total)_______________________ 1.1424E+07 # Pumping for primary coolant (helium) # Pressure_drop_in_FW_and_blanket_coolant_incl._hx_and_pipes_(Pa)_________ (dp_he)_______________________ 5.5000E+05 @@ -1139,7 +1139,7 @@ Ohmic_heating_(MW)______________________________________________________ (p_plasma_ohmic_mw.)_____________________ 6.2284E-01 Injected_power_deposited_in_plasma_(MW)_________________________________ (p_hcd_injected_total_mw)______________________ 8.0143E+01 Total_(MW)______________________________________________________________ ______________________________ 3.8950E+02 - Fusion_power_(MW)_______________________________________________________ (powfmw)______________________ 1.6202E+03 + Fusion_power_(MW)_______________________________________________________ (p_fusion_total_mw)______________________ 1.6202E+03 Power_from_energy_multiplication_in_blanket_and_shield_(MW)_____________ (emultmw)_____________________ 3.0836E+02 Injected_power_(MW)_____________________________________________________ (p_hcd_injected_total_mw.)_____________________ 8.0143E+01 Ohmic_power_(MW)________________________________________________________ (p_plasma_ohmic_mw.)_____________________ 6.2284E-01 @@ -1164,15 +1164,15 @@ Total_(MW)______________________________________________________________ (tot_plant_power)_____________ 8.7006E+02 Total_(MW)______________________________________________________________ ______________________________ 8.7006E+02 Gross_electrical_output*_(MW)___________________________________________ (pgrossmw)____________________ 8.7006E+02 - Fusion_power_(MW)_______________________________________________________ (powfmw)______________________ 1.6202E+03 + Fusion_power_(MW)_______________________________________________________ (p_fusion_total_mw)______________________ 1.6202E+03 Power_from_energy_multiplication_in_blanket_and_shield_(MW)_____________ (emultmw)_____________________ 3.0836E+02 Total_(MW)______________________________________________________________ ______________________________ 1.9285E+03 Net_electrical_output_(MW) _____________________________________________ (pnetelmw)____________________ 4.0001E+02 Heat_rejected_by_main_power_conversion_circuit_(MW)_____________________ (rejected_main)_______________ 1.3051E+03 Heat_rejected_by_other_cooling_circuits_(MW)____________________________ (psechtmw)____________________ 2.2417E+02 Total_(MW)______________________________________________________________ ______________________________ 1.9293E+03 - Net_electric_power_/_total_nuclear_power_(%)____________________________ (pnetelmw/(powfmw+emultmw)____ 2.0741E+01 - Net_electric_power_/_total_fusion_power_(%)_____________________________ (pnetelmw/powfmw)_____________ 2.4689E+01 + Net_electric_power_/_total_nuclear_power_(%)____________________________ (pnetelmw/(p_fusion_total_mw+emultmw)____ 2.0741E+01 + Net_electric_power_/_total_fusion_power_(%)_____________________________ (pnetelmw/p_fusion_total_mw)_____________ 2.4689E+01 Gross_electric_power*_/_high_grade_heat_(%)_____________________________ (etath)_______________________ 4.0000E+01 Recirculating_power_fraction____________________________________________ (cirpowfr)____________________ 5.4025E-01 # Water usage during plant operation (secondary cooling) # diff --git a/examples/data/large_tokamak_2_MFILE.DAT b/examples/data/large_tokamak_2_MFILE.DAT index 2442618f69..b6ae7f6f3e 100644 --- a/examples/data/large_tokamak_2_MFILE.DAT +++ b/examples/data/large_tokamak_2_MFILE.DAT @@ -416,7 +416,7 @@ Greenwald_model_________________________________________________________ (dlimit(7))___________________ 7.4445E+19 OP Deuterium_fuel_fraction_________________________________________________ (fdeut)_______________________ 5.0000E-01 Tritium_fuel_fraction___________________________________________________ (ftrit)_______________________ 5.0000E-01 - Total_fusion_power_(MW)_________________________________________________ (powfmw)______________________ 1.6202E+03 OP + Total_fusion_power_(MW)_________________________________________________ (p_fusion_total_mw)______________________ 1.6202E+03 OP _=____D-T_fusion_power_(MW)_____________________________________________ (pdt)_________________________ 1.6182E+03 OP __+___D-D_fusion_power_(MW)_____________________________________________ (pdd)_________________________ 1.9494E+00 OP __+_D-He3_fusion_power_(MW)_____________________________________________ (pdhe3)_______________________ 0.0000E+00 OP @@ -936,7 +936,7 @@ Blanket_line_density_(tonne/m2)_________________________________________ (x_blanket)___________________ 2.2911E+00 Unit_nuclear_heating_in_TF_coil_(W/GW)__________________________________ (tfc_nuc_heating)_____________ 1.4866E+04 Total_nuclear_heating_in_TF_coil_(MW)___________________________________ (ptfnuc.)_____________________ 2.4085E-02 - powfmw__________________________________________________________________ (powfmw.)_____________________ 1.6202E+03 + powfmw__________________________________________________________________ (p_fusion_total_mw.)_____________________ 1.6202E+03 total_mass_of_the_TF_coils_(kg)_________________________________________ (m_tf_coils_total)_______________________ 1.1424E+07 # Pumping for primary coolant (helium) # Pressure_drop_in_FW_and_blanket_coolant_incl._hx_and_pipes_(Pa)_________ (dp_he)_______________________ 5.5000E+05 @@ -1139,7 +1139,7 @@ Ohmic_heating_(MW)______________________________________________________ (p_plasma_ohmic_mw.)_____________________ 6.2284E-01 Injected_power_deposited_in_plasma_(MW)_________________________________ (p_hcd_injected_total_mw)______________________ 8.0143E+01 Total_(MW)______________________________________________________________ ______________________________ 3.8950E+02 - Fusion_power_(MW)_______________________________________________________ (powfmw)______________________ 1.6202E+03 + Fusion_power_(MW)_______________________________________________________ (p_fusion_total_mw)______________________ 1.6202E+03 Power_from_energy_multiplication_in_blanket_and_shield_(MW)_____________ (emultmw)_____________________ 3.0836E+02 Injected_power_(MW)_____________________________________________________ (p_hcd_injected_total_mw.)_____________________ 8.0143E+01 Ohmic_power_(MW)________________________________________________________ (p_plasma_ohmic_mw.)_____________________ 6.2284E-01 @@ -1164,15 +1164,15 @@ Total_(MW)______________________________________________________________ (tot_plant_power)_____________ 8.7006E+02 Total_(MW)______________________________________________________________ ______________________________ 8.7006E+02 Gross_electrical_output*_(MW)___________________________________________ (pgrossmw)____________________ 8.7006E+02 - Fusion_power_(MW)_______________________________________________________ (powfmw)______________________ 1.6202E+03 + Fusion_power_(MW)_______________________________________________________ (p_fusion_total_mw)______________________ 1.6202E+03 Power_from_energy_multiplication_in_blanket_and_shield_(MW)_____________ (emultmw)_____________________ 3.0836E+02 Total_(MW)______________________________________________________________ ______________________________ 1.9285E+03 Net_electrical_output_(MW) _____________________________________________ (pnetelmw)____________________ 4.0001E+02 Heat_rejected_by_main_power_conversion_circuit_(MW)_____________________ (rejected_main)_______________ 1.3051E+03 Heat_rejected_by_other_cooling_circuits_(MW)____________________________ (psechtmw)____________________ 2.2417E+02 Total_(MW)______________________________________________________________ ______________________________ 1.9293E+03 - Net_electric_power_/_total_nuclear_power_(%)____________________________ (pnetelmw/(powfmw+emultmw)____ 2.0741E+01 - Net_electric_power_/_total_fusion_power_(%)_____________________________ (pnetelmw/powfmw)_____________ 2.4689E+01 + Net_electric_power_/_total_nuclear_power_(%)____________________________ (pnetelmw/(p_fusion_total_mw+emultmw)____ 2.0741E+01 + Net_electric_power_/_total_fusion_power_(%)_____________________________ (pnetelmw/p_fusion_total_mw)_____________ 2.4689E+01 Gross_electric_power*_/_high_grade_heat_(%)_____________________________ (etath)_______________________ 4.0000E+01 Recirculating_power_fraction____________________________________________ (cirpowfr)____________________ 5.4025E-01 # Water usage during plant operation (secondary cooling) # diff --git a/examples/data/large_tokamak_3_MFILE.DAT b/examples/data/large_tokamak_3_MFILE.DAT index 8b0640a801..b81bb942f6 100644 --- a/examples/data/large_tokamak_3_MFILE.DAT +++ b/examples/data/large_tokamak_3_MFILE.DAT @@ -416,7 +416,7 @@ Greenwald_model_________________________________________________________ (dlimit(7))___________________ 7.4445E+19 OP Deuterium_fuel_fraction_________________________________________________ (fdeut)_______________________ 5.0000E-01 Tritium_fuel_fraction___________________________________________________ (ftrit)_______________________ 5.0000E-01 - Total_fusion_power_(MW)_________________________________________________ (powfmw)______________________ 1.6202E+03 OP + Total_fusion_power_(MW)_________________________________________________ (p_fusion_total_mw)______________________ 1.6202E+03 OP _=____D-T_fusion_power_(MW)_____________________________________________ (pdt)_________________________ 1.6182E+03 OP __+___D-D_fusion_power_(MW)_____________________________________________ (pdd)_________________________ 1.9494E+00 OP __+_D-He3_fusion_power_(MW)_____________________________________________ (pdhe3)_______________________ 0.0000E+00 OP @@ -936,7 +936,7 @@ Blanket_line_density_(tonne/m2)_________________________________________ (x_blanket)___________________ 2.2911E+00 Unit_nuclear_heating_in_TF_coil_(W/GW)__________________________________ (tfc_nuc_heating)_____________ 1.4866E+04 Total_nuclear_heating_in_TF_coil_(MW)___________________________________ (ptfnuc.)_____________________ 2.4085E-02 - powfmw__________________________________________________________________ (powfmw.)_____________________ 1.6202E+03 + powfmw__________________________________________________________________ (p_fusion_total_mw.)_____________________ 1.6202E+03 total_mass_of_the_TF_coils_(kg)_________________________________________ (m_tf_coils_total)_______________________ 1.1424E+07 # Pumping for primary coolant (helium) # Pressure_drop_in_FW_and_blanket_coolant_incl._hx_and_pipes_(Pa)_________ (dp_he)_______________________ 5.5000E+05 @@ -1139,7 +1139,7 @@ Ohmic_heating_(MW)______________________________________________________ (p_plasma_ohmic_mw.)_____________________ 6.2284E-01 Injected_power_deposited_in_plasma_(MW)_________________________________ (p_hcd_injected_total_mw)______________________ 8.0143E+01 Total_(MW)______________________________________________________________ ______________________________ 3.8950E+02 - Fusion_power_(MW)_______________________________________________________ (powfmw)______________________ 1.6202E+03 + Fusion_power_(MW)_______________________________________________________ (p_fusion_total_mw)______________________ 1.6202E+03 Power_from_energy_multiplication_in_blanket_and_shield_(MW)_____________ (emultmw)_____________________ 3.0836E+02 Injected_power_(MW)_____________________________________________________ (p_hcd_injected_total_mw.)_____________________ 8.0143E+01 Ohmic_power_(MW)________________________________________________________ (p_plasma_ohmic_mw.)_____________________ 6.2284E-01 @@ -1164,15 +1164,15 @@ Total_(MW)______________________________________________________________ (tot_plant_power)_____________ 8.7006E+02 Total_(MW)______________________________________________________________ ______________________________ 8.7006E+02 Gross_electrical_output*_(MW)___________________________________________ (pgrossmw)____________________ 8.7006E+02 - Fusion_power_(MW)_______________________________________________________ (powfmw)______________________ 1.6202E+03 + Fusion_power_(MW)_______________________________________________________ (p_fusion_total_mw)______________________ 1.6202E+03 Power_from_energy_multiplication_in_blanket_and_shield_(MW)_____________ (emultmw)_____________________ 3.0836E+02 Total_(MW)______________________________________________________________ ______________________________ 1.9285E+03 Net_electrical_output_(MW) _____________________________________________ (pnetelmw)____________________ 4.0001E+02 Heat_rejected_by_main_power_conversion_circuit_(MW)_____________________ (rejected_main)_______________ 1.3051E+03 Heat_rejected_by_other_cooling_circuits_(MW)____________________________ (psechtmw)____________________ 2.2417E+02 Total_(MW)______________________________________________________________ ______________________________ 1.9293E+03 - Net_electric_power_/_total_nuclear_power_(%)____________________________ (pnetelmw/(powfmw+emultmw)____ 2.0741E+01 - Net_electric_power_/_total_fusion_power_(%)_____________________________ (pnetelmw/powfmw)_____________ 2.4689E+01 + Net_electric_power_/_total_nuclear_power_(%)____________________________ (pnetelmw/(p_fusion_total_mw+emultmw)____ 2.0741E+01 + Net_electric_power_/_total_fusion_power_(%)_____________________________ (pnetelmw/p_fusion_total_mw)_____________ 2.4689E+01 Gross_electric_power*_/_high_grade_heat_(%)_____________________________ (etath)_______________________ 4.0000E+01 Recirculating_power_fraction____________________________________________ (cirpowfr)____________________ 5.4025E-01 # Water usage during plant operation (secondary cooling) # diff --git a/examples/data/large_tokamak_4_MFILE.DAT b/examples/data/large_tokamak_4_MFILE.DAT index ef19c1f520..933600628d 100644 --- a/examples/data/large_tokamak_4_MFILE.DAT +++ b/examples/data/large_tokamak_4_MFILE.DAT @@ -416,7 +416,7 @@ Greenwald_model_________________________________________________________ (dlimit(7))___________________ 7.4445E+19 OP Deuterium_fuel_fraction_________________________________________________ (fdeut)_______________________ 5.0000E-01 Tritium_fuel_fraction___________________________________________________ (ftrit)_______________________ 5.0000E-01 - Total_fusion_power_(MW)_________________________________________________ (powfmw)______________________ 1.6202E+03 OP + Total_fusion_power_(MW)_________________________________________________ (p_fusion_total_mw)______________________ 1.6202E+03 OP _=____D-T_fusion_power_(MW)_____________________________________________ (pdt)_________________________ 1.6182E+03 OP __+___D-D_fusion_power_(MW)_____________________________________________ (pdd)_________________________ 1.9494E+00 OP __+_D-He3_fusion_power_(MW)_____________________________________________ (pdhe3)_______________________ 0.0000E+00 OP @@ -936,7 +936,7 @@ Blanket_line_density_(tonne/m2)_________________________________________ (x_blanket)___________________ 2.2911E+00 Unit_nuclear_heating_in_TF_coil_(W/GW)__________________________________ (tfc_nuc_heating)_____________ 1.4866E+04 Total_nuclear_heating_in_TF_coil_(MW)___________________________________ (ptfnuc.)_____________________ 2.4085E-02 - powfmw__________________________________________________________________ (powfmw.)_____________________ 1.6202E+03 + powfmw__________________________________________________________________ (p_fusion_total_mw.)_____________________ 1.6202E+03 total_mass_of_the_TF_coils_(kg)_________________________________________ (m_tf_coils_total)_______________________ 1.1424E+07 # Pumping for primary coolant (helium) # Pressure_drop_in_FW_and_blanket_coolant_incl._hx_and_pipes_(Pa)_________ (dp_he)_______________________ 5.5000E+05 @@ -1139,7 +1139,7 @@ Ohmic_heating_(MW)______________________________________________________ (p_plasma_ohmic_mw.)_____________________ 6.2284E-01 Injected_power_deposited_in_plasma_(MW)_________________________________ (p_hcd_injected_total_mw)______________________ 8.0143E+01 Total_(MW)______________________________________________________________ ______________________________ 3.8950E+02 - Fusion_power_(MW)_______________________________________________________ (powfmw)______________________ 1.6202E+03 + Fusion_power_(MW)_______________________________________________________ (p_fusion_total_mw)______________________ 1.6202E+03 Power_from_energy_multiplication_in_blanket_and_shield_(MW)_____________ (emultmw)_____________________ 3.0836E+02 Injected_power_(MW)_____________________________________________________ (p_hcd_injected_total_mw.)_____________________ 8.0143E+01 Ohmic_power_(MW)________________________________________________________ (p_plasma_ohmic_mw.)_____________________ 6.2284E-01 @@ -1164,15 +1164,15 @@ Total_(MW)______________________________________________________________ (tot_plant_power)_____________ 8.7006E+02 Total_(MW)______________________________________________________________ ______________________________ 8.7006E+02 Gross_electrical_output*_(MW)___________________________________________ (pgrossmw)____________________ 8.7006E+02 - Fusion_power_(MW)_______________________________________________________ (powfmw)______________________ 1.6202E+03 + Fusion_power_(MW)_______________________________________________________ (p_fusion_total_mw)______________________ 1.6202E+03 Power_from_energy_multiplication_in_blanket_and_shield_(MW)_____________ (emultmw)_____________________ 3.0836E+02 Total_(MW)______________________________________________________________ ______________________________ 1.9285E+03 Net_electrical_output_(MW) _____________________________________________ (pnetelmw)____________________ 4.0001E+02 Heat_rejected_by_main_power_conversion_circuit_(MW)_____________________ (rejected_main)_______________ 1.3051E+03 Heat_rejected_by_other_cooling_circuits_(MW)____________________________ (psechtmw)____________________ 2.2417E+02 Total_(MW)______________________________________________________________ ______________________________ 1.9293E+03 - Net_electric_power_/_total_nuclear_power_(%)____________________________ (pnetelmw/(powfmw+emultmw)____ 2.0741E+01 - Net_electric_power_/_total_fusion_power_(%)_____________________________ (pnetelmw/powfmw)_____________ 2.4689E+01 + Net_electric_power_/_total_nuclear_power_(%)____________________________ (pnetelmw/(p_fusion_total_mw+emultmw)____ 2.0741E+01 + Net_electric_power_/_total_fusion_power_(%)_____________________________ (pnetelmw/p_fusion_total_mw)_____________ 2.4689E+01 Gross_electric_power*_/_high_grade_heat_(%)_____________________________ (etath)_______________________ 4.0000E+01 Recirculating_power_fraction____________________________________________ (cirpowfr)____________________ 5.4025E-01 # Water usage during plant operation (secondary cooling) # diff --git a/examples/data/large_tokamak_nof_2_MFILE.DAT b/examples/data/large_tokamak_nof_2_MFILE.DAT index efc71406b7..bcdee1512e 100644 --- a/examples/data/large_tokamak_nof_2_MFILE.DAT +++ b/examples/data/large_tokamak_nof_2_MFILE.DAT @@ -287,7 +287,7 @@ Deuterium_fuel_fraction__________________________________________________ (f_deuterium)__________________ 5.00000000000000000e-01 Tritium_fuel_fraction____________________________________________________ (f_tritium)____________________ 5.00000000000000000e-01 3-Helium_fuel_fraction___________________________________________________ (f_helium3)____________________ 0.00000000000000000e+00 - Total_fusion_power_(MW)__________________________________________________ (fusion_power)_________________ 1.60956116199862254e+03 OP + Total_fusion_power_(MW)__________________________________________________ (p_fusion_total_mw)_________________ 1.60956116199862254e+03 OP Fusion_rate_density:_total_(particles/m3/sec)____________________________ (fusion_rate_density_total)____ 3.03874355943265088e+17 OP Fusion_rate_density:_plasma_(particles/m3/sec)___________________________ (fusion_rate_density_plasma)___ 3.03874355943265088e+17 OP D-T_fusion_power:_total_(MW)_____________________________________________ (dt_power_total)_______________ 1.60765157256174621e+03 OP @@ -898,7 +898,7 @@ Blanket_line_density_(tonne/m2)__________________________________________ (x_blanket)____________________ 2.29112070985279770e+00 Unit_nuclear_heating_in_TF_coil_(W/GW)___________________________________ (tfc_nuc_heating)______________ 1.49757126200645089e+04 Total_nuclear_heating_in_TF_coil_(MW)____________________________________ (ptfnuc.)______________________ 2.41043254065084651e-02 - fusion_power_____________________________________________________________ (fusion_power.)________________ 1.60956116199862254e+03 + fusion_power_____________________________________________________________ (p_fusion_total_mw.)________________ 1.60956116199862254e+03 total_mass_of_the_TF_coils_(kg)__________________________________________ (whttf)________________________ 1.15087108498561420e+07 # Pumping for primary coolant (helium) # Pressure_drop_in_FW_and_blanket_coolant_incl._hx_and_pipes_(Pa)__________ (dp_he)________________________ 5.50000000000000000e+05 @@ -1095,7 +1095,7 @@ Ohmic_heating_(MW)_______________________________________________________ (p_plasma_ohmic_mw.)___________ 6.88941757462895432e-01 OP Injected_power_deposited_in_plasma_(MW)__________________________________ (pinjmw)_______________________ 7.75278055722339587e+01 OP Total_(MW)_______________________________________________________________ _______________________________ 3.86898310614849436e+02 OP - Fusion_power_(MW)________________________________________________________ (fusion_power)_________________ 1.60956116199862254e+03 OP + Fusion_power_(MW)________________________________________________________ (p_fusion_total_mw)_________________ 1.60956116199862254e+03 OP Power_from_energy_multiplication_in_blanket_and_shield_(MW)______________ (emultmw)______________________ 3.05841320096784727e+02 OP Injected_power_(MW)______________________________________________________ (pinjmw.)______________________ 7.75278055722339587e+01 OP Ohmic_power_(MW)_________________________________________________________ (p_plasma_ohmic_mw.)___________ 6.88941757462895432e-01 OP @@ -1120,15 +1120,15 @@ Total_(MW)_______________________________________________________________ (tot_plant_power)______________ 8.67303641193163344e+02 OP Total_(MW)_______________________________________________________________ _______________________________ 8.67303641193163344e+02 OP Gross_electrical_output*_(MW)____________________________________________ (pgrossmw)_____________________ 8.67303641193163458e+02 OP - Fusion_power_(MW)________________________________________________________ (fusion_power)_________________ 1.60956116199862254e+03 OP + Fusion_power_(MW)________________________________________________________ (p_fusion_total_mw)_________________ 1.60956116199862254e+03 OP Power_from_energy_multiplication_in_blanket_and_shield_(MW)______________ (emultmw)______________________ 3.05841320096784727e+02 OP Total_(MW)_______________________________________________________________ _______________________________ 1.91540248209540732e+03 OP Net_electrical_output_(MW) ______________________________________________ (pnetelmw)_____________________ 3.88019059400626361e+02 OP Heat_rejected_by_main_power_conversion_circuit_(MW)______________________ (rejected_main)________________ 1.30095546178974519e+03 OP Heat_rejected_by_other_cooling_circuits_(MW)_____________________________ (psechtmw)_____________________ 2.27456408964308480e+02 OP Total_(MW)_______________________________________________________________ _______________________________ 1.91643093015468003e+03 OP - Net_electric_power_/_total_nuclear_power_(%)_____________________________ (pnetelmw/(fusion_power+emultmw)_ 2.02578342164484511e+01 OP - Net_electric_power_/_total_fusion_power_(%)______________________________ (pnetelmw/fusion_power)________ 2.41071335816040531e+01 OP + Net_electric_power_/_total_nuclear_power_(%)_____________________________ (pnetelmw/(p_fusion_total_mw+emultmw)_ 2.02578342164484511e+01 OP + Net_electric_power_/_total_fusion_power_(%)______________________________ (pnetelmw/p_fusion_total_mw)________ 2.41071335816040531e+01 OP Gross_electric_power*_/_high_grade_heat_(%)______________________________ (etath)________________________ 4.00000000000000000e+01 Recirculating_power_fraction_____________________________________________ (cirpowfr)_____________________ 5.52614515872639100e-01 OP # Water usage during plant operation (secondary cooling) # diff --git a/examples/data/large_tokamak_nof_MFILE.DAT b/examples/data/large_tokamak_nof_MFILE.DAT index cc5f3962ca..3d382bb178 100644 --- a/examples/data/large_tokamak_nof_MFILE.DAT +++ b/examples/data/large_tokamak_nof_MFILE.DAT @@ -360,7 +360,7 @@ Deuterium_fuel_fraction__________________________________________________ (f_deuterium)__________________ 5.00000000000000000e-01 Tritium_fuel_fraction____________________________________________________ (f_tritium)____________________ 5.00000000000000000e-01 3-Helium_fuel_fraction___________________________________________________ (f_helium3)____________________ 0.00000000000000000e+00 - Total_fusion_power_(MW)__________________________________________________ (fusion_power)_________________ 1.74333215950657041e+03 OP + Total_fusion_power_(MW)__________________________________________________ (p_fusion_total_mw)_________________ 1.74333215950657041e+03 OP Fusion_rate_density:_total_(particles/m3/sec)____________________________ (fusion_rate_density_total)____ 3.29182443497713664e+17 OP Fusion_rate_density:_plasma_(particles/m3/sec)___________________________ (fusion_rate_density_plasma)___ 3.29182443497713664e+17 OP D-T_fusion_power:_total_(MW)_____________________________________________ (dt_power_total)_______________ 1.74119261535816122e+03 OP @@ -972,7 +972,7 @@ Blanket_line_density_(tonne/m2)__________________________________________ (x_blanket)____________________ 2.29112070985279770e+00 Unit_nuclear_heating_in_TF_coil_(W/GW)___________________________________ (tfc_nuc_heating)______________ 1.26770718506122175e+04 Total_nuclear_heating_in_TF_coil_(MW)____________________________________ (ptfnuc.)______________________ 2.21003470455477559e-02 - fusion_power_____________________________________________________________ (fusion_power.)________________ 1.74333215950657041e+03 + fusion_power_____________________________________________________________ (p_fusion_total_mw.)________________ 1.74333215950657041e+03 total_mass_of_the_TF_coils_(kg)__________________________________________ (whttf)________________________ 9.74222449728861451e+06 # Pumping for primary coolant (helium) # Pressure_drop_in_FW_and_blanket_coolant_incl._hx_and_pipes_(Pa)__________ (dp_he)________________________ 5.50000000000000000e+05 @@ -1169,7 +1169,7 @@ Ohmic_heating_(MW)_______________________________________________________ (p_plasma_ohmic_mw.)___________ 6.76139747896948751e-01 OP Injected_power_deposited_in_plasma_(MW)__________________________________ (pinjmw)_______________________ 1.04987905826090795e+02 OP Total_(MW)_______________________________________________________________ _______________________________ 4.40026498969293129e+02 OP - Fusion_power_(MW)________________________________________________________ (fusion_power)_________________ 1.74333215950657041e+03 OP + Fusion_power_(MW)________________________________________________________ (p_fusion_total_mw)_________________ 1.74333215950657041e+03 OP Power_from_energy_multiplication_in_blanket_and_shield_(MW)______________ (emultmw)______________________ 3.31253773315707974e+02 OP Injected_power_(MW)______________________________________________________ (pinjmw.)______________________ 1.04987905826090795e+02 OP Ohmic_power_(MW)_________________________________________________________ (p_plasma_ohmic_mw.)___________ 6.76139747896948751e-01 OP @@ -1194,15 +1194,15 @@ Total_(MW)_______________________________________________________________ (tot_plant_power)______________ 9.45581590756014521e+02 OP Total_(MW)_______________________________________________________________ _______________________________ 9.45581590756014521e+02 OP Gross_electrical_output*_(MW)____________________________________________ (pgrossmw)_____________________ 9.45581590756014521e+02 OP - Fusion_power_(MW)________________________________________________________ (fusion_power)_________________ 1.74333215950657041e+03 OP + Fusion_power_(MW)________________________________________________________ (p_fusion_total_mw)_________________ 1.74333215950657041e+03 OP Power_from_energy_multiplication_in_blanket_and_shield_(MW)______________ (emultmw)______________________ 3.31253773315707974e+02 OP Total_(MW)_______________________________________________________________ _______________________________ 2.07458593282227821e+03 OP Net_electrical_output_(MW) ______________________________________________ (pnetelmw)_____________________ 4.04675729597187456e+02 OP Heat_rejected_by_main_power_conversion_circuit_(MW)______________________ (rejected_main)________________ 1.41837238613402178e+03 OP Heat_rejected_by_other_cooling_circuits_(MW)_____________________________ (psechtmw)_____________________ 2.52584620983478175e+02 OP Total_(MW)_______________________________________________________________ _______________________________ 2.07563273671468733e+03 OP - Net_electric_power_/_total_nuclear_power_(%)_____________________________ (pnetelmw/(fusion_power+emultmw)_ 1.95063372981934933e+01 OP - Net_electric_power_/_total_fusion_power_(%)______________________________ (pnetelmw/fusion_power)________ 2.32127725855597227e+01 OP + Net_electric_power_/_total_nuclear_power_(%)_____________________________ (pnetelmw/(p_fusion_total_mw+emultmw)_ 1.95063372981934933e+01 OP + Net_electric_power_/_total_fusion_power_(%)______________________________ (pnetelmw/p_fusion_total_mw)________ 2.32127725855597227e+01 OP Gross_electric_power*_/_high_grade_heat_(%)______________________________ (etath)________________________ 4.00000000000000000e+01 Recirculating_power_fraction_____________________________________________ (cirpowfr)_____________________ 5.72035101409239854e-01 OP # Water usage during plant operation (secondary cooling) # diff --git a/examples/scan.ipynb b/examples/scan.ipynb index 50696c1917..0cc03e1b02 100644 --- a/examples/scan.ipynb +++ b/examples/scan.ipynb @@ -215,7 +215,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": { "slideshow": { "slide_type": "subslide" @@ -294,7 +294,7 @@ " \"-f\",\n", " str(mfile_name),\n", " \"-yv\",\n", - " \"bt rmajor pnetelmw fusion_power capcost\",\n", + " \"bt rmajor pnetelmw p_fusion_total_mw capcost\",\n", " \"--outputdir\",\n", " str(output_dir),\n", " ]\n", diff --git a/process/availability.py b/process/availability.py index 5702e2fa7a..05f5c474ac 100644 --- a/process/availability.py +++ b/process/availability.py @@ -89,7 +89,7 @@ def avail(self, output: bool): # - all of the above and more leading to the dpa/fpy in EUROfer at the FW OMP # About a relatively "constant" reference point, we can reasonably assume they all equal to 1.0. ref_fusion_power = 2.0e3 # (MW) fusion power for EU-DEMO - f_scale = pv.fusion_power / ref_fusion_power + f_scale = pv.p_fusion_total_mw / ref_fusion_power ref_dpa_fpy = ( 10.0e0 # dpa per fpy from T. Franke 2020 states up to 10 dpa/FPY ) @@ -472,7 +472,7 @@ def calc_u_planned(self, output: bool) -> float: # - all of the above and more leading to the dpa/fpy in EUROfer at the FW OMP # About a relatively "constant" reference point, we can reasonably assume they all equal to 1.0. ref_fusion_power = 2.0e3 # (MW) fusion power for EU-DEMO - f_scale = pv.fusion_power / ref_fusion_power + f_scale = pv.p_fusion_total_mw / ref_fusion_power ref_dpa_fpy = 10.0e0 # dpa per fpy from T. Franke 2020 states up to 10 dpa/FPY dpa_fpy = f_scale * ref_dpa_fpy @@ -1045,7 +1045,7 @@ def avail_st(self, output: bool): """ ref_powfmw = 2.0e3 # (MW) fusion power for EU-DEMO - f_scale = pv.fusion_power / ref_powfmw + f_scale = pv.p_fusion_total_mw / ref_powfmw ref_dpa_fpy = 10.0e0 # dpa per fpy from T. Franke 2020 states up to 10 dpa/FPY dpa_fpy = f_scale * ref_dpa_fpy diff --git a/process/costs.py b/process/costs.py index a8dbc66222..2f60d1cc99 100644 --- a/process/costs.py +++ b/process/costs.py @@ -2473,7 +2473,7 @@ def acc26(self): # Calculate rejected heat for non-reactor (==0) and reactor (==1) if cost_variables.ireactor == 0: pwrrej = ( - physics_variables.fusion_power + physics_variables.p_fusion_total_mw + heat_transport_variables.p_hcd_electric_total_mw + tfcoil_variables.tfcmw ) diff --git a/process/costs_2015.py b/process/costs_2015.py index acaf3f7f61..3c9c1cfa56 100644 --- a/process/costs_2015.py +++ b/process/costs_2015.py @@ -1032,7 +1032,7 @@ def calc_remaining_subsystems(self): # Cost of ITER pellet injector and pellet injection system self.s_cref[46] = 25.0e6 # Scale with fusion power (MW) - self.s_k[46] = physics_variables.fusion_power + self.s_k[46] = physics_variables.p_fusion_total_mw self.s_kref[46] = 500.0e0 self.s_cost[46] = ( self.s_cost_factor[46] @@ -1044,7 +1044,7 @@ def calc_remaining_subsystems(self): # # Cost of ITER gas injection system, GDC, Gi valve boxes self.s_cref[47] = 32.0e6 # Scale with fusion power (MW) - self.s_k[47] = physics_variables.fusion_power + self.s_k[47] = physics_variables.p_fusion_total_mw self.s_kref[47] = 500.0e0 self.s_cost[47] = ( self.s_cost_factor[47] @@ -1056,7 +1056,7 @@ def calc_remaining_subsystems(self): # Cost of ITER vacuum pumping self.s_cref[48] = 201.0e6 # Scale with fusion power (MW) - self.s_k[48] = physics_variables.fusion_power + self.s_k[48] = physics_variables.p_fusion_total_mw self.s_kref[48] = 500.0e0 self.s_cost[48] = ( self.s_cost_factor[48] @@ -1068,7 +1068,7 @@ def calc_remaining_subsystems(self): # Cost of ITER tritium plant self.s_cref[49] = 226.0e6 # Scale with fusion power (MW) - self.s_k[49] = physics_variables.fusion_power + self.s_k[49] = physics_variables.p_fusion_total_mw self.s_kref[49] = 500.0e0 self.s_cost[49] = ( self.s_cost_factor[49] @@ -1128,7 +1128,7 @@ def calc_remaining_subsystems(self): # Cost of ITER radiological protection self.s_cref[54] = 19.0e6 # Scale with fusion power (MW) - self.s_k[54] = physics_variables.fusion_power + self.s_k[54] = physics_variables.p_fusion_total_mw self.s_kref[54] = 500.0e0 self.s_cost[54] = ( self.s_cost_factor[54] diff --git a/process/current_drive.py b/process/current_drive.py index e6e80f6f04..699afb51bb 100644 --- a/process/current_drive.py +++ b/process/current_drive.py @@ -1833,7 +1833,7 @@ def cudriv(self) -> None: heat_transport_variables.p_hcd_electric_total_mw = 0.0e0 # Ratio of fusion to input (injection+ohmic) power - current_drive_variables.bigq = physics_variables.fusion_power / ( + current_drive_variables.bigq = physics_variables.p_fusion_total_mw / ( current_drive_variables.p_hcd_injected_total_mw + current_drive_variables.p_beam_orbit_loss_mw + physics_variables.p_plasma_ohmic_mw diff --git a/process/evaluators.py b/process/evaluators.py index 8a0137ed7c..2552517607 100644 --- a/process/evaluators.py +++ b/process/evaluators.py @@ -68,7 +68,7 @@ def fcnvmc1(self, _n, m, xv, ifail): logger.debug(f"{pv.te = }") logger.debug(f"{cv.coe = }") logger.debug(f"{pv.rmajor = }") - logger.debug(f"{pv.fusion_power = }") + logger.debug(f"{pv.p_fusion_total_mw = }") logger.debug(f"{pv.bt = }") logger.debug(f"{tv.t_burn = }") logger.debug(f"{sqsumconfsq = }") diff --git a/process/fusion_reactions.py b/process/fusion_reactions.py index 7772163a5d..9a797ea4c7 100644 --- a/process/fusion_reactions.py +++ b/process/fusion_reactions.py @@ -713,7 +713,7 @@ def set_fusion_powers( - alpha_power_electron_density (float): Alpha power per unit volume to electrons [MW/m^3]. - alpha_power_ions_density (float): Alpha power per unit volume to ions [MW/m^3]. - charged_particle_power (float): Charged particle fusion power [MW]. - - fusion_power (float): Total fusion power [MW]. + - p_fusion_total_mw (float): Total fusion power [MW]. References: - N.A. Uckan and ITER Physics Group, 'ITER Physics Design Guidelines: 1989' @@ -762,7 +762,9 @@ def set_fusion_powers( charged_particle_power = alpha_power_total + non_alpha_charged_power # Total fusion power - fusion_power = alpha_power_total + neutron_power_total + non_alpha_charged_power + p_fusion_total_mw = ( + alpha_power_total + neutron_power_total + non_alpha_charged_power + ) # Alpha power to electrons and ions (used with electron # and ion power balance equations only) @@ -785,7 +787,7 @@ def set_fusion_powers( alpha_power_electron_density, alpha_power_ions_density, charged_particle_power, - fusion_power, + p_fusion_total_mw, ) diff --git a/process/hcpb.py b/process/hcpb.py index ad44d24bed..b58e0974ae 100644 --- a/process/hcpb.py +++ b/process/hcpb.py @@ -494,7 +494,7 @@ def nuclear_heating_magnets(self, output: bool): # Total heating (MW) fwbs_variables.ptfnuc = ( ccfe_hcpb_module.tfc_nuc_heating - * (physics_variables.fusion_power / 1000.0) + * (physics_variables.p_fusion_total_mw / 1000.0) / 1.0e6 ) @@ -526,9 +526,9 @@ def nuclear_heating_magnets(self, output: bool): ) po.ovarre( self.outfile, - "fusion_power", - "(fusion_power.)", - physics_variables.fusion_power, + "p_fusion_total_mw", + "(p_fusion_total_mw.)", + physics_variables.p_fusion_total_mw, ) po.ovarre( self.outfile, @@ -550,13 +550,13 @@ def nuclear_heating_fw(self): fwbs_variables.p_fw_nuclear_heat_total_mw = ( fwbs_variables.m_fw_total * ccfe_hcpb_module.fw_armour_u_nuc_heating - * physics_variables.fusion_power + * physics_variables.p_fusion_total_mw ) if fwbs_variables.p_fw_nuclear_heat_total_mw < 0: raise ProcessValueError( f"""Error in nuclear_heating_fw. {fwbs_variables.p_fw_nuclear_heat_total_mw = }, - {physics_variables.fusion_power = }, {fwbs_variables.m_fw_total = }""" + {physics_variables.p_fusion_total_mw = }, {fwbs_variables.m_fw_total = }""" ) def nuclear_heating_blanket(self): @@ -574,13 +574,13 @@ def nuclear_heating_blanket(self): # Total blanket nuclear heating (MW) ccfe_hcpb_module.exp_blanket = 1 - np.exp(-b * mass) fwbs_variables.p_blkt_nuclear_heat_total_mw = ( - physics_variables.fusion_power * a * ccfe_hcpb_module.exp_blanket + physics_variables.p_fusion_total_mw * a * ccfe_hcpb_module.exp_blanket ) if fwbs_variables.p_blkt_nuclear_heat_total_mw < 1: eh.fdiags[0] = fwbs_variables.p_blkt_nuclear_heat_total_mw eh.fdiags[1] = ccfe_hcpb_module.exp_blanket - eh.fdiags[2] = physics_variables.fusion_power + eh.fdiags[2] = physics_variables.p_fusion_total_mw eh.fdiags[3] = mass eh.report_error(274) @@ -621,7 +621,7 @@ def nuclear_heating_shield(self): # Total nuclear heating in shield (MW) fwbs_variables.pnucshld = ( ccfe_hcpb_module.shld_u_nuc_heating - * (physics_variables.fusion_power / 1000) + * (physics_variables.p_fusion_total_mw / 1000) / 1.0e6 ) @@ -643,14 +643,16 @@ def nuclear_heating_divertor(self): # Double null configuration fwbs_variables.p_div_nuclear_heat_total_mw = ( 0.8 - * physics_variables.fusion_power + * physics_variables.p_fusion_total_mw * 2 * fwbs_variables.f_ster_div_single ) else: # single null configuration fwbs_variables.p_div_nuclear_heat_total_mw = ( - 0.8 * physics_variables.fusion_power * fwbs_variables.f_ster_div_single + 0.8 + * physics_variables.p_fusion_total_mw + * fwbs_variables.f_ster_div_single ) # No heating of the H & CD diff --git a/process/ife.py b/process/ife.py index 6daa2aff69..4e5f340b90 100644 --- a/process/ife.py +++ b/process/ife.py @@ -1470,7 +1470,7 @@ def ifephy(self, output: bool = False): # Repetition rate (Hz) ife_variables.reprat = ife_variables.pdrive / ife_variables.edrive # Fusion power (MW) - physics_variables.fusion_power = ( + physics_variables.p_fusion_total_mw = ( 1.0e-6 * ife_variables.pdrive * ife_variables.gain ) else: @@ -1478,8 +1478,8 @@ def ifephy(self, output: bool = False): ife_variables.reprat = ife_variables.rrin ife_variables.pdrive = ife_variables.reprat * ife_variables.edrive # Gain - physics_variables.fusion_power = ife_variables.pfusife - ife_variables.gain = physics_variables.fusion_power / ( + physics_variables.p_fusion_total_mw = ife_variables.pfusife + ife_variables.gain = physics_variables.p_fusion_total_mw / ( 1.0e-6 * ife_variables.pdrive ) @@ -1491,7 +1491,10 @@ def ifephy(self, output: bool = False): phi = 0.5 * np.pi + np.arctan(ife_variables.zl1 / ife_variables.r1) sang = 1.0 - np.cos(phi) physics_variables.pflux_fw_neutron_mw = ( - physics_variables.fusion_power * 0.5 * sang / build_variables.a_fw_total + physics_variables.p_fusion_total_mw + * 0.5 + * sang + / build_variables.a_fw_total ) elif ife_variables.ifetyp == 4: @@ -1503,12 +1506,15 @@ def ifephy(self, output: bool = False): phi = np.arctan(ife_variables.flirad / ife_variables.zu1) sang = sang - (1.0 - np.cos(phi)) physics_variables.pflux_fw_neutron_mw = ( - physics_variables.fusion_power * 0.5 * sang / build_variables.a_fw_total + physics_variables.p_fusion_total_mw + * 0.5 + * sang + / build_variables.a_fw_total ) else: physics_variables.pflux_fw_neutron_mw = ( - physics_variables.fusion_power / build_variables.a_fw_total + physics_variables.p_fusion_total_mw / build_variables.a_fw_total ) if not output: @@ -1548,8 +1554,8 @@ def ifephy(self, output: bool = False): process_output.ovarre( self.outfile, "Fusion power (MW)", - "(fusion_power)", - physics_variables.fusion_power, + "(p_fusion_total_mw)", + physics_variables.p_fusion_total_mw, ) process_output.ovarre( self.outfile, @@ -1910,7 +1916,7 @@ def ifepw1(self): # Total thermal power removed from fusion core heat_transport_variables.priheat = ( - fwbs_variables.emult * physics_variables.fusion_power + fwbs_variables.emult * physics_variables.p_fusion_total_mw ) # Useful (high-grade) thermal power (MW) diff --git a/process/io/mfile_comparison.py b/process/io/mfile_comparison.py index d3cd5536b3..7893be84ff 100644 --- a/process/io/mfile_comparison.py +++ b/process/io/mfile_comparison.py @@ -57,7 +57,7 @@ "dr_shld_outboard", "dr_blkt_inboard", "dr_blkt_outboard", - "fusion_power", + "p_fusion_total_mw", "plasma_current_MA", "bt", "q95", @@ -110,7 +110,7 @@ "a_plasma_surface", "vol_plasma", "n_tf_coils", - "fusion_power", + "p_fusion_total_mw", "plasma_current_MA", "bt", "q95", @@ -196,7 +196,7 @@ BLANKET_COMPARE_PARAMS = [ "dr_blkt_inboard", "dr_blkt_outboard", - "fusion_power", + "p_fusion_total_mw", "p_blkt_nuclear_heat_total_mw", "p_fw_nuclear_heat_total_mw", "ptfnuc", @@ -216,7 +216,7 @@ "kappa95", "triang", "triang95", - "fusion_power", + "p_fusion_total_mw", "plasma_current_MA", "bt", "q95", diff --git a/process/io/plot_proc.py b/process/io/plot_proc.py index db23998112..74524d0746 100644 --- a/process/io/plot_proc.py +++ b/process/io/plot_proc.py @@ -2771,7 +2771,7 @@ def plot_physics_info(axis, mfile_data, scan): pthresh = mfile_data.data["l_h_threshold_powers(6)"].get_scan(scan) data = [ - ("fusion_power", "Fusion power", "MW"), + ("p_fusion_total_mw", "Fusion power", "MW"), ("bigq", "$Q_{p}$", ""), ("plasma_current_ma", "$I_p$", "MA"), ("bt", "Vacuum $B_T$ at $R_0$", "T"), @@ -2973,7 +2973,7 @@ def plot_power_info(axis, mfile_data, scan): plant_eff = 100.0 * ( mfile_data.data["pnetelmw"].get_scan(scan) - / mfile_data.data["fusion_power"].get_scan(scan) + / mfile_data.data["p_fusion_total_mw"].get_scan(scan) ) # Define appropriate pedestal and impurity parameters diff --git a/process/io/sankey_funcs.py b/process/io/sankey_funcs.py index f66585cf55..614be29f03 100644 --- a/process/io/sankey_funcs.py +++ b/process/io/sankey_funcs.py @@ -23,7 +23,9 @@ def plot_full_sankey( m_file = MFile(mfilename) # Used in [PLASMA] - fusion_power = m_file.data["fusion_power"].get_scan(-1) # Fusion power (MW) + p_fusion_total_mw = m_file.data["p_fusion_total_mw"].get_scan( + -1 + ) # Fusion power (MW) p_hcd_injected_total_mw = m_file.data["p_hcd_injected_total_mw"].get_scan( -1 ) # Total auxiliary injected power (MW) @@ -31,7 +33,7 @@ def plot_full_sankey( -1 ) # Ohmic heating power (MW) totalplasma = ( - fusion_power + p_hcd_injected_total_mw + p_plasma_ohmic_mw + p_fusion_total_mw + p_hcd_injected_total_mw + p_plasma_ohmic_mw ) # Total Power in plasma (MW) neutron_power_total = m_file.data["neutron_power_total"].get_scan( -1 @@ -134,7 +136,7 @@ def plot_full_sankey( # Fusion, Injected, Ohmic, -Charged P.-Ohmic, -Alphas-Injected, -Neutrons plasma = [ - fusion_power, + p_fusion_total_mw, p_hcd_injected_total_mw, p_plasma_ohmic_mw, -pcharohmmw, @@ -510,7 +512,9 @@ def plot_sankey(mfilename="MFILE.DAT"): # Plot simplified power flow Sankey Dia m_file = MFile(mfilename) # Used in [PLASMA] - fusion_power = m_file.data["fusion_power"].get_scan(-1) # Fusion Power (MW) + p_fusion_total_mw = m_file.data["p_fusion_total_mw"].get_scan( + -1 + ) # Fusion Power (MW) p_hcd_injected_total_mw = m_file.data["p_hcd_injected_total_mw"].get_scan( -1 ) # Total auxiliary injected Power (MW) @@ -518,7 +522,7 @@ def plot_sankey(mfilename="MFILE.DAT"): # Plot simplified power flow Sankey Dia -1 ) # Ohmic heating Power (MW) totalplasma = ( - fusion_power + p_hcd_injected_total_mw + p_plasma_ohmic_mw + p_fusion_total_mw + p_hcd_injected_total_mw + p_plasma_ohmic_mw ) # Total Power in plasma (MW) # Used in [DEPOSITION] @@ -660,7 +664,7 @@ def plot_sankey(mfilename="MFILE.DAT"): # Plot simplified power flow Sankey Dia # Fusion power, Injected power + ohmic power, - total plasma power plasma = [ - fusion_power, + p_fusion_total_mw, p_hcd_injected_total_mw + p_plasma_ohmic_mw, -totalplasma, ] @@ -818,7 +822,7 @@ def plot_sankey(mfilename="MFILE.DAT"): # Plot simplified power flow Sankey Dia t.set_horizontalalignment("left") t.set_position(( pos[0] - 0.35, - pos[1] + 0.5 * (fusion_power / totalplasma) + 0.2, + pos[1] + 0.5 * (p_fusion_total_mw / totalplasma) + 0.2, )) if t == diagrams[0].texts[2]: # Plasma t.set_horizontalalignment("right") diff --git a/process/io/variable_metadata.py b/process/io/variable_metadata.py index 9aa213f9c1..2a304d7a71 100644 --- a/process/io/variable_metadata.py +++ b/process/io/variable_metadata.py @@ -28,7 +28,7 @@ class VariableMetadata: description="TF coil thickness", units="m", ), - "fusion_power": VariableMetadata( + "p_fusion_total_mw": VariableMetadata( latex=r"$P_\mathrm{fus}$ [$MW$]", description="Fusion power", units="MW" ), "p_hcd_injected_electrons_mw": VariableMetadata( diff --git a/process/objectives.py b/process/objectives.py index 9c04d96d40..7470bf2dd9 100644 --- a/process/objectives.py +++ b/process/objectives.py @@ -72,7 +72,7 @@ def objective_function(minmax: int) -> float: tfcoil_variables.tfcmw + 1e-3 * pf_power_variables.srcktpm ) / 10.0 case 5: - objective_metric = physics_variables.fusion_power / ( + objective_metric = physics_variables.p_fusion_total_mw / ( current_drive_variables.p_hcd_injected_total_mw + current_drive_variables.p_beam_orbit_loss_mw + physics_variables.p_plasma_ohmic_mw diff --git a/process/physics.py b/process/physics.py index c8294fc06d..3b73cce239 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2180,7 +2180,7 @@ def physics(self): physics_variables.alpha_power_electron_density, physics_variables.alpha_power_ions_density, physics_variables.charged_particle_power, - physics_variables.fusion_power, + physics_variables.p_fusion_total_mw, ) = reactions.set_fusion_powers( physics_variables.f_alpha_electron, physics_variables.f_alpha_ion, @@ -4653,8 +4653,8 @@ def outplas(self): po.ovarre( self.outfile, "Total fusion power (MW)", - "(fusion_power)", - physics_variables.fusion_power, + "(p_fusion_total_mw)", + physics_variables.p_fusion_total_mw, "OP ", ) po.ovarre( @@ -8388,7 +8388,7 @@ def init_physics_variables(): physics_variables.p_plasma_ohmic_mw = 0.0 physics_variables.pden_plasma_ohmic_mw = 0.0 physics_variables.p_plasma_loss_mw = 0.0 - physics_variables.fusion_power = 0.0 + physics_variables.p_fusion_total_mw = 0.0 physics_variables.len_plasma_poloidal = 0.0 physics_variables.p_plasma_rad_mw = 0.0 physics_variables.pden_plasma_rad_mw = 0.0 diff --git a/process/power.py b/process/power.py index 05a020a3f1..6b9310164d 100644 --- a/process/power.py +++ b/process/power.py @@ -1777,8 +1777,8 @@ def power2(self, output: bool): po.ovarrf( self.outfile, "Fusion power (MW)", - "(fusion_power)", - physics_variables.fusion_power, + "(p_fusion_total_mw)", + physics_variables.p_fusion_total_mw, "OP ", ) po.ovarrf( @@ -1810,7 +1810,7 @@ def power2(self, output: bool): "OP ", ) total = ( - physics_variables.fusion_power + physics_variables.p_fusion_total_mw + fwbs_variables.emultmw + pinj + self.htpmw_mech @@ -2012,8 +2012,8 @@ def power2(self, output: bool): po.ovarrf( self.outfile, "Fusion power (MW)", - "(fusion_power)", - physics_variables.fusion_power, + "(p_fusion_total_mw)", + physics_variables.p_fusion_total_mw, "OP ", ) po.ovarrf( @@ -2023,7 +2023,7 @@ def power2(self, output: bool): fwbs_variables.emultmw, "OP ", ) - total_power = physics_variables.fusion_power + fwbs_variables.emultmw + total_power = physics_variables.p_fusion_total_mw + fwbs_variables.emultmw po.ovarrf(self.outfile, "Total (MW)", "", total_power, "OP ") po.oblnkl(self.outfile) po.ovarrf( @@ -2080,19 +2080,19 @@ def power2(self, output: bool): po.ovarrf( self.outfile, "Net electric power / total nuclear power (%)", - "(pnetelmw/(fusion_power+emultmw)", + "(pnetelmw/(p_fusion_total_mw+emultmw)", 100.0e0 * heat_transport_variables.pnetelmw - / (physics_variables.fusion_power + fwbs_variables.emultmw), + / (physics_variables.p_fusion_total_mw + fwbs_variables.emultmw), "OP ", ) po.ovarrf( self.outfile, "Net electric power / total fusion power (%)", - "(pnetelmw/fusion_power)", + "(pnetelmw/p_fusion_total_mw)", 100.0e0 * heat_transport_variables.pnetelmw - / physics_variables.fusion_power, + / physics_variables.p_fusion_total_mw, "OP ", ) po.ovarrf( diff --git a/process/stellarator.py b/process/stellarator.py index eb86689989..185c783701 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -4283,7 +4283,7 @@ def stphys(self, output): physics_variables.alpha_power_electron_density, physics_variables.alpha_power_ions_density, physics_variables.charged_particle_power, - physics_variables.fusion_power, + physics_variables.p_fusion_total_mw, ) = reactions.set_fusion_powers( physics_variables.f_alpha_electron, physics_variables.f_alpha_ion, @@ -5038,7 +5038,7 @@ def stheat(self, output: bool): ): current_drive_variables.bigq = 1e18 else: - current_drive_variables.bigq = physics_variables.fusion_power / ( + current_drive_variables.bigq = physics_variables.p_fusion_total_mw / ( current_drive_variables.p_hcd_injected_total_mw + current_drive_variables.p_beam_orbit_loss_mw + physics_variables.p_plasma_ohmic_mw diff --git a/process/vacuum.py b/process/vacuum.py index 1ec7163b05..7c6f24ecdb 100644 --- a/process/vacuum.py +++ b/process/vacuum.py @@ -55,7 +55,7 @@ def run(self, output: bool) -> None: # as this is what f2py returns if self.vacuum_model == "old": pumpn, vacv.nvduct, vacv.dlscal, vacv.vacdshm, vacv.vcdimax = self.vacuum( - pv.fusion_power, + pv.p_fusion_total_mw, pv.rmajor, pv.rminor, 0.5e0 * (buv.dr_fw_plasma_gap_inboard + buv.dr_fw_plasma_gap_outboard), @@ -448,7 +448,7 @@ def vacuum( break else: - eh.fdiags[0] = pv.fusion_power + eh.fdiags[0] = pv.p_fusion_total_mw eh.fdiags[1] = pv.te eh.report_error(124) diff --git a/source/fortran/constraint_equations.f90 b/source/fortran/constraint_equations.f90 index 1a0bb7e502..6493fc6353 100755 --- a/source/fortran/constraint_equations.f90 +++ b/source/fortran/constraint_equations.f90 @@ -780,9 +780,9 @@ subroutine constraint_eqn_009(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units) !! Logic change during pre-factoring: err, symbol, units will be assigned only if present. !! ffuspow : input real : f-value for maximum fusion power !! powfmax : input real : maximum fusion power (MW) - !! fusion_power : input real : fusion power (MW) + !! p_fusion_total_mw : input real : fusion power (MW) use constraint_variables, only: ffuspow, powfmax - use physics_variables, only: fusion_power + use physics_variables, only: p_fusion_total_mw implicit none real(dp), intent(out) :: tmp_cc real(dp), intent(out) :: tmp_con @@ -790,9 +790,9 @@ subroutine constraint_eqn_009(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units) character(len=1), intent(out) :: tmp_symbol character(len=10), intent(out) :: tmp_units - tmp_cc = fusion_power/powfmax - 1.0D0 * ffuspow + tmp_cc = p_fusion_total_mw/powfmax - 1.0D0 * ffuspow tmp_con = powfmax * (1.0D0 - tmp_cc) - tmp_err = fusion_power * tmp_cc + tmp_err = p_fusion_total_mw * tmp_cc tmp_symbol = '<' tmp_units = 'MW' diff --git a/source/fortran/physics_variables.f90 b/source/fortran/physics_variables.f90 index c5c856cd1d..4b7334f888 100644 --- a/source/fortran/physics_variables.f90 +++ b/source/fortran/physics_variables.f90 @@ -687,7 +687,7 @@ module physics_variables real(dp) :: p_plasma_loss_mw !! heating power (= transport loss power) (MW) used in confinement time calculation - real(dp) :: fusion_power + real(dp) :: p_fusion_total_mw !! fusion power (MW) real(dp) :: len_plasma_poloidal diff --git a/tests/integration/data/large_tokamak_1_MFILE.DAT b/tests/integration/data/large_tokamak_1_MFILE.DAT index a3d8da8a5c..a74141c2dd 100644 --- a/tests/integration/data/large_tokamak_1_MFILE.DAT +++ b/tests/integration/data/large_tokamak_1_MFILE.DAT @@ -415,7 +415,7 @@ Greenwald_model_________________________________________________________ (dlimit(7))___________________ 7.4445E+19 OP Deuterium_fuel_fraction_________________________________________________ (fdeut)_______________________ 5.0000E-01 Tritium_fuel_fraction___________________________________________________ (ftrit)_______________________ 5.0000E-01 - Total_fusion_power_(MW)_________________________________________________ (fusion_power)______________________ 1.6202E+03 OP + Total_fusion_power_(MW)_________________________________________________ (p_fusion_total_mw)______________________ 1.6202E+03 OP _=____D-T_fusion_power_(MW)_____________________________________________ (pdt)_________________________ 1.6182E+03 OP __+___D-D_fusion_power_(MW)_____________________________________________ (pdd)_________________________ 1.9494E+00 OP __+_D-He3_fusion_power_(MW)_____________________________________________ (pdhe3)_______________________ 0.0000E+00 OP @@ -935,7 +935,7 @@ Blanket_line_density_(tonne/m2)_________________________________________ (x_blanket)___________________ 2.2911E+00 Unit_nuclear_heating_in_TF_coil_(W/GW)__________________________________ (tfc_nuc_heating)_____________ 1.4866E+04 Total_nuclear_heating_in_TF_coil_(MW)___________________________________ (ptfnuc.)_____________________ 2.4085E-02 - fusion_power__________________________________________________________________ (fusion_power.)_____________________ 1.6202E+03 + fusion_power__________________________________________________________________ (p_fusion_total_mw.)_____________________ 1.6202E+03 total_mass_of_the_TF_coils_(kg)_________________________________________ (m_tf_coils_total)_______________________ 1.1424E+07 # Pumping for primary coolant (helium) # Pressure_drop_in_FW_and_blanket_coolant_incl._hx_and_pipes_(Pa)_________ (dp_he)_______________________ 5.5000E+05 @@ -1138,7 +1138,7 @@ Ohmic_heating_(MW)______________________________________________________ (p_plasma_ohmic_mw.)_____________________ 6.2284E-01 Injected_power_deposited_in_plasma_(MW)_________________________________ (p_hcd_injected_total_mw)______________________ 8.0143E+01 Total_(MW)______________________________________________________________ ______________________________ 3.8950E+02 - Fusion_power_(MW)_______________________________________________________ (fusion_power)______________________ 1.6202E+03 + Fusion_power_(MW)_______________________________________________________ (p_fusion_total_mw)______________________ 1.6202E+03 Power_from_energy_multiplication_in_blanket_and_shield_(MW)_____________ (emultmw)_____________________ 3.0836E+02 Injected_power_(MW)_____________________________________________________ (p_hcd_injected_total_mw.)_____________________ 8.0143E+01 Ohmic_power_(MW)________________________________________________________ (p_plasma_ohmic_mw.)_____________________ 6.2284E-01 @@ -1163,15 +1163,15 @@ Total_(MW)______________________________________________________________ (tot_plant_power)_____________ 8.7006E+02 Total_(MW)______________________________________________________________ ______________________________ 8.7006E+02 Gross_electrical_output*_(MW)___________________________________________ (pgrossmw)____________________ 8.7006E+02 - Fusion_power_(MW)_______________________________________________________ (fusion_power)______________________ 1.6202E+03 + Fusion_power_(MW)_______________________________________________________ (p_fusion_total_mw)______________________ 1.6202E+03 Power_from_energy_multiplication_in_blanket_and_shield_(MW)_____________ (emultmw)_____________________ 3.0836E+02 Total_(MW)______________________________________________________________ ______________________________ 1.9285E+03 Net_electrical_output_(MW) _____________________________________________ (pnetelmw)____________________ 4.0001E+02 Heat_rejected_by_main_power_conversion_circuit_(MW)_____________________ (rejected_main)_______________ 1.3051E+03 Heat_rejected_by_other_cooling_circuits_(MW)____________________________ (psechtmw)____________________ 2.2417E+02 Total_(MW)______________________________________________________________ ______________________________ 1.9293E+03 - Net_electric_power_/_total_nuclear_power_(%)____________________________ (pnetelmw/(fusion_power+emultmw)____ 2.0741E+01 - Net_electric_power_/_total_fusion_power_(%)_____________________________ (pnetelmw/fusion_power)_____________ 2.4689E+01 + Net_electric_power_/_total_nuclear_power_(%)____________________________ (pnetelmw/(p_fusion_total_mw+emultmw)____ 2.0741E+01 + Net_electric_power_/_total_fusion_power_(%)_____________________________ (pnetelmw/p_fusion_total_mw)_____________ 2.4689E+01 Gross_electric_power*_/_high_grade_heat_(%)_____________________________ (etath)_______________________ 4.0000E+01 Recirculating_power_fraction____________________________________________ (cirpowfr)____________________ 5.4025E-01 # Water usage during plant operation (secondary cooling) # diff --git a/tests/integration/data/large_tokamak_2_MFILE.DAT b/tests/integration/data/large_tokamak_2_MFILE.DAT index 7eb1433533..1587735c27 100644 --- a/tests/integration/data/large_tokamak_2_MFILE.DAT +++ b/tests/integration/data/large_tokamak_2_MFILE.DAT @@ -416,7 +416,7 @@ Greenwald_model_________________________________________________________ (dlimit(7))___________________ 7.4445E+19 OP Deuterium_fuel_fraction_________________________________________________ (fdeut)_______________________ 5.0000E-01 Tritium_fuel_fraction___________________________________________________ (ftrit)_______________________ 5.0000E-01 - Total_fusion_power_(MW)_________________________________________________ (fusion_power)______________________ 1.6202E+03 OP + Total_fusion_power_(MW)_________________________________________________ (p_fusion_total_mw)______________________ 1.6202E+03 OP _=____D-T_fusion_power_(MW)_____________________________________________ (pdt)_________________________ 1.6182E+03 OP __+___D-D_fusion_power_(MW)_____________________________________________ (pdd)_________________________ 1.9494E+00 OP __+_D-He3_fusion_power_(MW)_____________________________________________ (pdhe3)_______________________ 0.0000E+00 OP @@ -936,7 +936,7 @@ Blanket_line_density_(tonne/m2)_________________________________________ (x_blanket)___________________ 2.2911E+00 Unit_nuclear_heating_in_TF_coil_(W/GW)__________________________________ (tfc_nuc_heating)_____________ 1.4866E+04 Total_nuclear_heating_in_TF_coil_(MW)___________________________________ (ptfnuc.)_____________________ 2.4085E-02 - fusion_power__________________________________________________________________ (fusion_power.)_____________________ 1.6202E+03 + fusion_power__________________________________________________________________ (p_fusion_total_mw.)_____________________ 1.6202E+03 total_mass_of_the_TF_coils_(kg)_________________________________________ (m_tf_coils_total)_______________________ 1.1424E+07 # Pumping for primary coolant (helium) # Pressure_drop_in_FW_and_blanket_coolant_incl._hx_and_pipes_(Pa)_________ (dp_he)_______________________ 5.5000E+05 @@ -1139,7 +1139,7 @@ Ohmic_heating_(MW)______________________________________________________ (p_plasma_ohmic_mw.)_____________________ 6.2284E-01 Injected_power_deposited_in_plasma_(MW)_________________________________ (p_hcd_injected_total_mw)______________________ 8.0143E+01 Total_(MW)______________________________________________________________ ______________________________ 3.8950E+02 - Fusion_power_(MW)_______________________________________________________ (fusion_power)______________________ 1.6202E+03 + Fusion_power_(MW)_______________________________________________________ (p_fusion_total_mw)______________________ 1.6202E+03 Power_from_energy_multiplication_in_blanket_and_shield_(MW)_____________ (emultmw)_____________________ 3.0836E+02 Injected_power_(MW)_____________________________________________________ (p_hcd_injected_total_mw.)_____________________ 8.0143E+01 Ohmic_power_(MW)________________________________________________________ (p_plasma_ohmic_mw.)_____________________ 6.2284E-01 @@ -1164,15 +1164,15 @@ Total_(MW)______________________________________________________________ (tot_plant_power)_____________ 8.7006E+02 Total_(MW)______________________________________________________________ ______________________________ 8.7006E+02 Gross_electrical_output*_(MW)___________________________________________ (pgrossmw)____________________ 8.7006E+02 - Fusion_power_(MW)_______________________________________________________ (fusion_power)______________________ 1.6202E+03 + Fusion_power_(MW)_______________________________________________________ (p_fusion_total_mw)______________________ 1.6202E+03 Power_from_energy_multiplication_in_blanket_and_shield_(MW)_____________ (emultmw)_____________________ 3.0836E+02 Total_(MW)______________________________________________________________ ______________________________ 1.9285E+03 Net_electrical_output_(MW) _____________________________________________ (pnetelmw)____________________ 4.0001E+02 Heat_rejected_by_main_power_conversion_circuit_(MW)_____________________ (rejected_main)_______________ 1.3051E+03 Heat_rejected_by_other_cooling_circuits_(MW)____________________________ (psechtmw)____________________ 2.2417E+02 Total_(MW)______________________________________________________________ ______________________________ 1.9293E+03 - Net_electric_power_/_total_nuclear_power_(%)____________________________ (pnetelmw/(fusion_power+emultmw)____ 2.0741E+01 - Net_electric_power_/_total_fusion_power_(%)_____________________________ (pnetelmw/fusion_power)_____________ 2.4689E+01 + Net_electric_power_/_total_nuclear_power_(%)____________________________ (pnetelmw/(p_fusion_total_mw+emultmw)____ 2.0741E+01 + Net_electric_power_/_total_fusion_power_(%)_____________________________ (pnetelmw/p_fusion_total_mw)_____________ 2.4689E+01 Gross_electric_power*_/_high_grade_heat_(%)_____________________________ (etath)_______________________ 4.0000E+01 Recirculating_power_fraction____________________________________________ (cirpowfr)____________________ 5.4025E-01 # Water usage during plant operation (secondary cooling) # diff --git a/tests/integration/data/large_tokamak_3_MFILE.DAT b/tests/integration/data/large_tokamak_3_MFILE.DAT index 31bef411e6..ef1c362010 100644 --- a/tests/integration/data/large_tokamak_3_MFILE.DAT +++ b/tests/integration/data/large_tokamak_3_MFILE.DAT @@ -416,7 +416,7 @@ Greenwald_model_________________________________________________________ (dlimit(7))___________________ 7.4445E+19 OP Deuterium_fuel_fraction_________________________________________________ (fdeut)_______________________ 5.0000E-01 Tritium_fuel_fraction___________________________________________________ (ftrit)_______________________ 5.0000E-01 - Total_fusion_power_(MW)_________________________________________________ (fusion_power)______________________ 1.6202E+03 OP + Total_fusion_power_(MW)_________________________________________________ (p_fusion_total_mw)______________________ 1.6202E+03 OP _=____D-T_fusion_power_(MW)_____________________________________________ (pdt)_________________________ 1.6182E+03 OP __+___D-D_fusion_power_(MW)_____________________________________________ (pdd)_________________________ 1.9494E+00 OP __+_D-He3_fusion_power_(MW)_____________________________________________ (pdhe3)_______________________ 0.0000E+00 OP @@ -936,7 +936,7 @@ Blanket_line_density_(tonne/m2)_________________________________________ (x_blanket)___________________ 2.2911E+00 Unit_nuclear_heating_in_TF_coil_(W/GW)__________________________________ (tfc_nuc_heating)_____________ 1.4866E+04 Total_nuclear_heating_in_TF_coil_(MW)___________________________________ (ptfnuc.)_____________________ 2.4085E-02 - fusion_power__________________________________________________________________ (fusion_power.)_____________________ 1.6202E+03 + fusion_power__________________________________________________________________ (p_fusion_total_mw.)_____________________ 1.6202E+03 total_mass_of_the_TF_coils_(kg)_________________________________________ (m_tf_coils_total)_______________________ 1.1424E+07 # Pumping for primary coolant (helium) # Pressure_drop_in_FW_and_blanket_coolant_incl._hx_and_pipes_(Pa)_________ (dp_he)_______________________ 5.5000E+05 @@ -1139,7 +1139,7 @@ Ohmic_heating_(MW)______________________________________________________ (p_plasma_ohmic_mw.)_____________________ 6.2284E-01 Injected_power_deposited_in_plasma_(MW)_________________________________ (p_hcd_injected_total_mw)______________________ 8.0143E+01 Total_(MW)______________________________________________________________ ______________________________ 3.8950E+02 - Fusion_power_(MW)_______________________________________________________ (fusion_power)______________________ 1.6202E+03 + Fusion_power_(MW)_______________________________________________________ (p_fusion_total_mw)______________________ 1.6202E+03 Power_from_energy_multiplication_in_blanket_and_shield_(MW)_____________ (emultmw)_____________________ 3.0836E+02 Injected_power_(MW)_____________________________________________________ (p_hcd_injected_total_mw.)_____________________ 8.0143E+01 Ohmic_power_(MW)________________________________________________________ (p_plasma_ohmic_mw.)_____________________ 6.2284E-01 @@ -1164,15 +1164,15 @@ Total_(MW)______________________________________________________________ (tot_plant_power)_____________ 8.7006E+02 Total_(MW)______________________________________________________________ ______________________________ 8.7006E+02 Gross_electrical_output*_(MW)___________________________________________ (pgrossmw)____________________ 8.7006E+02 - Fusion_power_(MW)_______________________________________________________ (fusion_power)______________________ 1.6202E+03 + Fusion_power_(MW)_______________________________________________________ (p_fusion_total_mw)______________________ 1.6202E+03 Power_from_energy_multiplication_in_blanket_and_shield_(MW)_____________ (emultmw)_____________________ 3.0836E+02 Total_(MW)______________________________________________________________ ______________________________ 1.9285E+03 Net_electrical_output_(MW) _____________________________________________ (pnetelmw)____________________ 4.0001E+02 Heat_rejected_by_main_power_conversion_circuit_(MW)_____________________ (rejected_main)_______________ 1.3051E+03 Heat_rejected_by_other_cooling_circuits_(MW)____________________________ (psechtmw)____________________ 2.2417E+02 Total_(MW)______________________________________________________________ ______________________________ 1.9293E+03 - Net_electric_power_/_total_nuclear_power_(%)____________________________ (pnetelmw/(fusion_power+emultmw)____ 2.0741E+01 - Net_electric_power_/_total_fusion_power_(%)_____________________________ (pnetelmw/fusion_power)_____________ 2.4689E+01 + Net_electric_power_/_total_nuclear_power_(%)____________________________ (pnetelmw/(p_fusion_total_mw+emultmw)____ 2.0741E+01 + Net_electric_power_/_total_fusion_power_(%)_____________________________ (pnetelmw/p_fusion_total_mw)_____________ 2.4689E+01 Gross_electric_power*_/_high_grade_heat_(%)_____________________________ (etath)_______________________ 4.0000E+01 Recirculating_power_fraction____________________________________________ (cirpowfr)____________________ 5.4025E-01 # Water usage during plant operation (secondary cooling) # diff --git a/tests/integration/data/large_tokamak_4_MFILE.DAT b/tests/integration/data/large_tokamak_4_MFILE.DAT index 43dcc0ff57..f130c0202e 100644 --- a/tests/integration/data/large_tokamak_4_MFILE.DAT +++ b/tests/integration/data/large_tokamak_4_MFILE.DAT @@ -416,7 +416,7 @@ Greenwald_model_________________________________________________________ (dlimit(7))___________________ 7.4445E+19 OP Deuterium_fuel_fraction_________________________________________________ (fdeut)_______________________ 5.0000E-01 Tritium_fuel_fraction___________________________________________________ (ftrit)_______________________ 5.0000E-01 - Total_fusion_power_(MW)_________________________________________________ (fusion_power)______________________ 1.6202E+03 OP + Total_fusion_power_(MW)_________________________________________________ (p_fusion_total_mw)______________________ 1.6202E+03 OP _=____D-T_fusion_power_(MW)_____________________________________________ (pdt)_________________________ 1.6182E+03 OP __+___D-D_fusion_power_(MW)_____________________________________________ (pdd)_________________________ 1.9494E+00 OP __+_D-He3_fusion_power_(MW)_____________________________________________ (pdhe3)_______________________ 0.0000E+00 OP @@ -936,7 +936,7 @@ Blanket_line_density_(tonne/m2)_________________________________________ (x_blanket)___________________ 2.2911E+00 Unit_nuclear_heating_in_TF_coil_(W/GW)__________________________________ (tfc_nuc_heating)_____________ 1.4866E+04 Total_nuclear_heating_in_TF_coil_(MW)___________________________________ (ptfnuc.)_____________________ 2.4085E-02 - fusion_power__________________________________________________________________ (fusion_power.)_____________________ 1.6202E+03 + fusion_power__________________________________________________________________ (p_fusion_total_mw.)_____________________ 1.6202E+03 total_mass_of_the_TF_coils_(kg)_________________________________________ (m_tf_coils_total)_______________________ 1.1424E+07 # Pumping for primary coolant (helium) # Pressure_drop_in_FW_and_blanket_coolant_incl._hx_and_pipes_(Pa)_________ (dp_he)_______________________ 5.5000E+05 @@ -1139,7 +1139,7 @@ Ohmic_heating_(MW)______________________________________________________ (p_plasma_ohmic_mw.)_____________________ 6.2284E-01 Injected_power_deposited_in_plasma_(MW)_________________________________ (p_hcd_injected_total_mw)______________________ 8.0143E+01 Total_(MW)______________________________________________________________ ______________________________ 3.8950E+02 - Fusion_power_(MW)_______________________________________________________ (fusion_power)______________________ 1.6202E+03 + Fusion_power_(MW)_______________________________________________________ (p_fusion_total_mw)______________________ 1.6202E+03 Power_from_energy_multiplication_in_blanket_and_shield_(MW)_____________ (emultmw)_____________________ 3.0836E+02 Injected_power_(MW)_____________________________________________________ (p_hcd_injected_total_mw.)_____________________ 8.0143E+01 Ohmic_power_(MW)________________________________________________________ (p_plasma_ohmic_mw.)_____________________ 6.2284E-01 @@ -1164,15 +1164,15 @@ Total_(MW)______________________________________________________________ (tot_plant_power)_____________ 8.7006E+02 Total_(MW)______________________________________________________________ ______________________________ 8.7006E+02 Gross_electrical_output*_(MW)___________________________________________ (pgrossmw)____________________ 8.7006E+02 - Fusion_power_(MW)_______________________________________________________ (fusion_power)______________________ 1.6202E+03 + Fusion_power_(MW)_______________________________________________________ (p_fusion_total_mw)______________________ 1.6202E+03 Power_from_energy_multiplication_in_blanket_and_shield_(MW)_____________ (emultmw)_____________________ 3.0836E+02 Total_(MW)______________________________________________________________ ______________________________ 1.9285E+03 Net_electrical_output_(MW) _____________________________________________ (pnetelmw)____________________ 4.0001E+02 Heat_rejected_by_main_power_conversion_circuit_(MW)_____________________ (rejected_main)_______________ 1.3051E+03 Heat_rejected_by_other_cooling_circuits_(MW)____________________________ (psechtmw)____________________ 2.2417E+02 Total_(MW)______________________________________________________________ ______________________________ 1.9293E+03 - Net_electric_power_/_total_nuclear_power_(%)____________________________ (pnetelmw/(fusion_power+emultmw)____ 2.0741E+01 - Net_electric_power_/_total_fusion_power_(%)_____________________________ (pnetelmw/fusion_power)_____________ 2.4689E+01 + Net_electric_power_/_total_nuclear_power_(%)____________________________ (pnetelmw/(p_fusion_total_mw+emultmw)____ 2.0741E+01 + Net_electric_power_/_total_fusion_power_(%)_____________________________ (pnetelmw/p_fusion_total_mw)_____________ 2.4689E+01 Gross_electric_power*_/_high_grade_heat_(%)_____________________________ (etath)_______________________ 4.0000E+01 Recirculating_power_fraction____________________________________________ (cirpowfr)____________________ 5.4025E-01 # Water usage during plant operation (secondary cooling) # diff --git a/tests/integration/data/large_tokamak_MFILE.DAT b/tests/integration/data/large_tokamak_MFILE.DAT index f62bd87126..cf3a7fc052 100644 --- a/tests/integration/data/large_tokamak_MFILE.DAT +++ b/tests/integration/data/large_tokamak_MFILE.DAT @@ -412,7 +412,7 @@ Greenwald_model_________________________________________________________ (dlimit(7))___________________ 7.3950E+19 OP Deuterium_fuel_fraction_________________________________________________ (fdeut)_______________________ 5.0000E-01 Tritium_fuel_fraction___________________________________________________ (ftrit)_______________________ 5.0000E-01 - Total_fusion_power_(MW)_________________________________________________ (fusion_power)______________________ 1.6176E+03 OP + Total_fusion_power_(MW)_________________________________________________ (p_fusion_total_mw)______________________ 1.6176E+03 OP _=____D-T_fusion_power_(MW)_____________________________________________ (pdt)_________________________ 1.6157E+03 OP __+___D-D_fusion_power_(MW)_____________________________________________ (pdd)_________________________ 1.9520E+00 OP __+_D-He3_fusion_power_(MW)_____________________________________________ (pdhe3)_______________________ 0.0000E+00 OP @@ -939,7 +939,7 @@ Blanket_line_density_(tonne/m2)_________________________________________ (x_blanket)___________________ 2.2911E+00 Unit_nuclear_heating_in_TF_coil_(W/GW)__________________________________ (tfc_nuc_heating)_____________ 1.5092E+04 Total_nuclear_heating_in_TF_coil_(MW)___________________________________ (ptfnuc.)_____________________ 2.4413E-02 - fusion_power__________________________________________________________________ (fusion_power.)_____________________ 1.6176E+03 + fusion_power__________________________________________________________________ (p_fusion_total_mw.)_____________________ 1.6176E+03 total_mass_of_the_TF_coils_(kg)_________________________________________ (m_tf_coils_total)_______________________ 1.1598E+07 # Pumping for primary coolant (helium) # Pressure_drop_in_FW_and_blanket_coolant_incl._hx_and_pipes_(Pa)_________ (dp_he)_______________________ 5.5000E+05 @@ -1142,7 +1142,7 @@ Ohmic_heating_(MW)______________________________________________________ (p_plasma_ohmic_mw.)_____________________ 6.0733E-01 Injected_power_deposited_in_plasma_(MW)_________________________________ (p_hcd_injected_total_mw)______________________ 7.9710E+01 Total_(MW)______________________________________________________________ ______________________________ 3.8856E+02 - Fusion_power_(MW)_______________________________________________________ (fusion_power)______________________ 1.6176E+03 + Fusion_power_(MW)_______________________________________________________ (p_fusion_total_mw)______________________ 1.6176E+03 Power_from_energy_multiplication_in_blanket_and_shield_(MW)_____________ (emultmw)_____________________ 3.0787E+02 Injected_power_(MW)_____________________________________________________ (p_hcd_injected_total_mw.)_____________________ 7.9710E+01 Ohmic_power_(MW)________________________________________________________ (p_plasma_ohmic_mw.)_____________________ 6.0733E-01 @@ -1167,15 +1167,15 @@ Total_(MW)______________________________________________________________ (tot_plant_power)_____________ 8.6850E+02 Total_(MW)______________________________________________________________ ______________________________ 8.6850E+02 Gross_electrical_output*_(MW)___________________________________________ (pgrossmw)____________________ 8.6850E+02 - Fusion_power_(MW)_______________________________________________________ (fusion_power)______________________ 1.6176E+03 + Fusion_power_(MW)_______________________________________________________ (p_fusion_total_mw)______________________ 1.6176E+03 Power_from_energy_multiplication_in_blanket_and_shield_(MW)_____________ (emultmw)_____________________ 3.0787E+02 Total_(MW)______________________________________________________________ ______________________________ 1.9255E+03 Net_electrical_output_(MW) _____________________________________________ (pnetelmw)____________________ 4.0001E+02 Heat_rejected_by_main_power_conversion_circuit_(MW)_____________________ (rejected_main)_______________ 1.3028E+03 Heat_rejected_by_other_cooling_circuits_(MW)____________________________ (psechtmw)____________________ 2.2345E+02 Total_(MW)______________________________________________________________ ______________________________ 1.9262E+03 - Net_electric_power_/_total_nuclear_power_(%)____________________________ (pnetelmw/(fusion_power+emultmw)____ 2.0774E+01 - Net_electric_power_/_total_fusion_power_(%)_____________________________ (pnetelmw/fusion_power)_____________ 2.4728E+01 + Net_electric_power_/_total_nuclear_power_(%)____________________________ (pnetelmw/(p_fusion_total_mw+emultmw)____ 2.0774E+01 + Net_electric_power_/_total_fusion_power_(%)_____________________________ (pnetelmw/p_fusion_total_mw)_____________ 2.4728E+01 Gross_electric_power*_/_high_grade_heat_(%)_____________________________ (etath)_______________________ 4.0000E+01 Recirculating_power_fraction____________________________________________ (cirpowfr)____________________ 5.3943E-01 # Water usage during plant operation (secondary cooling) # diff --git a/tests/regression/input_files/st_regression.IN.DAT b/tests/regression/input_files/st_regression.IN.DAT index ee8c4b1129..226791d350 100644 --- a/tests/regression/input_files/st_regression.IN.DAT +++ b/tests/regression/input_files/st_regression.IN.DAT @@ -102,7 +102,7 @@ bt = 3.0 icc = 9 * DESCRIPTION: Fusion Power Upper Limit Constraint * JUSTIFICATION: Working to target fusion -* VARIABLES: fusion_power (fusion power) calculated in-situ +* VARIABLES: p_fusion_total_mw (fusion power) calculated in-situ ixc = 26 ffuspow = 1.0 diff --git a/tests/unit/test_availability.py b/tests/unit/test_availability.py index 4059445a62..01357ec4ae 100644 --- a/tests/unit/test_availability.py +++ b/tests/unit/test_availability.py @@ -41,7 +41,7 @@ def test_avail_0(monkeypatch, availability, life_fw_fpy, ibkt_life, bktlife_exp_ # Mock module vars monkeypatch.setattr(ifev, "ife", 0) - monkeypatch.setattr(pv, "fusion_power", 4.0e3) + monkeypatch.setattr(pv, "p_fusion_total_mw", 4.0e3) monkeypatch.setattr(fwbsv, "life_fw_fpy", life_fw_fpy) monkeypatch.setattr(cv, "ibkt_life", ibkt_life) monkeypatch.setattr(cv, "abktflnc", 4.0) diff --git a/tests/unit/test_ccfe_hcpb.py b/tests/unit/test_ccfe_hcpb.py index 25516a76e1..d6f35dabff 100644 --- a/tests/unit/test_ccfe_hcpb.py +++ b/tests/unit/test_ccfe_hcpb.py @@ -72,7 +72,7 @@ class NuclearHeatingMagnetsParam(NamedTuple): f_a_fw_coolant_outboard: Any = None - fusion_power: Any = None + p_fusion_total_mw: Any = None itart: Any = None @@ -146,7 +146,7 @@ class NuclearHeatingMagnetsParam(NamedTuple): ptfnuc=0, f_a_fw_coolant_inboard=0, f_a_fw_coolant_outboard=0, - fusion_power=1986.0623241661431, + p_fusion_total_mw=1986.0623241661431, itart=0, m_tf_coils_total=19649856.627845347, whttflgs=0, @@ -193,7 +193,7 @@ class NuclearHeatingMagnetsParam(NamedTuple): ptfnuc=0.044184461825198453, f_a_fw_coolant_inboard=0.31415926535897931, f_a_fw_coolant_outboard=0.31415926535897931, - fusion_power=1985.4423932312809, + p_fusion_total_mw=1985.4423932312809, itart=0, m_tf_coils_total=19662548.210142396, whttflgs=0, @@ -314,7 +314,9 @@ def test_nuclear_heating_magnets(nuclearheatingmagnetsparam, monkeypatch, ccfe_h ) monkeypatch.setattr( - physics_variables, "fusion_power", nuclearheatingmagnetsparam.fusion_power + physics_variables, + "p_fusion_total_mw", + nuclearheatingmagnetsparam.p_fusion_total_mw, ) monkeypatch.setattr(physics_variables, "itart", nuclearheatingmagnetsparam.itart) @@ -415,7 +417,7 @@ class NuclearHeatingFwParam(NamedTuple): m_fw_total: Any = None - fusion_power: Any = None + p_fusion_total_mw: Any = None fw_armour_u_nuc_heating: Any = None @@ -430,7 +432,7 @@ class NuclearHeatingFwParam(NamedTuple): NuclearHeatingFwParam( p_fw_nuclear_heat_total_mw=0, m_fw_total=224802.80270851994, - fusion_power=1986.0623241661431, + p_fusion_total_mw=1986.0623241661431, fw_armour_u_nuc_heating=0, expected_p_fw_nuclear_heat_total_mw=279.04523551646628, expected_fw_armour_u_nuc_heating=6.2500000000000005e-07, @@ -438,7 +440,7 @@ class NuclearHeatingFwParam(NamedTuple): NuclearHeatingFwParam( p_fw_nuclear_heat_total_mw=276.80690153753221, m_fw_total=182115.83467868491, - fusion_power=1985.4423932312809, + p_fusion_total_mw=1985.4423932312809, fw_armour_u_nuc_heating=6.2500000000000005e-07, expected_p_fw_nuclear_heat_total_mw=225.98781165610032, expected_fw_armour_u_nuc_heating=6.2500000000000005e-07, @@ -467,7 +469,7 @@ def test_nuclear_heating_fw(nuclearheatingfwparam, monkeypatch, ccfe_hcpb): monkeypatch.setattr(fwbs_variables, "m_fw_total", nuclearheatingfwparam.m_fw_total) monkeypatch.setattr( - physics_variables, "fusion_power", nuclearheatingfwparam.fusion_power + physics_variables, "p_fusion_total_mw", nuclearheatingfwparam.p_fusion_total_mw ) monkeypatch.setattr( @@ -492,7 +494,7 @@ class NuclearHeatingBlanketParam(NamedTuple): p_blkt_nuclear_heat_total_mw: Any = None - fusion_power: Any = None + p_fusion_total_mw: Any = None exp_blanket: Any = None @@ -507,7 +509,7 @@ class NuclearHeatingBlanketParam(NamedTuple): NuclearHeatingBlanketParam( m_blkt_total=3501027.3252278985, p_blkt_nuclear_heat_total_mw=0, - fusion_power=1986.0623241661431, + p_fusion_total_mw=1986.0623241661431, exp_blanket=0, expected_p_blkt_nuclear_heat_total_mw=1517.0907688379014, expected_exp_blanket=0.99982809071915879, @@ -515,7 +517,7 @@ class NuclearHeatingBlanketParam(NamedTuple): NuclearHeatingBlanketParam( m_blkt_total=3507503.3737008357, p_blkt_nuclear_heat_total_mw=1504.9215740808861, - fusion_power=1985.4423932312809, + p_fusion_total_mw=1985.4423932312809, exp_blanket=0.99982809071915879, expected_p_blkt_nuclear_heat_total_mw=1516.6213709741428, expected_exp_blanket=0.99983082524994527, @@ -546,7 +548,9 @@ def test_nuclear_heating_blanket(nuclearheatingblanketparam, monkeypatch, ccfe_h ) monkeypatch.setattr( - physics_variables, "fusion_power", nuclearheatingblanketparam.fusion_power + physics_variables, + "p_fusion_total_mw", + nuclearheatingblanketparam.p_fusion_total_mw, ) monkeypatch.setattr( @@ -573,7 +577,7 @@ class NuclearHeatingShieldParam(NamedTuple): pnucshld: Any = None - fusion_power: Any = None + p_fusion_total_mw: Any = None itart: Any = None @@ -604,7 +608,7 @@ class NuclearHeatingShieldParam(NamedTuple): dr_shld_outboard=0.80000000000000004, whtshld=2294873.8131476045, pnucshld=0, - fusion_power=1986.0623241661431, + p_fusion_total_mw=1986.0623241661431, itart=0, shield_density=3119.9999999999995, x_blanket=2.3374537748527975, @@ -621,7 +625,7 @@ class NuclearHeatingShieldParam(NamedTuple): dr_shld_outboard=0.80000000000000004, whtshld=2297808.3935174854, pnucshld=1.3611259588044891, - fusion_power=1985.4423932312809, + p_fusion_total_mw=1985.4423932312809, itart=0, shield_density=3120, x_blanket=2.3374537748527979, @@ -661,7 +665,9 @@ def test_nuclear_heating_shield(nuclearheatingshieldparam, monkeypatch, ccfe_hcp monkeypatch.setattr(fwbs_variables, "pnucshld", nuclearheatingshieldparam.pnucshld) monkeypatch.setattr( - physics_variables, "fusion_power", nuclearheatingshieldparam.fusion_power + physics_variables, + "p_fusion_total_mw", + nuclearheatingshieldparam.p_fusion_total_mw, ) monkeypatch.setattr(physics_variables, "itart", nuclearheatingshieldparam.itart) @@ -716,7 +722,7 @@ class NuclearHeatingDivertorParam(NamedTuple): n_divertors: Any = None - fusion_power: Any = None + p_fusion_total_mw: Any = None expected_p_div_nuclear_heat_total_mw: Any = None @@ -729,7 +735,7 @@ class NuclearHeatingDivertorParam(NamedTuple): p_div_nuclear_heat_total_mw=0, p_fw_hcd_nuclear_heat_mw=0, n_divertors=1, - fusion_power=1986.0623241661431, + p_fusion_total_mw=1986.0623241661431, expected_p_div_nuclear_heat_total_mw=182.71773382328519, ), NuclearHeatingDivertorParam( @@ -737,7 +743,7 @@ class NuclearHeatingDivertorParam(NamedTuple): p_div_nuclear_heat_total_mw=182.71773382328519, p_fw_hcd_nuclear_heat_mw=0, n_divertors=1, - fusion_power=1985.4423932312809, + p_fusion_total_mw=1985.4423932312809, expected_p_div_nuclear_heat_total_mw=182.66070017727785, ), ), @@ -778,7 +784,9 @@ def test_nuclear_heating_divertor(nuclearheatingdivertorparam, monkeypatch, ccfe ) monkeypatch.setattr( - physics_variables, "fusion_power", nuclearheatingdivertorparam.fusion_power + physics_variables, + "p_fusion_total_mw", + nuclearheatingdivertorparam.p_fusion_total_mw, ) ccfe_hcpb.nuclear_heating_divertor() diff --git a/tests/unit/test_costs_1990.py b/tests/unit/test_costs_1990.py index 0ff4454224..8ea31308b3 100644 --- a/tests/unit/test_costs_1990.py +++ b/tests/unit/test_costs_1990.py @@ -601,7 +601,7 @@ def acc26_param(**kwargs): # Default parameters defaults = { "ireactor": 0, - "fusion_power": 2000.0, + "p_fusion_total_mw": 2000.0, "p_hcd_electric_total_mw": 250.0, "tfcmw": 50.0, "pthermmw": htv.pthermmw, @@ -626,7 +626,7 @@ def acc26_params(): acc26_param(), acc26_param( ireactor=1, - fusion_power=fortran.physics_variables.fusion_power, + p_fusion_total_mw=fortran.physics_variables.p_fusion_total_mw, p_hcd_electric_total_mw=htv.p_hcd_electric_total_mw, tfcmw=fortran.tfcoil_variables.tfcmw, pthermmw=3000.0, @@ -653,7 +653,7 @@ def acc26_fix(request, monkeypatch, costs): monkeypatch.setattr(cost_variables, "lsa", 4) monkeypatch.setattr(cost_variables, "ireactor", param["ireactor"]) monkeypatch.setattr( - fortran.physics_variables, "fusion_power", param["fusion_power"] + fortran.physics_variables, "p_fusion_total_mw", param["p_fusion_total_mw"] ) monkeypatch.setattr( htv, "p_hcd_electric_total_mw", param["p_hcd_electric_total_mw"] @@ -5155,7 +5155,7 @@ class Acc26Param(NamedTuple): pgrossmw: Any = None - fusion_power: Any = None + p_fusion_total_mw: Any = None tfcmw: Any = None @@ -5174,7 +5174,7 @@ class Acc26Param(NamedTuple): pthermmw=2620.2218111502593, p_hcd_electric_total_mw=129.94611930107126, pgrossmw=982.58317918134742, - fusion_power=1985.785106643267, + p_fusion_total_mw=1985.785106643267, tfcmw=0, c26=0, expected_c26=56.327648771765475, @@ -5186,7 +5186,7 @@ class Acc26Param(NamedTuple): pthermmw=2619.4223856129224, p_hcd_electric_total_mw=129.94611930107126, pgrossmw=982.28339460484608, - fusion_power=1985.1653095257811, + p_fusion_total_mw=1985.1653095257811, tfcmw=0, c26=56.327648771765475, expected_c26=56.310463295064743, @@ -5222,7 +5222,9 @@ def test_acc26_rut(acc26param, monkeypatch, costs): monkeypatch.setattr(heat_transport_variables, "pgrossmw", acc26param.pgrossmw) - monkeypatch.setattr(physics_variables, "fusion_power", acc26param.fusion_power) + monkeypatch.setattr( + physics_variables, "p_fusion_total_mw", acc26param.p_fusion_total_mw + ) monkeypatch.setattr(tfcoil_variables, "tfcmw", acc26param.tfcmw) diff --git a/tests/unit/test_costs_2015.py b/tests/unit/test_costs_2015.py index 9764ffa27b..b8e7226b15 100644 --- a/tests/unit/test_costs_2015.py +++ b/tests/unit/test_costs_2015.py @@ -13737,7 +13737,7 @@ class CalcRemainingSubsystemsParam(NamedTuple): p_plasma_separatrix_mw: Any = None - fusion_power: Any = None + p_fusion_total_mw: Any = None t_plasma_res_diffusion: Any = None @@ -13788,7 +13788,7 @@ class CalcRemainingSubsystemsParam(NamedTuple): CalcRemainingSubsystemsParam( p_hcd_injected_total_mw=43.745615131519273, p_plasma_separatrix_mw=94.203763268233445, - fusion_power=1726.9363495105574, + p_fusion_total_mw=1726.9363495105574, t_plasma_res_diffusion=2562.1529343276788, itr_sum=687546826.85995734, ensxpfm=34911.529178721656, @@ -14884,7 +14884,7 @@ class CalcRemainingSubsystemsParam(NamedTuple): CalcRemainingSubsystemsParam( p_hcd_injected_total_mw=43.745615131519266, p_plasma_separatrix_mw=94.062415557688894, - fusion_power=1726.1944723154274, + p_fusion_total_mw=1726.1944723154274, t_plasma_res_diffusion=2562.1529343276788, itr_sum=1176301401.3409874, ensxpfm=34908.848681194133, @@ -16007,7 +16007,9 @@ def test_calc_remaining_subsystems( ) monkeypatch.setattr( - physics_variables, "fusion_power", calcremainingsubsystemsparam.fusion_power + physics_variables, + "p_fusion_total_mw", + calcremainingsubsystemsparam.p_fusion_total_mw, ) monkeypatch.setattr( diff --git a/tests/unit/test_fusion_reactions.py b/tests/unit/test_fusion_reactions.py index c8f16e0785..24d8c4e9a0 100644 --- a/tests/unit/test_fusion_reactions.py +++ b/tests/unit/test_fusion_reactions.py @@ -177,7 +177,7 @@ def test_set_fusion_powers(setfusionpowersparam, monkeypatch): alpha_power_electron_density, alpha_power_ions_density, charged_particle_power, - fusion_power, + p_fusion_total_mw, ) = reactions.set_fusion_powers( f_alpha_electron=setfusionpowersparam.f_alpha_electron, f_alpha_ion=setfusionpowersparam.f_alpha_ion, @@ -212,7 +212,9 @@ def test_set_fusion_powers(setfusionpowersparam, monkeypatch): assert charged_particle_power == pytest.approx( setfusionpowersparam.expected_charged_particle_power ) - assert fusion_power == pytest.approx(setfusionpowersparam.expected_fusion_power) + assert p_fusion_total_mw == pytest.approx( + setfusionpowersparam.expected_fusion_power + ) @pytest.mark.parametrize( diff --git a/tests/unit/test_ife.py b/tests/unit/test_ife.py index e7ed06b48f..857b498a7d 100644 --- a/tests/unit/test_ife.py +++ b/tests/unit/test_ife.py @@ -2047,7 +2047,7 @@ class Ifepw1Param(NamedTuple): ifetyp: Any = None etadrv: Any = None pifecr: Any = None - powfmw: Any = None + p_fusion_total_mw: Any = None expected_p_blkt_nuclear_heat_total_mw: Any = None expected_priheat: Any = None expected_pthermmw: Any = None @@ -2080,7 +2080,7 @@ class Ifepw1Param(NamedTuple): ifetyp=1, etadrv=0.28199999999999997, pifecr=10, - powfmw=2009.6999999999998, + p_fusion_total_mw=2009.6999999999998, expected_p_blkt_nuclear_heat_total_mw=1924.4887199999998, expected_priheat=2532.2219999999998, expected_pthermmw=2532.2219999999998, @@ -2130,7 +2130,7 @@ def test_ifepw1(ifepw1param, monkeypatch, ife): monkeypatch.setattr(ife_variables, "ifetyp", ifepw1param.ifetyp) monkeypatch.setattr(ife_variables, "etadrv", ifepw1param.etadrv) monkeypatch.setattr(ife_variables, "pifecr", ifepw1param.pifecr) - monkeypatch.setattr(physics_variables, "fusion_power", ifepw1param.powfmw) + monkeypatch.setattr(physics_variables, "p_fusion_total_mw", ifepw1param.p_fusion_total_mw) ife.ifepw1() diff --git a/tests/unit/test_power.py b/tests/unit/test_power.py index 7718dea8a9..a6dbae5189 100644 --- a/tests/unit/test_power.py +++ b/tests/unit/test_power.py @@ -2169,7 +2169,7 @@ class Power2Param(NamedTuple): i_rad_loss: Any = None - fusion_power: Any = None + p_fusion_total_mw: Any = None non_alpha_charged_power: Any = None @@ -2308,7 +2308,7 @@ class Power2Param(NamedTuple): n_divertors=1, p_plasma_ohmic_mw=0.61391840981850698, i_rad_loss=1, - fusion_power=1985.785106643267, + p_fusion_total_mw=1985.785106643267, non_alpha_charged_power=1.6064693283140403, pscalingmw=325.08626176539281, f_alpha_plasma=0.94999999999999996, @@ -2410,7 +2410,7 @@ class Power2Param(NamedTuple): n_divertors=1, p_plasma_ohmic_mw=0.61391840981850698, i_rad_loss=1, - fusion_power=1985.1653095257811, + p_fusion_total_mw=1985.1653095257811, non_alpha_charged_power=1.6059679220663614, pscalingmw=325.00280675287695, f_alpha_plasma=0.94999999999999996, @@ -2642,7 +2642,9 @@ def test_power2(power2param, monkeypatch, power): monkeypatch.setattr(physics_variables, "i_rad_loss", power2param.i_rad_loss) - monkeypatch.setattr(physics_variables, "fusion_power", power2param.fusion_power) + monkeypatch.setattr( + physics_variables, "p_fusion_total_mw", power2param.p_fusion_total_mw + ) monkeypatch.setattr( physics_variables, diff --git a/tests/unit/test_vacuum.py b/tests/unit/test_vacuum.py index 7b6c79ec9d..7195d4e328 100644 --- a/tests/unit/test_vacuum.py +++ b/tests/unit/test_vacuum.py @@ -50,7 +50,7 @@ def test_old_model(self, monkeypatch, vacuum): Values taken from first calling of the model in G-L_Nb-Ti regression test. """ - monkeypatch.setattr(pv, "fusion_power", 2115.3899563651776) + monkeypatch.setattr(pv, "p_fusion_total_mw", 2115.3899563651776) monkeypatch.setattr(pv, "te", 15.872999999999999) monkeypatch.setattr(tv, "t_precharge", 30) monkeypatch.setattr(vacv, "dwell_pump", 0) diff --git a/tracking/tracking_data.py b/tracking/tracking_data.py index cbe7c646cc..f3b22874f9 100644 --- a/tracking/tracking_data.py +++ b/tracking/tracking_data.py @@ -131,7 +131,7 @@ class ProcessTracker: "bt", "hfact", "kappa", - "fusion_power", + "p_fusion_total_mw", "teped", "p_plasma_loss_mw", "kappa95", From ff8a60a5af5d68b8f058aea042d6acb5c8a1cd34 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 8 May 2025 13:41:36 +0100 Subject: [PATCH 03/37] =?UTF-8?q?=F0=9F=94=84=20Rename=20dt=5Fpower=5Ftota?= =?UTF-8?q?l=20to=20p=5Fdt=5Ftotal=5Fmw=20for=20consistency=20across=20var?= =?UTF-8?q?iables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/data/large_tokamak_nof_2_MFILE.DAT | 2 +- examples/data/large_tokamak_nof_MFILE.DAT | 2 +- process/physics.py | 10 +++++----- process/stellarator.py | 4 ++-- source/fortran/physics_variables.f90 | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/data/large_tokamak_nof_2_MFILE.DAT b/examples/data/large_tokamak_nof_2_MFILE.DAT index bcdee1512e..7482f54e8b 100644 --- a/examples/data/large_tokamak_nof_2_MFILE.DAT +++ b/examples/data/large_tokamak_nof_2_MFILE.DAT @@ -290,7 +290,7 @@ Total_fusion_power_(MW)__________________________________________________ (p_fusion_total_mw)_________________ 1.60956116199862254e+03 OP Fusion_rate_density:_total_(particles/m3/sec)____________________________ (fusion_rate_density_total)____ 3.03874355943265088e+17 OP Fusion_rate_density:_plasma_(particles/m3/sec)___________________________ (fusion_rate_density_plasma)___ 3.03874355943265088e+17 OP - D-T_fusion_power:_total_(MW)_____________________________________________ (dt_power_total)_______________ 1.60765157256174621e+03 OP + D-T_fusion_power:_total_(MW)_____________________________________________ (p_dt_total_mw)_______________ 1.60765157256174621e+03 OP D-T_fusion_power:_plasma_(MW)____________________________________________ (dt_power_plasma)______________ 1.60765157256174621e+03 OP D-D_fusion_power_(MW)____________________________________________________ (dd_power)_____________________ 1.90958943687632710e+00 OP D-D_branching_ratio_for_tritium_producing_reactions______________________ (f_dd_branching_trit)__________ 4.75373665171270443e-01 OP diff --git a/examples/data/large_tokamak_nof_MFILE.DAT b/examples/data/large_tokamak_nof_MFILE.DAT index 3d382bb178..c308932f88 100644 --- a/examples/data/large_tokamak_nof_MFILE.DAT +++ b/examples/data/large_tokamak_nof_MFILE.DAT @@ -363,7 +363,7 @@ Total_fusion_power_(MW)__________________________________________________ (p_fusion_total_mw)_________________ 1.74333215950657041e+03 OP Fusion_rate_density:_total_(particles/m3/sec)____________________________ (fusion_rate_density_total)____ 3.29182443497713664e+17 OP Fusion_rate_density:_plasma_(particles/m3/sec)___________________________ (fusion_rate_density_plasma)___ 3.29182443497713664e+17 OP - D-T_fusion_power:_total_(MW)_____________________________________________ (dt_power_total)_______________ 1.74119261535816122e+03 OP + D-T_fusion_power:_total_(MW)_____________________________________________ (p_dt_total_mw)_______________ 1.74119261535816122e+03 OP D-T_fusion_power:_plasma_(MW)____________________________________________ (dt_power_plasma)______________ 1.74119261535816122e+03 OP D-D_fusion_power_(MW)____________________________________________________ (dd_power)_____________________ 2.13954414840924656e+00 OP D-D_branching_ratio_for_tritium_producing_reactions______________________ (f_dd_branching_trit)__________ 4.73474335842989258e-01 OP diff --git a/process/physics.py b/process/physics.py index 3b73cce239..bbfc9aa3da 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2154,7 +2154,7 @@ def physics(self): / (constants.dt_alpha_energy) / physics_variables.vol_plasma ) - physics_variables.dt_power_total = ( + physics_variables.p_dt_total_mw = ( physics_variables.dt_power_plasma + 5.0e0 * physics_variables.alpha_power_beams ) @@ -2166,7 +2166,7 @@ def physics(self): physics_variables.alpha_rate_density_total = ( physics_variables.alpha_rate_density_plasma ) - physics_variables.dt_power_total = physics_variables.dt_power_plasma + physics_variables.p_dt_total_mw = physics_variables.dt_power_plasma # Create some derived values and add beam contribution to fusion power ( @@ -4674,8 +4674,8 @@ def outplas(self): po.ovarre( self.outfile, "D-T fusion power: total (MW)", - "(dt_power_total)", - physics_variables.dt_power_total, + "(p_dt_total_mw)", + physics_variables.p_dt_total_mw, "OP ", ) po.ovarre( @@ -8372,7 +8372,7 @@ def init_physics_variables(): physics_variables.pdivl = 0.0 physics_variables.pdivu = 0.0 physics_variables.pdivmax = 0.0 - physics_variables.dt_power_total = 0.0 + physics_variables.p_dt_total_mw = 0.0 physics_variables.dt_power_plasma = 0.0 physics_variables.p_plasma_outer_rad_mw = 0.0 physics_variables.pden_plasma_outer_rad_mw = 0.0 diff --git a/process/stellarator.py b/process/stellarator.py index 185c783701..5832736a63 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -4257,7 +4257,7 @@ def stphys(self, output): / (constants.dt_alpha_energy) / physics_variables.vol_plasma ) - physics_variables.dt_power_total = ( + physics_variables.p_dt_total_mw = ( physics_variables.dt_power_plasma + 5.0e0 * physics_variables.alpha_power_beams ) @@ -4269,7 +4269,7 @@ def stphys(self, output): physics_variables.alpha_rate_density_total = ( physics_variables.alpha_rate_density_plasma ) - physics_variables.dt_power_total = physics_variables.dt_power_plasma + physics_variables.p_dt_total_mw = physics_variables.dt_power_plasma # Create some derived values and add beam contribution to fusion power ( diff --git a/source/fortran/physics_variables.f90 b/source/fortran/physics_variables.f90 index 4b7334f888..c2827dd367 100644 --- a/source/fortran/physics_variables.f90 +++ b/source/fortran/physics_variables.f90 @@ -642,7 +642,7 @@ module physics_variables real(dp) :: pdivmax !! power conducted to the divertor with most load (calculated if `i_single_null = 0`) (MW) - real(dp) :: dt_power_total + real(dp) :: p_dt_total_mw !! Total deuterium-tritium fusion power, from plasma and beams [MW] real(dp) :: dt_power_plasma From 31507ae739b6f4c808d6fe67dd6bb57557e28a58 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 8 May 2025 13:42:24 +0100 Subject: [PATCH 04/37] =?UTF-8?q?=F0=9F=94=84=20Rename=20dt=5Fpower=5Fplas?= =?UTF-8?q?ma=20to=20p=5Fplasma=5Fdt=5Fmw=20for=20consistency=20across=20v?= =?UTF-8?q?ariables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/data/large_tokamak_nof_2_MFILE.DAT | 2 +- examples/data/large_tokamak_nof_MFILE.DAT | 2 +- process/physics.py | 12 ++++++------ process/stellarator.py | 6 +++--- source/fortran/physics_variables.f90 | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/data/large_tokamak_nof_2_MFILE.DAT b/examples/data/large_tokamak_nof_2_MFILE.DAT index 7482f54e8b..c0bf0965ba 100644 --- a/examples/data/large_tokamak_nof_2_MFILE.DAT +++ b/examples/data/large_tokamak_nof_2_MFILE.DAT @@ -291,7 +291,7 @@ Fusion_rate_density:_total_(particles/m3/sec)____________________________ (fusion_rate_density_total)____ 3.03874355943265088e+17 OP Fusion_rate_density:_plasma_(particles/m3/sec)___________________________ (fusion_rate_density_plasma)___ 3.03874355943265088e+17 OP D-T_fusion_power:_total_(MW)_____________________________________________ (p_dt_total_mw)_______________ 1.60765157256174621e+03 OP - D-T_fusion_power:_plasma_(MW)____________________________________________ (dt_power_plasma)______________ 1.60765157256174621e+03 OP + D-T_fusion_power:_plasma_(MW)____________________________________________ (p_plasma_dt_mw)______________ 1.60765157256174621e+03 OP D-D_fusion_power_(MW)____________________________________________________ (dd_power)_____________________ 1.90958943687632710e+00 OP D-D_branching_ratio_for_tritium_producing_reactions______________________ (f_dd_branching_trit)__________ 4.75373665171270443e-01 OP D-He3_fusion_power_(MW)__________________________________________________ (dhe3_power)___________________ 0.00000000000000000e+00 OP diff --git a/examples/data/large_tokamak_nof_MFILE.DAT b/examples/data/large_tokamak_nof_MFILE.DAT index c308932f88..7b4efd8ff3 100644 --- a/examples/data/large_tokamak_nof_MFILE.DAT +++ b/examples/data/large_tokamak_nof_MFILE.DAT @@ -364,7 +364,7 @@ Fusion_rate_density:_total_(particles/m3/sec)____________________________ (fusion_rate_density_total)____ 3.29182443497713664e+17 OP Fusion_rate_density:_plasma_(particles/m3/sec)___________________________ (fusion_rate_density_plasma)___ 3.29182443497713664e+17 OP D-T_fusion_power:_total_(MW)_____________________________________________ (p_dt_total_mw)_______________ 1.74119261535816122e+03 OP - D-T_fusion_power:_plasma_(MW)____________________________________________ (dt_power_plasma)______________ 1.74119261535816122e+03 OP + D-T_fusion_power:_plasma_(MW)____________________________________________ (p_plasma_dt_mw)______________ 1.74119261535816122e+03 OP D-D_fusion_power_(MW)____________________________________________________ (dd_power)_____________________ 2.13954414840924656e+00 OP D-D_branching_ratio_for_tritium_producing_reactions______________________ (f_dd_branching_trit)__________ 4.73474335842989258e-01 OP D-He3_fusion_power_(MW)__________________________________________________ (dhe3_power)___________________ 0.00000000000000000e+00 OP diff --git a/process/physics.py b/process/physics.py index bbfc9aa3da..df5a7b9458 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2101,7 +2101,7 @@ def physics(self): fusion_reactions.set_physics_variables() # This neglects the power from the beam - physics_variables.dt_power_plasma = ( + physics_variables.p_plasma_dt_mw = ( physics_module.dt_power_density_plasma * physics_variables.vol_plasma ) physics_variables.dhe3_power = ( @@ -2155,7 +2155,7 @@ def physics(self): / physics_variables.vol_plasma ) physics_variables.p_dt_total_mw = ( - physics_variables.dt_power_plasma + physics_variables.p_plasma_dt_mw + 5.0e0 * physics_variables.alpha_power_beams ) else: @@ -2166,7 +2166,7 @@ def physics(self): physics_variables.alpha_rate_density_total = ( physics_variables.alpha_rate_density_plasma ) - physics_variables.p_dt_total_mw = physics_variables.dt_power_plasma + physics_variables.p_dt_total_mw = physics_variables.p_plasma_dt_mw # Create some derived values and add beam contribution to fusion power ( @@ -4681,8 +4681,8 @@ def outplas(self): po.ovarre( self.outfile, "D-T fusion power: plasma (MW)", - "(dt_power_plasma)", - physics_variables.dt_power_plasma, + "(p_plasma_dt_mw)", + physics_variables.p_plasma_dt_mw, "OP ", ) po.ovarre( @@ -8373,7 +8373,7 @@ def init_physics_variables(): physics_variables.pdivu = 0.0 physics_variables.pdivmax = 0.0 physics_variables.p_dt_total_mw = 0.0 - physics_variables.dt_power_plasma = 0.0 + physics_variables.p_plasma_dt_mw = 0.0 physics_variables.p_plasma_outer_rad_mw = 0.0 physics_variables.pden_plasma_outer_rad_mw = 0.0 physics_variables.charged_particle_power = 0.0 diff --git a/process/stellarator.py b/process/stellarator.py index 5832736a63..5be2457c89 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -4204,7 +4204,7 @@ def stphys(self, output): fusion_reactions.set_physics_variables() # D-T power density is named differently to differentiate it from the beam given component - physics_variables.dt_power_plasma = ( + physics_variables.p_plasma_dt_mw = ( physics_module.dt_power_density_plasma * physics_variables.vol_plasma ) physics_variables.dhe3_power = ( @@ -4258,7 +4258,7 @@ def stphys(self, output): / physics_variables.vol_plasma ) physics_variables.p_dt_total_mw = ( - physics_variables.dt_power_plasma + physics_variables.p_plasma_dt_mw + 5.0e0 * physics_variables.alpha_power_beams ) else: @@ -4269,7 +4269,7 @@ def stphys(self, output): physics_variables.alpha_rate_density_total = ( physics_variables.alpha_rate_density_plasma ) - physics_variables.p_dt_total_mw = physics_variables.dt_power_plasma + physics_variables.p_dt_total_mw = physics_variables.p_plasma_dt_mw # Create some derived values and add beam contribution to fusion power ( diff --git a/source/fortran/physics_variables.f90 b/source/fortran/physics_variables.f90 index c2827dd367..8281bd4c78 100644 --- a/source/fortran/physics_variables.f90 +++ b/source/fortran/physics_variables.f90 @@ -645,7 +645,7 @@ module physics_variables real(dp) :: p_dt_total_mw !! Total deuterium-tritium fusion power, from plasma and beams [MW] - real(dp) :: dt_power_plasma + real(dp) :: p_plasma_dt_mw !! Deuterium-tritium fusion power, just from plasma [MW] real(dp) :: p_plasma_outer_rad_mw From 21f8e0563cb9f93cfd1ff76e7a6b83bbacfcf781 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 8 May 2025 13:43:42 +0100 Subject: [PATCH 05/37] =?UTF-8?q?=F0=9F=94=84=20Rename=20dd=5Fpower=20to?= =?UTF-8?q?=20p=5Fdd=5Ftotal=5Fmw=20for=20consistency=20across=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/data/large_tokamak_nof_2_MFILE.DAT | 2 +- examples/data/large_tokamak_nof_MFILE.DAT | 2 +- process/physics.py | 8 ++++---- process/stellarator.py | 2 +- source/fortran/physics_variables.f90 | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/data/large_tokamak_nof_2_MFILE.DAT b/examples/data/large_tokamak_nof_2_MFILE.DAT index c0bf0965ba..11b1a7d79c 100644 --- a/examples/data/large_tokamak_nof_2_MFILE.DAT +++ b/examples/data/large_tokamak_nof_2_MFILE.DAT @@ -292,7 +292,7 @@ Fusion_rate_density:_plasma_(particles/m3/sec)___________________________ (fusion_rate_density_plasma)___ 3.03874355943265088e+17 OP D-T_fusion_power:_total_(MW)_____________________________________________ (p_dt_total_mw)_______________ 1.60765157256174621e+03 OP D-T_fusion_power:_plasma_(MW)____________________________________________ (p_plasma_dt_mw)______________ 1.60765157256174621e+03 OP - D-D_fusion_power_(MW)____________________________________________________ (dd_power)_____________________ 1.90958943687632710e+00 OP + D-D_fusion_power_(MW)____________________________________________________ (p_dd_total_mw)_____________________ 1.90958943687632710e+00 OP D-D_branching_ratio_for_tritium_producing_reactions______________________ (f_dd_branching_trit)__________ 4.75373665171270443e-01 OP D-He3_fusion_power_(MW)__________________________________________________ (dhe3_power)___________________ 0.00000000000000000e+00 OP Alpha_rate_density:_total_(particles/m3/sec)_____________________________ (alpha_rate_density_total)_____ 3.02129344101219072e+17 OP diff --git a/examples/data/large_tokamak_nof_MFILE.DAT b/examples/data/large_tokamak_nof_MFILE.DAT index 7b4efd8ff3..58704c583e 100644 --- a/examples/data/large_tokamak_nof_MFILE.DAT +++ b/examples/data/large_tokamak_nof_MFILE.DAT @@ -365,7 +365,7 @@ Fusion_rate_density:_plasma_(particles/m3/sec)___________________________ (fusion_rate_density_plasma)___ 3.29182443497713664e+17 OP D-T_fusion_power:_total_(MW)_____________________________________________ (p_dt_total_mw)_______________ 1.74119261535816122e+03 OP D-T_fusion_power:_plasma_(MW)____________________________________________ (p_plasma_dt_mw)______________ 1.74119261535816122e+03 OP - D-D_fusion_power_(MW)____________________________________________________ (dd_power)_____________________ 2.13954414840924656e+00 OP + D-D_fusion_power_(MW)____________________________________________________ (p_dd_total_mw)_____________________ 2.13954414840924656e+00 OP D-D_branching_ratio_for_tritium_producing_reactions______________________ (f_dd_branching_trit)__________ 4.73474335842989258e-01 OP D-He3_fusion_power_(MW)__________________________________________________ (dhe3_power)___________________ 0.00000000000000000e+00 OP Alpha_rate_density:_total_(particles/m3/sec)_____________________________ (alpha_rate_density_total)_____ 3.27225993374781760e+17 OP diff --git a/process/physics.py b/process/physics.py index df5a7b9458..cccb4aa6ec 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2107,7 +2107,7 @@ def physics(self): physics_variables.dhe3_power = ( physics_module.dhe3_power_density * physics_variables.vol_plasma ) - physics_variables.dd_power = ( + physics_variables.p_dd_total_mw = ( physics_module.dd_power_density * physics_variables.vol_plasma ) @@ -4688,8 +4688,8 @@ def outplas(self): po.ovarre( self.outfile, "D-D fusion power (MW)", - "(dd_power)", - physics_variables.dd_power, + "(p_dd_total_mw)", + physics_variables.p_dd_total_mw, "OP ", ) po.ovarre( @@ -8366,7 +8366,7 @@ def init_physics_variables(): physics_variables.pcoef = 0.0 physics_variables.p_plasma_inner_rad_mw = 0.0 physics_variables.pden_plasma_core_rad_mw = 0.0 - physics_variables.dd_power = 0.0 + physics_variables.p_dd_total_mw = 0.0 physics_variables.dhe3_power = 0.0 physics_variables.p_plasma_separatrix_mw = 0.0 physics_variables.pdivl = 0.0 diff --git a/process/stellarator.py b/process/stellarator.py index 5be2457c89..a56e4a9301 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -4210,7 +4210,7 @@ def stphys(self, output): physics_variables.dhe3_power = ( physics_module.dhe3_power_density * physics_variables.vol_plasma ) - physics_variables.dd_power = ( + physics_variables.p_dd_total_mw = ( physics_module.dd_power_density * physics_variables.vol_plasma ) diff --git a/source/fortran/physics_variables.f90 b/source/fortran/physics_variables.f90 index 8281bd4c78..60dfb3d51c 100644 --- a/source/fortran/physics_variables.f90 +++ b/source/fortran/physics_variables.f90 @@ -624,7 +624,7 @@ module physics_variables real(dp) :: pden_plasma_core_rad_mw !! total core radiation power per volume (MW/m3) - real(dp) :: dd_power + real(dp) :: p_dd_total_mw !! deuterium-deuterium fusion power (MW) real(dp) :: dhe3_power From 5749a920319f80418b4fd65138c05251e3953e5e Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 8 May 2025 13:44:36 +0100 Subject: [PATCH 06/37] =?UTF-8?q?=F0=9F=94=84=20Rename=20dhe3=5Fpower=20to?= =?UTF-8?q?=20p=5Fdhe3=5Ftotal=5Fmw=20for=20consistency=20across=20variabl?= =?UTF-8?q?es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/data/large_tokamak_nof_2_MFILE.DAT | 2 +- examples/data/large_tokamak_nof_MFILE.DAT | 2 +- process/physics.py | 8 ++++---- process/stellarator.py | 2 +- source/fortran/physics_variables.f90 | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/data/large_tokamak_nof_2_MFILE.DAT b/examples/data/large_tokamak_nof_2_MFILE.DAT index 11b1a7d79c..15061e20af 100644 --- a/examples/data/large_tokamak_nof_2_MFILE.DAT +++ b/examples/data/large_tokamak_nof_2_MFILE.DAT @@ -294,7 +294,7 @@ D-T_fusion_power:_plasma_(MW)____________________________________________ (p_plasma_dt_mw)______________ 1.60765157256174621e+03 OP D-D_fusion_power_(MW)____________________________________________________ (p_dd_total_mw)_____________________ 1.90958943687632710e+00 OP D-D_branching_ratio_for_tritium_producing_reactions______________________ (f_dd_branching_trit)__________ 4.75373665171270443e-01 OP - D-He3_fusion_power_(MW)__________________________________________________ (dhe3_power)___________________ 0.00000000000000000e+00 OP + D-He3_fusion_power_(MW)__________________________________________________ (p_dhe3_total_mw)___________________ 0.00000000000000000e+00 OP Alpha_rate_density:_total_(particles/m3/sec)_____________________________ (alpha_rate_density_total)_____ 3.02129344101219072e+17 OP Alpha_rate_density:_plasma_(particles/m3/sec)____________________________ (alpha_rate_density_plasma)____ 3.02129344101219072e+17 OP Alpha_power:_total_(MW)__________________________________________________ (alpha_power_total)____________ 3.23657956519217578e+02 OP diff --git a/examples/data/large_tokamak_nof_MFILE.DAT b/examples/data/large_tokamak_nof_MFILE.DAT index 58704c583e..1f711f951a 100644 --- a/examples/data/large_tokamak_nof_MFILE.DAT +++ b/examples/data/large_tokamak_nof_MFILE.DAT @@ -367,7 +367,7 @@ D-T_fusion_power:_plasma_(MW)____________________________________________ (p_plasma_dt_mw)______________ 1.74119261535816122e+03 OP D-D_fusion_power_(MW)____________________________________________________ (p_dd_total_mw)_____________________ 2.13954414840924656e+00 OP D-D_branching_ratio_for_tritium_producing_reactions______________________ (f_dd_branching_trit)__________ 4.73474335842989258e-01 OP - D-He3_fusion_power_(MW)__________________________________________________ (dhe3_power)___________________ 0.00000000000000000e+00 OP + D-He3_fusion_power_(MW)__________________________________________________ (p_dhe3_total_mw)___________________ 0.00000000000000000e+00 OP Alpha_rate_density:_total_(particles/m3/sec)_____________________________ (alpha_rate_density_total)_____ 3.27225993374781760e+17 OP Alpha_rate_density:_plasma_(particles/m3/sec)____________________________ (alpha_rate_density_plasma)____ 3.27225993374781760e+17 OP Alpha_power:_total_(MW)__________________________________________________ (alpha_power_total)____________ 3.50542899600547457e+02 OP diff --git a/process/physics.py b/process/physics.py index cccb4aa6ec..c6e9c45527 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2104,7 +2104,7 @@ def physics(self): physics_variables.p_plasma_dt_mw = ( physics_module.dt_power_density_plasma * physics_variables.vol_plasma ) - physics_variables.dhe3_power = ( + physics_variables.p_dhe3_total_mw = ( physics_module.dhe3_power_density * physics_variables.vol_plasma ) physics_variables.p_dd_total_mw = ( @@ -4702,8 +4702,8 @@ def outplas(self): po.ovarre( self.outfile, "D-He3 fusion power (MW)", - "(dhe3_power)", - physics_variables.dhe3_power, + "(p_dhe3_total_mw)", + physics_variables.p_dhe3_total_mw, "OP ", ) po.osubhd(self.outfile, "Alpha Powers :") @@ -8367,7 +8367,7 @@ def init_physics_variables(): physics_variables.p_plasma_inner_rad_mw = 0.0 physics_variables.pden_plasma_core_rad_mw = 0.0 physics_variables.p_dd_total_mw = 0.0 - physics_variables.dhe3_power = 0.0 + physics_variables.p_dhe3_total_mw = 0.0 physics_variables.p_plasma_separatrix_mw = 0.0 physics_variables.pdivl = 0.0 physics_variables.pdivu = 0.0 diff --git a/process/stellarator.py b/process/stellarator.py index a56e4a9301..1935d6cc90 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -4207,7 +4207,7 @@ def stphys(self, output): physics_variables.p_plasma_dt_mw = ( physics_module.dt_power_density_plasma * physics_variables.vol_plasma ) - physics_variables.dhe3_power = ( + physics_variables.p_dhe3_total_mw = ( physics_module.dhe3_power_density * physics_variables.vol_plasma ) physics_variables.p_dd_total_mw = ( diff --git a/source/fortran/physics_variables.f90 b/source/fortran/physics_variables.f90 index 60dfb3d51c..f1140fa72e 100644 --- a/source/fortran/physics_variables.f90 +++ b/source/fortran/physics_variables.f90 @@ -627,7 +627,7 @@ module physics_variables real(dp) :: p_dd_total_mw !! deuterium-deuterium fusion power (MW) - real(dp) :: dhe3_power + real(dp) :: p_dhe3_total_mw !! deuterium-helium3 fusion power (MW) real(dp) :: p_plasma_separatrix_mw From 36a3685db90f0119cb5cad9defb64086b2ca1ea9 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 8 May 2025 13:48:39 +0100 Subject: [PATCH 07/37] =?UTF-8?q?=F0=9F=94=84=20Rename=20fusion=5Frate=5Fd?= =?UTF-8?q?ensity=5Ftotal=20to=20fusden=5Ftotal=20for=20consistency=20acro?= =?UTF-8?q?ss=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/data/large_tokamak_nof_2_MFILE.DAT | 2 +- examples/data/large_tokamak_nof_MFILE.DAT | 2 +- process/physics.py | 20 ++++++++++---------- process/stellarator.py | 6 +++--- source/fortran/physics_variables.f90 | 2 +- tests/unit/test_ife.py | 4 +++- tests/unit/test_physics.py | 8 ++++---- 7 files changed, 23 insertions(+), 21 deletions(-) diff --git a/examples/data/large_tokamak_nof_2_MFILE.DAT b/examples/data/large_tokamak_nof_2_MFILE.DAT index 15061e20af..fc6f946e21 100644 --- a/examples/data/large_tokamak_nof_2_MFILE.DAT +++ b/examples/data/large_tokamak_nof_2_MFILE.DAT @@ -288,7 +288,7 @@ Tritium_fuel_fraction____________________________________________________ (f_tritium)____________________ 5.00000000000000000e-01 3-Helium_fuel_fraction___________________________________________________ (f_helium3)____________________ 0.00000000000000000e+00 Total_fusion_power_(MW)__________________________________________________ (p_fusion_total_mw)_________________ 1.60956116199862254e+03 OP - Fusion_rate_density:_total_(particles/m3/sec)____________________________ (fusion_rate_density_total)____ 3.03874355943265088e+17 OP + Fusion_rate_density:_total_(particles/m3/sec)____________________________ (fusden_total)____ 3.03874355943265088e+17 OP Fusion_rate_density:_plasma_(particles/m3/sec)___________________________ (fusion_rate_density_plasma)___ 3.03874355943265088e+17 OP D-T_fusion_power:_total_(MW)_____________________________________________ (p_dt_total_mw)_______________ 1.60765157256174621e+03 OP D-T_fusion_power:_plasma_(MW)____________________________________________ (p_plasma_dt_mw)______________ 1.60765157256174621e+03 OP diff --git a/examples/data/large_tokamak_nof_MFILE.DAT b/examples/data/large_tokamak_nof_MFILE.DAT index 1f711f951a..07c2a1711c 100644 --- a/examples/data/large_tokamak_nof_MFILE.DAT +++ b/examples/data/large_tokamak_nof_MFILE.DAT @@ -361,7 +361,7 @@ Tritium_fuel_fraction____________________________________________________ (f_tritium)____________________ 5.00000000000000000e-01 3-Helium_fuel_fraction___________________________________________________ (f_helium3)____________________ 0.00000000000000000e+00 Total_fusion_power_(MW)__________________________________________________ (p_fusion_total_mw)_________________ 1.74333215950657041e+03 OP - Fusion_rate_density:_total_(particles/m3/sec)____________________________ (fusion_rate_density_total)____ 3.29182443497713664e+17 OP + Fusion_rate_density:_total_(particles/m3/sec)____________________________ (fusden_total)____ 3.29182443497713664e+17 OP Fusion_rate_density:_plasma_(particles/m3/sec)___________________________ (fusion_rate_density_plasma)___ 3.29182443497713664e+17 OP D-T_fusion_power:_total_(MW)_____________________________________________ (p_dt_total_mw)_______________ 1.74119261535816122e+03 OP D-T_fusion_power:_plasma_(MW)____________________________________________ (p_plasma_dt_mw)______________ 1.74119261535816122e+03 OP diff --git a/process/physics.py b/process/physics.py index c6e9c45527..9d923de92f 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2140,7 +2140,7 @@ def physics(self): physics_variables.vol_plasma, physics_variables.zeffai, ) - physics_variables.fusion_rate_density_total = ( + physics_variables.fusden_total = ( physics_variables.fusion_rate_density_plasma + 1.0e6 * physics_variables.alpha_power_beams @@ -2160,7 +2160,7 @@ def physics(self): ) else: # If no beams present then the total alpha rates and power are the same as the plasma values - physics_variables.fusion_rate_density_total = ( + physics_variables.fusden_total = ( physics_variables.fusion_rate_density_plasma ) physics_variables.alpha_rate_density_total = ( @@ -2475,7 +2475,7 @@ def physics(self): physics_variables.dene, physics_variables.te, physics_variables.nd_fuel_ions, - physics_variables.fusion_rate_density_total, + physics_variables.fusden_total, physics_variables.alpha_rate_density_total, physics_variables.plasma_current, sbar, @@ -3143,7 +3143,7 @@ def phyaux( dene: float, te: float, nd_fuel_ions: float, - fusion_rate_density_total: float, + fusden_total: float, alpha_rate_density_total: float, plasma_current: float, sbar: float, @@ -3158,7 +3158,7 @@ def phyaux( dene (float): Electron density (/m3). te (float): Volume avergaed electron temperature (keV). nd_fuel_ions (float): Fuel ion density (/m3). - fusion_rate_density_total (float): Fusion reaction rate from plasma and beams (/m3/s). + fusden_total (float): Fusion reaction rate from plasma and beams (/m3/s). alpha_rate_density_total (float): Alpha particle production rate (/m3/s). plasma_current (float): Plasma current (A). sbar (float): Exponent for aspect ratio (normally 1). @@ -3186,7 +3186,7 @@ def phyaux( nTtau = ntau * te # Fusion reactions per second - fusrat = fusion_rate_density_total * vol_plasma + fusrat = fusden_total * vol_plasma # Alpha particle confinement time (s) # Number of alphas / alpha production rate @@ -4660,15 +4660,15 @@ def outplas(self): po.ovarre( self.outfile, "Fusion rate density: total (particles/m3/sec)", - "(fusion_rate_density_total)", - physics_variables.fusion_rate_density_total, + "(fusden_total)", + physics_variables.fusden_total, "OP ", ) po.ovarre( self.outfile, "Fusion rate density: plasma (particles/m3/sec)", "(fusion_rate_density_plasma)", - physics_variables.fusion_rate_density_total, + physics_variables.fusden_total, "OP ", ) po.ovarre( @@ -8306,7 +8306,7 @@ def init_physics_variables(): physics_variables.fpdivlim = 1.0 physics_variables.fne0 = 1.0 physics_variables.f_tritium = 0.5 - physics_variables.fusion_rate_density_total = 0.0 + physics_variables.fusden_total = 0.0 physics_variables.fusion_rate_density_plasma = 0.0 physics_variables.f_c_plasma_non_inductive = 1.0 physics_variables.ejima_coeff = 0.4 diff --git a/process/stellarator.py b/process/stellarator.py index 1935d6cc90..e7958d0131 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -4243,7 +4243,7 @@ def stphys(self, output): physics_variables.vol_plasma, physics_variables.zeffai, ) - physics_variables.fusion_rate_density_total = ( + physics_variables.fusden_total = ( physics_variables.fusion_rate_density_plasma + 1.0e6 * physics_variables.alpha_power_beams @@ -4263,7 +4263,7 @@ def stphys(self, output): ) else: # If no beams present then the total alpha rates and power are the same as the plasma values - physics_variables.fusion_rate_density_total = ( + physics_variables.fusden_total = ( physics_variables.fusion_rate_density_plasma ) physics_variables.alpha_rate_density_total = ( @@ -4545,7 +4545,7 @@ def stphys(self, output): physics_variables.dene, physics_variables.te, physics_variables.nd_fuel_ions, - physics_variables.fusion_rate_density_total, + physics_variables.fusden_total, physics_variables.alpha_rate_density_total, physics_variables.plasma_current, sbar, diff --git a/source/fortran/physics_variables.f90 b/source/fortran/physics_variables.f90 index f1140fa72e..5d9f3a83f3 100644 --- a/source/fortran/physics_variables.f90 +++ b/source/fortran/physics_variables.f90 @@ -281,7 +281,7 @@ module physics_variables real(dp) :: f_tritium !! tritium fuel fraction - real(dp) :: fusion_rate_density_total + real(dp) :: fusden_total !! fusion reaction rate, from beams and plasma (reactions/m3/sec) real(dp) :: fusion_rate_density_plasma diff --git a/tests/unit/test_ife.py b/tests/unit/test_ife.py index 857b498a7d..a046ff9715 100644 --- a/tests/unit/test_ife.py +++ b/tests/unit/test_ife.py @@ -2130,7 +2130,9 @@ def test_ifepw1(ifepw1param, monkeypatch, ife): monkeypatch.setattr(ife_variables, "ifetyp", ifepw1param.ifetyp) monkeypatch.setattr(ife_variables, "etadrv", ifepw1param.etadrv) monkeypatch.setattr(ife_variables, "pifecr", ifepw1param.pifecr) - monkeypatch.setattr(physics_variables, "p_fusion_total_mw", ifepw1param.p_fusion_total_mw) + monkeypatch.setattr( + physics_variables, "p_fusion_total_mw", ifepw1param.p_fusion_total_mw + ) ife.ifepw1() diff --git a/tests/unit/test_physics.py b/tests/unit/test_physics.py index 299b98a40c..ee2aa2d137 100644 --- a/tests/unit/test_physics.py +++ b/tests/unit/test_physics.py @@ -2039,7 +2039,7 @@ class PhyauxParam(NamedTuple): nd_alphas: Any = None - fusion_rate_density_total: Any = None + fusden_total: Any = None alpha_rate_density_total: Any = None @@ -2079,7 +2079,7 @@ class PhyauxParam(NamedTuple): te=12.569, nd_fuel_ions=5.8589175702454272e19, nd_alphas=7.5e18, - fusion_rate_density_total=1.9852091609123786e17, + fusden_total=1.9852091609123786e17, alpha_rate_density_total=1.973996644759543e17, plasma_current=18398455.678867526, sbar=1, @@ -2102,7 +2102,7 @@ class PhyauxParam(NamedTuple): te=12.569, nd_fuel_ions=5.8576156204039725e19, nd_alphas=7.5e18, - fusion_rate_density_total=1.9843269653375773e17, + fusden_total=1.9843269653375773e17, alpha_rate_density_total=1.9731194318497056e17, plasma_current=18398455.678867526, sbar=1, @@ -2143,7 +2143,7 @@ def test_phyaux(phyauxparam, monkeypatch, physics): te=phyauxparam.te, nd_fuel_ions=phyauxparam.nd_fuel_ions, nd_alphas=phyauxparam.nd_alphas, - fusion_rate_density_total=phyauxparam.fusion_rate_density_total, + fusden_total=phyauxparam.fusden_total, alpha_rate_density_total=phyauxparam.alpha_rate_density_total, plasma_current=phyauxparam.plasma_current, sbar=phyauxparam.sbar, From 5209247f96341cc7a221b48498609d605eeea7eb Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 8 May 2025 13:49:30 +0100 Subject: [PATCH 08/37] =?UTF-8?q?=F0=9F=94=84=20Rename=20fusion=5Frate=5Fd?= =?UTF-8?q?ensity=5Fplasma=20to=20fusden=5Fplasma=20for=20consistency=20ac?= =?UTF-8?q?ross=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../physics-models/fusion_reactions/plasma_reactions.md | 2 +- examples/data/large_tokamak_nof_2_MFILE.DAT | 2 +- examples/data/large_tokamak_nof_MFILE.DAT | 2 +- process/fusion_reactions.py | 2 +- process/physics.py | 8 ++++---- process/stellarator.py | 4 ++-- source/fortran/physics_variables.f90 | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md b/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md index 52b1f5cc78..93c1e5feb1 100644 --- a/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md +++ b/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md @@ -183,7 +183,7 @@ This method sets the required physics variables in the `physics_variables` and ` - `physics_variables.alpha_power_density_plasma`: Updated with `self.alpha_power_density` - `physics_variables.charged_power_density`: Updated with `self.charged_power_density` - `physics_variables.neutron_power_density_plasma`: Updated with `self.neutron_power_density` -- `physics_variables.fusion_rate_density_plasma`: Updated with `self.fusion_rate_density` +- `physics_variables.fusden_plasma`: Updated with `self.fusion_rate_density` - `physics_variables.alpha_rate_density_plasma`: Updated with `self.alpha_rate_density` - `physics_variables.proton_rate_density`: Updated with `self.proton_rate_density` - `physics_module.sigmav_dt_average`: Updated with `self.sigmav_dt_average` diff --git a/examples/data/large_tokamak_nof_2_MFILE.DAT b/examples/data/large_tokamak_nof_2_MFILE.DAT index fc6f946e21..50df45fa06 100644 --- a/examples/data/large_tokamak_nof_2_MFILE.DAT +++ b/examples/data/large_tokamak_nof_2_MFILE.DAT @@ -289,7 +289,7 @@ 3-Helium_fuel_fraction___________________________________________________ (f_helium3)____________________ 0.00000000000000000e+00 Total_fusion_power_(MW)__________________________________________________ (p_fusion_total_mw)_________________ 1.60956116199862254e+03 OP Fusion_rate_density:_total_(particles/m3/sec)____________________________ (fusden_total)____ 3.03874355943265088e+17 OP - Fusion_rate_density:_plasma_(particles/m3/sec)___________________________ (fusion_rate_density_plasma)___ 3.03874355943265088e+17 OP + Fusion_rate_density:_plasma_(particles/m3/sec)___________________________ (fusden_plasma)___ 3.03874355943265088e+17 OP D-T_fusion_power:_total_(MW)_____________________________________________ (p_dt_total_mw)_______________ 1.60765157256174621e+03 OP D-T_fusion_power:_plasma_(MW)____________________________________________ (p_plasma_dt_mw)______________ 1.60765157256174621e+03 OP D-D_fusion_power_(MW)____________________________________________________ (p_dd_total_mw)_____________________ 1.90958943687632710e+00 OP diff --git a/examples/data/large_tokamak_nof_MFILE.DAT b/examples/data/large_tokamak_nof_MFILE.DAT index 07c2a1711c..ab57176b17 100644 --- a/examples/data/large_tokamak_nof_MFILE.DAT +++ b/examples/data/large_tokamak_nof_MFILE.DAT @@ -362,7 +362,7 @@ 3-Helium_fuel_fraction___________________________________________________ (f_helium3)____________________ 0.00000000000000000e+00 Total_fusion_power_(MW)__________________________________________________ (p_fusion_total_mw)_________________ 1.74333215950657041e+03 OP Fusion_rate_density:_total_(particles/m3/sec)____________________________ (fusden_total)____ 3.29182443497713664e+17 OP - Fusion_rate_density:_plasma_(particles/m3/sec)___________________________ (fusion_rate_density_plasma)___ 3.29182443497713664e+17 OP + Fusion_rate_density:_plasma_(particles/m3/sec)___________________________ (fusden_plasma)___ 3.29182443497713664e+17 OP D-T_fusion_power:_total_(MW)_____________________________________________ (p_dt_total_mw)_______________ 1.74119261535816122e+03 OP D-T_fusion_power:_plasma_(MW)____________________________________________ (p_plasma_dt_mw)______________ 1.74119261535816122e+03 OP D-D_fusion_power_(MW)____________________________________________________ (p_dd_total_mw)_____________________ 2.13954414840924656e+00 OP diff --git a/process/fusion_reactions.py b/process/fusion_reactions.py index 9a797ea4c7..fc823cdd54 100644 --- a/process/fusion_reactions.py +++ b/process/fusion_reactions.py @@ -535,7 +535,7 @@ def set_physics_variables(self) -> None: physics_variables.alpha_power_density_plasma = self.alpha_power_density physics_variables.charged_power_density = self.charged_power_density physics_variables.neutron_power_density_plasma = self.neutron_power_density - physics_variables.fusion_rate_density_plasma = self.fusion_rate_density + physics_variables.fusden_plasma = self.fusion_rate_density physics_variables.alpha_rate_density_plasma = self.alpha_rate_density physics_variables.proton_rate_density = self.proton_rate_density physics_module.sigmav_dt_average = self.sigmav_dt_average diff --git a/process/physics.py b/process/physics.py index 9d923de92f..5c439cd0ca 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2141,7 +2141,7 @@ def physics(self): physics_variables.zeffai, ) physics_variables.fusden_total = ( - physics_variables.fusion_rate_density_plasma + physics_variables.fusden_plasma + 1.0e6 * physics_variables.alpha_power_beams / (constants.dt_alpha_energy) @@ -2161,7 +2161,7 @@ def physics(self): else: # If no beams present then the total alpha rates and power are the same as the plasma values physics_variables.fusden_total = ( - physics_variables.fusion_rate_density_plasma + physics_variables.fusden_plasma ) physics_variables.alpha_rate_density_total = ( physics_variables.alpha_rate_density_plasma @@ -4667,7 +4667,7 @@ def outplas(self): po.ovarre( self.outfile, "Fusion rate density: plasma (particles/m3/sec)", - "(fusion_rate_density_plasma)", + "(fusden_plasma)", physics_variables.fusden_total, "OP ", ) @@ -8307,7 +8307,7 @@ def init_physics_variables(): physics_variables.fne0 = 1.0 physics_variables.f_tritium = 0.5 physics_variables.fusden_total = 0.0 - physics_variables.fusion_rate_density_plasma = 0.0 + physics_variables.fusden_plasma = 0.0 physics_variables.f_c_plasma_non_inductive = 1.0 physics_variables.ejima_coeff = 0.4 physics_variables.f_beta_alpha_beam_thermal = 0.0 diff --git a/process/stellarator.py b/process/stellarator.py index e7958d0131..5b92bda6e6 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -4244,7 +4244,7 @@ def stphys(self, output): physics_variables.zeffai, ) physics_variables.fusden_total = ( - physics_variables.fusion_rate_density_plasma + physics_variables.fusden_plasma + 1.0e6 * physics_variables.alpha_power_beams / (constants.dt_alpha_energy) @@ -4264,7 +4264,7 @@ def stphys(self, output): else: # If no beams present then the total alpha rates and power are the same as the plasma values physics_variables.fusden_total = ( - physics_variables.fusion_rate_density_plasma + physics_variables.fusden_plasma ) physics_variables.alpha_rate_density_total = ( physics_variables.alpha_rate_density_plasma diff --git a/source/fortran/physics_variables.f90 b/source/fortran/physics_variables.f90 index 5d9f3a83f3..30173be728 100644 --- a/source/fortran/physics_variables.f90 +++ b/source/fortran/physics_variables.f90 @@ -284,7 +284,7 @@ module physics_variables real(dp) :: fusden_total !! fusion reaction rate, from beams and plasma (reactions/m3/sec) - real(dp) :: fusion_rate_density_plasma + real(dp) :: fusden_plasma !! fusion reaction rate, just from plasma (reactions/m3/sec) real(dp) :: f_c_plasma_non_inductive From 520f3e6bd3e0c9227d62dc5dd4070a9e09f38beb Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 8 May 2025 13:54:09 +0100 Subject: [PATCH 09/37] =?UTF-8?q?=F0=9F=94=84=20Rename=20alpha=5Frate=5Fde?= =?UTF-8?q?nsity=5Ftotal=20to=20fusden=5Falpha=5Ftotal=20for=20consistency?= =?UTF-8?q?=20across=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/data/large_tokamak_nof_2_MFILE.DAT | 2 +- examples/data/large_tokamak_nof_MFILE.DAT | 2 +- process/physics.py | 24 ++++++++++----------- process/stellarator.py | 6 +++--- source/fortran/physics_variables.f90 | 2 +- tests/unit/test_physics.py | 18 ++++++++-------- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/examples/data/large_tokamak_nof_2_MFILE.DAT b/examples/data/large_tokamak_nof_2_MFILE.DAT index 50df45fa06..36c8eb9816 100644 --- a/examples/data/large_tokamak_nof_2_MFILE.DAT +++ b/examples/data/large_tokamak_nof_2_MFILE.DAT @@ -295,7 +295,7 @@ D-D_fusion_power_(MW)____________________________________________________ (p_dd_total_mw)_____________________ 1.90958943687632710e+00 OP D-D_branching_ratio_for_tritium_producing_reactions______________________ (f_dd_branching_trit)__________ 4.75373665171270443e-01 OP D-He3_fusion_power_(MW)__________________________________________________ (p_dhe3_total_mw)___________________ 0.00000000000000000e+00 OP - Alpha_rate_density:_total_(particles/m3/sec)_____________________________ (alpha_rate_density_total)_____ 3.02129344101219072e+17 OP + Alpha_rate_density:_total_(particles/m3/sec)_____________________________ (fusden_alpha_total)_____ 3.02129344101219072e+17 OP Alpha_rate_density:_plasma_(particles/m3/sec)____________________________ (alpha_rate_density_plasma)____ 3.02129344101219072e+17 OP Alpha_power:_total_(MW)__________________________________________________ (alpha_power_total)____________ 3.23657956519217578e+02 OP Alpha_power_density:_total_(MW/m^3)______________________________________ (alpha_power_density_total)____ 1.71413463146233375e-01 OP diff --git a/examples/data/large_tokamak_nof_MFILE.DAT b/examples/data/large_tokamak_nof_MFILE.DAT index ab57176b17..4273297154 100644 --- a/examples/data/large_tokamak_nof_MFILE.DAT +++ b/examples/data/large_tokamak_nof_MFILE.DAT @@ -368,7 +368,7 @@ D-D_fusion_power_(MW)____________________________________________________ (p_dd_total_mw)_____________________ 2.13954414840924656e+00 OP D-D_branching_ratio_for_tritium_producing_reactions______________________ (f_dd_branching_trit)__________ 4.73474335842989258e-01 OP D-He3_fusion_power_(MW)__________________________________________________ (p_dhe3_total_mw)___________________ 0.00000000000000000e+00 OP - Alpha_rate_density:_total_(particles/m3/sec)_____________________________ (alpha_rate_density_total)_____ 3.27225993374781760e+17 OP + Alpha_rate_density:_total_(particles/m3/sec)_____________________________ (fusden_alpha_total)_____ 3.27225993374781760e+17 OP Alpha_rate_density:_plasma_(particles/m3/sec)____________________________ (alpha_rate_density_plasma)____ 3.27225993374781760e+17 OP Alpha_power:_total_(MW)__________________________________________________ (alpha_power_total)____________ 3.50542899600547457e+02 OP Alpha_power_density:_total_(MW/m^3)______________________________________ (alpha_power_density_total)____ 1.85652078657564057e-01 OP diff --git a/process/physics.py b/process/physics.py index 5c439cd0ca..87540a9e80 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2147,7 +2147,7 @@ def physics(self): / (constants.dt_alpha_energy) / physics_variables.vol_plasma ) - physics_variables.alpha_rate_density_total = ( + physics_variables.fusden_alpha_total = ( physics_variables.alpha_rate_density_plasma + 1.0e6 * physics_variables.alpha_power_beams @@ -2163,7 +2163,7 @@ def physics(self): physics_variables.fusden_total = ( physics_variables.fusden_plasma ) - physics_variables.alpha_rate_density_total = ( + physics_variables.fusden_alpha_total = ( physics_variables.alpha_rate_density_plasma ) physics_variables.p_dt_total_mw = physics_variables.p_plasma_dt_mw @@ -2476,7 +2476,7 @@ def physics(self): physics_variables.te, physics_variables.nd_fuel_ions, physics_variables.fusden_total, - physics_variables.alpha_rate_density_total, + physics_variables.fusden_alpha_total, physics_variables.plasma_current, sbar, physics_variables.nd_alphas, @@ -2893,7 +2893,7 @@ def plasma_composition() -> None: # production rates are evaluated later in the calling sequence # Issue #557 Allow f_nd_protium_electrons impurity to be specified: 'f_nd_protium_electrons' # This will override the calculated value which is a minimum. - if physics_variables.alpha_rate_density_total < 1.0e-6: # not calculated yet... + if physics_variables.fusden_alpha_total < 1.0e-6: # not calculated yet... physics_variables.nd_protons = max( physics_variables.f_nd_protium_electrons * physics_variables.dene, physics_variables.nd_alphas * (physics_variables.f_helium3 + 1.0e-3), @@ -2903,7 +2903,7 @@ def plasma_composition() -> None: physics_variables.f_nd_protium_electrons * physics_variables.dene, physics_variables.nd_alphas * physics_variables.proton_rate_density - / physics_variables.alpha_rate_density_total, + / physics_variables.fusden_alpha_total, ) # ====================================================================== @@ -3144,7 +3144,7 @@ def phyaux( te: float, nd_fuel_ions: float, fusden_total: float, - alpha_rate_density_total: float, + fusden_alpha_total: float, plasma_current: float, sbar: float, nd_alphas: float, @@ -3159,7 +3159,7 @@ def phyaux( te (float): Volume avergaed electron temperature (keV). nd_fuel_ions (float): Fuel ion density (/m3). fusden_total (float): Fusion reaction rate from plasma and beams (/m3/s). - alpha_rate_density_total (float): Alpha particle production rate (/m3/s). + fusden_alpha_total (float): Alpha particle production rate (/m3/s). plasma_current (float): Plasma current (A). sbar (float): Exponent for aspect ratio (normally 1). nd_alphas (float): Alpha ash density (/m3). @@ -3190,8 +3190,8 @@ def phyaux( # Alpha particle confinement time (s) # Number of alphas / alpha production rate - if alpha_rate_density_total != 0.0: - t_alpha_confinement = nd_alphas / alpha_rate_density_total + if fusden_alpha_total != 0.0: + t_alpha_confinement = nd_alphas / fusden_alpha_total else: # only likely if DD is only active fusion reaction t_alpha_confinement = 0.0 @@ -4710,8 +4710,8 @@ def outplas(self): po.ovarre( self.outfile, "Alpha rate density: total (particles/m3/sec)", - "(alpha_rate_density_total)", - physics_variables.alpha_rate_density_total, + "(fusden_alpha_total)", + physics_variables.fusden_alpha_total, "OP ", ) po.ovarre( @@ -8235,7 +8235,7 @@ def init_physics_variables(): physics_variables.i_alphaj = 0 physics_variables.alphan = 0.25 physics_variables.alphap = 0.0 - physics_variables.alpha_rate_density_total = 0.0 + physics_variables.fusden_alpha_total = 0.0 physics_variables.alpha_rate_density_plasma = 0.0 physics_variables.alphat = 0.5 physics_variables.aspect = 2.907 diff --git a/process/stellarator.py b/process/stellarator.py index 5b92bda6e6..e60efea417 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -4250,7 +4250,7 @@ def stphys(self, output): / (constants.dt_alpha_energy) / physics_variables.vol_plasma ) - physics_variables.alpha_rate_density_total = ( + physics_variables.fusden_alpha_total = ( physics_variables.alpha_rate_density_plasma + 1.0e6 * physics_variables.alpha_power_beams @@ -4266,7 +4266,7 @@ def stphys(self, output): physics_variables.fusden_total = ( physics_variables.fusden_plasma ) - physics_variables.alpha_rate_density_total = ( + physics_variables.fusden_alpha_total = ( physics_variables.alpha_rate_density_plasma ) physics_variables.p_dt_total_mw = physics_variables.p_plasma_dt_mw @@ -4546,7 +4546,7 @@ def stphys(self, output): physics_variables.te, physics_variables.nd_fuel_ions, physics_variables.fusden_total, - physics_variables.alpha_rate_density_total, + physics_variables.fusden_alpha_total, physics_variables.plasma_current, sbar, physics_variables.nd_alphas, diff --git a/source/fortran/physics_variables.f90 b/source/fortran/physics_variables.f90 index 30173be728..15ebd27db0 100644 --- a/source/fortran/physics_variables.f90 +++ b/source/fortran/physics_variables.f90 @@ -53,7 +53,7 @@ module physics_variables real(dp) :: alphap !! pressure profile index - real(dp) :: alpha_rate_density_total + real(dp) :: fusden_alpha_total !! Alpha particle production rate per unit volume, from plasma and beams [particles/m3/sec] real(dp) :: alpha_rate_density_plasma diff --git a/tests/unit/test_physics.py b/tests/unit/test_physics.py index ee2aa2d137..7621e8bfb5 100644 --- a/tests/unit/test_physics.py +++ b/tests/unit/test_physics.py @@ -1339,7 +1339,7 @@ class PlasmaCompositionParam(NamedTuple): pcoef: Any = None - alpha_rate_density_total: Any = None + fusden_alpha_total: Any = None rnfene: Any = None @@ -1475,7 +1475,7 @@ class PlasmaCompositionParam(NamedTuple): zeff=0, nd_impurities=0, pcoef=0, - alpha_rate_density_total=0, + fusden_alpha_total=0, rnfene=0, m_beam_amu=0, te=12, @@ -1593,7 +1593,7 @@ class PlasmaCompositionParam(NamedTuple): zeff=2.0909945616489103, nd_impurities=28875000000000004, pcoef=1.0521775929921553, - alpha_rate_density_total=1.973996644759543e17, + fusden_alpha_total=1.973996644759543e17, rnfene=0, m_beam_amu=2.01355414, te=12, @@ -1757,8 +1757,8 @@ def test_plasma_composition(plasmacompositionparam, monkeypatch, physics): monkeypatch.setattr( physics_variables, - "alpha_rate_density_total", - plasmacompositionparam.alpha_rate_density_total, + "fusden_alpha_total", + plasmacompositionparam.fusden_alpha_total, ) monkeypatch.setattr(physics_variables, "rnfene", plasmacompositionparam.rnfene) @@ -2041,7 +2041,7 @@ class PhyauxParam(NamedTuple): fusden_total: Any = None - alpha_rate_density_total: Any = None + fusden_alpha_total: Any = None plasma_current: Any = None @@ -2080,7 +2080,7 @@ class PhyauxParam(NamedTuple): nd_fuel_ions=5.8589175702454272e19, nd_alphas=7.5e18, fusden_total=1.9852091609123786e17, - alpha_rate_density_total=1.973996644759543e17, + fusden_alpha_total=1.973996644759543e17, plasma_current=18398455.678867526, sbar=1, t_energy_confinement=3.401323521525641, @@ -2103,7 +2103,7 @@ class PhyauxParam(NamedTuple): nd_fuel_ions=5.8576156204039725e19, nd_alphas=7.5e18, fusden_total=1.9843269653375773e17, - alpha_rate_density_total=1.9731194318497056e17, + fusden_alpha_total=1.9731194318497056e17, plasma_current=18398455.678867526, sbar=1, t_energy_confinement=3.402116961408892, @@ -2144,7 +2144,7 @@ def test_phyaux(phyauxparam, monkeypatch, physics): nd_fuel_ions=phyauxparam.nd_fuel_ions, nd_alphas=phyauxparam.nd_alphas, fusden_total=phyauxparam.fusden_total, - alpha_rate_density_total=phyauxparam.alpha_rate_density_total, + fusden_alpha_total=phyauxparam.fusden_alpha_total, plasma_current=phyauxparam.plasma_current, sbar=phyauxparam.sbar, t_energy_confinement=phyauxparam.t_energy_confinement, From 08c439ce0c911f1617a47aeae90867c5732cbfba Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 8 May 2025 13:55:14 +0100 Subject: [PATCH 10/37] =?UTF-8?q?=F0=9F=94=84=20Rename=20alpha=5Frate=5Fde?= =?UTF-8?q?nsity=5Fplasma=20to=20fusden=5Fplasma=5Falpha=20for=20consisten?= =?UTF-8?q?cy=20across=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fusion_reactions/plasma_reactions.md | 2 +- examples/data/large_tokamak_nof_2_MFILE.DAT | 2 +- examples/data/large_tokamak_nof_MFILE.DAT | 2 +- process/fusion_reactions.py | 2 +- process/physics.py | 10 +++++----- process/stellarator.py | 4 ++-- source/fortran/physics_variables.f90 | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md b/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md index 93c1e5feb1..855a72c5b9 100644 --- a/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md +++ b/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md @@ -184,7 +184,7 @@ This method sets the required physics variables in the `physics_variables` and ` - `physics_variables.charged_power_density`: Updated with `self.charged_power_density` - `physics_variables.neutron_power_density_plasma`: Updated with `self.neutron_power_density` - `physics_variables.fusden_plasma`: Updated with `self.fusion_rate_density` -- `physics_variables.alpha_rate_density_plasma`: Updated with `self.alpha_rate_density` +- `physics_variables.fusden_plasma_alpha`: Updated with `self.alpha_rate_density` - `physics_variables.proton_rate_density`: Updated with `self.proton_rate_density` - `physics_module.sigmav_dt_average`: Updated with `self.sigmav_dt_average` - `physics_module.dt_power_density_plasma`: Updated with `self.dt_power_density` diff --git a/examples/data/large_tokamak_nof_2_MFILE.DAT b/examples/data/large_tokamak_nof_2_MFILE.DAT index 36c8eb9816..7826690a1c 100644 --- a/examples/data/large_tokamak_nof_2_MFILE.DAT +++ b/examples/data/large_tokamak_nof_2_MFILE.DAT @@ -296,7 +296,7 @@ D-D_branching_ratio_for_tritium_producing_reactions______________________ (f_dd_branching_trit)__________ 4.75373665171270443e-01 OP D-He3_fusion_power_(MW)__________________________________________________ (p_dhe3_total_mw)___________________ 0.00000000000000000e+00 OP Alpha_rate_density:_total_(particles/m3/sec)_____________________________ (fusden_alpha_total)_____ 3.02129344101219072e+17 OP - Alpha_rate_density:_plasma_(particles/m3/sec)____________________________ (alpha_rate_density_plasma)____ 3.02129344101219072e+17 OP + Alpha_rate_density:_plasma_(particles/m3/sec)____________________________ (fusden_plasma_alpha)____ 3.02129344101219072e+17 OP Alpha_power:_total_(MW)__________________________________________________ (alpha_power_total)____________ 3.23657956519217578e+02 OP Alpha_power_density:_total_(MW/m^3)______________________________________ (alpha_power_density_total)____ 1.71413463146233375e-01 OP Alpha_power:_plasma_only_(MW)____________________________________________ (alpha_power_plasma)___________ 3.23657956519217578e+02 OP diff --git a/examples/data/large_tokamak_nof_MFILE.DAT b/examples/data/large_tokamak_nof_MFILE.DAT index 4273297154..4ac814ba85 100644 --- a/examples/data/large_tokamak_nof_MFILE.DAT +++ b/examples/data/large_tokamak_nof_MFILE.DAT @@ -369,7 +369,7 @@ D-D_branching_ratio_for_tritium_producing_reactions______________________ (f_dd_branching_trit)__________ 4.73474335842989258e-01 OP D-He3_fusion_power_(MW)__________________________________________________ (p_dhe3_total_mw)___________________ 0.00000000000000000e+00 OP Alpha_rate_density:_total_(particles/m3/sec)_____________________________ (fusden_alpha_total)_____ 3.27225993374781760e+17 OP - Alpha_rate_density:_plasma_(particles/m3/sec)____________________________ (alpha_rate_density_plasma)____ 3.27225993374781760e+17 OP + Alpha_rate_density:_plasma_(particles/m3/sec)____________________________ (fusden_plasma_alpha)____ 3.27225993374781760e+17 OP Alpha_power:_total_(MW)__________________________________________________ (alpha_power_total)____________ 3.50542899600547457e+02 OP Alpha_power_density:_total_(MW/m^3)______________________________________ (alpha_power_density_total)____ 1.85652078657564057e-01 OP Alpha_power:_plasma_only_(MW)____________________________________________ (alpha_power_plasma)___________ 3.50542899600547457e+02 OP diff --git a/process/fusion_reactions.py b/process/fusion_reactions.py index fc823cdd54..0a7a29560a 100644 --- a/process/fusion_reactions.py +++ b/process/fusion_reactions.py @@ -536,7 +536,7 @@ def set_physics_variables(self) -> None: physics_variables.charged_power_density = self.charged_power_density physics_variables.neutron_power_density_plasma = self.neutron_power_density physics_variables.fusden_plasma = self.fusion_rate_density - physics_variables.alpha_rate_density_plasma = self.alpha_rate_density + physics_variables.fusden_plasma_alpha = self.alpha_rate_density physics_variables.proton_rate_density = self.proton_rate_density physics_module.sigmav_dt_average = self.sigmav_dt_average physics_module.dt_power_density_plasma = self.dt_power_density diff --git a/process/physics.py b/process/physics.py index 87540a9e80..8aed0a9ceb 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2148,7 +2148,7 @@ def physics(self): / physics_variables.vol_plasma ) physics_variables.fusden_alpha_total = ( - physics_variables.alpha_rate_density_plasma + physics_variables.fusden_plasma_alpha + 1.0e6 * physics_variables.alpha_power_beams / (constants.dt_alpha_energy) @@ -2164,7 +2164,7 @@ def physics(self): physics_variables.fusden_plasma ) physics_variables.fusden_alpha_total = ( - physics_variables.alpha_rate_density_plasma + physics_variables.fusden_plasma_alpha ) physics_variables.p_dt_total_mw = physics_variables.p_plasma_dt_mw @@ -4717,8 +4717,8 @@ def outplas(self): po.ovarre( self.outfile, "Alpha rate density: plasma (particles/m3/sec)", - "(alpha_rate_density_plasma)", - physics_variables.alpha_rate_density_plasma, + "(fusden_plasma_alpha)", + physics_variables.fusden_plasma_alpha, "OP ", ) po.ovarre( @@ -8236,7 +8236,7 @@ def init_physics_variables(): physics_variables.alphan = 0.25 physics_variables.alphap = 0.0 physics_variables.fusden_alpha_total = 0.0 - physics_variables.alpha_rate_density_plasma = 0.0 + physics_variables.fusden_plasma_alpha = 0.0 physics_variables.alphat = 0.5 physics_variables.aspect = 2.907 physics_variables.beamfus0 = 1.0 diff --git a/process/stellarator.py b/process/stellarator.py index e60efea417..c4d4a1f091 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -4251,7 +4251,7 @@ def stphys(self, output): / physics_variables.vol_plasma ) physics_variables.fusden_alpha_total = ( - physics_variables.alpha_rate_density_plasma + physics_variables.fusden_plasma_alpha + 1.0e6 * physics_variables.alpha_power_beams / (constants.dt_alpha_energy) @@ -4267,7 +4267,7 @@ def stphys(self, output): physics_variables.fusden_plasma ) physics_variables.fusden_alpha_total = ( - physics_variables.alpha_rate_density_plasma + physics_variables.fusden_plasma_alpha ) physics_variables.p_dt_total_mw = physics_variables.p_plasma_dt_mw diff --git a/source/fortran/physics_variables.f90 b/source/fortran/physics_variables.f90 index 15ebd27db0..bab149c771 100644 --- a/source/fortran/physics_variables.f90 +++ b/source/fortran/physics_variables.f90 @@ -56,7 +56,7 @@ module physics_variables real(dp) :: fusden_alpha_total !! Alpha particle production rate per unit volume, from plasma and beams [particles/m3/sec] - real(dp) :: alpha_rate_density_plasma + real(dp) :: fusden_plasma_alpha !! Alpha particle production rate per unit volume, just from plasma [particles/m3/sec] real(dp) :: alphat From 4ec27b87f40fd692b6b822ae25d504de0b5410de Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 8 May 2025 13:56:30 +0100 Subject: [PATCH 11/37] =?UTF-8?q?=F0=9F=94=84=20Rename=20alpha=5Fpower=5Ft?= =?UTF-8?q?otal=20to=20p=5Falpha=5Ftotal=5Fmw=20for=20consistency=20across?= =?UTF-8?q?=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/data/large_tokamak_nof_2_MFILE.DAT | 4 +-- examples/data/large_tokamak_nof_MFILE.DAT | 4 +-- process/fusion_reactions.py | 10 +++--- process/io/sankey_funcs.py | 12 +++---- process/physics.py | 28 ++++++++-------- process/power.py | 12 +++---- process/stellarator.py | 10 +++--- source/fortran/physics_variables.f90 | 2 +- tests/unit/test_fusion_reactions.py | 4 +-- tests/unit/test_physics.py | 36 ++++++++++----------- tests/unit/test_power.py | 8 ++--- 11 files changed, 65 insertions(+), 65 deletions(-) diff --git a/examples/data/large_tokamak_nof_2_MFILE.DAT b/examples/data/large_tokamak_nof_2_MFILE.DAT index 7826690a1c..7c52968c69 100644 --- a/examples/data/large_tokamak_nof_2_MFILE.DAT +++ b/examples/data/large_tokamak_nof_2_MFILE.DAT @@ -297,7 +297,7 @@ D-He3_fusion_power_(MW)__________________________________________________ (p_dhe3_total_mw)___________________ 0.00000000000000000e+00 OP Alpha_rate_density:_total_(particles/m3/sec)_____________________________ (fusden_alpha_total)_____ 3.02129344101219072e+17 OP Alpha_rate_density:_plasma_(particles/m3/sec)____________________________ (fusden_plasma_alpha)____ 3.02129344101219072e+17 OP - Alpha_power:_total_(MW)__________________________________________________ (alpha_power_total)____________ 3.23657956519217578e+02 OP + Alpha_power:_total_(MW)__________________________________________________ (p_alpha_total_mw)____________ 3.23657956519217578e+02 OP Alpha_power_density:_total_(MW/m^3)______________________________________ (alpha_power_density_total)____ 1.71413463146233375e-01 OP Alpha_power:_plasma_only_(MW)____________________________________________ (alpha_power_plasma)___________ 3.23657956519217578e+02 OP Alpha_power_density:_plasma_(MW/m^3)_____________________________________ (alpha_power_density_plasma)___ 1.71413463146233375e-01 OP @@ -1090,7 +1090,7 @@ Transport_power_from_scaling_law_(MW)____________________________________ (pscalingmw)___________________ 2.67976424195365780e+02 OP Radiation_power_from_inside_"coreradius"_(MW)____________________________ (pcoreradmw.)__________________ 1.30345146305381149e+02 OP Total_(MW)_______________________________________________________________ _______________________________ 3.98321570500746930e+02 OP - Alpha_power_deposited_in_plasma_(MW)_____________________________________ (f_alpha_plasma*alpha_power_total)_ 3.07475058693256699e+02 OP + Alpha_power_deposited_in_plasma_(MW)_____________________________________ (f_alpha_plasma*p_alpha_total_mw)_ 3.07475058693256699e+02 OP Power_from_charged_products_of_DD_and/or_D-He3_fusion_(MW)_______________ (non_alpha_charged_power.)_____ 1.20650459189592762e+00 OP Ohmic_heating_(MW)_______________________________________________________ (p_plasma_ohmic_mw.)___________ 6.88941757462895432e-01 OP Injected_power_deposited_in_plasma_(MW)__________________________________ (pinjmw)_______________________ 7.75278055722339587e+01 OP diff --git a/examples/data/large_tokamak_nof_MFILE.DAT b/examples/data/large_tokamak_nof_MFILE.DAT index 4ac814ba85..89f9c531d7 100644 --- a/examples/data/large_tokamak_nof_MFILE.DAT +++ b/examples/data/large_tokamak_nof_MFILE.DAT @@ -370,7 +370,7 @@ D-He3_fusion_power_(MW)__________________________________________________ (p_dhe3_total_mw)___________________ 0.00000000000000000e+00 OP Alpha_rate_density:_total_(particles/m3/sec)_____________________________ (fusden_alpha_total)_____ 3.27225993374781760e+17 OP Alpha_rate_density:_plasma_(particles/m3/sec)____________________________ (fusden_plasma_alpha)____ 3.27225993374781760e+17 OP - Alpha_power:_total_(MW)__________________________________________________ (alpha_power_total)____________ 3.50542899600547457e+02 OP + Alpha_power:_total_(MW)__________________________________________________ (p_alpha_total_mw)____________ 3.50542899600547457e+02 OP Alpha_power_density:_total_(MW/m^3)______________________________________ (alpha_power_density_total)____ 1.85652078657564057e-01 OP Alpha_power:_plasma_only_(MW)____________________________________________ (alpha_power_plasma)___________ 3.50542899600547457e+02 OP Alpha_power_density:_plasma_(MW/m^3)_____________________________________ (alpha_power_density_plasma)___ 1.85652078657564057e-01 OP @@ -1164,7 +1164,7 @@ Transport_power_from_scaling_law_(MW)____________________________________ (pscalingmw)___________________ 3.21850327706303688e+02 OP Radiation_power_from_inside_"coreradius"_(MW)____________________________ (pcoreradmw.)__________________ 1.18176171262989300e+02 OP Total_(MW)_______________________________________________________________ _______________________________ 4.40026498969293016e+02 OP - Alpha_power_deposited_in_plasma_(MW)_____________________________________ (f_alpha_plasma*alpha_power_total)_ 3.33015754620520056e+02 OP + Alpha_power_deposited_in_plasma_(MW)_____________________________________ (f_alpha_plasma*p_alpha_total_mw)_ 3.33015754620520056e+02 OP Power_from_charged_products_of_DD_and/or_D-He3_fusion_(MW)_______________ (non_alpha_charged_power.)_____ 1.34669877478527300e+00 OP Ohmic_heating_(MW)_______________________________________________________ (p_plasma_ohmic_mw.)___________ 6.76139747896948751e-01 OP Injected_power_deposited_in_plasma_(MW)__________________________________ (pinjmw)_______________________ 1.04987905826090795e+02 OP diff --git a/process/fusion_reactions.py b/process/fusion_reactions.py index 0a7a29560a..514d2e8508 100644 --- a/process/fusion_reactions.py +++ b/process/fusion_reactions.py @@ -705,7 +705,7 @@ def set_fusion_powers( tuple: A tuple containing the following elements: - neutron_power_density_total (float): Neutron fusion power per unit volume from plasma and beams [MW/m^3]. - alpha_power_plasma (float): Alpha fusion power from only the plasma [MW]. - - alpha_power_total (float): Total alpha fusion power from plasma and beams [MW]. + - p_alpha_total_mw (float): Total alpha fusion power from plasma and beams [MW]. - neutron_power_plasma (float): Neutron fusion power from only the plasma [MW]. - neutron_power_total (float): Total neutron fusion power from plasma and beams [MW]. - non_alpha_charged_power (float): Other total charged particle fusion power [MW]. @@ -731,7 +731,7 @@ def set_fusion_powers( ) # Total alpha power - alpha_power_total = alpha_power_density_total * vol_plasma + p_alpha_total_mw = alpha_power_density_total * vol_plasma # Neutron Power @@ -759,11 +759,11 @@ def set_fusion_powers( non_alpha_charged_power = charged_power_density * vol_plasma # Charged particle fusion power - charged_particle_power = alpha_power_total + non_alpha_charged_power + charged_particle_power = p_alpha_total_mw + non_alpha_charged_power # Total fusion power p_fusion_total_mw = ( - alpha_power_total + neutron_power_total + non_alpha_charged_power + p_alpha_total_mw + neutron_power_total + non_alpha_charged_power ) # Alpha power to electrons and ions (used with electron @@ -779,7 +779,7 @@ def set_fusion_powers( return ( neutron_power_density_total, alpha_power_plasma, - alpha_power_total, + p_alpha_total_mw, neutron_power_plasma, neutron_power_total, non_alpha_charged_power, diff --git a/process/io/sankey_funcs.py b/process/io/sankey_funcs.py index 614be29f03..94ef3a4786 100644 --- a/process/io/sankey_funcs.py +++ b/process/io/sankey_funcs.py @@ -44,11 +44,11 @@ def plot_full_sankey( pcharohmmw = ( non_alpha_charged_power + p_plasma_ohmic_mw ) # The ohmic and charged particle power (MW) - alpha_power_total = m_file.data["alpha_power_total"].get_scan( + p_alpha_total_mw = m_file.data["p_alpha_total_mw"].get_scan( -1 ) # Alpha power (MW) palpinjmw = ( - alpha_power_total + p_hcd_injected_total_mw + p_alpha_total_mw + p_hcd_injected_total_mw ) # Alpha particle and HC&D power (MW) # Used in [NEUTRONICS] @@ -79,7 +79,7 @@ def plot_full_sankey( f_alpha_plasma = m_file.data["f_alpha_plasma"].get_scan( -1 ) # Fraction of alpha power deposited in plasma - p_fw_alpha_mw = alpha_power_total * ( + p_fw_alpha_mw = p_alpha_total_mw * ( 1 - f_alpha_plasma ) # Alpha particles hitting first wall (MW) p_plasma_rad_mw = m_file.data["p_plasma_rad_mw"].get_scan( @@ -475,7 +475,7 @@ def plot_full_sankey( t.set_position((pos[0]-0.5*(non_alpha_charged_power/totalplasma)-0.05,pos[1])) if t == diagrams[0].texts[5]: # Alphas t.set_horizontalalignment('left') - t.set_position((pos[0]+0.5*(alpha_power_total/totalplasma)+0.05,pos[1]-0.1)) + t.set_position((pos[0]+0.5*(p_alpha_total_mw/totalplasma)+0.05,pos[1]-0.1)) if t == diagrams[1].texts[0]: # H&CD power t.set_horizontalalignment('right') t.set_position((pos[0]-0.5*((pinjht+p_hcd_injected_total_mw)/totalplasma)-0.05,pos[1])) @@ -570,13 +570,13 @@ def plot_sankey(mfilename="MFILE.DAT"): # Plot simplified power flow Sankey Dia -1 ) # nuclear heating in the CP shield (MW) emultmw = m_file.data["emultmw"].get_scan(-1) # Blanket energy multiplication (MW) - alpha_power_total = m_file.data["alpha_power_total"].get_scan( + p_alpha_total_mw = m_file.data["p_alpha_total_mw"].get_scan( -1 ) # Alpha power (MW) f_alpha_plasma = m_file.data["f_alpha_plasma"].get_scan( -1 ) # Fraction of alpha power deposited in plasma - p_fw_alpha_mw = alpha_power_total * ( + p_fw_alpha_mw = p_alpha_total_mw * ( 1 - f_alpha_plasma ) # Alpha power hitting 1st wall (MW) itart = m_file.data["itart"].get_scan( diff --git a/process/physics.py b/process/physics.py index 8aed0a9ceb..c5470b17a3 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2172,7 +2172,7 @@ def physics(self): ( physics_variables.neutron_power_density_total, physics_variables.alpha_power_plasma, - physics_variables.alpha_power_total, + physics_variables.p_alpha_total_mw, physics_variables.neutron_power_plasma, physics_variables.neutron_power_total, physics_variables.non_alpha_charged_power, @@ -2328,7 +2328,7 @@ def physics(self): ) physics_variables.p_plasma_separatrix_mw = ( - physics_variables.f_alpha_plasma * physics_variables.alpha_power_total + physics_variables.f_alpha_plasma * physics_variables.p_alpha_total_mw + physics_variables.non_alpha_charged_power + pinj + physics_variables.p_plasma_ohmic_mw @@ -2366,7 +2366,7 @@ def physics(self): ) # Power transported to the first wall by escaped alpha particles - physics_variables.p_fw_alpha_mw = physics_variables.alpha_power_total * ( + physics_variables.p_fw_alpha_mw = physics_variables.p_alpha_total_mw * ( 1.0e0 - physics_variables.f_alpha_plasma ) @@ -2400,7 +2400,7 @@ def physics(self): physics_variables.p_plasma_loss_mw, ) = self.calculate_confinement_time( physics_variables.m_fuel_amu, - physics_variables.alpha_power_total, + physics_variables.p_alpha_total_mw, physics_variables.aspect, physics_variables.bt, physics_variables.nd_ions_total, @@ -2670,7 +2670,7 @@ def physics(self): # Calculate some derived quantities that may not have been defined earlier physics_module.total_loss_power = 1e6 * ( - physics_variables.f_alpha_plasma * physics_variables.alpha_power_total + physics_variables.f_alpha_plasma * physics_variables.p_alpha_total_mw + physics_variables.non_alpha_charged_power + physics_variables.p_plasma_ohmic_mw + current_drive_variables.p_hcd_injected_total_mw @@ -4724,8 +4724,8 @@ def outplas(self): po.ovarre( self.outfile, "Alpha power: total (MW)", - "(alpha_power_total)", - physics_variables.alpha_power_total, + "(p_alpha_total_mw)", + physics_variables.p_alpha_total_mw, "OP ", ) po.ovarre( @@ -4822,7 +4822,7 @@ def outplas(self): "OP ", ) tot_power_plasma = ( - physics_variables.f_alpha_plasma * physics_variables.alpha_power_total + physics_variables.f_alpha_plasma * physics_variables.p_alpha_total_mw + physics_variables.non_alpha_charged_power + physics_variables.p_plasma_ohmic_mw + current_drive_variables.p_hcd_injected_total_mw @@ -6092,7 +6092,7 @@ def output_confinement_comparison(self, istell: int) -> None: _, ) = self.calculate_confinement_time( physics_variables.m_fuel_amu, - physics_variables.alpha_power_total, + physics_variables.p_alpha_total_mw, physics_variables.aspect, physics_variables.bt, physics_variables.nd_ions_total, @@ -7016,7 +7016,7 @@ def fhz(hfact: float) -> float: _, ) = self.calculate_confinement_time( physics_variables.m_fuel_amu, - physics_variables.alpha_power_total, + physics_variables.p_alpha_total_mw, physics_variables.aspect, physics_variables.bt, physics_variables.nd_ions_total, @@ -7072,7 +7072,7 @@ def fhz(hfact: float) -> float: @staticmethod def calculate_confinement_time( m_fuel_amu: float, - alpha_power_total: float, + p_alpha_total_mw: float, aspect: float, bt: float, nd_ions_total: float, @@ -7101,7 +7101,7 @@ def calculate_confinement_time( Calculate the confinement times and the transport power loss terms. :param m_fuel_amu: Average mass of fuel (amu) - :param alpha_power_total: Alpha particle power (MW) + :param p_alpha_total_mw: Alpha particle power (MW) :param aspect: Aspect ratio :param bt: Toroidal field on axis (T) :param nd_ions_total: Total ion density (/m3) @@ -7140,7 +7140,7 @@ def calculate_confinement_time( # Calculate heating power (MW) p_plasma_loss_mw = ( - physics_variables.f_alpha_plasma * alpha_power_total + physics_variables.f_alpha_plasma * p_alpha_total_mw + non_alpha_charged_power + physics_variables.p_plasma_ohmic_mw ) @@ -8358,7 +8358,7 @@ def init_physics_variables(): physics_variables.alpha_power_electron_density = 0.0 physics_variables.p_fw_alpha_mw = 0.0 physics_variables.alpha_power_ions_density = 0.0 - physics_variables.alpha_power_total = 0.0 + physics_variables.p_alpha_total_mw = 0.0 physics_variables.alpha_power_plasma = 0.0 physics_variables.alpha_power_beams = 0.0 physics_variables.non_alpha_charged_power = 0.0 diff --git a/process/power.py b/process/power.py index 6b9310164d..8e4e5bae4f 100644 --- a/process/power.py +++ b/process/power.py @@ -1705,8 +1705,8 @@ def power2(self, output: bool): po.ovarrf( self.outfile, "Alpha power deposited in plasma (MW)", - "(f_alpha_plasma*alpha_power_total)", - physics_variables.f_alpha_plasma * physics_variables.alpha_power_total, + "(f_alpha_plasma*p_alpha_total_mw)", + physics_variables.f_alpha_plasma * physics_variables.p_alpha_total_mw, "OP ", ) po.ovarrf( @@ -1724,9 +1724,9 @@ def power2(self, output: bool): "OP ", ) # if (physics_variables.i_plasma_ignited == 1) : - # po.ovarrf(self.outfile,'Total (MW)','',f_alpha_plasma*physics_variables.alpha_power_total+physics_variables.non_alpha_charged_power+p_plasma_ohmic_mw, 'OP ') + # po.ovarrf(self.outfile,'Total (MW)','',f_alpha_plasma*physics_variables.p_alpha_total_mw+physics_variables.non_alpha_charged_power+p_plasma_ohmic_mw, 'OP ') # po.oblnkl(self.outfile) - # if (abs(sum - (physics_variables.f_alpha_plasma*physics_variables.alpha_power_total+physics_variables.non_alpha_charged_power+physics_variables.p_plasma_ohmic_mw)) > 5.0e0) : + # if (abs(sum - (physics_variables.f_alpha_plasma*physics_variables.p_alpha_total_mw+physics_variables.non_alpha_charged_power+physics_variables.p_plasma_ohmic_mw)) > 5.0e0) : # write(*,*) 'WARNING: Power balance across separatrix is in error by more than 5 MW.' # po.ocmmnt(self.outfile,'WARNING: Power balance across separatrix is in error by more than 5 MW.') # @@ -1742,7 +1742,7 @@ def power2(self, output: bool): self.outfile, "Total (MW)", "", - physics_variables.f_alpha_plasma * physics_variables.alpha_power_total + physics_variables.f_alpha_plasma * physics_variables.p_alpha_total_mw + physics_variables.non_alpha_charged_power + physics_variables.p_plasma_ohmic_mw + pinj, @@ -1754,7 +1754,7 @@ def power2(self, output: bool): total - ( physics_variables.f_alpha_plasma - * physics_variables.alpha_power_total + * physics_variables.p_alpha_total_mw + physics_variables.non_alpha_charged_power + physics_variables.p_plasma_ohmic_mw + pinj diff --git a/process/stellarator.py b/process/stellarator.py index c4d4a1f091..6308874a3f 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -4275,7 +4275,7 @@ def stphys(self, output): ( physics_variables.neutron_power_density_total, physics_variables.alpha_power_plasma, - physics_variables.alpha_power_total, + physics_variables.p_alpha_total_mw, physics_variables.neutron_power_plasma, physics_variables.neutron_power_total, physics_variables.non_alpha_charged_power, @@ -4392,7 +4392,7 @@ def stphys(self, output): # physics_variables.p_plasma_rad_mw here is core + edge (no SOL) powht = ( - physics_variables.f_alpha_plasma * physics_variables.alpha_power_total + physics_variables.f_alpha_plasma * physics_variables.p_alpha_total_mw + physics_variables.non_alpha_charged_power + physics_variables.p_plasma_ohmic_mw - physics_variables.pden_plasma_rad_mw * physics_variables.vol_plasma @@ -4433,7 +4433,7 @@ def stphys(self, output): # Power transported to the first wall by escaped alpha particles - physics_variables.p_fw_alpha_mw = physics_variables.alpha_power_total * ( + physics_variables.p_fw_alpha_mw = physics_variables.p_alpha_total_mw * ( 1.0e0 - physics_variables.f_alpha_plasma ) @@ -4468,7 +4468,7 @@ def stphys(self, output): ) physics_variables.rad_fraction_total = physics_variables.p_plasma_rad_mw / ( - physics_variables.f_alpha_plasma * physics_variables.alpha_power_total + physics_variables.f_alpha_plasma * physics_variables.p_alpha_total_mw + physics_variables.non_alpha_charged_power + physics_variables.p_plasma_ohmic_mw + current_drive_variables.p_hcd_injected_total_mw @@ -4487,7 +4487,7 @@ def stphys(self, output): physics_variables.p_plasma_loss_mw, ) = self.physics.calculate_confinement_time( physics_variables.m_fuel_amu, - physics_variables.alpha_power_total, + physics_variables.p_alpha_total_mw, physics_variables.aspect, physics_variables.bt, physics_variables.nd_ions_total, diff --git a/source/fortran/physics_variables.f90 b/source/fortran/physics_variables.f90 index bab149c771..20328cdde7 100644 --- a/source/fortran/physics_variables.f90 +++ b/source/fortran/physics_variables.f90 @@ -600,7 +600,7 @@ module physics_variables real(dp) :: alpha_power_plasma !! Alpha power from only the plasma (MW) - real(dp) :: alpha_power_total + real(dp) :: p_alpha_total_mw !! Total alpha power from plasma and beams (MW) real(dp) :: alpha_power_beams diff --git a/tests/unit/test_fusion_reactions.py b/tests/unit/test_fusion_reactions.py index 24d8c4e9a0..c207f0c683 100644 --- a/tests/unit/test_fusion_reactions.py +++ b/tests/unit/test_fusion_reactions.py @@ -169,7 +169,7 @@ def test_set_fusion_powers(setfusionpowersparam, monkeypatch): ( neutron_power_density_total, alpha_power_plasma, - alpha_power_total, + p_alpha_total_mw, neutron_power_plasma, neutron_power_total, non_alpha_charged_power, @@ -194,7 +194,7 @@ def test_set_fusion_powers(setfusionpowersparam, monkeypatch): assert neutron_power_density_total == pytest.approx( setfusionpowersparam.expected_neutron_power_density ) - assert alpha_power_total == pytest.approx( + assert p_alpha_total_mw == pytest.approx( setfusionpowersparam.expected_alpha_power_total ) assert neutron_power_total == pytest.approx( diff --git a/tests/unit/test_physics.py b/tests/unit/test_physics.py index 7621e8bfb5..b8611fe4dd 100644 --- a/tests/unit/test_physics.py +++ b/tests/unit/test_physics.py @@ -2384,7 +2384,7 @@ class ConfinementTimeParam(NamedTuple): m_fuel_amu: Any = None - alpha_power_total: Any = None + p_alpha_total_mw: Any = None aspect: Any = None @@ -2462,7 +2462,7 @@ class ConfinementTimeParam(NamedTuple): i_confinement_time=32, i_plasma_ignited=0, m_fuel_amu=2.5, - alpha_power_total=319.03020327154269, + p_alpha_total_mw=319.03020327154269, aspect=3, bt=5.2375830857646202, dene=8.0593948787884524e19, @@ -2504,7 +2504,7 @@ class ConfinementTimeParam(NamedTuple): i_confinement_time=33, i_plasma_ignited=0, m_fuel_amu=2.5, - alpha_power_total=319.03020327154269, + p_alpha_total_mw=319.03020327154269, aspect=3, bt=5.2375830857646202, dene=8.0593948787884524e19, @@ -2546,7 +2546,7 @@ class ConfinementTimeParam(NamedTuple): i_confinement_time=34, i_plasma_ignited=0, m_fuel_amu=2.5, - alpha_power_total=319.03020327154269, + p_alpha_total_mw=319.03020327154269, aspect=3, bt=5.2375830857646202, dene=8.0593948787884524e19, @@ -2588,7 +2588,7 @@ class ConfinementTimeParam(NamedTuple): i_confinement_time=35, i_plasma_ignited=0, m_fuel_amu=2.5, - alpha_power_total=319.03020327154269, + p_alpha_total_mw=319.03020327154269, aspect=3, bt=5.2375830857646202, dene=8.0593948787884524e19, @@ -2630,7 +2630,7 @@ class ConfinementTimeParam(NamedTuple): i_confinement_time=36, i_plasma_ignited=0, m_fuel_amu=2.5, - alpha_power_total=319.03020327154269, + p_alpha_total_mw=319.03020327154269, aspect=3, bt=5.2375830857646202, dene=8.0593948787884524e19, @@ -2672,7 +2672,7 @@ class ConfinementTimeParam(NamedTuple): i_confinement_time=37, i_plasma_ignited=0, m_fuel_amu=2.5, - alpha_power_total=319.03020327154269, + p_alpha_total_mw=319.03020327154269, aspect=3, bt=5.2375830857646202, dene=8.0593948787884524e19, @@ -2714,7 +2714,7 @@ class ConfinementTimeParam(NamedTuple): i_confinement_time=38, i_plasma_ignited=0, m_fuel_amu=2.5, - alpha_power_total=319.03020327154269, + p_alpha_total_mw=319.03020327154269, aspect=3, bt=5.2375830857646202, dene=8.0593948787884524e19, @@ -2756,7 +2756,7 @@ class ConfinementTimeParam(NamedTuple): i_confinement_time=39, i_plasma_ignited=0, m_fuel_amu=2.5, - alpha_power_total=319.03020327154269, + p_alpha_total_mw=319.03020327154269, aspect=3, bt=5.2375830857646202, dene=8.0593948787884524e19, @@ -2798,7 +2798,7 @@ class ConfinementTimeParam(NamedTuple): i_confinement_time=40, i_plasma_ignited=0, m_fuel_amu=2.5, - alpha_power_total=319.03020327154269, + p_alpha_total_mw=319.03020327154269, aspect=3, bt=5.2375830857646202, dene=8.0593948787884524e19, @@ -2840,7 +2840,7 @@ class ConfinementTimeParam(NamedTuple): i_confinement_time=41, i_plasma_ignited=0, m_fuel_amu=2.5, - alpha_power_total=319.03020327154269, + p_alpha_total_mw=319.03020327154269, aspect=3, bt=5.2375830857646202, dene=8.0593948787884524e19, @@ -2882,7 +2882,7 @@ class ConfinementTimeParam(NamedTuple): i_confinement_time=42, i_plasma_ignited=0, m_fuel_amu=2.5, - alpha_power_total=319.03020327154269, + p_alpha_total_mw=319.03020327154269, aspect=3, bt=5.2375830857646202, dene=8.0593948787884524e19, @@ -2924,7 +2924,7 @@ class ConfinementTimeParam(NamedTuple): i_confinement_time=43, i_plasma_ignited=0, m_fuel_amu=2.5, - alpha_power_total=319.03020327154269, + p_alpha_total_mw=319.03020327154269, aspect=3, bt=5.2375830857646202, dene=8.0593948787884524e19, @@ -2966,7 +2966,7 @@ class ConfinementTimeParam(NamedTuple): i_confinement_time=44, i_plasma_ignited=0, m_fuel_amu=2.5, - alpha_power_total=319.03020327154269, + p_alpha_total_mw=319.03020327154269, aspect=3, bt=5.2375830857646202, dene=8.0593948787884524e19, @@ -3008,7 +3008,7 @@ class ConfinementTimeParam(NamedTuple): i_confinement_time=45, i_plasma_ignited=0, m_fuel_amu=2.5, - alpha_power_total=319.03020327154269, + p_alpha_total_mw=319.03020327154269, aspect=3, bt=5.2375830857646202, dene=8.0593948787884524e19, @@ -3050,7 +3050,7 @@ class ConfinementTimeParam(NamedTuple): i_confinement_time=46, i_plasma_ignited=0, m_fuel_amu=2.5, - alpha_power_total=319.03020327154269, + p_alpha_total_mw=319.03020327154269, aspect=3, bt=5.2375830857646202, dene=8.0593948787884524e19, @@ -3092,7 +3092,7 @@ class ConfinementTimeParam(NamedTuple): i_confinement_time=47, i_plasma_ignited=0, m_fuel_amu=2.5, - alpha_power_total=319.03020327154269, + p_alpha_total_mw=319.03020327154269, aspect=3, bt=5.2375830857646202, dene=8.0593948787884524e19, @@ -3170,7 +3170,7 @@ def test_calculate_confinement_time(confinementtimeparam, monkeypatch, physics): i_confinement_time=confinementtimeparam.i_confinement_time, i_plasma_ignited=confinementtimeparam.i_plasma_ignited, m_fuel_amu=confinementtimeparam.m_fuel_amu, - alpha_power_total=confinementtimeparam.alpha_power_total, + p_alpha_total_mw=confinementtimeparam.p_alpha_total_mw, aspect=confinementtimeparam.aspect, bt=confinementtimeparam.bt, dene=confinementtimeparam.dene, diff --git a/tests/unit/test_power.py b/tests/unit/test_power.py index a6dbae5189..468c7d98b8 100644 --- a/tests/unit/test_power.py +++ b/tests/unit/test_power.py @@ -2149,7 +2149,7 @@ class Power2Param(NamedTuple): pfwpmw: Any = None - alpha_power_total: Any = None + p_alpha_total_mw: Any = None i_plasma_ignited: Any = None @@ -2298,7 +2298,7 @@ class Power2Param(NamedTuple): htpsecmw=30.457120415306122, helpow_cryal=0, pfwpmw=0.89998039031509891, - alpha_power_total=396.66154806848488, + p_alpha_total_mw=396.66154806848488, i_plasma_ignited=0, p_plasma_inner_rad_mw=113.53817859231452, p_plasma_rad_mw=287.99550050743289, @@ -2400,7 +2400,7 @@ class Power2Param(NamedTuple): htpsecmw=30.448114159579291, helpow_cryal=0, pfwpmw=0.068213156646500808, - alpha_power_total=396.53774329057228, + p_alpha_total_mw=396.53774329057228, i_plasma_ignited=0, p_plasma_inner_rad_mw=113.53817859231452, p_plasma_rad_mw=287.99550050743289, @@ -2611,7 +2611,7 @@ def test_power2(power2param, monkeypatch, power): monkeypatch.setattr(pfcoil_variables, "pfwpmw", power2param.pfwpmw) monkeypatch.setattr( - physics_variables, "alpha_power_total", power2param.alpha_power_total + physics_variables, "p_alpha_total_mw", power2param.p_alpha_total_mw ) monkeypatch.setattr( From c6ac4b0a74c40b551c69c31a48a3cf19b373f47b Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 8 May 2025 13:57:13 +0100 Subject: [PATCH 12/37] =?UTF-8?q?=F0=9F=94=84=20Rename=20alpha=5Fpower=5Fd?= =?UTF-8?q?ensity=5Ftotal=20to=20pden=5Falpha=5Ftotal=5Fmw=20for=20consist?= =?UTF-8?q?ency=20across=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/data/large_tokamak_nof_2_MFILE.DAT | 2 +- examples/data/large_tokamak_nof_MFILE.DAT | 2 +- process/fusion_reactions.py | 12 ++++++------ process/physics.py | 12 ++++++------ process/physics_functions.py | 6 +++--- process/stellarator.py | 10 +++++----- source/fortran/constraint_equations.f90 | 14 +++++++------- source/fortran/physics_variables.f90 | 2 +- tests/unit/test_fusion_reactions.py | 4 ++-- tests/unit/test_stellarator.py | 10 +++++----- 10 files changed, 37 insertions(+), 37 deletions(-) diff --git a/examples/data/large_tokamak_nof_2_MFILE.DAT b/examples/data/large_tokamak_nof_2_MFILE.DAT index 7c52968c69..9fc04f10e8 100644 --- a/examples/data/large_tokamak_nof_2_MFILE.DAT +++ b/examples/data/large_tokamak_nof_2_MFILE.DAT @@ -298,7 +298,7 @@ Alpha_rate_density:_total_(particles/m3/sec)_____________________________ (fusden_alpha_total)_____ 3.02129344101219072e+17 OP Alpha_rate_density:_plasma_(particles/m3/sec)____________________________ (fusden_plasma_alpha)____ 3.02129344101219072e+17 OP Alpha_power:_total_(MW)__________________________________________________ (p_alpha_total_mw)____________ 3.23657956519217578e+02 OP - Alpha_power_density:_total_(MW/m^3)______________________________________ (alpha_power_density_total)____ 1.71413463146233375e-01 OP + Alpha_power_density:_total_(MW/m^3)______________________________________ (pden_alpha_total_mw)____ 1.71413463146233375e-01 OP Alpha_power:_plasma_only_(MW)____________________________________________ (alpha_power_plasma)___________ 3.23657956519217578e+02 OP Alpha_power_density:_plasma_(MW/m^3)_____________________________________ (alpha_power_density_plasma)___ 1.71413463146233375e-01 OP Alpha_power:_beam-plasma_(MW)____________________________________________ (alpha_power_beams)____________ 0.00000000000000000e+00 OP diff --git a/examples/data/large_tokamak_nof_MFILE.DAT b/examples/data/large_tokamak_nof_MFILE.DAT index 89f9c531d7..fa819cd86e 100644 --- a/examples/data/large_tokamak_nof_MFILE.DAT +++ b/examples/data/large_tokamak_nof_MFILE.DAT @@ -371,7 +371,7 @@ Alpha_rate_density:_total_(particles/m3/sec)_____________________________ (fusden_alpha_total)_____ 3.27225993374781760e+17 OP Alpha_rate_density:_plasma_(particles/m3/sec)____________________________ (fusden_plasma_alpha)____ 3.27225993374781760e+17 OP Alpha_power:_total_(MW)__________________________________________________ (p_alpha_total_mw)____________ 3.50542899600547457e+02 OP - Alpha_power_density:_total_(MW/m^3)______________________________________ (alpha_power_density_total)____ 1.85652078657564057e-01 OP + Alpha_power_density:_total_(MW/m^3)______________________________________ (pden_alpha_total_mw)____ 1.85652078657564057e-01 OP Alpha_power:_plasma_only_(MW)____________________________________________ (alpha_power_plasma)___________ 3.50542899600547457e+02 OP Alpha_power_density:_plasma_(MW/m^3)_____________________________________ (alpha_power_density_plasma)___ 1.85652078657564057e-01 OP Alpha_power:_beam-plasma_(MW)____________________________________________ (alpha_power_beams)____________ 0.00000000000000000e+00 OP diff --git a/process/fusion_reactions.py b/process/fusion_reactions.py index 514d2e8508..6c8f8748da 100644 --- a/process/fusion_reactions.py +++ b/process/fusion_reactions.py @@ -709,7 +709,7 @@ def set_fusion_powers( - neutron_power_plasma (float): Neutron fusion power from only the plasma [MW]. - neutron_power_total (float): Total neutron fusion power from plasma and beams [MW]. - non_alpha_charged_power (float): Other total charged particle fusion power [MW]. - - alpha_power_density_total (float): Alpha power per unit volume, from beams and plasma [MW/m^3]. + - pden_alpha_total_mw (float): Alpha power per unit volume, from beams and plasma [MW/m^3]. - alpha_power_electron_density (float): Alpha power per unit volume to electrons [MW/m^3]. - alpha_power_ions_density (float): Alpha power per unit volume to ions [MW/m^3]. - charged_particle_power (float): Charged particle fusion power [MW]. @@ -726,12 +726,12 @@ def set_fusion_powers( alpha_power_plasma = alpha_power_density_plasma * vol_plasma # Add neutral beam alpha power / volume - alpha_power_density_total = alpha_power_density_plasma + ( + pden_alpha_total_mw = alpha_power_density_plasma + ( alpha_power_beams / vol_plasma ) # Total alpha power - p_alpha_total_mw = alpha_power_density_total * vol_plasma + p_alpha_total_mw = pden_alpha_total_mw * vol_plasma # Neutron Power @@ -770,10 +770,10 @@ def set_fusion_powers( # and ion power balance equations only) # No consideration of charged_power_density here. alpha_power_ions_density = ( - physics_variables.f_alpha_plasma * alpha_power_density_total * f_alpha_ion + physics_variables.f_alpha_plasma * pden_alpha_total_mw * f_alpha_ion ) alpha_power_electron_density = ( - physics_variables.f_alpha_plasma * alpha_power_density_total * f_alpha_electron + physics_variables.f_alpha_plasma * pden_alpha_total_mw * f_alpha_electron ) return ( @@ -783,7 +783,7 @@ def set_fusion_powers( neutron_power_plasma, neutron_power_total, non_alpha_charged_power, - alpha_power_density_total, + pden_alpha_total_mw, alpha_power_electron_density, alpha_power_ions_density, charged_particle_power, diff --git a/process/physics.py b/process/physics.py index c5470b17a3..c79bac7024 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2176,7 +2176,7 @@ def physics(self): physics_variables.neutron_power_plasma, physics_variables.neutron_power_total, physics_variables.non_alpha_charged_power, - physics_variables.alpha_power_density_total, + physics_variables.pden_alpha_total_mw, physics_variables.alpha_power_electron_density, physics_variables.alpha_power_ions_density, physics_variables.charged_particle_power, @@ -2199,7 +2199,7 @@ def physics(self): physics_variables.nd_ions_total, physics_variables.ten, physics_variables.tin, - physics_variables.alpha_power_density_total, + physics_variables.pden_alpha_total_mw, physics_variables.alpha_power_density_plasma, physics_variables.i_beta_fast_alpha, ) @@ -4731,8 +4731,8 @@ def outplas(self): po.ovarre( self.outfile, "Alpha power density: total (MW/m^3)", - "(alpha_power_density_total)", - physics_variables.alpha_power_density_total, + "(pden_alpha_total_mw)", + physics_variables.pden_alpha_total_mw, "OP ", ) po.ovarre( @@ -7047,7 +7047,7 @@ def fhz(hfact: float) -> float: ptrez + ptriz - physics_variables.f_alpha_plasma - * physics_variables.alpha_power_density_total + * physics_variables.pden_alpha_total_mw - physics_variables.charged_power_density - physics_variables.pden_plasma_ohmic_mw ) @@ -8354,7 +8354,7 @@ def init_physics_variables(): physics_variables.j_plasma_0 = 0.0 physics_variables.f_dd_branching_trit = 0.0 physics_variables.alpha_power_density_plasma = 0.0 - physics_variables.alpha_power_density_total = 0.0 + physics_variables.pden_alpha_total_mw = 0.0 physics_variables.alpha_power_electron_density = 0.0 physics_variables.p_fw_alpha_mw = 0.0 physics_variables.alpha_power_ions_density = 0.0 diff --git a/process/physics_functions.py b/process/physics_functions.py index 6720c482ba..8b78140cef 100644 --- a/process/physics_functions.py +++ b/process/physics_functions.py @@ -219,7 +219,7 @@ def fast_alpha_beta( nd_ions_total: float, ten: float, tin: float, - alpha_power_density_total: float, + pden_alpha_total_mw: float, alpha_power_density_plasma: float, i_beta_fast_alpha: int, ) -> float: @@ -236,7 +236,7 @@ def fast_alpha_beta( nd_ions_total (float): Total ion density (m^-3). ten (float): Density-weighted electron temperature (keV). tin (float): Density-weighted ion temperature (keV). - alpha_power_density_total (float): Alpha power per unit volume, from beams and plasma (MW/m^3). + pden_alpha_total_mw (float): Alpha power per unit volume, from beams and plasma (MW/m^3). alpha_power_density_plasma (float): Alpha power per unit volume just from plasma (MW/m^3). i_beta_fast_alpha (int): Switch for fast alpha pressure method. @@ -284,7 +284,7 @@ def fast_alpha_beta( ) fact = max(fact, 0.0) - fact2 = alpha_power_density_total / alpha_power_density_plasma + fact2 = pden_alpha_total_mw / alpha_power_density_plasma beta_fast_alpha = beta_thermal * fact * fact2 else: # negligible alpha production, alpha_power_density = alpha_power_beams = 0 diff --git a/process/stellarator.py b/process/stellarator.py index 6308874a3f..93010829e0 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -4279,7 +4279,7 @@ def stphys(self, output): physics_variables.neutron_power_plasma, physics_variables.neutron_power_total, physics_variables.non_alpha_charged_power, - physics_variables.alpha_power_density_total, + physics_variables.pden_alpha_total_mw, physics_variables.alpha_power_electron_density, physics_variables.alpha_power_ions_density, physics_variables.charged_particle_power, @@ -4302,7 +4302,7 @@ def stphys(self, output): physics_variables.nd_ions_total, physics_variables.ten, physics_variables.tin, - physics_variables.alpha_power_density_total, + physics_variables.pden_alpha_total_mw, physics_variables.alpha_power_density_plasma, physics_variables.i_beta_fast_alpha, ) @@ -4761,7 +4761,7 @@ def calc_neoclassics(self): q_PROCESS = ( ( physics_variables.f_alpha_plasma - * physics_variables.alpha_power_density_total + * physics_variables.pden_alpha_total_mw - physics_variables.pden_plasma_core_rad_mw ) * physics_variables.vol_plasma @@ -4771,7 +4771,7 @@ def calc_neoclassics(self): q_PROCESS_r1 = ( ( physics_variables.f_alpha_plasma - * physics_variables.alpha_power_density_total + * physics_variables.pden_alpha_total_mw - physics_variables.pden_plasma_core_rad_mw ) * physics_variables.vol_plasma @@ -4908,7 +4908,7 @@ def st_calc_eff_chi(self): nominator = ( physics_variables.f_alpha_plasma - * physics_variables.alpha_power_density_total + * physics_variables.pden_alpha_total_mw - physics_variables.pden_plasma_core_rad_mw ) * volscaling diff --git a/source/fortran/constraint_equations.f90 b/source/fortran/constraint_equations.f90 index 6493fc6353..907bf80535 100755 --- a/source/fortran/constraint_equations.f90 +++ b/source/fortran/constraint_equations.f90 @@ -452,14 +452,14 @@ subroutine constraint_eqn_002(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units) !! pden_plasma_rad_mw : input real : total radiation power per volume (MW/m3) !! pden_plasma_core_rad_mw : input real : total core radiation power per volume (MW/m3) !! f_alpha_plasma : input real : fraction of alpha power deposited in plasma - !! alpha_power_density_total : input real : alpha power per volume (MW/m3) + !! pden_alpha_total_mw : input real : alpha power per volume (MW/m3) !! charged_power_density : input real : non-alpha charged particle fusion power per volume (MW/m3) !! pden_plasma_ohmic_mw : input real : ohmic heating power per volume (MW/m3) !! p_hcd_injected_total_mw : input real : total auxiliary injected power (MW) !! vol_plasma : input real : plasma volume (m3) use physics_variables, only: i_rad_loss, i_plasma_ignited, pden_electron_transport_loss_mw, pden_ion_transport_loss_mw, pden_plasma_rad_mw, & - pden_plasma_core_rad_mw, f_alpha_plasma, alpha_power_density_total, charged_power_density, & + pden_plasma_core_rad_mw, f_alpha_plasma, pden_alpha_total_mw, charged_power_density, & pden_plasma_ohmic_mw, vol_plasma use current_drive_variables, only: p_hcd_injected_total_mw @@ -487,10 +487,10 @@ subroutine constraint_eqn_002(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units) ! if plasma not ignited include injected power if (i_plasma_ignited == 0) then - pdenom = f_alpha_plasma*alpha_power_density_total + charged_power_density + pden_plasma_ohmic_mw + p_hcd_injected_total_mw/vol_plasma + pdenom = f_alpha_plasma*pden_alpha_total_mw + charged_power_density + pden_plasma_ohmic_mw + p_hcd_injected_total_mw/vol_plasma else ! if plasma ignited - pdenom = f_alpha_plasma*alpha_power_density_total + charged_power_density + pden_plasma_ohmic_mw + pdenom = f_alpha_plasma*pden_alpha_total_mw + charged_power_density + pden_plasma_ohmic_mw end if tmp_cc = 1.0D0 - pnumerator / pdenom @@ -1030,12 +1030,12 @@ subroutine constraint_eqn_017(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units) !! f_alpha_plasma : input real : fraction of alpha power deposited in plasma !! p_hcd_injected_total_mw : input real : total auxiliary injected power (MW) !! vol_plasma : input real : plasma volume (m3) - !! alpha_power_density_total : input real : alpha power per volume (MW/m3) + !! pden_alpha_total_mw : input real : alpha power per volume (MW/m3) !! charged_power_density : input real : non-alpha charged particle fusion power per volume (MW/m3) !! pden_plasma_ohmic_mw : input real : ohmic heating power per volume (MW/m3) !! fradpwr : input real : f-value for core radiation power limit !! pden_plasma_rad_mw : input real : total radiation power per volume (MW/m3) - use physics_variables, only: f_alpha_plasma, vol_plasma, alpha_power_density_total, charged_power_density, pden_plasma_ohmic_mw, pden_plasma_rad_mw + use physics_variables, only: f_alpha_plasma, vol_plasma, pden_alpha_total_mw, charged_power_density, pden_plasma_ohmic_mw, pden_plasma_rad_mw use current_drive_variables, only: p_hcd_injected_total_mw use constraint_variables, only: fradpwr implicit none @@ -1048,7 +1048,7 @@ subroutine constraint_eqn_017(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units) real(dp) :: pradmaxpv !! Maximum possible power/vol_plasma that can be radiated (local) - pradmaxpv = p_hcd_injected_total_mw/vol_plasma + alpha_power_density_total*f_alpha_plasma + charged_power_density + pden_plasma_ohmic_mw + pradmaxpv = p_hcd_injected_total_mw/vol_plasma + pden_alpha_total_mw*f_alpha_plasma + charged_power_density + pden_plasma_ohmic_mw tmp_cc = pden_plasma_rad_mw/pradmaxpv - 1.0D0 * fradpwr tmp_con = pradmaxpv * (1.0D0 - tmp_cc) tmp_err = pden_plasma_rad_mw * tmp_cc diff --git a/source/fortran/physics_variables.f90 b/source/fortran/physics_variables.f90 index 20328cdde7..55f1817875 100644 --- a/source/fortran/physics_variables.f90 +++ b/source/fortran/physics_variables.f90 @@ -585,7 +585,7 @@ module physics_variables real(dp) :: alpha_power_density_plasma !! Alpha power per volume just from plasma [MW/m3] - real(dp) :: alpha_power_density_total + real(dp) :: pden_alpha_total_mw !! Alpha power per volume from plasma and beams [MW/m3] real(dp) :: alpha_power_electron_density diff --git a/tests/unit/test_fusion_reactions.py b/tests/unit/test_fusion_reactions.py index c207f0c683..e314310245 100644 --- a/tests/unit/test_fusion_reactions.py +++ b/tests/unit/test_fusion_reactions.py @@ -173,7 +173,7 @@ def test_set_fusion_powers(setfusionpowersparam, monkeypatch): neutron_power_plasma, neutron_power_total, non_alpha_charged_power, - alpha_power_density_total, + pden_alpha_total_mw, alpha_power_electron_density, alpha_power_ions_density, charged_particle_power, @@ -188,7 +188,7 @@ def test_set_fusion_powers(setfusionpowersparam, monkeypatch): alpha_power_density_plasma=setfusionpowersparam.alpha_power_density_plasma, ) - assert alpha_power_density_total == pytest.approx( + assert pden_alpha_total_mw == pytest.approx( setfusionpowersparam.expected_alpha_power_density ) assert neutron_power_density_total == pytest.approx( diff --git a/tests/unit/test_stellarator.py b/tests/unit/test_stellarator.py index cf9992eb11..395cc3c57a 100644 --- a/tests/unit/test_stellarator.py +++ b/tests/unit/test_stellarator.py @@ -2736,7 +2736,7 @@ class StCalcEffChiParam(NamedTuple): f_alpha_plasma: Any = None - alpha_power_density_total: Any = None + pden_alpha_total_mw: Any = None pden_plasma_core_rad_mw: Any = None @@ -2766,7 +2766,7 @@ class StCalcEffChiParam(NamedTuple): te0=19.108573496973477, ne0=3.4479000000000007e20, f_alpha_plasma=0.95000000000000007, - alpha_power_density_total=1.2629524018077414, + pden_alpha_total_mw=1.2629524018077414, pden_plasma_core_rad_mw=0.10762698429338043, alphan=0.35000000000000003, alphat=1.2, @@ -2783,7 +2783,7 @@ class StCalcEffChiParam(NamedTuple): te0=17.5, ne0=3.4479000000000007e20, f_alpha_plasma=0.95000000000000007, - alpha_power_density_total=1.0570658694225301, + pden_alpha_total_mw=1.0570658694225301, pden_plasma_core_rad_mw=0.1002475669217598, alphan=0.35000000000000003, alphat=1.2, @@ -2821,8 +2821,8 @@ def test_st_calc_eff_chi(stcalceffchiparam, monkeypatch, stellarator): monkeypatch.setattr( physics_variables, - "alpha_power_density_total", - stcalceffchiparam.alpha_power_density_total, + "pden_alpha_total_mw", + stcalceffchiparam.pden_alpha_total_mw, ) monkeypatch.setattr( From 97a5b9904511224f16b8a089af6a63c273138458 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 8 May 2025 13:57:49 +0100 Subject: [PATCH 13/37] =?UTF-8?q?=F0=9F=94=84=20Rename=20alpha=5Fpower=5Fp?= =?UTF-8?q?lasma=20to=20p=5Fplasma=5Falpha=5Fmw=20for=20consistency=20acro?= =?UTF-8?q?ss=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/data/large_tokamak_nof_2_MFILE.DAT | 2 +- examples/data/large_tokamak_nof_MFILE.DAT | 2 +- process/fusion_reactions.py | 6 +++--- process/physics.py | 8 ++++---- process/stellarator.py | 2 +- source/fortran/physics_variables.f90 | 2 +- tests/unit/test_fusion_reactions.py | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/data/large_tokamak_nof_2_MFILE.DAT b/examples/data/large_tokamak_nof_2_MFILE.DAT index 9fc04f10e8..c418490279 100644 --- a/examples/data/large_tokamak_nof_2_MFILE.DAT +++ b/examples/data/large_tokamak_nof_2_MFILE.DAT @@ -299,7 +299,7 @@ Alpha_rate_density:_plasma_(particles/m3/sec)____________________________ (fusden_plasma_alpha)____ 3.02129344101219072e+17 OP Alpha_power:_total_(MW)__________________________________________________ (p_alpha_total_mw)____________ 3.23657956519217578e+02 OP Alpha_power_density:_total_(MW/m^3)______________________________________ (pden_alpha_total_mw)____ 1.71413463146233375e-01 OP - Alpha_power:_plasma_only_(MW)____________________________________________ (alpha_power_plasma)___________ 3.23657956519217578e+02 OP + Alpha_power:_plasma_only_(MW)____________________________________________ (p_plasma_alpha_mw)___________ 3.23657956519217578e+02 OP Alpha_power_density:_plasma_(MW/m^3)_____________________________________ (alpha_power_density_plasma)___ 1.71413463146233375e-01 OP Alpha_power:_beam-plasma_(MW)____________________________________________ (alpha_power_beams)____________ 0.00000000000000000e+00 OP Alpha_power_per_unit_volume_transferred_to_electrons_(MW/m3)_____________ (alpha_power_electron_density)_ 1.17513473229255330e-01 OP diff --git a/examples/data/large_tokamak_nof_MFILE.DAT b/examples/data/large_tokamak_nof_MFILE.DAT index fa819cd86e..7e5d986ac0 100644 --- a/examples/data/large_tokamak_nof_MFILE.DAT +++ b/examples/data/large_tokamak_nof_MFILE.DAT @@ -372,7 +372,7 @@ Alpha_rate_density:_plasma_(particles/m3/sec)____________________________ (fusden_plasma_alpha)____ 3.27225993374781760e+17 OP Alpha_power:_total_(MW)__________________________________________________ (p_alpha_total_mw)____________ 3.50542899600547457e+02 OP Alpha_power_density:_total_(MW/m^3)______________________________________ (pden_alpha_total_mw)____ 1.85652078657564057e-01 OP - Alpha_power:_plasma_only_(MW)____________________________________________ (alpha_power_plasma)___________ 3.50542899600547457e+02 OP + Alpha_power:_plasma_only_(MW)____________________________________________ (p_plasma_alpha_mw)___________ 3.50542899600547457e+02 OP Alpha_power_density:_plasma_(MW/m^3)_____________________________________ (alpha_power_density_plasma)___ 1.85652078657564057e-01 OP Alpha_power:_beam-plasma_(MW)____________________________________________ (alpha_power_beams)____________ 0.00000000000000000e+00 OP Alpha_power_per_unit_volume_transferred_to_electrons_(MW/m3)_____________ (alpha_power_electron_density)_ 1.25503605903536375e-01 OP diff --git a/process/fusion_reactions.py b/process/fusion_reactions.py index 6c8f8748da..6ac0d361d8 100644 --- a/process/fusion_reactions.py +++ b/process/fusion_reactions.py @@ -704,7 +704,7 @@ def set_fusion_powers( Returns: tuple: A tuple containing the following elements: - neutron_power_density_total (float): Neutron fusion power per unit volume from plasma and beams [MW/m^3]. - - alpha_power_plasma (float): Alpha fusion power from only the plasma [MW]. + - p_plasma_alpha_mw (float): Alpha fusion power from only the plasma [MW]. - p_alpha_total_mw (float): Total alpha fusion power from plasma and beams [MW]. - neutron_power_plasma (float): Neutron fusion power from only the plasma [MW]. - neutron_power_total (float): Total neutron fusion power from plasma and beams [MW]. @@ -723,7 +723,7 @@ def set_fusion_powers( # Alpha power # Calculate alpha power produced just by the plasma - alpha_power_plasma = alpha_power_density_plasma * vol_plasma + p_plasma_alpha_mw = alpha_power_density_plasma * vol_plasma # Add neutral beam alpha power / volume pden_alpha_total_mw = alpha_power_density_plasma + ( @@ -778,7 +778,7 @@ def set_fusion_powers( return ( neutron_power_density_total, - alpha_power_plasma, + p_plasma_alpha_mw, p_alpha_total_mw, neutron_power_plasma, neutron_power_total, diff --git a/process/physics.py b/process/physics.py index c79bac7024..4656d61488 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2171,7 +2171,7 @@ def physics(self): # Create some derived values and add beam contribution to fusion power ( physics_variables.neutron_power_density_total, - physics_variables.alpha_power_plasma, + physics_variables.p_plasma_alpha_mw, physics_variables.p_alpha_total_mw, physics_variables.neutron_power_plasma, physics_variables.neutron_power_total, @@ -4738,8 +4738,8 @@ def outplas(self): po.ovarre( self.outfile, "Alpha power: plasma only (MW)", - "(alpha_power_plasma)", - physics_variables.alpha_power_plasma, + "(p_plasma_alpha_mw)", + physics_variables.p_plasma_alpha_mw, "OP ", ) po.ovarre( @@ -8359,7 +8359,7 @@ def init_physics_variables(): physics_variables.p_fw_alpha_mw = 0.0 physics_variables.alpha_power_ions_density = 0.0 physics_variables.p_alpha_total_mw = 0.0 - physics_variables.alpha_power_plasma = 0.0 + physics_variables.p_plasma_alpha_mw = 0.0 physics_variables.alpha_power_beams = 0.0 physics_variables.non_alpha_charged_power = 0.0 physics_variables.charged_power_density = 0.0 diff --git a/process/stellarator.py b/process/stellarator.py index 93010829e0..e063a63be3 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -4274,7 +4274,7 @@ def stphys(self, output): # Create some derived values and add beam contribution to fusion power ( physics_variables.neutron_power_density_total, - physics_variables.alpha_power_plasma, + physics_variables.p_plasma_alpha_mw, physics_variables.p_alpha_total_mw, physics_variables.neutron_power_plasma, physics_variables.neutron_power_total, diff --git a/source/fortran/physics_variables.f90 b/source/fortran/physics_variables.f90 index 55f1817875..defb5f2aa6 100644 --- a/source/fortran/physics_variables.f90 +++ b/source/fortran/physics_variables.f90 @@ -597,7 +597,7 @@ module physics_variables real(dp) :: alpha_power_ions_density !! alpha power per volume to ions (MW/m3) - real(dp) :: alpha_power_plasma + real(dp) :: p_plasma_alpha_mw !! Alpha power from only the plasma (MW) real(dp) :: p_alpha_total_mw diff --git a/tests/unit/test_fusion_reactions.py b/tests/unit/test_fusion_reactions.py index e314310245..01c4305b60 100644 --- a/tests/unit/test_fusion_reactions.py +++ b/tests/unit/test_fusion_reactions.py @@ -168,7 +168,7 @@ def test_set_fusion_powers(setfusionpowersparam, monkeypatch): ( neutron_power_density_total, - alpha_power_plasma, + p_plasma_alpha_mw, p_alpha_total_mw, neutron_power_plasma, neutron_power_total, From f0d4e73f271523ae0e1881b78abc79cb65cb5965 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 8 May 2025 13:58:24 +0100 Subject: [PATCH 14/37] =?UTF-8?q?=F0=9F=94=84=20Rename=20alpha=5Fpower=5Fd?= =?UTF-8?q?ensity=5Fplasma=20to=20pden=5Fplasma=5Falpha=5Fmw=20for=20consi?= =?UTF-8?q?stency=20across=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fusion_reactions/plasma_reactions.md | 2 +- examples/data/large_tokamak_nof_2_MFILE.DAT | 2 +- examples/data/large_tokamak_nof_MFILE.DAT | 2 +- process/fusion_reactions.py | 10 +++++----- process/physics.py | 10 +++++----- process/physics_functions.py | 6 +++--- process/stellarator.py | 4 ++-- source/fortran/physics_variables.f90 | 2 +- tests/unit/test_fusion_reactions.py | 12 ++++++------ 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md b/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md index 855a72c5b9..cfaff31bfc 100644 --- a/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md +++ b/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md @@ -180,7 +180,7 @@ It updates the instance attributes for the cumulative power densities and reacti This method sets the required physics variables in the `physics_variables` and `physics_module` modules. It updates the global physics variables and module variables with the current instance's fusion power densities and reaction rates. #### Updates: -- `physics_variables.alpha_power_density_plasma`: Updated with `self.alpha_power_density` +- `physics_variables.pden_plasma_alpha_mw`: Updated with `self.alpha_power_density` - `physics_variables.charged_power_density`: Updated with `self.charged_power_density` - `physics_variables.neutron_power_density_plasma`: Updated with `self.neutron_power_density` - `physics_variables.fusden_plasma`: Updated with `self.fusion_rate_density` diff --git a/examples/data/large_tokamak_nof_2_MFILE.DAT b/examples/data/large_tokamak_nof_2_MFILE.DAT index c418490279..03fd651f6b 100644 --- a/examples/data/large_tokamak_nof_2_MFILE.DAT +++ b/examples/data/large_tokamak_nof_2_MFILE.DAT @@ -300,7 +300,7 @@ Alpha_power:_total_(MW)__________________________________________________ (p_alpha_total_mw)____________ 3.23657956519217578e+02 OP Alpha_power_density:_total_(MW/m^3)______________________________________ (pden_alpha_total_mw)____ 1.71413463146233375e-01 OP Alpha_power:_plasma_only_(MW)____________________________________________ (p_plasma_alpha_mw)___________ 3.23657956519217578e+02 OP - Alpha_power_density:_plasma_(MW/m^3)_____________________________________ (alpha_power_density_plasma)___ 1.71413463146233375e-01 OP + Alpha_power_density:_plasma_(MW/m^3)_____________________________________ (pden_plasma_alpha_mw)___ 1.71413463146233375e-01 OP Alpha_power:_beam-plasma_(MW)____________________________________________ (alpha_power_beams)____________ 0.00000000000000000e+00 OP Alpha_power_per_unit_volume_transferred_to_electrons_(MW/m3)_____________ (alpha_power_electron_density)_ 1.17513473229255330e-01 OP Alpha_power_per_unit_volume_transferred_to_ions_(MW/m3)__________________ (alpha_power_ions_density)_____ 4.53293167596663799e-02 OP diff --git a/examples/data/large_tokamak_nof_MFILE.DAT b/examples/data/large_tokamak_nof_MFILE.DAT index 7e5d986ac0..23a72bd297 100644 --- a/examples/data/large_tokamak_nof_MFILE.DAT +++ b/examples/data/large_tokamak_nof_MFILE.DAT @@ -373,7 +373,7 @@ Alpha_power:_total_(MW)__________________________________________________ (p_alpha_total_mw)____________ 3.50542899600547457e+02 OP Alpha_power_density:_total_(MW/m^3)______________________________________ (pden_alpha_total_mw)____ 1.85652078657564057e-01 OP Alpha_power:_plasma_only_(MW)____________________________________________ (p_plasma_alpha_mw)___________ 3.50542899600547457e+02 OP - Alpha_power_density:_plasma_(MW/m^3)_____________________________________ (alpha_power_density_plasma)___ 1.85652078657564057e-01 OP + Alpha_power_density:_plasma_(MW/m^3)_____________________________________ (pden_plasma_alpha_mw)___ 1.85652078657564057e-01 OP Alpha_power:_beam-plasma_(MW)____________________________________________ (alpha_power_beams)____________ 0.00000000000000000e+00 OP Alpha_power_per_unit_volume_transferred_to_electrons_(MW/m3)_____________ (alpha_power_electron_density)_ 1.25503605903536375e-01 OP Alpha_power_per_unit_volume_transferred_to_ions_(MW/m3)__________________ (alpha_power_ions_density)_____ 5.08658688211494556e-02 OP diff --git a/process/fusion_reactions.py b/process/fusion_reactions.py index 6ac0d361d8..149e7a6329 100644 --- a/process/fusion_reactions.py +++ b/process/fusion_reactions.py @@ -532,7 +532,7 @@ def set_physics_variables(self) -> None: Returns: None """ - physics_variables.alpha_power_density_plasma = self.alpha_power_density + physics_variables.pden_plasma_alpha_mw = self.alpha_power_density physics_variables.charged_power_density = self.charged_power_density physics_variables.neutron_power_density_plasma = self.neutron_power_density physics_variables.fusden_plasma = self.fusion_rate_density @@ -686,7 +686,7 @@ def set_fusion_powers( charged_power_density: float, neutron_power_density_plasma: float, vol_plasma: float, - alpha_power_density_plasma: float, + pden_plasma_alpha_mw: float, ) -> tuple: """ @@ -699,7 +699,7 @@ def set_fusion_powers( charged_power_density (float): Other charged particle fusion power per unit volume (MW/m^3). neutron_power_density_plasma (float): Neutron fusion power per unit volume just from plasma (MW/m^3). vol_plasma (float): Plasma volume (m^3). - alpha_power_density_plasma (float): Alpha power per unit volume just from plasma (MW/m^3). + pden_plasma_alpha_mw (float): Alpha power per unit volume just from plasma (MW/m^3). Returns: tuple: A tuple containing the following elements: @@ -723,10 +723,10 @@ def set_fusion_powers( # Alpha power # Calculate alpha power produced just by the plasma - p_plasma_alpha_mw = alpha_power_density_plasma * vol_plasma + p_plasma_alpha_mw = pden_plasma_alpha_mw * vol_plasma # Add neutral beam alpha power / volume - pden_alpha_total_mw = alpha_power_density_plasma + ( + pden_alpha_total_mw = pden_plasma_alpha_mw + ( alpha_power_beams / vol_plasma ) diff --git a/process/physics.py b/process/physics.py index 4656d61488..37fe0e6eaa 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2188,7 +2188,7 @@ def physics(self): physics_variables.charged_power_density, physics_variables.neutron_power_density_plasma, physics_variables.vol_plasma, - physics_variables.alpha_power_density_plasma, + physics_variables.pden_plasma_alpha_mw, ) physics_variables.beta_fast_alpha = physics_funcs.fast_alpha_beta( @@ -2200,7 +2200,7 @@ def physics(self): physics_variables.ten, physics_variables.tin, physics_variables.pden_alpha_total_mw, - physics_variables.alpha_power_density_plasma, + physics_variables.pden_plasma_alpha_mw, physics_variables.i_beta_fast_alpha, ) @@ -4745,8 +4745,8 @@ def outplas(self): po.ovarre( self.outfile, "Alpha power density: plasma (MW/m^3)", - "(alpha_power_density_plasma)", - physics_variables.alpha_power_density_plasma, + "(pden_plasma_alpha_mw)", + physics_variables.pden_plasma_alpha_mw, "OP ", ) po.ovarre( @@ -8353,7 +8353,7 @@ def init_physics_variables(): physics_variables.p0 = 0.0 physics_variables.j_plasma_0 = 0.0 physics_variables.f_dd_branching_trit = 0.0 - physics_variables.alpha_power_density_plasma = 0.0 + physics_variables.pden_plasma_alpha_mw = 0.0 physics_variables.pden_alpha_total_mw = 0.0 physics_variables.alpha_power_electron_density = 0.0 physics_variables.p_fw_alpha_mw = 0.0 diff --git a/process/physics_functions.py b/process/physics_functions.py index 8b78140cef..069fcad37e 100644 --- a/process/physics_functions.py +++ b/process/physics_functions.py @@ -220,7 +220,7 @@ def fast_alpha_beta( ten: float, tin: float, pden_alpha_total_mw: float, - alpha_power_density_plasma: float, + pden_plasma_alpha_mw: float, i_beta_fast_alpha: int, ) -> float: """ @@ -237,7 +237,7 @@ def fast_alpha_beta( ten (float): Density-weighted electron temperature (keV). tin (float): Density-weighted ion temperature (keV). pden_alpha_total_mw (float): Alpha power per unit volume, from beams and plasma (MW/m^3). - alpha_power_density_plasma (float): Alpha power per unit volume just from plasma (MW/m^3). + pden_plasma_alpha_mw (float): Alpha power per unit volume just from plasma (MW/m^3). i_beta_fast_alpha (int): Switch for fast alpha pressure method. Returns: @@ -284,7 +284,7 @@ def fast_alpha_beta( ) fact = max(fact, 0.0) - fact2 = pden_alpha_total_mw / alpha_power_density_plasma + fact2 = pden_alpha_total_mw / pden_plasma_alpha_mw beta_fast_alpha = beta_thermal * fact * fact2 else: # negligible alpha production, alpha_power_density = alpha_power_beams = 0 diff --git a/process/stellarator.py b/process/stellarator.py index e063a63be3..ef056952f3 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -4291,7 +4291,7 @@ def stphys(self, output): physics_variables.charged_power_density, physics_variables.neutron_power_density_plasma, physics_variables.vol_plasma, - physics_variables.alpha_power_density_plasma, + physics_variables.pden_plasma_alpha_mw, ) physics_variables.beta_fast_alpha = physics_funcs.fast_alpha_beta( @@ -4303,7 +4303,7 @@ def stphys(self, output): physics_variables.ten, physics_variables.tin, physics_variables.pden_alpha_total_mw, - physics_variables.alpha_power_density_plasma, + physics_variables.pden_plasma_alpha_mw, physics_variables.i_beta_fast_alpha, ) diff --git a/source/fortran/physics_variables.f90 b/source/fortran/physics_variables.f90 index defb5f2aa6..dc2708cba0 100644 --- a/source/fortran/physics_variables.f90 +++ b/source/fortran/physics_variables.f90 @@ -582,7 +582,7 @@ module physics_variables real(dp) :: f_dd_branching_trit !! branching ratio for DD -> T - real(dp) :: alpha_power_density_plasma + real(dp) :: pden_plasma_alpha_mw !! Alpha power per volume just from plasma [MW/m3] real(dp) :: pden_alpha_total_mw diff --git a/tests/unit/test_fusion_reactions.py b/tests/unit/test_fusion_reactions.py index 01c4305b60..65bc3b9f37 100644 --- a/tests/unit/test_fusion_reactions.py +++ b/tests/unit/test_fusion_reactions.py @@ -41,7 +41,7 @@ class SetFusionPowersParam(NamedTuple): vol_plasma: Any = None - alpha_power_density_plasma: Any = None + pden_plasma_alpha_mw: Any = None neutron_power_density_plasma: Any = None @@ -77,7 +77,7 @@ class SetFusionPowersParam(NamedTuple): alpha_power_beams=0, charged_power_density=0.00066, vol_plasma=2426.25, - alpha_power_density_plasma=0.163, + pden_plasma_alpha_mw=0.163, neutron_power_density_plasma=0.654, expected_alpha_power_density=0.163, expected_neutron_power_density=0.654, @@ -97,7 +97,7 @@ class SetFusionPowersParam(NamedTuple): alpha_power_beams=100.5, charged_power_density=0.00066, vol_plasma=2426.25, - alpha_power_density_plasma=0.163, + pden_plasma_alpha_mw=0.163, neutron_power_density_plasma=0.654, expected_alpha_power_density=0.20442195, expected_neutron_power_density=0.8183263050336705, @@ -117,7 +117,7 @@ class SetFusionPowersParam(NamedTuple): alpha_power_beams=100.5, charged_power_density=0.00066, vol_plasma=2426.25, - alpha_power_density_plasma=0.163, + pden_plasma_alpha_mw=0.163, neutron_power_density_plasma=0.654, expected_alpha_power_density=0.20442195, expected_neutron_power_density=0.8183263050336705, @@ -137,7 +137,7 @@ class SetFusionPowersParam(NamedTuple): alpha_power_beams=100.5, charged_power_density=0.00066, vol_plasma=2426.25, - alpha_power_density_plasma=0.163, + pden_plasma_alpha_mw=0.163, neutron_power_density_plasma=0.654, expected_alpha_power_density=0.20442195, expected_neutron_power_density=0.8183263050336705, @@ -185,7 +185,7 @@ def test_set_fusion_powers(setfusionpowersparam, monkeypatch): charged_power_density=setfusionpowersparam.charged_power_density, neutron_power_density_plasma=setfusionpowersparam.neutron_power_density_plasma, vol_plasma=setfusionpowersparam.vol_plasma, - alpha_power_density_plasma=setfusionpowersparam.alpha_power_density_plasma, + pden_plasma_alpha_mw=setfusionpowersparam.pden_plasma_alpha_mw, ) assert pden_alpha_total_mw == pytest.approx( From a10e43993d1d15971fa2a37ea76b226d47b2156a Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 8 May 2025 13:59:39 +0100 Subject: [PATCH 15/37] =?UTF-8?q?=F0=9F=94=84=20Rename=20alpha=5Fpower=5Fb?= =?UTF-8?q?eams=20to=20p=5Fbeam=5Falpha=5Fmw=20for=20consistency=20across?= =?UTF-8?q?=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/data/large_tokamak_nof_2_MFILE.DAT | 2 +- examples/data/large_tokamak_nof_MFILE.DAT | 2 +- process/fusion_reactions.py | 14 +++++++------- process/physics.py | 18 +++++++++--------- process/physics_functions.py | 2 +- process/stellarator.py | 10 +++++----- source/fortran/physics_variables.f90 | 2 +- tests/unit/test_fusion_reactions.py | 16 ++++++++-------- 8 files changed, 33 insertions(+), 33 deletions(-) diff --git a/examples/data/large_tokamak_nof_2_MFILE.DAT b/examples/data/large_tokamak_nof_2_MFILE.DAT index 03fd651f6b..e200ad0a01 100644 --- a/examples/data/large_tokamak_nof_2_MFILE.DAT +++ b/examples/data/large_tokamak_nof_2_MFILE.DAT @@ -301,7 +301,7 @@ Alpha_power_density:_total_(MW/m^3)______________________________________ (pden_alpha_total_mw)____ 1.71413463146233375e-01 OP Alpha_power:_plasma_only_(MW)____________________________________________ (p_plasma_alpha_mw)___________ 3.23657956519217578e+02 OP Alpha_power_density:_plasma_(MW/m^3)_____________________________________ (pden_plasma_alpha_mw)___ 1.71413463146233375e-01 OP - Alpha_power:_beam-plasma_(MW)____________________________________________ (alpha_power_beams)____________ 0.00000000000000000e+00 OP + Alpha_power:_beam-plasma_(MW)____________________________________________ (p_beam_alpha_mw)____________ 0.00000000000000000e+00 OP Alpha_power_per_unit_volume_transferred_to_electrons_(MW/m3)_____________ (alpha_power_electron_density)_ 1.17513473229255330e-01 OP Alpha_power_per_unit_volume_transferred_to_ions_(MW/m3)__________________ (alpha_power_ions_density)_____ 4.53293167596663799e-02 OP Neutron_power:_total_(MW)________________________________________________ (neutron_power_total)__________ 1.28469670088750900e+03 OP diff --git a/examples/data/large_tokamak_nof_MFILE.DAT b/examples/data/large_tokamak_nof_MFILE.DAT index 23a72bd297..e559522591 100644 --- a/examples/data/large_tokamak_nof_MFILE.DAT +++ b/examples/data/large_tokamak_nof_MFILE.DAT @@ -374,7 +374,7 @@ Alpha_power_density:_total_(MW/m^3)______________________________________ (pden_alpha_total_mw)____ 1.85652078657564057e-01 OP Alpha_power:_plasma_only_(MW)____________________________________________ (p_plasma_alpha_mw)___________ 3.50542899600547457e+02 OP Alpha_power_density:_plasma_(MW/m^3)_____________________________________ (pden_plasma_alpha_mw)___ 1.85652078657564057e-01 OP - Alpha_power:_beam-plasma_(MW)____________________________________________ (alpha_power_beams)____________ 0.00000000000000000e+00 OP + Alpha_power:_beam-plasma_(MW)____________________________________________ (p_beam_alpha_mw)____________ 0.00000000000000000e+00 OP Alpha_power_per_unit_volume_transferred_to_electrons_(MW/m3)_____________ (alpha_power_electron_density)_ 1.25503605903536375e-01 OP Alpha_power_per_unit_volume_transferred_to_ions_(MW/m3)__________________ (alpha_power_ions_density)_____ 5.08658688211494556e-02 OP Neutron_power:_total_(MW)________________________________________________ (neutron_power_total)__________ 1.39144256113123765e+03 OP diff --git a/process/fusion_reactions.py b/process/fusion_reactions.py index 149e7a6329..67e4a3eaf9 100644 --- a/process/fusion_reactions.py +++ b/process/fusion_reactions.py @@ -682,7 +682,7 @@ def bosch_hale_reactivity( def set_fusion_powers( f_alpha_electron: float, f_alpha_ion: float, - alpha_power_beams: float, + p_beam_alpha_mw: float, charged_power_density: float, neutron_power_density_plasma: float, vol_plasma: float, @@ -695,7 +695,7 @@ def set_fusion_powers( Parameters: f_alpha_electron (float): Fraction of alpha energy to electrons. f_alpha_ion (float): Fraction of alpha energy to ions. - alpha_power_beams (float): Alpha power from hot neutral beam ions (MW). + p_beam_alpha_mw (float): Alpha power from hot neutral beam ions (MW). charged_power_density (float): Other charged particle fusion power per unit volume (MW/m^3). neutron_power_density_plasma (float): Neutron fusion power per unit volume just from plasma (MW/m^3). vol_plasma (float): Plasma volume (m^3). @@ -727,7 +727,7 @@ def set_fusion_powers( # Add neutral beam alpha power / volume pden_alpha_total_mw = pden_plasma_alpha_mw + ( - alpha_power_beams / vol_plasma + p_beam_alpha_mw / vol_plasma ) # Total alpha power @@ -745,7 +745,7 @@ def set_fusion_powers( constants.dt_neutron_energy_fraction / (1.0 - constants.dt_neutron_energy_fraction) ) - * alpha_power_beams + * p_beam_alpha_mw ) / vol_plasma ) @@ -839,7 +839,7 @@ def beam_fusion( tuple: A tuple containing the following elements: - beta_beam (float): Neutral beam beta component. - beam_density_out (float): Hot beam ion density (m^-3). - - alpha_power_beams (float): Alpha power from hot neutral beam ions (MW). + - p_beam_alpha_mw (float): Alpha power from hot neutral beam ions (MW). Notes: - The function uses the Bosch-Hale parametrization to compute the reactivity. @@ -911,7 +911,7 @@ def beam_fusion( ) # Neutral beam alpha power - alpha_power_beams = beamfus0 * ( + p_beam_alpha_mw = beamfus0 * ( deuterium_beam_alpha_power + tritium_beam_alpha_power ) @@ -925,7 +925,7 @@ def beam_fusion( / (bt**2 + bp**2) ) - return beta_beam, hot_beam_density, alpha_power_beams + return beta_beam, hot_beam_density, p_beam_alpha_mw def beamcalc( diff --git a/process/physics.py b/process/physics.py index 37fe0e6eaa..6bfcc1628e 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2120,7 +2120,7 @@ def physics(self): ( physics_variables.beta_beam, physics_variables.beam_density_out, - physics_variables.alpha_power_beams, + physics_variables.p_beam_alpha_mw, ) = reactions.beam_fusion( physics_variables.beamfus0, physics_variables.betbm0, @@ -2143,20 +2143,20 @@ def physics(self): physics_variables.fusden_total = ( physics_variables.fusden_plasma + 1.0e6 - * physics_variables.alpha_power_beams + * physics_variables.p_beam_alpha_mw / (constants.dt_alpha_energy) / physics_variables.vol_plasma ) physics_variables.fusden_alpha_total = ( physics_variables.fusden_plasma_alpha + 1.0e6 - * physics_variables.alpha_power_beams + * physics_variables.p_beam_alpha_mw / (constants.dt_alpha_energy) / physics_variables.vol_plasma ) physics_variables.p_dt_total_mw = ( physics_variables.p_plasma_dt_mw - + 5.0e0 * physics_variables.alpha_power_beams + + 5.0e0 * physics_variables.p_beam_alpha_mw ) else: # If no beams present then the total alpha rates and power are the same as the plasma values @@ -2184,7 +2184,7 @@ def physics(self): ) = reactions.set_fusion_powers( physics_variables.f_alpha_electron, physics_variables.f_alpha_ion, - physics_variables.alpha_power_beams, + physics_variables.p_beam_alpha_mw, physics_variables.charged_power_density, physics_variables.neutron_power_density_plasma, physics_variables.vol_plasma, @@ -4752,8 +4752,8 @@ def outplas(self): po.ovarre( self.outfile, "Alpha power: beam-plasma (MW)", - "(alpha_power_beams)", - physics_variables.alpha_power_beams, + "(p_beam_alpha_mw)", + physics_variables.p_beam_alpha_mw, "OP ", ) po.ovarre( @@ -4803,7 +4803,7 @@ def outplas(self): self.outfile, "Neutron power: beam-plasma (MW)", "(neutron_power_beams)", - physics_variables.alpha_power_beams * 4.0e0, + physics_variables.p_beam_alpha_mw * 4.0e0, "OP ", ) po.osubhd(self.outfile, "Charged Particle Powers :") @@ -8360,7 +8360,7 @@ def init_physics_variables(): physics_variables.alpha_power_ions_density = 0.0 physics_variables.p_alpha_total_mw = 0.0 physics_variables.p_plasma_alpha_mw = 0.0 - physics_variables.alpha_power_beams = 0.0 + physics_variables.p_beam_alpha_mw = 0.0 physics_variables.non_alpha_charged_power = 0.0 physics_variables.charged_power_density = 0.0 physics_variables.pcoef = 0.0 diff --git a/process/physics_functions.py b/process/physics_functions.py index 069fcad37e..98603303f3 100644 --- a/process/physics_functions.py +++ b/process/physics_functions.py @@ -287,7 +287,7 @@ def fast_alpha_beta( fact2 = pden_alpha_total_mw / pden_plasma_alpha_mw beta_fast_alpha = beta_thermal * fact * fact2 - else: # negligible alpha production, alpha_power_density = alpha_power_beams = 0 + else: # negligible alpha production, alpha_power_density = p_beam_alpha_mw = 0 beta_fast_alpha = 0.0 return beta_fast_alpha diff --git a/process/stellarator.py b/process/stellarator.py index ef056952f3..099fe76f8b 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -4223,7 +4223,7 @@ def stphys(self, output): ( physics_variables.beta_beam, physics_variables.beam_density_out, - physics_variables.alpha_power_beams, + physics_variables.p_beam_alpha_mw, ) = reactions.beam_fusion( physics_variables.beamfus0, physics_variables.betbm0, @@ -4246,20 +4246,20 @@ def stphys(self, output): physics_variables.fusden_total = ( physics_variables.fusden_plasma + 1.0e6 - * physics_variables.alpha_power_beams + * physics_variables.p_beam_alpha_mw / (constants.dt_alpha_energy) / physics_variables.vol_plasma ) physics_variables.fusden_alpha_total = ( physics_variables.fusden_plasma_alpha + 1.0e6 - * physics_variables.alpha_power_beams + * physics_variables.p_beam_alpha_mw / (constants.dt_alpha_energy) / physics_variables.vol_plasma ) physics_variables.p_dt_total_mw = ( physics_variables.p_plasma_dt_mw - + 5.0e0 * physics_variables.alpha_power_beams + + 5.0e0 * physics_variables.p_beam_alpha_mw ) else: # If no beams present then the total alpha rates and power are the same as the plasma values @@ -4287,7 +4287,7 @@ def stphys(self, output): ) = reactions.set_fusion_powers( physics_variables.f_alpha_electron, physics_variables.f_alpha_ion, - physics_variables.alpha_power_beams, + physics_variables.p_beam_alpha_mw, physics_variables.charged_power_density, physics_variables.neutron_power_density_plasma, physics_variables.vol_plasma, diff --git a/source/fortran/physics_variables.f90 b/source/fortran/physics_variables.f90 index dc2708cba0..08de6df012 100644 --- a/source/fortran/physics_variables.f90 +++ b/source/fortran/physics_variables.f90 @@ -603,7 +603,7 @@ module physics_variables real(dp) :: p_alpha_total_mw !! Total alpha power from plasma and beams (MW) - real(dp) :: alpha_power_beams + real(dp) :: p_beam_alpha_mw !! alpha power from hot neutral beam ions (MW) real(dp) :: non_alpha_charged_power diff --git a/tests/unit/test_fusion_reactions.py b/tests/unit/test_fusion_reactions.py index 65bc3b9f37..e2573c6a76 100644 --- a/tests/unit/test_fusion_reactions.py +++ b/tests/unit/test_fusion_reactions.py @@ -31,7 +31,7 @@ class SetFusionPowersParam(NamedTuple): f_alpha_ion: Any = None - alpha_power_beams: Any = None + p_beam_alpha_mw: Any = None charged_power_density: Any = None @@ -74,7 +74,7 @@ class SetFusionPowersParam(NamedTuple): f_deuterium=0.5, f_alpha_electron=0.68, f_alpha_ion=0.32, - alpha_power_beams=0, + p_beam_alpha_mw=0, charged_power_density=0.00066, vol_plasma=2426.25, pden_plasma_alpha_mw=0.163, @@ -94,7 +94,7 @@ class SetFusionPowersParam(NamedTuple): f_deuterium=0.5, f_alpha_electron=0.68, f_alpha_ion=0.32, - alpha_power_beams=100.5, + p_beam_alpha_mw=100.5, charged_power_density=0.00066, vol_plasma=2426.25, pden_plasma_alpha_mw=0.163, @@ -114,7 +114,7 @@ class SetFusionPowersParam(NamedTuple): f_deuterium=0.5, f_alpha_electron=0.68, f_alpha_ion=0.32, - alpha_power_beams=100.5, + p_beam_alpha_mw=100.5, charged_power_density=0.00066, vol_plasma=2426.25, pden_plasma_alpha_mw=0.163, @@ -134,7 +134,7 @@ class SetFusionPowersParam(NamedTuple): f_deuterium=2.5, f_alpha_electron=0.68, f_alpha_ion=0.32, - alpha_power_beams=100.5, + p_beam_alpha_mw=100.5, charged_power_density=0.00066, vol_plasma=2426.25, pden_plasma_alpha_mw=0.163, @@ -181,7 +181,7 @@ def test_set_fusion_powers(setfusionpowersparam, monkeypatch): ) = reactions.set_fusion_powers( f_alpha_electron=setfusionpowersparam.f_alpha_electron, f_alpha_ion=setfusionpowersparam.f_alpha_ion, - alpha_power_beams=setfusionpowersparam.alpha_power_beams, + p_beam_alpha_mw=setfusionpowersparam.p_beam_alpha_mw, charged_power_density=setfusionpowersparam.charged_power_density, neutron_power_density_plasma=setfusionpowersparam.neutron_power_density_plasma, vol_plasma=setfusionpowersparam.vol_plasma, @@ -246,7 +246,7 @@ def test_bosch_hale(t, reaction, expected_bosch_hale): def test_beam_fusion(): - beta_beam, beam_density_out, alpha_power_beams = reactions.beam_fusion( + beta_beam, beam_density_out, p_beam_alpha_mw = reactions.beam_fusion( 1.0, 1.5, 0.85, @@ -268,7 +268,7 @@ def test_beam_fusion(): assert beta_beam == pytest.approx(0.0026264022466211366) assert beam_density_out == pytest.approx(4.2133504058678246e17) - assert alpha_power_beams == pytest.approx(11.593221085189192) + assert p_beam_alpha_mw == pytest.approx(11.593221085189192) def test_beamcalc(): From 3c5a27d9ee5f3d3bf26afb51c80da38f55114b76 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 8 May 2025 14:00:59 +0100 Subject: [PATCH 16/37] =?UTF-8?q?=F0=9F=94=84=20Rename=20alpha=5Fpower=5Fe?= =?UTF-8?q?lectron=5Fdensity=20to=20f=5Fpden=5Falpha=5Felectron=5Fmw=20for?= =?UTF-8?q?=20consistency=20across=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/data/large_tokamak_nof_2_MFILE.DAT | 2 +- examples/data/large_tokamak_nof_MFILE.DAT | 2 +- process/fusion_reactions.py | 6 +++--- process/physics.py | 8 ++++---- process/stellarator.py | 2 +- source/fortran/constraint_equations.f90 | 8 ++++---- source/fortran/physics_variables.f90 | 2 +- tests/unit/test_fusion_reactions.py | 4 ++-- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/examples/data/large_tokamak_nof_2_MFILE.DAT b/examples/data/large_tokamak_nof_2_MFILE.DAT index e200ad0a01..fd816a1a2a 100644 --- a/examples/data/large_tokamak_nof_2_MFILE.DAT +++ b/examples/data/large_tokamak_nof_2_MFILE.DAT @@ -302,7 +302,7 @@ Alpha_power:_plasma_only_(MW)____________________________________________ (p_plasma_alpha_mw)___________ 3.23657956519217578e+02 OP Alpha_power_density:_plasma_(MW/m^3)_____________________________________ (pden_plasma_alpha_mw)___ 1.71413463146233375e-01 OP Alpha_power:_beam-plasma_(MW)____________________________________________ (p_beam_alpha_mw)____________ 0.00000000000000000e+00 OP - Alpha_power_per_unit_volume_transferred_to_electrons_(MW/m3)_____________ (alpha_power_electron_density)_ 1.17513473229255330e-01 OP + Alpha_power_per_unit_volume_transferred_to_electrons_(MW/m3)_____________ (f_pden_alpha_electron_mw)_ 1.17513473229255330e-01 OP Alpha_power_per_unit_volume_transferred_to_ions_(MW/m3)__________________ (alpha_power_ions_density)_____ 4.53293167596663799e-02 OP Neutron_power:_total_(MW)________________________________________________ (neutron_power_total)__________ 1.28469670088750900e+03 OP Neutron_power_density:_total_(MW/m^3)____________________________________ (neutron_power_density_total)__ 6.80392081072146104e-01 OP diff --git a/examples/data/large_tokamak_nof_MFILE.DAT b/examples/data/large_tokamak_nof_MFILE.DAT index e559522591..fe04eadc83 100644 --- a/examples/data/large_tokamak_nof_MFILE.DAT +++ b/examples/data/large_tokamak_nof_MFILE.DAT @@ -375,7 +375,7 @@ Alpha_power:_plasma_only_(MW)____________________________________________ (p_plasma_alpha_mw)___________ 3.50542899600547457e+02 OP Alpha_power_density:_plasma_(MW/m^3)_____________________________________ (pden_plasma_alpha_mw)___ 1.85652078657564057e-01 OP Alpha_power:_beam-plasma_(MW)____________________________________________ (p_beam_alpha_mw)____________ 0.00000000000000000e+00 OP - Alpha_power_per_unit_volume_transferred_to_electrons_(MW/m3)_____________ (alpha_power_electron_density)_ 1.25503605903536375e-01 OP + Alpha_power_per_unit_volume_transferred_to_electrons_(MW/m3)_____________ (f_pden_alpha_electron_mw)_ 1.25503605903536375e-01 OP Alpha_power_per_unit_volume_transferred_to_ions_(MW/m3)__________________ (alpha_power_ions_density)_____ 5.08658688211494556e-02 OP Neutron_power:_total_(MW)________________________________________________ (neutron_power_total)__________ 1.39144256113123765e+03 OP Neutron_power_density:_total_(MW/m^3)____________________________________ (neutron_power_density_total)__ 7.36926076953736353e-01 OP diff --git a/process/fusion_reactions.py b/process/fusion_reactions.py index 67e4a3eaf9..dca12b5c60 100644 --- a/process/fusion_reactions.py +++ b/process/fusion_reactions.py @@ -710,7 +710,7 @@ def set_fusion_powers( - neutron_power_total (float): Total neutron fusion power from plasma and beams [MW]. - non_alpha_charged_power (float): Other total charged particle fusion power [MW]. - pden_alpha_total_mw (float): Alpha power per unit volume, from beams and plasma [MW/m^3]. - - alpha_power_electron_density (float): Alpha power per unit volume to electrons [MW/m^3]. + - f_pden_alpha_electron_mw (float): Alpha power per unit volume to electrons [MW/m^3]. - alpha_power_ions_density (float): Alpha power per unit volume to ions [MW/m^3]. - charged_particle_power (float): Charged particle fusion power [MW]. - p_fusion_total_mw (float): Total fusion power [MW]. @@ -772,7 +772,7 @@ def set_fusion_powers( alpha_power_ions_density = ( physics_variables.f_alpha_plasma * pden_alpha_total_mw * f_alpha_ion ) - alpha_power_electron_density = ( + f_pden_alpha_electron_mw = ( physics_variables.f_alpha_plasma * pden_alpha_total_mw * f_alpha_electron ) @@ -784,7 +784,7 @@ def set_fusion_powers( neutron_power_total, non_alpha_charged_power, pden_alpha_total_mw, - alpha_power_electron_density, + f_pden_alpha_electron_mw, alpha_power_ions_density, charged_particle_power, p_fusion_total_mw, diff --git a/process/physics.py b/process/physics.py index 6bfcc1628e..45564dd726 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2177,7 +2177,7 @@ def physics(self): physics_variables.neutron_power_total, physics_variables.non_alpha_charged_power, physics_variables.pden_alpha_total_mw, - physics_variables.alpha_power_electron_density, + physics_variables.f_pden_alpha_electron_mw, physics_variables.alpha_power_ions_density, physics_variables.charged_particle_power, physics_variables.p_fusion_total_mw, @@ -4759,8 +4759,8 @@ def outplas(self): po.ovarre( self.outfile, "Alpha power per unit volume transferred to electrons (MW/m3)", - "(alpha_power_electron_density)", - physics_variables.alpha_power_electron_density, + "(f_pden_alpha_electron_mw)", + physics_variables.f_pden_alpha_electron_mw, "OP ", ) po.ovarre( @@ -8355,7 +8355,7 @@ def init_physics_variables(): physics_variables.f_dd_branching_trit = 0.0 physics_variables.pden_plasma_alpha_mw = 0.0 physics_variables.pden_alpha_total_mw = 0.0 - physics_variables.alpha_power_electron_density = 0.0 + physics_variables.f_pden_alpha_electron_mw = 0.0 physics_variables.p_fw_alpha_mw = 0.0 physics_variables.alpha_power_ions_density = 0.0 physics_variables.p_alpha_total_mw = 0.0 diff --git a/process/stellarator.py b/process/stellarator.py index 099fe76f8b..fd06d3d4f7 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -4280,7 +4280,7 @@ def stphys(self, output): physics_variables.neutron_power_total, physics_variables.non_alpha_charged_power, physics_variables.pden_alpha_total_mw, - physics_variables.alpha_power_electron_density, + physics_variables.f_pden_alpha_electron_mw, physics_variables.alpha_power_ions_density, physics_variables.charged_particle_power, physics_variables.p_fusion_total_mw, diff --git a/source/fortran/constraint_equations.f90 b/source/fortran/constraint_equations.f90 index 907bf80535..9c32217e2c 100755 --- a/source/fortran/constraint_equations.f90 +++ b/source/fortran/constraint_equations.f90 @@ -571,12 +571,12 @@ subroutine constraint_eqn_004(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units) !! pden_plasma_rad_mw : input real : total radiation power per volume (MW/m3) !! pden_plasma_core_rad_mw : input real : total core radiation power per volume (MW/m3) !! f_alpha_plasma : input real : fraction of alpha power deposited in plasma - !! alpha_power_electron_density : input real : alpha power per volume to electrons (MW/m3) + !! f_pden_alpha_electron_mw : input real : alpha power per volume to electrons (MW/m3) !! piepv : input real : ion/electron equilibration power per volume (MW/m3) !! p_hcd_injected_electrons_mw : input real : auxiliary injected power to electrons (MW) !! vol_plasma : input real : plasma volume (m3) use physics_variables, only: i_rad_loss, i_plasma_ignited, pden_electron_transport_loss_mw, pden_plasma_core_rad_mw, f_alpha_plasma, & - alpha_power_electron_density, piepv, vol_plasma, pden_plasma_rad_mw + f_pden_alpha_electron_mw, piepv, vol_plasma, pden_plasma_rad_mw use current_drive_variables, only: p_hcd_injected_electrons_mw implicit none real(dp), intent(out) :: tmp_cc @@ -600,10 +600,10 @@ subroutine constraint_eqn_004(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units) ! if plasma not ignited include injected power if (i_plasma_ignited == 0) then - pdenom = f_alpha_plasma*alpha_power_electron_density + piepv + p_hcd_injected_electrons_mw/vol_plasma + pdenom = f_alpha_plasma*f_pden_alpha_electron_mw + piepv + p_hcd_injected_electrons_mw/vol_plasma else ! if plasma ignited - pdenom = f_alpha_plasma*alpha_power_electron_density + piepv + pdenom = f_alpha_plasma*f_pden_alpha_electron_mw + piepv end if tmp_cc = 1.0D0 - pnumerator / pdenom diff --git a/source/fortran/physics_variables.f90 b/source/fortran/physics_variables.f90 index 08de6df012..dd932fb403 100644 --- a/source/fortran/physics_variables.f90 +++ b/source/fortran/physics_variables.f90 @@ -588,7 +588,7 @@ module physics_variables real(dp) :: pden_alpha_total_mw !! Alpha power per volume from plasma and beams [MW/m3] - real(dp) :: alpha_power_electron_density + real(dp) :: f_pden_alpha_electron_mw !! Alpha power per volume to electrons [MW/m3] real(dp) :: p_fw_alpha_mw diff --git a/tests/unit/test_fusion_reactions.py b/tests/unit/test_fusion_reactions.py index e2573c6a76..288d8e74b1 100644 --- a/tests/unit/test_fusion_reactions.py +++ b/tests/unit/test_fusion_reactions.py @@ -174,7 +174,7 @@ def test_set_fusion_powers(setfusionpowersparam, monkeypatch): neutron_power_total, non_alpha_charged_power, pden_alpha_total_mw, - alpha_power_electron_density, + f_pden_alpha_electron_mw, alpha_power_ions_density, charged_particle_power, p_fusion_total_mw, @@ -203,7 +203,7 @@ def test_set_fusion_powers(setfusionpowersparam, monkeypatch): assert non_alpha_charged_power == pytest.approx( setfusionpowersparam.expected_non_alpha_charged_power ) - assert alpha_power_electron_density == pytest.approx( + assert f_pden_alpha_electron_mw == pytest.approx( setfusionpowersparam.expected_alpha_power_electron_density ) assert alpha_power_ions_density == pytest.approx( From b646e1ca5413ea8e50dbbce51bf2f2df7df2e888 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 8 May 2025 14:01:31 +0100 Subject: [PATCH 17/37] =?UTF-8?q?=F0=9F=94=84=20Rename=20alpha=5Fpower=5Fi?= =?UTF-8?q?ons=5Fdensity=20to=20f=5Fpden=5Falpha=5Fions=5Fmw=20for=20consi?= =?UTF-8?q?stency=20across=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/data/large_tokamak_nof_2_MFILE.DAT | 2 +- examples/data/large_tokamak_nof_MFILE.DAT | 2 +- process/fusion_reactions.py | 6 +++--- process/physics.py | 8 ++++---- process/stellarator.py | 2 +- source/fortran/constraint_equations.f90 | 16 ++++++++-------- source/fortran/physics_variables.f90 | 2 +- tests/unit/test_fusion_reactions.py | 4 ++-- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/examples/data/large_tokamak_nof_2_MFILE.DAT b/examples/data/large_tokamak_nof_2_MFILE.DAT index fd816a1a2a..a8753f54fa 100644 --- a/examples/data/large_tokamak_nof_2_MFILE.DAT +++ b/examples/data/large_tokamak_nof_2_MFILE.DAT @@ -303,7 +303,7 @@ Alpha_power_density:_plasma_(MW/m^3)_____________________________________ (pden_plasma_alpha_mw)___ 1.71413463146233375e-01 OP Alpha_power:_beam-plasma_(MW)____________________________________________ (p_beam_alpha_mw)____________ 0.00000000000000000e+00 OP Alpha_power_per_unit_volume_transferred_to_electrons_(MW/m3)_____________ (f_pden_alpha_electron_mw)_ 1.17513473229255330e-01 OP - Alpha_power_per_unit_volume_transferred_to_ions_(MW/m3)__________________ (alpha_power_ions_density)_____ 4.53293167596663799e-02 OP + Alpha_power_per_unit_volume_transferred_to_ions_(MW/m3)__________________ (f_pden_alpha_ions_mw)_____ 4.53293167596663799e-02 OP Neutron_power:_total_(MW)________________________________________________ (neutron_power_total)__________ 1.28469670088750900e+03 OP Neutron_power_density:_total_(MW/m^3)____________________________________ (neutron_power_density_total)__ 6.80392081072146104e-01 OP Neutron_power:_plasma_only_(MW)__________________________________________ (neutron_power_plasma)_________ 1.28469670088750900e+03 OP diff --git a/examples/data/large_tokamak_nof_MFILE.DAT b/examples/data/large_tokamak_nof_MFILE.DAT index fe04eadc83..edb1c9db69 100644 --- a/examples/data/large_tokamak_nof_MFILE.DAT +++ b/examples/data/large_tokamak_nof_MFILE.DAT @@ -376,7 +376,7 @@ Alpha_power_density:_plasma_(MW/m^3)_____________________________________ (pden_plasma_alpha_mw)___ 1.85652078657564057e-01 OP Alpha_power:_beam-plasma_(MW)____________________________________________ (p_beam_alpha_mw)____________ 0.00000000000000000e+00 OP Alpha_power_per_unit_volume_transferred_to_electrons_(MW/m3)_____________ (f_pden_alpha_electron_mw)_ 1.25503605903536375e-01 OP - Alpha_power_per_unit_volume_transferred_to_ions_(MW/m3)__________________ (alpha_power_ions_density)_____ 5.08658688211494556e-02 OP + Alpha_power_per_unit_volume_transferred_to_ions_(MW/m3)__________________ (f_pden_alpha_ions_mw)_____ 5.08658688211494556e-02 OP Neutron_power:_total_(MW)________________________________________________ (neutron_power_total)__________ 1.39144256113123765e+03 OP Neutron_power_density:_total_(MW/m^3)____________________________________ (neutron_power_density_total)__ 7.36926076953736353e-01 OP Neutron_power:_plasma_only_(MW)__________________________________________ (neutron_power_plasma)_________ 1.39144256113123765e+03 OP diff --git a/process/fusion_reactions.py b/process/fusion_reactions.py index dca12b5c60..a296afa05e 100644 --- a/process/fusion_reactions.py +++ b/process/fusion_reactions.py @@ -711,7 +711,7 @@ def set_fusion_powers( - non_alpha_charged_power (float): Other total charged particle fusion power [MW]. - pden_alpha_total_mw (float): Alpha power per unit volume, from beams and plasma [MW/m^3]. - f_pden_alpha_electron_mw (float): Alpha power per unit volume to electrons [MW/m^3]. - - alpha_power_ions_density (float): Alpha power per unit volume to ions [MW/m^3]. + - f_pden_alpha_ions_mw (float): Alpha power per unit volume to ions [MW/m^3]. - charged_particle_power (float): Charged particle fusion power [MW]. - p_fusion_total_mw (float): Total fusion power [MW]. @@ -769,7 +769,7 @@ def set_fusion_powers( # Alpha power to electrons and ions (used with electron # and ion power balance equations only) # No consideration of charged_power_density here. - alpha_power_ions_density = ( + f_pden_alpha_ions_mw = ( physics_variables.f_alpha_plasma * pden_alpha_total_mw * f_alpha_ion ) f_pden_alpha_electron_mw = ( @@ -785,7 +785,7 @@ def set_fusion_powers( non_alpha_charged_power, pden_alpha_total_mw, f_pden_alpha_electron_mw, - alpha_power_ions_density, + f_pden_alpha_ions_mw, charged_particle_power, p_fusion_total_mw, ) diff --git a/process/physics.py b/process/physics.py index 45564dd726..fab7015e57 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2178,7 +2178,7 @@ def physics(self): physics_variables.non_alpha_charged_power, physics_variables.pden_alpha_total_mw, physics_variables.f_pden_alpha_electron_mw, - physics_variables.alpha_power_ions_density, + physics_variables.f_pden_alpha_ions_mw, physics_variables.charged_particle_power, physics_variables.p_fusion_total_mw, ) = reactions.set_fusion_powers( @@ -4766,8 +4766,8 @@ def outplas(self): po.ovarre( self.outfile, "Alpha power per unit volume transferred to ions (MW/m3)", - "(alpha_power_ions_density)", - physics_variables.alpha_power_ions_density, + "(f_pden_alpha_ions_mw)", + physics_variables.f_pden_alpha_ions_mw, "OP ", ) po.osubhd(self.outfile, "Neutron Powers :") @@ -8357,7 +8357,7 @@ def init_physics_variables(): physics_variables.pden_alpha_total_mw = 0.0 physics_variables.f_pden_alpha_electron_mw = 0.0 physics_variables.p_fw_alpha_mw = 0.0 - physics_variables.alpha_power_ions_density = 0.0 + physics_variables.f_pden_alpha_ions_mw = 0.0 physics_variables.p_alpha_total_mw = 0.0 physics_variables.p_plasma_alpha_mw = 0.0 physics_variables.p_beam_alpha_mw = 0.0 diff --git a/process/stellarator.py b/process/stellarator.py index fd06d3d4f7..403826cbc0 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -4281,7 +4281,7 @@ def stphys(self, output): physics_variables.non_alpha_charged_power, physics_variables.pden_alpha_total_mw, physics_variables.f_pden_alpha_electron_mw, - physics_variables.alpha_power_ions_density, + physics_variables.f_pden_alpha_ions_mw, physics_variables.charged_particle_power, physics_variables.p_fusion_total_mw, ) = reactions.set_fusion_powers( diff --git a/source/fortran/constraint_equations.f90 b/source/fortran/constraint_equations.f90 index 9c32217e2c..714391900a 100755 --- a/source/fortran/constraint_equations.f90 +++ b/source/fortran/constraint_equations.f90 @@ -517,10 +517,10 @@ subroutine constraint_eqn_003(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units) !! pden_ion_transport_loss_mw : input real : ion transport power per volume (MW/m3) !! piepv : input real : ion/electron equilibration power per volume (MW/m3) !! f_alpha_plasma : input real : fraction of alpha power deposited in plasma - !! alpha_power_ions_density : input real : alpha power per volume to ions (MW/m3) + !! f_pden_alpha_ions_mw : input real : alpha power per volume to ions (MW/m3) !! p_hcd_injected_ions_mw : input real : auxiliary injected power to ions (MW) !! vol_plasma : input real : plasma volume (m3) - use physics_variables, only: i_plasma_ignited, pden_ion_transport_loss_mw, piepv, f_alpha_plasma, alpha_power_ions_density, vol_plasma + use physics_variables, only: i_plasma_ignited, pden_ion_transport_loss_mw, piepv, f_alpha_plasma, f_pden_alpha_ions_mw, vol_plasma use current_drive_variables, only: p_hcd_injected_ions_mw implicit none real(dp), intent(out) :: tmp_cc @@ -531,16 +531,16 @@ subroutine constraint_eqn_003(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units) ! No assume plasma ignition: if (i_plasma_ignited == 0) then - tmp_cc = 1.0D0 - (pden_ion_transport_loss_mw + piepv) / (f_alpha_plasma*alpha_power_ions_density + p_hcd_injected_ions_mw/vol_plasma) - tmp_con = (f_alpha_plasma*alpha_power_ions_density + p_hcd_injected_ions_mw/vol_plasma) * (1.0D0 - tmp_cc) - tmp_err = (f_alpha_plasma*alpha_power_ions_density + p_hcd_injected_ions_mw/vol_plasma) * tmp_cc + tmp_cc = 1.0D0 - (pden_ion_transport_loss_mw + piepv) / (f_alpha_plasma*f_pden_alpha_ions_mw + p_hcd_injected_ions_mw/vol_plasma) + tmp_con = (f_alpha_plasma*f_pden_alpha_ions_mw + p_hcd_injected_ions_mw/vol_plasma) * (1.0D0 - tmp_cc) + tmp_err = (f_alpha_plasma*f_pden_alpha_ions_mw + p_hcd_injected_ions_mw/vol_plasma) * tmp_cc tmp_symbol = '=' tmp_units = 'MW/m3' ! Plasma ignited: else - tmp_cc = 1.0D0 - (pden_ion_transport_loss_mw+piepv) / (f_alpha_plasma*alpha_power_ions_density) - tmp_con = (f_alpha_plasma*alpha_power_ions_density) * (1.0D0 - tmp_cc) - tmp_err = (f_alpha_plasma*alpha_power_ions_density) * tmp_cc + tmp_cc = 1.0D0 - (pden_ion_transport_loss_mw+piepv) / (f_alpha_plasma*f_pden_alpha_ions_mw) + tmp_con = (f_alpha_plasma*f_pden_alpha_ions_mw) * (1.0D0 - tmp_cc) + tmp_err = (f_alpha_plasma*f_pden_alpha_ions_mw) * tmp_cc tmp_symbol = '=' tmp_units = 'MW/m3' end if diff --git a/source/fortran/physics_variables.f90 b/source/fortran/physics_variables.f90 index dd932fb403..c34dd1ed3b 100644 --- a/source/fortran/physics_variables.f90 +++ b/source/fortran/physics_variables.f90 @@ -594,7 +594,7 @@ module physics_variables real(dp) :: p_fw_alpha_mw !! alpha power escaping plasma and reaching first wall (MW) - real(dp) :: alpha_power_ions_density + real(dp) :: f_pden_alpha_ions_mw !! alpha power per volume to ions (MW/m3) real(dp) :: p_plasma_alpha_mw diff --git a/tests/unit/test_fusion_reactions.py b/tests/unit/test_fusion_reactions.py index 288d8e74b1..3faab3fd58 100644 --- a/tests/unit/test_fusion_reactions.py +++ b/tests/unit/test_fusion_reactions.py @@ -175,7 +175,7 @@ def test_set_fusion_powers(setfusionpowersparam, monkeypatch): non_alpha_charged_power, pden_alpha_total_mw, f_pden_alpha_electron_mw, - alpha_power_ions_density, + f_pden_alpha_ions_mw, charged_particle_power, p_fusion_total_mw, ) = reactions.set_fusion_powers( @@ -206,7 +206,7 @@ def test_set_fusion_powers(setfusionpowersparam, monkeypatch): assert f_pden_alpha_electron_mw == pytest.approx( setfusionpowersparam.expected_alpha_power_electron_density ) - assert alpha_power_ions_density == pytest.approx( + assert f_pden_alpha_ions_mw == pytest.approx( setfusionpowersparam.expected_alpha_power_ion_density ) assert charged_particle_power == pytest.approx( From fe580f6f9ddb1d95a6a168916f855b741d564b0b Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 8 May 2025 14:07:29 +0100 Subject: [PATCH 18/37] =?UTF-8?q?=F0=9F=94=84=20Rename=20neutron=5Fpower?= =?UTF-8?q?=5Ftotal=20to=20p=5Fneutron=5Ftotal=5Fmw=20for=20consistency=20?= =?UTF-8?q?across=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/data/large_tokamak_nof_2_MFILE.DAT | 2 +- examples/data/large_tokamak_nof_MFILE.DAT | 2 +- process/dcll.py | 10 ++++---- process/fusion_reactions.py | 8 +++---- process/hcpb.py | 24 +++++++++---------- process/io/sankey_funcs.py | 6 ++--- process/physics.py | 14 +++++------ process/stellarator.py | 26 ++++++++++----------- source/fortran/physics_variables.f90 | 2 +- tests/unit/test_ccfe_hcpb.py | 8 +++---- tests/unit/test_dcll.py | 10 ++++---- tests/unit/test_fusion_reactions.py | 4 ++-- 12 files changed, 58 insertions(+), 58 deletions(-) diff --git a/examples/data/large_tokamak_nof_2_MFILE.DAT b/examples/data/large_tokamak_nof_2_MFILE.DAT index a8753f54fa..71e9f1dcd6 100644 --- a/examples/data/large_tokamak_nof_2_MFILE.DAT +++ b/examples/data/large_tokamak_nof_2_MFILE.DAT @@ -304,7 +304,7 @@ Alpha_power:_beam-plasma_(MW)____________________________________________ (p_beam_alpha_mw)____________ 0.00000000000000000e+00 OP Alpha_power_per_unit_volume_transferred_to_electrons_(MW/m3)_____________ (f_pden_alpha_electron_mw)_ 1.17513473229255330e-01 OP Alpha_power_per_unit_volume_transferred_to_ions_(MW/m3)__________________ (f_pden_alpha_ions_mw)_____ 4.53293167596663799e-02 OP - Neutron_power:_total_(MW)________________________________________________ (neutron_power_total)__________ 1.28469670088750900e+03 OP + Neutron_power:_total_(MW)________________________________________________ (p_neutron_total_mw)__________ 1.28469670088750900e+03 OP Neutron_power_density:_total_(MW/m^3)____________________________________ (neutron_power_density_total)__ 6.80392081072146104e-01 OP Neutron_power:_plasma_only_(MW)__________________________________________ (neutron_power_plasma)_________ 1.28469670088750900e+03 OP Neutron_power_density:_plasma_(MW/m^3)___________________________________ (neutron_power_density_plasma)_ 6.80392081072146104e-01 OP diff --git a/examples/data/large_tokamak_nof_MFILE.DAT b/examples/data/large_tokamak_nof_MFILE.DAT index edb1c9db69..b408e90271 100644 --- a/examples/data/large_tokamak_nof_MFILE.DAT +++ b/examples/data/large_tokamak_nof_MFILE.DAT @@ -377,7 +377,7 @@ Alpha_power:_beam-plasma_(MW)____________________________________________ (p_beam_alpha_mw)____________ 0.00000000000000000e+00 OP Alpha_power_per_unit_volume_transferred_to_electrons_(MW/m3)_____________ (f_pden_alpha_electron_mw)_ 1.25503605903536375e-01 OP Alpha_power_per_unit_volume_transferred_to_ions_(MW/m3)__________________ (f_pden_alpha_ions_mw)_____ 5.08658688211494556e-02 OP - Neutron_power:_total_(MW)________________________________________________ (neutron_power_total)__________ 1.39144256113123765e+03 OP + Neutron_power:_total_(MW)________________________________________________ (p_neutron_total_mw)__________ 1.39144256113123765e+03 OP Neutron_power_density:_total_(MW/m^3)____________________________________ (neutron_power_density_total)__ 7.36926076953736353e-01 OP Neutron_power:_plasma_only_(MW)__________________________________________ (neutron_power_plasma)_________ 1.39144256113123765e+03 OP Neutron_power_density:_plasma_(MW/m^3)___________________________________ (neutron_power_density_plasma)_ 7.36926076953736353e-01 OP diff --git a/process/dcll.py b/process/dcll.py index 64a685a6d1..7374efaf81 100644 --- a/process/dcll.py +++ b/process/dcll.py @@ -132,7 +132,7 @@ def dcll_neutronics_and_power(self, output: bool): # Nuclear heating in the first wall (MW) fwbs_variables.p_fw_nuclear_heat_total_mw = ( - physics_variables.neutron_power_total + physics_variables.p_neutron_total_mw * fwbs_variables.pnuc_fw_ratio_dcll * covf ) @@ -140,7 +140,7 @@ def dcll_neutronics_and_power(self, output: bool): # Nuclear heating in the blanket with energy multiplication (MW) fwbs_variables.pnuc_blkt_ratio_dcll = 1 - fwbs_variables.pnuc_fw_ratio_dcll fwbs_variables.p_blkt_nuclear_heat_total_mw = ( - physics_variables.neutron_power_total + physics_variables.p_neutron_total_mw * fwbs_variables.pnuc_blkt_ratio_dcll * fwbs_variables.emult * covf @@ -149,7 +149,7 @@ def dcll_neutronics_and_power(self, output: bool): # Energy multiplication energy (MW) fwbs_variables.emultmw = ( ( - physics_variables.neutron_power_total + physics_variables.p_neutron_total_mw * fwbs_variables.pnuc_blkt_ratio_dcll ) * (fwbs_variables.emult - 1) @@ -162,7 +162,7 @@ def dcll_neutronics_and_power(self, output: bool): # Double null configuration # Nuclear heating in the divertor (MW), neutron power times f_ster_div_single fwbs_variables.p_div_nuclear_heat_total_mw = ( - physics_variables.neutron_power_total + physics_variables.p_neutron_total_mw * 2 * fwbs_variables.f_ster_div_single ) @@ -174,7 +174,7 @@ def dcll_neutronics_and_power(self, output: bool): # Single null configuration # Nuclear heating in the divertor (MW), neutron power times f_ster_div_single fwbs_variables.p_div_nuclear_heat_total_mw = ( - physics_variables.neutron_power_total * fwbs_variables.f_ster_div_single + physics_variables.p_neutron_total_mw * fwbs_variables.f_ster_div_single ) # Radiation power incident on divertor (MW) fwbs_variables.p_div_rad_total_mw = ( diff --git a/process/fusion_reactions.py b/process/fusion_reactions.py index a296afa05e..cc08837539 100644 --- a/process/fusion_reactions.py +++ b/process/fusion_reactions.py @@ -707,7 +707,7 @@ def set_fusion_powers( - p_plasma_alpha_mw (float): Alpha fusion power from only the plasma [MW]. - p_alpha_total_mw (float): Total alpha fusion power from plasma and beams [MW]. - neutron_power_plasma (float): Neutron fusion power from only the plasma [MW]. - - neutron_power_total (float): Total neutron fusion power from plasma and beams [MW]. + - p_neutron_total_mw (float): Total neutron fusion power from plasma and beams [MW]. - non_alpha_charged_power (float): Other total charged particle fusion power [MW]. - pden_alpha_total_mw (float): Alpha power per unit volume, from beams and plasma [MW/m^3]. - f_pden_alpha_electron_mw (float): Alpha power per unit volume to electrons [MW/m^3]. @@ -751,7 +751,7 @@ def set_fusion_powers( ) # Total neutron power - neutron_power_total = neutron_power_density_total * vol_plasma + p_neutron_total_mw = neutron_power_density_total * vol_plasma # Charged particle power @@ -763,7 +763,7 @@ def set_fusion_powers( # Total fusion power p_fusion_total_mw = ( - p_alpha_total_mw + neutron_power_total + non_alpha_charged_power + p_alpha_total_mw + p_neutron_total_mw + non_alpha_charged_power ) # Alpha power to electrons and ions (used with electron @@ -781,7 +781,7 @@ def set_fusion_powers( p_plasma_alpha_mw, p_alpha_total_mw, neutron_power_plasma, - neutron_power_total, + p_neutron_total_mw, non_alpha_charged_power, pden_alpha_total_mw, f_pden_alpha_electron_mw, diff --git a/process/hcpb.py b/process/hcpb.py index b58e0974ae..49849b9ae5 100644 --- a/process/hcpb.py +++ b/process/hcpb.py @@ -80,7 +80,7 @@ def run(self, output: bool): # TF fast neutron flux (E > 0.1 MeV) [m^{-2}.s^{-1}] fwbs_variables.neut_flux_cp = self.st_tf_centrepost_fast_neut_flux( - physics_variables.neutron_power_total, + physics_variables.p_neutron_total_mw, build_variables.dr_shld_inboard, physics_variables.rmajor, ) @@ -91,7 +91,7 @@ def run(self, output: bool): fwbs_variables.pnuc_cp_sh, fwbs_variables.pnuc_cp, ) = self.st_centrepost_nuclear_heating( - physics_variables.neutron_power_total, build_variables.dr_shld_inboard + physics_variables.p_neutron_total_mw, build_variables.dr_shld_inboard ) else: # No CP @@ -151,7 +151,7 @@ def run(self, output: bool): ) * fwbs_variables.emult * f_geom_blanket - * physics_variables.neutron_power_total + * physics_variables.p_neutron_total_mw ) # Power to the blanket (MW) @@ -162,7 +162,7 @@ def run(self, output: bool): ) * fwbs_variables.emult * f_geom_blanket - * physics_variables.neutron_power_total + * physics_variables.p_neutron_total_mw ) # Power to the shield(MW) @@ -171,7 +171,7 @@ def run(self, output: bool): (fwbs_variables.pnucshld / ccfe_hcpb_module.pnuc_tot_blk_sector) * fwbs_variables.emult * f_geom_blanket - * physics_variables.neutron_power_total + * physics_variables.p_neutron_total_mw ) # Power to the TF coils (MW) @@ -180,13 +180,13 @@ def run(self, output: bool): (fwbs_variables.ptfnuc / ccfe_hcpb_module.pnuc_tot_blk_sector) * fwbs_variables.emult * f_geom_blanket - * physics_variables.neutron_power_total + * physics_variables.p_neutron_total_mw + fwbs_variables.pnuc_cp_tf ) # Power deposited in the CP fwbs_variables.pnuc_cp_sh = ( - f_geom_cp * physics_variables.neutron_power_total + f_geom_cp * physics_variables.p_neutron_total_mw - fwbs_variables.pnuc_cp_tf ) @@ -194,14 +194,14 @@ def run(self, output: bool): # --- # p_div_nuclear_heat_total_mw is not changed. # The energy due to multiplication, by subtraction: - # emultmw = p_fw_nuclear_heat_total_mw + p_blkt_nuclear_heat_total_mw + pnucshld + ptfnuc + p_div_nuclear_heat_total_mw - neutron_power_total + # emultmw = p_fw_nuclear_heat_total_mw + p_blkt_nuclear_heat_total_mw + pnucshld + ptfnuc + p_div_nuclear_heat_total_mw - p_neutron_total_mw # --- # New code, a bit simpler fwbs_variables.emultmw = ( (fwbs_variables.emult - 1) * f_geom_blanket - * physics_variables.neutron_power_total + * physics_variables.p_neutron_total_mw ) # powerflow calculation for pumping power @@ -939,7 +939,7 @@ def st_cp_angle_fraction(self, z_cp_top, r_cp_mid, r_cp_top, rmajor): # Solid angle fraction covered by the CP (OUTPUT) [-] return 0.25 * cp_sol_angle / np.pi - def st_tf_centrepost_fast_neut_flux(self, neutron_power_total, sh_width, rmajor): + def st_tf_centrepost_fast_neut_flux(self, p_neutron_total_mw, sh_width, rmajor): """Author S Kahn Routine calculating the fast neutron (E > 0.1 MeV) flux reaching the TF at the centerpost. These calcualtion are made from a CP only MCNP fit @@ -950,7 +950,7 @@ def st_tf_centrepost_fast_neut_flux(self, neutron_power_total, sh_width, rmajor) of 16.6 cm, close to the "15 - 16 cm" of Menard et al. 2016. (This is an e-folding lenth of 7.22 cm.) - :param neutron_power_total: neutron fusion power [MW] + :param p_neutron_total_mw: neutron fusion power [MW] :param sh_width: Neutron shield width [m] :param rmajor: Plasma major radius [m] """ @@ -983,7 +983,7 @@ def st_tf_centrepost_fast_neut_flux(self, neutron_power_total, sh_width, rmajor) f_wc_density * f_neut_flux_out_wall * neut_flux_cp - * (neutron_power_total / 800) + * (p_neutron_total_mw / 800) ) return neut_flux_cp diff --git a/process/io/sankey_funcs.py b/process/io/sankey_funcs.py index 94ef3a4786..c2c72d1577 100644 --- a/process/io/sankey_funcs.py +++ b/process/io/sankey_funcs.py @@ -35,7 +35,7 @@ def plot_full_sankey( totalplasma = ( p_fusion_total_mw + p_hcd_injected_total_mw + p_plasma_ohmic_mw ) # Total Power in plasma (MW) - neutron_power_total = m_file.data["neutron_power_total"].get_scan( + p_neutron_total_mw = m_file.data["p_neutron_total_mw"].get_scan( -1 ) # Neutron fusion power (MW) non_alpha_charged_power = m_file.data["non_alpha_charged_power"].get_scan( @@ -141,7 +141,7 @@ def plot_full_sankey( p_plasma_ohmic_mw, -pcharohmmw, -palpinjmw, - -neutron_power_total, + -p_neutron_total_mw, ] sankey.add( flows=plasma, @@ -169,7 +169,7 @@ def plot_full_sankey( # Neutrons, -Divertor, -1st wall, -Shield, -TF coils, -Blanket+Energy Mult. neutrons = [ - neutron_power_total, + p_neutron_total_mw, -p_div_nuclear_heat_total_mw, -p_fw_nuclear_heat_total_mw, -pnucshld, diff --git a/process/physics.py b/process/physics.py index fab7015e57..540ef1ae83 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2174,7 +2174,7 @@ def physics(self): physics_variables.p_plasma_alpha_mw, physics_variables.p_alpha_total_mw, physics_variables.neutron_power_plasma, - physics_variables.neutron_power_total, + physics_variables.p_neutron_total_mw, physics_variables.non_alpha_charged_power, physics_variables.pden_alpha_total_mw, physics_variables.f_pden_alpha_electron_mw, @@ -2209,7 +2209,7 @@ def physics(self): if physics_variables.iwalld == 1: physics_variables.pflux_fw_neutron_mw = ( physics_variables.ffwal - * physics_variables.neutron_power_total + * physics_variables.p_neutron_total_mw / physics_variables.a_plasma_surface ) else: @@ -2221,7 +2221,7 @@ def physics(self): - fwbs_variables.f_a_fw_hcd - 2.0e0 * fwbs_variables.f_ster_div_single ) - * physics_variables.neutron_power_total + * physics_variables.p_neutron_total_mw / build_variables.a_fw_total ) else: @@ -2232,7 +2232,7 @@ def physics(self): - fwbs_variables.f_a_fw_hcd - fwbs_variables.f_ster_div_single ) - * physics_variables.neutron_power_total + * physics_variables.p_neutron_total_mw / build_variables.a_fw_total ) @@ -4774,8 +4774,8 @@ def outplas(self): po.ovarre( self.outfile, "Neutron power: total (MW)", - "(neutron_power_total)", - physics_variables.neutron_power_total, + "(p_neutron_total_mw)", + physics_variables.p_neutron_total_mw, "OP ", ) po.ovarre( @@ -8382,7 +8382,7 @@ def init_physics_variables(): physics_variables.piepv = 0.0 physics_variables.plasma_current = 0.0 physics_variables.neutron_power_plasma = 0.0 - physics_variables.neutron_power_total = 0.0 + physics_variables.p_neutron_total_mw = 0.0 physics_variables.neutron_power_density_total = 0.0 physics_variables.neutron_power_density_plasma = 0.0 physics_variables.p_plasma_ohmic_mw = 0.0 diff --git a/process/stellarator.py b/process/stellarator.py index 403826cbc0..374d3c2c74 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -1186,7 +1186,7 @@ def stfwbs(self, output: bool): # shield) fwbs_variables.pnucloss = ( - physics_variables.neutron_power_total * fwbs_variables.fhole + physics_variables.p_neutron_total_mw * fwbs_variables.fhole ) # The peaking factor, obtained as precalculated parameter @@ -1200,14 +1200,14 @@ def stfwbs(self, output: bool): if heat_transport_variables.ipowerflow == 1: fwbs_variables.p_div_nuclear_heat_total_mw = ( - physics_variables.neutron_power_total + physics_variables.p_neutron_total_mw * fwbs_variables.f_ster_div_single ) fwbs_variables.p_fw_hcd_nuclear_heat_mw = ( - physics_variables.neutron_power_total * fwbs_variables.f_a_fw_hcd + physics_variables.p_neutron_total_mw * fwbs_variables.f_a_fw_hcd ) fwbs_variables.p_fw_nuclear_heat_total_mw = ( - physics_variables.neutron_power_total + physics_variables.p_neutron_total_mw - fwbs_variables.p_div_nuclear_heat_total_mw - fwbs_variables.pnucloss - fwbs_variables.p_fw_hcd_nuclear_heat_mw @@ -1268,13 +1268,13 @@ def stfwbs(self, output: bool): # Energy-multiplied neutron power pneut2 = ( - physics_variables.neutron_power_total + physics_variables.p_neutron_total_mw - fwbs_variables.pnucloss - fwbs_variables.pnuc_cp ) * fwbs_variables.emult fwbs_variables.emultmw = pneut2 - ( - physics_variables.neutron_power_total + physics_variables.p_neutron_total_mw - fwbs_variables.pnucloss - fwbs_variables.pnuc_cp ) @@ -1315,20 +1315,20 @@ def stfwbs(self, output: bool): # Neutron power incident on divertor (MW) fwbs_variables.p_div_nuclear_heat_total_mw = ( - physics_variables.neutron_power_total + physics_variables.p_neutron_total_mw * fwbs_variables.f_ster_div_single ) # Neutron power incident on HCD apparatus (MW) fwbs_variables.p_fw_hcd_nuclear_heat_mw = ( - physics_variables.neutron_power_total * fwbs_variables.f_a_fw_hcd + physics_variables.p_neutron_total_mw * fwbs_variables.f_a_fw_hcd ) # Neutron power deposited in first wall, blanket and shield (MW) pnucfwbs = ( - physics_variables.neutron_power_total + physics_variables.p_neutron_total_mw - fwbs_variables.p_div_nuclear_heat_total_mw - fwbs_variables.pnucloss - fwbs_variables.pnuc_cp @@ -4277,7 +4277,7 @@ def stphys(self, output): physics_variables.p_plasma_alpha_mw, physics_variables.p_alpha_total_mw, physics_variables.neutron_power_plasma, - physics_variables.neutron_power_total, + physics_variables.p_neutron_total_mw, physics_variables.non_alpha_charged_power, physics_variables.pden_alpha_total_mw, physics_variables.f_pden_alpha_electron_mw, @@ -4312,14 +4312,14 @@ def stphys(self, output): if physics_variables.iwalld == 1: physics_variables.pflux_fw_neutron_mw = ( physics_variables.ffwal - * physics_variables.neutron_power_total + * physics_variables.p_neutron_total_mw / physics_variables.a_plasma_surface ) else: if heat_transport_variables.ipowerflow == 0: physics_variables.pflux_fw_neutron_mw = ( (1.0e0 - fwbs_variables.fhole) - * physics_variables.neutron_power_total + * physics_variables.p_neutron_total_mw / build_variables.a_fw_total ) else: @@ -4330,7 +4330,7 @@ def stphys(self, output): - fwbs_variables.f_a_fw_hcd - fwbs_variables.f_ster_div_single ) - * physics_variables.neutron_power_total + * physics_variables.p_neutron_total_mw / build_variables.a_fw_total ) diff --git a/source/fortran/physics_variables.f90 b/source/fortran/physics_variables.f90 index c34dd1ed3b..f1ba444707 100644 --- a/source/fortran/physics_variables.f90 +++ b/source/fortran/physics_variables.f90 @@ -669,7 +669,7 @@ module physics_variables real(dp) :: neutron_power_plasma !! Neutron fusion power from just the plasma [MW] - real(dp) :: neutron_power_total + real(dp) :: p_neutron_total_mw !! Total neutron fusion power from plasma and beams [MW] real(dp) :: neutron_power_density_total diff --git a/tests/unit/test_ccfe_hcpb.py b/tests/unit/test_ccfe_hcpb.py index d6f35dabff..3c49b47a62 100644 --- a/tests/unit/test_ccfe_hcpb.py +++ b/tests/unit/test_ccfe_hcpb.py @@ -1231,7 +1231,7 @@ def test_st_cp_angle_fraction(stcpanglefractionparam, ccfe_hcpb): class StTfCentrepostFastNeutFluxParam(NamedTuple): i_tf_sup: Any = None - neutron_power_total: Any = None + p_neutron_total_mw: Any = None sh_width: Any = None @@ -1245,14 +1245,14 @@ class StTfCentrepostFastNeutFluxParam(NamedTuple): ( StTfCentrepostFastNeutFluxParam( i_tf_sup=1, - neutron_power_total=400.65875490746737, + p_neutron_total_mw=400.65875490746737, sh_width=0.60000000000000009, rmajor=3, expected_neut_flux_cp=144701998710998.5, ), StTfCentrepostFastNeutFluxParam( i_tf_sup=1, - neutron_power_total=409.82485143909827, + p_neutron_total_mw=409.82485143909827, sh_width=0.60000000000000009, rmajor=3, expected_neut_flux_cp=148012428028364.28, @@ -1279,7 +1279,7 @@ def test_st_tf_centrepost_fast_neut_flux( ) neut_flux_cp = ccfe_hcpb.st_tf_centrepost_fast_neut_flux( - neutron_power_total=sttfcentrepostfastneutfluxparam.neutron_power_total, + p_neutron_total_mw=sttfcentrepostfastneutfluxparam.p_neutron_total_mw, sh_width=sttfcentrepostfastneutfluxparam.sh_width, rmajor=sttfcentrepostfastneutfluxparam.rmajor, ) diff --git a/tests/unit/test_dcll.py b/tests/unit/test_dcll.py index f35c079e3a..f6c7b48b23 100644 --- a/tests/unit/test_dcll.py +++ b/tests/unit/test_dcll.py @@ -67,7 +67,7 @@ class DcllNeutronicsAndPowerParam(NamedTuple): n_divertors: Any = None - neutron_power_total: Any = None + p_neutron_total_mw: Any = None p_plasma_rad_mw: Any = None @@ -111,7 +111,7 @@ class DcllNeutronicsAndPowerParam(NamedTuple): emultmw=0, ptfnuc=0, n_divertors=1, - neutron_power_total=1587.7386535917431, + p_neutron_total_mw=1587.7386535917431, p_plasma_rad_mw=287.44866938104849, p_fw_alpha_mw=19.835845058655043, expected_p_div_rad_total_mw=33.056596978820579, @@ -143,7 +143,7 @@ class DcllNeutronicsAndPowerParam(NamedTuple): emultmw=325.06710220789364, ptfnuc=0, n_divertors=1, - neutron_power_total=1587.2430556964196, + p_neutron_total_mw=1587.2430556964196, p_plasma_rad_mw=287.44866938104849, p_fw_alpha_mw=19.829653483586444, expected_p_div_rad_total_mw=33.056596978820579, @@ -270,8 +270,8 @@ def test_dcll_neutronics_and_power(dcllneutronicsandpowerparam, monkeypatch, dcl monkeypatch.setattr( physics_variables, - "neutron_power_total", - dcllneutronicsandpowerparam.neutron_power_total, + "p_neutron_total_mw", + dcllneutronicsandpowerparam.p_neutron_total_mw, ) monkeypatch.setattr( diff --git a/tests/unit/test_fusion_reactions.py b/tests/unit/test_fusion_reactions.py index 3faab3fd58..e5625871a3 100644 --- a/tests/unit/test_fusion_reactions.py +++ b/tests/unit/test_fusion_reactions.py @@ -171,7 +171,7 @@ def test_set_fusion_powers(setfusionpowersparam, monkeypatch): p_plasma_alpha_mw, p_alpha_total_mw, neutron_power_plasma, - neutron_power_total, + p_neutron_total_mw, non_alpha_charged_power, pden_alpha_total_mw, f_pden_alpha_electron_mw, @@ -197,7 +197,7 @@ def test_set_fusion_powers(setfusionpowersparam, monkeypatch): assert p_alpha_total_mw == pytest.approx( setfusionpowersparam.expected_alpha_power_total ) - assert neutron_power_total == pytest.approx( + assert p_neutron_total_mw == pytest.approx( setfusionpowersparam.expected_neutron_power_total ) assert non_alpha_charged_power == pytest.approx( From de6b74ce4e86c6fdaac5d102ba12376736ad28b2 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 8 May 2025 14:07:58 +0100 Subject: [PATCH 19/37] =?UTF-8?q?=F0=9F=94=84=20Rename=20neutron=5Fpower?= =?UTF-8?q?=5Fdensity=5Ftotal=20to=20pden=5Fneutron=5Ftotal=5Fmw=20for=20c?= =?UTF-8?q?onsistency=20across=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/data/large_tokamak_nof_2_MFILE.DAT | 2 +- examples/data/large_tokamak_nof_MFILE.DAT | 2 +- process/fusion_reactions.py | 8 ++++---- process/physics.py | 8 ++++---- process/stellarator.py | 2 +- source/fortran/physics_variables.f90 | 2 +- tests/unit/test_fusion_reactions.py | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/examples/data/large_tokamak_nof_2_MFILE.DAT b/examples/data/large_tokamak_nof_2_MFILE.DAT index 71e9f1dcd6..897f667a7a 100644 --- a/examples/data/large_tokamak_nof_2_MFILE.DAT +++ b/examples/data/large_tokamak_nof_2_MFILE.DAT @@ -305,7 +305,7 @@ Alpha_power_per_unit_volume_transferred_to_electrons_(MW/m3)_____________ (f_pden_alpha_electron_mw)_ 1.17513473229255330e-01 OP Alpha_power_per_unit_volume_transferred_to_ions_(MW/m3)__________________ (f_pden_alpha_ions_mw)_____ 4.53293167596663799e-02 OP Neutron_power:_total_(MW)________________________________________________ (p_neutron_total_mw)__________ 1.28469670088750900e+03 OP - Neutron_power_density:_total_(MW/m^3)____________________________________ (neutron_power_density_total)__ 6.80392081072146104e-01 OP + Neutron_power_density:_total_(MW/m^3)____________________________________ (pden_neutron_total_mw)__ 6.80392081072146104e-01 OP Neutron_power:_plasma_only_(MW)__________________________________________ (neutron_power_plasma)_________ 1.28469670088750900e+03 OP Neutron_power_density:_plasma_(MW/m^3)___________________________________ (neutron_power_density_plasma)_ 6.80392081072146104e-01 OP Neutron_power:_beam-plasma_(MW)__________________________________________ (neutron_power_beams)__________ 0.00000000000000000e+00 OP diff --git a/examples/data/large_tokamak_nof_MFILE.DAT b/examples/data/large_tokamak_nof_MFILE.DAT index b408e90271..38e601c99b 100644 --- a/examples/data/large_tokamak_nof_MFILE.DAT +++ b/examples/data/large_tokamak_nof_MFILE.DAT @@ -378,7 +378,7 @@ Alpha_power_per_unit_volume_transferred_to_electrons_(MW/m3)_____________ (f_pden_alpha_electron_mw)_ 1.25503605903536375e-01 OP Alpha_power_per_unit_volume_transferred_to_ions_(MW/m3)__________________ (f_pden_alpha_ions_mw)_____ 5.08658688211494556e-02 OP Neutron_power:_total_(MW)________________________________________________ (p_neutron_total_mw)__________ 1.39144256113123765e+03 OP - Neutron_power_density:_total_(MW/m^3)____________________________________ (neutron_power_density_total)__ 7.36926076953736353e-01 OP + Neutron_power_density:_total_(MW/m^3)____________________________________ (pden_neutron_total_mw)__ 7.36926076953736353e-01 OP Neutron_power:_plasma_only_(MW)__________________________________________ (neutron_power_plasma)_________ 1.39144256113123765e+03 OP Neutron_power_density:_plasma_(MW/m^3)___________________________________ (neutron_power_density_plasma)_ 7.36926076953736353e-01 OP Neutron_power:_beam-plasma_(MW)__________________________________________ (neutron_power_beams)__________ 0.00000000000000000e+00 OP diff --git a/process/fusion_reactions.py b/process/fusion_reactions.py index cc08837539..b24da95b61 100644 --- a/process/fusion_reactions.py +++ b/process/fusion_reactions.py @@ -703,7 +703,7 @@ def set_fusion_powers( Returns: tuple: A tuple containing the following elements: - - neutron_power_density_total (float): Neutron fusion power per unit volume from plasma and beams [MW/m^3]. + - pden_neutron_total_mw (float): Neutron fusion power per unit volume from plasma and beams [MW/m^3]. - p_plasma_alpha_mw (float): Alpha fusion power from only the plasma [MW]. - p_alpha_total_mw (float): Total alpha fusion power from plasma and beams [MW]. - neutron_power_plasma (float): Neutron fusion power from only the plasma [MW]. @@ -739,7 +739,7 @@ def set_fusion_powers( neutron_power_plasma = neutron_power_density_plasma * vol_plasma # Add extra neutron power from beams - neutron_power_density_total = neutron_power_density_plasma + ( + pden_neutron_total_mw = neutron_power_density_plasma + ( ( ( constants.dt_neutron_energy_fraction @@ -751,7 +751,7 @@ def set_fusion_powers( ) # Total neutron power - p_neutron_total_mw = neutron_power_density_total * vol_plasma + p_neutron_total_mw = pden_neutron_total_mw * vol_plasma # Charged particle power @@ -777,7 +777,7 @@ def set_fusion_powers( ) return ( - neutron_power_density_total, + pden_neutron_total_mw, p_plasma_alpha_mw, p_alpha_total_mw, neutron_power_plasma, diff --git a/process/physics.py b/process/physics.py index 540ef1ae83..cc13199c1f 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2170,7 +2170,7 @@ def physics(self): # Create some derived values and add beam contribution to fusion power ( - physics_variables.neutron_power_density_total, + physics_variables.pden_neutron_total_mw, physics_variables.p_plasma_alpha_mw, physics_variables.p_alpha_total_mw, physics_variables.neutron_power_plasma, @@ -4781,8 +4781,8 @@ def outplas(self): po.ovarre( self.outfile, "Neutron power density: total (MW/m^3)", - "(neutron_power_density_total)", - physics_variables.neutron_power_density_total, + "(pden_neutron_total_mw)", + physics_variables.pden_neutron_total_mw, "OP ", ) po.ovarre( @@ -8383,7 +8383,7 @@ def init_physics_variables(): physics_variables.plasma_current = 0.0 physics_variables.neutron_power_plasma = 0.0 physics_variables.p_neutron_total_mw = 0.0 - physics_variables.neutron_power_density_total = 0.0 + physics_variables.pden_neutron_total_mw = 0.0 physics_variables.neutron_power_density_plasma = 0.0 physics_variables.p_plasma_ohmic_mw = 0.0 physics_variables.pden_plasma_ohmic_mw = 0.0 diff --git a/process/stellarator.py b/process/stellarator.py index 374d3c2c74..c17a283d1f 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -4273,7 +4273,7 @@ def stphys(self, output): # Create some derived values and add beam contribution to fusion power ( - physics_variables.neutron_power_density_total, + physics_variables.pden_neutron_total_mw, physics_variables.p_plasma_alpha_mw, physics_variables.p_alpha_total_mw, physics_variables.neutron_power_plasma, diff --git a/source/fortran/physics_variables.f90 b/source/fortran/physics_variables.f90 index f1ba444707..63c511e6c3 100644 --- a/source/fortran/physics_variables.f90 +++ b/source/fortran/physics_variables.f90 @@ -672,7 +672,7 @@ module physics_variables real(dp) :: p_neutron_total_mw !! Total neutron fusion power from plasma and beams [MW] - real(dp) :: neutron_power_density_total + real(dp) :: pden_neutron_total_mw !! neutron fusion power per volume from beams and plasma (MW/m3) real(dp) :: neutron_power_density_plasma diff --git a/tests/unit/test_fusion_reactions.py b/tests/unit/test_fusion_reactions.py index e5625871a3..543176036a 100644 --- a/tests/unit/test_fusion_reactions.py +++ b/tests/unit/test_fusion_reactions.py @@ -167,7 +167,7 @@ def test_set_fusion_powers(setfusionpowersparam, monkeypatch): monkeypatch.setattr(pv, "f_deuterium", setfusionpowersparam.f_deuterium) ( - neutron_power_density_total, + pden_neutron_total_mw, p_plasma_alpha_mw, p_alpha_total_mw, neutron_power_plasma, @@ -191,7 +191,7 @@ def test_set_fusion_powers(setfusionpowersparam, monkeypatch): assert pden_alpha_total_mw == pytest.approx( setfusionpowersparam.expected_alpha_power_density ) - assert neutron_power_density_total == pytest.approx( + assert pden_neutron_total_mw == pytest.approx( setfusionpowersparam.expected_neutron_power_density ) assert p_alpha_total_mw == pytest.approx( From b2a316a402f3e9cb704da7fc56dbaf603ff34f8a Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 8 May 2025 14:08:31 +0100 Subject: [PATCH 20/37] =?UTF-8?q?=F0=9F=94=84=20Rename=20neutron=5Fpower?= =?UTF-8?q?=5Fplasma=20to=20p=5Fplasma=5Fneutron=5Fmw=20for=20consistency?= =?UTF-8?q?=20across=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/data/large_tokamak_nof_2_MFILE.DAT | 2 +- examples/data/large_tokamak_nof_MFILE.DAT | 2 +- process/fusion_reactions.py | 6 +++--- process/physics.py | 8 ++++---- process/stellarator.py | 2 +- source/fortran/physics_variables.f90 | 2 +- tests/unit/test_fusion_reactions.py | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/data/large_tokamak_nof_2_MFILE.DAT b/examples/data/large_tokamak_nof_2_MFILE.DAT index 897f667a7a..567fda51c0 100644 --- a/examples/data/large_tokamak_nof_2_MFILE.DAT +++ b/examples/data/large_tokamak_nof_2_MFILE.DAT @@ -306,7 +306,7 @@ Alpha_power_per_unit_volume_transferred_to_ions_(MW/m3)__________________ (f_pden_alpha_ions_mw)_____ 4.53293167596663799e-02 OP Neutron_power:_total_(MW)________________________________________________ (p_neutron_total_mw)__________ 1.28469670088750900e+03 OP Neutron_power_density:_total_(MW/m^3)____________________________________ (pden_neutron_total_mw)__ 6.80392081072146104e-01 OP - Neutron_power:_plasma_only_(MW)__________________________________________ (neutron_power_plasma)_________ 1.28469670088750900e+03 OP + Neutron_power:_plasma_only_(MW)__________________________________________ (p_plasma_neutron_mw)_________ 1.28469670088750900e+03 OP Neutron_power_density:_plasma_(MW/m^3)___________________________________ (neutron_power_density_plasma)_ 6.80392081072146104e-01 OP Neutron_power:_beam-plasma_(MW)__________________________________________ (neutron_power_beams)__________ 0.00000000000000000e+00 OP Charged_particle_power_(excluding_alphas)_(MW)___________________________ (non_alpha_charged_power)______ 1.20650459189592762e+00 OP diff --git a/examples/data/large_tokamak_nof_MFILE.DAT b/examples/data/large_tokamak_nof_MFILE.DAT index 38e601c99b..32b42d2eb8 100644 --- a/examples/data/large_tokamak_nof_MFILE.DAT +++ b/examples/data/large_tokamak_nof_MFILE.DAT @@ -379,7 +379,7 @@ Alpha_power_per_unit_volume_transferred_to_ions_(MW/m3)__________________ (f_pden_alpha_ions_mw)_____ 5.08658688211494556e-02 OP Neutron_power:_total_(MW)________________________________________________ (p_neutron_total_mw)__________ 1.39144256113123765e+03 OP Neutron_power_density:_total_(MW/m^3)____________________________________ (pden_neutron_total_mw)__ 7.36926076953736353e-01 OP - Neutron_power:_plasma_only_(MW)__________________________________________ (neutron_power_plasma)_________ 1.39144256113123765e+03 OP + Neutron_power:_plasma_only_(MW)__________________________________________ (p_plasma_neutron_mw)_________ 1.39144256113123765e+03 OP Neutron_power_density:_plasma_(MW/m^3)___________________________________ (neutron_power_density_plasma)_ 7.36926076953736353e-01 OP Neutron_power:_beam-plasma_(MW)__________________________________________ (neutron_power_beams)__________ 0.00000000000000000e+00 OP Charged_particle_power_(excluding_alphas)_(MW)___________________________ (non_alpha_charged_power)______ 1.34669877478527300e+00 OP diff --git a/process/fusion_reactions.py b/process/fusion_reactions.py index b24da95b61..dd69575a1e 100644 --- a/process/fusion_reactions.py +++ b/process/fusion_reactions.py @@ -706,7 +706,7 @@ def set_fusion_powers( - pden_neutron_total_mw (float): Neutron fusion power per unit volume from plasma and beams [MW/m^3]. - p_plasma_alpha_mw (float): Alpha fusion power from only the plasma [MW]. - p_alpha_total_mw (float): Total alpha fusion power from plasma and beams [MW]. - - neutron_power_plasma (float): Neutron fusion power from only the plasma [MW]. + - p_plasma_neutron_mw (float): Neutron fusion power from only the plasma [MW]. - p_neutron_total_mw (float): Total neutron fusion power from plasma and beams [MW]. - non_alpha_charged_power (float): Other total charged particle fusion power [MW]. - pden_alpha_total_mw (float): Alpha power per unit volume, from beams and plasma [MW/m^3]. @@ -736,7 +736,7 @@ def set_fusion_powers( # Neutron Power # Calculate neutron power produced just by the plasma - neutron_power_plasma = neutron_power_density_plasma * vol_plasma + p_plasma_neutron_mw = neutron_power_density_plasma * vol_plasma # Add extra neutron power from beams pden_neutron_total_mw = neutron_power_density_plasma + ( @@ -780,7 +780,7 @@ def set_fusion_powers( pden_neutron_total_mw, p_plasma_alpha_mw, p_alpha_total_mw, - neutron_power_plasma, + p_plasma_neutron_mw, p_neutron_total_mw, non_alpha_charged_power, pden_alpha_total_mw, diff --git a/process/physics.py b/process/physics.py index cc13199c1f..dc9944b22e 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2173,7 +2173,7 @@ def physics(self): physics_variables.pden_neutron_total_mw, physics_variables.p_plasma_alpha_mw, physics_variables.p_alpha_total_mw, - physics_variables.neutron_power_plasma, + physics_variables.p_plasma_neutron_mw, physics_variables.p_neutron_total_mw, physics_variables.non_alpha_charged_power, physics_variables.pden_alpha_total_mw, @@ -4788,8 +4788,8 @@ def outplas(self): po.ovarre( self.outfile, "Neutron power: plasma only (MW)", - "(neutron_power_plasma)", - physics_variables.neutron_power_plasma, + "(p_plasma_neutron_mw)", + physics_variables.p_plasma_neutron_mw, "OP ", ) po.ovarre( @@ -8381,7 +8381,7 @@ def init_physics_variables(): physics_variables.pflux_fw_rad_mw = 0.0 physics_variables.piepv = 0.0 physics_variables.plasma_current = 0.0 - physics_variables.neutron_power_plasma = 0.0 + physics_variables.p_plasma_neutron_mw = 0.0 physics_variables.p_neutron_total_mw = 0.0 physics_variables.pden_neutron_total_mw = 0.0 physics_variables.neutron_power_density_plasma = 0.0 diff --git a/process/stellarator.py b/process/stellarator.py index c17a283d1f..6f18e8087c 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -4276,7 +4276,7 @@ def stphys(self, output): physics_variables.pden_neutron_total_mw, physics_variables.p_plasma_alpha_mw, physics_variables.p_alpha_total_mw, - physics_variables.neutron_power_plasma, + physics_variables.p_plasma_neutron_mw, physics_variables.p_neutron_total_mw, physics_variables.non_alpha_charged_power, physics_variables.pden_alpha_total_mw, diff --git a/source/fortran/physics_variables.f90 b/source/fortran/physics_variables.f90 index 63c511e6c3..c5ec4a0b6a 100644 --- a/source/fortran/physics_variables.f90 +++ b/source/fortran/physics_variables.f90 @@ -666,7 +666,7 @@ module physics_variables real(dp) :: plasma_current !! plasma current (A) - real(dp) :: neutron_power_plasma + real(dp) :: p_plasma_neutron_mw !! Neutron fusion power from just the plasma [MW] real(dp) :: p_neutron_total_mw diff --git a/tests/unit/test_fusion_reactions.py b/tests/unit/test_fusion_reactions.py index 543176036a..95fdb06070 100644 --- a/tests/unit/test_fusion_reactions.py +++ b/tests/unit/test_fusion_reactions.py @@ -170,7 +170,7 @@ def test_set_fusion_powers(setfusionpowersparam, monkeypatch): pden_neutron_total_mw, p_plasma_alpha_mw, p_alpha_total_mw, - neutron_power_plasma, + p_plasma_neutron_mw, p_neutron_total_mw, non_alpha_charged_power, pden_alpha_total_mw, From 0edf8adcaea71e6a91834ae23d2faa42648493ae Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 8 May 2025 14:09:23 +0100 Subject: [PATCH 21/37] =?UTF-8?q?=F0=9F=94=84=20Rename=20neutron=5Fpower?= =?UTF-8?q?=5Fdensity=5Fplasma=20to=20pden=5Fplasma=5Fneutron=5Fmw=20for?= =?UTF-8?q?=20consistency=20across=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fusion_reactions/plasma_reactions.md | 2 +- examples/data/large_tokamak_nof_2_MFILE.DAT | 2 +- examples/data/large_tokamak_nof_MFILE.DAT | 2 +- process/fusion_reactions.py | 10 +++++----- process/physics.py | 8 ++++---- process/stellarator.py | 2 +- source/fortran/physics_variables.f90 | 2 +- tests/unit/test_fusion_reactions.py | 12 ++++++------ 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md b/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md index cfaff31bfc..0d8744c76a 100644 --- a/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md +++ b/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md @@ -182,7 +182,7 @@ This method sets the required physics variables in the `physics_variables` and ` #### Updates: - `physics_variables.pden_plasma_alpha_mw`: Updated with `self.alpha_power_density` - `physics_variables.charged_power_density`: Updated with `self.charged_power_density` -- `physics_variables.neutron_power_density_plasma`: Updated with `self.neutron_power_density` +- `physics_variables.pden_plasma_neutron_mw`: Updated with `self.neutron_power_density` - `physics_variables.fusden_plasma`: Updated with `self.fusion_rate_density` - `physics_variables.fusden_plasma_alpha`: Updated with `self.alpha_rate_density` - `physics_variables.proton_rate_density`: Updated with `self.proton_rate_density` diff --git a/examples/data/large_tokamak_nof_2_MFILE.DAT b/examples/data/large_tokamak_nof_2_MFILE.DAT index 567fda51c0..8b86ad9b9b 100644 --- a/examples/data/large_tokamak_nof_2_MFILE.DAT +++ b/examples/data/large_tokamak_nof_2_MFILE.DAT @@ -307,7 +307,7 @@ Neutron_power:_total_(MW)________________________________________________ (p_neutron_total_mw)__________ 1.28469670088750900e+03 OP Neutron_power_density:_total_(MW/m^3)____________________________________ (pden_neutron_total_mw)__ 6.80392081072146104e-01 OP Neutron_power:_plasma_only_(MW)__________________________________________ (p_plasma_neutron_mw)_________ 1.28469670088750900e+03 OP - Neutron_power_density:_plasma_(MW/m^3)___________________________________ (neutron_power_density_plasma)_ 6.80392081072146104e-01 OP + Neutron_power_density:_plasma_(MW/m^3)___________________________________ (pden_plasma_neutron_mw)_ 6.80392081072146104e-01 OP Neutron_power:_beam-plasma_(MW)__________________________________________ (neutron_power_beams)__________ 0.00000000000000000e+00 OP Charged_particle_power_(excluding_alphas)_(MW)___________________________ (non_alpha_charged_power)______ 1.20650459189592762e+00 OP Total_charged_particle_power_(including_alphas)_(MW)_____________________ (charged_particle_power)_______ 3.24864461111113485e+02 OP diff --git a/examples/data/large_tokamak_nof_MFILE.DAT b/examples/data/large_tokamak_nof_MFILE.DAT index 32b42d2eb8..88fe85b22f 100644 --- a/examples/data/large_tokamak_nof_MFILE.DAT +++ b/examples/data/large_tokamak_nof_MFILE.DAT @@ -380,7 +380,7 @@ Neutron_power:_total_(MW)________________________________________________ (p_neutron_total_mw)__________ 1.39144256113123765e+03 OP Neutron_power_density:_total_(MW/m^3)____________________________________ (pden_neutron_total_mw)__ 7.36926076953736353e-01 OP Neutron_power:_plasma_only_(MW)__________________________________________ (p_plasma_neutron_mw)_________ 1.39144256113123765e+03 OP - Neutron_power_density:_plasma_(MW/m^3)___________________________________ (neutron_power_density_plasma)_ 7.36926076953736353e-01 OP + Neutron_power_density:_plasma_(MW/m^3)___________________________________ (pden_plasma_neutron_mw)_ 7.36926076953736353e-01 OP Neutron_power:_beam-plasma_(MW)__________________________________________ (neutron_power_beams)__________ 0.00000000000000000e+00 OP Charged_particle_power_(excluding_alphas)_(MW)___________________________ (non_alpha_charged_power)______ 1.34669877478527300e+00 OP Total_charged_particle_power_(including_alphas)_(MW)_____________________ (charged_particle_power)_______ 3.51889598375332753e+02 OP diff --git a/process/fusion_reactions.py b/process/fusion_reactions.py index dd69575a1e..15ff1c67a3 100644 --- a/process/fusion_reactions.py +++ b/process/fusion_reactions.py @@ -534,7 +534,7 @@ def set_physics_variables(self) -> None: """ physics_variables.pden_plasma_alpha_mw = self.alpha_power_density physics_variables.charged_power_density = self.charged_power_density - physics_variables.neutron_power_density_plasma = self.neutron_power_density + physics_variables.pden_plasma_neutron_mw = self.neutron_power_density physics_variables.fusden_plasma = self.fusion_rate_density physics_variables.fusden_plasma_alpha = self.alpha_rate_density physics_variables.proton_rate_density = self.proton_rate_density @@ -684,7 +684,7 @@ def set_fusion_powers( f_alpha_ion: float, p_beam_alpha_mw: float, charged_power_density: float, - neutron_power_density_plasma: float, + pden_plasma_neutron_mw: float, vol_plasma: float, pden_plasma_alpha_mw: float, ) -> tuple: @@ -697,7 +697,7 @@ def set_fusion_powers( f_alpha_ion (float): Fraction of alpha energy to ions. p_beam_alpha_mw (float): Alpha power from hot neutral beam ions (MW). charged_power_density (float): Other charged particle fusion power per unit volume (MW/m^3). - neutron_power_density_plasma (float): Neutron fusion power per unit volume just from plasma (MW/m^3). + pden_plasma_neutron_mw (float): Neutron fusion power per unit volume just from plasma (MW/m^3). vol_plasma (float): Plasma volume (m^3). pden_plasma_alpha_mw (float): Alpha power per unit volume just from plasma (MW/m^3). @@ -736,10 +736,10 @@ def set_fusion_powers( # Neutron Power # Calculate neutron power produced just by the plasma - p_plasma_neutron_mw = neutron_power_density_plasma * vol_plasma + p_plasma_neutron_mw = pden_plasma_neutron_mw * vol_plasma # Add extra neutron power from beams - pden_neutron_total_mw = neutron_power_density_plasma + ( + pden_neutron_total_mw = pden_plasma_neutron_mw + ( ( ( constants.dt_neutron_energy_fraction diff --git a/process/physics.py b/process/physics.py index dc9944b22e..b198c06bdb 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2186,7 +2186,7 @@ def physics(self): physics_variables.f_alpha_ion, physics_variables.p_beam_alpha_mw, physics_variables.charged_power_density, - physics_variables.neutron_power_density_plasma, + physics_variables.pden_plasma_neutron_mw, physics_variables.vol_plasma, physics_variables.pden_plasma_alpha_mw, ) @@ -4795,8 +4795,8 @@ def outplas(self): po.ovarre( self.outfile, "Neutron power density: plasma (MW/m^3)", - "(neutron_power_density_plasma)", - physics_variables.neutron_power_density_plasma, + "(pden_plasma_neutron_mw)", + physics_variables.pden_plasma_neutron_mw, "OP ", ) po.ovarre( @@ -8384,7 +8384,7 @@ def init_physics_variables(): physics_variables.p_plasma_neutron_mw = 0.0 physics_variables.p_neutron_total_mw = 0.0 physics_variables.pden_neutron_total_mw = 0.0 - physics_variables.neutron_power_density_plasma = 0.0 + physics_variables.pden_plasma_neutron_mw = 0.0 physics_variables.p_plasma_ohmic_mw = 0.0 physics_variables.pden_plasma_ohmic_mw = 0.0 physics_variables.p_plasma_loss_mw = 0.0 diff --git a/process/stellarator.py b/process/stellarator.py index 6f18e8087c..c4571dd666 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -4289,7 +4289,7 @@ def stphys(self, output): physics_variables.f_alpha_ion, physics_variables.p_beam_alpha_mw, physics_variables.charged_power_density, - physics_variables.neutron_power_density_plasma, + physics_variables.pden_plasma_neutron_mw, physics_variables.vol_plasma, physics_variables.pden_plasma_alpha_mw, ) diff --git a/source/fortran/physics_variables.f90 b/source/fortran/physics_variables.f90 index c5ec4a0b6a..da22a16f1a 100644 --- a/source/fortran/physics_variables.f90 +++ b/source/fortran/physics_variables.f90 @@ -675,7 +675,7 @@ module physics_variables real(dp) :: pden_neutron_total_mw !! neutron fusion power per volume from beams and plasma (MW/m3) - real(dp) :: neutron_power_density_plasma + real(dp) :: pden_plasma_neutron_mw !! neutron fusion power per volume just from plasma (MW/m3) real(dp) :: p_plasma_ohmic_mw diff --git a/tests/unit/test_fusion_reactions.py b/tests/unit/test_fusion_reactions.py index 95fdb06070..0ebb1dab9f 100644 --- a/tests/unit/test_fusion_reactions.py +++ b/tests/unit/test_fusion_reactions.py @@ -43,7 +43,7 @@ class SetFusionPowersParam(NamedTuple): pden_plasma_alpha_mw: Any = None - neutron_power_density_plasma: Any = None + pden_plasma_neutron_mw: Any = None expected_alpha_power_density: Any = None @@ -78,7 +78,7 @@ class SetFusionPowersParam(NamedTuple): charged_power_density=0.00066, vol_plasma=2426.25, pden_plasma_alpha_mw=0.163, - neutron_power_density_plasma=0.654, + pden_plasma_neutron_mw=0.654, expected_alpha_power_density=0.163, expected_neutron_power_density=0.654, expected_alpha_power_total=395.47875, @@ -98,7 +98,7 @@ class SetFusionPowersParam(NamedTuple): charged_power_density=0.00066, vol_plasma=2426.25, pden_plasma_alpha_mw=0.163, - neutron_power_density_plasma=0.654, + pden_plasma_neutron_mw=0.654, expected_alpha_power_density=0.20442195, expected_neutron_power_density=0.8183263050336705, expected_alpha_power_total=495.97875, @@ -118,7 +118,7 @@ class SetFusionPowersParam(NamedTuple): charged_power_density=0.00066, vol_plasma=2426.25, pden_plasma_alpha_mw=0.163, - neutron_power_density_plasma=0.654, + pden_plasma_neutron_mw=0.654, expected_alpha_power_density=0.20442195, expected_neutron_power_density=0.8183263050336705, expected_alpha_power_total=495.97875, @@ -138,7 +138,7 @@ class SetFusionPowersParam(NamedTuple): charged_power_density=0.00066, vol_plasma=2426.25, pden_plasma_alpha_mw=0.163, - neutron_power_density_plasma=0.654, + pden_plasma_neutron_mw=0.654, expected_alpha_power_density=0.20442195, expected_neutron_power_density=0.8183263050336705, expected_alpha_power_total=495.97875, @@ -183,7 +183,7 @@ def test_set_fusion_powers(setfusionpowersparam, monkeypatch): f_alpha_ion=setfusionpowersparam.f_alpha_ion, p_beam_alpha_mw=setfusionpowersparam.p_beam_alpha_mw, charged_power_density=setfusionpowersparam.charged_power_density, - neutron_power_density_plasma=setfusionpowersparam.neutron_power_density_plasma, + pden_plasma_neutron_mw=setfusionpowersparam.pden_plasma_neutron_mw, vol_plasma=setfusionpowersparam.vol_plasma, pden_plasma_alpha_mw=setfusionpowersparam.pden_plasma_alpha_mw, ) From 43d31a183e152a4b24dcb5ee1a44d8ff6c4c5c57 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 8 May 2025 14:10:24 +0100 Subject: [PATCH 22/37] =?UTF-8?q?=F0=9F=94=84=20Rename=20neutron=5Fpower?= =?UTF-8?q?=5Fbeams=20to=20p=5Fbeam=5Fneutron=5Fmw=20for=20consistency=20a?= =?UTF-8?q?cross=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/data/large_tokamak_nof_2_MFILE.DAT | 2 +- examples/data/large_tokamak_nof_MFILE.DAT | 2 +- process/physics.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/data/large_tokamak_nof_2_MFILE.DAT b/examples/data/large_tokamak_nof_2_MFILE.DAT index 8b86ad9b9b..288bdf4f0a 100644 --- a/examples/data/large_tokamak_nof_2_MFILE.DAT +++ b/examples/data/large_tokamak_nof_2_MFILE.DAT @@ -308,7 +308,7 @@ Neutron_power_density:_total_(MW/m^3)____________________________________ (pden_neutron_total_mw)__ 6.80392081072146104e-01 OP Neutron_power:_plasma_only_(MW)__________________________________________ (p_plasma_neutron_mw)_________ 1.28469670088750900e+03 OP Neutron_power_density:_plasma_(MW/m^3)___________________________________ (pden_plasma_neutron_mw)_ 6.80392081072146104e-01 OP - Neutron_power:_beam-plasma_(MW)__________________________________________ (neutron_power_beams)__________ 0.00000000000000000e+00 OP + Neutron_power:_beam-plasma_(MW)__________________________________________ (p_beam_neutron_mw)__________ 0.00000000000000000e+00 OP Charged_particle_power_(excluding_alphas)_(MW)___________________________ (non_alpha_charged_power)______ 1.20650459189592762e+00 OP Total_charged_particle_power_(including_alphas)_(MW)_____________________ (charged_particle_power)_______ 3.24864461111113485e+02 OP Total_power_deposited_in_plasma_(MW)_____________________________________ (tot_power_plasma)_____________ 3.86898310614849436e+02 OP diff --git a/examples/data/large_tokamak_nof_MFILE.DAT b/examples/data/large_tokamak_nof_MFILE.DAT index 88fe85b22f..f5d7f9dcf0 100644 --- a/examples/data/large_tokamak_nof_MFILE.DAT +++ b/examples/data/large_tokamak_nof_MFILE.DAT @@ -381,7 +381,7 @@ Neutron_power_density:_total_(MW/m^3)____________________________________ (pden_neutron_total_mw)__ 7.36926076953736353e-01 OP Neutron_power:_plasma_only_(MW)__________________________________________ (p_plasma_neutron_mw)_________ 1.39144256113123765e+03 OP Neutron_power_density:_plasma_(MW/m^3)___________________________________ (pden_plasma_neutron_mw)_ 7.36926076953736353e-01 OP - Neutron_power:_beam-plasma_(MW)__________________________________________ (neutron_power_beams)__________ 0.00000000000000000e+00 OP + Neutron_power:_beam-plasma_(MW)__________________________________________ (p_beam_neutron_mw)__________ 0.00000000000000000e+00 OP Charged_particle_power_(excluding_alphas)_(MW)___________________________ (non_alpha_charged_power)______ 1.34669877478527300e+00 OP Total_charged_particle_power_(including_alphas)_(MW)_____________________ (charged_particle_power)_______ 3.51889598375332753e+02 OP Total_power_deposited_in_plasma_(MW)_____________________________________ (tot_power_plasma)_____________ 4.40026498969293129e+02 OP diff --git a/process/physics.py b/process/physics.py index b198c06bdb..9c8ced82ff 100644 --- a/process/physics.py +++ b/process/physics.py @@ -4802,7 +4802,7 @@ def outplas(self): po.ovarre( self.outfile, "Neutron power: beam-plasma (MW)", - "(neutron_power_beams)", + "(p_beam_neutron_mw)", physics_variables.p_beam_alpha_mw * 4.0e0, "OP ", ) From eff600180b18dc0b9be238216ce543e1c427e28f Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 8 May 2025 14:11:46 +0100 Subject: [PATCH 23/37] =?UTF-8?q?=F0=9F=94=84=20Rename=20non=5Falpha=5Fcha?= =?UTF-8?q?rged=5Fpower=20to=20p=5Fnon=5Falpha=5Fcharged=5Fmw=20for=20cons?= =?UTF-8?q?istency=20across=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/data/large_tokamak_nof_2_MFILE.DAT | 4 +-- examples/data/large_tokamak_nof_MFILE.DAT | 4 +-- process/fusion_reactions.py | 10 +++--- process/io/sankey_funcs.py | 6 ++-- process/physics.py | 26 +++++++-------- process/power.py | 12 +++---- process/stellarator.py | 8 ++--- source/fortran/physics_variables.f90 | 2 +- tests/unit/test_fusion_reactions.py | 4 +-- tests/unit/test_physics.py | 36 ++++++++++----------- tests/unit/test_power.py | 10 +++--- 11 files changed, 61 insertions(+), 61 deletions(-) diff --git a/examples/data/large_tokamak_nof_2_MFILE.DAT b/examples/data/large_tokamak_nof_2_MFILE.DAT index 288bdf4f0a..469eecf904 100644 --- a/examples/data/large_tokamak_nof_2_MFILE.DAT +++ b/examples/data/large_tokamak_nof_2_MFILE.DAT @@ -309,7 +309,7 @@ Neutron_power:_plasma_only_(MW)__________________________________________ (p_plasma_neutron_mw)_________ 1.28469670088750900e+03 OP Neutron_power_density:_plasma_(MW/m^3)___________________________________ (pden_plasma_neutron_mw)_ 6.80392081072146104e-01 OP Neutron_power:_beam-plasma_(MW)__________________________________________ (p_beam_neutron_mw)__________ 0.00000000000000000e+00 OP - Charged_particle_power_(excluding_alphas)_(MW)___________________________ (non_alpha_charged_power)______ 1.20650459189592762e+00 OP + Charged_particle_power_(excluding_alphas)_(MW)___________________________ (p_non_alpha_charged_mw)______ 1.20650459189592762e+00 OP Total_charged_particle_power_(including_alphas)_(MW)_____________________ (charged_particle_power)_______ 3.24864461111113485e+02 OP Total_power_deposited_in_plasma_(MW)_____________________________________ (tot_power_plasma)_____________ 3.86898310614849436e+02 OP Synchrotron_radiation_power_(MW)_________________________________________ (pden_plasma_sync_mw*vol_plasma)_ 1.51830269530638411e+01 OP @@ -1091,7 +1091,7 @@ Radiation_power_from_inside_"coreradius"_(MW)____________________________ (pcoreradmw.)__________________ 1.30345146305381149e+02 OP Total_(MW)_______________________________________________________________ _______________________________ 3.98321570500746930e+02 OP Alpha_power_deposited_in_plasma_(MW)_____________________________________ (f_alpha_plasma*p_alpha_total_mw)_ 3.07475058693256699e+02 OP - Power_from_charged_products_of_DD_and/or_D-He3_fusion_(MW)_______________ (non_alpha_charged_power.)_____ 1.20650459189592762e+00 OP + Power_from_charged_products_of_DD_and/or_D-He3_fusion_(MW)_______________ (p_non_alpha_charged_mw.)_____ 1.20650459189592762e+00 OP Ohmic_heating_(MW)_______________________________________________________ (p_plasma_ohmic_mw.)___________ 6.88941757462895432e-01 OP Injected_power_deposited_in_plasma_(MW)__________________________________ (pinjmw)_______________________ 7.75278055722339587e+01 OP Total_(MW)_______________________________________________________________ _______________________________ 3.86898310614849436e+02 OP diff --git a/examples/data/large_tokamak_nof_MFILE.DAT b/examples/data/large_tokamak_nof_MFILE.DAT index f5d7f9dcf0..8ab49b611b 100644 --- a/examples/data/large_tokamak_nof_MFILE.DAT +++ b/examples/data/large_tokamak_nof_MFILE.DAT @@ -382,7 +382,7 @@ Neutron_power:_plasma_only_(MW)__________________________________________ (p_plasma_neutron_mw)_________ 1.39144256113123765e+03 OP Neutron_power_density:_plasma_(MW/m^3)___________________________________ (pden_plasma_neutron_mw)_ 7.36926076953736353e-01 OP Neutron_power:_beam-plasma_(MW)__________________________________________ (p_beam_neutron_mw)__________ 0.00000000000000000e+00 OP - Charged_particle_power_(excluding_alphas)_(MW)___________________________ (non_alpha_charged_power)______ 1.34669877478527300e+00 OP + Charged_particle_power_(excluding_alphas)_(MW)___________________________ (p_non_alpha_charged_mw)______ 1.34669877478527300e+00 OP Total_charged_particle_power_(including_alphas)_(MW)_____________________ (charged_particle_power)_______ 3.51889598375332753e+02 OP Total_power_deposited_in_plasma_(MW)_____________________________________ (tot_power_plasma)_____________ 4.40026498969293129e+02 OP Synchrotron_radiation_power_(MW)_________________________________________ (pden_plasma_sync_mw*vol_plasma)_ 1.45588444219885051e+01 OP @@ -1165,7 +1165,7 @@ Radiation_power_from_inside_"coreradius"_(MW)____________________________ (pcoreradmw.)__________________ 1.18176171262989300e+02 OP Total_(MW)_______________________________________________________________ _______________________________ 4.40026498969293016e+02 OP Alpha_power_deposited_in_plasma_(MW)_____________________________________ (f_alpha_plasma*p_alpha_total_mw)_ 3.33015754620520056e+02 OP - Power_from_charged_products_of_DD_and/or_D-He3_fusion_(MW)_______________ (non_alpha_charged_power.)_____ 1.34669877478527300e+00 OP + Power_from_charged_products_of_DD_and/or_D-He3_fusion_(MW)_______________ (p_non_alpha_charged_mw.)_____ 1.34669877478527300e+00 OP Ohmic_heating_(MW)_______________________________________________________ (p_plasma_ohmic_mw.)___________ 6.76139747896948751e-01 OP Injected_power_deposited_in_plasma_(MW)__________________________________ (pinjmw)_______________________ 1.04987905826090795e+02 OP Total_(MW)_______________________________________________________________ _______________________________ 4.40026498969293129e+02 OP diff --git a/process/fusion_reactions.py b/process/fusion_reactions.py index 15ff1c67a3..1df2bf088d 100644 --- a/process/fusion_reactions.py +++ b/process/fusion_reactions.py @@ -708,7 +708,7 @@ def set_fusion_powers( - p_alpha_total_mw (float): Total alpha fusion power from plasma and beams [MW]. - p_plasma_neutron_mw (float): Neutron fusion power from only the plasma [MW]. - p_neutron_total_mw (float): Total neutron fusion power from plasma and beams [MW]. - - non_alpha_charged_power (float): Other total charged particle fusion power [MW]. + - p_non_alpha_charged_mw (float): Other total charged particle fusion power [MW]. - pden_alpha_total_mw (float): Alpha power per unit volume, from beams and plasma [MW/m^3]. - f_pden_alpha_electron_mw (float): Alpha power per unit volume to electrons [MW/m^3]. - f_pden_alpha_ions_mw (float): Alpha power per unit volume to ions [MW/m^3]. @@ -756,14 +756,14 @@ def set_fusion_powers( # Charged particle power # Total non-alpha charged particle power - non_alpha_charged_power = charged_power_density * vol_plasma + p_non_alpha_charged_mw = charged_power_density * vol_plasma # Charged particle fusion power - charged_particle_power = p_alpha_total_mw + non_alpha_charged_power + charged_particle_power = p_alpha_total_mw + p_non_alpha_charged_mw # Total fusion power p_fusion_total_mw = ( - p_alpha_total_mw + p_neutron_total_mw + non_alpha_charged_power + p_alpha_total_mw + p_neutron_total_mw + p_non_alpha_charged_mw ) # Alpha power to electrons and ions (used with electron @@ -782,7 +782,7 @@ def set_fusion_powers( p_alpha_total_mw, p_plasma_neutron_mw, p_neutron_total_mw, - non_alpha_charged_power, + p_non_alpha_charged_mw, pden_alpha_total_mw, f_pden_alpha_electron_mw, f_pden_alpha_ions_mw, diff --git a/process/io/sankey_funcs.py b/process/io/sankey_funcs.py index c2c72d1577..7fcef3e0d2 100644 --- a/process/io/sankey_funcs.py +++ b/process/io/sankey_funcs.py @@ -38,11 +38,11 @@ def plot_full_sankey( p_neutron_total_mw = m_file.data["p_neutron_total_mw"].get_scan( -1 ) # Neutron fusion power (MW) - non_alpha_charged_power = m_file.data["non_alpha_charged_power"].get_scan( + p_non_alpha_charged_mw = m_file.data["p_non_alpha_charged_mw"].get_scan( -1 ) # Non-alpha charged particle power (MW) pcharohmmw = ( - non_alpha_charged_power + p_plasma_ohmic_mw + p_non_alpha_charged_mw + p_plasma_ohmic_mw ) # The ohmic and charged particle power (MW) p_alpha_total_mw = m_file.data["p_alpha_total_mw"].get_scan( -1 @@ -472,7 +472,7 @@ def plot_full_sankey( t.set_position((pos[0]-0.2,pos[1])) if t == diagrams[0].texts[4]: # Charged Particles t.set_horizontalalignment('right') - t.set_position((pos[0]-0.5*(non_alpha_charged_power/totalplasma)-0.05,pos[1])) + t.set_position((pos[0]-0.5*(p_non_alpha_charged_mw/totalplasma)-0.05,pos[1])) if t == diagrams[0].texts[5]: # Alphas t.set_horizontalalignment('left') t.set_position((pos[0]+0.5*(p_alpha_total_mw/totalplasma)+0.05,pos[1]-0.1)) diff --git a/process/physics.py b/process/physics.py index 9c8ced82ff..61ab91f3bd 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2175,7 +2175,7 @@ def physics(self): physics_variables.p_alpha_total_mw, physics_variables.p_plasma_neutron_mw, physics_variables.p_neutron_total_mw, - physics_variables.non_alpha_charged_power, + physics_variables.p_non_alpha_charged_mw, physics_variables.pden_alpha_total_mw, physics_variables.f_pden_alpha_electron_mw, physics_variables.f_pden_alpha_ions_mw, @@ -2329,7 +2329,7 @@ def physics(self): physics_variables.p_plasma_separatrix_mw = ( physics_variables.f_alpha_plasma * physics_variables.p_alpha_total_mw - + physics_variables.non_alpha_charged_power + + physics_variables.p_non_alpha_charged_mw + pinj + physics_variables.p_plasma_ohmic_mw - physics_variables.p_plasma_rad_mw @@ -2412,7 +2412,7 @@ def physics(self): physics_variables.i_plasma_ignited, physics_variables.kappa, physics_variables.kappa95, - physics_variables.non_alpha_charged_power, + physics_variables.p_non_alpha_charged_mw, current_drive_variables.p_hcd_injected_total_mw, physics_variables.plasma_current, physics_variables.pden_plasma_core_rad_mw, @@ -2671,7 +2671,7 @@ def physics(self): # Calculate some derived quantities that may not have been defined earlier physics_module.total_loss_power = 1e6 * ( physics_variables.f_alpha_plasma * physics_variables.p_alpha_total_mw - + physics_variables.non_alpha_charged_power + + physics_variables.p_non_alpha_charged_mw + physics_variables.p_plasma_ohmic_mw + current_drive_variables.p_hcd_injected_total_mw ) @@ -4810,8 +4810,8 @@ def outplas(self): po.ovarre( self.outfile, "Charged particle power (excluding alphas) (MW)", - "(non_alpha_charged_power)", - physics_variables.non_alpha_charged_power, + "(p_non_alpha_charged_mw)", + physics_variables.p_non_alpha_charged_mw, "OP ", ) po.ovarre( @@ -4823,7 +4823,7 @@ def outplas(self): ) tot_power_plasma = ( physics_variables.f_alpha_plasma * physics_variables.p_alpha_total_mw - + physics_variables.non_alpha_charged_power + + physics_variables.p_non_alpha_charged_mw + physics_variables.p_plasma_ohmic_mw + current_drive_variables.p_hcd_injected_total_mw ) @@ -6104,7 +6104,7 @@ def output_confinement_comparison(self, istell: int) -> None: physics_variables.i_plasma_ignited, physics_variables.kappa, physics_variables.kappa95, - physics_variables.non_alpha_charged_power, + physics_variables.p_non_alpha_charged_mw, current_drive_variables.p_hcd_injected_total_mw, physics_variables.plasma_current, physics_variables.pden_plasma_core_rad_mw, @@ -7028,7 +7028,7 @@ def fhz(hfact: float) -> float: physics_variables.i_plasma_ignited, physics_variables.kappa, physics_variables.kappa95, - physics_variables.non_alpha_charged_power, + physics_variables.p_non_alpha_charged_mw, current_drive_variables.p_hcd_injected_total_mw, physics_variables.plasma_current, physics_variables.pden_plasma_core_rad_mw, @@ -7084,7 +7084,7 @@ def calculate_confinement_time( i_plasma_ignited: int, kappa: float, kappa95: float, - non_alpha_charged_power: float, + p_non_alpha_charged_mw: float, p_hcd_injected_total_mw: float, plasma_current: float, pden_plasma_core_rad_mw: float, @@ -7113,7 +7113,7 @@ def calculate_confinement_time( :param i_plasma_ignited: Switch for ignited calculation :param kappa: Plasma elongation :param kappa95: Plasma elongation at 95% surface - :param non_alpha_charged_power: Non-alpha charged particle fusion power (MW) + :param p_non_alpha_charged_mw: Non-alpha charged particle fusion power (MW) :param p_hcd_injected_total_mw: Auxiliary power to ions and electrons (MW) :param plasma_current: Plasma current (A) :param pden_plasma_core_rad_mw: Total core radiation power (MW/m3) @@ -7141,7 +7141,7 @@ def calculate_confinement_time( # Calculate heating power (MW) p_plasma_loss_mw = ( physics_variables.f_alpha_plasma * p_alpha_total_mw - + non_alpha_charged_power + + p_non_alpha_charged_mw + physics_variables.p_plasma_ohmic_mw ) @@ -8361,7 +8361,7 @@ def init_physics_variables(): physics_variables.p_alpha_total_mw = 0.0 physics_variables.p_plasma_alpha_mw = 0.0 physics_variables.p_beam_alpha_mw = 0.0 - physics_variables.non_alpha_charged_power = 0.0 + physics_variables.p_non_alpha_charged_mw = 0.0 physics_variables.charged_power_density = 0.0 physics_variables.pcoef = 0.0 physics_variables.p_plasma_inner_rad_mw = 0.0 diff --git a/process/power.py b/process/power.py index 8e4e5bae4f..20b178e656 100644 --- a/process/power.py +++ b/process/power.py @@ -1712,8 +1712,8 @@ def power2(self, output: bool): po.ovarrf( self.outfile, "Power from charged products of DD and/or D-He3 fusion (MW)", - "(non_alpha_charged_power.)", - physics_variables.non_alpha_charged_power, + "(p_non_alpha_charged_mw.)", + physics_variables.p_non_alpha_charged_mw, "OP ", ) po.ovarrf( @@ -1724,9 +1724,9 @@ def power2(self, output: bool): "OP ", ) # if (physics_variables.i_plasma_ignited == 1) : - # po.ovarrf(self.outfile,'Total (MW)','',f_alpha_plasma*physics_variables.p_alpha_total_mw+physics_variables.non_alpha_charged_power+p_plasma_ohmic_mw, 'OP ') + # po.ovarrf(self.outfile,'Total (MW)','',f_alpha_plasma*physics_variables.p_alpha_total_mw+physics_variables.p_non_alpha_charged_mw+p_plasma_ohmic_mw, 'OP ') # po.oblnkl(self.outfile) - # if (abs(sum - (physics_variables.f_alpha_plasma*physics_variables.p_alpha_total_mw+physics_variables.non_alpha_charged_power+physics_variables.p_plasma_ohmic_mw)) > 5.0e0) : + # if (abs(sum - (physics_variables.f_alpha_plasma*physics_variables.p_alpha_total_mw+physics_variables.p_non_alpha_charged_mw+physics_variables.p_plasma_ohmic_mw)) > 5.0e0) : # write(*,*) 'WARNING: Power balance across separatrix is in error by more than 5 MW.' # po.ocmmnt(self.outfile,'WARNING: Power balance across separatrix is in error by more than 5 MW.') # @@ -1743,7 +1743,7 @@ def power2(self, output: bool): "Total (MW)", "", physics_variables.f_alpha_plasma * physics_variables.p_alpha_total_mw - + physics_variables.non_alpha_charged_power + + physics_variables.p_non_alpha_charged_mw + physics_variables.p_plasma_ohmic_mw + pinj, "OP ", @@ -1755,7 +1755,7 @@ def power2(self, output: bool): - ( physics_variables.f_alpha_plasma * physics_variables.p_alpha_total_mw - + physics_variables.non_alpha_charged_power + + physics_variables.p_non_alpha_charged_mw + physics_variables.p_plasma_ohmic_mw + pinj ) diff --git a/process/stellarator.py b/process/stellarator.py index c4571dd666..c1c8934ac3 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -4278,7 +4278,7 @@ def stphys(self, output): physics_variables.p_alpha_total_mw, physics_variables.p_plasma_neutron_mw, physics_variables.p_neutron_total_mw, - physics_variables.non_alpha_charged_power, + physics_variables.p_non_alpha_charged_mw, physics_variables.pden_alpha_total_mw, physics_variables.f_pden_alpha_electron_mw, physics_variables.f_pden_alpha_ions_mw, @@ -4393,7 +4393,7 @@ def stphys(self, output): powht = ( physics_variables.f_alpha_plasma * physics_variables.p_alpha_total_mw - + physics_variables.non_alpha_charged_power + + physics_variables.p_non_alpha_charged_mw + physics_variables.p_plasma_ohmic_mw - physics_variables.pden_plasma_rad_mw * physics_variables.vol_plasma ) @@ -4469,7 +4469,7 @@ def stphys(self, output): physics_variables.rad_fraction_total = physics_variables.p_plasma_rad_mw / ( physics_variables.f_alpha_plasma * physics_variables.p_alpha_total_mw - + physics_variables.non_alpha_charged_power + + physics_variables.p_non_alpha_charged_mw + physics_variables.p_plasma_ohmic_mw + current_drive_variables.p_hcd_injected_total_mw ) @@ -4499,7 +4499,7 @@ def stphys(self, output): physics_variables.i_plasma_ignited, physics_variables.kappa, physics_variables.kappa95, - physics_variables.non_alpha_charged_power, + physics_variables.p_non_alpha_charged_mw, current_drive_variables.p_hcd_injected_total_mw, physics_variables.plasma_current, physics_variables.pden_plasma_core_rad_mw, diff --git a/source/fortran/physics_variables.f90 b/source/fortran/physics_variables.f90 index da22a16f1a..ea8a90975d 100644 --- a/source/fortran/physics_variables.f90 +++ b/source/fortran/physics_variables.f90 @@ -606,7 +606,7 @@ module physics_variables real(dp) :: p_beam_alpha_mw !! alpha power from hot neutral beam ions (MW) - real(dp) :: non_alpha_charged_power + real(dp) :: p_non_alpha_charged_mw !! non-alpha charged particle fusion power (MW) real(dp) :: charged_particle_power diff --git a/tests/unit/test_fusion_reactions.py b/tests/unit/test_fusion_reactions.py index 0ebb1dab9f..2f70ce3e74 100644 --- a/tests/unit/test_fusion_reactions.py +++ b/tests/unit/test_fusion_reactions.py @@ -172,7 +172,7 @@ def test_set_fusion_powers(setfusionpowersparam, monkeypatch): p_alpha_total_mw, p_plasma_neutron_mw, p_neutron_total_mw, - non_alpha_charged_power, + p_non_alpha_charged_mw, pden_alpha_total_mw, f_pden_alpha_electron_mw, f_pden_alpha_ions_mw, @@ -200,7 +200,7 @@ def test_set_fusion_powers(setfusionpowersparam, monkeypatch): assert p_neutron_total_mw == pytest.approx( setfusionpowersparam.expected_neutron_power_total ) - assert non_alpha_charged_power == pytest.approx( + assert p_non_alpha_charged_mw == pytest.approx( setfusionpowersparam.expected_non_alpha_charged_power ) assert f_pden_alpha_electron_mw == pytest.approx( diff --git a/tests/unit/test_physics.py b/tests/unit/test_physics.py index b8611fe4dd..05b025451e 100644 --- a/tests/unit/test_physics.py +++ b/tests/unit/test_physics.py @@ -2404,7 +2404,7 @@ class ConfinementTimeParam(NamedTuple): kappa95: Any = None - non_alpha_charged_power: Any = None + p_non_alpha_charged_mw: Any = None p_hcd_injected_total_mw: Any = None @@ -2472,7 +2472,7 @@ class ConfinementTimeParam(NamedTuple): hfact=6.1946504123280199, kappa=1.8500000000000001, kappa95=1.6517857142857142, - non_alpha_charged_power=1.2453296074483358, + p_non_alpha_charged_mw=1.2453296074483358, p_hcd_injected_total_mw=75.397788712812741, plasma_current=16616203.759182997, pden_plasma_core_rad_mw=0.047757569353246924, @@ -2514,7 +2514,7 @@ class ConfinementTimeParam(NamedTuple): hfact=0.96163409847948844, kappa=1.8500000000000001, kappa95=1.6517857142857142, - non_alpha_charged_power=1.2453296074483358, + p_non_alpha_charged_mw=1.2453296074483358, p_hcd_injected_total_mw=75.397788712812741, plasma_current=16616203.759182997, pden_plasma_core_rad_mw=0.047757569353246924, @@ -2556,7 +2556,7 @@ class ConfinementTimeParam(NamedTuple): hfact=1.1960655150953154, kappa=1.8500000000000001, kappa95=1.6517857142857142, - non_alpha_charged_power=1.2453296074483358, + p_non_alpha_charged_mw=1.2453296074483358, p_hcd_injected_total_mw=75.397788712812741, plasma_current=16616203.759182997, pden_plasma_core_rad_mw=0.047757569353246924, @@ -2598,7 +2598,7 @@ class ConfinementTimeParam(NamedTuple): hfact=0.78453691772934719, kappa=1.8500000000000001, kappa95=1.6517857142857142, - non_alpha_charged_power=1.2453296074483358, + p_non_alpha_charged_mw=1.2453296074483358, p_hcd_injected_total_mw=75.397788712812741, plasma_current=16616203.759182997, pden_plasma_core_rad_mw=0.047757569353246924, @@ -2640,7 +2640,7 @@ class ConfinementTimeParam(NamedTuple): hfact=1.1619079679077555, kappa=1.8500000000000001, kappa95=1.6517857142857142, - non_alpha_charged_power=1.2453296074483358, + p_non_alpha_charged_mw=1.2453296074483358, p_hcd_injected_total_mw=75.397788712812741, plasma_current=16616203.759182997, pden_plasma_core_rad_mw=0.047757569353246924, @@ -2682,7 +2682,7 @@ class ConfinementTimeParam(NamedTuple): hfact=1.7340642483550435, kappa=1.8500000000000001, kappa95=1.6517857142857142, - non_alpha_charged_power=1.2453296074483358, + p_non_alpha_charged_mw=1.2453296074483358, p_hcd_injected_total_mw=75.397788712812741, plasma_current=16616203.759182997, pden_plasma_core_rad_mw=0.047757569353246924, @@ -2724,7 +2724,7 @@ class ConfinementTimeParam(NamedTuple): hfact=1.1117392853827024, kappa=1.8500000000000001, kappa95=1.6517857142857142, - non_alpha_charged_power=1.2453296074483358, + p_non_alpha_charged_mw=1.2453296074483358, p_hcd_injected_total_mw=75.397788712812741, plasma_current=16616203.759182997, pden_plasma_core_rad_mw=0.047757569353246924, @@ -2766,7 +2766,7 @@ class ConfinementTimeParam(NamedTuple): hfact=0.84477227311274361, kappa=1.8500000000000001, kappa95=1.6517857142857142, - non_alpha_charged_power=1.2453296074483358, + p_non_alpha_charged_mw=1.2453296074483358, p_hcd_injected_total_mw=75.397788712812741, plasma_current=16616203.759182997, pden_plasma_core_rad_mw=0.047757569353246924, @@ -2808,7 +2808,7 @@ class ConfinementTimeParam(NamedTuple): hfact=1.6096667103064701, kappa=1.8500000000000001, kappa95=1.6517857142857142, - non_alpha_charged_power=1.2453296074483358, + p_non_alpha_charged_mw=1.2453296074483358, p_hcd_injected_total_mw=75.397788712812741, plasma_current=16616203.759182997, pden_plasma_core_rad_mw=0.047757569353246924, @@ -2850,7 +2850,7 @@ class ConfinementTimeParam(NamedTuple): hfact=0.67053301699102119, kappa=1.8500000000000001, kappa95=1.6517857142857142, - non_alpha_charged_power=1.2453296074483358, + p_non_alpha_charged_mw=1.2453296074483358, p_hcd_injected_total_mw=75.397788712812741, plasma_current=16616203.759182997, pden_plasma_core_rad_mw=0.047757569353246924, @@ -2892,7 +2892,7 @@ class ConfinementTimeParam(NamedTuple): hfact=2.1212580310552207, kappa=1.8500000000000001, kappa95=1.6517857142857142, - non_alpha_charged_power=1.2453296074483358, + p_non_alpha_charged_mw=1.2453296074483358, p_hcd_injected_total_mw=75.397788712812741, plasma_current=16616203.759182997, pden_plasma_core_rad_mw=0.047757569353246924, @@ -2934,7 +2934,7 @@ class ConfinementTimeParam(NamedTuple): hfact=50.095480115636271, kappa=1.8500000000000001, kappa95=1.6517857142857142, - non_alpha_charged_power=1.2453296074483358, + p_non_alpha_charged_mw=1.2453296074483358, p_hcd_injected_total_mw=75.397788712812741, plasma_current=16616203.759182997, pden_plasma_core_rad_mw=0.047757569353246924, @@ -2976,7 +2976,7 @@ class ConfinementTimeParam(NamedTuple): hfact=87.869318916638761, kappa=1.8500000000000001, kappa95=1.6517857142857142, - non_alpha_charged_power=1.2453296074483358, + p_non_alpha_charged_mw=1.2453296074483358, p_hcd_injected_total_mw=75.397788712812741, plasma_current=16616203.759182997, pden_plasma_core_rad_mw=0.047757569353246924, @@ -3018,7 +3018,7 @@ class ConfinementTimeParam(NamedTuple): hfact=28.562137619592285, kappa=1.8500000000000001, kappa95=1.6517857142857142, - non_alpha_charged_power=1.2453296074483358, + p_non_alpha_charged_mw=1.2453296074483358, p_hcd_injected_total_mw=75.397788712812741, plasma_current=16616203.759182997, pden_plasma_core_rad_mw=0.047757569353246924, @@ -3060,7 +3060,7 @@ class ConfinementTimeParam(NamedTuple): hfact=0.50082256309019457, kappa=1.8500000000000001, kappa95=1.6517857142857142, - non_alpha_charged_power=1.2453296074483358, + p_non_alpha_charged_mw=1.2453296074483358, p_hcd_injected_total_mw=75.397788712812741, plasma_current=16616203.759182997, pden_plasma_core_rad_mw=0.047757569353246924, @@ -3102,7 +3102,7 @@ class ConfinementTimeParam(NamedTuple): hfact=0.77961193402355955, kappa=1.8500000000000001, kappa95=1.6517857142857142, - non_alpha_charged_power=1.2453296074483358, + p_non_alpha_charged_mw=1.2453296074483358, p_hcd_injected_total_mw=75.397788712812741, plasma_current=16616203.759182997, pden_plasma_core_rad_mw=0.047757569353246924, @@ -3180,7 +3180,7 @@ def test_calculate_confinement_time(confinementtimeparam, monkeypatch, physics): hfact=confinementtimeparam.hfact, kappa=confinementtimeparam.kappa, kappa95=confinementtimeparam.kappa95, - non_alpha_charged_power=confinementtimeparam.non_alpha_charged_power, + p_non_alpha_charged_mw=confinementtimeparam.p_non_alpha_charged_mw, p_hcd_injected_total_mw=confinementtimeparam.p_hcd_injected_total_mw, plasma_current=confinementtimeparam.plasma_current, pden_plasma_core_rad_mw=confinementtimeparam.pden_plasma_core_rad_mw, diff --git a/tests/unit/test_power.py b/tests/unit/test_power.py index 468c7d98b8..feb052523e 100644 --- a/tests/unit/test_power.py +++ b/tests/unit/test_power.py @@ -2171,7 +2171,7 @@ class Power2Param(NamedTuple): p_fusion_total_mw: Any = None - non_alpha_charged_power: Any = None + p_non_alpha_charged_mw: Any = None pscalingmw: Any = None @@ -2309,7 +2309,7 @@ class Power2Param(NamedTuple): p_plasma_ohmic_mw=0.61391840981850698, i_rad_loss=1, p_fusion_total_mw=1985.785106643267, - non_alpha_charged_power=1.6064693283140403, + p_non_alpha_charged_mw=1.6064693283140403, pscalingmw=325.08626176539281, f_alpha_plasma=0.94999999999999996, ppump=0, @@ -2411,7 +2411,7 @@ class Power2Param(NamedTuple): p_plasma_ohmic_mw=0.61391840981850698, i_rad_loss=1, p_fusion_total_mw=1985.1653095257811, - non_alpha_charged_power=1.6059679220663614, + p_non_alpha_charged_mw=1.6059679220663614, pscalingmw=325.00280675287695, f_alpha_plasma=0.94999999999999996, ppump=0, @@ -2648,8 +2648,8 @@ def test_power2(power2param, monkeypatch, power): monkeypatch.setattr( physics_variables, - "non_alpha_charged_power", - power2param.non_alpha_charged_power, + "p_non_alpha_charged_mw", + power2param.p_non_alpha_charged_mw, ) monkeypatch.setattr(physics_variables, "pscalingmw", power2param.pscalingmw) From 03ffbb3d956e867ba6c40a8ad096d7e175341bba Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 8 May 2025 14:12:34 +0100 Subject: [PATCH 24/37] =?UTF-8?q?=F0=9F=94=84=20Rename=20charged=5Fparticl?= =?UTF-8?q?e=5Fpower=20to=20p=5Fcharged=5Fparticle=5Fmw=20for=20consistenc?= =?UTF-8?q?y=20across=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/data/large_tokamak_nof_2_MFILE.DAT | 2 +- examples/data/large_tokamak_nof_MFILE.DAT | 2 +- process/fusion_reactions.py | 6 +++--- process/physics.py | 8 ++++---- process/stellarator.py | 2 +- source/fortran/physics_variables.f90 | 2 +- tests/unit/test_fusion_reactions.py | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/data/large_tokamak_nof_2_MFILE.DAT b/examples/data/large_tokamak_nof_2_MFILE.DAT index 469eecf904..0bca73e3f1 100644 --- a/examples/data/large_tokamak_nof_2_MFILE.DAT +++ b/examples/data/large_tokamak_nof_2_MFILE.DAT @@ -310,7 +310,7 @@ Neutron_power_density:_plasma_(MW/m^3)___________________________________ (pden_plasma_neutron_mw)_ 6.80392081072146104e-01 OP Neutron_power:_beam-plasma_(MW)__________________________________________ (p_beam_neutron_mw)__________ 0.00000000000000000e+00 OP Charged_particle_power_(excluding_alphas)_(MW)___________________________ (p_non_alpha_charged_mw)______ 1.20650459189592762e+00 OP - Total_charged_particle_power_(including_alphas)_(MW)_____________________ (charged_particle_power)_______ 3.24864461111113485e+02 OP + Total_charged_particle_power_(including_alphas)_(MW)_____________________ (p_charged_particle_mw)_______ 3.24864461111113485e+02 OP Total_power_deposited_in_plasma_(MW)_____________________________________ (tot_power_plasma)_____________ 3.86898310614849436e+02 OP Synchrotron_radiation_power_(MW)_________________________________________ (pden_plasma_sync_mw*vol_plasma)_ 1.51830269530638411e+01 OP Synchrotron_wall_reflectivity_factor_____________________________________ (f_sync_reflect)_______________ 6.00000000000000089e-01 diff --git a/examples/data/large_tokamak_nof_MFILE.DAT b/examples/data/large_tokamak_nof_MFILE.DAT index 8ab49b611b..7aab684e7b 100644 --- a/examples/data/large_tokamak_nof_MFILE.DAT +++ b/examples/data/large_tokamak_nof_MFILE.DAT @@ -383,7 +383,7 @@ Neutron_power_density:_plasma_(MW/m^3)___________________________________ (pden_plasma_neutron_mw)_ 7.36926076953736353e-01 OP Neutron_power:_beam-plasma_(MW)__________________________________________ (p_beam_neutron_mw)__________ 0.00000000000000000e+00 OP Charged_particle_power_(excluding_alphas)_(MW)___________________________ (p_non_alpha_charged_mw)______ 1.34669877478527300e+00 OP - Total_charged_particle_power_(including_alphas)_(MW)_____________________ (charged_particle_power)_______ 3.51889598375332753e+02 OP + Total_charged_particle_power_(including_alphas)_(MW)_____________________ (p_charged_particle_mw)_______ 3.51889598375332753e+02 OP Total_power_deposited_in_plasma_(MW)_____________________________________ (tot_power_plasma)_____________ 4.40026498969293129e+02 OP Synchrotron_radiation_power_(MW)_________________________________________ (pden_plasma_sync_mw*vol_plasma)_ 1.45588444219885051e+01 OP Synchrotron_wall_reflectivity_factor_____________________________________ (f_sync_reflect)_______________ 6.00000000000000089e-01 diff --git a/process/fusion_reactions.py b/process/fusion_reactions.py index 1df2bf088d..bc48513f85 100644 --- a/process/fusion_reactions.py +++ b/process/fusion_reactions.py @@ -712,7 +712,7 @@ def set_fusion_powers( - pden_alpha_total_mw (float): Alpha power per unit volume, from beams and plasma [MW/m^3]. - f_pden_alpha_electron_mw (float): Alpha power per unit volume to electrons [MW/m^3]. - f_pden_alpha_ions_mw (float): Alpha power per unit volume to ions [MW/m^3]. - - charged_particle_power (float): Charged particle fusion power [MW]. + - p_charged_particle_mw (float): Charged particle fusion power [MW]. - p_fusion_total_mw (float): Total fusion power [MW]. References: @@ -759,7 +759,7 @@ def set_fusion_powers( p_non_alpha_charged_mw = charged_power_density * vol_plasma # Charged particle fusion power - charged_particle_power = p_alpha_total_mw + p_non_alpha_charged_mw + p_charged_particle_mw = p_alpha_total_mw + p_non_alpha_charged_mw # Total fusion power p_fusion_total_mw = ( @@ -786,7 +786,7 @@ def set_fusion_powers( pden_alpha_total_mw, f_pden_alpha_electron_mw, f_pden_alpha_ions_mw, - charged_particle_power, + p_charged_particle_mw, p_fusion_total_mw, ) diff --git a/process/physics.py b/process/physics.py index 61ab91f3bd..07e90d26f1 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2179,7 +2179,7 @@ def physics(self): physics_variables.pden_alpha_total_mw, physics_variables.f_pden_alpha_electron_mw, physics_variables.f_pden_alpha_ions_mw, - physics_variables.charged_particle_power, + physics_variables.p_charged_particle_mw, physics_variables.p_fusion_total_mw, ) = reactions.set_fusion_powers( physics_variables.f_alpha_electron, @@ -4817,8 +4817,8 @@ def outplas(self): po.ovarre( self.outfile, "Total charged particle power (including alphas) (MW)", - "(charged_particle_power)", - physics_variables.charged_particle_power, + "(p_charged_particle_mw)", + physics_variables.p_charged_particle_mw, "OP ", ) tot_power_plasma = ( @@ -8376,7 +8376,7 @@ def init_physics_variables(): physics_variables.p_plasma_dt_mw = 0.0 physics_variables.p_plasma_outer_rad_mw = 0.0 physics_variables.pden_plasma_outer_rad_mw = 0.0 - physics_variables.charged_particle_power = 0.0 + physics_variables.p_charged_particle_mw = 0.0 physics_variables.vs_plasma_internal = 0.0 physics_variables.pflux_fw_rad_mw = 0.0 physics_variables.piepv = 0.0 diff --git a/process/stellarator.py b/process/stellarator.py index c1c8934ac3..405d04ca7e 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -4282,7 +4282,7 @@ def stphys(self, output): physics_variables.pden_alpha_total_mw, physics_variables.f_pden_alpha_electron_mw, physics_variables.f_pden_alpha_ions_mw, - physics_variables.charged_particle_power, + physics_variables.p_charged_particle_mw, physics_variables.p_fusion_total_mw, ) = reactions.set_fusion_powers( physics_variables.f_alpha_electron, diff --git a/source/fortran/physics_variables.f90 b/source/fortran/physics_variables.f90 index ea8a90975d..10739630f3 100644 --- a/source/fortran/physics_variables.f90 +++ b/source/fortran/physics_variables.f90 @@ -609,7 +609,7 @@ module physics_variables real(dp) :: p_non_alpha_charged_mw !! non-alpha charged particle fusion power (MW) - real(dp) :: charged_particle_power + real(dp) :: p_charged_particle_mw !! Total charged particle fusion power [MW] real(dp) :: charged_power_density diff --git a/tests/unit/test_fusion_reactions.py b/tests/unit/test_fusion_reactions.py index 2f70ce3e74..c1f0dee657 100644 --- a/tests/unit/test_fusion_reactions.py +++ b/tests/unit/test_fusion_reactions.py @@ -176,7 +176,7 @@ def test_set_fusion_powers(setfusionpowersparam, monkeypatch): pden_alpha_total_mw, f_pden_alpha_electron_mw, f_pden_alpha_ions_mw, - charged_particle_power, + p_charged_particle_mw, p_fusion_total_mw, ) = reactions.set_fusion_powers( f_alpha_electron=setfusionpowersparam.f_alpha_electron, @@ -209,7 +209,7 @@ def test_set_fusion_powers(setfusionpowersparam, monkeypatch): assert f_pden_alpha_ions_mw == pytest.approx( setfusionpowersparam.expected_alpha_power_ion_density ) - assert charged_particle_power == pytest.approx( + assert p_charged_particle_mw == pytest.approx( setfusionpowersparam.expected_charged_particle_power ) assert p_fusion_total_mw == pytest.approx( From e4afc65423f9f3a1047a65680fc7082fcd852195 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Thu, 8 May 2025 14:14:04 +0100 Subject: [PATCH 25/37] =?UTF-8?q?=F0=9F=94=84=20Rename=20total=5Fpower=5Fd?= =?UTF-8?q?eposited=5Fin=5Fplasma=20to=20p=5Fplasma=5Fheating=5Ftotal=5Fmw?= =?UTF-8?q?=20for=20consistency=20across=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/csv_output_large_tokamak_MFILE.DAT | 2 +- examples/data/large_tokamak_1_MFILE.DAT | 2 +- examples/data/large_tokamak_2_MFILE.DAT | 2 +- examples/data/large_tokamak_3_MFILE.DAT | 2 +- examples/data/large_tokamak_4_MFILE.DAT | 2 +- examples/data/large_tokamak_nof_2_MFILE.DAT | 2 +- examples/data/large_tokamak_nof_MFILE.DAT | 2 +- process/dcll.py | 5 +---- process/fusion_reactions.py | 12 +++--------- process/hcpb.py | 3 +-- process/io/sankey_funcs.py | 8 ++------ process/physics.py | 14 +++++--------- process/stellarator.py | 17 +++++------------ 13 files changed, 24 insertions(+), 49 deletions(-) diff --git a/examples/data/csv_output_large_tokamak_MFILE.DAT b/examples/data/csv_output_large_tokamak_MFILE.DAT index 6360e8cd10..2b91b53f09 100644 --- a/examples/data/csv_output_large_tokamak_MFILE.DAT +++ b/examples/data/csv_output_large_tokamak_MFILE.DAT @@ -423,7 +423,7 @@ Alpha_power:_beam-plasma_(MW)___________________________________________ (palpnb)______________________ 0.0000E+00 OP Neutron_power_(MW)______________________________________________________ (pneutmw)_____________________ 1.2733E+03 OP Charged_particle_power_(excluding_alphas)_(MW)__________________________ (pchargemw)___________________ 1.2322E+00 OP - Total_power_deposited_in_plasma_(MW)____________________________________ (tot_power_plasma)____________ 3.7935E+02 OP + Total_power_deposited_in_plasma_(MW)____________________________________ (p_plasma_heating_total_mw)____________ 3.7935E+02 OP Bremsstrahlung_radiation_power_(MW)_____________________________________ (pbrempv*vol)_________________ 6.4356E+01 OP Line_radiation_power_(MW)_______________________________________________ (plinepv*vol)_________________ 1.4715E+02 OP Synchrotron_radiation_power_(MW)________________________________________ (p_plasma_sync_mw)_________________ 1.2665E+01 OP diff --git a/examples/data/large_tokamak_1_MFILE.DAT b/examples/data/large_tokamak_1_MFILE.DAT index be83abfbeb..3b75a9cc95 100644 --- a/examples/data/large_tokamak_1_MFILE.DAT +++ b/examples/data/large_tokamak_1_MFILE.DAT @@ -424,7 +424,7 @@ Alpha_power:_beam-plasma_(MW)___________________________________________ (palpnb)______________________ 0.0000E+00 OP Neutron_power_(MW)______________________________________________________ (pneutmw)_____________________ 1.2953E+03 OP Charged_particle_power_(excluding_alphas)_(MW)__________________________ (pchargemw)___________________ 1.2659E+00 OP - Total_power_deposited_in_plasma_(MW)____________________________________ (tot_power_plasma)____________ 3.8950E+02 OP + Total_power_deposited_in_plasma_(MW)____________________________________ (p_plasma_heating_total_mw)____________ 3.8950E+02 OP Bremsstrahlung_radiation_power_(MW)_____________________________________ (pbrempv*vol)_________________ 6.5195E+01 OP Line_radiation_power_(MW)_______________________________________________ (plinepv*vol)_________________ 1.4609E+02 OP Synchrotron_radiation_power_(MW)________________________________________ (p_plasma_sync_mw)_________________ 1.5187E+01 OP diff --git a/examples/data/large_tokamak_2_MFILE.DAT b/examples/data/large_tokamak_2_MFILE.DAT index b6ae7f6f3e..2bd708d87d 100644 --- a/examples/data/large_tokamak_2_MFILE.DAT +++ b/examples/data/large_tokamak_2_MFILE.DAT @@ -424,7 +424,7 @@ Alpha_power:_beam-plasma_(MW)___________________________________________ (palpnb)______________________ 0.0000E+00 OP Neutron_power_(MW)______________________________________________________ (pneutmw)_____________________ 1.2953E+03 OP Charged_particle_power_(excluding_alphas)_(MW)__________________________ (pchargemw)___________________ 1.2659E+00 OP - Total_power_deposited_in_plasma_(MW)____________________________________ (tot_power_plasma)____________ 3.8950E+02 OP + Total_power_deposited_in_plasma_(MW)____________________________________ (p_plasma_heating_total_mw)____________ 3.8950E+02 OP Bremsstrahlung_radiation_power_(MW)_____________________________________ (pbrempv*vol)_________________ 6.5195E+01 OP Line_radiation_power_(MW)_______________________________________________ (plinepv*vol)_________________ 1.4609E+02 OP Synchrotron_radiation_power_(MW)________________________________________ (p_plasma_sync_mw)_________________ 1.5187E+01 OP diff --git a/examples/data/large_tokamak_3_MFILE.DAT b/examples/data/large_tokamak_3_MFILE.DAT index b81bb942f6..369c048b49 100644 --- a/examples/data/large_tokamak_3_MFILE.DAT +++ b/examples/data/large_tokamak_3_MFILE.DAT @@ -424,7 +424,7 @@ Alpha_power:_beam-plasma_(MW)___________________________________________ (palpnb)______________________ 0.0000E+00 OP Neutron_power_(MW)______________________________________________________ (pneutmw)_____________________ 1.2953E+03 OP Charged_particle_power_(excluding_alphas)_(MW)__________________________ (pchargemw)___________________ 1.2659E+00 OP - Total_power_deposited_in_plasma_(MW)____________________________________ (tot_power_plasma)____________ 3.8950E+02 OP + Total_power_deposited_in_plasma_(MW)____________________________________ (p_plasma_heating_total_mw)____________ 3.8950E+02 OP Bremsstrahlung_radiation_power_(MW)_____________________________________ (pbrempv*vol)_________________ 6.5195E+01 OP Line_radiation_power_(MW)_______________________________________________ (plinepv*vol)_________________ 1.4609E+02 OP Synchrotron_radiation_power_(MW)________________________________________ (p_plasma_sync_mw)_________________ 1.5187E+01 OP diff --git a/examples/data/large_tokamak_4_MFILE.DAT b/examples/data/large_tokamak_4_MFILE.DAT index 933600628d..b5a95e9d8a 100644 --- a/examples/data/large_tokamak_4_MFILE.DAT +++ b/examples/data/large_tokamak_4_MFILE.DAT @@ -424,7 +424,7 @@ Alpha_power:_beam-plasma_(MW)___________________________________________ (palpnb)______________________ 0.0000E+00 OP Neutron_power_(MW)______________________________________________________ (pneutmw)_____________________ 1.2953E+03 OP Charged_particle_power_(excluding_alphas)_(MW)__________________________ (pchargemw)___________________ 1.2659E+00 OP - Total_power_deposited_in_plasma_(MW)____________________________________ (tot_power_plasma)____________ 3.8950E+02 OP + Total_power_deposited_in_plasma_(MW)____________________________________ (p_plasma_heating_total_mw)____________ 3.8950E+02 OP Bremsstrahlung_radiation_power_(MW)_____________________________________ (pbrempv*vol)_________________ 6.5195E+01 OP Line_radiation_power_(MW)_______________________________________________ (plinepv*vol)_________________ 1.4609E+02 OP Synchrotron_radiation_power_(MW)________________________________________ (p_plasma_sync_mw)_________________ 1.5187E+01 OP diff --git a/examples/data/large_tokamak_nof_2_MFILE.DAT b/examples/data/large_tokamak_nof_2_MFILE.DAT index 0bca73e3f1..00894cf1b9 100644 --- a/examples/data/large_tokamak_nof_2_MFILE.DAT +++ b/examples/data/large_tokamak_nof_2_MFILE.DAT @@ -311,7 +311,7 @@ Neutron_power:_beam-plasma_(MW)__________________________________________ (p_beam_neutron_mw)__________ 0.00000000000000000e+00 OP Charged_particle_power_(excluding_alphas)_(MW)___________________________ (p_non_alpha_charged_mw)______ 1.20650459189592762e+00 OP Total_charged_particle_power_(including_alphas)_(MW)_____________________ (p_charged_particle_mw)_______ 3.24864461111113485e+02 OP - Total_power_deposited_in_plasma_(MW)_____________________________________ (tot_power_plasma)_____________ 3.86898310614849436e+02 OP + Total_power_deposited_in_plasma_(MW)_____________________________________ (p_plasma_heating_total_mw)_____________ 3.86898310614849436e+02 OP Synchrotron_radiation_power_(MW)_________________________________________ (pden_plasma_sync_mw*vol_plasma)_ 1.51830269530638411e+01 OP Synchrotron_wall_reflectivity_factor_____________________________________ (f_sync_reflect)_______________ 6.00000000000000089e-01 Normalised_minor_radius_defining_'core'__________________________________ (coreradius)___________________ 7.50000000000000111e-01 diff --git a/examples/data/large_tokamak_nof_MFILE.DAT b/examples/data/large_tokamak_nof_MFILE.DAT index 7aab684e7b..781ba11ef1 100644 --- a/examples/data/large_tokamak_nof_MFILE.DAT +++ b/examples/data/large_tokamak_nof_MFILE.DAT @@ -384,7 +384,7 @@ Neutron_power:_beam-plasma_(MW)__________________________________________ (p_beam_neutron_mw)__________ 0.00000000000000000e+00 OP Charged_particle_power_(excluding_alphas)_(MW)___________________________ (p_non_alpha_charged_mw)______ 1.34669877478527300e+00 OP Total_charged_particle_power_(including_alphas)_(MW)_____________________ (p_charged_particle_mw)_______ 3.51889598375332753e+02 OP - Total_power_deposited_in_plasma_(MW)_____________________________________ (tot_power_plasma)_____________ 4.40026498969293129e+02 OP + Total_power_deposited_in_plasma_(MW)_____________________________________ (p_plasma_heating_total_mw)_____________ 4.40026498969293129e+02 OP Synchrotron_radiation_power_(MW)_________________________________________ (pden_plasma_sync_mw*vol_plasma)_ 1.45588444219885051e+01 OP Synchrotron_wall_reflectivity_factor_____________________________________ (f_sync_reflect)_______________ 6.00000000000000089e-01 Normalised_minor_radius_defining_'core'__________________________________ (coreradius)___________________ 7.50000000000000111e-01 diff --git a/process/dcll.py b/process/dcll.py index 7374efaf81..722dffa64b 100644 --- a/process/dcll.py +++ b/process/dcll.py @@ -148,10 +148,7 @@ def dcll_neutronics_and_power(self, output: bool): # Energy multiplication energy (MW) fwbs_variables.emultmw = ( - ( - physics_variables.p_neutron_total_mw - * fwbs_variables.pnuc_blkt_ratio_dcll - ) + (physics_variables.p_neutron_total_mw * fwbs_variables.pnuc_blkt_ratio_dcll) * (fwbs_variables.emult - 1) * covf ) diff --git a/process/fusion_reactions.py b/process/fusion_reactions.py index bc48513f85..4535301703 100644 --- a/process/fusion_reactions.py +++ b/process/fusion_reactions.py @@ -726,9 +726,7 @@ def set_fusion_powers( p_plasma_alpha_mw = pden_plasma_alpha_mw * vol_plasma # Add neutral beam alpha power / volume - pden_alpha_total_mw = pden_plasma_alpha_mw + ( - p_beam_alpha_mw / vol_plasma - ) + pden_alpha_total_mw = pden_plasma_alpha_mw + (p_beam_alpha_mw / vol_plasma) # Total alpha power p_alpha_total_mw = pden_alpha_total_mw * vol_plasma @@ -762,9 +760,7 @@ def set_fusion_powers( p_charged_particle_mw = p_alpha_total_mw + p_non_alpha_charged_mw # Total fusion power - p_fusion_total_mw = ( - p_alpha_total_mw + p_neutron_total_mw + p_non_alpha_charged_mw - ) + p_fusion_total_mw = p_alpha_total_mw + p_neutron_total_mw + p_non_alpha_charged_mw # Alpha power to electrons and ions (used with electron # and ion power balance equations only) @@ -911,9 +907,7 @@ def beam_fusion( ) # Neutral beam alpha power - p_beam_alpha_mw = beamfus0 * ( - deuterium_beam_alpha_power + tritium_beam_alpha_power - ) + p_beam_alpha_mw = beamfus0 * (deuterium_beam_alpha_power + tritium_beam_alpha_power) # Neutral beam beta beta_beam = ( diff --git a/process/hcpb.py b/process/hcpb.py index 49849b9ae5..fe1afa6e74 100644 --- a/process/hcpb.py +++ b/process/hcpb.py @@ -186,8 +186,7 @@ def run(self, output: bool): # Power deposited in the CP fwbs_variables.pnuc_cp_sh = ( - f_geom_cp * physics_variables.p_neutron_total_mw - - fwbs_variables.pnuc_cp_tf + f_geom_cp * physics_variables.p_neutron_total_mw - fwbs_variables.pnuc_cp_tf ) # Old code kept for backward compatibility diff --git a/process/io/sankey_funcs.py b/process/io/sankey_funcs.py index 7fcef3e0d2..0addb2a624 100644 --- a/process/io/sankey_funcs.py +++ b/process/io/sankey_funcs.py @@ -44,9 +44,7 @@ def plot_full_sankey( pcharohmmw = ( p_non_alpha_charged_mw + p_plasma_ohmic_mw ) # The ohmic and charged particle power (MW) - p_alpha_total_mw = m_file.data["p_alpha_total_mw"].get_scan( - -1 - ) # Alpha power (MW) + p_alpha_total_mw = m_file.data["p_alpha_total_mw"].get_scan(-1) # Alpha power (MW) palpinjmw = ( p_alpha_total_mw + p_hcd_injected_total_mw ) # Alpha particle and HC&D power (MW) @@ -570,9 +568,7 @@ def plot_sankey(mfilename="MFILE.DAT"): # Plot simplified power flow Sankey Dia -1 ) # nuclear heating in the CP shield (MW) emultmw = m_file.data["emultmw"].get_scan(-1) # Blanket energy multiplication (MW) - p_alpha_total_mw = m_file.data["p_alpha_total_mw"].get_scan( - -1 - ) # Alpha power (MW) + p_alpha_total_mw = m_file.data["p_alpha_total_mw"].get_scan(-1) # Alpha power (MW) f_alpha_plasma = m_file.data["f_alpha_plasma"].get_scan( -1 ) # Fraction of alpha power deposited in plasma diff --git a/process/physics.py b/process/physics.py index 07e90d26f1..cc503dbb86 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2160,12 +2160,8 @@ def physics(self): ) else: # If no beams present then the total alpha rates and power are the same as the plasma values - physics_variables.fusden_total = ( - physics_variables.fusden_plasma - ) - physics_variables.fusden_alpha_total = ( - physics_variables.fusden_plasma_alpha - ) + physics_variables.fusden_total = physics_variables.fusden_plasma + physics_variables.fusden_alpha_total = physics_variables.fusden_plasma_alpha physics_variables.p_dt_total_mw = physics_variables.p_plasma_dt_mw # Create some derived values and add beam contribution to fusion power @@ -4821,7 +4817,7 @@ def outplas(self): physics_variables.p_charged_particle_mw, "OP ", ) - tot_power_plasma = ( + p_plasma_heating_total_mw = ( physics_variables.f_alpha_plasma * physics_variables.p_alpha_total_mw + physics_variables.p_non_alpha_charged_mw + physics_variables.p_plasma_ohmic_mw @@ -4830,8 +4826,8 @@ def outplas(self): po.ovarre( self.outfile, "Total power deposited in plasma (MW)", - "(tot_power_plasma)", - tot_power_plasma, + "(p_plasma_heating_total_mw)", + p_plasma_heating_total_mw, "OP ", ) diff --git a/process/stellarator.py b/process/stellarator.py index 405d04ca7e..a960a87da0 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -4263,12 +4263,8 @@ def stphys(self, output): ) else: # If no beams present then the total alpha rates and power are the same as the plasma values - physics_variables.fusden_total = ( - physics_variables.fusden_plasma - ) - physics_variables.fusden_alpha_total = ( - physics_variables.fusden_plasma_alpha - ) + physics_variables.fusden_total = physics_variables.fusden_plasma + physics_variables.fusden_alpha_total = physics_variables.fusden_plasma_alpha physics_variables.p_dt_total_mw = physics_variables.p_plasma_dt_mw # Create some derived values and add beam contribution to fusion power @@ -4760,8 +4756,7 @@ def calc_neoclassics(self): q_PROCESS = ( ( - physics_variables.f_alpha_plasma - * physics_variables.pden_alpha_total_mw + physics_variables.f_alpha_plasma * physics_variables.pden_alpha_total_mw - physics_variables.pden_plasma_core_rad_mw ) * physics_variables.vol_plasma @@ -4770,8 +4765,7 @@ def calc_neoclassics(self): ) q_PROCESS_r1 = ( ( - physics_variables.f_alpha_plasma - * physics_variables.pden_alpha_total_mw + physics_variables.f_alpha_plasma * physics_variables.pden_alpha_total_mw - physics_variables.pden_plasma_core_rad_mw ) * physics_variables.vol_plasma @@ -4907,8 +4901,7 @@ def st_calc_eff_chi(self): ) nominator = ( - physics_variables.f_alpha_plasma - * physics_variables.pden_alpha_total_mw + physics_variables.f_alpha_plasma * physics_variables.pden_alpha_total_mw - physics_variables.pden_plasma_core_rad_mw ) * volscaling From 693a19ac265bd2ac4c8a4706eb19de97b7fba35b Mon Sep 17 00:00:00 2001 From: mn3981 Date: Fri, 9 May 2025 10:06:10 +0100 Subject: [PATCH 26/37] =?UTF-8?q?=F0=9F=94=84=20Rename=20powfmax=20to=20p?= =?UTF-8?q?=5Ffusion=5Ftotal=5Fmax=5Fmw?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- documentation/proc-pages/development/add-vars.md | 10 +++++----- .../fusion_reactions/plasma_reactions.md | 2 +- examples/data/csv_output_large_tokamak_MFILE.DAT | 2 +- examples/data/large_tokamak_1_MFILE.DAT | 2 +- examples/data/large_tokamak_2_MFILE.DAT | 2 +- examples/data/large_tokamak_3_MFILE.DAT | 2 +- examples/data/large_tokamak_4_MFILE.DAT | 2 +- examples/data/large_tokamak_nof_2_MFILE.DAT | 2 +- examples/data/large_tokamak_nof_MFILE.DAT | 2 +- examples/data/large_tokamak_once_through_IN.DAT | 2 +- process/input.py | 2 +- process/io/plot_radial_build.py | 2 +- process/io/plot_scans.py | 2 +- process/scan.py | 4 ++-- source/fortran/constraint_equations.f90 | 10 +++++----- source/fortran/constraint_variables.f90 | 4 ++-- source/fortran/scan.f90 | 2 +- tests/regression/input_files/large_tokamak.IN.DAT | 2 +- tests/regression/input_files/large_tokamak_nof.IN.DAT | 2 +- .../input_files/large_tokamak_once_through.IN.DAT | 2 +- .../input_files/spherical_tokamak_once_through.IN.DAT | 2 +- tests/regression/input_files/st_regression.IN.DAT | 2 +- .../input_files/stellarator_helias_once_through.IN.DAT | 2 +- 23 files changed, 33 insertions(+), 33 deletions(-) diff --git a/documentation/proc-pages/development/add-vars.md b/documentation/proc-pages/development/add-vars.md index 24a1c6ea1c..7342b1fbde 100644 --- a/documentation/proc-pages/development/add-vars.md +++ b/documentation/proc-pages/development/add-vars.md @@ -242,19 +242,19 @@ Constraint equations are added to *PROCESS* in the following way: !! residual error in physical units; output string; units string !! Equation for fusion power upper limit !! #=# physics - !! #=#=# ffuspow, powfmax + !! #=#=# ffuspow, p_fusion_total_max_mw !! and hence also optional here. !! Logic change during pre-factoring: err, symbol, units will be assigned only if present. !! ffuspow : input real : f-value for maximum fusion power - !! powfmax : input real : maximum fusion power (MW) + !! p_fusion_total_max_mw : input real : maximum fusion power (MW) !! p_fusion_total_mw : input real : fusion power (MW) - use constraint_variables, only: ffuspow, powfmax + use constraint_variables, only: ffuspow, p_fusion_total_max_mw use physics_variables, only: p_fusion_total_mw implicit none type (constraint_args_type), intent(out) :: args - args%cc = 1.0D0 - ffuspow * powfmax/p_fusion_total_mw - args%con = powfmax * (1.0D0 - args%cc) + args%cc = 1.0D0 - ffuspow * p_fusion_total_max_mw/p_fusion_total_mw + args%con = p_fusion_total_max_mw * (1.0D0 - args%cc) args%err = p_fusion_total_mw * args%cc args%symbol = '<' args%units = 'MW' diff --git a/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md b/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md index 0d8744c76a..5f4e302c32 100644 --- a/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md +++ b/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md @@ -224,7 +224,7 @@ If the plasma is classed as ignited then the injected heating power density is n This constraint can be activated by stating `icc = 9` in the input file. -The value of `powfmax` can be set to the desired maximum fusion power. The scaling value `ffuspow` can be varied also. +The value of `p_fusion_total_max_mw` can be set to the desired maximum fusion power. The scaling value `ffuspow` can be varied also. --------------------------------- diff --git a/examples/data/csv_output_large_tokamak_MFILE.DAT b/examples/data/csv_output_large_tokamak_MFILE.DAT index 2b91b53f09..790da28a80 100644 --- a/examples/data/csv_output_large_tokamak_MFILE.DAT +++ b/examples/data/csv_output_large_tokamak_MFILE.DAT @@ -1251,7 +1251,7 @@ walalw = 2.0 icc = 9 ixc = 26 * ffuspow * Maximum allowable value fusion power [MW] -powfmax = 3000 +p_fusion_total_max_mw = 3000 * Burn time lower limit * *-----------------------* diff --git a/examples/data/large_tokamak_1_MFILE.DAT b/examples/data/large_tokamak_1_MFILE.DAT index 3b75a9cc95..922ca82956 100644 --- a/examples/data/large_tokamak_1_MFILE.DAT +++ b/examples/data/large_tokamak_1_MFILE.DAT @@ -1246,7 +1246,7 @@ walalw = 2.0 icc = 9 ixc = 26 * ffuspow * Maximum allowable value fusion power [MW] -powfmax = 3000 +p_fusion_total_max_mw = 3000 * Burn time lower limit * *-----------------------* diff --git a/examples/data/large_tokamak_2_MFILE.DAT b/examples/data/large_tokamak_2_MFILE.DAT index 2bd708d87d..bb58a270e3 100644 --- a/examples/data/large_tokamak_2_MFILE.DAT +++ b/examples/data/large_tokamak_2_MFILE.DAT @@ -1246,7 +1246,7 @@ walalw = 2.0 icc = 9 ixc = 26 * ffuspow * Maximum allowable value fusion power [MW] -powfmax = 3000 +p_fusion_total_max_mw = 3000 * Burn time lower limit * *-----------------------* diff --git a/examples/data/large_tokamak_3_MFILE.DAT b/examples/data/large_tokamak_3_MFILE.DAT index 369c048b49..60058a6956 100644 --- a/examples/data/large_tokamak_3_MFILE.DAT +++ b/examples/data/large_tokamak_3_MFILE.DAT @@ -1246,7 +1246,7 @@ walalw = 2.0 icc = 9 ixc = 26 * ffuspow * Maximum allowable value fusion power [MW] -powfmax = 3000 +p_fusion_total_max_mw = 3000 * Burn time lower limit * *-----------------------* diff --git a/examples/data/large_tokamak_4_MFILE.DAT b/examples/data/large_tokamak_4_MFILE.DAT index b5a95e9d8a..663c58eef9 100644 --- a/examples/data/large_tokamak_4_MFILE.DAT +++ b/examples/data/large_tokamak_4_MFILE.DAT @@ -1246,7 +1246,7 @@ walalw = 2.0 icc = 9 ixc = 26 * ffuspow * Maximum allowable value fusion power [MW] -powfmax = 3000 +p_fusion_total_max_mw = 3000 * Burn time lower limit * *-----------------------* diff --git a/examples/data/large_tokamak_nof_2_MFILE.DAT b/examples/data/large_tokamak_nof_2_MFILE.DAT index 00894cf1b9..b10765c8cd 100644 --- a/examples/data/large_tokamak_nof_2_MFILE.DAT +++ b/examples/data/large_tokamak_nof_2_MFILE.DAT @@ -1283,7 +1283,7 @@ fmaxvvstress = 1.0 * f-value for maximum permitted stress of the VV fvdump = 1.0 * f-value for dump voltage (`constraint equation 34`; `iteration variable 51`) fwalld = 1.0 * f-value for maximum wall load (`constraint equation 8`; `iteration variable 14`) pnetelin = 400.0 * required net electric power (MW) (`constraint equation 16`) -powfmax = 3000 * maximum fusion power (MW) (`constraint equation 9`) +p_fusion_total_max_mw = 3000 * maximum fusion power (MW) (`constraint equation 9`) psepbqarmax = 10.0 * maximum ratio of Psep*Bt/qAR (MWT/m) (`constraint equation 68`) t_burn_min = 7200.0 * minimum burn time (s) (KE - no longer itv;; see issue #706) walalw = 2.0 * allowable neutron wall-load (MW/m2) (`constraint equation 8`) diff --git a/examples/data/large_tokamak_nof_MFILE.DAT b/examples/data/large_tokamak_nof_MFILE.DAT index 781ba11ef1..8d053a0cb3 100644 --- a/examples/data/large_tokamak_nof_MFILE.DAT +++ b/examples/data/large_tokamak_nof_MFILE.DAT @@ -1384,7 +1384,7 @@ walalw = 2.0 *--------------------------* icc = 9 * Maximum allowable value fusion power [MW] -powfmax = 3000 +p_fusion_total_max_mw = 3000 * Burn time lower limit * *-----------------------* diff --git a/examples/data/large_tokamak_once_through_IN.DAT b/examples/data/large_tokamak_once_through_IN.DAT index 64eed66a4a..8add9ef7c5 100644 --- a/examples/data/large_tokamak_once_through_IN.DAT +++ b/examples/data/large_tokamak_once_through_IN.DAT @@ -139,7 +139,7 @@ fmaxvvstress = 1.0 * f-value for maximum permitted stress of the VV fvdump = 1.0 * f-value for dump voltage (`constraint equation 34`; `iteration variable 51`) fwalld = 1.0 * f-value for maximum wall load (`constraint equation 8`; `iteration variable 14`) pnetelin = 400.0 * required net electric power (MW) (`constraint equation 16`) -powfmax = 3000 * maximum fusion power (MW) (`constraint equation 9`) +p_fusion_total_max_mw = 3000 * maximum fusion power (MW) (`constraint equation 9`) psepbqarmax = 10.0 * maximum ratio of Psep*Bt/qAR (MWT/m) (`constraint equation 68`) t_burn_min = 7200.0 * minimum burn time (s) (KE - no longer itv;; see issue #706) walalw = 2.0 * allowable neutron wall-load (MW/m2) (`constraint equation 8`) diff --git a/process/input.py b/process/input.py index 65b289dbc5..6f951fbc60 100644 --- a/process/input.py +++ b/process/input.py @@ -1016,7 +1016,7 @@ def __post_init__(self): "poisson_al": InputVariable(fortran.tfcoil_variables, float, range=(0.0, 1.0)), "poisson_copper": InputVariable(fortran.tfcoil_variables, float, range=(0.0, 1.0)), "poisson_steel": InputVariable(fortran.tfcoil_variables, float, range=(0.0, 1.0)), - "powfmax": InputVariable(fortran.constraint_variables, float, range=(1.0, 10000.0)), + "p_fusion_total_max_mw": InputVariable(fortran.constraint_variables, float, range=(1.0, 10000.0)), "prdiv": InputVariable(fortran.vacuum_variables, float, range=(0.0, 10.0)), "pres_fw_coolant": InputVariable( fortran.fwbs_variables, float, range=(100000.0, 100000000.0) diff --git a/process/io/plot_radial_build.py b/process/io/plot_radial_build.py index 9550dc1f32..fb04b8c480 100644 --- a/process/io/plot_radial_build.py +++ b/process/io/plot_radial_build.py @@ -171,7 +171,7 @@ def main(args=None): "", "cfactr", "boundu(72)", - "powfmax", + "p_fusion_total_max_mw", "kappa", "triang", "tbrmin", diff --git a/process/io/plot_scans.py b/process/io/plot_scans.py index 890b73b871..38cb6837a4 100644 --- a/process/io/plot_scans.py +++ b/process/io/plot_scans.py @@ -313,7 +313,7 @@ def main(args=None): 21: "", 22: "cfactr", 23: "boundu(72)", - 24: "powfmax", + 24: "p_fusion_total_max_mw", 25: "kappa", 26: "triang", 27: "tbrmin", diff --git a/process/scan.py b/process/scan.py index 7f85c67681..b078510a0a 100644 --- a/process/scan.py +++ b/process/scan.py @@ -66,7 +66,7 @@ def __iter__(self): 20: ScanVariable("t_burn_min", "Minimum_burn_time_(s)"), 22: ScanVariable("cfactr", "Plant_availability_factor"), 23: ScanVariable("boundu(72)", "Ip/Irod_upper_bound"), - 24: ScanVariable("powfmax", "Fusion_power_limit_(MW)"), + 24: ScanVariable("p_fusion_total_max_mw", "Fusion_power_limit_(MW)"), 25: ScanVariable("kappa", "Plasma_elongation"), 26: ScanVariable("triang", "Plasma_triangularity"), 27: ScanVariable("tbrmin", "Min_tritium_breed._ratio"), @@ -926,7 +926,7 @@ def scan_select(self, nwp, swp, iscn): case 23: numerics.boundu[71] = swp[iscn - 1] case 24: - constraint_variables.powfmax = swp[iscn - 1] + constraint_variables.p_fusion_total_max_mw = swp[iscn - 1] case 25: physics_variables.kappa = swp[iscn - 1] case 26: diff --git a/source/fortran/constraint_equations.f90 b/source/fortran/constraint_equations.f90 index 714391900a..a4918980f3 100755 --- a/source/fortran/constraint_equations.f90 +++ b/source/fortran/constraint_equations.f90 @@ -775,13 +775,13 @@ subroutine constraint_eqn_009(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units) !! residual error in physical units; output string; units string !! Equation for fusion power upper limit !! #=# physics - !! #=#=# ffuspow, powfmax + !! #=#=# ffuspow, p_fusion_total_max_mw !! and hence also optional here. !! Logic change during pre-factoring: err, symbol, units will be assigned only if present. !! ffuspow : input real : f-value for maximum fusion power - !! powfmax : input real : maximum fusion power (MW) + !! p_fusion_total_max_mw : input real : maximum fusion power (MW) !! p_fusion_total_mw : input real : fusion power (MW) - use constraint_variables, only: ffuspow, powfmax + use constraint_variables, only: ffuspow, p_fusion_total_max_mw use physics_variables, only: p_fusion_total_mw implicit none real(dp), intent(out) :: tmp_cc @@ -790,8 +790,8 @@ subroutine constraint_eqn_009(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units) character(len=1), intent(out) :: tmp_symbol character(len=10), intent(out) :: tmp_units - tmp_cc = p_fusion_total_mw/powfmax - 1.0D0 * ffuspow - tmp_con = powfmax * (1.0D0 - tmp_cc) + tmp_cc = p_fusion_total_mw/p_fusion_total_max_mw - 1.0D0 * ffuspow + tmp_con = p_fusion_total_max_mw * (1.0D0 - tmp_cc) tmp_err = p_fusion_total_mw * tmp_cc tmp_symbol = '<' tmp_units = 'MW' diff --git a/source/fortran/constraint_variables.f90 b/source/fortran/constraint_variables.f90 index 6320d9d4d8..4f564b8c56 100644 --- a/source/fortran/constraint_variables.f90 +++ b/source/fortran/constraint_variables.f90 @@ -252,7 +252,7 @@ module constraint_variables real(dp) :: pnetelin !! required net electric power (MW) (`constraint equation 16`) - real(dp) :: powfmax + real(dp) :: p_fusion_total_max_mw !! maximum fusion power (MW) (`constraint equation 9`) real(dp) :: psepbqarmax @@ -386,7 +386,7 @@ subroutine init_constraint_variables f_fw_rad_max = 3.33D0 pflux_fw_rad_max_mw = 0.0D0 pnetelin = 1.0D3 - powfmax = 1.5D3 + p_fusion_total_max_mw = 1.5D3 psepbqarmax = 9.5D0 pseprmax = 25.0D0 ptfnucmax = 1.0D-3 diff --git a/source/fortran/scan.f90 b/source/fortran/scan.f90 index 02cc5ed29a..eb9168df19 100644 --- a/source/fortran/scan.f90 +++ b/source/fortran/scan.f90 @@ -60,7 +60,7 @@ module scan_module !!
  • 21 not used !!
  • 22 cfactr (N.B. requires iavail=0) !!
  • 23 boundu(72: fipir) - !!
  • 24 powfmax + !!
  • 24 p_fusion_total_max_mw !!
  • 25 kappa !!
  • 26 triang !!
  • 27 tbrmin (for blktmodel > 0 only) diff --git a/tests/regression/input_files/large_tokamak.IN.DAT b/tests/regression/input_files/large_tokamak.IN.DAT index 062a89027c..3541f7ed75 100644 --- a/tests/regression/input_files/large_tokamak.IN.DAT +++ b/tests/regression/input_files/large_tokamak.IN.DAT @@ -58,7 +58,7 @@ walalw = 2.0 icc = 9 ixc = 26 * ffuspow * Maximum allowable value fusion power [MW] -powfmax = 3000 +p_fusion_total_max_mw = 3000 * Burn time lower limit * *-----------------------* diff --git a/tests/regression/input_files/large_tokamak_nof.IN.DAT b/tests/regression/input_files/large_tokamak_nof.IN.DAT index 854ca5a3c1..76cecc8de5 100644 --- a/tests/regression/input_files/large_tokamak_nof.IN.DAT +++ b/tests/regression/input_files/large_tokamak_nof.IN.DAT @@ -166,7 +166,7 @@ walalw = 2.0 *--------------------------* icc = 9 * Maximum allowable value fusion power [MW] -powfmax = 3000 +p_fusion_total_max_mw = 3000 * Burn time lower limit * *-----------------------* diff --git a/tests/regression/input_files/large_tokamak_once_through.IN.DAT b/tests/regression/input_files/large_tokamak_once_through.IN.DAT index 9e27f8946f..2c7279b5c5 100644 --- a/tests/regression/input_files/large_tokamak_once_through.IN.DAT +++ b/tests/regression/input_files/large_tokamak_once_through.IN.DAT @@ -139,7 +139,7 @@ fmaxvvstress = 1.0 * f-value for maximum permitted stress of the VV fvdump = 1.0 * f-value for dump voltage (`constraint equation 34`; `iteration variable 51`) fwalld = 1.0 * f-value for maximum wall load (`constraint equation 8`; `iteration variable 14`) pnetelin = 400.0 * required net electric power (MW) (`constraint equation 16`) -powfmax = 3000 * maximum fusion power (MW) (`constraint equation 9`) +p_fusion_total_max_mw = 3000 * maximum fusion power (MW) (`constraint equation 9`) psepbqarmax = 10.0 * maximum ratio of Psep*Bt/qAR (MWT/m) (`constraint equation 68`) t_burn_min = 7200.0 * minimum burn time (s) (KE - no longer itv;; see issue #706) walalw = 2.0 * allowable neutron wall-load (MW/m2) (`constraint equation 8`) diff --git a/tests/regression/input_files/spherical_tokamak_once_through.IN.DAT b/tests/regression/input_files/spherical_tokamak_once_through.IN.DAT index 2553d610d5..462a0f5511 100644 --- a/tests/regression/input_files/spherical_tokamak_once_through.IN.DAT +++ b/tests/regression/input_files/spherical_tokamak_once_through.IN.DAT @@ -172,7 +172,7 @@ fstrcase = 0.47408648750854704 * f-value for maximum TF coil case Tresca yield c fstrcond = 0.4359431939504875 * f-value for maxiumum TF coil conduit Tresca yield criterion pflux_fw_rad_max = 1.2 * Maximum permitted radiation wall load (MW/m^2) (`constraint equation 67`) f_fw_rad_max = 1.0 * peaking factor for radiation wall load (`constraint equation 67`) -powfmax = 2500.0 * maximum fusion power (MW) (`constraint equation 9`) +p_fusion_total_max_mw = 2500.0 * maximum fusion power (MW) (`constraint equation 9`) pseprmax = 40.0 * maximum ratio of power crossing the separatrix to plasma major radius (Psep/R) (MW/m) f_alpha_energy_confinement_min = 5.0 * Lower limit on taup/taueff the ratio of alpha particle to energy confinement falpha_energy_confinement = 1.0 * f-value for lower limit on taup/taueff the ratio of alpha particle to energy diff --git a/tests/regression/input_files/st_regression.IN.DAT b/tests/regression/input_files/st_regression.IN.DAT index 226791d350..18cc12cd96 100644 --- a/tests/regression/input_files/st_regression.IN.DAT +++ b/tests/regression/input_files/st_regression.IN.DAT @@ -111,7 +111,7 @@ ffuspow = 1.0 * DESCRIPTION: f-value for Maximum Fusion Power * JUSTIFICATION: Used with icc=9 to enforce Fusion Power limit -powfmax = 2500.0 +p_fusion_total_max_mw = 2500.0 * DESCRIPTION: Maximum fusion power (MW) (icc=9) * JUSTIFICATION: diff --git a/tests/regression/input_files/stellarator_helias_once_through.IN.DAT b/tests/regression/input_files/stellarator_helias_once_through.IN.DAT index 424e73c74e..a2ac891bd9 100644 --- a/tests/regression/input_files/stellarator_helias_once_through.IN.DAT +++ b/tests/regression/input_files/stellarator_helias_once_through.IN.DAT @@ -118,7 +118,7 @@ fradpwr = 1 * f-value for core radiation power limit (`constraint equation 17`; fradwall = 1.0 * f-value for upper limit on radiation wall load (`constr; equ; 67`; `iteration variable 116`) pflux_fw_rad_max = 1 * Maximum permitted radiation wall load (MW/m^2) (`constraint equation 67`) pnetelin = 1000 * required net electric power (MW) (`constraint equation 16`) -powfmax = 500. * maximum fusion power (MW) (`constraint equation 9`) +p_fusion_total_max_mw = 500. * maximum fusion power (MW) (`constraint equation 9`) walalw = 1.0 * allowable neutron wall-load (MW/m2) (`constraint equation 8`) f_alpha_energy_confinement_min = 6 * Lower limit on taup/taueff the ratio of alpha particle to energy confinement falpha_energy_confinement = 1. * f-value for lower limit on taup/taueff the ratio of alpha particle to energy From 1dc2706d3fe2030f4070bd3495554288ccc08804 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Fri, 9 May 2025 10:06:50 +0100 Subject: [PATCH 27/37] =?UTF-8?q?=F0=9F=94=84=20Rename=20=20ffuspow=20to?= =?UTF-8?q?=20fp=5Ffusion=5Ftotal=5Fmax=5Fmw?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../proc-pages/development/add-vars.md | 8 ++-- .../fusion_reactions/plasma_reactions.md | 2 +- .../data/csv_output_large_tokamak_MFILE.DAT | 2 +- examples/data/large_tokamak_1_MFILE.DAT | 2 +- examples/data/large_tokamak_2_MFILE.DAT | 2 +- examples/data/large_tokamak_3_MFILE.DAT | 2 +- examples/data/large_tokamak_4_MFILE.DAT | 2 +- examples/plot_solutions.ipynb | 40 +++++++++---------- process/input.py | 2 +- process/iteration_variables.py | 2 +- source/fortran/constraint_equations.f90 | 8 ++-- source/fortran/constraint_variables.f90 | 4 +- source/fortran/numerics.f90 | 2 +- .../input_files/large_tokamak.IN.DAT | 2 +- .../spherical_tokamak_once_through.IN.DAT | 2 +- .../input_files/st_regression.IN.DAT | 2 +- .../stellarator_helias_once_through.IN.DAT | 2 +- 17 files changed, 43 insertions(+), 43 deletions(-) diff --git a/documentation/proc-pages/development/add-vars.md b/documentation/proc-pages/development/add-vars.md index 7342b1fbde..12852133c6 100644 --- a/documentation/proc-pages/development/add-vars.md +++ b/documentation/proc-pages/development/add-vars.md @@ -242,18 +242,18 @@ Constraint equations are added to *PROCESS* in the following way: !! residual error in physical units; output string; units string !! Equation for fusion power upper limit !! #=# physics - !! #=#=# ffuspow, p_fusion_total_max_mw + !! #=#=# fp_fusion_total_max_mw, p_fusion_total_max_mw !! and hence also optional here. !! Logic change during pre-factoring: err, symbol, units will be assigned only if present. - !! ffuspow : input real : f-value for maximum fusion power + !! fp_fusion_total_max_mw : input real : f-value for maximum fusion power !! p_fusion_total_max_mw : input real : maximum fusion power (MW) !! p_fusion_total_mw : input real : fusion power (MW) - use constraint_variables, only: ffuspow, p_fusion_total_max_mw + use constraint_variables, only: fp_fusion_total_max_mw, p_fusion_total_max_mw use physics_variables, only: p_fusion_total_mw implicit none type (constraint_args_type), intent(out) :: args - args%cc = 1.0D0 - ffuspow * p_fusion_total_max_mw/p_fusion_total_mw + args%cc = 1.0D0 - fp_fusion_total_max_mw * p_fusion_total_max_mw/p_fusion_total_mw args%con = p_fusion_total_max_mw * (1.0D0 - args%cc) args%err = p_fusion_total_mw * args%cc args%symbol = '<' diff --git a/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md b/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md index 5f4e302c32..8d919e3b76 100644 --- a/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md +++ b/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md @@ -224,7 +224,7 @@ If the plasma is classed as ignited then the injected heating power density is n This constraint can be activated by stating `icc = 9` in the input file. -The value of `p_fusion_total_max_mw` can be set to the desired maximum fusion power. The scaling value `ffuspow` can be varied also. +The value of `p_fusion_total_max_mw` can be set to the desired maximum fusion power. The scaling value `fp_fusion_total_max_mw` can be varied also. --------------------------------- diff --git a/examples/data/csv_output_large_tokamak_MFILE.DAT b/examples/data/csv_output_large_tokamak_MFILE.DAT index 790da28a80..aea567557f 100644 --- a/examples/data/csv_output_large_tokamak_MFILE.DAT +++ b/examples/data/csv_output_large_tokamak_MFILE.DAT @@ -1249,7 +1249,7 @@ walalw = 2.0 *--------------------------* icc = 9 -ixc = 26 * ffuspow +ixc = 26 * fp_fusion_total_max_mw * Maximum allowable value fusion power [MW] p_fusion_total_max_mw = 3000 diff --git a/examples/data/large_tokamak_1_MFILE.DAT b/examples/data/large_tokamak_1_MFILE.DAT index 922ca82956..5ac073d224 100644 --- a/examples/data/large_tokamak_1_MFILE.DAT +++ b/examples/data/large_tokamak_1_MFILE.DAT @@ -1244,7 +1244,7 @@ walalw = 2.0 *--------------------------* icc = 9 -ixc = 26 * ffuspow +ixc = 26 * fp_fusion_total_max_mw * Maximum allowable value fusion power [MW] p_fusion_total_max_mw = 3000 diff --git a/examples/data/large_tokamak_2_MFILE.DAT b/examples/data/large_tokamak_2_MFILE.DAT index bb58a270e3..48475661d2 100644 --- a/examples/data/large_tokamak_2_MFILE.DAT +++ b/examples/data/large_tokamak_2_MFILE.DAT @@ -1244,7 +1244,7 @@ walalw = 2.0 *--------------------------* icc = 9 -ixc = 26 * ffuspow +ixc = 26 * fp_fusion_total_max_mw * Maximum allowable value fusion power [MW] p_fusion_total_max_mw = 3000 diff --git a/examples/data/large_tokamak_3_MFILE.DAT b/examples/data/large_tokamak_3_MFILE.DAT index 60058a6956..a1ef7c6c23 100644 --- a/examples/data/large_tokamak_3_MFILE.DAT +++ b/examples/data/large_tokamak_3_MFILE.DAT @@ -1244,7 +1244,7 @@ walalw = 2.0 *--------------------------* icc = 9 -ixc = 26 * ffuspow +ixc = 26 * fp_fusion_total_max_mw * Maximum allowable value fusion power [MW] p_fusion_total_max_mw = 3000 diff --git a/examples/data/large_tokamak_4_MFILE.DAT b/examples/data/large_tokamak_4_MFILE.DAT index 663c58eef9..4b50ad0a6a 100644 --- a/examples/data/large_tokamak_4_MFILE.DAT +++ b/examples/data/large_tokamak_4_MFILE.DAT @@ -1244,7 +1244,7 @@ walalw = 2.0 *--------------------------* icc = 9 -ixc = 26 * ffuspow +ixc = 26 * fp_fusion_total_max_mw * Maximum allowable value fusion power [MW] p_fusion_total_max_mw = 3000 diff --git a/examples/plot_solutions.ipynb b/examples/plot_solutions.ipynb index d67085860e..23ba2c293e 100644 --- a/examples/plot_solutions.ipynb +++ b/examples/plot_solutions.ipynb @@ -546,7 +546,7 @@ "1.0756", "fwalld", "0.50758", - "ffuspow", + "fp_fusion_total_max_mw", "0.54006", "ftburn", "0.9994", @@ -1264,7 +1264,7 @@ "1.0756", "fwalld", "0.50758", - "ffuspow", + "fp_fusion_total_max_mw", "0.54006", "ftburn", "0.9994", @@ -1361,7 +1361,7 @@ "1.0756", "fwalld", "0.51758", - "ffuspow", + "fp_fusion_total_max_mw", "0.54006", "ftburn", "0.9994", @@ -2114,7 +2114,7 @@ "1.0756", "fwalld", "0.50758", - "ffuspow", + "fp_fusion_total_max_mw", "0.54006", "ftburn", "0.9994", @@ -2211,7 +2211,7 @@ "1.0756", "fwalld", "0.51758", - "ffuspow", + "fp_fusion_total_max_mw", "0.54006", "ftburn", "0.9994", @@ -2960,7 +2960,7 @@ "1.0756", "fwalld", "0.50758", - "ffuspow", + "fp_fusion_total_max_mw", "0.54006", "ftburn", "0.9994", @@ -3057,7 +3057,7 @@ "1.0756", "fwalld", "0.51758", - "ffuspow", + "fp_fusion_total_max_mw", "0.54006", "ftburn", "0.9994", @@ -3154,7 +3154,7 @@ "1.0756", "fwalld", "0.50758", - "ffuspow", + "fp_fusion_total_max_mw", "0.54006", "ftburn", "0.9794", @@ -3936,7 +3936,7 @@ "1.0756", "fwalld", "0.50758", - "ffuspow", + "fp_fusion_total_max_mw", "0.54006", "ftburn", "0.9994", @@ -4033,7 +4033,7 @@ "1.0756", "fwalld", "0.51758", - "ffuspow", + "fp_fusion_total_max_mw", "0.54006", "ftburn", "0.9994", @@ -4130,7 +4130,7 @@ "1.0756", "fwalld", "0.50758", - "ffuspow", + "fp_fusion_total_max_mw", "0.54006", "ftburn", "0.9794", @@ -4227,7 +4227,7 @@ "1.0756", "fwalld", "0.50758", - "ffuspow", + "fp_fusion_total_max_mw", "0.55006", "ftburn", "0.9794", @@ -5031,7 +5031,7 @@ "0.071381", "fwalld", "0.50709", - "ffuspow", + "fp_fusion_total_max_mw", "0.5396", "ftburn", "0.9994", @@ -5128,7 +5128,7 @@ "0.071381", "fwalld", "0.70709", - "ffuspow", + "fp_fusion_total_max_mw", "0.5396", "ftburn", "0.7994", @@ -5225,7 +5225,7 @@ "0.071381", "fwalld", "0.50709", - "ffuspow", + "fp_fusion_total_max_mw", "0.5396", "ftburn", "0.5994", @@ -5322,7 +5322,7 @@ "0.071381", "fwalld", "0.40709", - "ffuspow", + "fp_fusion_total_max_mw", "0.5396", "ftburn", "0.9994", @@ -6123,7 +6123,7 @@ "8.0667e+19", "fwalld", "0.50758", - "ffuspow", + "fp_fusion_total_max_mw", "0.54006", "ftburn", "0.9994", @@ -6220,7 +6220,7 @@ "8.0567e+19", "fwalld", "0.50258", - "ffuspow", + "fp_fusion_total_max_mw", "0.56006", "ftburn", "0.9894", @@ -6317,7 +6317,7 @@ "8.0667e+19", "fwalld", "0.50758", - "ffuspow", + "fp_fusion_total_max_mw", "0.54006", "ftburn", "0.9994", @@ -6414,7 +6414,7 @@ "8.3667e+19", "fwalld", "0.55758", - "ffuspow", + "fp_fusion_total_max_mw", "0.57006", "ftburn", "0.9294", diff --git a/process/input.py b/process/input.py index 6f951fbc60..59e927b195 100644 --- a/process/input.py +++ b/process/input.py @@ -603,7 +603,7 @@ def __post_init__(self): ), "feffcd": InputVariable(fortran.current_drive_variables, float, range=(0.0, 20.0)), "fflutf": InputVariable(fortran.constraint_variables, float, range=(0.001, 10.0)), - "ffuspow": InputVariable(fortran.constraint_variables, float, range=(0.001, 10.0)), + "fp_fusion_total_max_mw": InputVariable(fortran.constraint_variables, float, range=(0.001, 10.0)), "fgamcd": InputVariable(fortran.constraint_variables, float, range=(0.001, 10.0)), "f_a_fw_hcd": InputVariable(fortran.fwbs_variables, float, range=(0.0, 1.0)), "fpflux_div_heat_load_mw": InputVariable( diff --git a/process/iteration_variables.py b/process/iteration_variables.py index 411dd6efda..726398dad0 100644 --- a/process/iteration_variables.py +++ b/process/iteration_variables.py @@ -63,7 +63,7 @@ class IterationVariable: 21: IterationVariable("ft_burn", fortran.constraint_variables, 0.001, 1.0), 23: IterationVariable("fcoolcp", fortran.tfcoil_variables, 0.1, 0.50), 25: IterationVariable("fpnetel", fortran.constraint_variables, 0.001, 1.0), - 26: IterationVariable("ffuspow", fortran.constraint_variables, 0.001, 1.0), + 26: IterationVariable("fp_fusion_total_max_mw", fortran.constraint_variables, 0.001, 1.0), 27: IterationVariable( "fpflux_div_heat_load_mw", fortran.constraint_variables, 0.001, 1.0 ), diff --git a/source/fortran/constraint_equations.f90 b/source/fortran/constraint_equations.f90 index a4918980f3..06eaaa92f4 100755 --- a/source/fortran/constraint_equations.f90 +++ b/source/fortran/constraint_equations.f90 @@ -775,13 +775,13 @@ subroutine constraint_eqn_009(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units) !! residual error in physical units; output string; units string !! Equation for fusion power upper limit !! #=# physics - !! #=#=# ffuspow, p_fusion_total_max_mw + !! #=#=# fp_fusion_total_max_mw, p_fusion_total_max_mw !! and hence also optional here. !! Logic change during pre-factoring: err, symbol, units will be assigned only if present. - !! ffuspow : input real : f-value for maximum fusion power + !! fp_fusion_total_max_mw : input real : f-value for maximum fusion power !! p_fusion_total_max_mw : input real : maximum fusion power (MW) !! p_fusion_total_mw : input real : fusion power (MW) - use constraint_variables, only: ffuspow, p_fusion_total_max_mw + use constraint_variables, only: fp_fusion_total_max_mw, p_fusion_total_max_mw use physics_variables, only: p_fusion_total_mw implicit none real(dp), intent(out) :: tmp_cc @@ -790,7 +790,7 @@ subroutine constraint_eqn_009(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units) character(len=1), intent(out) :: tmp_symbol character(len=10), intent(out) :: tmp_units - tmp_cc = p_fusion_total_mw/p_fusion_total_max_mw - 1.0D0 * ffuspow + tmp_cc = p_fusion_total_mw/p_fusion_total_max_mw - 1.0D0 * fp_fusion_total_max_mw tmp_con = p_fusion_total_max_mw * (1.0D0 - tmp_cc) tmp_err = p_fusion_total_mw * tmp_cc tmp_symbol = '<' diff --git a/source/fortran/constraint_variables.f90 b/source/fortran/constraint_variables.f90 index 4f564b8c56..31824dccb3 100644 --- a/source/fortran/constraint_variables.f90 +++ b/source/fortran/constraint_variables.f90 @@ -65,7 +65,7 @@ module constraint_variables real(dp) :: fflutf !! f-value for neutron fluence on TF coil (`constraint equation 53`, `iteration variable 92`) - real(dp) :: ffuspow + real(dp) :: fp_fusion_total_max_mw !! f-value for maximum fusion power (`constraint equation 9`, `iteration variable 26`) real(dp) :: fgamcd @@ -331,7 +331,7 @@ subroutine init_constraint_variables fdene = 1.0D0 fdtmp = 1.0D0 fflutf = 1.0D0 - ffuspow = 1.0D0 + fp_fusion_total_max_mw = 1.0D0 fgamcd = 1.0D0 fpflux_div_heat_load_mw = 1.0D0 fiooic = 0.5D0 diff --git a/source/fortran/numerics.f90 b/source/fortran/numerics.f90 index d940e5fe39..128710e408 100755 --- a/source/fortran/numerics.f90 +++ b/source/fortran/numerics.f90 @@ -231,7 +231,7 @@ module numerics !!
  • (23) fcoolcp !!
  • (24) NOT USED !!
  • (25) fpnetel (f-value for equation 16) - !!
  • (26) ffuspow (f-value for equation 9) + !!
  • (26) fp_fusion_total_max_mw (f-value for equation 9) !!
  • (27) fpflux_div_heat_load_mw (f-value for equation 18) !!
  • (28) fradpwr (f-value for equation 17), total radiation fraction !!
  • (29) dr_bore diff --git a/tests/regression/input_files/large_tokamak.IN.DAT b/tests/regression/input_files/large_tokamak.IN.DAT index 3541f7ed75..2fa59ec138 100644 --- a/tests/regression/input_files/large_tokamak.IN.DAT +++ b/tests/regression/input_files/large_tokamak.IN.DAT @@ -56,7 +56,7 @@ walalw = 2.0 *--------------------------* icc = 9 -ixc = 26 * ffuspow +ixc = 26 * fp_fusion_total_max_mw * Maximum allowable value fusion power [MW] p_fusion_total_max_mw = 3000 diff --git a/tests/regression/input_files/spherical_tokamak_once_through.IN.DAT b/tests/regression/input_files/spherical_tokamak_once_through.IN.DAT index 462a0f5511..f2d160a303 100644 --- a/tests/regression/input_files/spherical_tokamak_once_through.IN.DAT +++ b/tests/regression/input_files/spherical_tokamak_once_through.IN.DAT @@ -160,7 +160,7 @@ i_bldgs_size = 0 * switch between routines estimating building sizes (0 = defaul fbeta_max = 0.8735070761063214 * f-value for beta limit (`constraint equation 24`; `iteration variable 36`) fdene = 1.0 * f-value for density limit (`constraint equation 5`; `iteration variable 9`) -ffuspow = 1.0 * f-value for maximum fusion power (`constraint equation 9`; `iteration variable 26`) +fp_fusion_total_max_mw = 1.0 * f-value for maximum fusion power (`constraint equation 9`; `iteration variable 26`) fiooic = 0.9942981023320613 * f-value for TF coil operating current / critical current ratio fipir = 0.5460655498423221 * f-value for Ip/Irod upper limit fl_h_threshold = 0.34445356794812293 * f-value for L-H power threshold (`constraint equation 15`; `iteration variable 103`) diff --git a/tests/regression/input_files/st_regression.IN.DAT b/tests/regression/input_files/st_regression.IN.DAT index 18cc12cd96..f30648c0b7 100644 --- a/tests/regression/input_files/st_regression.IN.DAT +++ b/tests/regression/input_files/st_regression.IN.DAT @@ -105,7 +105,7 @@ icc = 9 * VARIABLES: p_fusion_total_mw (fusion power) calculated in-situ ixc = 26 -ffuspow = 1.0 +fp_fusion_total_max_mw = 1.0 *boundl(26) = 0.9 *boundu(26) = 1.1 * DESCRIPTION: f-value for Maximum Fusion Power diff --git a/tests/regression/input_files/stellarator_helias_once_through.IN.DAT b/tests/regression/input_files/stellarator_helias_once_through.IN.DAT index a2ac891bd9..f977dddfba 100644 --- a/tests/regression/input_files/stellarator_helias_once_through.IN.DAT +++ b/tests/regression/input_files/stellarator_helias_once_through.IN.DAT @@ -108,7 +108,7 @@ bigqmin = 1 * minimum fusion gain Q (`constraint equation 28`) fbeta_max = 1. * f-value for beta limit (`constraint equation 24`; `iteration variable 36`) fecrh_ignition = 1.0 * f-value for ecrh ignition constraint fflutf = 1 * f-value for neutron fluence on TF coil (`constraint equation 53`; `iteration variable 92`) -ffuspow = 1.0 * f-value for maximum fusion power (`constraint equation 9`; `iteration variable 26`) +fp_fusion_total_max_mw = 1.0 * f-value for maximum fusion power (`constraint equation 9`; `iteration variable 26`) fpflux_div_heat_load_mw = 0.8 * f-value for divertor heat load (`constraint equation 18`; `iteration variable 27`) fiooic = 0.9 * f-value for TF coil operating current / critical current ratio fjprot = 0.95 * f-value for TF coil winding pack current density From 53a7e5ff16420acdd50407db54f8e2dbad492f0f Mon Sep 17 00:00:00 2001 From: mn3981 Date: Fri, 9 May 2025 10:09:23 +0100 Subject: [PATCH 28/37] =?UTF-8?q?=F0=9F=94=84=20Rename=20=20charged=5Fpowe?= =?UTF-8?q?r=5Fdensity=20to=20pden=5Fcharged=5Fparticle=5Fmw?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../proc-pages/physics-models/error.txt | 6 +-- .../fusion_reactions/plasma_reactions.md | 6 +-- process/fusion_reactions.py | 50 +++++++++---------- process/physics.py | 8 +-- process/stellarator.py | 2 +- source/fortran/constraint_equations.f90 | 14 +++--- source/fortran/physics_variables.f90 | 2 +- tests/unit/test_fusion_reactions.py | 12 ++--- 8 files changed, 50 insertions(+), 50 deletions(-) diff --git a/documentation/proc-pages/physics-models/error.txt b/documentation/proc-pages/physics-models/error.txt index 96718cd7e7..948ec3f293 100644 --- a/documentation/proc-pages/physics-models/error.txt +++ b/documentation/proc-pages/physics-models/error.txt @@ -994,18 +994,18 @@ is derived directly from the energy confinement scaling law. \texttt{i_rad_loss\ =\ 0} -- Total power lost is scaling power plus radiation -\texttt{pscaling\ +\ pden_plasma_rad_mw\ =\ f_alpha_plasma*alpha_power_density\ +\ charged_power_density\ +\ pden_plasma_ohmic_mw\ +\ p_hcd_injected_total_mw/vol_plasma} +\texttt{pscaling\ +\ pden_plasma_rad_mw\ =\ f_alpha_plasma*alpha_power_density\ +\ pden_charged_particle_mw\ +\ pden_plasma_ohmic_mw\ +\ p_hcd_injected_total_mw/vol_plasma} \texttt{i_rad_loss\ =\ 1} -- Total power lost is scaling power plus core radiation only -\texttt{pscaling\ +\ pden_plasma_core_rad_mw\ =\ f_alpha_plasma*alpha_power_density\ +\ charged_power_density\ +\ pden_plasma_ohmic_mw\ +\ p_hcd_injected_total_mw/vol_plasma} +\texttt{pscaling\ +\ pden_plasma_core_rad_mw\ =\ f_alpha_plasma*alpha_power_density\ +\ pden_charged_particle_mw\ +\ pden_plasma_ohmic_mw\ +\ p_hcd_injected_total_mw/vol_plasma} \texttt{i_rad_loss\ =\ 2} -- Total power lost is scaling power only, with no additional allowance for radiation. This is not recommended for power plant models. -\texttt{pscaling\ =\ f_alpha_plasma*alpha_power_density\ +\ charged_power_density\ +\ pden_plasma_ohmic_mw\ +\ p_hcd_injected_total_mw/vol_plasma} +\texttt{pscaling\ =\ f_alpha_plasma*alpha_power_density\ +\ pden_charged_particle_mw\ +\ pden_plasma_ohmic_mw\ +\ p_hcd_injected_total_mw/vol_plasma} \subsection{Plasma Core Power Balance}\label{plasma-core-power-balance} diff --git a/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md b/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md index 8d919e3b76..63f828da40 100644 --- a/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md +++ b/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md @@ -84,7 +84,7 @@ Initialize the FusionReactionRate class with the given plasma profile. - `dd_power_density (float)`: Fusion power density produced by the D-D reactions. - `dt_power_density (float)`: Fusion power density produced by the D-T reaction. - `alpha_power_density (float)`: Power density of alpha particles produced. -- `charged_power_density (float)`: Power density of charged particles produced. +- `pden_charged_particle_mw (float)`: Power density of charged particles produced. - `neutron_power_density (float)`: Power density of neutrons produced. - `fusion_rate_density (float)`: Fusion reaction rate density. - `alpha_rate_density (float)`: Alpha particle production rate density. @@ -137,7 +137,7 @@ The method updates the following attributes: - `self.sigmav_dt_average`: Average fusion reaction rate `` for D-T. - `self.dt_power_density`: Fusion power density produced by the D-T reaction. - `self.alpha_power_density`: Power density of alpha particles produced. -- `self.charged_power_density`: Power density of charged particles produced. +- `self.pden_charged_particle_mw`: Power density of charged particles produced. - `self.neutron_power_density`: Power density of neutrons produced. - `self.fusion_rate_density`: Fusion reaction rate density. - `self.alpha_rate_density`: Alpha particle production rate density. @@ -181,7 +181,7 @@ This method sets the required physics variables in the `physics_variables` and ` #### Updates: - `physics_variables.pden_plasma_alpha_mw`: Updated with `self.alpha_power_density` -- `physics_variables.charged_power_density`: Updated with `self.charged_power_density` +- `physics_variables.pden_charged_particle_mw`: Updated with `self.pden_charged_particle_mw` - `physics_variables.pden_plasma_neutron_mw`: Updated with `self.neutron_power_density` - `physics_variables.fusden_plasma`: Updated with `self.fusion_rate_density` - `physics_variables.fusden_plasma_alpha`: Updated with `self.alpha_rate_density` diff --git a/process/fusion_reactions.py b/process/fusion_reactions.py index 4535301703..113f4c641e 100644 --- a/process/fusion_reactions.py +++ b/process/fusion_reactions.py @@ -82,7 +82,7 @@ class FusionReactionRate: dd_power_density (float): Fusion power density produced by the D-D reactions. dt_power_density (float): Fusion power density produced by the D-T reaction. alpha_power_density (float): Power density of alpha particles produced. - charged_power_density (float): Power density of charged particles produced. + pden_charged_particle_mw (float): Power density of charged particles produced. neutron_power_density (float): Power density of neutrons produced. fusion_rate_density (float): Fusion reaction rate density. alpha_rate_density (float): Alpha particle production rate density. @@ -135,7 +135,7 @@ def __init__(self, plasma_profile: PlasmaProfile) -> None: dd_power_density (float): Fusion power density produced by the D-D reactions. dt_power_density (float): Fusion power density produced by the D-T reaction. alpha_power_density (float): Power density of alpha particles produced. - charged_power_density (float): Power density of charged particles produced. + pden_charged_particle_mw (float): Power density of charged particles produced. neutron_power_density (float): Power density of neutrons produced. fusion_rate_density (float): Fusion reaction rate density. alpha_rate_density (float): Alpha particle production rate density. @@ -148,7 +148,7 @@ def __init__(self, plasma_profile: PlasmaProfile) -> None: self.dd_power_density = 0.0 self.dt_power_density = 0.0 self.alpha_power_density = 0.0 - self.charged_power_density = 0.0 + self.pden_charged_particle_mw = 0.0 self.neutron_power_density = 0.0 self.fusion_rate_density = 0.0 self.alpha_rate_density = 0.0 @@ -197,7 +197,7 @@ def dt_reaction(self) -> None: - self.sigmav_dt_average: Average fusion reaction rate for D-T. - self.dt_power_density: Fusion power density produced by the D-T reaction. - self.alpha_power_density: Power density of alpha particles produced. - - self.charged_power_density: Power density of charged particles produced. + - self.pden_charged_particle_mw: Power density of charged particles produced. - self.neutron_power_density: Power density of neutrons produced. - self.fusion_rate_density: Fusion reaction rate density. - self.alpha_rate_density: Alpha particle production rate density. @@ -235,7 +235,7 @@ def dt_reaction(self) -> None: alpha_power_density = ( 1.0 - constants.dt_neutron_energy_fraction ) * fusion_power_density - charged_power_density = 0.0 + pden_charged_particle_mw = 0.0 neutron_power_density = ( constants.dt_neutron_energy_fraction * fusion_power_density ) @@ -251,7 +251,7 @@ def dt_reaction(self) -> None: # Sum the fusion rates for all particles self.sum_fusion_rates( alpha_power_density, - charged_power_density, + pden_charged_particle_mw, neutron_power_density, fusion_rate_density, alpha_rate_density, @@ -269,7 +269,7 @@ def dhe3_reaction(self) -> None: The method updates the following attributes: - self.dhe3_power_density: Fusion power density produced by the D-3He reaction. - self.alpha_power_density: Power density of alpha particles produced. - - self.charged_power_density: Power density of charged particles produced. + - self.pden_charged_particle_mw: Power density of charged particles produced. - self.neutron_power_density: Power density of neutrons produced. - self.fusion_rate_density: Fusion reaction rate density. - self.alpha_rate_density: Alpha particle production rate density. @@ -304,7 +304,7 @@ def dhe3_reaction(self) -> None: alpha_power_density = ( 1.0 - constants.dhelium_proton_energy_fraction ) * fusion_power_density - charged_power_density = ( + pden_charged_particle_mw = ( constants.dhelium_proton_energy_fraction * fusion_power_density ) neutron_power_density = 0.0 @@ -320,7 +320,7 @@ def dhe3_reaction(self) -> None: # Sum the fusion rates for all particles self.sum_fusion_rates( alpha_power_density, - charged_power_density, + pden_charged_particle_mw, neutron_power_density, fusion_rate_density, alpha_rate_density, @@ -339,7 +339,7 @@ def dd_helion_reaction(self) -> None: The method updates the following attributes: - self.dd_power_density: Fusion power density produced by the D-D reaction. - self.alpha_power_density: Power density of alpha particles produced. - - self.charged_power_density: Power density of charged particles produced. + - self.pden_charged_particle_mw: Power density of charged particles produced. - self.neutron_power_density: Power density of neutrons produced. - self.fusion_rate_density: Fusion reaction rate density. - self.alpha_rate_density: Alpha particle production rate density. @@ -375,7 +375,7 @@ def dd_helion_reaction(self) -> None: # Power densities for different particles [MW/m^3] # Neutron particle gets approximately 75% of the fusion power alpha_power_density = 0.0 - charged_power_density = ( + pden_charged_particle_mw = ( 1.0 - constants.dd_neutron_energy_fraction ) * fusion_power_density neutron_power_density = ( @@ -393,7 +393,7 @@ def dd_helion_reaction(self) -> None: # Sum the fusion rates for all particles self.sum_fusion_rates( alpha_power_density, - charged_power_density, + pden_charged_particle_mw, neutron_power_density, fusion_rate_density, alpha_rate_density, @@ -412,7 +412,7 @@ def dd_triton_reaction(self) -> None: The method updates the following attributes: - self.dd_power_density: Fusion power density produced by the D-D reaction. - self.alpha_power_density: Power density of alpha particles produced. - - self.charged_power_density: Power density of charged particles produced. + - self.pden_charged_particle_mw: Power density of charged particles produced. - self.neutron_power_density: Power density of neutrons produced. - self.fusion_rate_density: Fusion reaction rate density. - self.alpha_rate_density: Alpha particle production rate density. @@ -447,7 +447,7 @@ def dd_triton_reaction(self) -> None: # Power densities for different particles [MW/m^3] alpha_power_density = 0.0 - charged_power_density = fusion_power_density + pden_charged_particle_mw = fusion_power_density neutron_power_density = 0.0 # Calculate the fusion rate density [reactions/m^3/second] @@ -461,7 +461,7 @@ def dd_triton_reaction(self) -> None: # Sum the fusion rates for all particles self.sum_fusion_rates( alpha_power_density, - charged_power_density, + pden_charged_particle_mw, neutron_power_density, fusion_rate_density, alpha_rate_density, @@ -494,7 +494,7 @@ def sum_fusion_rates( None """ self.alpha_power_density += alpha_power_add - self.charged_power_density += charged_power_add + self.pden_charged_particle_mw += charged_power_add self.neutron_power_density += neutron_power_add self.fusion_rate_density += fusion_rate_add self.alpha_rate_density += alpha_rate_add @@ -533,7 +533,7 @@ def set_physics_variables(self) -> None: None """ physics_variables.pden_plasma_alpha_mw = self.alpha_power_density - physics_variables.charged_power_density = self.charged_power_density + physics_variables.pden_charged_particle_mw = self.pden_charged_particle_mw physics_variables.pden_plasma_neutron_mw = self.neutron_power_density physics_variables.fusden_plasma = self.fusion_rate_density physics_variables.fusden_plasma_alpha = self.alpha_rate_density @@ -591,7 +591,7 @@ def fusion_rate_integral( sigv = bosch_hale_reactivity(ion_temperature_profile, reaction_constants) # Integrand for the volume averaged fusion reaction rate sigmav: - # sigmav = integral(2 rho (sigv(rho) ni(rho)^2) drho), + # sigmav = integral(2 ρ (sigv(rho) ni(ρ)^2) dρ), # divided by the square of the volume-averaged ion density # to retain the dimensions m^3/s (this is multiplied back in later) @@ -611,7 +611,7 @@ def bosch_hale_reactivity( ion_temperature_profile: np.ndarray, reaction_constants: BoschHaleConstants ) -> np.ndarray: """ - Calculate the volumetric fusion reaction rate (m^3/s) for one of four nuclear reactions using + Calculate the volumetric fusion reaction rate 〈σv〉 (m^3/s) for one of four nuclear reactions using the Bosch-Hale parametrization. The valid range of the fit is 0.2 keV < t < 100 keV except for D-3He where it is 0.5 keV < t < 190 keV. @@ -627,7 +627,7 @@ def bosch_hale_reactivity( reaction_constants (BoschHaleConstants): Bosch-Hale reaction constants. Returns: - np.ndarray: Volumetric fusion reaction rate in m^3/s for each point in the ion temperature profile. + np.ndarray: Volumetric fusion reaction rate 〈σv〉 in m^3/s for each point in the ion temperature profile. References: - H.-S. Bosch and G. M. Hale, “Improved formulas for fusion cross-sections and thermal reactivities,” @@ -661,7 +661,7 @@ def bosch_hale_reactivity( xi = ((reaction_constants.bg**2) / (4.0 * theta)) ** (1 / 3) - # Volumetric reaction rate / reactivity (m^3/s) + # Volumetric reaction rate / reactivity 〈σv〉 (m^3/s) # Original form is in [cm^3/s], so multiply by 1.0e-6 to convert to [m^3/s] sigmav = ( 1.0e-6 @@ -683,7 +683,7 @@ def set_fusion_powers( f_alpha_electron: float, f_alpha_ion: float, p_beam_alpha_mw: float, - charged_power_density: float, + pden_charged_particle_mw: float, pden_plasma_neutron_mw: float, vol_plasma: float, pden_plasma_alpha_mw: float, @@ -696,7 +696,7 @@ def set_fusion_powers( f_alpha_electron (float): Fraction of alpha energy to electrons. f_alpha_ion (float): Fraction of alpha energy to ions. p_beam_alpha_mw (float): Alpha power from hot neutral beam ions (MW). - charged_power_density (float): Other charged particle fusion power per unit volume (MW/m^3). + pden_charged_particle_mw (float): Other charged particle fusion power per unit volume (MW/m^3). pden_plasma_neutron_mw (float): Neutron fusion power per unit volume just from plasma (MW/m^3). vol_plasma (float): Plasma volume (m^3). pden_plasma_alpha_mw (float): Alpha power per unit volume just from plasma (MW/m^3). @@ -754,7 +754,7 @@ def set_fusion_powers( # Charged particle power # Total non-alpha charged particle power - p_non_alpha_charged_mw = charged_power_density * vol_plasma + p_non_alpha_charged_mw = pden_charged_particle_mw * vol_plasma # Charged particle fusion power p_charged_particle_mw = p_alpha_total_mw + p_non_alpha_charged_mw @@ -764,7 +764,7 @@ def set_fusion_powers( # Alpha power to electrons and ions (used with electron # and ion power balance equations only) - # No consideration of charged_power_density here. + # No consideration of pden_charged_particle_mw here. f_pden_alpha_ions_mw = ( physics_variables.f_alpha_plasma * pden_alpha_total_mw * f_alpha_ion ) diff --git a/process/physics.py b/process/physics.py index cc503dbb86..61ecda9515 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2181,7 +2181,7 @@ def physics(self): physics_variables.f_alpha_electron, physics_variables.f_alpha_ion, physics_variables.p_beam_alpha_mw, - physics_variables.charged_power_density, + physics_variables.pden_charged_particle_mw, physics_variables.pden_plasma_neutron_mw, physics_variables.vol_plasma, physics_variables.pden_plasma_alpha_mw, @@ -3028,7 +3028,7 @@ def plasma_composition() -> None: # Fraction of alpha energy to ions and electrons # From Max Fenstermacher # (used with electron and ion power balance equations only) - # No consideration of charged_power_density here... + # No consideration of pden_charged_particle_mw here... # pcoef now calculated in plasma_profiles, after the very first # call of plasma_composition; use old parabolic profile estimate @@ -7044,7 +7044,7 @@ def fhz(hfact: float) -> float: + ptriz - physics_variables.f_alpha_plasma * physics_variables.pden_alpha_total_mw - - physics_variables.charged_power_density + - physics_variables.pden_charged_particle_mw - physics_variables.pden_plasma_ohmic_mw ) @@ -8358,7 +8358,7 @@ def init_physics_variables(): physics_variables.p_plasma_alpha_mw = 0.0 physics_variables.p_beam_alpha_mw = 0.0 physics_variables.p_non_alpha_charged_mw = 0.0 - physics_variables.charged_power_density = 0.0 + physics_variables.pden_charged_particle_mw = 0.0 physics_variables.pcoef = 0.0 physics_variables.p_plasma_inner_rad_mw = 0.0 physics_variables.pden_plasma_core_rad_mw = 0.0 diff --git a/process/stellarator.py b/process/stellarator.py index a960a87da0..9b6e50e792 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -4284,7 +4284,7 @@ def stphys(self, output): physics_variables.f_alpha_electron, physics_variables.f_alpha_ion, physics_variables.p_beam_alpha_mw, - physics_variables.charged_power_density, + physics_variables.pden_charged_particle_mw, physics_variables.pden_plasma_neutron_mw, physics_variables.vol_plasma, physics_variables.pden_plasma_alpha_mw, diff --git a/source/fortran/constraint_equations.f90 b/source/fortran/constraint_equations.f90 index 06eaaa92f4..58455a29ed 100755 --- a/source/fortran/constraint_equations.f90 +++ b/source/fortran/constraint_equations.f90 @@ -453,13 +453,13 @@ subroutine constraint_eqn_002(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units) !! pden_plasma_core_rad_mw : input real : total core radiation power per volume (MW/m3) !! f_alpha_plasma : input real : fraction of alpha power deposited in plasma !! pden_alpha_total_mw : input real : alpha power per volume (MW/m3) - !! charged_power_density : input real : non-alpha charged particle fusion power per volume (MW/m3) + !! pden_charged_particle_mw : input real : non-alpha charged particle fusion power per volume (MW/m3) !! pden_plasma_ohmic_mw : input real : ohmic heating power per volume (MW/m3) !! p_hcd_injected_total_mw : input real : total auxiliary injected power (MW) !! vol_plasma : input real : plasma volume (m3) use physics_variables, only: i_rad_loss, i_plasma_ignited, pden_electron_transport_loss_mw, pden_ion_transport_loss_mw, pden_plasma_rad_mw, & - pden_plasma_core_rad_mw, f_alpha_plasma, pden_alpha_total_mw, charged_power_density, & + pden_plasma_core_rad_mw, f_alpha_plasma, pden_alpha_total_mw, pden_charged_particle_mw, & pden_plasma_ohmic_mw, vol_plasma use current_drive_variables, only: p_hcd_injected_total_mw @@ -487,10 +487,10 @@ subroutine constraint_eqn_002(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units) ! if plasma not ignited include injected power if (i_plasma_ignited == 0) then - pdenom = f_alpha_plasma*pden_alpha_total_mw + charged_power_density + pden_plasma_ohmic_mw + p_hcd_injected_total_mw/vol_plasma + pdenom = f_alpha_plasma*pden_alpha_total_mw + pden_charged_particle_mw + pden_plasma_ohmic_mw + p_hcd_injected_total_mw/vol_plasma else ! if plasma ignited - pdenom = f_alpha_plasma*pden_alpha_total_mw + charged_power_density + pden_plasma_ohmic_mw + pdenom = f_alpha_plasma*pden_alpha_total_mw + pden_charged_particle_mw + pden_plasma_ohmic_mw end if tmp_cc = 1.0D0 - pnumerator / pdenom @@ -1031,11 +1031,11 @@ subroutine constraint_eqn_017(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units) !! p_hcd_injected_total_mw : input real : total auxiliary injected power (MW) !! vol_plasma : input real : plasma volume (m3) !! pden_alpha_total_mw : input real : alpha power per volume (MW/m3) - !! charged_power_density : input real : non-alpha charged particle fusion power per volume (MW/m3) + !! pden_charged_particle_mw : input real : non-alpha charged particle fusion power per volume (MW/m3) !! pden_plasma_ohmic_mw : input real : ohmic heating power per volume (MW/m3) !! fradpwr : input real : f-value for core radiation power limit !! pden_plasma_rad_mw : input real : total radiation power per volume (MW/m3) - use physics_variables, only: f_alpha_plasma, vol_plasma, pden_alpha_total_mw, charged_power_density, pden_plasma_ohmic_mw, pden_plasma_rad_mw + use physics_variables, only: f_alpha_plasma, vol_plasma, pden_alpha_total_mw, pden_charged_particle_mw, pden_plasma_ohmic_mw, pden_plasma_rad_mw use current_drive_variables, only: p_hcd_injected_total_mw use constraint_variables, only: fradpwr implicit none @@ -1048,7 +1048,7 @@ subroutine constraint_eqn_017(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units) real(dp) :: pradmaxpv !! Maximum possible power/vol_plasma that can be radiated (local) - pradmaxpv = p_hcd_injected_total_mw/vol_plasma + pden_alpha_total_mw*f_alpha_plasma + charged_power_density + pden_plasma_ohmic_mw + pradmaxpv = p_hcd_injected_total_mw/vol_plasma + pden_alpha_total_mw*f_alpha_plasma + pden_charged_particle_mw + pden_plasma_ohmic_mw tmp_cc = pden_plasma_rad_mw/pradmaxpv - 1.0D0 * fradpwr tmp_con = pradmaxpv * (1.0D0 - tmp_cc) tmp_err = pden_plasma_rad_mw * tmp_cc diff --git a/source/fortran/physics_variables.f90 b/source/fortran/physics_variables.f90 index 10739630f3..23798f24b2 100644 --- a/source/fortran/physics_variables.f90 +++ b/source/fortran/physics_variables.f90 @@ -612,7 +612,7 @@ module physics_variables real(dp) :: p_charged_particle_mw !! Total charged particle fusion power [MW] - real(dp) :: charged_power_density + real(dp) :: pden_charged_particle_mw !! Non-alpha charged particle fusion power per volume [MW/m3] real(dp) :: pcoef diff --git a/tests/unit/test_fusion_reactions.py b/tests/unit/test_fusion_reactions.py index c1f0dee657..cb7be9db96 100644 --- a/tests/unit/test_fusion_reactions.py +++ b/tests/unit/test_fusion_reactions.py @@ -33,7 +33,7 @@ class SetFusionPowersParam(NamedTuple): p_beam_alpha_mw: Any = None - charged_power_density: Any = None + pden_charged_particle_mw: Any = None ten: Any = None @@ -75,7 +75,7 @@ class SetFusionPowersParam(NamedTuple): f_alpha_electron=0.68, f_alpha_ion=0.32, p_beam_alpha_mw=0, - charged_power_density=0.00066, + pden_charged_particle_mw=0.00066, vol_plasma=2426.25, pden_plasma_alpha_mw=0.163, pden_plasma_neutron_mw=0.654, @@ -95,7 +95,7 @@ class SetFusionPowersParam(NamedTuple): f_alpha_electron=0.68, f_alpha_ion=0.32, p_beam_alpha_mw=100.5, - charged_power_density=0.00066, + pden_charged_particle_mw=0.00066, vol_plasma=2426.25, pden_plasma_alpha_mw=0.163, pden_plasma_neutron_mw=0.654, @@ -115,7 +115,7 @@ class SetFusionPowersParam(NamedTuple): f_alpha_electron=0.68, f_alpha_ion=0.32, p_beam_alpha_mw=100.5, - charged_power_density=0.00066, + pden_charged_particle_mw=0.00066, vol_plasma=2426.25, pden_plasma_alpha_mw=0.163, pden_plasma_neutron_mw=0.654, @@ -135,7 +135,7 @@ class SetFusionPowersParam(NamedTuple): f_alpha_electron=0.68, f_alpha_ion=0.32, p_beam_alpha_mw=100.5, - charged_power_density=0.00066, + pden_charged_particle_mw=0.00066, vol_plasma=2426.25, pden_plasma_alpha_mw=0.163, pden_plasma_neutron_mw=0.654, @@ -182,7 +182,7 @@ def test_set_fusion_powers(setfusionpowersparam, monkeypatch): f_alpha_electron=setfusionpowersparam.f_alpha_electron, f_alpha_ion=setfusionpowersparam.f_alpha_ion, p_beam_alpha_mw=setfusionpowersparam.p_beam_alpha_mw, - charged_power_density=setfusionpowersparam.charged_power_density, + pden_charged_particle_mw=setfusionpowersparam.pden_charged_particle_mw, pden_plasma_neutron_mw=setfusionpowersparam.pden_plasma_neutron_mw, vol_plasma=setfusionpowersparam.vol_plasma, pden_plasma_alpha_mw=setfusionpowersparam.pden_plasma_alpha_mw, From 17d9a5142d9ec6160c83477c0b3565fb5f022239 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Fri, 9 May 2025 10:55:01 +0100 Subject: [PATCH 29/37] :bug: Fix energy fraction of power from beam to total dt energy --- process/fusion_reactions.py | 8 ++++---- process/input.py | 8 ++++++-- process/iteration_variables.py | 4 +++- process/physics.py | 3 ++- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/process/fusion_reactions.py b/process/fusion_reactions.py index 113f4c641e..f1d7a6c27e 100644 --- a/process/fusion_reactions.py +++ b/process/fusion_reactions.py @@ -591,7 +591,7 @@ def fusion_rate_integral( sigv = bosch_hale_reactivity(ion_temperature_profile, reaction_constants) # Integrand for the volume averaged fusion reaction rate sigmav: - # sigmav = integral(2 ρ (sigv(rho) ni(ρ)^2) dρ), + # sigmav = integral(2 rho (sigv(rho) ni(rho)^2) drho), # divided by the square of the volume-averaged ion density # to retain the dimensions m^3/s (this is multiplied back in later) @@ -611,7 +611,7 @@ def bosch_hale_reactivity( ion_temperature_profile: np.ndarray, reaction_constants: BoschHaleConstants ) -> np.ndarray: """ - Calculate the volumetric fusion reaction rate 〈σv〉 (m^3/s) for one of four nuclear reactions using + Calculate the volumetric fusion reaction rate 〈sigmav〉 (m^3/s) for one of four nuclear reactions using the Bosch-Hale parametrization. The valid range of the fit is 0.2 keV < t < 100 keV except for D-3He where it is 0.5 keV < t < 190 keV. @@ -627,7 +627,7 @@ def bosch_hale_reactivity( reaction_constants (BoschHaleConstants): Bosch-Hale reaction constants. Returns: - np.ndarray: Volumetric fusion reaction rate 〈σv〉 in m^3/s for each point in the ion temperature profile. + np.ndarray: Volumetric fusion reaction rate 〈sigmav〉 in m^3/s for each point in the ion temperature profile. References: - H.-S. Bosch and G. M. Hale, “Improved formulas for fusion cross-sections and thermal reactivities,” @@ -661,7 +661,7 @@ def bosch_hale_reactivity( xi = ((reaction_constants.bg**2) / (4.0 * theta)) ** (1 / 3) - # Volumetric reaction rate / reactivity 〈σv〉 (m^3/s) + # Volumetric reaction rate / reactivity 〈sigmav〉 (m^3/s) # Original form is in [cm^3/s], so multiply by 1.0e-6 to convert to [m^3/s] sigmav = ( 1.0e-6 diff --git a/process/input.py b/process/input.py index 59e927b195..6edbae2ddf 100644 --- a/process/input.py +++ b/process/input.py @@ -603,7 +603,9 @@ def __post_init__(self): ), "feffcd": InputVariable(fortran.current_drive_variables, float, range=(0.0, 20.0)), "fflutf": InputVariable(fortran.constraint_variables, float, range=(0.001, 10.0)), - "fp_fusion_total_max_mw": InputVariable(fortran.constraint_variables, float, range=(0.001, 10.0)), + "fp_fusion_total_max_mw": InputVariable( + fortran.constraint_variables, float, range=(0.001, 10.0) + ), "fgamcd": InputVariable(fortran.constraint_variables, float, range=(0.001, 10.0)), "f_a_fw_hcd": InputVariable(fortran.fwbs_variables, float, range=(0.0, 1.0)), "fpflux_div_heat_load_mw": InputVariable( @@ -1016,7 +1018,9 @@ def __post_init__(self): "poisson_al": InputVariable(fortran.tfcoil_variables, float, range=(0.0, 1.0)), "poisson_copper": InputVariable(fortran.tfcoil_variables, float, range=(0.0, 1.0)), "poisson_steel": InputVariable(fortran.tfcoil_variables, float, range=(0.0, 1.0)), - "p_fusion_total_max_mw": InputVariable(fortran.constraint_variables, float, range=(1.0, 10000.0)), + "p_fusion_total_max_mw": InputVariable( + fortran.constraint_variables, float, range=(1.0, 10000.0) + ), "prdiv": InputVariable(fortran.vacuum_variables, float, range=(0.0, 10.0)), "pres_fw_coolant": InputVariable( fortran.fwbs_variables, float, range=(100000.0, 100000000.0) diff --git a/process/iteration_variables.py b/process/iteration_variables.py index 726398dad0..a61f8b8aa1 100644 --- a/process/iteration_variables.py +++ b/process/iteration_variables.py @@ -63,7 +63,9 @@ class IterationVariable: 21: IterationVariable("ft_burn", fortran.constraint_variables, 0.001, 1.0), 23: IterationVariable("fcoolcp", fortran.tfcoil_variables, 0.1, 0.50), 25: IterationVariable("fpnetel", fortran.constraint_variables, 0.001, 1.0), - 26: IterationVariable("fp_fusion_total_max_mw", fortran.constraint_variables, 0.001, 1.0), + 26: IterationVariable( + "fp_fusion_total_max_mw", fortran.constraint_variables, 0.001, 1.0 + ), 27: IterationVariable( "fpflux_div_heat_load_mw", fortran.constraint_variables, 0.001, 1.0 ), diff --git a/process/physics.py b/process/physics.py index 61ecda9515..785a3194de 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2156,7 +2156,8 @@ def physics(self): ) physics_variables.p_dt_total_mw = ( physics_variables.p_plasma_dt_mw - + 5.0e0 * physics_variables.p_beam_alpha_mw + + (1.0 / (1.0 - constants.dt_neutron_energy_fraction)) + * physics_variables.p_beam_alpha_mw ) else: # If no beams present then the total alpha rates and power are the same as the plasma values From 30717b349e4ca9318a16f6cfd8b73d321f8c06bd Mon Sep 17 00:00:00 2001 From: mn3981 Date: Fri, 9 May 2025 10:58:42 +0100 Subject: [PATCH 30/37] :sparkle: Add p_beam_neutron_mw variable for neutron power from hot neutral beam ions --- process/physics.py | 1 + source/fortran/physics_variables.f90 | 3 +++ 2 files changed, 4 insertions(+) diff --git a/process/physics.py b/process/physics.py index 785a3194de..46e8308de3 100644 --- a/process/physics.py +++ b/process/physics.py @@ -8358,6 +8358,7 @@ def init_physics_variables(): physics_variables.p_alpha_total_mw = 0.0 physics_variables.p_plasma_alpha_mw = 0.0 physics_variables.p_beam_alpha_mw = 0.0 + physics_variables.p_beam_neutron_mw = 0.0 physics_variables.p_non_alpha_charged_mw = 0.0 physics_variables.pden_charged_particle_mw = 0.0 physics_variables.pcoef = 0.0 diff --git a/source/fortran/physics_variables.f90 b/source/fortran/physics_variables.f90 index 23798f24b2..3e4dc570b1 100644 --- a/source/fortran/physics_variables.f90 +++ b/source/fortran/physics_variables.f90 @@ -606,6 +606,9 @@ module physics_variables real(dp) :: p_beam_alpha_mw !! alpha power from hot neutral beam ions (MW) + real(dp) :: p_beam_neutron_mw + !! neutron power from hot neutral beam ions (MW) + real(dp) :: p_non_alpha_charged_mw !! non-alpha charged particle fusion power (MW) From 7ab0f3a56c4a41a0ec54fd840c6429b013e7fa0e Mon Sep 17 00:00:00 2001 From: mn3981 Date: Fri, 9 May 2025 11:08:48 +0100 Subject: [PATCH 31/37] :bug: Make p_beam_neutron calculation use proper ratios --- process/physics.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/process/physics.py b/process/physics.py index 46e8308de3..42f2e9160f 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2159,6 +2159,10 @@ def physics(self): + (1.0 / (1.0 - constants.dt_neutron_energy_fraction)) * physics_variables.p_beam_alpha_mw ) + physics_variables.p_beam_neutron_mw = physics_variables.p_beam_alpha_mw * ( + constants.dt_neutron_energy_fraction + / (1 - constants.dt_neutron_energy_fraction) + ) else: # If no beams present then the total alpha rates and power are the same as the plasma values physics_variables.fusden_total = physics_variables.fusden_plasma @@ -4800,7 +4804,7 @@ def outplas(self): self.outfile, "Neutron power: beam-plasma (MW)", "(p_beam_neutron_mw)", - physics_variables.p_beam_alpha_mw * 4.0e0, + physics_variables.p_beam_neutron_mw, "OP ", ) po.osubhd(self.outfile, "Charged Particle Powers :") From bd7287aa16f715ac715e25c744cba4b1c80d1f4c Mon Sep 17 00:00:00 2001 From: mn3981 Date: Fri, 9 May 2025 11:43:14 +0100 Subject: [PATCH 32/37] Update test files with new variables --- examples/data/large_tokamak_IN.DAT | 4 ++-- examples/data/scan_MFILE.DAT | 2 +- examples/data/scan_example_file_IN.DAT | 4 ++-- tests/integration/data/large_tokamak_1_MFILE.DAT | 4 ++-- tests/integration/data/large_tokamak_2_MFILE.DAT | 4 ++-- tests/integration/data/large_tokamak_3_MFILE.DAT | 4 ++-- tests/integration/data/large_tokamak_4_MFILE.DAT | 4 ++-- tests/integration/data/large_tokamak_IN.DAT | 4 ++-- tests/integration/data/large_tokamak_MFILE.DAT | 4 ++-- tests/integration/data/large_tokamak_once_through.IN.DAT | 2 +- tests/integration/data/ref_IN.DAT | 2 +- tests/integration/data/scan_2D_MFILE.DAT | 2 +- tests/integration/data/scan_MFILE.DAT | 2 +- tests/integration/data/uncertainties_nonopt_ref_IN.DAT | 2 +- tests/integration/data/uncertainties_ref_IN.DAT | 2 +- tests/unit/data/large_tokamak_IN.DAT | 4 ++-- tests/unit/data/large_tokamak_MFILE.DAT | 4 ++-- 17 files changed, 27 insertions(+), 27 deletions(-) diff --git a/examples/data/large_tokamak_IN.DAT b/examples/data/large_tokamak_IN.DAT index dec3ebf50e..96d6047b34 100644 --- a/examples/data/large_tokamak_IN.DAT +++ b/examples/data/large_tokamak_IN.DAT @@ -56,9 +56,9 @@ walalw = 2.0 *--------------------------* icc = 9 -ixc = 26 * ffuspow +ixc = 26 * fp_fusion_total_max_mw * Maximum allowable value fusion power [MW] -powfmax = 3000 +p_fusion_total_max_mw = 3000 * Burn time lower limit * *-----------------------* diff --git a/examples/data/scan_MFILE.DAT b/examples/data/scan_MFILE.DAT index 7a559cf5e8..780d47bd1d 100644 --- a/examples/data/scan_MFILE.DAT +++ b/examples/data/scan_MFILE.DAT @@ -9105,7 +9105,7 @@ dr_shld_blkt_gap = 0.02 * gap between vacuum vessel and blanket (m) fbeta_max = 0.4815 * F-value for beta limit fdene = 1.2 * F-value for density limit -ffuspow = 1 * F-value for maximum fusion power +fp_fusion_total_max_mw = 1 * F-value for maximum fusion power fjohc = 0.25 * F-value for central solenoid current at end-of-flattop fjohc0 = 0.25 * F-value for central solenoid current at beginning of pulse fjprot = 1.0 * F-value for tf coil winding pack current density diff --git a/examples/data/scan_example_file_IN.DAT b/examples/data/scan_example_file_IN.DAT index 839fd174b4..83628bd96d 100644 --- a/examples/data/scan_example_file_IN.DAT +++ b/examples/data/scan_example_file_IN.DAT @@ -56,9 +56,9 @@ walalw = 2.0 *--------------------------* icc = 9 -ixc = 26 * ffuspow +ixc = 26 * fp_fusion_total_max_mw * Maximum allowable value fusion power [MW] -powfmax = 3000 +p_fusion_total_max_mw = 3000 * Burn time lower limit * *-----------------------* diff --git a/tests/integration/data/large_tokamak_1_MFILE.DAT b/tests/integration/data/large_tokamak_1_MFILE.DAT index a74141c2dd..74da7f7de7 100644 --- a/tests/integration/data/large_tokamak_1_MFILE.DAT +++ b/tests/integration/data/large_tokamak_1_MFILE.DAT @@ -1243,9 +1243,9 @@ walalw = 2.0 *--------------------------* icc = 9 -ixc = 26 * ffuspow +ixc = 26 * fp_fusion_total_max_mw * Maximum allowable value fusion power [MW] -powfmax = 3000 +p_fusion_total_max_mw = 3000 * Burn time lower limit * *-----------------------* diff --git a/tests/integration/data/large_tokamak_2_MFILE.DAT b/tests/integration/data/large_tokamak_2_MFILE.DAT index 1587735c27..96fae99f6f 100644 --- a/tests/integration/data/large_tokamak_2_MFILE.DAT +++ b/tests/integration/data/large_tokamak_2_MFILE.DAT @@ -1244,9 +1244,9 @@ walalw = 2.0 *--------------------------* icc = 9 -ixc = 26 * ffuspow +ixc = 26 * fp_fusion_total_max_mw * Maximum allowable value fusion power [MW] -powfmax = 3000 +p_fusion_total_max_mw = 3000 * Burn time lower limit * *-----------------------* diff --git a/tests/integration/data/large_tokamak_3_MFILE.DAT b/tests/integration/data/large_tokamak_3_MFILE.DAT index ef1c362010..3709c4cf01 100644 --- a/tests/integration/data/large_tokamak_3_MFILE.DAT +++ b/tests/integration/data/large_tokamak_3_MFILE.DAT @@ -1244,9 +1244,9 @@ walalw = 2.0 *--------------------------* icc = 9 -ixc = 26 * ffuspow +ixc = 26 * fp_fusion_total_max_mw * Maximum allowable value fusion power [MW] -powfmax = 3000 +p_fusion_total_max_mw = 3000 * Burn time lower limit * *-----------------------* diff --git a/tests/integration/data/large_tokamak_4_MFILE.DAT b/tests/integration/data/large_tokamak_4_MFILE.DAT index f130c0202e..bc91dfeda5 100644 --- a/tests/integration/data/large_tokamak_4_MFILE.DAT +++ b/tests/integration/data/large_tokamak_4_MFILE.DAT @@ -1244,9 +1244,9 @@ walalw = 2.0 *--------------------------* icc = 9 -ixc = 26 * ffuspow +ixc = 26 * fp_fusion_total_max_mw * Maximum allowable value fusion power [MW] -powfmax = 3000 +p_fusion_total_max_mw = 3000 * Burn time lower limit * *-----------------------* diff --git a/tests/integration/data/large_tokamak_IN.DAT b/tests/integration/data/large_tokamak_IN.DAT index b0e9513f9c..37191ac411 100644 --- a/tests/integration/data/large_tokamak_IN.DAT +++ b/tests/integration/data/large_tokamak_IN.DAT @@ -56,9 +56,9 @@ walalw = 2.0 *--------------------------* icc = 9 -ixc = 26 * ffuspow +ixc = 26 * fp_fusion_total_max_mw * Maximum allowable value fusion power [MW] -powfmax = 3000 +p_fusion_total_max_mw = 3000 * Burn time lower limit * *-----------------------* diff --git a/tests/integration/data/large_tokamak_MFILE.DAT b/tests/integration/data/large_tokamak_MFILE.DAT index cf3a7fc052..90385d5032 100644 --- a/tests/integration/data/large_tokamak_MFILE.DAT +++ b/tests/integration/data/large_tokamak_MFILE.DAT @@ -1247,9 +1247,9 @@ walalw = 2.0 *--------------------------* icc = 9 -ixc = 26 * ffuspow +ixc = 26 * fp_fusion_total_max_mw * Maximum allowable value fusion power [MW] -powfmax = 3000 +p_fusion_total_max_mw = 3000 * Burn time lower limit * *-----------------------* diff --git a/tests/integration/data/large_tokamak_once_through.IN.DAT b/tests/integration/data/large_tokamak_once_through.IN.DAT index 963822480b..69bb27f60a 100644 --- a/tests/integration/data/large_tokamak_once_through.IN.DAT +++ b/tests/integration/data/large_tokamak_once_through.IN.DAT @@ -139,7 +139,7 @@ fmaxvvstress = 1.0 * f-value for maximum permitted stress of the VV fvdump = 1.0 * f-value for dump voltage (`constraint equation 34`; `iteration variable 51`) fwalld = 1.0 * f-value for maximum wall load (`constraint equation 8`; `iteration variable 14`) pnetelin = 400.0 * required net electric power (MW) (`constraint equation 16`) -powfmax = 3000 * maximum fusion power (MW) (`constraint equation 9`) +p_fusion_total_max_mw = 3000 * maximum fusion power (MW) (`constraint equation 9`) psepbqarmax = 10.0 * maximum ratio of Psep*Bt/qAR (MWT/m) (`constraint equation 68`) t_burn_min = 7200.0 * minimum burn time (s) (KE - no longer itv;; see issue #706) walalw = 2.0 * allowable neutron wall-load (MW/m2) (`constraint equation 8`) diff --git a/tests/integration/data/ref_IN.DAT b/tests/integration/data/ref_IN.DAT index dd8649e812..146a36a355 100644 --- a/tests/integration/data/ref_IN.DAT +++ b/tests/integration/data/ref_IN.DAT @@ -126,7 +126,7 @@ dr_shld_blkt_gap = 0.02 * gap between vacuum vessel and blanket (m) fbeta_max = 0.4815 * F-value for beta limit fdene = 1.2 * F-value for density limit -ffuspow = 1 * F-value for maximum fusion power +fp_fusion_total_max_mw = 1 * F-value for maximum fusion power fjohc = 0.25 * F-value for central solenoid current at end-of-flattop fjohc0 = 0.25 * F-value for central solenoid current at beginning of pulse fjprot = 1.0 * F-value for tf coil winding pack current density diff --git a/tests/integration/data/scan_2D_MFILE.DAT b/tests/integration/data/scan_2D_MFILE.DAT index d9055f62c3..1e9b97645e 100644 --- a/tests/integration/data/scan_2D_MFILE.DAT +++ b/tests/integration/data/scan_2D_MFILE.DAT @@ -17537,7 +17537,7 @@ walalw = 2.0 *--------------------------* icc = 9 -ixc = 26 * ffuspow +ixc = 26 * fp_fusion_total_max_mw boundl(26) = 0.01 boundu(26) = 2.0 * Maximum allowable value fusion power [MW] diff --git a/tests/integration/data/scan_MFILE.DAT b/tests/integration/data/scan_MFILE.DAT index 41d9412fd4..fde2dd12d9 100644 --- a/tests/integration/data/scan_MFILE.DAT +++ b/tests/integration/data/scan_MFILE.DAT @@ -9105,7 +9105,7 @@ dr_shld_blkt_gap = 0.02 * gap between vacuum vessel and blanket (m) fbeta_max = 0.4815 * F-value for beta limit fdene = 1.2 * F-value for density limit -ffuspow = 1 * F-value for maximum fusion power +fp_fusion_total_max_mw = 1 * F-value for maximum fusion power fjohc = 0.25 * F-value for central solenoid current at end-of-flattop fjohc0 = 0.25 * F-value for central solenoid current at beginning of pulse fjprot = 1.0 * F-value for tf coil winding pack current density diff --git a/tests/integration/data/uncertainties_nonopt_ref_IN.DAT b/tests/integration/data/uncertainties_nonopt_ref_IN.DAT index 7557788126..4988a38c39 100644 --- a/tests/integration/data/uncertainties_nonopt_ref_IN.DAT +++ b/tests/integration/data/uncertainties_nonopt_ref_IN.DAT @@ -126,7 +126,7 @@ dr_shld_blkt_gap = 0.02 * gap between vacuum vessel and blanket (m) fbeta_max = 0.4815 * F-value for beta limit fdene = 1.2 * F-value for density limit -ffuspow = 1 * F-value for maximum fusion power +fp_fusion_total_max_mw = 1 * F-value for maximum fusion power fjohc = 0.25 * F-value for central solenoid current at end-of-flattop fjohc0 = 0.25 * F-value for central solenoid current at beginning of pulse fjprot = 1.0 * F-value for tf coil winding pack current density diff --git a/tests/integration/data/uncertainties_ref_IN.DAT b/tests/integration/data/uncertainties_ref_IN.DAT index f71e76d536..9961a8f970 100644 --- a/tests/integration/data/uncertainties_ref_IN.DAT +++ b/tests/integration/data/uncertainties_ref_IN.DAT @@ -126,7 +126,7 @@ dr_shld_blkt_gap = 0.02 * gap between vacuum vessel and blanket (m) fbeta_max = 0.4815 * F-value for beta limit fdene = 1.2 * F-value for density limit -ffuspow = 1 * F-value for maximum fusion power +fp_fusion_total_max_mw = 1 * F-value for maximum fusion power fjohc = 0.25 * F-value for central solenoid current at end-of-flattop fjohc0 = 0.25 * F-value for central solenoid current at beginning of pulse fjprot = 1.0 * F-value for tf coil winding pack current density diff --git a/tests/unit/data/large_tokamak_IN.DAT b/tests/unit/data/large_tokamak_IN.DAT index e283782208..917496df30 100644 --- a/tests/unit/data/large_tokamak_IN.DAT +++ b/tests/unit/data/large_tokamak_IN.DAT @@ -56,9 +56,9 @@ walalw = 2.0 *--------------------------* icc = 9 -ixc = 26 * ffuspow +ixc = 26 * fp_fusion_total_max_mw * Maximum allowable value fusion power [MW] -powfmax = 3000 +p_fusion_total_max_mw = 3000 * Burn time lower limit * *-----------------------* diff --git a/tests/unit/data/large_tokamak_MFILE.DAT b/tests/unit/data/large_tokamak_MFILE.DAT index 120a8855df..f98e6d538f 100644 --- a/tests/unit/data/large_tokamak_MFILE.DAT +++ b/tests/unit/data/large_tokamak_MFILE.DAT @@ -1247,9 +1247,9 @@ walalw = 2.0 *--------------------------* icc = 9 -ixc = 26 * ffuspow +ixc = 26 * fp_fusion_total_max_mw * Maximum allowable value fusion power [MW] -powfmax = 3000 +p_fusion_total_max_mw = 3000 * Burn time lower limit * *-----------------------* From 5427881587de176bb856960f38cefae9fdbed69e Mon Sep 17 00:00:00 2001 From: mn3981 Date: Fri, 9 May 2025 13:57:30 +0100 Subject: [PATCH 33/37] :memo: update output with new variables --- process/physics.py | 56 +++++++++++++++++++--------- source/fortran/physics_variables.f90 | 8 +++- 2 files changed, 46 insertions(+), 18 deletions(-) diff --git a/process/physics.py b/process/physics.py index 42f2e9160f..c6be4f5d31 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2163,12 +2163,19 @@ def physics(self): constants.dt_neutron_energy_fraction / (1 - constants.dt_neutron_energy_fraction) ) + physics_variables.p_beam_dt_mw = physics_variables.p_beam_alpha_mw * ( + 1 / (1 - constants.dt_neutron_energy_fraction) + ) else: # If no beams present then the total alpha rates and power are the same as the plasma values physics_variables.fusden_total = physics_variables.fusden_plasma physics_variables.fusden_alpha_total = physics_variables.fusden_plasma_alpha physics_variables.p_dt_total_mw = physics_variables.p_plasma_dt_mw + physics_variables.fusrat_total = ( + physics_variables.fusden_total * physics_variables.vol_plasma + ) + # Create some derived values and add beam contribution to fusion power ( physics_variables.pden_neutron_total_mw, @@ -4644,6 +4651,8 @@ def outplas(self): "(f_helium3)", physics_variables.f_helium3, ) + po.oblnkl(self.outfile) + po.ocmmnt(self.outfile, "----------------------------") po.osubhd(self.outfile, "Fusion Powers :") po.ocmmnt( @@ -4660,16 +4669,23 @@ def outplas(self): ) po.ovarre( self.outfile, - "Fusion rate density: total (particles/m3/sec)", + "Fusion rate: total (reactions/sec)", + "(fusrat_total)", + physics_variables.fusrat_total, + "OP ", + ) + po.ovarre( + self.outfile, + "Fusion rate density: total (reactions/m3/sec)", "(fusden_total)", physics_variables.fusden_total, "OP ", ) po.ovarre( self.outfile, - "Fusion rate density: plasma (particles/m3/sec)", + "Fusion rate density: plasma (reactions/m3/sec)", "(fusden_plasma)", - physics_variables.fusden_total, + physics_variables.fusden_plasma, "OP ", ) po.ovarre( @@ -4686,6 +4702,13 @@ def outplas(self): physics_variables.p_plasma_dt_mw, "OP ", ) + po.ovarre( + self.outfile, + "D-T fusion power: beam (MW)", + "(p_beam_dt_mw)", + physics_variables.p_beam_dt_mw, + "OP ", + ) po.ovarre( self.outfile, "D-D fusion power (MW)", @@ -4707,6 +4730,9 @@ def outplas(self): physics_variables.p_dhe3_total_mw, "OP ", ) + + po.oblnkl(self.outfile) + po.ocmmnt(self.outfile, "----------------------------") po.osubhd(self.outfile, "Alpha Powers :") po.ovarre( self.outfile, @@ -4771,6 +4797,9 @@ def outplas(self): physics_variables.f_pden_alpha_ions_mw, "OP ", ) + + po.oblnkl(self.outfile) + po.ocmmnt(self.outfile, "----------------------------") po.osubhd(self.outfile, "Neutron Powers :") po.ovarre( self.outfile, @@ -4807,10 +4836,14 @@ def outplas(self): physics_variables.p_beam_neutron_mw, "OP ", ) + po.oblnkl(self.outfile) + po.ocmmnt(self.outfile, "----------------------------") + po.osubhd(self.outfile, "Charged Particle Powers :") + po.ovarre( self.outfile, - "Charged particle power (excluding alphas) (MW)", + "Charged particle power (p, 3He, T) (excluding alphas) (MW)", "(p_non_alpha_charged_mw)", physics_variables.p_non_alpha_charged_mw, "OP ", @@ -4822,19 +4855,6 @@ def outplas(self): physics_variables.p_charged_particle_mw, "OP ", ) - p_plasma_heating_total_mw = ( - physics_variables.f_alpha_plasma * physics_variables.p_alpha_total_mw - + physics_variables.p_non_alpha_charged_mw - + physics_variables.p_plasma_ohmic_mw - + current_drive_variables.p_hcd_injected_total_mw - ) - po.ovarre( - self.outfile, - "Total power deposited in plasma (MW)", - "(p_plasma_heating_total_mw)", - p_plasma_heating_total_mw, - "OP ", - ) po.oblnkl(self.outfile) po.ostars(self.outfile, 110) @@ -8308,6 +8328,7 @@ def init_physics_variables(): physics_variables.fne0 = 1.0 physics_variables.f_tritium = 0.5 physics_variables.fusden_total = 0.0 + physics_variables.fusrat_total = 0.0 physics_variables.fusden_plasma = 0.0 physics_variables.f_c_plasma_non_inductive = 1.0 physics_variables.ejima_coeff = 0.4 @@ -8363,6 +8384,7 @@ def init_physics_variables(): physics_variables.p_plasma_alpha_mw = 0.0 physics_variables.p_beam_alpha_mw = 0.0 physics_variables.p_beam_neutron_mw = 0.0 + physics_variables.p_beam_dt_mw = 0.0 physics_variables.p_non_alpha_charged_mw = 0.0 physics_variables.pden_charged_particle_mw = 0.0 physics_variables.pcoef = 0.0 diff --git a/source/fortran/physics_variables.f90 b/source/fortran/physics_variables.f90 index 3e4dc570b1..f920c3a2fa 100644 --- a/source/fortran/physics_variables.f90 +++ b/source/fortran/physics_variables.f90 @@ -282,7 +282,10 @@ module physics_variables !! tritium fuel fraction real(dp) :: fusden_total - !! fusion reaction rate, from beams and plasma (reactions/m3/sec) + !! fusion reaction rate density, from beams and plasma (reactions/m3/sec) + + real(dp) :: fusrat_total + !! fusion reaction rate, from beams and plasma (reactions/sec) real(dp) :: fusden_plasma !! fusion reaction rate, just from plasma (reactions/m3/sec) @@ -609,6 +612,9 @@ module physics_variables real(dp) :: p_beam_neutron_mw !! neutron power from hot neutral beam ions (MW) + real(dp) :: p_beam_dt_mw + !! D-T fusion power from hot neutral beam ions (MW) + real(dp) :: p_non_alpha_charged_mw !! non-alpha charged particle fusion power (MW) From e0ab86402afd2e60b5fc3e0f0efafcbb32f248b7 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Fri, 9 May 2025 14:05:33 +0100 Subject: [PATCH 34/37] :bug: Rename pden_charged_particle_mw to pden_non_alpha_charged_mw across multiple files for clarity and consistency --- .../proc-pages/physics-models/error.txt | 6 +-- .../fusion_reactions/plasma_reactions.md | 6 +-- process/fusion_reactions.py | 42 ++++++++-------- process/physics.py | 48 ++++++++++++------- process/stellarator.py | 2 +- source/fortran/constraint_equations.f90 | 14 +++--- source/fortran/physics_variables.f90 | 2 +- tests/unit/test_fusion_reactions.py | 12 ++--- 8 files changed, 72 insertions(+), 60 deletions(-) diff --git a/documentation/proc-pages/physics-models/error.txt b/documentation/proc-pages/physics-models/error.txt index 948ec3f293..31d9d631e0 100644 --- a/documentation/proc-pages/physics-models/error.txt +++ b/documentation/proc-pages/physics-models/error.txt @@ -994,18 +994,18 @@ is derived directly from the energy confinement scaling law. \texttt{i_rad_loss\ =\ 0} -- Total power lost is scaling power plus radiation -\texttt{pscaling\ +\ pden_plasma_rad_mw\ =\ f_alpha_plasma*alpha_power_density\ +\ pden_charged_particle_mw\ +\ pden_plasma_ohmic_mw\ +\ p_hcd_injected_total_mw/vol_plasma} +\texttt{pscaling\ +\ pden_plasma_rad_mw\ =\ f_alpha_plasma*alpha_power_density\ +\ pden_non_alpha_charged_mw\ +\ pden_plasma_ohmic_mw\ +\ p_hcd_injected_total_mw/vol_plasma} \texttt{i_rad_loss\ =\ 1} -- Total power lost is scaling power plus core radiation only -\texttt{pscaling\ +\ pden_plasma_core_rad_mw\ =\ f_alpha_plasma*alpha_power_density\ +\ pden_charged_particle_mw\ +\ pden_plasma_ohmic_mw\ +\ p_hcd_injected_total_mw/vol_plasma} +\texttt{pscaling\ +\ pden_plasma_core_rad_mw\ =\ f_alpha_plasma*alpha_power_density\ +\ pden_non_alpha_charged_mw\ +\ pden_plasma_ohmic_mw\ +\ p_hcd_injected_total_mw/vol_plasma} \texttt{i_rad_loss\ =\ 2} -- Total power lost is scaling power only, with no additional allowance for radiation. This is not recommended for power plant models. -\texttt{pscaling\ =\ f_alpha_plasma*alpha_power_density\ +\ pden_charged_particle_mw\ +\ pden_plasma_ohmic_mw\ +\ p_hcd_injected_total_mw/vol_plasma} +\texttt{pscaling\ =\ f_alpha_plasma*alpha_power_density\ +\ pden_non_alpha_charged_mw\ +\ pden_plasma_ohmic_mw\ +\ p_hcd_injected_total_mw/vol_plasma} \subsection{Plasma Core Power Balance}\label{plasma-core-power-balance} diff --git a/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md b/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md index 63f828da40..b6eaf6a144 100644 --- a/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md +++ b/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md @@ -84,7 +84,7 @@ Initialize the FusionReactionRate class with the given plasma profile. - `dd_power_density (float)`: Fusion power density produced by the D-D reactions. - `dt_power_density (float)`: Fusion power density produced by the D-T reaction. - `alpha_power_density (float)`: Power density of alpha particles produced. -- `pden_charged_particle_mw (float)`: Power density of charged particles produced. +- `pden_non_alpha_charged_mw (float)`: Power density of charged particles produced. - `neutron_power_density (float)`: Power density of neutrons produced. - `fusion_rate_density (float)`: Fusion reaction rate density. - `alpha_rate_density (float)`: Alpha particle production rate density. @@ -137,7 +137,7 @@ The method updates the following attributes: - `self.sigmav_dt_average`: Average fusion reaction rate `` for D-T. - `self.dt_power_density`: Fusion power density produced by the D-T reaction. - `self.alpha_power_density`: Power density of alpha particles produced. -- `self.pden_charged_particle_mw`: Power density of charged particles produced. +- `self.pden_non_alpha_charged_mw`: Power density of charged particles produced. - `self.neutron_power_density`: Power density of neutrons produced. - `self.fusion_rate_density`: Fusion reaction rate density. - `self.alpha_rate_density`: Alpha particle production rate density. @@ -181,7 +181,7 @@ This method sets the required physics variables in the `physics_variables` and ` #### Updates: - `physics_variables.pden_plasma_alpha_mw`: Updated with `self.alpha_power_density` -- `physics_variables.pden_charged_particle_mw`: Updated with `self.pden_charged_particle_mw` +- `physics_variables.pden_non_alpha_charged_mw`: Updated with `self.pden_non_alpha_charged_mw` - `physics_variables.pden_plasma_neutron_mw`: Updated with `self.neutron_power_density` - `physics_variables.fusden_plasma`: Updated with `self.fusion_rate_density` - `physics_variables.fusden_plasma_alpha`: Updated with `self.alpha_rate_density` diff --git a/process/fusion_reactions.py b/process/fusion_reactions.py index f1d7a6c27e..75caf16172 100644 --- a/process/fusion_reactions.py +++ b/process/fusion_reactions.py @@ -82,7 +82,7 @@ class FusionReactionRate: dd_power_density (float): Fusion power density produced by the D-D reactions. dt_power_density (float): Fusion power density produced by the D-T reaction. alpha_power_density (float): Power density of alpha particles produced. - pden_charged_particle_mw (float): Power density of charged particles produced. + pden_non_alpha_charged_mw (float): Power density of charged particles produced. neutron_power_density (float): Power density of neutrons produced. fusion_rate_density (float): Fusion reaction rate density. alpha_rate_density (float): Alpha particle production rate density. @@ -135,7 +135,7 @@ def __init__(self, plasma_profile: PlasmaProfile) -> None: dd_power_density (float): Fusion power density produced by the D-D reactions. dt_power_density (float): Fusion power density produced by the D-T reaction. alpha_power_density (float): Power density of alpha particles produced. - pden_charged_particle_mw (float): Power density of charged particles produced. + pden_non_alpha_charged_mw (float): Power density of charged particles produced. neutron_power_density (float): Power density of neutrons produced. fusion_rate_density (float): Fusion reaction rate density. alpha_rate_density (float): Alpha particle production rate density. @@ -148,7 +148,7 @@ def __init__(self, plasma_profile: PlasmaProfile) -> None: self.dd_power_density = 0.0 self.dt_power_density = 0.0 self.alpha_power_density = 0.0 - self.pden_charged_particle_mw = 0.0 + self.pden_non_alpha_charged_mw = 0.0 self.neutron_power_density = 0.0 self.fusion_rate_density = 0.0 self.alpha_rate_density = 0.0 @@ -197,7 +197,7 @@ def dt_reaction(self) -> None: - self.sigmav_dt_average: Average fusion reaction rate for D-T. - self.dt_power_density: Fusion power density produced by the D-T reaction. - self.alpha_power_density: Power density of alpha particles produced. - - self.pden_charged_particle_mw: Power density of charged particles produced. + - self.pden_non_alpha_charged_mw: Power density of charged particles produced. - self.neutron_power_density: Power density of neutrons produced. - self.fusion_rate_density: Fusion reaction rate density. - self.alpha_rate_density: Alpha particle production rate density. @@ -235,7 +235,7 @@ def dt_reaction(self) -> None: alpha_power_density = ( 1.0 - constants.dt_neutron_energy_fraction ) * fusion_power_density - pden_charged_particle_mw = 0.0 + pden_non_alpha_charged_mw = 0.0 neutron_power_density = ( constants.dt_neutron_energy_fraction * fusion_power_density ) @@ -251,7 +251,7 @@ def dt_reaction(self) -> None: # Sum the fusion rates for all particles self.sum_fusion_rates( alpha_power_density, - pden_charged_particle_mw, + pden_non_alpha_charged_mw, neutron_power_density, fusion_rate_density, alpha_rate_density, @@ -269,7 +269,7 @@ def dhe3_reaction(self) -> None: The method updates the following attributes: - self.dhe3_power_density: Fusion power density produced by the D-3He reaction. - self.alpha_power_density: Power density of alpha particles produced. - - self.pden_charged_particle_mw: Power density of charged particles produced. + - self.pden_non_alpha_charged_mw: Power density of charged particles produced. - self.neutron_power_density: Power density of neutrons produced. - self.fusion_rate_density: Fusion reaction rate density. - self.alpha_rate_density: Alpha particle production rate density. @@ -304,7 +304,7 @@ def dhe3_reaction(self) -> None: alpha_power_density = ( 1.0 - constants.dhelium_proton_energy_fraction ) * fusion_power_density - pden_charged_particle_mw = ( + pden_non_alpha_charged_mw = ( constants.dhelium_proton_energy_fraction * fusion_power_density ) neutron_power_density = 0.0 @@ -320,7 +320,7 @@ def dhe3_reaction(self) -> None: # Sum the fusion rates for all particles self.sum_fusion_rates( alpha_power_density, - pden_charged_particle_mw, + pden_non_alpha_charged_mw, neutron_power_density, fusion_rate_density, alpha_rate_density, @@ -339,7 +339,7 @@ def dd_helion_reaction(self) -> None: The method updates the following attributes: - self.dd_power_density: Fusion power density produced by the D-D reaction. - self.alpha_power_density: Power density of alpha particles produced. - - self.pden_charged_particle_mw: Power density of charged particles produced. + - self.pden_non_alpha_charged_mw: Power density of charged particles produced. - self.neutron_power_density: Power density of neutrons produced. - self.fusion_rate_density: Fusion reaction rate density. - self.alpha_rate_density: Alpha particle production rate density. @@ -375,7 +375,7 @@ def dd_helion_reaction(self) -> None: # Power densities for different particles [MW/m^3] # Neutron particle gets approximately 75% of the fusion power alpha_power_density = 0.0 - pden_charged_particle_mw = ( + pden_non_alpha_charged_mw = ( 1.0 - constants.dd_neutron_energy_fraction ) * fusion_power_density neutron_power_density = ( @@ -393,7 +393,7 @@ def dd_helion_reaction(self) -> None: # Sum the fusion rates for all particles self.sum_fusion_rates( alpha_power_density, - pden_charged_particle_mw, + pden_non_alpha_charged_mw, neutron_power_density, fusion_rate_density, alpha_rate_density, @@ -412,7 +412,7 @@ def dd_triton_reaction(self) -> None: The method updates the following attributes: - self.dd_power_density: Fusion power density produced by the D-D reaction. - self.alpha_power_density: Power density of alpha particles produced. - - self.pden_charged_particle_mw: Power density of charged particles produced. + - self.pden_non_alpha_charged_mw: Power density of charged particles produced. - self.neutron_power_density: Power density of neutrons produced. - self.fusion_rate_density: Fusion reaction rate density. - self.alpha_rate_density: Alpha particle production rate density. @@ -447,7 +447,7 @@ def dd_triton_reaction(self) -> None: # Power densities for different particles [MW/m^3] alpha_power_density = 0.0 - pden_charged_particle_mw = fusion_power_density + pden_non_alpha_charged_mw = fusion_power_density neutron_power_density = 0.0 # Calculate the fusion rate density [reactions/m^3/second] @@ -461,7 +461,7 @@ def dd_triton_reaction(self) -> None: # Sum the fusion rates for all particles self.sum_fusion_rates( alpha_power_density, - pden_charged_particle_mw, + pden_non_alpha_charged_mw, neutron_power_density, fusion_rate_density, alpha_rate_density, @@ -494,7 +494,7 @@ def sum_fusion_rates( None """ self.alpha_power_density += alpha_power_add - self.pden_charged_particle_mw += charged_power_add + self.pden_non_alpha_charged_mw += charged_power_add self.neutron_power_density += neutron_power_add self.fusion_rate_density += fusion_rate_add self.alpha_rate_density += alpha_rate_add @@ -533,7 +533,7 @@ def set_physics_variables(self) -> None: None """ physics_variables.pden_plasma_alpha_mw = self.alpha_power_density - physics_variables.pden_charged_particle_mw = self.pden_charged_particle_mw + physics_variables.pden_non_alpha_charged_mw = self.pden_non_alpha_charged_mw physics_variables.pden_plasma_neutron_mw = self.neutron_power_density physics_variables.fusden_plasma = self.fusion_rate_density physics_variables.fusden_plasma_alpha = self.alpha_rate_density @@ -683,7 +683,7 @@ def set_fusion_powers( f_alpha_electron: float, f_alpha_ion: float, p_beam_alpha_mw: float, - pden_charged_particle_mw: float, + pden_non_alpha_charged_mw: float, pden_plasma_neutron_mw: float, vol_plasma: float, pden_plasma_alpha_mw: float, @@ -696,7 +696,7 @@ def set_fusion_powers( f_alpha_electron (float): Fraction of alpha energy to electrons. f_alpha_ion (float): Fraction of alpha energy to ions. p_beam_alpha_mw (float): Alpha power from hot neutral beam ions (MW). - pden_charged_particle_mw (float): Other charged particle fusion power per unit volume (MW/m^3). + pden_non_alpha_charged_mw (float): Other charged particle fusion power per unit volume (MW/m^3). pden_plasma_neutron_mw (float): Neutron fusion power per unit volume just from plasma (MW/m^3). vol_plasma (float): Plasma volume (m^3). pden_plasma_alpha_mw (float): Alpha power per unit volume just from plasma (MW/m^3). @@ -754,7 +754,7 @@ def set_fusion_powers( # Charged particle power # Total non-alpha charged particle power - p_non_alpha_charged_mw = pden_charged_particle_mw * vol_plasma + p_non_alpha_charged_mw = pden_non_alpha_charged_mw * vol_plasma # Charged particle fusion power p_charged_particle_mw = p_alpha_total_mw + p_non_alpha_charged_mw @@ -764,7 +764,7 @@ def set_fusion_powers( # Alpha power to electrons and ions (used with electron # and ion power balance equations only) - # No consideration of pden_charged_particle_mw here. + # No consideration of pden_non_alpha_charged_mw here. f_pden_alpha_ions_mw = ( physics_variables.f_alpha_plasma * pden_alpha_total_mw * f_alpha_ion ) diff --git a/process/physics.py b/process/physics.py index c6be4f5d31..9325ecde07 100644 --- a/process/physics.py +++ b/process/physics.py @@ -2193,7 +2193,7 @@ def physics(self): physics_variables.f_alpha_electron, physics_variables.f_alpha_ion, physics_variables.p_beam_alpha_mw, - physics_variables.pden_charged_particle_mw, + physics_variables.pden_non_alpha_charged_mw, physics_variables.pden_plasma_neutron_mw, physics_variables.vol_plasma, physics_variables.pden_plasma_alpha_mw, @@ -3040,7 +3040,7 @@ def plasma_composition() -> None: # Fraction of alpha energy to ions and electrons # From Max Fenstermacher # (used with electron and ion power balance equations only) - # No consideration of pden_charged_particle_mw here... + # No consideration of pden_non_alpha_charged_mw here... # pcoef now calculated in plasma_profiles, after the very first # call of plasma_composition; use old parabolic profile estimate @@ -4631,6 +4631,8 @@ def outplas(self): po.oblnkl(self.outfile) po.ostars(self.outfile, 110) po.oblnkl(self.outfile) + + po.oheadr(self.outfile, "Plasma Reactions :") po.osubhd(self.outfile, "Fuel Constituents :") po.ovarrf( @@ -4653,20 +4655,7 @@ def outplas(self): ) po.oblnkl(self.outfile) po.ocmmnt(self.outfile, "----------------------------") - - po.osubhd(self.outfile, "Fusion Powers :") - po.ocmmnt( - self.outfile, - "Fusion power totals from the main plasma and beam-plasma interactions (if present)\n", - ) - - po.ovarre( - self.outfile, - "Total fusion power (MW)", - "(p_fusion_total_mw)", - physics_variables.p_fusion_total_mw, - "OP ", - ) + po.osubhd(self.outfile, "Fusion rates :") po.ovarre( self.outfile, "Fusion rate: total (reactions/sec)", @@ -4688,6 +4677,22 @@ def outplas(self): physics_variables.fusden_plasma, "OP ", ) + + po.oblnkl(self.outfile) + po.ocmmnt(self.outfile, "----------------------------") + po.osubhd(self.outfile, "Fusion Powers :") + po.ocmmnt( + self.outfile, + "Fusion power totals from the main plasma and beam-plasma interactions (if present)\n", + ) + + po.ovarre( + self.outfile, + "Total fusion power (MW)", + "(p_fusion_total_mw)", + physics_variables.p_fusion_total_mw, + "OP ", + ) po.ovarre( self.outfile, "D-T fusion power: total (MW)", @@ -4848,6 +4853,13 @@ def outplas(self): physics_variables.p_non_alpha_charged_mw, "OP ", ) + po.ovarre( + self.outfile, + "Charged particle power density (p, 3He, T) (excluding alphas) (MW)", + "(pden_non_alpha_charged_mw)", + physics_variables.pden_non_alpha_charged_mw, + "OP ", + ) po.ovarre( self.outfile, "Total charged particle power (including alphas) (MW)", @@ -7069,7 +7081,7 @@ def fhz(hfact: float) -> float: + ptriz - physics_variables.f_alpha_plasma * physics_variables.pden_alpha_total_mw - - physics_variables.pden_charged_particle_mw + - physics_variables.pden_non_alpha_charged_mw - physics_variables.pden_plasma_ohmic_mw ) @@ -8386,7 +8398,7 @@ def init_physics_variables(): physics_variables.p_beam_neutron_mw = 0.0 physics_variables.p_beam_dt_mw = 0.0 physics_variables.p_non_alpha_charged_mw = 0.0 - physics_variables.pden_charged_particle_mw = 0.0 + physics_variables.pden_non_alpha_charged_mw = 0.0 physics_variables.pcoef = 0.0 physics_variables.p_plasma_inner_rad_mw = 0.0 physics_variables.pden_plasma_core_rad_mw = 0.0 diff --git a/process/stellarator.py b/process/stellarator.py index 9b6e50e792..f97cf35cc1 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -4284,7 +4284,7 @@ def stphys(self, output): physics_variables.f_alpha_electron, physics_variables.f_alpha_ion, physics_variables.p_beam_alpha_mw, - physics_variables.pden_charged_particle_mw, + physics_variables.pden_non_alpha_charged_mw, physics_variables.pden_plasma_neutron_mw, physics_variables.vol_plasma, physics_variables.pden_plasma_alpha_mw, diff --git a/source/fortran/constraint_equations.f90 b/source/fortran/constraint_equations.f90 index 58455a29ed..c51db89f02 100755 --- a/source/fortran/constraint_equations.f90 +++ b/source/fortran/constraint_equations.f90 @@ -453,13 +453,13 @@ subroutine constraint_eqn_002(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units) !! pden_plasma_core_rad_mw : input real : total core radiation power per volume (MW/m3) !! f_alpha_plasma : input real : fraction of alpha power deposited in plasma !! pden_alpha_total_mw : input real : alpha power per volume (MW/m3) - !! pden_charged_particle_mw : input real : non-alpha charged particle fusion power per volume (MW/m3) + !! pden_non_alpha_charged_mw : input real : non-alpha charged particle fusion power per volume (MW/m3) !! pden_plasma_ohmic_mw : input real : ohmic heating power per volume (MW/m3) !! p_hcd_injected_total_mw : input real : total auxiliary injected power (MW) !! vol_plasma : input real : plasma volume (m3) use physics_variables, only: i_rad_loss, i_plasma_ignited, pden_electron_transport_loss_mw, pden_ion_transport_loss_mw, pden_plasma_rad_mw, & - pden_plasma_core_rad_mw, f_alpha_plasma, pden_alpha_total_mw, pden_charged_particle_mw, & + pden_plasma_core_rad_mw, f_alpha_plasma, pden_alpha_total_mw, pden_non_alpha_charged_mw, & pden_plasma_ohmic_mw, vol_plasma use current_drive_variables, only: p_hcd_injected_total_mw @@ -487,10 +487,10 @@ subroutine constraint_eqn_002(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units) ! if plasma not ignited include injected power if (i_plasma_ignited == 0) then - pdenom = f_alpha_plasma*pden_alpha_total_mw + pden_charged_particle_mw + pden_plasma_ohmic_mw + p_hcd_injected_total_mw/vol_plasma + pdenom = f_alpha_plasma*pden_alpha_total_mw + pden_non_alpha_charged_mw + pden_plasma_ohmic_mw + p_hcd_injected_total_mw/vol_plasma else ! if plasma ignited - pdenom = f_alpha_plasma*pden_alpha_total_mw + pden_charged_particle_mw + pden_plasma_ohmic_mw + pdenom = f_alpha_plasma*pden_alpha_total_mw + pden_non_alpha_charged_mw + pden_plasma_ohmic_mw end if tmp_cc = 1.0D0 - pnumerator / pdenom @@ -1031,11 +1031,11 @@ subroutine constraint_eqn_017(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units) !! p_hcd_injected_total_mw : input real : total auxiliary injected power (MW) !! vol_plasma : input real : plasma volume (m3) !! pden_alpha_total_mw : input real : alpha power per volume (MW/m3) - !! pden_charged_particle_mw : input real : non-alpha charged particle fusion power per volume (MW/m3) + !! pden_non_alpha_charged_mw : input real : non-alpha charged particle fusion power per volume (MW/m3) !! pden_plasma_ohmic_mw : input real : ohmic heating power per volume (MW/m3) !! fradpwr : input real : f-value for core radiation power limit !! pden_plasma_rad_mw : input real : total radiation power per volume (MW/m3) - use physics_variables, only: f_alpha_plasma, vol_plasma, pden_alpha_total_mw, pden_charged_particle_mw, pden_plasma_ohmic_mw, pden_plasma_rad_mw + use physics_variables, only: f_alpha_plasma, vol_plasma, pden_alpha_total_mw, pden_non_alpha_charged_mw, pden_plasma_ohmic_mw, pden_plasma_rad_mw use current_drive_variables, only: p_hcd_injected_total_mw use constraint_variables, only: fradpwr implicit none @@ -1048,7 +1048,7 @@ subroutine constraint_eqn_017(tmp_cc, tmp_con, tmp_err, tmp_symbol, tmp_units) real(dp) :: pradmaxpv !! Maximum possible power/vol_plasma that can be radiated (local) - pradmaxpv = p_hcd_injected_total_mw/vol_plasma + pden_alpha_total_mw*f_alpha_plasma + pden_charged_particle_mw + pden_plasma_ohmic_mw + pradmaxpv = p_hcd_injected_total_mw/vol_plasma + pden_alpha_total_mw*f_alpha_plasma + pden_non_alpha_charged_mw + pden_plasma_ohmic_mw tmp_cc = pden_plasma_rad_mw/pradmaxpv - 1.0D0 * fradpwr tmp_con = pradmaxpv * (1.0D0 - tmp_cc) tmp_err = pden_plasma_rad_mw * tmp_cc diff --git a/source/fortran/physics_variables.f90 b/source/fortran/physics_variables.f90 index f920c3a2fa..62710f5205 100644 --- a/source/fortran/physics_variables.f90 +++ b/source/fortran/physics_variables.f90 @@ -621,7 +621,7 @@ module physics_variables real(dp) :: p_charged_particle_mw !! Total charged particle fusion power [MW] - real(dp) :: pden_charged_particle_mw + real(dp) :: pden_non_alpha_charged_mw !! Non-alpha charged particle fusion power per volume [MW/m3] real(dp) :: pcoef diff --git a/tests/unit/test_fusion_reactions.py b/tests/unit/test_fusion_reactions.py index cb7be9db96..eba0fc8727 100644 --- a/tests/unit/test_fusion_reactions.py +++ b/tests/unit/test_fusion_reactions.py @@ -33,7 +33,7 @@ class SetFusionPowersParam(NamedTuple): p_beam_alpha_mw: Any = None - pden_charged_particle_mw: Any = None + pden_non_alpha_charged_mw: Any = None ten: Any = None @@ -75,7 +75,7 @@ class SetFusionPowersParam(NamedTuple): f_alpha_electron=0.68, f_alpha_ion=0.32, p_beam_alpha_mw=0, - pden_charged_particle_mw=0.00066, + pden_non_alpha_charged_mw=0.00066, vol_plasma=2426.25, pden_plasma_alpha_mw=0.163, pden_plasma_neutron_mw=0.654, @@ -95,7 +95,7 @@ class SetFusionPowersParam(NamedTuple): f_alpha_electron=0.68, f_alpha_ion=0.32, p_beam_alpha_mw=100.5, - pden_charged_particle_mw=0.00066, + pden_non_alpha_charged_mw=0.00066, vol_plasma=2426.25, pden_plasma_alpha_mw=0.163, pden_plasma_neutron_mw=0.654, @@ -115,7 +115,7 @@ class SetFusionPowersParam(NamedTuple): f_alpha_electron=0.68, f_alpha_ion=0.32, p_beam_alpha_mw=100.5, - pden_charged_particle_mw=0.00066, + pden_non_alpha_charged_mw=0.00066, vol_plasma=2426.25, pden_plasma_alpha_mw=0.163, pden_plasma_neutron_mw=0.654, @@ -135,7 +135,7 @@ class SetFusionPowersParam(NamedTuple): f_alpha_electron=0.68, f_alpha_ion=0.32, p_beam_alpha_mw=100.5, - pden_charged_particle_mw=0.00066, + pden_non_alpha_charged_mw=0.00066, vol_plasma=2426.25, pden_plasma_alpha_mw=0.163, pden_plasma_neutron_mw=0.654, @@ -182,7 +182,7 @@ def test_set_fusion_powers(setfusionpowersparam, monkeypatch): f_alpha_electron=setfusionpowersparam.f_alpha_electron, f_alpha_ion=setfusionpowersparam.f_alpha_ion, p_beam_alpha_mw=setfusionpowersparam.p_beam_alpha_mw, - pden_charged_particle_mw=setfusionpowersparam.pden_charged_particle_mw, + pden_non_alpha_charged_mw=setfusionpowersparam.pden_non_alpha_charged_mw, pden_plasma_neutron_mw=setfusionpowersparam.pden_plasma_neutron_mw, vol_plasma=setfusionpowersparam.vol_plasma, pden_plasma_alpha_mw=setfusionpowersparam.pden_plasma_alpha_mw, From 888c9707196ac4a97d55bccb36e1382f4e17c68a Mon Sep 17 00:00:00 2001 From: mn3981 Date: Fri, 9 May 2025 14:20:47 +0100 Subject: [PATCH 35/37] :memo: Add new obsolete variable mappings for fusion power in obsolete_vars.py --- process/io/obsolete_vars.py | 2 ++ process/physics.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/process/io/obsolete_vars.py b/process/io/obsolete_vars.py index bf20e2209d..92e9520801 100644 --- a/process/io/obsolete_vars.py +++ b/process/io/obsolete_vars.py @@ -328,6 +328,8 @@ "i_hldiv": "i_div_heat_load", "ignite": "i_plasma_ignited", "iprofile": None, + "powfmax": "p_fusion_total_max_mw", + "ffuspow": "fp_fusion_total_max_mw", } OBS_VARS_HELP = { diff --git a/process/physics.py b/process/physics.py index 9325ecde07..8b78a23f99 100644 --- a/process/physics.py +++ b/process/physics.py @@ -4631,7 +4631,7 @@ def outplas(self): po.oblnkl(self.outfile) po.ostars(self.outfile, 110) po.oblnkl(self.outfile) - + po.oheadr(self.outfile, "Plasma Reactions :") po.osubhd(self.outfile, "Fuel Constituents :") @@ -4677,7 +4677,7 @@ def outplas(self): physics_variables.fusden_plasma, "OP ", ) - + po.oblnkl(self.outfile) po.ocmmnt(self.outfile, "----------------------------") po.osubhd(self.outfile, "Fusion Powers :") From 5bd4fe7d73653667d123f30ac3b719cd895dd310 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Fri, 9 May 2025 14:43:48 +0100 Subject: [PATCH 36/37] Remove redundant statement about alpha power coupling in plasma heating --- .../physics-models/fusion_reactions/plasma_reactions.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md b/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md index b6eaf6a144..9034c36986 100644 --- a/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md +++ b/documentation/proc-pages/physics-models/fusion_reactions/plasma_reactions.md @@ -12,7 +12,7 @@ $$ Roughly 20% of the energy produced is given to the alpha particles (\(^4\)He). The remaining 80% is carried away by the neutrons, which deposit their energy within the blanket and shield and other reactor components. The fraction of the alpha energy deposited in the plasma is [`f_alpha_plasma`](#coupled-alpha-particle-power). -**`PROCESS` only assumes the alpha power produced is coupled to and self heats the plasma, other charged particles do not.** + PROCESS can also model D-\(^3\)He power plants, which utilise the following primary fusion reaction: @@ -79,7 +79,7 @@ Initialize the FusionReactionRate class with the given plasma profile. #### Attributes: - `plasma_profile (PlasmaProfile)`: The parameterized temperature and density profiles of the plasma. -- `sigmav_dt_average (float)`: Average fusion reaction rate $<\sigma v>$ for D-T. +- `sigmav_dt_average (float)`: Average fusion reaction rate $\langle \sigma v \rangle$ for D-T. - `dhe3_power_density (float)`: Fusion power density produced by the D-3He reaction. - `dd_power_density (float)`: Fusion power density produced by the D-D reactions. - `dt_power_density (float)`: Fusion power density produced by the D-T reaction. @@ -202,8 +202,6 @@ This method sets the required physics variables in the `physics_variables` and ` The fraction of alpha particle power produced by the plasma that gets coupled to the plasma for internal heating can be set in `PROCESS` with the `f_alpha_plasma` input variable. By default it is set to 95% or 0.95 as is the assumed ITER default.[^2] -**`PROCESS` only assumes the alpha power produced is coupled to and self heats the plasma, other charged particles do not.** - ----------------------------- ## Key Constraints From 0bc8b5aa33b64e9f66956a39d3e4ba74877180e3 Mon Sep 17 00:00:00 2001 From: mn3981 Date: Tue, 13 May 2025 15:42:39 +0100 Subject: [PATCH 37/37] Rename powfmax to p_fusion_total_max_mw for clarity in fusion power limits --- tests/integration/data/scan_2D_MFILE.DAT | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/data/scan_2D_MFILE.DAT b/tests/integration/data/scan_2D_MFILE.DAT index 1e9b97645e..a7bec178e8 100644 --- a/tests/integration/data/scan_2D_MFILE.DAT +++ b/tests/integration/data/scan_2D_MFILE.DAT @@ -17541,7 +17541,7 @@ ixc = 26 * fp_fusion_total_max_mw boundl(26) = 0.01 boundu(26) = 2.0 * Maximum allowable value fusion power [MW] -powfmax = 3000 +p_fusion_total_max_mw = 3000 * Burn time lower limit * *-----------------------*