Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions process/core/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from process.core.log import logging_model_handler
from process.core.solver import iteration_variables
from process.core.solver.constraints import ConstraintManager
from process.data_structure.current_drive_variables import init_current_drive_variables
from process.data_structure.divertor_variables import init_divertor_variables
from process.data_structure.heat_transport_variables import (
init_heat_transport_variables,
Expand Down Expand Up @@ -267,7 +266,6 @@ def init_all_module_vars():
init_stellarator_variables()
init_tfcoil_variables()
constants.init_constants()
init_current_drive_variables()
init_pfcoil_variables()
init_pf_power_variables()
init_rebco_variables()
Expand Down Expand Up @@ -1129,8 +1127,8 @@ def check_process(inputs, data): # noqa: ARG001
data_structure.pfcoil_variables.rho_pf_coil = 0.0

# If there is no NBI, then hot beam density should be zero
if data_structure.current_drive_variables.i_hcd_calculations == 1:
if data_structure.current_drive_variables.i_hcd_primary not in {5, 8}:
if data.current_drive.i_hcd_calculations == 1:
if data.current_drive.i_hcd_primary not in {5, 8}:
data_structure.physics_variables.f_nd_beam_electron = 0.0
else:
data_structure.physics_variables.f_nd_beam_electron = 0.0
Expand Down
86 changes: 27 additions & 59 deletions process/core/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,8 @@ def __post_init__(self):
),
"bcritsc": InputVariable(data_structure.tfcoil_variables, float, range=(10.0, 50.0)),
"bctmp": InputVariable("pulse", float, range=(1.0, 800.0)),
"e_beam_kev": InputVariable(
data_structure.current_drive_variables, float, range=(1.0, 1000000.0)
),
"dx_beam_duct": InputVariable(
data_structure.current_drive_variables, float, range=(0.001, 5.0)
),
"e_beam_kev": InputVariable("current_drive", float, range=(1.0, 1000000.0)),
"dx_beam_duct": InputVariable("current_drive", float, range=(0.001, 5.0)),
"deg_div_field_plate": InputVariable(
data_structure.divertor_variables, float, range=(0.0, 360.0)
),
Expand Down Expand Up @@ -256,11 +252,9 @@ def __post_init__(self):
),
"b_tf_inboard_max": InputVariable("constraints", float, range=(0.1, 50.0)),
"f_c_plasma_bootstrap_max": InputVariable(
data_structure.current_drive_variables, float, range=(-0.999, 0.999)
),
"f_c_plasma_bootstrap": InputVariable(
data_structure.current_drive_variables, float, range=(0.0, 1.0)
"current_drive", float, range=(-0.999, 0.999)
),
"f_c_plasma_bootstrap": InputVariable("current_drive", float, range=(0.0, 1.0)),
"breeder_f": InputVariable("fwbs", float, range=(0.0, 1.0)),
"breeder_multiplier": InputVariable("fwbs", float, range=(0.0, 1.0)),
"bz_channel_conduct_liq": InputVariable("fwbs", float, range=(1e-06, 1000000.0)),
Expand All @@ -276,9 +270,7 @@ def __post_init__(self):
"casths_fraction": InputVariable(
data_structure.tfcoil_variables, float, range=(0.0, 1.0)
),
"cboot": InputVariable(
data_structure.current_drive_variables, float, range=(0.0, 10.0)
),
"cboot": InputVariable("current_drive", float, range=(0.0, 10.0)),
"cconfix": InputVariable("costs", float, range=(50.0, 200.0)),
"cconshpf": InputVariable("costs", float, range=(50.0, 200.0)),
"cconshtf": InputVariable("costs", float, range=(50.0, 200.0)),
Expand Down Expand Up @@ -450,22 +442,22 @@ def __post_init__(self):
"f_p_blkt_multiplication": InputVariable("fwbs", float, range=(1.0, 2.0)),
"esbldgm3": InputVariable("buildings", float, range=(1000.0, 1000000.0)),
"eta_ecrh_injector_wall_plug": InputVariable(
data_structure.current_drive_variables, float, range=(0.0, 1.0)
"current_drive", float, range=(0.0, 1.0)
),
"eta_icrh_injector_wall_plug": InputVariable(
data_structure.current_drive_variables, float, range=(0.0, 1.0)
"current_drive", float, range=(0.0, 1.0)
),
"eta_ebw_injector_wall_plug": InputVariable(
data_structure.current_drive_variables, float, range=(0.0, 1.0)
"current_drive", float, range=(0.0, 1.0)
),
"eta_coolant_pump_electric": InputVariable("fwbs", float, range=(0.1, 1.0)),
"etaiso": InputVariable("fwbs", float, range=(0.1, 1.0)),
"eta_lowhyb_injector_wall_plug": InputVariable(
data_structure.current_drive_variables, float, range=(0.0, 1.0)
"current_drive", float, range=(0.0, 1.0)
),
"etali": InputVariable(data_structure.ife_variables, float, range=(0.0, 1.0)),
"eta_beam_injector_wall_plug": InputVariable(
data_structure.current_drive_variables, float, range=(0.0, 1.0)
"current_drive", float, range=(0.0, 1.0)
),
"etapsu": InputVariable(data_structure.pfcoil_variables, float, range=(0.0, 1.0)),
"etapump": InputVariable(data_structure.tfcoil_variables, float, range=(0.0, 1.0)),
Expand Down Expand Up @@ -523,9 +515,7 @@ def __post_init__(self):
"f_plasma_fuel_tritium": InputVariable(
data_structure.physics_variables, float, range=(0.0, 1.0)
),
"f_beam_tritium": InputVariable(
data_structure.current_drive_variables, float, range=(0.0, 1.0)
),
"f_beam_tritium": InputVariable("current_drive", float, range=(0.0, 1.0)),
"f_vforce_inboard": InputVariable(
data_structure.tfcoil_variables, float, range=(0.0, 1.0)
),
Expand Down Expand Up @@ -574,9 +564,7 @@ def __post_init__(self):
"fdivwet": InputVariable(
data_structure.stellarator_variables, float, range=(0.01, 1.0)
),
"feffcd": InputVariable(
data_structure.current_drive_variables, float, range=(0.0, 20.0)
),
"feffcd": InputVariable("current_drive", float, range=(0.0, 20.0)),
"f_a_fw_outboard_hcd": InputVariable("fwbs", float, range=(0.0, 1.0)),
"fhole": InputVariable("fwbs", float, range=(0.0, 1.0)),
"fhts": InputVariable(data_structure.tfcoil_variables, float, range=(0.01, 1.0)),
Expand All @@ -594,9 +582,7 @@ def __post_init__(self):
data_structure.heat_transport_variables, float, range=(0.0, 100.0)
),
"fndt": InputVariable("buildings", float, range=(0.0, 10.0)),
"f_p_beam_orbit_loss": InputVariable(
data_structure.current_drive_variables, float, range=(0.0, 0.999)
),
"f_p_beam_orbit_loss": InputVariable("current_drive", float, range=(0.0, 0.999)),
"f_p_blkt_coolant_pump_total_heat": InputVariable(
data_structure.heat_transport_variables, float, range=(0.0, 0.2)
),
Expand All @@ -612,7 +598,7 @@ def __post_init__(self):
"fracture_toughness": InputVariable("cs_fatigue", float, range=(0.1, 100000000.0)),
"fradpwr": InputVariable("constraints", float, range=(0.0, 1.0)),
"f_radius_beam_tangency_rmajor": InputVariable(
data_structure.current_drive_variables, float, range=(0.5, 2.0)
"current_drive", float, range=(0.5, 2.0)
),
"frhocp": InputVariable(data_structure.tfcoil_variables, float, range=(0.01, 5.0)),
"frholeg": InputVariable(data_structure.tfcoil_variables, float, range=(0.01, 5.0)),
Expand All @@ -634,9 +620,7 @@ def __post_init__(self):
"fwdzl": InputVariable(data_structure.ife_variables, float, range=(0.0, 10.0)),
"fwdzu": InputVariable(data_structure.ife_variables, float, range=(0.0, 10.0)),
"fzactual": InputVariable("reinke", float, range=(0.0, 1.0)),
"eta_cd_norm_ecrh": InputVariable(
data_structure.current_drive_variables, float, range=(0.0, 1.0)
),
"eta_cd_norm_ecrh": InputVariable("current_drive", float, range=(0.0, 1.0)),
"gamma_he": InputVariable("primary_pumping", float, range=(1.0, 2.0)),
"eta_cd_norm_hcd_primary_max": InputVariable(
"constraints", float, range=(0.01, 10.0)
Expand All @@ -646,9 +630,7 @@ def __post_init__(self):
"gas_buildings_l": InputVariable("buildings", float, range=(10.0, 1000.0)),
"gas_buildings_w": InputVariable("buildings", float, range=(10.0, 1000.0)),
"ground_clrnc": InputVariable("buildings", float, range=(0.0, 10.0)),
"n_ecrh_harmonic": InputVariable(
data_structure.current_drive_variables, float, range=(1.0, 10.0)
),
"n_ecrh_harmonic": InputVariable("current_drive", float, range=(1.0, 10.0)),
"dx_hts_tape_hastelloy": InputVariable(
data_structure.rebco_variables, float, range=(1e-08, 0.001)
),
Expand Down Expand Up @@ -759,9 +741,7 @@ def __post_init__(self):
),
"nbi_sys_l": InputVariable("buildings", float, range=(10.0, 1000.0)),
"nbi_sys_w": InputVariable("buildings", float, range=(10.0, 1000.0)),
"dx_beam_shield": InputVariable(
data_structure.current_drive_variables, float, range=(0.01, 0.5)
),
"dx_beam_shield": InputVariable("current_drive", float, range=(0.01, 0.5)),
"f_p_beam_shine_through_max": InputVariable(
"constraints", float, range=(1e-20, 0.1)
),
Expand Down Expand Up @@ -801,18 +781,16 @@ def __post_init__(self):
),
"pfusife": InputVariable(data_structure.ife_variables, float, range=(0.0, 10000.0)),
"p_hcd_primary_extra_heat_mw": InputVariable(
data_structure.current_drive_variables, float, range=(0.0, 1000.0)
"current_drive", float, range=(0.0, 1000.0)
),
"p_hcd_secondary_extra_heat_mw": InputVariable(
data_structure.current_drive_variables, float, range=(0.0, 1000.0)
"current_drive", float, range=(0.0, 1000.0)
),
"pibv": InputVariable("buildings", float, range=(1000.0, 100000.0)),
"pifecr": InputVariable(data_structure.ife_variables, float, range=(0.0, 100.0)),
"p_hcd_injected_max": InputVariable(
data_structure.current_drive_variables, float, range=(0.0, 1000.0)
),
"p_hcd_injected_max": InputVariable("current_drive", float, range=(0.0, 1000.0)),
"p_hcd_secondary_injected_mw": InputVariable(
data_structure.current_drive_variables, float, range=(0.0, 1000.0)
"current_drive", float, range=(0.0, 1000.0)
),
"plasma_res_factor": InputVariable(
data_structure.physics_variables, float, range=(0.0, 1.0)
Expand Down Expand Up @@ -1033,7 +1011,7 @@ def __post_init__(self):
data_structure.physics_variables, float, range=(0.1, 100.0)
),
"n_beam_decay_lengths_core_required": InputVariable(
data_structure.current_drive_variables, float, range=(0.0, 10.0)
"current_drive", float, range=(0.0, 10.0)
),
"tbeta": InputVariable(data_structure.physics_variables, float, range=(0.0, 4.0)),
"t_blkt_replace_yrs": InputVariable("costs", float, range=(0.01, 2.0)),
Expand Down Expand Up @@ -1239,9 +1217,7 @@ def __post_init__(self):
"workshop_l": InputVariable("buildings", float, range=(10.0, 1000.0)),
"workshop_w": InputVariable("buildings", float, range=(10.0, 1000.0)),
"wsvfac": InputVariable("buildings", float, range=(0.9, 3.0)),
"xi_ebw": InputVariable(
data_structure.current_drive_variables, float, range=(0.0, 1.0)
),
"xi_ebw": InputVariable("current_drive", float, range=(0.0, 1.0)),
"xpertin": InputVariable(
data_structure.divertor_variables, float, range=(0.0, 10.0)
),
Expand Down Expand Up @@ -1348,12 +1324,8 @@ def __post_init__(self):
"i_plant_availability": InputVariable("costs", int, range=(0, 3)),
"ibkt_life": InputVariable("costs", int, choices=[0, 1, 2]),
"i_blkt_dual_coolant": InputVariable("fwbs", int, choices=[0, 1, 2]),
"i_hcd_primary": InputVariable(
data_structure.current_drive_variables, int, range=(1, 13)
),
"i_hcd_secondary": InputVariable(
data_structure.current_drive_variables, int, range=(0, 13)
),
"i_hcd_primary": InputVariable("current_drive", int, range=(1, 13)),
"i_hcd_secondary": InputVariable("current_drive", int, range=(0, 13)),
"i_blkt_liquid_breeder_channel_type": InputVariable("fwbs", int, choices=[0, 1, 2]),
"ife": InputVariable(data_structure.ife_variables, int, choices=[0, 1]),
"ifedrv": InputVariable(data_structure.ife_variables, int, range=(-1, 3)),
Expand Down Expand Up @@ -1388,9 +1360,7 @@ def __post_init__(self):
"i_fw_blkt_shared_coolant": InputVariable("fwbs", int, choices=[0, 1, 2]),
"ireactor": InputVariable("costs", int, choices=[0, 1]),
"irefprop": InputVariable("fwbs", int, choices=[0, 1]),
"i_hcd_calculations": InputVariable(
data_structure.current_drive_variables, int, choices=[0, 1]
),
"i_hcd_calculations": InputVariable("current_drive", int, choices=[0, 1]),
"i_pf_energy_storage_source": InputVariable(
data_structure.pf_power_variables, int, range=(1, 3)
),
Expand Down Expand Up @@ -1449,9 +1419,7 @@ def __post_init__(self):
"secondary_cycle_liq": InputVariable("fwbs", int, range=(2, 4)),
"supercond_cost_model": InputVariable("costs", int, choices=[0, 1]),
"i_tf_inside_cs": InputVariable("build", int, choices=[0, 1]),
"i_ecrh_wave_mode": InputVariable(
data_structure.current_drive_variables, int, choices=[0, 1]
),
"i_ecrh_wave_mode": InputVariable("current_drive", int, choices=[0, 1]),
"i_confinement_time": InputVariable(
data_structure.physics_variables,
int,
Expand Down
2 changes: 2 additions & 0 deletions process/core/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from process.data_structure.cost_2015_variables import Cost2015Data
from process.data_structure.cost_variables import CostData
from process.data_structure.cs_fatigue_variables import CSFatigueData
from process.data_structure.current_drive_variables import CurrentDriveData
from process.data_structure.dcll_variables import DCLLData
from process.data_structure.first_wall_variables import FirstWallData
from process.data_structure.fwbs_variables import FWBSData
Expand Down Expand Up @@ -43,6 +44,7 @@ class DataStructure:
buildings: BuildingsData = initialise_later
constraints: ConstraintData = initialise_later
dcll: DCLLData = initialise_later
current_drive: CurrentDriveData = initialise_later

def __post_init__(self):
for f in fields(self):
Expand Down
5 changes: 2 additions & 3 deletions process/core/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from process.core.solver import constraints
from process.core.solver.solver_handler import SolverHandler
from process.data_structure import (
current_drive_variables,
divertor_variables,
global_variables,
heat_transport_variables,
Expand Down Expand Up @@ -1093,7 +1092,7 @@ def scan_select(self, nwp, swp, iscn):
case 11:
physics_variables.beta_norm_max = swp[iscn - 1]
case 12:
current_drive_variables.f_c_plasma_bootstrap_max = swp[iscn - 1]
self.data.current_drive.f_c_plasma_bootstrap_max = swp[iscn - 1]
case 13:
numerics.boundu[9] = swp[iscn - 1]
case 16:
Expand Down Expand Up @@ -1213,7 +1212,7 @@ def scan_select(self, nwp, swp, iscn):
case 78:
self.data.costs.fkind = swp[iscn - 1]
case 79:
current_drive_variables.eta_ecrh_injector_wall_plug = swp[iscn - 1]
self.data.current_drive.eta_ecrh_injector_wall_plug = swp[iscn - 1]
case 80:
tfcoil_variables.fcoolcp = swp[iscn - 1]
case 81:
Expand Down
Loading
Loading