diff --git a/process/core/caller.py b/process/core/caller.py index d880d884f..df8716424 100644 --- a/process/core/caller.py +++ b/process/core/caller.py @@ -96,7 +96,7 @@ def call_models(self, xc: np.ndarray, m: int) -> tuple[float, np.ndarray]: # Evaluate models up to 10 times; any more implies non-converging values for _ in range(10): - self._call_models_once(xc) + self._call_models_once(xc, self.data) # Evaluate objective function and constraints objf = objective_function(data_structure.numerics.minmax, self.data) conf, _, _, _, _ = constraints.constraint_eqns(m, -1, self.data) @@ -161,7 +161,7 @@ def call_models_and_write_output(self, xc: np.ndarray, ifail: int): # Divert OUT.DAT and MFILE.DAT output to scratch files for # idempotence checking OutputFileManager.open_idempotence_files() - self._call_models_once(xc) + self._call_models_once(xc, self.data) # Write mfile finalise(self.models, self.data, ifail) @@ -244,7 +244,7 @@ def call_models_and_write_output(self, xc: np.ndarray, ifail: int): non_idempotent_msg=non_idempotent_warning + "\n" + non_idempotent_table, ) - def _call_models_once(self, xc: np.ndarray): + def _call_models_once(self, xc: np.ndarray, data: DataStructure): """Call the physics and engineering models. This method is the principal caller of all the physics and @@ -255,6 +255,8 @@ def _call_models_once(self, xc: np.ndarray): ---------- xc : np.array Array of optimisation parameters + data: DataStructure + data structure object """ # Number of active iteration variables nvars = len(xc) @@ -267,13 +269,13 @@ def _call_models_once(self, xc: np.ndarray): # Perform the various function calls # Stellarator caller - if data_structure.stellarator_variables.istell != 0: + if data.stellarator.istell != 0: self.models.stellarator.run() # TODO Is this return safe? return # Inertial Fusion Energy calls - if data_structure.ife_variables.ife != 0: + if data.ife.ife != 0: self.models.ife.run() return diff --git a/process/core/init.py b/process/core/init.py index ce4ebdde7..4065ab6d5 100644 --- a/process/core/init.py +++ b/process/core/init.py @@ -17,24 +17,17 @@ from process.core.solver import iteration_variables from process.core.solver.constraints import ConstraintManager from process.data_structure.divertor_variables import init_divertor_variables -from process.data_structure.ife_variables import init_ife_variables from process.data_structure.impurity_radiation_module import ( init_impurity_radiation_module, ) from process.data_structure.neoclassics_variables import init_neoclassics_variables from process.data_structure.pf_power_variables import init_pf_power_variables -from process.data_structure.pfcoil_variables import ( - init_pfcoil_module, - init_pfcoil_variables, -) from process.data_structure.physics_variables import ( init_physics_module, init_physics_variables, ) -from process.data_structure.power_variables import init_power_variables from process.data_structure.rebco_variables import init_rebco_variables from process.data_structure.scan_variables import init_scan_variables -from process.data_structure.stellarator_variables import init_stellarator_variables from process.data_structure.superconducting_tf_coil_variables import ( init_superconducting_tf_coil_variables, ) @@ -72,7 +65,7 @@ def init_process(data: DataStructure): set_active_constraints() # set the device type (icase) - set_device_type() + set_device_type(data) # Initialise the Stellarator st_init(data) @@ -252,20 +245,15 @@ def init_all_module_vars(): data_structure.numerics.init_numerics() init_divertor_variables() data_structure.global_variables.init_global_variables() - init_ife_variables() init_impurity_radiation_module() - init_pfcoil_module() init_physics_module() init_physics_variables() init_scan_variables() init_superconducting_tf_coil_variables() - init_stellarator_variables() init_tfcoil_variables() constants.init_constants() - init_pfcoil_variables() init_pf_power_variables() init_rebco_variables() - init_power_variables() init_neoclassics_variables() @@ -394,10 +382,7 @@ def check_process(inputs, data): # noqa: ARG001 ) # Plasma profile consistency checks - if ( - data_structure.ife_variables.ife != 1 - and data_structure.physics_variables.i_plasma_pedestal == 1 - ): + if data.ife.ife != 1 and data_structure.physics_variables.i_plasma_pedestal == 1: # Temperature checks if ( data_structure.physics_variables.temp_plasma_pedestal_kev @@ -615,9 +600,9 @@ def check_process(inputs, data): # noqa: ARG001 # 2 : PF coil on top of TF coil # 3 : PF coil outside of TF coil if data_structure.physics_variables.itartpf == 0: - data_structure.pfcoil_variables.i_pf_location[0] = 2 - data_structure.pfcoil_variables.i_pf_location[1] = 3 - data_structure.pfcoil_variables.i_pf_location[2] = 3 + data.pf_coil.i_pf_location[0] = 2 + data.pf_coil.i_pf_location[1] = 3 + data.pf_coil.i_pf_location[2] = 3 # Water cooled copper magnets initalisation / checks if ( @@ -757,18 +742,18 @@ def check_process(inputs, data): # noqa: ARG001 # Check PF coil configurations j = 0 k = 0 - for i in range(data_structure.pfcoil_variables.n_pf_coil_groups): + for i in range(data.pf_coil.n_pf_coil_groups): if ( - data_structure.pfcoil_variables.i_pf_location[i] != 2 - and data_structure.pfcoil_variables.n_pf_coils_in_group[i] != 2 + data.pf_coil.i_pf_location[i] != 2 + and data.pf_coil.n_pf_coils_in_group[i] != 2 ): raise ProcessValidationError( "n_pf_coils_in_group(i) .ne. 2 is not a valid option except for (i_pf_location = 2)" ) - if data_structure.pfcoil_variables.i_pf_location[i] == 2: + if data.pf_coil.i_pf_location[i] == 2: j += 1 - k += data_structure.pfcoil_variables.n_pf_coils_in_group[i] + k += data.pf_coil.n_pf_coils_in_group[i] if k == 1: raise ProcessValidationError( @@ -1119,8 +1104,8 @@ def check_process(inputs, data): # noqa: ARG001 ) # PF coil resistivity is zero if superconducting - if data_structure.pfcoil_variables.i_pf_conductor == 0: - data_structure.pfcoil_variables.rho_pf_coil = 0.0 + if data.pf_coil.i_pf_conductor == 0: + data.pf_coil.rho_pf_coil = 0.0 # If there is no NBI, then hot beam density should be zero if data.current_drive.i_hcd_calculations == 1: @@ -1137,9 +1122,7 @@ def check_process(inputs, data): # noqa: ARG001 # Ensure that blanket material fractions allow non-zero space for steel # CCFE HCPB Model - if data_structure.stellarator_variables.istell == 0 and ( - data.fwbs.i_blanket_type == 1 - ): + if data.stellarator.istell == 0 and (data.fwbs.i_blanket_type == 1): fsum = data.fwbs.breeder_multiplier + data.fwbs.vfcblkt + data.fwbs.vfpblkt if fsum >= 1.0: raise ProcessValidationError( @@ -1217,7 +1200,7 @@ def check_process(inputs, data): # noqa: ARG001 : data_structure.numerics.neqns + data_structure.numerics.nineqns ] == 60 - ).any() and data_structure.pfcoil_variables.i_cs_superconductor == 8: + ).any() and data.pf_coil.i_cs_superconductor == 8: raise ProcessValidationError( "turn off CS temperature margin constraint icc = 60 when using REBCO" ) @@ -1256,8 +1239,8 @@ def set_active_constraints(): data_structure.numerics.nineqns = num_constraints - data_structure.numerics.neqns -def set_device_type(): - if data_structure.ife_variables.ife == 1: +def set_device_type(data): + if data.ife.ife == 1: data_structure.global_variables.icase = "Inertial Fusion model" - elif data_structure.stellarator_variables.istell != 0: + elif data.stellarator.istell != 0: data_structure.global_variables.icase = "Stellarator model" diff --git a/process/core/input.py b/process/core/input.py index 49bca620b..89b7b2134 100644 --- a/process/core/input.py +++ b/process/core/input.py @@ -16,6 +16,7 @@ ProcessValueError, ) from process.core.solver.constraints import ConstraintManager +from process.data_structure.pfcoil_variables import N_PF_GROUPS_MAX if TYPE_CHECKING: from collections.abc import Callable @@ -192,10 +193,8 @@ def __post_init__(self): "adivflnc": InputVariable("costs", float, range=(0.1, 100.0)), "admv": InputVariable("buildings", float, range=(1.0e4, 1.0e6)), "airtemp": InputVariable("water_use", float, range=(-15.0, 40.0)), - "alfapf": InputVariable(data_structure.pfcoil_variables, float, range=(1e-12, 1.0)), - "alstroh": InputVariable( - data_structure.pfcoil_variables, float, range=(1000000.0, 100000000000.0) - ), + "alfapf": InputVariable("pf_coil", float, range=(1e-12, 1.0)), + "alstroh": InputVariable("pf_coil", float, range=(1000000.0, 100000000000.0)), "amortization": InputVariable("costs", float, range=(1.0, 50.0)), "anginc": InputVariable( data_structure.divertor_variables, float, range=(0.0, 1.5707) @@ -238,18 +237,14 @@ def __post_init__(self): "blbpoth": InputVariable("build", float, range=(0.0, 2.0)), "blbuith": InputVariable("build", float, range=(0.0, 2.0)), "blbuoth": InputVariable("build", float, range=(0.0, 2.0)), - "bldr": InputVariable(data_structure.ife_variables, float, range=(0.0, 10.0)), - "bldrc": InputVariable(data_structure.ife_variables, float, range=(0.0, 10.0)), - "bldzl": InputVariable(data_structure.ife_variables, float, range=(0.0, 10.0)), - "bldzu": InputVariable(data_structure.ife_variables, float, range=(0.0, 10.0)), + "bldr": InputVariable("ife", float, range=(0.0, 10.0)), + "bldrc": InputVariable("ife", float, range=(0.0, 10.0)), + "bldzl": InputVariable("ife", float, range=(0.0, 10.0)), + "bldzu": InputVariable("ife", float, range=(0.0, 10.0)), "pres_blkt_coolant": InputVariable("fwbs", float, range=(100000.0, 100000000.0)), "blpressure_liq": InputVariable("fwbs", float, range=(100000.0, 100000000.0)), - "b_cs_limit_max": InputVariable( - data_structure.pfcoil_variables, float, range=(0.01, 100.0) - ), - "bmn": InputVariable( - data_structure.stellarator_variables, float, range=(0.0001, 0.01) - ), + "b_cs_limit_max": InputVariable("pf_coil", float, range=(0.01, 100.0)), + "bmn": InputVariable("stellarator", float, range=(0.0001, 0.01)), "b_tf_inboard_max": InputVariable("constraints", float, range=(0.1, 50.0)), "f_c_plasma_bootstrap_max": InputVariable( "current_drive", float, range=(-0.999, 0.999) @@ -274,21 +269,19 @@ def __post_init__(self): "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)), - "cdriv0": InputVariable(data_structure.ife_variables, float, range=(50.0, 500.0)), - "cdriv1": InputVariable(data_structure.ife_variables, float, range=(50.0, 500.0)), - "cdriv2": InputVariable(data_structure.ife_variables, float, range=(50.0, 500.0)), + "cdriv0": InputVariable("ife", float, range=(50.0, 500.0)), + "cdriv1": InputVariable("ife", float, range=(50.0, 500.0)), + "cdriv2": InputVariable("ife", float, range=(50.0, 500.0)), "f_t_plant_available": InputVariable("costs", float, range=(0.0, 1.0)), - "chdzl": InputVariable(data_structure.ife_variables, float, range=(0.0, 10.0)), - "chdzu": InputVariable(data_structure.ife_variables, float, range=(0.0, 10.0)), + "chdzl": InputVariable("ife", float, range=(0.0, 10.0)), + "chdzu": InputVariable("ife", float, range=(0.0, 10.0)), "chemlab_h": InputVariable("buildings", float, range=(1.0, 100.0)), "chemlab_l": InputVariable("buildings", float, range=(10.0, 1000.0)), "chemlab_w": InputVariable("buildings", float, range=(10.0, 1000.0)), - "chrad": InputVariable(data_structure.ife_variables, float, range=(0.1, 20.0)), + "chrad": InputVariable("ife", float, range=(0.1, 20.0)), "cland": InputVariable("costs", float, range=(10.0, 100.0)), "clh2": InputVariable("buildings", float, range=(0.0, 30.0)), - "j_cs_flat_top_end": InputVariable( - data_structure.pfcoil_variables, float, range=(10000.0, 500000000.0) - ), + "j_cs_flat_top_end": InputVariable("pf_coil", float, range=(10000.0, 500000000.0)), "conf_mag": InputVariable("costs", float, range=(0.9, 1.0)), "control_buildings_h": InputVariable("buildings", float, range=(1.0, 100.0)), "control_buildings_l": InputVariable("buildings", float, range=(10.0, 1000.0)), @@ -352,9 +345,9 @@ def __post_init__(self): "den_tf_coil_case": InputVariable( data_structure.tfcoil_variables, float, range=(1000.0, 100000.0) ), - "dcdrv0": InputVariable(data_structure.ife_variables, float, range=(0.0, 200.0)), - "dcdrv1": InputVariable(data_structure.ife_variables, float, range=(0.0, 200.0)), - "dcdrv2": InputVariable(data_structure.ife_variables, float, range=(0.0, 200.0)), + "dcdrv0": InputVariable("ife", float, range=(0.0, 200.0)), + "dcdrv1": InputVariable("ife", float, range=(0.0, 200.0)), + "dcdrv2": InputVariable("ife", float, range=(0.0, 200.0)), "den_tf_wp_turn_insulation": InputVariable( data_structure.tfcoil_variables, float, range=(500.0, 10000.0) ), @@ -415,15 +408,13 @@ def __post_init__(self): "dr_vv_inboard": InputVariable("build", float, range=(0.0, 10.0)), "dr_vv_outboard": InputVariable("build", float, range=(0.0, 10.0)), "drtop": InputVariable(data_structure.tfcoil_variables, float, range=(-1.5, 1.5)), - "drveff": InputVariable(data_structure.ife_variables, float, range=(0.01, 1.0)), + "drveff": InputVariable("ife", float, range=(0.01, 1.0)), "dtlife": InputVariable("costs", float, range=(0.0, 15.0)), "dtstor": InputVariable("pulse", float, range=(50.0, 500.0)), "dx_fw_module": InputVariable("fwbs", float, range=(0.0005, 0.1)), "dz_tf_cryostat": InputVariable("buildings", float, range=(0.0, 20.0)), "dztop": InputVariable(data_structure.tfcoil_variables, float, range=(-0.5, 0.5)), - "edrive": InputVariable( - data_structure.ife_variables, float, range=(100000.0, 5000000000.0) - ), + "edrive": InputVariable("ife", float, range=(100000.0, 5000000000.0)), "eff_tf_cryo": InputVariable( data_structure.tfcoil_variables, float, range=(0.0, 1.0) ), @@ -455,11 +446,11 @@ def __post_init__(self): "eta_lowhyb_injector_wall_plug": InputVariable( "current_drive", float, range=(0.0, 1.0) ), - "etali": InputVariable(data_structure.ife_variables, float, range=(0.0, 1.0)), + "etali": InputVariable("ife", float, range=(0.0, 1.0)), "eta_beam_injector_wall_plug": InputVariable( "current_drive", float, range=(0.0, 1.0) ), - "etapsu": InputVariable(data_structure.pfcoil_variables, float, range=(0.0, 1.0)), + "etapsu": InputVariable("pf_coil", float, range=(0.0, 1.0)), "etapump": InputVariable(data_structure.tfcoil_variables, float, range=(0.0, 1.0)), "etatf": InputVariable("heat_transport", float, range=(0.0, 1.0)), "eta_turbine": InputVariable("heat_transport", float, range=(0.0, 1.0)), @@ -485,9 +476,7 @@ def __post_init__(self): "f_alpha_energy_confinement_min": InputVariable( "constraints", float, range=(1.0, 100.0) ), - "f_asym": InputVariable( - data_structure.stellarator_variables, float, range=(0.9, 2.0) - ), + "f_asym": InputVariable("stellarator", float, range=(0.9, 2.0)), "f_fw_peak": InputVariable("fwbs", float, range=(1.0, 100.0)), "f_fw_rad_max": InputVariable("constraints", float, range=(0.1, 10)), "f_nd_alpha_electron": InputVariable( @@ -502,9 +491,7 @@ def __post_init__(self): "f_neut_shield": InputVariable("fwbs", float, range=(0.0, 1.0)), "f_nuc_pow_bz_struct": InputVariable("fwbs", float, range=(0.0, 1.0)), "f_r_cp": InputVariable("build", float, range=(1.0, 100.0)), - "f_rad": InputVariable( - data_structure.stellarator_variables, float, range=(0.0, 1.0) - ), + "f_rad": InputVariable("stellarator", float, range=(0.0, 1.0)), "f_sync_reflect": InputVariable( data_structure.physics_variables, float, range=(0.0, 1.0) ), @@ -515,12 +502,10 @@ def __post_init__(self): "f_vforce_inboard": InputVariable( data_structure.tfcoil_variables, float, range=(0.0, 1.0) ), - "f_w": InputVariable(data_structure.stellarator_variables, float, range=(0.1, 1.0)), - "f_st_coil_aspect": InputVariable( - data_structure.stellarator_variables, float, range=(0.1, 10.0) - ), + "f_w": InputVariable("stellarator", float, range=(0.1, 1.0)), + "f_st_coil_aspect": InputVariable("stellarator", float, range=(0.1, 10.0)), "f_z_cryostat": InputVariable("build", float, range=(2.0, 10.0)), - "fauxbop": InputVariable(data_structure.ife_variables, float, range=(0.0, 1.0)), + "fauxbop": InputVariable("ife", float, range=(0.0, 1.0)), "fblbe": InputVariable("fwbs", float, range=(0.0, 1.0)), "fblbreed": InputVariable("fwbs", float, range=(0.0, 1.0)), "fblhebmi": InputVariable("fwbs", float, range=(0.0, 1.0)), @@ -532,22 +517,20 @@ def __post_init__(self): "fbllipb": InputVariable("fwbs", float, range=(0.0, 1.0)), "fblss": InputVariable("fwbs", float, range=(0.0, 1.0)), "fblvd": InputVariable("fwbs", float, range=(0.0, 1.0)), - "fbreed": InputVariable(data_structure.ife_variables, float, range=(0.0, 0.999)), - "fburn": InputVariable(data_structure.ife_variables, float, range=(0.01, 1.0)), + "fbreed": InputVariable("ife", float, range=(0.0, 0.999)), + "fburn": InputVariable("ife", float, range=(0.01, 1.0)), "fc_building_l": InputVariable("buildings", float, range=(10.0, 1000.0)), "fc_building_w": InputVariable("buildings", float, range=(10.0, 1000.0)), "fcap0": InputVariable("costs", float, range=(1.0, 1.5)), "fcap0cp": InputVariable("costs", float, range=(1.0, 1.5)), "fcdfuel": InputVariable("costs", float, range=(0.0, 1.0)), - "f_j_cs_start_pulse_end_flat_top": InputVariable( - data_structure.pfcoil_variables, float, range=(0.0, 1.0) - ), + "f_j_cs_start_pulse_end_flat_top": InputVariable("pf_coil", float, range=(0.0, 1.0)), "fcontng": InputVariable("costs", float, range=(0.0, 1.0)), "fcoolcp": InputVariable(data_structure.tfcoil_variables, float, range=(0.0, 1.0)), "fcr0": InputVariable("costs", float, range=(0.0, 1.0)), "fcspc": InputVariable("build", float, range=(0.0, 1.0)), - "fcuohsu": InputVariable(data_structure.pfcoil_variables, float, range=(0.0, 1.0)), - "fcupfsu": InputVariable(data_structure.pfcoil_variables, float, range=(0.0, 1.0)), + "fcuohsu": InputVariable("pf_coil", float, range=(0.0, 1.0)), + "fcupfsu": InputVariable("pf_coil", float, range=(0.0, 1.0)), "f_a_tf_turn_cable_copper": InputVariable( data_structure.tfcoil_variables, float, range=(0.0, 1.0) ), @@ -557,9 +540,7 @@ def __post_init__(self): "fjohc0": InputVariable("constraints", float, range=(0.001, 1.0)), "f_ster_div_single": InputVariable("fwbs", float, range=(0.0, 1.0)), "fdiva": InputVariable(data_structure.divertor_variables, float, range=(0.1, 2.0)), - "fdivwet": InputVariable( - data_structure.stellarator_variables, float, range=(0.01, 1.0) - ), + "fdivwet": InputVariable("stellarator", float, range=(0.01, 1.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)), @@ -567,10 +548,8 @@ def __post_init__(self): "fkind": InputVariable("costs", float, range=(0.5, 1.0)), "f_h_mode_margin": InputVariable("constraints", float, range=(0.001, 1000000.0)), "f_l_mode_margin": InputVariable("constraints", float, range=(0.001, 1000000.0)), - "flirad": InputVariable(data_structure.ife_variables, float, range=(0.0, 10.0)), - "flpitch": InputVariable( - data_structure.stellarator_variables, float, range=(0.0001, 0.01) - ), + "flirad": InputVariable("ife", float, range=(0.0, 10.0)), + "flpitch": InputVariable("stellarator", float, range=(0.0001, 0.01)), "f_div_flux_expansion": InputVariable( data_structure.divertor_variables, float, range=(0.0, 10.0) ), @@ -610,9 +589,9 @@ def __post_init__(self): "fwbs_prob_fail": InputVariable("costs", float, range=(0.0, 1.0)), "fwbs_umain_time": InputVariable("costs", float, range=(0.1, 2.0)), "fwclfr": InputVariable("fwbs", float, range=(0.0, 1.0)), - "fwdr": InputVariable(data_structure.ife_variables, float, range=(0.0, 10.0)), - "fwdzl": InputVariable(data_structure.ife_variables, float, range=(0.0, 10.0)), - "fwdzu": InputVariable(data_structure.ife_variables, float, range=(0.0, 10.0)), + "fwdr": InputVariable("ife", float, range=(0.0, 10.0)), + "fwdzl": InputVariable("ife", float, range=(0.0, 10.0)), + "fwdzu": InputVariable("ife", float, range=(0.0, 10.0)), "fzactual": InputVariable("reinke", 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)), @@ -650,7 +629,7 @@ def __post_init__(self): ), "p_div_coolant_pump_mw": InputVariable("heat_transport", float, range=(0.0, 1000.0)), "p_fw_coolant_pump_mw": InputVariable("heat_transport", float, range=(0.0, 1000.0)), - "htpmw_ife": InputVariable(data_structure.ife_variables, float, range=(0.0, 1000.0)), + "htpmw_ife": InputVariable("ife", float, range=(0.0, 1000.0)), "p_shld_coolant_pump_mw": InputVariable( "heat_transport", float, range=(0.0, 1000.0) ), @@ -671,18 +650,14 @@ def __post_init__(self): ), "temp_blkt_coolant_in": InputVariable("fwbs", float, range=(200.0, 600.0)), "inlet_temp_liq": InputVariable("fwbs", float, range=(508.0, 1500.0)), - "iotabar": InputVariable( - data_structure.stellarator_variables, float, range=(0.1, 10.0) - ), + "iotabar": InputVariable("stellarator", float, range=(0.1, 10.0)), "j_tf_bus": InputVariable( data_structure.tfcoil_variables, float, range=(10000.0, 100000000.0) ), "kappa": InputVariable(data_structure.physics_variables, float, range=(0.99, 5.0)), "kappa95": InputVariable(data_structure.physics_variables, float, range=(0.99, 5.0)), "layer_ins": InputVariable(data_structure.tfcoil_variables, float, range=(0.0, 0.1)), - "f_dr_dz_cs_turn": InputVariable( - data_structure.pfcoil_variables, float, range=(0.0, 5.0) - ), + "f_dr_dz_cs_turn": InputVariable("pf_coil", float, range=(0.0, 5.0)), "len_fw_channel": InputVariable("fwbs", float, range=(0.001, 1000.0)), "len_tf_bus": InputVariable( data_structure.tfcoil_variables, float, range=(0.01, 1000.0) @@ -708,7 +683,7 @@ def __post_init__(self): "maintenance_fwbs": InputVariable("costs", float, range=(0.0, 1.0)), "maintenance_gen": InputVariable("costs", float, range=(0.0, 1.0)), "max_gyrotron_frequency": InputVariable( - data_structure.stellarator_variables, + "stellarator", float, range=(1000000000.0, 100000000000000.0), ), @@ -720,7 +695,7 @@ def __post_init__(self): ), "pflux_fw_rad_max": InputVariable("constraints", float, range=(0.1, 10.0)), "mbvfac": InputVariable("buildings", float, range=(0.9, 3.0)), - "mcdriv": InputVariable(data_structure.ife_variables, float, range=(0.1, 10.0)), + "mcdriv": InputVariable("ife", float, range=(0.1, 10.0)), "mvalim": InputVariable("constraints", float, range=(0.0, 1000.0)), "n_cycle_min": InputVariable("cs_fatigue", float, range=(0.0, 100000000.0)), "n_tf_coils": InputVariable( @@ -745,12 +720,8 @@ def __post_init__(self): "oacdcp": InputVariable( data_structure.tfcoil_variables, float, range=(10000.0, 1000000000.0) ), - "f_a_cs_turn_steel": InputVariable( - data_structure.pfcoil_variables, float, range=(0.001, 0.999) - ), - "f_z_cs_tf_internal": InputVariable( - data_structure.pfcoil_variables, float, range=(0.0, 2.0) - ), + "f_a_cs_turn_steel": InputVariable("pf_coil", float, range=(0.001, 0.999)), + "f_z_cs_tf_internal": InputVariable("pf_coil", float, range=(0.0, 2.0)), "outgasfactor": InputVariable("vacuum", float, range=(1e-06, 1000.0)), "outgasindex": InputVariable("vacuum", float, range=(1e-06, 1000.0)), "temp_blkt_coolant_out": InputVariable("fwbs", float, range=(450.0, 900.0)), @@ -762,14 +733,10 @@ def __post_init__(self): "p_plasma_separatrix_min_mw": InputVariable( "constraints", float, range=(0.1, 1000.0) ), - "pdrive": InputVariable( - data_structure.ife_variables, float, range=(1000000.0, 200000000.0) - ), + "pdrive": InputVariable("ife", float, range=(1000000.0, 200000000.0)), "pfbldgm3": InputVariable("buildings", float, range=(10000.0, 1000000.0)), - "rho_pf_coil": InputVariable( - data_structure.pfcoil_variables, float, range=(0.0, 0.0001) - ), - "pfusife": InputVariable(data_structure.ife_variables, float, range=(0.0, 10000.0)), + "rho_pf_coil": InputVariable("pf_coil", float, range=(0.0, 0.0001)), + "pfusife": InputVariable("ife", float, range=(0.0, 10000.0)), "p_hcd_primary_extra_heat_mw": InputVariable( "current_drive", float, range=(0.0, 1000.0) ), @@ -777,7 +744,7 @@ def __post_init__(self): "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)), + "pifecr": InputVariable("ife", float, range=(0.0, 100.0)), "p_hcd_injected_max": InputVariable("current_drive", float, range=(0.0, 1000.0)), "p_hcd_secondary_injected_mw": InputVariable( "current_drive", float, range=(0.0, 1000.0) @@ -811,7 +778,7 @@ def __post_init__(self): "prn1": InputVariable(data_structure.divertor_variables, float, range=(0.0, 1.0)), "psepbqarmax": InputVariable("constraints", float, range=(1.0, 50.0)), "pseprmax": InputVariable("constraints", float, range=(1.0, 60.0)), - "ptargf": InputVariable(data_structure.ife_variables, float, range=(0.1, 100.0)), + "ptargf": InputVariable("ife", float, range=(0.1, 100.0)), "temp_cp_max": InputVariable( data_structure.tfcoil_variables, float, range=(4.0, 573.15) ), @@ -880,9 +847,7 @@ def __post_init__(self): "radius_plasma_pedestal_temp_norm": InputVariable( data_structure.physics_variables, float, range=(0.01, 1.0) ), - "rhopfbus": InputVariable( - data_structure.pfcoil_variables, float, range=(0.0, 1e-05) - ), + "rhopfbus": InputVariable("pf_coil", float, range=(0.0, 1e-05)), "rinboard": InputVariable("build", float, range=(0.1, 10.0)), "ripple_b_tf_plasma_edge_max": InputVariable( data_structure.tfcoil_variables, float, range=(0.1, 100.0) @@ -892,16 +857,12 @@ def __post_init__(self): "robotics_l": InputVariable("buildings", float, range=(10.0, 1000.0)), "robotics_w": InputVariable("buildings", float, range=(10.0, 1000.0)), "roughness_fw_channel": InputVariable("fwbs", float, range=(0.0, 0.01)), - "dr_pf_tf_outboard_out_offset": InputVariable( - data_structure.pfcoil_variables, float, range=(-3.0, 3.0) - ), + "dr_pf_tf_outboard_out_offset": InputVariable("pf_coil", float, range=(-3.0, 3.0)), "row": InputVariable("buildings", float, range=(0.0, 10.0)), - "dr_pf_cs_middle_offset": InputVariable( - data_structure.pfcoil_variables, float, range=(0.0, 3.0) - ), - "rpf2": InputVariable(data_structure.pfcoil_variables, float, range=(-3.0, 3.0)), - "rrin": InputVariable(data_structure.ife_variables, float, range=(0.1, 50.0)), - "rrmax": InputVariable(data_structure.ife_variables, float, range=(1.0, 50.0)), + "dr_pf_cs_middle_offset": InputVariable("pf_coil", float, range=(0.0, 3.0)), + "rpf2": InputVariable("pf_coil", float, range=(-3.0, 3.0)), + "rrin": InputVariable("ife", float, range=(0.1, 50.0)), + "rrmax": InputVariable("ife", float, range=(1.0, 50.0)), "rrr_tf_cu": InputVariable( data_structure.tfcoil_variables, float, range=(1.0, 1000.0) ), @@ -912,12 +873,10 @@ def __post_init__(self): "sf_fast_fracture": InputVariable("cs_fatigue", float, range=(1.0, 10.0)), "sf_radial_crack": InputVariable("cs_fatigue", float, range=(1.0, 10.0)), "sf_vertical_crack": InputVariable("cs_fatigue", float, range=(1.0, 10.0)), - "shdr": InputVariable(data_structure.ife_variables, float, range=(0.0, 10.0)), - "shdzl": InputVariable(data_structure.ife_variables, float, range=(0.0, 10.0)), - "shdzu": InputVariable(data_structure.ife_variables, float, range=(0.0, 10.0)), - "shear": InputVariable( - data_structure.stellarator_variables, float, range=(0.1, 10.0) - ), + "shdr": InputVariable("ife", float, range=(0.0, 10.0)), + "shdzl": InputVariable("ife", float, range=(0.0, 10.0)), + "shdzu": InputVariable("ife", float, range=(0.0, 10.0)), + "shear": InputVariable("stellarator", float, range=(0.1, 10.0)), "dz_shld_lower": InputVariable("build", float, range=(0.0, 10.0)), "dz_shld_upper": InputVariable("build", float, range=(0.0, 10.0)), "shmf": InputVariable("buildings", float, range=(0.0, 1.0)), @@ -929,12 +888,10 @@ def __post_init__(self): data_structure.tfcoil_variables, float, range=(1000000.0, 100000000000.0) ), "sigallpc": InputVariable("build", float, range=(0.0, 1000000000.0)), - "sigpfcalw": InputVariable( - data_structure.pfcoil_variables, float, range=(1.0, 1000.0) - ), - "sigpfcf": InputVariable(data_structure.pfcoil_variables, float, range=(0.1, 1.0)), - "sombdr": InputVariable(data_structure.ife_variables, float, range=(0.0, 10.0)), - "somtdr": InputVariable(data_structure.ife_variables, float, range=(0.0, 10.0)), + "sigpfcalw": InputVariable("pf_coil", float, range=(1.0, 1000.0)), + "sigpfcf": InputVariable("pf_coil", float, range=(0.1, 1.0)), + "sombdr": InputVariable("ife", float, range=(0.0, 10.0)), + "somtdr": InputVariable("ife", float, range=(0.0, 10.0)), "staff_buildings_area": InputVariable( "buildings", float, range=(10000.0, 1000000.0) ), @@ -1020,9 +977,7 @@ def __post_init__(self): "temp_plasma_electron_vol_avg_kev": InputVariable( data_structure.physics_variables, float, range=(1.0, 200.0) ), - "te0_ecrh_achievable": InputVariable( - data_structure.stellarator_variables, float, range=(1.0, 1000.0) - ), + "te0_ecrh_achievable": InputVariable("stellarator", float, range=(1.0, 1000.0)), "temp_cp_average": InputVariable( data_structure.tfcoil_variables, float, range=(4.0, 573.15) ), @@ -1041,7 +996,7 @@ def __post_init__(self): ), "f_dr_tf_outboard_inboard": InputVariable("build", float, range=(0.2, 5.0)), "tftmp": InputVariable(data_structure.tfcoil_variables, float, range=(0.01, 293.0)), - "tgain": InputVariable(data_structure.ife_variables, float, range=(1.0, 500.0)), + "tgain": InputVariable("ife", float, range=(1.0, 500.0)), "th_joint_contact": InputVariable( data_structure.tfcoil_variables, float, range=(0.0, 1.0) ), @@ -1113,9 +1068,9 @@ def __post_init__(self): "ucblss": InputVariable("costs", float, range=(10.0, 1000.0)), "ucblvd": InputVariable("costs", float, range=(100.0, 1000.0)), "ucbus": InputVariable("costs", float, range=(0.01, 10.0)), - "uccarb": InputVariable(data_structure.ife_variables, float, range=(10.0, 1000.0)), + "uccarb": InputVariable("ife", float, range=(10.0, 1000.0)), "uccase": InputVariable("costs", float, range=(1.0, 1000.0)), - "ucconc": InputVariable(data_structure.ife_variables, float, range=(0.1, 1000.0)), + "ucconc": InputVariable("ife", float, range=(0.1, 1000.0)), "uccpcl1": InputVariable("costs", float, range=(1.0, 1000.0)), "uccpclb": InputVariable("costs", float, range=(1.0, 1000.0)), "uccry": InputVariable("costs", float, range=(10000.0, 1000000.0)), @@ -1124,7 +1079,7 @@ def __post_init__(self): "ucdiv": InputVariable("costs", float, range=(1000.0, 10000000.0)), "ucech": InputVariable("costs", float, range=(1.0, 10.0)), "ucf1": InputVariable("costs", float, range=(1000000.0, 50000000.0)), - "ucflib": InputVariable(data_structure.ife_variables, float, range=(10.0, 1000.0)), + "ucflib": InputVariable("ife", float, range=(10.0, 1000.0)), "ucfnc": InputVariable("costs", float, range=(10.0, 100.0)), "ucfuel": InputVariable("costs", float, range=(1.0, 10.0)), "uche3": InputVariable("costs", float, range=(100000.0, 10000000.0)), @@ -1145,7 +1100,7 @@ def __post_init__(self): "ucpfps": InputVariable("costs", float, range=(1000.0, 100000.0)), "ucrb": InputVariable("costs", float, range=(100.0, 1000.0)), "ucshld": InputVariable("costs", float, range=(1.0, 100.0)), - "uctarg": InputVariable(data_structure.ife_variables, float, range=(0.1, 1000.0)), + "uctarg": InputVariable("ife", float, range=(0.1, 1000.0)), "uctfbr": InputVariable("costs", float, range=(1.0, 10.0)), "uctfbus": InputVariable("costs", float, range=(1.0, 1000.0)), "uctfps": InputVariable("costs", float, range=(1.0, 1000.0)), @@ -1159,15 +1114,15 @@ def __post_init__(self): "uufw": InputVariable("costs", float, range=(0.005, 0.1)), "uumag": InputVariable("costs", float, range=(0.005, 0.1)), "uuves": InputVariable("costs", float, range=(0.005, 0.1)), - "v1dr": InputVariable(data_structure.ife_variables, float, range=(0.0, 10.0)), - "v1dzl": InputVariable(data_structure.ife_variables, float, range=(0.0, 10.0)), - "v1dzu": InputVariable(data_structure.ife_variables, float, range=(0.0, 10.0)), - "v2dr": InputVariable(data_structure.ife_variables, float, range=(0.0, 10.0)), - "v2dzl": InputVariable(data_structure.ife_variables, float, range=(0.0, 10.0)), - "v2dzu": InputVariable(data_structure.ife_variables, float, range=(0.0, 10.0)), - "v3dr": InputVariable(data_structure.ife_variables, float, range=(0.0, 50.0)), - "v3dzl": InputVariable(data_structure.ife_variables, float, range=(0.0, 30.0)), - "v3dzu": InputVariable(data_structure.ife_variables, float, range=(0.0, 30.0)), + "v1dr": InputVariable("ife", float, range=(0.0, 10.0)), + "v1dzl": InputVariable("ife", float, range=(0.0, 10.0)), + "v1dzu": InputVariable("ife", float, range=(0.0, 10.0)), + "v2dr": InputVariable("ife", float, range=(0.0, 10.0)), + "v2dzl": InputVariable("ife", float, range=(0.0, 10.0)), + "v2dzu": InputVariable("ife", float, range=(0.0, 10.0)), + "v3dr": InputVariable("ife", float, range=(0.0, 50.0)), + "v3dzl": InputVariable("ife", float, range=(0.0, 30.0)), + "v3dzu": InputVariable("ife", float, range=(0.0, 30.0)), "vachtmw": InputVariable("heat_transport", float, range=(0.0, 100.0)), "vel_cp_coolant_midplane": InputVariable( data_structure.tfcoil_variables, float, range=(0.001, 100.0) @@ -1177,9 +1132,7 @@ def __post_init__(self): ), "f_a_blkt_cooling_channels": InputVariable("fwbs", float, range=(0.0, 1.0)), "vfcblkt": InputVariable("fwbs", float, range=(0.0, 1.0)), - "f_a_cs_void": InputVariable( - data_structure.pfcoil_variables, float, range=(0.0, 1.0) - ), + "f_a_cs_void": InputVariable("pf_coil", float, range=(0.0, 1.0)), "vfpblkt": InputVariable("fwbs", float, range=(0.0, 1.0)), "vfshld": InputVariable("fwbs", float, range=(0.0, 1.0)), "f_a_tf_turn_cable_space_extra_void": InputVariable( @@ -1213,8 +1166,8 @@ def __post_init__(self): "blktmodel": InputVariable("fwbs", int, choices=[0, 1]), "blkttype": InputVariable("fwbs", int, choices=[1, 2, 3]), "breedmat": InputVariable("fwbs", int, choices=[1, 2, 3]), - "ccl0_ma": InputVariable(data_structure.pfcoil_variables, float, array=True), - "ccls_ma": InputVariable(data_structure.pfcoil_variables, float, array=True), + "ccl0_ma": InputVariable("pf_coil", float, array=True), + "ccls_ma": InputVariable("pf_coil", float, array=True), "cfind": InputVariable("costs", float, array=True), "i_blkt_coolant_type": InputVariable("fwbs", int, choices=[1, 2]), "coppera_m2_max": InputVariable( @@ -1241,7 +1194,7 @@ def __post_init__(self): "i_cp_joints": InputVariable(data_structure.tfcoil_variables, int, choices=[0, 1]), "i_cp_lifetime": InputVariable("costs", int, range=(0, 3)), "i_cs_precomp": InputVariable("build", int, choices=[0, 1]), - "i_cs_stress": InputVariable(data_structure.pfcoil_variables, int, choices=[0, 1]), + "i_cs_stress": InputVariable("pf_coil", int, choices=[0, 1]), "i_density_limit": InputVariable( data_structure.physics_variables, int, range=(1, 8) ), @@ -1254,9 +1207,7 @@ def __post_init__(self): "i_l_h_threshold": InputVariable( data_structure.physics_variables, int, range=(1, 21) ), - "i_pf_current": InputVariable( - data_structure.pfcoil_variables, int, choices=[0, 1, 2] - ), + "i_pf_current": InputVariable("pf_coil", int, choices=[0, 1, 2]), "i_pfirsch_schluter_current": InputVariable( data_structure.physics_variables, int, choices=[0, 1] ), @@ -1283,9 +1234,7 @@ def __post_init__(self): data_structure.physics_variables, int, choices=[0, 1] ), "i_str_wp": InputVariable(data_structure.tfcoil_variables, int, choices=[0, 1]), - "i_r_pf_outside_tf_placement": InputVariable( - data_structure.pfcoil_variables, int, choices=[0, 1] - ), + "i_r_pf_outside_tf_placement": InputVariable("pf_coil", int, choices=[0, 1]), "i_tf_bucking": InputVariable(data_structure.tfcoil_variables, int, range=(0, 3)), "i_tf_case_geom": InputVariable( data_structure.tfcoil_variables, int, choices=[0, 1] @@ -1315,9 +1264,9 @@ def __post_init__(self): "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)), - "ifetyp": InputVariable(data_structure.ife_variables, int, range=(0, 4)), + "ife": InputVariable("ife", int, choices=[0, 1]), + "ifedrv": InputVariable("ife", int, range=(-1, 3)), + "ifetyp": InputVariable("ife", int, range=(0, 4)), "ifueltyp": InputVariable("costs", int, choices=[0, 1, 2]), "i_plasma_ignited": InputVariable( data_structure.physics_variables, int, choices=[0, 1] @@ -1328,9 +1277,7 @@ def __post_init__(self): "i_plasma_pedestal": InputVariable( data_structure.physics_variables, int, choices=[0, 1] ), - "i_pf_conductor": InputVariable( - data_structure.pfcoil_variables, int, choices=[0, 1] - ), + "i_pf_conductor": InputVariable("pf_coil", int, choices=[0, 1]), "ipnet": InputVariable("costs", int, choices=[0, 1]), "ipowerflow": InputVariable("heat_transport", int, choices=[0, 1]), "i_shld_primary_heat": InputVariable("heat_transport", int, choices=[0, 1]), @@ -1348,15 +1295,11 @@ def __post_init__(self): "i_pf_energy_storage_source": InputVariable( data_structure.pf_power_variables, int, range=(1, 3) ), - "istell": InputVariable(data_structure.stellarator_variables, int, range=(0, 6)), - "isthtr": InputVariable(data_structure.stellarator_variables, int, range=(1, 3)), + "istell": InputVariable("stellarator", int, range=(0, 6)), + "isthtr": InputVariable("stellarator", int, range=(1, 3)), "istore": InputVariable("pulse", int, range=(1, 3)), - "i_cs_superconductor": InputVariable( - data_structure.pfcoil_variables, int, range=(1, 9) - ), - "i_pf_superconductor": InputVariable( - data_structure.pfcoil_variables, int, range=(1, 9) - ), + "i_cs_superconductor": InputVariable("pf_coil", int, range=(1, 9)), + "i_pf_superconductor": InputVariable("pf_coil", int, range=(1, 9)), "itart": InputVariable(data_structure.physics_variables, int, choices=[0, 1]), "itartpf": InputVariable(data_structure.physics_variables, int, choices=[0, 1]), "itcycl": InputVariable("pulse", int, range=(1, 3)), @@ -1364,7 +1307,7 @@ def __post_init__(self): data_structure.physics_variables, int, range=(1, 2) ), "lsa": InputVariable("costs", int, range=(1, 4)), - "m_res": InputVariable(data_structure.stellarator_variables, int, range=(1, 10)), + "m_res": InputVariable("stellarator", int, range=(1, 10)), "n_tf_wp_layers": InputVariable( data_structure.tfcoil_variables, int, range=(1, 100) ), @@ -1378,7 +1321,7 @@ def __post_init__(self): "n_rad_per_layer": InputVariable( data_structure.tfcoil_variables, int, range=(1, 500) ), - "n_res": InputVariable(data_structure.stellarator_variables, int, range=(3, 6)), + "n_res": InputVariable("stellarator", int, range=(3, 6)), "n_tf_graded_layers": InputVariable( data_structure.tfcoil_variables, int, range=(1, 20) ), @@ -1415,40 +1358,32 @@ def __post_init__(self): "i_fw_coolant_type": InputVariable("fwbs", str, choices=["helium", "water"]), "i_vacuum_pumping": InputVariable("vacuum", str, choices=["old", "simple"]), "dcond": InputVariable(data_structure.tfcoil_variables, float, array=True), - "c_pf_coil_turn_peak_input": InputVariable( - data_structure.pfcoil_variables, float, array=True - ), - "i_pf_location": InputVariable(data_structure.pfcoil_variables, int, array=True), - "n_pf_coils_in_group": InputVariable( - data_structure.pfcoil_variables, int, array=True - ), - "n_cs_current_filaments": InputVariable( - data_structure.pfcoil_variables, int, array=True - ), + "c_pf_coil_turn_peak_input": InputVariable("pf_coil", float, array=True), + "i_pf_location": InputVariable("pf_coil", int, array=True), + "n_pf_coils_in_group": InputVariable("pf_coil", int, array=True), + "n_cs_current_filaments": InputVariable("pf_coil", int, array=True), "n_pf_coil_groups": InputVariable( - data_structure.pfcoil_variables, + "pf_coil", int, - range=(0, data_structure.pfcoil_variables.N_PF_GROUPS_MAX), + range=(0, N_PF_GROUPS_MAX), ), - "rref": InputVariable(data_structure.pfcoil_variables, float, array=True), - "f_a_pf_coil_void": InputVariable( - data_structure.pfcoil_variables, float, array=True - ), - "zref": InputVariable(data_structure.pfcoil_variables, float, array=True), + "rref": InputVariable("pf_coil", float, array=True), + "f_a_pf_coil_void": InputVariable("pf_coil", float, array=True), + "zref": InputVariable("pf_coil", float, array=True), "uchts": InputVariable("costs", float, array=True), "ucoam": InputVariable("costs", float, array=True), "ucsc": InputVariable("costs", float, array=True), "ucturb": InputVariable("costs", float, array=True), "ucwst": InputVariable("costs", float, array=True), - "blmatf": InputVariable(data_structure.ife_variables, float, array=True), - "chmatf": InputVariable(data_structure.ife_variables, float, array=True), - "etave": InputVariable(data_structure.ife_variables, float, array=True), - "fwmatf": InputVariable(data_structure.ife_variables, float, array=True), - "gainve": InputVariable(data_structure.ife_variables, float, array=True), - "shmatf": InputVariable(data_structure.ife_variables, float, array=True), - "v1matf": InputVariable(data_structure.ife_variables, float, array=True), - "v2matf": InputVariable(data_structure.ife_variables, float, array=True), - "v3matf": InputVariable(data_structure.ife_variables, float, array=True), + "blmatf": InputVariable("ife", float, array=True), + "chmatf": InputVariable("ife", float, array=True), + "etave": InputVariable("ife", float, array=True), + "fwmatf": InputVariable("ife", float, array=True), + "gainve": InputVariable("ife", float, array=True), + "shmatf": InputVariable("ife", float, array=True), + "v1matf": InputVariable("ife", float, array=True), + "v2matf": InputVariable("ife", float, array=True), + "v3matf": InputVariable("ife", float, array=True), "isweep": InputVariable( data_structure.scan_variables, int, @@ -1476,9 +1411,7 @@ def __post_init__(self): int, choices=range(3, data_structure.impurity_radiation_module.N_IMPURITIES + 1), ), - "j_pf_coil_wp_peak": InputVariable( - data_structure.pfcoil_variables, float, array=True - ), + "j_pf_coil_wp_peak": InputVariable("pf_coil", float, array=True), "ixc": InputVariable( None, int, diff --git a/process/core/io/plot/summary.py b/process/core/io/plot/summary.py index b340d0ab2..bce8c6173 100644 --- a/process/core/io/plot/summary.py +++ b/process/core/io/plot/summary.py @@ -21,7 +21,8 @@ from process.core import constants from process.core.io.mfile import MFile, MFileErrorClass from process.core.solver.objectives import OBJECTIVE_NAMES -from process.data_structure import impurity_radiation_module, pfcoil_variables +from process.data_structure import impurity_radiation_module +from process.data_structure.pfcoil_variables import NFIXMX from process.models.build import Build from process.models.geometry.blanket import ( blanket_geometry_double_null, @@ -9618,12 +9619,10 @@ def plot_cs_coil_structure( dz_cs = mfile.get("dz_cs_full", scan=scan) dr_bore = mfile.get("dr_bore", scan=scan) r_cs_current_filaments_array = [ - mfile.get(f"r_pf_cs_current_filaments{i}", scan=scan) - for i in range(pfcoil_variables.NFIXMX) + mfile.get(f"r_pf_cs_current_filaments{i}", scan=scan) for i in range(NFIXMX) ] z_cs_current_filaments_array = [ - mfile.get(f"z_pf_cs_current_filaments{i}", scan=scan) - for i in range(pfcoil_variables.NFIXMX) + mfile.get(f"z_pf_cs_current_filaments{i}", scan=scan) for i in range(NFIXMX) ] # Plot the right side of the CS diff --git a/process/core/model.py b/process/core/model.py index c5161a5a4..726126063 100644 --- a/process/core/model.py +++ b/process/core/model.py @@ -14,9 +14,14 @@ from process.data_structure.first_wall_variables import FirstWallData from process.data_structure.fwbs_variables import FWBSData from process.data_structure.heat_transport_variables import HeatTransportData +from process.data_structure.ife_variables import IFEData +from process.data_structure.pfcoil_variables import PFCoilData +from process.data_structure.power_variables import PowerData from process.data_structure.primary_pumping_variables import PrimaryPumpingData from process.data_structure.pulse_variables import PulseData from process.data_structure.reinke_variables import ReinkeData +from process.data_structure.stellarator_configuration import StellaratorConfigData +from process.data_structure.stellarator_variables import StellaratorData from process.data_structure.structure_variables import StructureData from process.data_structure.times_variables import TimesData from process.data_structure.vacuum_variables import VacuumData @@ -47,6 +52,11 @@ class DataStructure: dcll: DCLLData = initialise_later current_drive: CurrentDriveData = initialise_later heat_transport: HeatTransportData = initialise_later + ife: IFEData = initialise_later + pf_coil: PFCoilData = initialise_later + power: PowerData = initialise_later + stellarator: StellaratorData = initialise_later + stellarator_config: StellaratorConfigData = initialise_later def __post_init__(self): for f in fields(self): diff --git a/process/core/output.py b/process/core/output.py index c8d9530b2..83435cca6 100644 --- a/process/core/output.py +++ b/process/core/output.py @@ -25,12 +25,12 @@ def write(models, data, _outfile): logging_model_handler.clear_logs() # Call stellarator output routine instead if relevant - if data_structure.stellarator_variables.istell != 0: + if data.stellarator.istell != 0: models.stellarator.output() return # Call IFE output routine instead if relevant - if data_structure.ife_variables.ife != 0: + if data.ife.ife != 0: models.ife.output() return diff --git a/process/core/scan.py b/process/core/scan.py index 7588537e7..82d15c273 100644 --- a/process/core/scan.py +++ b/process/core/scan.py @@ -20,7 +20,6 @@ global_variables, impurity_radiation_module, numerics, - pfcoil_variables, physics_variables, rebco_variables, scan_variables, @@ -1121,7 +1120,7 @@ def scan_select(self, nwp, swp, iscn): case 28: physics_variables.b_plasma_toroidal_on_axis = swp[iscn - 1] case 29: - impurity_radiation_module.coreradius = swp[iscn - 1] + impurity_radiation_module.radius_plasma_core_norm = swp[iscn - 1] case 31: self.data.constraints.f_alpha_energy_confinement_min = swp[iscn - 1] case 32: @@ -1177,15 +1176,15 @@ def scan_select(self, nwp, swp, iscn): case 61: rebco_variables.copperaoh_m2_max = swp[iscn - 1] case 62: - pfcoil_variables.coheof = swp[iscn - 1] + self.data.pf_coil.j_cs_flat_top_end = swp[iscn - 1] case 63: self.data.build.dr_cs = swp[iscn - 1] case 64: - pfcoil_variables.ohhghf = swp[iscn - 1] + self.data.pf_coil.f_z_cs_tf_internal = swp[iscn - 1] case 65: self.data.cs_fatigue.n_cycle_min = swp[iscn - 1] case 66: - pfcoil_variables.oh_steel_frac = swp[iscn - 1] + self.data.pf_coil.f_a_cs_turn_steel = swp[iscn - 1] case 67: self.data.cs_fatigue.t_crack_vertical = swp[iscn - 1] case 68: diff --git a/process/core/solver/constraints.py b/process/core/solver/constraints.py index f2537877f..983091e24 100644 --- a/process/core/solver/constraints.py +++ b/process/core/solver/constraints.py @@ -512,7 +512,7 @@ def constraint_equation_11(constraint_registration, data): @ConstraintManager.register_constraint(12, "V.sec", ">=") -def constraint_equation_12(constraint_registration, _data): +def constraint_equation_12(constraint_registration, data): """Equation for volt-second capability lower limit vs_plasma_total_required: total V-s needed (Wb) @@ -521,7 +521,7 @@ def constraint_equation_12(constraint_registration, _data): """ # vs_cs_pf_total_pulse is negative, requires sign change return geq( - -data_structure.pfcoil_variables.vs_cs_pf_total_pulse, + -data.pf_coil.vs_cs_pf_total_pulse, data_structure.physics_variables.vs_plasma_total_required, constraint_registration, ) @@ -737,7 +737,7 @@ def constraint_equation_23(constraint_registration, data): @ConstraintManager.register_constraint(24, "", "<=") -def constraint_equation_24(constraint_registration, _data): +def constraint_equation_24(constraint_registration, data): """Equation for beta upper limit i_beta_component: switch for beta limit scaling (constraint equation 24): @@ -758,7 +758,7 @@ def constraint_equation_24(constraint_registration, _data): # Include all beta components: relevant for both tokamaks and stellarators if ( data_structure.physics_variables.i_beta_component == BetaComponentLimits.TOTAL - or data_structure.stellarator_variables.istell != 0 + or data.stellarator.istell != 0 ): value = data_structure.physics_variables.beta_total_vol_avg # Here, the beta limit applies to only the thermal component, not the fast alpha or neutral beam parts @@ -822,10 +822,7 @@ def constraint_equation_26(constraint_registration, data): j_cs_flat_top_end: central solenoid overall current density at end of flat-top (A/m²) """ return leq( - ( - data_structure.pfcoil_variables.j_cs_flat_top_end - / data_structure.pfcoil_variables.j_cs_critical_flat_top_end - ), + (data.pf_coil.j_cs_flat_top_end / data.pf_coil.j_cs_critical_flat_top_end), data.constraints.fjohc, constraint_registration, ) @@ -840,10 +837,7 @@ def constraint_equation_27(constraint_registration, data): j_cs_pulse_start: central solenoid overall current density at beginning of pulse (A/m²) """ return leq( - ( - data_structure.pfcoil_variables.j_cs_pulse_start - / data_structure.pfcoil_variables.j_cs_critical_pulse_start - ), + (data.pf_coil.j_cs_pulse_start / data.pf_coil.j_cs_critical_pulse_start), data.constraints.fjohc0, constraint_registration, ) @@ -1187,17 +1181,17 @@ def constraint_equation_48(constraint_registration, data): @ConstraintManager.register_constraint(50, "Hz", "<=") -def constraint_equation_50(constraint_registration, _data): +def constraint_equation_50(constraint_registration, data): """IFE option: Equation for repetition rate upper limit""" return leq( - data_structure.ife_variables.reprat, - data_structure.ife_variables.rrmax, + data.ife.reprat, + data.ife.rrmax, constraint_registration, ) @ConstraintManager.register_constraint(51, "V.s", "=") -def constraint_equation_51(constraint_registration, _data): +def constraint_equation_51(constraint_registration, data): """Equation to enforce startup flux = available startup flux vs_plasma_res_ramp: resistive losses in startup V-s (Wb) @@ -1209,7 +1203,7 @@ def constraint_equation_51(constraint_registration, _data): data_structure.physics_variables.vs_plasma_res_ramp + data_structure.physics_variables.vs_plasma_ind_ramp ), - data_structure.pfcoil_variables.vs_cs_pf_total_ramp, + data.pf_coil.vs_cs_pf_total_ramp, constraint_registration, ) @@ -1223,7 +1217,7 @@ def constraint_equation_52(constraint_registration, data): tbr: tritium breeding ratio tbrmin: minimum tritium breeding ratio """ - if data_structure.ife_variables.ife != 1: + if data.ife.ife != 1: raise ProcessValueError( "Constraint 52 is only supported when running the IFE model" ) @@ -1296,14 +1290,14 @@ def constraint_equation_59(constraint_registration, data): @ConstraintManager.register_constraint(60, "K", ">=") -def constraint_equation_60(constraint_registration, _data): +def constraint_equation_60(constraint_registration, data): """Equation for Central Solenoid s/c temperature margin lower limit temp_cs_superconductor_margin: Central solenoid temperature margin (K) temp_cs_superconductor_margin_min: Minimum allowable temperature margin : CS (K) """ return geq( - data_structure.pfcoil_variables.temp_cs_superconductor_margin, + data.pf_coil.temp_cs_superconductor_margin, data_structure.tfcoil_variables.temp_cs_superconductor_margin_min, constraint_registration, ) @@ -1483,16 +1477,16 @@ def constraint_equation_72(constraint_registration, data): ): return leq( max( - data_structure.pfcoil_variables.s_shear_cs_peak, + data.pf_coil.s_shear_cs_peak, data_structure.tfcoil_variables.sig_tf_cs_bucked, ), - data_structure.pfcoil_variables.alstroh, + data.pf_coil.alstroh, constraint_registration, ) # Free standing CS return leq( - data_structure.pfcoil_variables.s_shear_cs_peak, - data_structure.pfcoil_variables.alstroh, + data.pf_coil.s_shear_cs_peak, + data.pf_coil.alstroh, constraint_registration, ) @@ -1613,7 +1607,7 @@ def constraint_equation_78(constraint_registration, data): @ConstraintManager.register_constraint(79, "A/turn", "<=") -def constraint_equation_79(constraint_registration, _data): +def constraint_equation_79(constraint_registration, data): """Equation for maximum CS field b_cs_limit_max: Central solenoid max field limit [T] @@ -1623,10 +1617,10 @@ def constraint_equation_79(constraint_registration, _data): """ return leq( max( - data_structure.pfcoil_variables.b_cs_peak_flat_top_end, - data_structure.pfcoil_variables.b_cs_peak_pulse_start, + data.pf_coil.b_cs_peak_flat_top_end, + data.pf_coil.b_cs_peak_pulse_start, ), - data_structure.pfcoil_variables.b_cs_limit_max, + data.pf_coil.b_cs_limit_max, constraint_registration, ) @@ -1827,15 +1821,15 @@ def constraint_equation_91(constraint_registration, data): # Achievable ECRH te needs to be larger than needed te for igntion if data_structure.physics_variables.i_plasma_ignited == 0: value = ( - data_structure.stellarator_variables.powerht_constraint + data.stellarator.powerht_constraint + data.current_drive.p_hcd_primary_extra_heat_mw ) else: - value = data_structure.stellarator_variables.powerht_constraint + value = data.stellarator.powerht_constraint return geq( value, - data_structure.stellarator_variables.powerscaling_constraint, + data.stellarator.powerscaling_constraint, constraint_registration, ) diff --git a/process/core/solver/iteration_variables.py b/process/core/solver/iteration_variables.py index af5c0e189..53a644b72 100644 --- a/process/core/solver/iteration_variables.py +++ b/process/core/solver/iteration_variables.py @@ -69,12 +69,8 @@ class IterationVariable: 23: IterationVariable("fcoolcp", data_structure.tfcoil_variables, 0.1, 0.50), 29: IterationVariable("dr_bore", "build", 0.1, 10.00), 31: IterationVariable("gapomin", "build", 0.001, 1.0e1), - 37: IterationVariable( - "j_cs_flat_top_end", data_structure.pfcoil_variables, 1.0e5, 1.0e8 - ), - 41: IterationVariable( - "f_j_cs_start_pulse_end_flat_top", data_structure.pfcoil_variables, 0.001, 1.0 - ), + 37: IterationVariable("j_cs_flat_top_end", "pf_coil", 1.0e5, 1.0e8), + 41: IterationVariable("f_j_cs_start_pulse_end_flat_top", "pf_coil", 0.001, 1.0), 42: IterationVariable("dr_cs_tf_gap", "build", 0.001, 10.00), 44: IterationVariable( "f_c_plasma_non_inductive", data_structure.physics_variables, 0.001, 1.0 @@ -107,11 +103,11 @@ class IterationVariable: 73: IterationVariable("dr_fw_plasma_gap_inboard", "build", 0.001, 10.00), 74: IterationVariable("dr_fw_plasma_gap_outboard", "build", 0.001, 10.00), 75: IterationVariable("f_dr_tf_outboard_inboard", "build", 0.200, 5.0), - 81: IterationVariable("edrive", data_structure.ife_variables, 1.0e5, 5.0e7), - 82: IterationVariable("drveff", data_structure.ife_variables, 0.010, 1.0), - 83: IterationVariable("tgain", data_structure.ife_variables, 1.0, 500.0), - 84: IterationVariable("chrad", data_structure.ife_variables, 0.1, 20.00), - 85: IterationVariable("pdrive", data_structure.ife_variables, 1.0e6, 200.0e6), + 81: IterationVariable("edrive", "ife", 1.0e5, 5.0e7), + 82: IterationVariable("drveff", "ife", 0.010, 1.0), + 83: IterationVariable("tgain", "ife", 1.0, 500.0), + 84: IterationVariable("chrad", "ife", 0.1, 20.00), + 85: IterationVariable("pdrive", "ife", 1.0e6, 200.0e6), 90: IterationVariable("blbuith", "build", 0.001, 2.0), 91: IterationVariable("blbuoth", "build", 0.001, 2.0), 93: IterationVariable("dr_shld_inboard", "build", 0.001, 10.00), @@ -126,9 +122,7 @@ class IterationVariable: 119: IterationVariable( "temp_plasma_separatrix_kev", data_structure.physics_variables, 0.0, 1.0e1 ), - 122: IterationVariable( - "f_a_cs_turn_steel", data_structure.pfcoil_variables, 0.001, 0.950 - ), + 122: IterationVariable("f_a_cs_turn_steel", "pf_coil", 0.001, 0.950), 125: IterationVariable( "f_nd_impurity_electrons(03)", data_structure.impurity_radiation_module, @@ -246,15 +240,13 @@ class IterationVariable: 152: IterationVariable( "f_nd_plasma_separatrix_greenwald", data_structure.physics_variables, 0.001, 0.5 ), - 155: IterationVariable("pfusife", data_structure.ife_variables, 5.0e2, 3.0e3), - 156: IterationVariable("rrin", data_structure.ife_variables, 1.0, 1.0e1), + 155: IterationVariable("pfusife", "ife", 5.0e2, 3.0e3), + 156: IterationVariable("rrin", "ife", 1.0, 1.0e1), 158: IterationVariable( "dx_croco_strand_copper", data_structure.rebco_variables, 1.0e-3, 1.0e-1 ), 162: IterationVariable("r_cp_top", "build", 0.0010, 10.0), - 169: IterationVariable( - "te0_ecrh_achievable", data_structure.stellarator_variables, 1.0, 1.0e3 - ), + 169: IterationVariable("te0_ecrh_achievable", "stellarator", 1.0, 1.0e3), 170: IterationVariable( "deg_div_field_plate", data_structure.divertor_variables, 0.49, 5.01 ), @@ -269,9 +261,7 @@ class IterationVariable: ), 174: IterationVariable("triang", data_structure.physics_variables, 0.00, 1.00), 175: IterationVariable("kappa", data_structure.physics_variables, 0.00, 10.00), - 176: IterationVariable( - "f_st_coil_aspect", data_structure.stellarator_variables, 0.70, 1.30 - ), + 176: IterationVariable("f_st_coil_aspect", "stellarator", 0.70, 1.30), } diff --git a/process/data_structure/ife_variables.py b/process/data_structure/ife_variables.py index f6708f3b2..9fc7ece23 100644 --- a/process/data_structure/ife_variables.py +++ b/process/data_structure/ife_variables.py @@ -11,6 +11,8 @@ - 'region' = 3 below chamber """ +from dataclasses import dataclass, field + import numpy as np MAXMAT = 8 @@ -26,905 +28,588 @@ - =8 lithium """ -bldr: float = None -"""radial thickness of IFE blanket (m; calculated `if ifetyp=4`)""" - - -bldrc: float = None -"""radial thickness of IFE curtain (m; `ifetyp=4`)""" - - -bldzl: float = None -"""vertical thickness of IFE blanket below chamber (m)""" - - -bldzu: float = None -"""vertical thickness of IFE blanket above chamber (m)""" - - -blmatf: list[float] = None -"""IFE blanket material fractions""" - - -blmatm: list[float] = None -"""IFE blanket material masses (kg)""" - -blmatv: list[float] = None -"""IFE blanket material volumes (m3)""" - -blvol: list[float] = None -"""IFE blanket volume (m3)""" - - -cdriv0: float = None -"""IFE generic/laser driver cost at edrive=0 (M$)""" - - -cdriv1: float = None -"""IFE low energy heavy ion beam driver cost extrapolated to `edrive=0` (M$)""" - - -cdriv2: float = None -"""IFE high energy heavy ion beam driver cost extrapolated to `edrive=0` (M$)""" - - -cdriv3: float = None -"""IFE driver cost ($/J wall plug) (`ifedrv==3`)""" - - -chdzl: float = None -"""vertical thickness of IFE chamber below centre (m)""" - - -chdzu: float = None -"""vertical thickness of IFE chamber above centre (m)""" - - -chmatf: list[float] = None -"""IFE chamber material fractions""" - - -chmatm: list[float] = None -"""IFE chamber material masses (kg)""" - - -chmatv: list[float] = None -"""IFE chamber material volumes (m3)""" - - -chrad: float = None -"""radius of IFE chamber (m) (`iteration variable 84`)""" - - -chvol: float = None -"""IFE chamber volume (m3)""" - - -dcdrv0: float = None -"""IFE generic/laser driver cost gradient (M$/MJ)""" - - -dcdrv1: float = None -"""HIB driver cost gradient at low energy (M$/MJ)""" - - -dcdrv2: float = None -"""HIB driver cost gradient at high energy (M$/MJ)""" - - -drveff: float = None -"""IFE driver wall plug to target efficiency (`ifedrv=0,3`) (`iteration variable 82`)""" - - -edrive: float = None -"""IFE driver energy (J) (`iteration variable 81`)""" - - -etadrv: float = None -"""IFE driver wall plug to target efficiency""" - - -etali: float = None -"""IFE lithium pump wall plug efficiency (`ifetyp=4`)""" - - -etave: list[float] = None -"""IFE driver efficiency vs driver energy (`ifedrv=-1`)""" - - -fauxbop: float = None -"""fraction of gross electric power to balance-of-plant (IFE)""" - - -fbreed: float = None -"""fraction of breeder external to device core""" - - -fburn: float = None -"""IFE burn fraction (fraction of tritium fused/target)""" - - -flirad: float = None -"""radius of FLiBe/lithium inlet (m) (`ifetyp=3,4`)""" - - -fwdr: float = None -"""radial thickness of IFE first wall (m)""" - - -fwdzl: float = None -"""vertical thickness of IFE first wall below chamber (m)""" - - -fwdzu: float = None -"""vertical thickness of IFE first wall above chamber (m)""" - - -fwmatf: list[float] = None -"""IFE first wall material fractions""" - - -fwmatm: list[float] = None -"""IFE first wall material masses (kg)""" - - -fwmatv: list[float] = None -"""IFE first wall material volumes (kg)""" - - -fwvol: list[float] = None -"""IFE first wall volume (m3)""" - - -gain: float = None -"""IFE target gain""" - - -gainve: list[float] = None -"""IFE target gain vs driver energy (`ifedrv=-1`)""" - - -htpmw_ife: float = None -"""IFE heat transport system electrical pump power (MW)""" - - -ife: int = None -"""Switch for IFE option: -- =0 use tokamak, RFP or stellarator model -- =1 use IFE model -""" - - -ifedrv: int = None -"""Switch for type of IFE driver: -- =-1 use gainve, etave for gain and driver efficiency -- =0 use tgain, drveff for gain and driver efficiency -- =1 use laser driver based on SOMBRERO design -- =2 use heavy ion beam driver based on OSIRIS -- =3 Input pfusife, rrin and drveff -""" - - -ifetyp: int = None -"""Switch for type of IFE device build: -- =0 generic (cylindrical) build -- =1 OSIRIS-like build -- =2 SOMBRERO-like build -- =3 HYLIFE-II-like build -- =4 2019 build -""" - - -lipmw: float = None -"""IFE lithium pump power (MW; `ifetyp=4`)""" - - -mcdriv: float = None -"""IFE driver cost multiplier""" - - -mflibe: float = None -"""total mass of FLiBe (kg)""" - - -pdrive: float = None -"""IFE driver power reaching target (W) (`iteration variable 85`)""" - - -pfusife: float = None -"""IFE input fusion power (MW) (`ifedrv=3 only`; `itv 155`)""" - - -pifecr: float = None -"""IFE cryogenic power requirements (MW)""" +@dataclass +class IFEData: + bldr: float = 1.0 + """radial thickness of IFE blanket (m; calculated `if ifetyp=4`)""" + + bldrc: float = 1.0 + """radial thickness of IFE curtain (m; `ifetyp=4`)""" + + bldzl: float = 4.0 + """vertical thickness of IFE blanket below chamber (m)""" + + bldzu: float = 4.0 + """vertical thickness of IFE blanket above chamber (m)""" + + blmatf: list[float] = field( + default_factory=lambda: np.reshape( + [ + 0.05, + 0.05, + 0.05, + 0.0, + 0.0, + 0.0, + 0.45, + 0.45, + 0.45, + 0.0, + 0.0, + 0.0, + 0.20, + 0.20, + 0.20, + 0.0, + 0.0, + 0.0, + 0.30, + 0.30, + 0.30, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + ], + (3, MAXMAT + 1), + ) + ) + """IFE blanket material fractions""" -ptargf: float = None -"""IFE target factory power at 6 Hz repetition rate (MW)""" - - -r1: float = None -"""IFE device radial build (m)""" - - -r2: float = None -"""IFE device radial build (m)""" - - -r3: float = None -"""IFE device radial build (m)""" - - -r4: float = None -"""IFE device radial build (m)""" - - -r5: float = None -"""IFE device radial build (m)""" - - -r6: float = None -"""IFE device radial build (m)""" - - -r7: float = None -"""IFE device radial build (m)""" - - -reprat: float = None -"""IFE driver repetition rate (Hz)""" - - -rrin: float = None -"""Input IFE repetition rate (Hz) (`ifedrv=3 only`; `itv 156`)""" - - -rrmax: float = None -"""maximum IFE repetition rate (Hz)""" - - -shdr: float = None -"""radial thickness of IFE shield (m)""" - - -shdzl: float = None -"""vertical thickness of IFE shield below chamber (m)""" - - -shdzu: float = None -"""vertical thickness of IFE shield above chamber (m)""" - - -shmatf: list[float] = None -"""IFE shield material fractions""" - - -shmatm: list[float] = None -"""IFE shield material masses (kg)""" - - -shmatv: list[float] = None -"""IFE shield material volumes (kg)""" - - -shvol: list[float] = None -"""IFE shield volume (m3)""" - - -sombdr: float = None -"""radius of cylindrical blanket section below chamber (`ifetyp=2`)""" - - -somtdr: float = None -"""radius of cylindrical blanket section above chamber (`ifetyp=2`)""" - - -taufall: float = None -"""Lithium Fall Time (s)""" - - -tdspmw: float = None -"""IFE target delivery system power (MW)""" - - -tfacmw: float = None -"""IFE target factory power (MW)""" - - -tgain: float = None -"""IFE target gain (if `ifedrv = 0`) (`iteration variable 83`)""" - - -uccarb: float = None -"""cost of carbon cloth ($/kg)""" - - -ucconc: float = None -"""cost of concrete ($/kg)""" - - -ucflib: float = None -"""cost of FLiBe ($/kg)""" - - -uctarg: float = None -"""cost of IFE target ($/target)""" - - -v1dr: float = None -"""radial thickness of IFE void between first wall and blanket (m)""" - - -v1dzl: float = None -"""vertical thickness of IFE void 1 below chamber (m)""" - - -v1dzu: float = None -"""vertical thickness of IFE void 1 above chamber (m)""" - - -v1matf: list[float] = None -"""IFE void 1 material fractions""" - - -v1matm: list[float] = None -"""IFE void 1 material masses (kg)""" - - -v1matv: list[float] = None -"""IFE void 1 material volumes (kg)""" - - -v1vol: list[float] = None -"""IFE void 1 volume (m3)""" - - -v2dr: float = None -"""radial thickness of IFE void between blanket and shield (m)""" - - -v2dzl: float = None -"""vertical thickness of IFE void 2 below chamber (m)""" - - -v2dzu: float = None -"""vertical thickness of IFE void 2 above chamber (m)""" - - -v2matf: list[float] = None -"""IFE void 2 material fractions""" - - -v2matm: list[float] = None -"""IFE void 2 material masses (kg)""" - - -v2matv: list[float] = None -"""IFE void 2 material volumes (kg)""" - - -v2vol: list[float] = None -"""IFE void 2 volume (m3)""" - - -v3dr: float = None -"""radial thickness of IFE void outside shield (m)""" - + blmatm: list[float] = field(default_factory=lambda: np.zeros((3, MAXMAT + 1))) + """IFE blanket material masses (kg)""" -v3dzl: float = None -"""vertical thickness of IFE void 3 below chamber (m)""" + blmatv: list[float] = field(default_factory=lambda: np.zeros((3, MAXMAT + 1))) + """IFE blanket material volumes (m3)""" + blvol: list[float] = field(default_factory=lambda: np.zeros(3)) + """IFE blanket volume (m3)""" -v3dzu: float = None -"""vertical thickness of IFE void 3 above chamber (m)""" + cdriv0: float = 154.3 + """IFE generic/laser driver cost at edrive=0 (M$)""" + cdriv1: float = 163.2 + """IFE low energy heavy ion beam driver cost extrapolated to `edrive=0` (M$)""" -v3matf: list[float] = None -"""IFE void 3 material fractions""" + cdriv2: float = 244.9 + """IFE high energy heavy ion beam driver cost extrapolated to `edrive=0` (M$)""" + cdriv3: float = 1.463 + """IFE driver cost ($/J wall plug) (`ifedrv==3`)""" -v3matm: list[float] = None -"""IFE void 3 material masses (kg)""" + chdzl: float = 9.0 + """vertical thickness of IFE chamber below centre (m)""" + chdzu: float = 9.0 + """vertical thickness of IFE chamber above centre (m)""" -v3matv: list[float] = None -"""IFE void 3 material volumes (kg)""" + chmatf: list[float] = field( + default_factory=lambda: np.array([1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) + ) + """IFE chamber material fractions""" + chmatm: list[float] = field(default_factory=lambda: np.zeros(MAXMAT + 1)) + """IFE chamber material masses (kg)""" -v3vol: list[float] = None -"""IFE void 3 volume (m3)""" + chmatv: list[float] = field(default_factory=lambda: np.zeros(MAXMAT + 1)) + """IFE chamber material volumes (m3)""" + chrad: float = 6.5 + """radius of IFE chamber (m) (`iteration variable 84`)""" -zl1: float = None -"""IFE vertical build below centre (m)""" + chvol: float = 0.0 + """IFE chamber volume (m3)""" + dcdrv0: float = 111.4 + """IFE generic/laser driver cost gradient (M$/MJ)""" -zl2: float = None -"""IFE vertical build below centre (m)""" + dcdrv1: float = 78.0 + """HIB driver cost gradient at low energy (M$/MJ)""" + dcdrv2: float = 59.9 + """HIB driver cost gradient at high energy (M$/MJ)""" -zl3: float = None -"""IFE vertical build below centre (m)""" + drveff: float = 0.28 + """IFE driver wall plug to target efficiency (`ifedrv=0,3`) (`iteration variable 82`)""" + edrive: float = 5.0e6 + """IFE driver energy (J) (`iteration variable 81`)""" -zl4: float = None -"""IFE vertical build below centre (m)""" + etadrv: float = 0.0 + """IFE driver wall plug to target efficiency""" + etali: float = 0.4 + """IFE lithium pump wall plug efficiency (`ifetyp=4`)""" -zl5: float = None -"""IFE vertical build below centre (m)""" + etave: list[float] = field( + default_factory=lambda: np.array([ + 0.082, + 0.079, + 0.076, + 0.073, + 0.069, + 0.066, + 0.062, + 0.059, + 0.055, + 0.051, + ]) + ) + """IFE driver efficiency vs driver energy (`ifedrv=-1`)""" + + fauxbop: float = 0.06 + """fraction of gross electric power to balance-of-plant (IFE)""" + + fbreed: float = 0.51 + """fraction of breeder external to device core""" + + fburn: float = 0.3333 + """IFE burn fraction (fraction of tritium fused/target)""" + + flirad: float = 0.78 + """radius of FLiBe/lithium inlet (m) (`ifetyp=3,4`)""" + + fwdr: float = 0.01 + """radial thickness of IFE first wall (m)""" + + fwdzl: float = 0.01 + """vertical thickness of IFE first wall below chamber (m)""" + + fwdzu: float = 0.01 + """vertical thickness of IFE first wall above chamber (m)""" + + fwmatf: list[float] = field( + default_factory=lambda: np.reshape( + [ + 0.05, + 0.05, + 0.05, + 0.0, + 0.0, + 0.0, + 0.95, + 0.95, + 0.95, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + ], + (3, MAXMAT + 1), + ) + ) + """IFE first wall material fractions""" + + fwmatm: list[float] = field(default_factory=lambda: np.zeros((3, MAXMAT + 1))) + """IFE first wall material masses (kg)""" + + fwmatv: list[float] = field(default_factory=lambda: np.zeros((3, MAXMAT + 1))) + """IFE first wall material volumes (kg)""" + + fwvol: list[float] = field(default_factory=lambda: np.zeros(3)) + """IFE first wall volume (m3)""" + + gain: float = 0.0 + """IFE target gain""" + + gainve: list[float] = field( + default_factory=lambda: np.array([ + 60.0, + 95.0, + 115.0, + 125.0, + 133.0, + 141.0, + 152.0, + 160.0, + 165.0, + 170.0, + ]) + ) + """IFE target gain vs driver energy (`ifedrv=-1`)""" + htpmw_ife: float = 0.0 + """IFE heat transport system electrical pump power (MW)""" + + ife: int = 0 + """Switch for IFE option: + - =0 use tokamak, RFP or stellarator model + - =1 use IFE model + """ + + ifedrv: int = 2 + """Switch for type of IFE driver: + - =-1 use gainve, etave for gain and driver efficiency + - =0 use tgain, drveff for gain and driver efficiency + - =1 use laser driver based on SOMBRERO design + - =2 use heavy ion beam driver based on OSIRIS + - =3 Input pfusife, rrin and drveff + """ + + ifetyp: int = 0 + """Switch for type of IFE device build: + - =0 generic (cylindrical) build + - =1 OSIRIS-like build + - =2 SOMBRERO-like build + - =3 HYLIFE-II-like build + - =4 2019 build + """ + + lipmw: float = 0.0 + """IFE lithium pump power (MW; `ifetyp=4`)""" + + mcdriv: float = 1.0 + """IFE driver cost multiplier""" + + mflibe: float = 0.0 + """total mass of FLiBe (kg)""" + + pdrive: float = 23.0e6 + """IFE driver power reaching target (W) (`iteration variable 85`)""" + + pfusife: float = 1000.0 + """IFE input fusion power (MW) (`ifedrv=3 only`; `itv 155`)""" + + pifecr: float = 10.0 + """IFE cryogenic power requirements (MW)""" + + ptargf: float = 2.0 + """IFE target factory power at 6 Hz repetition rate (MW)""" + + r1: float = 0.0 + """IFE device radial build (m)""" + + r2: float = 0.0 + """IFE device radial build (m)""" + + r3: float = 0.0 + """IFE device radial build (m)""" + + r4: float = 0.0 + """IFE device radial build (m)""" + + r5: float = 0.0 + """IFE device radial build (m)""" + + r6: float = 0.0 + """IFE device radial build (m)""" + + r7: float = 0.0 + """IFE device radial build (m)""" + + reprat: float = 0.0 + """IFE driver repetition rate (Hz)""" + + rrin: float = 6.0 + """Input IFE repetition rate (Hz) (`ifedrv=3 only`; `itv 156`)""" + + rrmax: float = 20.0 + """maximum IFE repetition rate (Hz)""" + + shdr: float = 1.7 + """radial thickness of IFE shield (m)""" + + shdzl: float = 5.0 + """vertical thickness of IFE shield below chamber (m)""" + + shdzu: float = 5.0 + """vertical thickness of IFE shield above chamber (m)""" + + shmatf: list[float] = field( + default_factory=lambda: np.reshape( + [ + 0.05, + 0.05, + 0.05, + 0.19, + 0.19, + 0.19, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.665, + 0.665, + 0.665, + 0.095, + 0.095, + 0.095, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + ], + (3, MAXMAT + 1), + ) + ) + """IFE shield material fractions""" + + shmatm: list[float] = field(default_factory=lambda: np.zeros((3, MAXMAT + 1))) + """IFE shield material masses (kg)""" + + shmatv: list[float] = field(default_factory=lambda: np.zeros((3, MAXMAT + 1))) + """IFE shield material volumes (kg)""" + + shvol: list[float] = field(default_factory=lambda: np.zeros(3)) + """IFE shield volume (m3)""" + + sombdr: float = 2.7 + """radius of cylindrical blanket section below chamber (`ifetyp=2`)""" + + somtdr: float = 2.7 + """radius of cylindrical blanket section above chamber (`ifetyp=2`)""" + + taufall: float = 0.0 + """Lithium Fall Time (s)""" + + tdspmw: float = 0.01 + """IFE target delivery system power (MW)""" + + tfacmw: float = 0.0 + """IFE target factory power (MW)""" + + tgain: float = 85.0 + """IFE target gain (if `ifedrv = 0`) (`iteration variable 83`)""" + + uccarb: float = 50.0 + """cost of carbon cloth ($/kg)""" + + ucconc: float = 0.1 + """cost of concrete ($/kg)""" + + ucflib: float = 84.0 + """cost of FLiBe ($/kg)""" + + uctarg: float = 0.3 + """cost of IFE target ($/target)""" + + v1dr: float = 0.0 + """radial thickness of IFE void between first wall and blanket (m)""" + + v1dzl: float = 0.0 + """vertical thickness of IFE void 1 below chamber (m)""" + + v1dzu: float = 0.0 + """vertical thickness of IFE void 1 above chamber (m)""" + + v1matf: list[float] = field( + default_factory=lambda: np.reshape( + [ + 1.0, + 1.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + ], + (3, MAXMAT + 1), + ) + ) + """IFE void 1 material fractions""" + + v1matm: list[float] = field(default_factory=lambda: np.zeros((3, MAXMAT + 1))) + """IFE void 1 material masses (kg)""" + + v1matv: list[float] = field(default_factory=lambda: np.zeros((3, MAXMAT + 1))) + """IFE void 1 material volumes (kg)""" + + v1vol: list[float] = field(default_factory=lambda: np.zeros(3)) + """IFE void 1 volume (m3)""" + + v2dr: float = 2.0 + """radial thickness of IFE void between blanket and shield (m)""" + + v2dzl: float = 7.0 + """vertical thickness of IFE void 2 below chamber (m)""" + + v2dzu: float = 7.0 + """vertical thickness of IFE void 2 above chamber (m)""" + + v2matf: list[float] = field( + default_factory=lambda: np.reshape( + [ + 1.0, + 1.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + ], + (3, MAXMAT + 1), + ) + ) + """IFE void 2 material fractions""" + + v2matm: list[float] = field(default_factory=lambda: np.zeros((3, MAXMAT + 1))) + """IFE void 2 material masses (kg)""" + + v2matv: list[float] = field(default_factory=lambda: np.zeros((3, MAXMAT + 1))) + """IFE void 2 material volumes (kg)""" + + v2vol: list[float] = field(default_factory=lambda: np.zeros(3)) + """IFE void 2 volume (m3)""" + + v3dr: float = 43.3 + """radial thickness of IFE void outside shield (m)""" + + v3dzl: float = 30.0 + """vertical thickness of IFE void 3 below chamber (m)""" + + v3dzu: float = 20.0 + """vertical thickness of IFE void 3 above chamber (m)""" + + v3matf: list[float] = field( + default_factory=lambda: np.reshape( + [ + 1.0, + 1.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + ], + (3, MAXMAT + 1), + ) + ) + """IFE void 3 material fractions""" -zl6: float = None -"""IFE vertical build below centre (m)""" + v3matm: list[float] = field(default_factory=lambda: np.zeros((3, MAXMAT + 1))) + """IFE void 3 material masses (kg)""" + v3matv: list[float] = field(default_factory=lambda: np.zeros((3, MAXMAT + 1))) + """IFE void 3 material volumes (kg)""" -zl7: float = None -"""IFE vertical build below centre (m)""" + v3vol: list[float] = field(default_factory=lambda: np.zeros(3)) + """IFE void 3 volume (m3)""" + zl1: float = 0.0 + """IFE vertical build below centre (m)""" -zu1: float = None -"""IFE vertical build above centre (m)""" + zl2: float = 0.0 + """IFE vertical build below centre (m)""" + zl3: float = 0.0 + """IFE vertical build below centre (m)""" -zu2: float = None -"""IFE vertical build above centre (m)""" + zl4: float = 0.0 + """IFE vertical build below centre (m)""" + zl5: float = 0.0 + """IFE vertical build below centre (m)""" -zu3: float = None -"""IFE vertical build above centre (m)""" + zl6: float = 0.0 + """IFE vertical build below centre (m)""" + zl7: float = 0.0 + """IFE vertical build below centre (m)""" -zu4: float = None -"""IFE vertical build above centre (m)""" + zu1: float = 0.0 + """IFE vertical build above centre (m)""" + zu2: float = 0.0 + """IFE vertical build above centre (m)""" -zu5: float = None -"""IFE vertical build above centre (m)""" + zu3: float = 0.0 + """IFE vertical build above centre (m)""" + zu4: float = 0.0 + """IFE vertical build above centre (m)""" -zu6: float = None -"""IFE vertical build above centre (m)""" + zu5: float = 0.0 + """IFE vertical build above centre (m)""" + zu6: float = 0.0 + """IFE vertical build above centre (m)""" -zu7: float = None -"""IFE vertical build above centre (m)""" + zu7: float = 0.0 + """IFE vertical build above centre (m)""" -def init_ife_variables(): - global \ - bldr, \ - bldrc, \ - bldzl, \ - bldzu, \ - blmatf, \ - blmatm, \ - blmatv, \ - blvol, \ - cdriv0, \ - cdriv1, \ - cdriv2, \ - cdriv3, \ - chdzl, \ - chdzu, \ - chmatf, \ - chmatm, \ - chmatv, \ - chrad, \ - chvol, \ - dcdrv0, \ - dcdrv1, \ - dcdrv2, \ - drveff, \ - edrive, \ - etadrv, \ - etali, \ - etave, \ - fauxbop, \ - fbreed, \ - fburn, \ - flirad, \ - fwdr, \ - fwdzl, \ - fwdzu, \ - fwmatf, \ - fwmatm, \ - fwmatv, \ - fwvol, \ - gain, \ - gainve, \ - htpmw_ife, \ - ife, \ - ifedrv, \ - ifetyp, \ - lipmw, \ - mcdriv, \ - mflibe, \ - pdrive, \ - pfusife, \ - pifecr, \ - ptargf, \ - r1, \ - r2, \ - r3, \ - r4, \ - r5, \ - r6, \ - r7, \ - reprat, \ - rrin, \ - rrmax, \ - shdr, \ - shdzl, \ - shdzu, \ - shmatf, \ - shmatm, \ - shmatv, \ - shvol, \ - sombdr, \ - somtdr, \ - taufall, \ - tdspmw, \ - tfacmw, \ - tgain, \ - uccarb, \ - ucconc, \ - ucflib, \ - uctarg, \ - v1dr, \ - v1dzl, \ - v1dzu, \ - v1matf, \ - v1matm, \ - v1matv, \ - v1vol, \ - v2dr, \ - v2dzl, \ - v2dzu, \ - v2matf, \ - v2matm, \ - v2matv, \ - v2vol, \ - v3dr, \ - v3dzl, \ - v3dzu, \ - v3matf, \ - v3matm, \ - v3matv, \ - v3vol, \ - zl1, \ - zl2, \ - zl3, \ - zl4, \ - zl5, \ - zl6, \ - zl7, \ - zu1, \ - zu2, \ - zu3, \ - zu4, \ - zu5, \ - zu6, \ - zu7 - """Initialise IFE variables""" - bldr = 1.0 - bldrc = 1.0 - bldzl = 4.0 - bldzu = 4.0 - blmatf = np.reshape( - [ - 0.05, - 0.05, - 0.05, - 0.0, - 0.0, - 0.0, - 0.45, - 0.45, - 0.45, - 0.0, - 0.0, - 0.0, - 0.20, - 0.20, - 0.20, - 0.0, - 0.0, - 0.0, - 0.30, - 0.30, - 0.30, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - ], - (3, MAXMAT + 1), - ) - blmatm = np.zeros((3, MAXMAT + 1)) - blmatv = np.zeros((3, MAXMAT + 1)) - blvol = np.zeros(3) - cdriv0 = 154.3 - cdriv1 = 163.2 - cdriv2 = 244.9 - cdriv3 = 1.463 - chdzl = 9.0 - chdzu = 9.0 - chmatf = np.array([1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]) - chmatm = np.zeros(MAXMAT + 1) - chmatv = np.zeros(MAXMAT + 1) - chrad = 6.5 - chvol = 0.0 - dcdrv0 = 111.4 - dcdrv1 = 78.0 - dcdrv2 = 59.9 - drveff = 0.28 - edrive = 5.0e6 - etadrv = 0.0 - etali = 0.4 - etave = np.array([ - 0.082, - 0.079, - 0.076, - 0.073, - 0.069, - 0.066, - 0.062, - 0.059, - 0.055, - 0.051, - ]) - fauxbop = 0.06 - fbreed = 0.51 - fburn = 0.3333 - flirad = 0.78 - fwdr = 0.01 - fwdzl = 0.01 - fwdzu = 0.01 - fwmatf = np.reshape( - [ - 0.05, - 0.05, - 0.05, - 0.0, - 0.0, - 0.0, - 0.95, - 0.95, - 0.95, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - ], - (3, MAXMAT + 1), - ) - fwmatm = np.zeros((3, MAXMAT + 1)) - fwmatv = np.zeros((3, MAXMAT + 1)) - fwvol = np.zeros(3) - gain = 0.0 - gainve = np.array([ - 60.0, - 95.0, - 115.0, - 125.0, - 133.0, - 141.0, - 152.0, - 160.0, - 165.0, - 170.0, - ]) - htpmw_ife = 0.0 - ife = 0 - ifedrv = 2 - ifetyp = 0 - lipmw = 0.0 - mcdriv = 1.0 - mflibe = 0.0 - pdrive = 23.0e6 - pfusife = 1000.0 - pifecr = 10.0 - ptargf = 2.0 - r1 = 0.0 - r2 = 0.0 - r3 = 0.0 - r4 = 0.0 - r5 = 0.0 - r6 = 0.0 - r7 = 0.0 - reprat = 0.0 - rrin = 6.0 - rrmax = 20.0 - shdr = 1.7 - shdzl = 5.0 - shdzu = 5.0 - shmatf = np.reshape( - [ - 0.05, - 0.05, - 0.05, - 0.19, - 0.19, - 0.19, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.665, - 0.665, - 0.665, - 0.095, - 0.095, - 0.095, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - ], - (3, MAXMAT + 1), - ) - shmatm = np.zeros((3, MAXMAT + 1)) - shmatv = np.zeros((3, MAXMAT + 1)) - shvol = np.zeros(3) - sombdr = 2.7 - somtdr = 2.7 - taufall = 0.0 - tdspmw = 0.01 - tfacmw = 0.0 - tgain = 85.0 - uccarb = 50.0 - ucconc = 0.1 - ucflib = 84.0 - uctarg = 0.3 - v1dr = 0.0 - v1dzl = 0.0 - v1dzu = 0.0 - v1matf = np.reshape( - [ - 1.0, - 1.0, - 1.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - ], - (3, MAXMAT + 1), - ) - v1matm = np.zeros((3, MAXMAT + 1)) - v1matv = np.zeros((3, MAXMAT + 1)) - v1vol = np.zeros(3) - v2dr = 2.0 - v2dzl = 7.0 - v2dzu = 7.0 - v2matf = np.reshape( - [ - 1.0, - 1.0, - 1.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - ], - (3, MAXMAT + 1), - ) - v2matm = np.zeros((3, MAXMAT + 1)) - v2matv = np.zeros((3, MAXMAT + 1)) - v2vol = np.zeros(3) - v3dr = 43.3 - v3dzl = 30.0 - v3dzu = 20.0 - v3matf = np.reshape( - [ - 1.0, - 1.0, - 1.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - ], - (3, MAXMAT + 1), - ) - v3matm = np.zeros((3, MAXMAT + 1)) - v3matv = np.zeros((3, MAXMAT + 1)) - v3vol = np.zeros(3) - zl1 = 0.0 - zl2 = 0.0 - zl3 = 0.0 - zl4 = 0.0 - zl5 = 0.0 - zl6 = 0.0 - zl7 = 0.0 - zu1 = 0.0 - zu2 = 0.0 - zu3 = 0.0 - zu4 = 0.0 - zu5 = 0.0 - zu6 = 0.0 - zu7 = 0.0 +CREATE_DICTS_FROM_DATACLASS = IFEData diff --git a/process/data_structure/pfcoil_variables.py b/process/data_structure/pfcoil_variables.py index 0223332a1..a20efcfa4 100644 --- a/process/data_structure/pfcoil_variables.py +++ b/process/data_structure/pfcoil_variables.py @@ -1,3 +1,5 @@ +from dataclasses import dataclass, field + import numpy as np N_PF_GROUPS_MAX = 10 @@ -20,783 +22,482 @@ NGC2 = NGC + 2 """new variable to include 2 additional circuits: plasma and central solenoid""" -# PF coil module variables -nef: int = None -nfxf: int = None +@dataclass +class PFCoilData: + # PF coil module variables + nef: int = 0 -ricpf: float = None + nfxf: int = 0 -ssq0: float = None + ricpf: float = 0.0 -stress_z_cs_self_peak_midplane: float = None -"""Peak axial stress (z) in central solenoid at midplane due to its own field (when at peak current) (Pa)""" + ssq0: float = 0.0 -sig_hoop: float = None + stress_z_cs_self_peak_midplane: float = 0.0 + """Peak axial stress (z) in central solenoid at midplane due to its own field (when at peak current) (Pa)""" -forc_z_cs_self_peak_midplane: float = None -"""Axial force (z) on central solenoid at midplane due to its own field (when at peak current) (N)""" + sig_hoop: float = 0.0 -r_pf_cs_current_filaments: list[float] = None -"""array of radial positions of current filaments in central solenoid""" + forc_z_cs_self_peak_midplane: float = 0.0 + """Axial force (z) on central solenoid at midplane due to its own field (when at peak current) (N)""" -z_pf_cs_current_filaments: list[float] = None -"""array of vertical positions of current filaments in central solenoid""" + r_pf_cs_current_filaments: list[float] = field( + default_factory=lambda: np.zeros(NFIXMX) + ) + """array of radial positions of current filaments in central solenoid""" -c_pf_cs_current_filaments: list[float] = None -"""array of current in filaments in central solenoid""" + z_pf_cs_current_filaments: list[float] = field( + default_factory=lambda: np.zeros(NFIXMX) + ) + """array of vertical positions of current filaments in central solenoid""" -xind: list[float] = None + c_pf_cs_current_filaments: list[float] = field( + default_factory=lambda: np.zeros(NFIXMX) + ) + """array of current in filaments in central solenoid""" -r_pf_coil_middle_group_array: list[float] = None -"""2D array of PF coil middle radii, indexed by group and coil in group""" + xind: list[float] = field(default_factory=lambda: np.zeros(NFIXMX)) -z_pf_coil_middle_group_array: list[float] = None -"""2D array of PF coil middle heights, indexed by group and coil in group""" + r_pf_coil_middle_group_array: list[float] = field( + default_factory=lambda: np.zeros((N_PF_GROUPS_MAX, N_PF_COILS_IN_GROUP_MAX)) + ) + """2D array of PF coil middle radii, indexed by group and coil in group""" -ccls: list[float] = None + z_pf_coil_middle_group_array: list[float] = field( + default_factory=lambda: np.zeros((N_PF_GROUPS_MAX, N_PF_COILS_IN_GROUP_MAX)) + ) + """2D array of PF coil middle heights, indexed by group and coil in group""" -ccl0: list[float] = None + ccls: list[float] = field(default_factory=lambda: np.zeros(N_PF_GROUPS_MAX)) -bpf2: list[float] = None + ccl0: list[float] = field(default_factory=lambda: np.zeros(N_PF_GROUPS_MAX)) -vsdum: list[float] = None + bpf2: list[float] = field(default_factory=lambda: np.zeros(NGC2)) -first_call: bool = None + vsdum: list[float] = field(default_factory=lambda: np.zeros((NGC2, 3))) -cslimit: bool = None + first_call: bool = True -# PF coil variables + cslimit: bool = False -alfapf: float = None -"""smoothing parameter used in PF coil current calculation at the beginning of pulse (BoP)""" + # PF coil variables + alfapf: float = 5e-10 + """smoothing parameter used in PF coil current calculation at the beginning of pulse (BoP)""" -alstroh: float = None -"""allowable hoop stress in Central Solenoid structural material (Pa)""" + alstroh: float = 4.0e8 + """allowable hoop stress in Central Solenoid structural material (Pa)""" + i_cs_stress: int = 1 + """Switch for CS stress calculation: + - =0 Hoop stress only + - =1 Hoop + Axial stress + """ -i_cs_stress: int = None -"""Switch for CS stress calculation: -- =0 Hoop stress only -- =1 Hoop + Axial stress -""" + a_cs_poloidal: float = 0.0 + """Central solenoid vertical cross-sectional area (m2)""" + a_cs_turn: float = 0.0 + """Central solenoid (OH) trun cross-sectional area (m2)""" -a_cs_poloidal: float = None -"""Central solenoid vertical cross-sectional area (m2)""" + awpoh: float = 0.0 + """central solenoid conductor+void area with area of steel subtracted (m2)""" + b_cs_peak_flat_top_end: float = 0.0 + """maximum field in central solenoid at end of flat-top (EoF) (T)""" -a_cs_turn: float = None -"""Central solenoid (OH) trun cross-sectional area (m2)""" + b_cs_peak_pulse_start: float = 0.0 + """maximum field in central solenoid at beginning of pulse (T)""" + b_pf_coil_peak: list[float] = field(default_factory=lambda: np.zeros(NGC2)) + """peak field at coil i (T)""" -awpoh: float = None -"""central solenoid conductor+void area with area of steel subtracted (m2)""" + ccl0_ma: list[float] = field(default_factory=lambda: np.zeros(N_PF_GROUPS_MAX)) + """PF group current array, flux-swing cancellation current (MA) + Input if i_pf_current=0, computed otherwise + """ + ccls_ma: list[float] = field(default_factory=lambda: np.zeros(N_PF_GROUPS_MAX)) + """PF group current array, equilibrium current (MA) + Input if i_pf_current=0, computed otherwise + """ + + j_cs_pulse_start: float = 0.0 + """Central solenoid overall current density at beginning of pulse (A/m2)""" + + j_cs_flat_top_end: float = 1.85e7 + """Central solenoid overall current density at end of flat-top (A/m2) (`iteration variable 37`) (`sweep variable 62`)""" + + c_pf_coil_turn: list[float] = field(default_factory=lambda: np.zeros((NGC2, 6))) + """current per turn in coil i at time j (A)""" + + c_pf_coil_turn_peak_input: list[float] = field( + default_factory=lambda: np.full(NGC2, 4.0e4) + ) + """peak current per turn input for PF coil i (A)""" + + c_pf_cs_coil_pulse_start_ma: list[float] = field( + default_factory=lambda: np.zeros(NGC2) + ) + """PF coil current array, at beginning of pulse (MA) + Indexed by coil number, not group number + """ + + c_pf_cs_coil_flat_top_ma: list[float] = field(default_factory=lambda: np.zeros(NGC2)) + """PF coil current array, at flat top (MA) + Indexed by coil number, not group number + """ + + c_pf_cs_coil_pulse_end_ma: list[float] = field( + default_factory=lambda: np.zeros(NGC2) + ) + """PF coil current array, at end of pulse (MA) + Indexed by coil number, not group number + """ + + etapsu: float = 0.9 + """Efficiency of transfer of PF stored energy into or out of storage.""" + + f_j_cs_start_end_flat_top: float = 0.0 + """ratio of central solenoid overall current density at beginning of flat-top / end of flat-top""" + + f_j_cs_start_pulse_end_flat_top: float = 0.9 + """ratio of central solenoid overall current density at beginning of pulse / end of flat-top + (`iteration variable 41`) + """ + + fcuohsu: float = 0.7 + """copper fraction of strand in central solenoid""" + + fcupfsu: float = 0.69 + """copper fraction of cable conductor (PF coils)""" + + i_pf_location: list[int] = field( + default_factory=lambda: np.array([2, 2, 3, 0, 0, 0, 0, 0, 0, 0]) + ) + """Switch for location of PF coil group i: + - =1 PF coil on top of central solenoid (flux ramp only) + - =2 PF coil on top of TF coil (flux ramp only) + - =3 PF coil outside of TF coil (equilibrium coil) + - =4 PF coil, general location (equilibrium coil) + """ + + i_pf_conductor: int = 0 + """switch for PF & CS coil conductor type: + - =0 superconducting PF coils + - =1 resistive PF coils + """ + + itr_sum: float = 0.0 + """total sum of I x turns x radius for all PF coils and CS (Am)""" + + i_cs_superconductor: int = 1 + """switch for superconductor material in central solenoid: + - =1 ITER Nb3Sn critical surface model with standard + ITER parameters + - =2 Bi-2212 high temperature superconductor (range of + validity T < 20K, adjusted field b < 104 T, B > 6 T) + - =3 NbTi + - =4 ITER Nb3Sn model with user-specified parameters + - =5 WST Nb3Sn parameterisation + - =6 REBCO HTS tape in CroCo strand + - =7 Durham Ginzburg-Landau critical surface model for Nb-Ti + - =8 Durham Ginzburg-Landau critical surface model for REBCO + - =9 Hazelton experimental data + Zhai conceptual model for REBCO + """ + + i_pf_superconductor: int = 1 + """switch for superconductor material in PF coils: + - =1 ITER Nb3Sn critical surface model with standard + ITER parameters + - =2 Bi-2212 high temperature superconductor (range of + validity T < 20K, adjusted field b < 104 T, B > 6 T) + - =3 NbTi + - =4 ITER Nb3Sn model with user-specified parameters + - =5 WST Nb3Sn parameterisation + - =6 REBCO HTS tape in CroCo strand + - =7 Durham Ginzburg-Landau critical surface model for Nb-Ti + - =8 Durham Ginzburg-Landau critical surface model for REBCO + - =9 Hazelton experimental data + Zhai conceptual model for REBCO + """ + + j_crit_str_cs: float = 0.0 + """superconductor strand critical current density under operating + conditions in central solenoid (A/m2). Necessary for the cost calculation in $/kA m + """ + + j_crit_str_pf: float = 0.0 + """superconductor strand critical current density under operating + conditions in PF coils (A/m2). Necessary for the cost calculation in $/kA m + """ + + i_pf_current: int = 1 + """Switch for controlling the current of the PF coils: + - =0 Input via the variables c_pf_cs_coil_pulse_start_ma, c_pf_cs_coil_flat_top_ma, c_pf_cs_coil_pulse_end_ma + - =1 SVD targets zero field across midplane (flux swing + coils) and the correct vertical field at the plasma + center (equilibrium coils) + """ + + i_r_pf_outside_tf_placement: int = 0 + """Switch for the placement of Location 3 (outboard) PF coils + - =0 (Default) Outboard PF coils follow TF shape + in an ellipsoidal winding surface + - =1 Outboard PF coils all have same radius, cylindrical + winding surface + """ + + j_cs_conductor_critical_pulse_start: float = 0.0 + """central solenoid superconductor critical current density (A/m2) at beginning-of-pulse""" + + j_cs_conductor_critical_flat_top_end: float = 0.0 + """central solenoid superconductor critical current density (A/m2) at end-of-flattop""" + + jcableoh_bop: float = 0.0 + """central solenoid cable critical current density (A/m2) at beginning-of-pulse""" + + jcableoh_eof: float = 0.0 + """central solenoid cable critical current density (A/m2) at end-of-flattop""" + + n_pf_cs_plasma_circuits: int = 0 + """number of PF circuits (including central solenoid and plasma)""" + + n_pf_coils_in_group: list[int] = field( + default_factory=lambda: np.array([1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0]) + ) + """number of PF coils in group j""" + + n_cs_current_filaments: int = 7 + """number of filaments the top and bottom of the central solenoid should be broken + into during scaling (5 - 10 is good) + """ + + n_pf_coil_groups: int = 3 + """number of groups of PF coils. Symmetric coil pairs should all be in the same group""" + + n_cs_pf_coils: int = 0 + """number of PF coils (excluding the central solenoid) + 1""" + + f_z_cs_tf_internal: float = 0.71 + """Central solenoid height / TF coil internal height""" + + f_a_cs_turn_steel: float = 0.5 + """Fraction of CS turn poloidal area that is steel (`iteration variable 122`)""" + + pf_current_safety_factor: float = 1.0 + """Ratio of permissible PF coil conductor current density to critical conductor + current density based on short-sample DC measurements + """ + + pfcaseth: list[float] = field(default_factory=lambda: np.zeros(NGC2)) + """steel case thickness for PF coil i (m)""" + + rho_pf_coil: float = 2.5e-8 + """PF coil resistivity (if i_pf_conductor=1) (Ohm-m)""" + + rhopfbus: float = 3.93e-8 + """Resistivity of CS and PF coil bus bars (irrespective of + whether the coils themselves are superconducting or resistive) (Ohm-m) + """ + + m_pf_coil_max: float = 0.0 + """mass of heaviest PF coil (tonnes)""" + + r_pf_coil_outer_max: float = 0.0 + """radius of largest PF coil (m)""" -b_cs_peak_flat_top_end: float = None -"""maximum field in central solenoid at end of flat-top (EoF) (T)""" + p_pf_electric_supplies_mw: float = 0.0 + """Total mean wall plug power dissipated in PFC and CS power supplies (MW) (issue #713)""" + p_cs_resistive_flat_top: float = 0.0 + """central solenoid resistive power during flattop (W)""" -b_cs_peak_pulse_start: float = None -"""maximum field in central solenoid at beginning of pulse (T)""" + p_pf_coil_resistive_total_flat_top: float = 0.0 + """total PF coil resistive losses during flattop (W)""" + r_pf_coil_inner: list[float] = field(default_factory=lambda: np.zeros(NGC2)) + """inner radius of coil i (m)""" -b_pf_coil_peak: list[float] = None -"""peak field at coil i (T)""" + r_pf_coil_outer: list[float] = field(default_factory=lambda: np.zeros(NGC2)) + """outer radius of coil i (m)""" + c_pf_cs_coils_peak_ma: list[float] = field(default_factory=lambda: np.zeros(NGC2)) + """peak current in coil i (MA-turns)""" -ccl0_ma: list[float] = None -"""PF group current array, flux-swing cancellation current (MA) -Input if i_pf_current=0, computed otherwise -""" + j_pf_coil_wp_peak: list[float] = field(default_factory=lambda: np.full(NGC2, 3.0e7)) + """average winding pack current density of PF coil i (A/m2) at time of peak + current in that coil (calculated for `i_pf_location=1` coils) + """ + j_cs_critical_flat_top_end: float = 0.0 + """allowable central solenoid current density at end of flat-top (A/m2)""" -ccls_ma: list[float] = None -"""PF group current array, equilibrium current (MA) -Input if i_pf_current=0, computed otherwise -""" + j_cs_critical_pulse_start: float = 0.0 + """allowable central solenoid current density at beginning of pulse (A/m2)""" + j_pf_wp_critical: list[float] = field(default_factory=lambda: np.zeros(NGC2)) + """allowable winding pack current density of PF coil i (A/m2)""" -j_cs_pulse_start: float = None -"""Central solenoid overall current density at beginning of pulse (A/m2)""" + r_cs_middle: float = 0.0 + """radius to the centre of the central solenoid (m)""" + dz_cs_full: float = 0.0 + """Full height of the central solenoid (m)""" -j_cs_flat_top_end: float = None -"""Central solenoid overall current density at end of flat-top (A/m2) (`iteration variable 37`) (`sweep variable 62`)""" + dr_pf_tf_outboard_out_offset: float = 1.5 + """radial distance (m) from outboard TF coil leg to centre of `i_pf_location=3` PF coils""" + r_pf_coil_middle: list[float] = field(default_factory=lambda: np.zeros(NGC2)) + """radius of PF coil i (m)""" -c_pf_coil_turn: list[float] = None -"""current per turn in coil i at time j (A)""" + dr_pf_cs_middle_offset: float = 0.0 + """offset (m) of radial position of `i_pf_location=1` PF coils from being directly above + the central solenoid + """ + rpf2: float = -1.63 + """offset (m) of radial position of `i_pf_location=2` PF coils from being at + rmajor (offset = rpf2*triang*rminor) + """ -c_pf_coil_turn_peak_input: list[float] = None -"""peak current per turn input for PF coil i (A)""" + rref: list[float] = field(default_factory=lambda: np.full(N_PF_GROUPS_MAX, 7.0)) + """PF coil radial positioning adjuster: + - for groups j with i_pf_location(j) = 1; rref(j) is ignored + - for groups j with i_pf_location(j) = 2; rref(j) is ignored + - for groups j with i_pf_location(j) = 3; rref(j) is ignored + - for groups j with i_pf_location(j) = 4; rref(j) is radius of + the coil in units of minor radii from the major radius + (r = rmajor + rref*rminor) + """ + s_shear_cs_peak: float = 0.0 + """Maximum shear stress (Tresca criterion) coils/central solenoid [MPa]""" -c_pf_cs_coil_pulse_start_ma: list[float] = None -"""PF coil current array, at beginning of pulse (MA) -Indexed by coil number, not group number -""" + sigpfcalw: float = 500.0 + """maximum permissible tensile stress (MPa) in steel coil cases for superconducting + PF coils (`i_pf_conductor=0`) + """ + sigpfcf: float = 1.0 + """fraction of JxB hoop force supported by steel case for superconducting PF coils (`i_pf_conductor=0`)""" -c_pf_cs_coil_flat_top_ma: list[float] = None -"""PF coil current array, at flat top (MA) -Indexed by coil number, not group number -""" + ind_pf_cs_plasma_mutual: list[float] = field( + default_factory=lambda: np.zeros((NGC2, NGC2)) + ) + """mutual inductance matrix (H)""" + temp_cs_superconductor_margin: float = 0.0 + """Central solenoid temperature margin (K)""" -c_pf_cs_coil_pulse_end_ma: list[float] = None -"""PF coil current array, at end of pulse (MA) -Indexed by coil number, not group number -""" + n_pf_coil_turns: list[float] = field(default_factory=lambda: np.zeros(NGC2)) + """number of turns in PF coil i""" + f_a_pf_coil_void: list[float] = field(default_factory=lambda: np.full(NGC2, 0.3)) + """winding pack void fraction of PF coil i for coolant""" -etapsu: float = None -"""Efficiency of transfer of PF stored energy into or out of storage.""" + f_a_cs_void: float = 0.3 + """void fraction of central solenoid conductor for coolant""" + vs_cs_pf_total_burn: float = 0.0 + """total flux swing available for burn (Wb)""" -f_j_cs_start_end_flat_top: float = None -"""ratio of central solenoid overall current density at beginning of flat-top / end of flat-top""" + vs_pf_coils_total_burn: float = 0.0 + """flux swing from PF coils for burn (Wb)""" + vs_pf_coils_total_ramp: float = 0.0 + """flux swing from PF coils for startup (Wb)""" -f_j_cs_start_pulse_end_flat_top: float = None -"""ratio of central solenoid overall current density at beginning of pulse / end of flat-top -(`iteration variable 41`) -""" + vs_pf_coils_total_pulse: float = 0.0 + """total flux swing from PF coils (Wb)""" + vs_cs_total_pulse: float = 0.0 + """total flux swing from the central solenoid (Wb)""" -fcuohsu: float = None -"""copper fraction of strand in central solenoid""" + vs_cs_burn: float = 0.0 + """central solenoid flux swing for burn (Wb)""" + vs_cs_ramp: float = 0.0 + """central solenoid flux swing for startup (Wb)""" -fcupfsu: float = None -"""copper fraction of cable conductor (PF coils)""" + vs_cs_pf_total_ramp: float = 0.0 + """total flux swing for startup (`constraint eqn 51` to enforce vs_cs_pf_total_ramp=vs_plasma_res_ramp+vs_plasma_ind_ramp) (Wb)""" + vs_cs_pf_total_pulse: float = 0.0 + """total flux swing for pulse (Wb)""" -i_pf_location: list[int] = None -"""Switch for location of PF coil group i: -- =1 PF coil on top of central solenoid (flux ramp only) -- =2 PF coil on top of TF coil (flux ramp only) -- =3 PF coil outside of TF coil (equilibrium coil) -- =4 PF coil, general location (equilibrium coil) -""" + f_c_pf_cs_peak_time_array: list[float] = field( + default_factory=lambda: np.zeros((NGC2, 6)) + ) + """PF, CS coil current relative to peak current at time points 1 to 6""" + m_pf_coil_conductor_total: float = 0.0 + """total mass of the PF coil conductor (kg)""" -i_pf_conductor: int = None -"""switch for PF & CS coil conductor type: -- =0 superconducting PF coils -- =1 resistive PF coils -""" + m_pf_coil_structure_total: float = 0.0 + """total mass of the PF coil structure (kg)""" + m_pf_coil_conductor: list[float] = field(default_factory=lambda: np.zeros(NGC2)) + """conductor mass for PF coil i (kg)""" -itr_sum: float = None -"""total sum of I x turns x radius for all PF coils and CS (Am)""" + m_pf_coil_structure: list[float] = field(default_factory=lambda: np.zeros(NGC2)) + """structure mass for PF coil i (kg)""" + z_pf_coil_upper: list[float] = field(default_factory=lambda: np.zeros(NGC2)) + """upper point of PF coil i (m)""" -i_cs_superconductor: int = None -"""switch for superconductor material in central solenoid: -- =1 ITER Nb3Sn critical surface model with standard -ITER parameters -- =2 Bi-2212 high temperature superconductor (range of -validity T < 20K, adjusted field b < 104 T, B > 6 T) -- =3 NbTi -- =4 ITER Nb3Sn model with user-specified parameters -- =5 WST Nb3Sn parameterisation -- =6 REBCO HTS tape in CroCo strand -- =7 Durham Ginzburg-Landau critical surface model for Nb-Ti -- =8 Durham Ginzburg-Landau critical surface model for REBCO -- =9 Hazelton experimental data + Zhai conceptual model for REBCO -""" - + z_pf_coil_lower: list[float] = field(default_factory=lambda: np.zeros(NGC2)) + """lower point of PF coil i (m)""" -i_pf_superconductor: int = None -"""switch for superconductor material in PF coils: -- =1 ITER Nb3Sn critical surface model with standard -ITER parameters -- =2 Bi-2212 high temperature superconductor (range of -validity T < 20K, adjusted field b < 104 T, B > 6 T) -- =3 NbTi -- =4 ITER Nb3Sn model with user-specified parameters -- =5 WST Nb3Sn parameterisation -- =6 REBCO HTS tape in CroCo strand -- =7 Durham Ginzburg-Landau critical surface model for Nb-Ti -- =8 Durham Ginzburg-Landau critical surface model for REBCO -- =9 Hazelton experimental data + Zhai conceptual model for REBCO -""" + z_pf_coil_middle: list[float] = field(default_factory=lambda: np.zeros(NGC2)) + """z (height) location of PF coil i (m)""" + zref: list[float] = field( + default_factory=lambda: np.array([ + 3.6, + 1.2, + 2.5, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + ]) + ) + """PF coil vertical positioning adjuster: + - for groups j with i_pf_location(j) = 1; zref(j) is ignored + - for groups j with i_pf_location(j) = 2 AND itart=1 (only); + zref(j) is distance of centre of PF coil from inside + edge of TF coil (remember that PF coils for STs lie + within the TF coil) + - for groups j with i_pf_location(j) = 3; zref(j) = ratio of + height of coil group j to plasma minor radius + - for groups j with i_pf_location(j) = 4; zref(j) = ratio of + height of coil group j to plasma minor radius + """ -j_crit_str_cs: float = None -"""superconductor strand critical current density under operating -conditions in central solenoid (A/m2). Necessary for the cost calculation in $/kA m -""" - + b_cs_limit_max: float = 13.0 + """Central solenoid max field limit [T]""" -j_crit_str_pf: float = None -"""superconductor strand critical current density under operating -conditions in PF coils (A/m2). Necessary for the cost calculation in $/kA m -""" - - -i_pf_current: int = None -"""Switch for controlling the current of the PF coils: -- =0 Input via the variables c_pf_cs_coil_pulse_start_ma, c_pf_cs_coil_flat_top_ma, c_pf_cs_coil_pulse_end_ma -- =1 SVD targets zero field across midplane (flux swing -coils) and the correct vertical field at the plasma -center (equilibrium coils) -""" - - -i_r_pf_outside_tf_placement: int = None -"""Switch for the placement of Location 3 (outboard) PF coils -- =0 (Default) Outboard PF coils follow TF shape -in an ellipsoidal winding surface -- =1 Outboard PF coils all have same radius, cylindrical -winding surface -""" - - -j_cs_conductor_critical_pulse_start: float = None -"""central solenoid superconductor critical current density (A/m2) at beginning-of-pulse""" - - -j_cs_conductor_critical_flat_top_end: float = None -"""central solenoid superconductor critical current density (A/m2) at end-of-flattop""" - - -jcableoh_bop: float = None -"""central solenoid cable critical current density (A/m2) at beginning-of-pulse""" - - -jcableoh_eof: float = None -"""central solenoid cable critical current density (A/m2) at end-of-flattop""" - - -n_pf_cs_plasma_circuits: int = None -"""number of PF circuits (including central solenoid and plasma)""" - - -n_pf_coils_in_group: list[int] = None -"""number of PF coils in group j""" - - -n_cs_current_filaments: int = None -"""number of filaments the top and bottom of the central solenoid should be broken -into during scaling (5 - 10 is good) -""" + f_dr_dz_cs_turn: float = 70.0 / 22.0 + """Ratio of CS coil turn conduit length to depth""" + dr_cs_turn: float = 0.0 + """Length of CS of CS coil turn conduit""" -n_pf_coil_groups: int = None -"""number of groups of PF coils. Symmetric coil pairs should all be in the same group""" - - -n_cs_pf_coils: int = None -"""number of PF coils (excluding the central solenoid) + 1""" - - -f_z_cs_tf_internal: float = None -"""Central solenoid height / TF coil internal height""" - - -f_a_cs_turn_steel: float = None -"""Fraction of CS turn poloidal area that is steel (`iteration variable 122`)""" - - -pf_current_safety_factor: float = None -"""Ratio of permissible PF coil conductor current density to critical conductor -current density based on short-sample DC measurements -""" - - -pfcaseth: list[float] = None -"""steel case thickness for PF coil i (m)""" - - -rho_pf_coil: float = None -"""PF coil resistivity (if i_pf_conductor=1) (Ohm-m)""" - - -rhopfbus: float = None -"""Resistivity of CS and PF coil bus bars (irrespective of -whether the coils themselves are superconducting or resistive) (Ohm-m) -""" - - -m_pf_coil_max: float = None -"""mass of heaviest PF coil (tonnes)""" - - -r_pf_coil_outer_max: float = None -"""radius of largest PF coil (m)""" - - -p_pf_electric_supplies_mw: float = None -"""Total mean wall plug power dissipated in PFC and CS power supplies (MW) (issue #713)""" - - -p_cs_resistive_flat_top: float = None -"""central solenoid resistive power during flattop (W)""" - - -p_pf_coil_resistive_total_flat_top: float = None -"""total PF coil resistive losses during flattop (W)""" - - -r_pf_coil_inner: list[float] = None -"""inner radius of coil i (m)""" - - -r_pf_coil_outer: list[float] = None -"""outer radius of coil i (m)""" - - -c_pf_cs_coils_peak_ma: list[float] = None -"""peak current in coil i (MA-turns)""" - - -j_pf_coil_wp_peak: list[float] = None -"""average winding pack current density of PF coil i (A/m2) at time of peak -current in that coil (calculated for `i_pf_location=1` coils) -""" - + dr_cs_full: float = 0.0 + """Full radial thickness of the central solenoid (m)""" -j_cs_critical_flat_top_end: float = None -"""allowable central solenoid current density at end of flat-top (A/m2)""" + dz_cs_turn: float = 0.0 + """Depth/width of CS of CS coil turn conduit""" + radius_cs_turn_corners: float = 3.0e-3 + """Radius of curvature of CS coil turn corners (m)""" -j_cs_critical_pulse_start: float = None -"""allowable central solenoid current density at beginning of pulse (A/m2)""" - - -j_pf_wp_critical: list[float] = None -"""allowable winding pack current density of PF coil i (A/m2)""" - - -r_cs_middle: float = None -"""radius to the centre of the central solenoid (m)""" - -dz_cs_full: float = None -"""Full height of the central solenoid (m)""" - - -dr_pf_tf_outboard_out_offset: float = None -"""radial distance (m) from outboard TF coil leg to centre of `i_pf_location=3` PF coils""" - - -r_pf_coil_middle: list[float] = None -"""radius of PF coil i (m)""" - - -dr_pf_cs_middle_offset: float = None -"""offset (m) of radial position of `i_pf_location=1` PF coils from being directly above -the central solenoid -""" - - -rpf2: float = None -"""offset (m) of radial position of `i_pf_location=2` PF coils from being at -rmajor (offset = rpf2*triang*rminor) -""" - - -rref: list[float] = None -"""PF coil radial positioning adjuster: -- for groups j with i_pf_location(j) = 1; rref(j) is ignored -- for groups j with i_pf_location(j) = 2; rref(j) is ignored -- for groups j with i_pf_location(j) = 3; rref(j) is ignored -- for groups j with i_pf_location(j) = 4; rref(j) is radius of -the coil in units of minor radii from the major radius -(r = rmajor + rref*rminor) -""" - - -s_shear_cs_peak: float = None -"""Maximum shear stress (Tresca criterion) coils/central solenoid [MPa]""" - - -sigpfcalw: float = None -"""maximum permissible tensile stress (MPa) in steel coil cases for superconducting -PF coils (`i_pf_conductor=0`) -""" - - -sigpfcf: float = None -"""fraction of JxB hoop force supported by steel case for superconducting PF coils (`i_pf_conductor=0`)""" - - -ind_pf_cs_plasma_mutual: list[float] = None -"""mutual inductance matrix (H)""" - - -temp_cs_superconductor_margin: float = None -"""Central solenoid temperature margin (K)""" - - -n_pf_coil_turns: list[float] = None -"""number of turns in PF coil i""" - - -f_a_pf_coil_void: list[float] = None -"""winding pack void fraction of PF coil i for coolant""" - - -f_a_cs_void: float = None -"""void fraction of central solenoid conductor for coolant""" - - -vs_cs_pf_total_burn: float = None -"""total flux swing available for burn (Wb)""" - - -vs_pf_coils_total_burn: float = None -"""flux swing from PF coils for burn (Wb)""" - - -vs_pf_coils_total_ramp: float = None -"""flux swing from PF coils for startup (Wb)""" - - -vs_pf_coils_total_pulse: float = None -"""total flux swing from PF coils (Wb)""" - - -vs_cs_total_pulse: float = None -"""total flux swing from the central solenoid (Wb)""" - - -vs_cs_burn: float = None -"""central solenoid flux swing for burn (Wb)""" - - -vs_cs_ramp: float = None -"""central solenoid flux swing for startup (Wb)""" - - -vs_cs_pf_total_ramp: float = None -"""total flux swing for startup (`constraint eqn 51` to enforce vs_cs_pf_total_ramp=vs_plasma_res_ramp+vs_plasma_ind_ramp) (Wb)""" - - -vs_cs_pf_total_pulse: float = None -"""total flux swing for pulse (Wb)""" - - -f_c_pf_cs_peak_time_array: list[float] = None -"""PF, CS coil current relative to peak current at time points 1 to 6""" - - -m_pf_coil_conductor_total: float = None -"""total mass of the PF coil conductor (kg)""" - - -m_pf_coil_structure_total: float = None -"""total mass of the PF coil structure (kg)""" - - -m_pf_coil_conductor: list[float] = None -"""conductor mass for PF coil i (kg)""" - - -m_pf_coil_structure: list[float] = None -"""structure mass for PF coil i (kg)""" - - -z_pf_coil_upper: list[float] = None -"""upper point of PF coil i (m)""" - - -z_pf_coil_lower: list[float] = None -"""lower point of PF coil i (m)""" - - -z_pf_coil_middle: list[float] = None -"""z (height) location of PF coil i (m)""" - - -zref: list[float] = None -"""PF coil vertical positioning adjuster: -- for groups j with i_pf_location(j) = 1; zref(j) is ignored -- for groups j with i_pf_location(j) = 2 AND itart=1 (only); -zref(j) is distance of centre of PF coil from inside -edge of TF coil (remember that PF coils for STs lie -within the TF coil) -- for groups j with i_pf_location(j) = 3; zref(j) = ratio of -height of coil group j to plasma minor radius -- for groups j with i_pf_location(j) = 4; zref(j) = ratio of -height of coil group j to plasma minor radius -""" + radius_cs_turn_cable_space: float = 0.0 + """Length of CS of CS coil turn conduit length""" -b_cs_limit_max: float = None -"""Central solenoid max field limit [T]""" - - -f_dr_dz_cs_turn: float = None -"""Ratio of CS coil turn conduit length to depth""" - - -dr_cs_turn: float = None -"""Length of CS of CS coil turn conduit""" - -dr_cs_full: float = None -"""Full radial thickness of the central solenoid (m)""" - - -dz_cs_turn: float = None -"""Depth/width of CS of CS coil turn conduit""" - - -radius_cs_turn_corners: float = None -"""Radius of curvature of CS coil turn corners (m)""" - - -radius_cs_turn_cable_space: float = None -"""Length of CS of CS coil turn conduit length""" - - -def init_pfcoil_module(): - global \ - first_call, \ - cslimit, \ - nef, \ - nfxf, \ - ricpf, \ - ssq0, \ - stress_z_cs_self_peak_midplane, \ - sig_hoop, \ - forc_z_cs_self_peak_midplane, \ - r_pf_cs_current_filaments, \ - z_pf_cs_current_filaments, \ - c_pf_cs_current_filaments, \ - xind, \ - r_pf_coil_middle_group_array, \ - z_pf_coil_middle_group_array, \ - ccls, \ - ccl0, \ - bpf2, \ - vsdum - - first_call = True - cslimit = False - nef = 0 - nfxf = 0 - ricpf = 0.0 - ssq0 = 0.0 - stress_z_cs_self_peak_midplane = 0.0 - sig_hoop = 0.0 - forc_z_cs_self_peak_midplane = 0.0 - - r_pf_cs_current_filaments = np.zeros(NFIXMX) - z_pf_cs_current_filaments = np.zeros(NFIXMX) - c_pf_cs_current_filaments = np.zeros(NFIXMX) - xind = np.zeros(NFIXMX) - r_pf_coil_middle_group_array = np.zeros((N_PF_GROUPS_MAX, N_PF_COILS_IN_GROUP_MAX)) - z_pf_coil_middle_group_array = np.zeros((N_PF_GROUPS_MAX, N_PF_COILS_IN_GROUP_MAX)) - ccls = np.zeros(N_PF_GROUPS_MAX) - ccl0 = np.zeros(N_PF_GROUPS_MAX) - bpf2 = np.zeros(NGC2) - vsdum = np.zeros((NGC2, 3)) - - -def init_pfcoil_variables(): - """Initialise the PF coil variables""" - global \ - alfapf, \ - alstroh, \ - i_cs_stress, \ - a_cs_poloidal, \ - a_cs_turn, \ - awpoh, \ - b_cs_peak_flat_top_end, \ - b_cs_peak_pulse_start, \ - b_pf_coil_peak, \ - ccl0_ma, \ - ccls_ma, \ - j_cs_pulse_start, \ - j_cs_flat_top_end, \ - c_pf_coil_turn, \ - c_pf_coil_turn_peak_input, \ - c_pf_cs_coil_pulse_start_ma, \ - c_pf_cs_coil_flat_top_ma, \ - c_pf_cs_coil_pulse_end_ma, \ - etapsu, \ - f_j_cs_start_end_flat_top, \ - f_j_cs_start_pulse_end_flat_top, \ - fcuohsu, \ - fcupfsu, \ - i_pf_location, \ - i_pf_conductor, \ - itr_sum, \ - i_cs_superconductor, \ - i_pf_superconductor, \ - j_crit_str_cs, \ - j_crit_str_pf, \ - i_pf_current, \ - i_r_pf_outside_tf_placement, \ - j_cs_conductor_critical_pulse_start, \ - j_cs_conductor_critical_flat_top_end, \ - jcableoh_bop, \ - jcableoh_eof, \ - n_pf_cs_plasma_circuits, \ - n_pf_coils_in_group, \ - n_cs_current_filaments, \ - n_pf_coil_groups, \ - n_cs_pf_coils, \ - f_z_cs_tf_internal, \ - f_a_cs_turn_steel, \ - pf_current_safety_factor, \ - pfcaseth, \ - rho_pf_coil, \ - rhopfbus, \ - m_pf_coil_max, \ - r_pf_coil_outer_max, \ - p_pf_electric_supplies_mw, \ - p_cs_resistive_flat_top, \ - p_pf_coil_resistive_total_flat_top, \ - r_pf_coil_inner, \ - r_pf_coil_outer, \ - c_pf_cs_coils_peak_ma, \ - j_pf_coil_wp_peak, \ - j_cs_critical_flat_top_end, \ - j_cs_critical_pulse_start, \ - j_pf_wp_critical, \ - r_cs_middle, \ - dz_cs_full, \ - dr_pf_tf_outboard_out_offset, \ - r_pf_coil_middle, \ - dr_pf_cs_middle_offset, \ - rpf2, \ - rref, \ - s_shear_cs_peak, \ - sigpfcalw, \ - sigpfcf, \ - ind_pf_cs_plasma_mutual, \ - temp_cs_superconductor_margin, \ - n_pf_coil_turns, \ - f_a_pf_coil_void, \ - f_a_cs_void, \ - vs_cs_pf_total_burn, \ - vs_pf_coils_total_burn, \ - vs_pf_coils_total_ramp, \ - vs_pf_coils_total_pulse, \ - vs_cs_total_pulse, \ - vs_cs_burn, \ - vs_cs_ramp, \ - vs_cs_pf_total_ramp, \ - vs_cs_pf_total_pulse, \ - f_c_pf_cs_peak_time_array, \ - m_pf_coil_conductor_total, \ - m_pf_coil_structure_total, \ - m_pf_coil_conductor, \ - m_pf_coil_structure, \ - z_pf_coil_upper, \ - z_pf_coil_lower, \ - z_pf_coil_middle, \ - zref, \ - b_cs_limit_max, \ - f_dr_dz_cs_turn, \ - dr_cs_turn, \ - dr_cs_full, \ - dz_cs_turn, \ - radius_cs_turn_corners, \ - radius_cs_turn_cable_space - - alfapf = 5e-10 - alstroh = 4.0e8 - i_cs_stress = 1 - a_cs_poloidal = 0.0 - a_cs_turn = 0.0 - awpoh = 0.0 - b_cs_peak_flat_top_end = 0.0 - b_cs_peak_pulse_start = 0.0 - b_pf_coil_peak = np.zeros(NGC2) - ccl0_ma = np.zeros(N_PF_GROUPS_MAX) - ccls_ma = np.zeros(N_PF_GROUPS_MAX) - j_cs_pulse_start = 0.0 - j_cs_flat_top_end = 1.85e7 - c_pf_coil_turn = np.zeros((NGC2, 6)) - c_pf_coil_turn_peak_input = np.full(NGC2, 4.0e4) - c_pf_cs_coil_pulse_start_ma = np.zeros(NGC2) - c_pf_cs_coil_flat_top_ma = np.zeros(NGC2) - c_pf_cs_coil_pulse_end_ma = np.zeros(NGC2) - etapsu = 0.9 - f_j_cs_start_end_flat_top = 0.0 - f_j_cs_start_pulse_end_flat_top = 0.9 - fcuohsu = 0.7 - fcupfsu = 0.69 - i_pf_location = np.array([2, 2, 3, 0, 0, 0, 0, 0, 0, 0]) - i_pf_conductor = 0 - itr_sum = 0.0 - i_cs_superconductor = 1 - i_pf_superconductor = 1 - j_crit_str_cs = 0.0 - j_crit_str_pf = 0.0 - i_pf_current = 1 - i_r_pf_outside_tf_placement = 0 - j_cs_conductor_critical_pulse_start = 0.0 - j_cs_conductor_critical_flat_top_end = 0.0 - jcableoh_bop = 0.0 - jcableoh_eof = 0.0 - n_pf_cs_plasma_circuits = 0 - n_pf_coils_in_group = np.array([1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0]) - n_cs_current_filaments = 7 - n_pf_coil_groups = 3 - n_cs_pf_coils = 0 - f_z_cs_tf_internal = 0.71 - f_a_cs_turn_steel = 0.5 - pf_current_safety_factor = 1.0 - pfcaseth = np.zeros(NGC2) - rho_pf_coil = 2.5e-8 - rhopfbus = 3.93e-8 - m_pf_coil_max = 0.0 - r_pf_coil_outer_max = 0.0 - p_pf_electric_supplies_mw = 0.0 - p_cs_resistive_flat_top = 0.0 - p_pf_coil_resistive_total_flat_top = 0.0 - r_pf_coil_inner = np.zeros(NGC2) - r_pf_coil_outer = np.zeros(NGC2) - c_pf_cs_coils_peak_ma = np.zeros(NGC2) - j_pf_coil_wp_peak = np.full(NGC2, 3.0e7) - j_cs_critical_flat_top_end = 0.0 - j_cs_critical_pulse_start = 0.0 - j_pf_wp_critical = np.zeros(NGC2) - r_cs_middle = 0.0 - dz_cs_full = 0.0 - dr_pf_tf_outboard_out_offset = 1.5 - r_pf_coil_middle = np.zeros(NGC2) - dr_pf_cs_middle_offset = 0.0 - rpf2 = -1.63 - rref = np.full(N_PF_GROUPS_MAX, 7.0) - s_shear_cs_peak = 0.0 - sigpfcalw = 500.0 - sigpfcf = 1.0 - ind_pf_cs_plasma_mutual = np.zeros((NGC2, NGC2)) - temp_cs_superconductor_margin = 0.0 - n_pf_coil_turns = np.zeros(NGC2) - f_a_pf_coil_void = np.full(NGC2, 0.3) - f_a_cs_void = 0.3 - vs_cs_pf_total_burn = 0.0 - vs_pf_coils_total_burn = 0.0 - vs_pf_coils_total_ramp = 0.0 - vs_pf_coils_total_pulse = 0.0 - vs_cs_total_pulse = 0.0 - vs_cs_burn = 0.0 - vs_cs_ramp = 0.0 - vs_cs_pf_total_ramp = 0.0 - vs_cs_pf_total_pulse = 0.0 - f_c_pf_cs_peak_time_array = np.zeros((NGC2, 6)) - m_pf_coil_conductor_total = 0.0 - m_pf_coil_structure_total = 0.0 - m_pf_coil_conductor = np.zeros(NGC2) - m_pf_coil_structure = np.zeros(NGC2) - z_pf_coil_upper = np.zeros(NGC2) - z_pf_coil_lower = np.zeros(NGC2) - z_pf_coil_middle = np.zeros(NGC2) - zref = np.array([3.6, 1.2, 2.5, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]) - b_cs_limit_max = 13.0 - f_dr_dz_cs_turn = 70.0 / 22.0 - dr_cs_turn = 0.0 - dr_cs_full = 0.0 - dz_cs_turn = 0.0 - radius_cs_turn_cable_space = 0.0 - radius_cs_turn_corners = 3.0e-3 +CREATE_DICTS_FROM_DATACLASS = PFCoilData diff --git a/process/data_structure/power_variables.py b/process/data_structure/power_variables.py index 464b99221..00aa61b28 100644 --- a/process/data_structure/power_variables.py +++ b/process/data_structure/power_variables.py @@ -1,154 +1,88 @@ -qmisc: float = None +from dataclasses import dataclass, field -qac: float = None -qcl: float = None +@dataclass +class PowerData: + qmisc: float = 0.0 -qss: float = None + qac: float = 0.0 -p_shld_coolant_pump_elec_mw: float = None + qcl: float = 0.0 -p_div_coolant_pump_elec_mw: float = None + qss: float = 0.0 -p_coolant_pump_total_mw: float = None + p_shld_coolant_pump_elec_mw: float = 0.0 -p_fw_blkt_heat_deposited_mw: float = None + p_div_coolant_pump_elec_mw: float = 0.0 -p_fw_blkt_coolant_pump_elec_mw: float = None + p_coolant_pump_total_mw: float = 0.0 -p_blkt_breeder_pump_elec_mw: float = None + p_fw_blkt_heat_deposited_mw: float = 0.0 -p_div_heat_deposited_mw: float = None + p_fw_blkt_coolant_pump_elec_mw: float = 0.0 -p_fw_heat_deposited_mw: float = None + p_blkt_breeder_pump_elec_mw: float = 0.0 -p_blkt_heat_deposited_mw: float = None + p_div_heat_deposited_mw: float = 0.0 -p_blkt_liquid_breeder_heat_deposited_mw: float = None + p_fw_heat_deposited_mw: float = 0.0 -p_shld_heat_deposited_mw: float = None + p_blkt_heat_deposited_mw: float = 0.0 -p_cp_coolant_pump_elec_mw: float = None + p_blkt_liquid_breeder_heat_deposited_mw: float = 0.0 -p_plant_core_systems_elec_mw: float = None + p_shld_heat_deposited_mw: float = 0.0 -e_plant_net_electric_pulse_mj: float = None -"""Net electric energy output per pulse (MJ)""" + p_cp_coolant_pump_elec_mw: float = 0.0 -e_plant_net_electric_pulse_kwh: float = None -"""Net electric energy output per pulse (kWh)""" + p_plant_core_systems_elec_mw: float = 0.0 -f_p_div_primary_heat: float = None + e_plant_net_electric_pulse_mj: float = 0.0 + """Net electric energy output per pulse (MJ)""" -delta_eta: float = None + e_plant_net_electric_pulse_kwh: float = 0.0 + """Net electric energy output per pulse (kWh)""" -i_div_primary_heat: float = None + f_p_div_primary_heat: float = 0.0 -p_turbine_loss_mw: float = None + delta_eta: float = 0.0 -p_hcd_electric_total_profile_mw: list[float] = None -"""Profile of total HCD electric power (MW) over pulse""" + i_div_primary_heat: float = 0.0 -p_tf_electric_supplies_profile_mw: list[float] = None -"""Profile of total TF coil electric power (MW) over pulse""" + p_turbine_loss_mw: float = 0.0 -p_pf_electric_supplies_profile_mw: list[float] = None -"""Profile of total PF coil electric power (MW) over pulse""" + p_hcd_electric_total_profile_mw: list[float] = field(default_factory=list) + """Profile of total HCD electric power (MW) over pulse""" -p_coolant_pump_elec_total_profile_mw: list[float] = None -"""Profile of total coolant pump electric power (MW) over pulse""" + p_tf_electric_supplies_profile_mw: list[float] = None + """Profile of total TF coil electric power (MW) over pulse""" -vachtmw_profile_mw: list[float] = None -"""Profile of total active vacuum pump power (MW) over pulse""" + p_pf_electric_supplies_profile_mw: list[float] = None + """Profile of total PF coil electric power (MW) over pulse""" -p_tritium_plant_electric_profile_mw: list[float] = None -"""Profile of total tritium plant electric power (MW) over pulse""" + p_coolant_pump_elec_total_profile_mw: list[float] = None + """Profile of total coolant pump electric power (MW) over pulse""" -p_cryo_plant_electric_profile_mw: list[float] = None -"""Profile of total cryo plant electric power (MW) over pulse""" + vachtmw_profile_mw: list[float] = None + """Profile of total active vacuum pump power (MW) over pulse""" -p_plant_electric_base_total__profile_mw: list[float] = None -"""Profile of total plant electric base power (MW) over pulse""" + p_tritium_plant_electric_profile_mw: list[float] = None + """Profile of total tritium plant electric power (MW) over pulse""" -p_plant_electric_gross_profile_mw: list[float] = None -"""Profile of total plant electric gross power (MW) over pulse""" + p_cryo_plant_electric_profile_mw: list[float] = None + """Profile of total cryo plant electric power (MW) over pulse""" -p_plant_electric_net_profile_mw: list[float] = None -"""Profile of total plant electric net power (MW) over pulse""" + p_plant_electric_base_total__profile_mw: list[float] = None + """Profile of total plant electric base power (MW) over pulse""" -p_fusion_total_profile_mw: list[float] = None -"""Profile of total fusion power (MW) over pulse""" + p_plant_electric_gross_profile_mw: list[float] = None + """Profile of total plant electric gross power (MW) over pulse""" + p_plant_electric_net_profile_mw: list[float] = None + """Profile of total plant electric net power (MW) over pulse""" -def init_power_variables(): - global qmisc - qmisc = 0.0 + p_fusion_total_profile_mw: list[float] = None + """Profile of total fusion power (MW) over pulse""" - global qac - qac = 0.0 - global qcl - qcl = 0.0 - - global qss - qss = 0.0 - - global p_shld_coolant_pump_elec_mw - p_shld_coolant_pump_elec_mw = 0.0 - - global p_div_coolant_pump_elec_mw - p_div_coolant_pump_elec_mw = 0.0 - - global p_coolant_pump_total_mw - p_coolant_pump_total_mw = 0.0 - - global p_fw_blkt_heat_deposited_mw - p_fw_blkt_heat_deposited_mw = 0.0 - - global p_fw_blkt_coolant_pump_elec_mw - p_fw_blkt_coolant_pump_elec_mw = 0.0 - - global p_blkt_breeder_pump_elec_mw - p_blkt_breeder_pump_elec_mw = 0.0 - - global p_div_heat_deposited_mw - p_div_heat_deposited_mw = 0.0 - - global p_fw_heat_deposited_mw - p_fw_heat_deposited_mw = 0.0 - - global p_blkt_heat_deposited_mw - p_blkt_heat_deposited_mw = 0.0 - - global p_blkt_liquid_breeder_heat_deposited_mw - p_blkt_liquid_breeder_heat_deposited_mw = 0.0 - - global p_shld_heat_deposited_mw - p_shld_heat_deposited_mw = 0.0 - - global p_cp_coolant_pump_elec_mw - p_cp_coolant_pump_elec_mw = 0.0 - - global p_plant_core_systems_elec_mw - p_plant_core_systems_elec_mw = 0.0 - - global e_plant_net_electric_pulse_mj - e_plant_net_electric_pulse_mj = 0.0 - - global e_plant_net_electric_pulse_kwh - e_plant_net_electric_pulse_kwh = 0.0 - - global f_p_div_primary_heat - f_p_div_primary_heat = 0.0 - - global delta_eta - delta_eta = 0.0 - - global i_div_primary_heat - i_div_primary_heat = 0.0 - - global p_turbine_loss_mw - p_turbine_loss_mw = 0.0 - - global p_hcd_electric_total_profile_mw - p_hcd_electric_total_profile_mw = [] +CREATE_DICTS_FROM_DATACLASS = PowerData diff --git a/process/data_structure/stellarator_configuration.py b/process/data_structure/stellarator_configuration.py index bb32a35c5..bf81a0f4b 100644 --- a/process/data_structure/stellarator_configuration.py +++ b/process/data_structure/stellarator_configuration.py @@ -1,137 +1,112 @@ -stella_config_name: str = None -"""Name of the configuration""" +from dataclasses import dataclass -stella_config_symmetry: int = None -"""Number of coils [1]""" +@dataclass +class StellaratorConfigData: + stella_config_name: str = None + """Name of the configuration""" -stella_config_coilspermodule: int = None -"""Coils per module [1]""" + stella_config_symmetry: int = None + """Number of coils [1]""" + stella_config_coilspermodule: int = None + """Coils per module [1]""" -stella_config_rmajor_ref: float = None -"""Reference Point for major radius where all the other variables are determined [m]""" + stella_config_rmajor_ref: float = None + """Reference Point for major radius where all the other variables are determined [m]""" + stella_config_rminor_ref: float = None + """Reference Point for minor radius where all the other variables are determined [m]""" -stella_config_rminor_ref: float = None -"""Reference Point for minor radius where all the other variables are determined [m]""" + stella_config_coil_rmajor: float = None + """Reference Point for coil major radius [m]""" + stella_config_coil_rminor: float = None + """Reference Point for coil minor radius [m]""" -stella_config_coil_rmajor: float = None -"""Reference Point for coil major radius [m]""" + stella_config_aspect_ref: float = None + """Reference Point for aspect ratio where all the other variables are determined [1]""" + stella_config_bt_ref: float = None + """Reference Point for toroidal b where all the other variables are determined [T]""" -stella_config_coil_rminor: float = None -"""Reference Point for coil minor radius [m]""" + stella_config_wp_area: float = None + """Winding pack area at the reference point [m^2]""" + stella_config_wp_bmax: float = None + """The maximal magnetic field in the winding pack at the reference size of the winding pack [T]""" -stella_config_aspect_ref: float = None -"""Reference Point for aspect ratio where all the other variables are determined [1]""" + stella_config_i0: float = None + """Coil current needed for b0 at the reference point [MA]""" + stella_config_a1: float = None + """Magnetic field fit parameter a1 (for the maximal field on the coils) [1]""" -stella_config_bt_ref: float = None -"""Reference Point for toroidal b where all the other variables are determined [T]""" + stella_config_a2: float = None + """Magnetic field fit parameter a2 [1]""" + stella_config_dmin: float = None + """Minimal intercoil distance at the reference point [m]""" -stella_config_wp_area: float = None -"""Winding pack area at the reference point [m^2]""" + stella_config_inductance: float = None + """inductance at the reference point [H]""" + stella_config_coilsurface: float = None + """Coil surface at the reference point [m2]""" -stella_config_wp_bmax: float = None -"""The maximal magnetic field in the winding pack at the reference size of the winding pack [T]""" + stella_config_coillength: float = None + """Total coil length at the reference point [m]""" + stella_config_max_portsize_width: float = None + """Port size in toroidal direction at the reference point [m]""" -stella_config_i0: float = None -"""Coil current needed for b0 at the reference point [MA]""" + stella_config_maximal_coil_height: float = None + """The maximal coil height at reference point. [m]""" + stella_config_min_plasma_coil_distance: float = None + """The minimal distance between coil and plasma at the reference point [m]""" -stella_config_a1: float = None -"""Magnetic field fit parameter a1 (for the maximal field on the coils) [1]""" + stella_config_derivative_min_lcfs_coils_dist: float = None + """The derivative of min_plasma_coil_distance wrt to the minor plasma radius at the reference point [1]""" + stella_config_vol_plasma: float = None + """The plasma volume at the reference point. Scales as a*R^2. [m^3]""" -stella_config_a2: float = None -"""Magnetic field fit parameter a2 [1]""" + stella_config_plasma_surface: float = None + """The plasma surface a the reference point. [m^2]""" + stella_config_wp_ratio: float = None + """Ratio radial to toroidal length of the winding pack. (a1 and a2 should be calculated using this value) [1]""" -stella_config_dmin: float = None -"""Minimal intercoil distance at the reference point [m]""" + stella_config_max_force_density: float = None + """Maximal toroidal and radially averaged force density at reference point in a WP cross section [MN/m^3]""" + stella_config_max_force_density_mnm: float = None + """Maximal integrated force density at reference point in a WP cross section [MN/m]""" -stella_config_inductance: float = None -"""inductance at the reference point [H]""" + stella_config_min_bend_radius: float = None + """Minimal bending radius at reference point [m]""" + stella_config_epseff: float = None + """Maximal epsilon effective in the core region [1]""" -stella_config_coilsurface: float = None -"""Coil surface at the reference point [m2]""" + stella_config_max_lateral_force_density: float = None + """Maximal lateral force density of the coil set [MN/m]""" + stella_config_max_radial_force_density: float = None + """Maximal radial force density of the coil set [MN/m]""" -stella_config_coillength: float = None -"""Total coil length at the reference point [m]""" + stella_config_centering_force_max_mn: float = None + """Maximal centering force of a coil in the coil set [MN]""" + stella_config_centering_force_min_mn: float = None + """Minimal centering force of a coil in the coil set (negative means pointing outwards) [MN]""" -stella_config_max_portsize_width: float = None -"""Port size in toroidal direction at the reference point [m]""" + stella_config_centering_force_avg_mn: float = None + """Average centering force the coils in the coil set [MN/coil]""" + stella_config_neutron_peakfactor: float = None + """The neutron peaking factor determined through inhomogeneities on the stellarator wall (qmax/qavg) [1]""" -stella_config_maximal_coil_height: float = None -"""The maximal coil height at reference point. [m]""" - -stella_config_min_plasma_coil_distance: float = None -"""The minimal distance between coil and plasma at the reference point [m]""" - - -stella_config_derivative_min_lcfs_coils_dist: float = None -"""The derivative of min_plasma_coil_distance wrt to the minor plasma radius at the reference point [1]""" - - -stella_config_vol_plasma: float = None -"""The plasma volume at the reference point. Scales as a*R^2. [m^3]""" - - -stella_config_plasma_surface: float = None -"""The plasma surface a the reference point. [m^2]""" - - -stella_config_wp_ratio: float = None -"""Ratio radial to toroidal length of the winding pack. (a1 and a2 should be calculated using this value) [1]""" - - -stella_config_max_force_density: float = None -"""Maximal toroidal and radially averaged force density at reference point in a WP cross section [MN/m^3]""" - - -stella_config_max_force_density_mnm: float = None -"""Maximal integrated force density at reference point in a WP cross section [MN/m]""" - - -stella_config_min_bend_radius: float = None -"""Minimal bending radius at reference point [m]""" - - -stella_config_epseff: float = None -"""Maximal epsilon effective in the core region [1]""" - - -stella_config_max_lateral_force_density: float = None -"""Maximal lateral force density of the coil set [MN/m]""" - - -stella_config_max_radial_force_density: float = None -"""Maximal radial force density of the coil set [MN/m]""" - - -stella_config_centering_force_max_mn: float = None -"""Maximal centering force of a coil in the coil set [MN]""" - - -stella_config_centering_force_min_mn: float = None -"""Minimal centering force of a coil in the coil set (negative means pointing outwards) [MN]""" - - -stella_config_centering_force_avg_mn: float = None -"""Average centering force the coils in the coil set [MN/coil]""" - - -stella_config_neutron_peakfactor: float = None -"""The neutron peaking factor determined through inhomogeneities on the stellarator wall (qmax/qavg) [1]""" +CREATE_DICTS_FROM_DATACLASS = StellaratorConfigData diff --git a/process/data_structure/stellarator_variables.py b/process/data_structure/stellarator_variables.py index 310efdbfb..f7fd3d574 100644 --- a/process/data_structure/stellarator_variables.py +++ b/process/data_structure/stellarator_variables.py @@ -1,184 +1,119 @@ -# These variables were from stellarator.f90 -f_st_n_coils: float = None -"""Actual number of coils to reference value from stella_config file""" +from dataclasses import dataclass -f_st_rmajor: float = None -"""Actual major radius to reference value from stella_config file""" -f_st_aspect: float = None -"""Actual aspect ratio to reference value from stella_config file""" +@dataclass +class StellaratorData: + f_st_n_coils: float = 0.0 + """Actual number of coils to reference value from stella_config file""" -f_st_coil_aspect: float = None -"""Scaling factor for (stellarator major radius / coil radius ratio)""" + f_st_rmajor: float = 0.0 + """Actual major radius to reference value from stella_config file""" -f_st_b: float = None -"""Actual b_plasma_toroidal_on_axis to reference value from stella_config file """ + f_st_aspect: float = None + """Actual aspect ratio to reference value from stella_config file""" -f_st_i_total: float = None -"""Actual total coil current to reference value from stella_config file""" + f_st_coil_aspect: float = 1.0 + """Scaling factor for (stellarator major radius / coil radius ratio)""" -f_st_rminor: float = None -"""Actual minor radius to reference value from stella_config file""" + f_st_b: float = 0.0 + """Actual b_plasma_toroidal_on_axis to reference value from stella_config file """ -f_coil_shape: float = None -"""Paramtere required for coil scaling -(min_plasma_coil_distance + stella_config_rminor_ref) / stella_config_coil_rminor -""" + f_st_i_total: float = 0.0 + """Actual total coil current to reference value from stella_config file""" -first_call: bool = None + f_st_rminor: float = 0.0 + """Actual minor radius to reference value from stella_config file""" -first_call_stfwbs: bool = None + f_coil_shape: float = 0.0 + """Paramtere required for coil scaling + (min_plasma_coil_distance + stella_config_rminor_ref) / stella_config_coil_rminor + """ -r_coil_minor: float = None -"""Coil minor radius (m)""" + first_call: bool = True -r_coil_major: float = None -"""Coil major radius (m)""" + first_call_stfwbs: bool = True -# These variables were from stellarator_variables.f90 -istell: int = None -"""Switch for stellarator option (set via `device.dat`): - - =0 use tokamak model - - =1 use stellarator model: Helias5 - - =2 use stellarator model: Helias4 - - =3 use stellarator model: Helias3 - - =4 use stellarator model: Wendelstein 7-X with 50 Coils - - =5 use stellarator model: Wendelstein 7-X with 30 Coils - - =6 use stellarator model: Use stella_conf.json file (any modulear stellarator, see documentation) -""" - -bmn: float = None -"""relative radial field perturbation""" - -f_asym: float = None -"""divertor heat load peaking factor""" - -f_rad: float = None -"""radiated power fraction in SOL""" - -f_w: float = None -"""island size fraction factor""" - -fdivwet: float = None -"""wetted fraction of the divertor area""" - -flpitch: float = None -"""field line pitch (rad)""" - -hportamax: float = None -"""maximum available area for horizontal ports (m2)""" - -hportpmax: float = None -"""maximum available poloidal extent for horizontal ports (m)""" - -hporttmax: float = None -"""maximum available toroidal extent for horizontal ports (m)""" - -iotabar: float = None -"""rotational transform (reciprocal of tokamak q) for stellarator confinement time scaling laws""" - -isthtr: int = None -"""Switch for stellarator auxiliary heating method: - - = 1electron cyclotron resonance heating - - = 2lower hybrid heating - - = 3neutral beam injection -""" - -m_res: int = None -"""poloidal resonance number (1)""" - -max_gyrotron_frequency: float = None -"""Maximal available gyrotron frequency (input parameter) (Hz)""" - -n_res: int = None -"""toroidal resonance number (1)""" - -shear: float = None -"""magnetic shear, derivative of iotabar (1)""" - -te0_ecrh_achievable: float = None -"""maximal central electron temperature as achievable by the ECRH, input. (keV)""" - -vportamax: float = None -"""maximum available area for vertical ports (m2)""" - -vportpmax: float = None -"""maximum available poloidal extent for vertical ports (m)""" - -vporttmax: float = None -"""maximum available toroidal extent for vertical ports (m)""" - -powerht_constraint: float = None - -powerscaling_constraint: float = None - - -def init_stellarator_variables(): - global \ - first_call, \ - first_call_stfwbs, \ - f_st_n_coils, \ - f_st_rmajor, \ - f_st_rminor, \ - f_coil_shape, \ - f_st_b, \ - f_st_i_total, \ - r_coil_minor, \ - r_coil_major, \ - istell, \ - bmn, \ - f_asym, \ - f_rad, \ - f_w, \ - f_st_coil_aspect, \ - fdivwet, \ - flpitch, \ - hportamax, \ - hportpmax, \ - hporttmax, \ - iotabar, \ - isthtr, \ - m_res, \ - n_res, \ - shear, \ - vportamax, \ - vportpmax, \ - vporttmax, \ - max_gyrotron_frequency, \ - te0_ecrh_achievable, \ - powerht_constraint, \ - powerscaling_constraint - - first_call = True - first_call_stfwbs = True - f_st_n_coils = 0.0 - f_st_rmajor = 0.0 - f_st_rminor = 0.0 - f_coil_shape = 0.0 - f_st_b = 0.0 - f_st_i_total = 0.0 - f_st_coil_aspect = 1.0 - r_coil_major = 0.0 - r_coil_minor = 0.0 - istell = 0 - bmn = 1e-3 - f_asym = 1.0 - f_rad = 0.85 - f_w = 0.5 - fdivwet = 0.333333333333333 - flpitch = 1e-3 - hportamax = 0.0 - hportpmax = 0.0 - hporttmax = 0.0 - iotabar = 1.0 - isthtr = 1 - m_res = 5 - n_res = 5 - shear = 0.5 - vportamax = 0.0 - vportpmax = 0.0 - vporttmax = 0.0 - max_gyrotron_frequency = 1.0e9 - te0_ecrh_achievable = 1.0e2 - powerht_constraint = 0.0 - powerscaling_constraint = 0.0 + r_coil_minor: float = 0.0 + """Coil minor radius (m)""" + + r_coil_major: float = 0.0 + """Coil major radius (m)""" + + istell: int = 0 + """Switch for stellarator option (set via `device.dat`): + - =0 use tokamak model + - =1 use stellarator model: Helias5 + - =2 use stellarator model: Helias4 + - =3 use stellarator model: Helias3 + - =4 use stellarator model: Wendelstein 7-X with 50 Coils + - =5 use stellarator model: Wendelstein 7-X with 30 Coils + - =6 use stellarator model: Use stella_conf.json file (any modulear stellarator, see documentation) + """ + + bmn: float = 1e-3 + """relative radial field perturbation""" + + f_asym: float = 1.0 + """divertor heat load peaking factor""" + + f_rad: float = 0.85 + """radiated power fraction in SOL""" + + f_w: float = 0.5 + """island size fraction factor""" + + fdivwet: float = 0.333333333333333 + """wetted fraction of the divertor area""" + + flpitch: float = 1e-3 + """field line pitch (rad)""" + + hportamax: float = 0.0 + """maximum available area for horizontal ports (m2)""" + + hportpmax: float = 0.0 + """maximum available poloidal extent for horizontal ports (m)""" + + hporttmax: float = 0.0 + """maximum available toroidal extent for horizontal ports (m)""" + + iotabar: float = 1.0 + """rotational transform (reciprocal of tokamak q) for stellarator confinement time scaling laws""" + + isthtr: int = 1 + """Switch for stellarator auxiliary heating method: + - = 1electron cyclotron resonance heating + - = 2lower hybrid heating + - = 3neutral beam injection + """ + + m_res: int = 5 + """poloidal resonance number (1)""" + + max_gyrotron_frequency: float = 1.0e9 + """Maximal available gyrotron frequency (input parameter) (Hz)""" + + n_res: int = 5 + """toroidal resonance number (1)""" + + shear: float = 0.5 + """magnetic shear, derivative of iotabar (1)""" + + te0_ecrh_achievable: float = 1.0e2 + """maximal central electron temperature as achievable by the ECRH, input. (keV)""" + + vportamax: float = 0.0 + """maximum available area for vertical ports (m2)""" + + vportpmax: float = 0.0 + """maximum available poloidal extent for vertical ports (m)""" + + vporttmax: float = 0.0 + """maximum available toroidal extent for vertical ports (m)""" + + powerht_constraint: float = 0.0 + + powerscaling_constraint: float = 0.0 + + +CREATE_DICTS_FROM_DATACLASS = StellaratorData diff --git a/process/main.py b/process/main.py index 9ed1925a2..ec7b4a00d 100644 --- a/process/main.py +++ b/process/main.py @@ -739,6 +739,9 @@ def models(self) -> tuple[Model, ...]: self.plasma_profile, self.plasma_dia_current, self.plasma_bootstrap_current, + self.stellarator, + self.plasma_current, + self.neoclassics, ) def setup_data_structure(self): diff --git a/process/models/availability.py b/process/models/availability.py index 2b72fddcf..8d03470fd 100644 --- a/process/models/availability.py +++ b/process/models/availability.py @@ -8,7 +8,6 @@ from process.core.exceptions import ProcessValueError from process.core.model import Model from process.data_structure import divertor_variables as dv -from process.data_structure import ife_variables as ifev from process.data_structure import physics_variables as pv from process.data_structure import tfcoil_variables as tfv from process.models.tfcoil.base import TFConductorModel @@ -87,7 +86,7 @@ def avail(self, output: bool): indicate whether output should be written to the output file, or not """ # Full power lifetime (in years) - if ifev.ife != 1: + if self.data.ife.ife != 1: # Calculate DPA per FPY - based on neutronics-derived fusion power relation to DEMO blanket lifetime provided by Matti Coleman # Detailed and cited in T. Franke 2020, "The EU DEMO equatorial outboard limiter — Design and port integration concept" # https://www.sciencedirect.com/science/article/pii/S0920379620301952#bib0075 @@ -199,7 +198,7 @@ def avail(self, output: bool): ) # Modify lifetimes to take account of the availability - if ifev.ife != 1: + if self.data.ife.ife != 1: # First wall / blanket if self.data.fwbs.life_blkt_fpy < self.data.costs.life_plant: self.data.fwbs.life_blkt_fpy = min( @@ -407,7 +406,7 @@ def avail_2(self, output: bool): ) # Modify lifetimes to take account of the availability - if ifev.ife != 1: + if self.data.ife.ife != 1: # First wall / blanket if self.data.fwbs.life_blkt_fpy < self.data.costs.life_plant: self.data.fwbs.life_blkt_fpy = min( @@ -1269,7 +1268,7 @@ def avail_st(self, output: bool): ) # Modify lifetimes to take account of the availability - if ifev.ife != 1: + if self.data.ife.ife != 1: # First wall / blanket if self.data.fwbs.life_blkt_fpy < self.data.costs.life_plant: self.data.fwbs.life_blkt_fpy = min( diff --git a/process/models/build.py b/process/models/build.py index 2c83c1c73..a500b1b63 100644 --- a/process/models/build.py +++ b/process/models/build.py @@ -9,7 +9,6 @@ from process.data_structure import ( divertor_variables, numerics, - pfcoil_variables, physics_variables, superconducting_tf_coil_variables, tfcoil_variables, @@ -777,7 +776,7 @@ def calculate_vertical_build(self, output: bool): self.mfile, "Ratio of Central Solenoid height to TF coil internal height", "(f_z_cs_tf_internal)", - pfcoil_variables.f_z_cs_tf_internal, + self.data.pf_coil.f_z_cs_tf_internal, ) po.ocmmnt( self.outfile, diff --git a/process/models/buildings.py b/process/models/buildings.py index d47005f4a..78947e970 100644 --- a/process/models/buildings.py +++ b/process/models/buildings.py @@ -7,7 +7,6 @@ from process.core.model import Model from process.data_structure import ( divertor_variables, - pfcoil_variables, physics_variables, tfcoil_variables, ) @@ -73,8 +72,8 @@ def run(self, output: bool = False): self.data.buildings.elevol, ) = self.bldgs( output, - pfcoil_variables.r_pf_coil_outer_max, - pfcoil_variables.m_pf_coil_max, + self.data.pf_coil.r_pf_coil_outer_max, + self.data.pf_coil.m_pf_coil_max, tfro, tfri, tf_vertical_dim, @@ -423,7 +422,7 @@ def bldgs_sizes(self, output, tf_radial_dim, tf_vertical_dim): # Lateral size driven by radial width of largest component, from: # PF coil max radius, cryostat radius, TF coil outer radius width_reactor_piece = max( - pfcoil_variables.r_pf_coil_outer_max, + self.data.pf_coil.r_pf_coil_outer_max, self.data.fwbs.r_cryostat_inboard, tf_radial_dim, ) diff --git a/process/models/costs/costs.py b/process/models/costs/costs.py index fded82b1e..c70a3e637 100644 --- a/process/models/costs/costs.py +++ b/process/models/costs/costs.py @@ -8,9 +8,7 @@ from process.core.model import Model from process.data_structure import ( divertor_variables, - ife_variables, pf_power_variables, - pfcoil_variables, physics_variables, tfcoil_variables, ) @@ -98,7 +96,7 @@ def output(self): self.data.fwbs.life_blkt, ) - if ife_variables.ife != 1: + if self.data.ife.ife != 1: po.ovarrf( self.outfile, "Divertor life (years)", @@ -132,7 +130,7 @@ def output(self): "(blkcst)", self.data.costs.blkcst, ) - if ife_variables.ife != 1: + if self.data.ife.ife != 1: po.ovarrf( self.outfile, "Divertor direct capital cost (M$)", @@ -260,7 +258,7 @@ def output(self): po.oshead(self.outfile, "Reactor Systems") po.ocosts(self.outfile, "(c2211)", "First wall cost (M$)", self.data.costs.c2211) - if ife_variables.ife != 1: + if self.data.ife.ife != 1: po.ocosts( self.outfile, "(c22121)", @@ -375,7 +373,7 @@ def output(self): self.data.costs.c221, ) - if ife_variables.ife != 1: + if self.data.ife.ife != 1: po.oshead(self.outfile, "Magnets") if ( @@ -492,7 +490,7 @@ def output(self): po.oshead(self.outfile, "Power Injection") - if ife_variables.ife == 1: + if self.data.ife.ife == 1: po.ocosts( self.outfile, "(c2231)", @@ -567,7 +565,7 @@ def output(self): self.data.costs.c224, ) - if ife_variables.ife != 1: + if self.data.ife.ife != 1: po.oshead(self.outfile, "Power Conditioning") po.ocosts( self.outfile, @@ -976,7 +974,7 @@ def acc222(self): This routine evaluates the Account 222 (magnet) costs, including the costs of associated cryostats. """ - if ife_variables.ife == 1: + if self.data.ife.ife == 1: self.data.costs.c222 = 0.0e0 return @@ -1001,7 +999,7 @@ def acc225(self): """Account 225 : Power conditioning This routine evaluates the Account 225 (power conditioning) costs. """ - if ife_variables.ife == 1: + if self.data.ife.ife == 1: self.data.costs.c225 = 0.0e0 else: # Account 225.1 : TF coil power conditioning @@ -1153,7 +1151,7 @@ def acc2211(self): """ cmlsa = [0.5000e0, 0.7500e0, 0.8750e0, 1.0000e0] - if ife_variables.ife != 1: + if self.data.ife.ife != 1: self.data.costs.c2211 = ( 1.0e-6 * cmlsa[self.data.costs.lsa - 1] @@ -1170,27 +1168,27 @@ def acc2211(self): * ( self.data.costs.ucblss * ( - ife_variables.fwmatm[0, 0] - + ife_variables.fwmatm[1, 0] - + ife_variables.fwmatm[2, 0] + self.data.ife.fwmatm[0, 0] + + self.data.ife.fwmatm[1, 0] + + self.data.ife.fwmatm[2, 0] ) - + ife_variables.uccarb + + self.data.ife.uccarb * ( - ife_variables.fwmatm[0, 1] - + ife_variables.fwmatm[1, 1] - + ife_variables.fwmatm[2, 1] + self.data.ife.fwmatm[0, 1] + + self.data.ife.fwmatm[1, 1] + + self.data.ife.fwmatm[2, 1] ) + self.data.costs.ucblli2o * ( - ife_variables.fwmatm[0, 3] - + ife_variables.fwmatm[1, 3] - + ife_variables.fwmatm[2, 3] + self.data.ife.fwmatm[0, 3] + + self.data.ife.fwmatm[1, 3] + + self.data.ife.fwmatm[2, 3] ) - + ife_variables.ucconc + + self.data.ife.ucconc * ( - ife_variables.fwmatm[0, 4] - + ife_variables.fwmatm[1, 4] - + ife_variables.fwmatm[2, 4] + self.data.ife.fwmatm[0, 4] + + self.data.ife.fwmatm[1, 4] + + self.data.ife.fwmatm[2, 4] ) ) ) @@ -1215,7 +1213,7 @@ def acc2212(self): """ cmlsa = [0.5000e0, 0.7500e0, 0.8750e0, 1.0000e0] - if ife_variables.ife != 1: + if self.data.ife.ife != 1: # Solid blanket (Li2O + Be) self.data.costs.c22121 = ( 1.0e-6 * self.data.fwbs.m_blkt_beryllium * self.data.costs.ucblbe @@ -1250,23 +1248,23 @@ def acc2212(self): self.data.costs.c22124 = 0.0e0 self.data.costs.c22125 = ( 1.0e-6 - * ife_variables.uccarb + * self.data.ife.uccarb * ( - ife_variables.blmatm[0, 1] - + ife_variables.blmatm[1, 1] - + ife_variables.blmatm[2, 1] + self.data.ife.blmatm[0, 1] + + self.data.ife.blmatm[1, 1] + + self.data.ife.blmatm[2, 1] ) ) self.data.costs.c22126 = ( 1.0e-6 - * ife_variables.ucconc + * self.data.ife.ucconc * ( - ife_variables.blmatm[0, 4] - + ife_variables.blmatm[1, 4] - + ife_variables.blmatm[2, 4] + self.data.ife.blmatm[0, 4] + + self.data.ife.blmatm[1, 4] + + self.data.ife.blmatm[2, 4] ) ) - self.data.costs.c22127 = 1.0e-6 * ife_variables.ucflib * ife_variables.mflibe + self.data.costs.c22127 = 1.0e-6 * self.data.ife.ucflib * self.data.ife.mflibe self.data.costs.c22128 = ( 1.0e-6 * self.data.costs.ucblli * self.data.fwbs.m_blkt_lithium ) @@ -1331,7 +1329,7 @@ def acc2213(self): """ cmlsa = [0.5000e0, 0.7500e0, 0.8750e0, 1.0000e0] - if ife_variables.ife != 1: + if self.data.ife.ife != 1: self.data.costs.c22131 = ( 1.0e-6 * self.data.fwbs.whtshld @@ -1345,27 +1343,27 @@ def acc2213(self): * ( self.data.costs.ucshld * ( - ife_variables.shmatm[0, 0] - + ife_variables.shmatm[1, 0] - + ife_variables.shmatm[2, 0] + self.data.ife.shmatm[0, 0] + + self.data.ife.shmatm[1, 0] + + self.data.ife.shmatm[2, 0] ) - + ife_variables.uccarb + + self.data.ife.uccarb * ( - ife_variables.shmatm[0, 1] - + ife_variables.shmatm[1, 1] - + ife_variables.shmatm[2, 1] + self.data.ife.shmatm[0, 1] + + self.data.ife.shmatm[1, 1] + + self.data.ife.shmatm[2, 1] ) + self.data.costs.ucblli2o * ( - ife_variables.shmatm[0, 3] - + ife_variables.shmatm[1, 3] - + ife_variables.shmatm[2, 3] + self.data.ife.shmatm[0, 3] + + self.data.ife.shmatm[1, 3] + + self.data.ife.shmatm[2, 3] ) - + ife_variables.ucconc + + self.data.ife.ucconc * ( - ife_variables.shmatm[0, 4] - + ife_variables.shmatm[1, 4] - + ife_variables.shmatm[2, 4] + self.data.ife.shmatm[0, 4] + + self.data.ife.shmatm[1, 4] + + self.data.ife.shmatm[2, 4] ) ) ) @@ -1373,7 +1371,7 @@ def acc2213(self): self.data.costs.c22131 = self.data.costs.fkind * self.data.costs.c22131 # Penetration shield assumed to be typical steel plate - if ife_variables.ife != 1: + if self.data.ife.ife != 1: self.data.costs.c22132 = ( 1.0e-6 * self.data.fwbs.wpenshld @@ -1414,7 +1412,7 @@ def acc2215(self):
If ifueltyp = 2, the initial divertor is included as a capital cost and the replacement divertor costs ae treated as a fuel cost, """ - if ife_variables.ife != 1: + if self.data.ife.ife != 1: self.data.costs.c2215 = ( 1.0e-6 * divertor_variables.a_div_surface_total * self.data.costs.ucdiv ) @@ -1605,12 +1603,12 @@ def acc2222(self): # Total length of PF coil windings (m) pfwndl = 0.0e0 - for i in range(pfcoil_variables.n_cs_pf_coils): + for i in range(self.data.pf_coil.n_cs_pf_coils): pfwndl += ( 2.0 * np.pi - * pfcoil_variables.r_pf_coil_middle[i] - * pfcoil_variables.n_pf_coil_turns[i] + * self.data.pf_coil.r_pf_coil_middle[i] + * self.data.pf_coil.n_pf_coil_turns[i] ) # Account 222.2.1 : Conductor @@ -1620,75 +1618,75 @@ def acc2222(self): # each superconducting cable (so is zero for resistive coils) costpfsh = ( - 0.0 if pfcoil_variables.i_pf_conductor == 1 else self.data.costs.cconshpf + 0.0 if self.data.pf_coil.i_pf_conductor == 1 else self.data.costs.cconshpf ) # Non-Central Solenoid coils if self.data.build.iohcl == 1: - npf = pfcoil_variables.n_cs_pf_coils - 1 + npf = self.data.pf_coil.n_cs_pf_coils - 1 else: - npf = pfcoil_variables.n_cs_pf_coils + npf = self.data.pf_coil.n_cs_pf_coils self.data.costs.c22221 = 0.0e0 for i in range(npf): # Superconductor ($/m) if self.data.costs.supercond_cost_model == 0: - if pfcoil_variables.i_pf_conductor == 0: + if self.data.pf_coil.i_pf_conductor == 0: costpfsc = ( - self.data.costs.ucsc[pfcoil_variables.i_pf_superconductor - 1] - * (1.0e0 - pfcoil_variables.fcupfsu) - * (1.0e0 - pfcoil_variables.f_a_pf_coil_void[i]) + self.data.costs.ucsc[self.data.pf_coil.i_pf_superconductor - 1] + * (1.0e0 - self.data.pf_coil.fcupfsu) + * (1.0e0 - self.data.pf_coil.f_a_pf_coil_void[i]) * abs( - pfcoil_variables.c_pf_cs_coils_peak_ma[i] - / pfcoil_variables.n_pf_coil_turns[i] + self.data.pf_coil.c_pf_cs_coils_peak_ma[i] + / self.data.pf_coil.n_pf_coil_turns[i] ) * 1.0e6 - / pfcoil_variables.j_pf_coil_wp_peak[i] + / self.data.pf_coil.j_pf_coil_wp_peak[i] * tfcoil_variables.dcond[ - pfcoil_variables.i_pf_superconductor - 1 + self.data.pf_coil.i_pf_superconductor - 1 ] ) else: costpfsc = 0.0e0 - elif pfcoil_variables.i_pf_conductor == 0: + elif self.data.pf_coil.i_pf_conductor == 0: costpfsc = ( self.data.costs.sc_mat_cost_0[ - pfcoil_variables.i_pf_superconductor - 1 + self.data.pf_coil.i_pf_superconductor - 1 ] * tfcoil_variables.j_crit_str_0[ - pfcoil_variables.i_pf_superconductor - 1 + self.data.pf_coil.i_pf_superconductor - 1 ] - / pfcoil_variables.j_crit_str_pf + / self.data.pf_coil.j_crit_str_pf ) else: costpfsc = 0.0 # Copper ($/m) - if pfcoil_variables.i_pf_conductor == 0: + if self.data.pf_coil.i_pf_conductor == 0: costpfcu = ( self.data.costs.uccu - * pfcoil_variables.fcupfsu - * (1.0e0 - pfcoil_variables.f_a_pf_coil_void[i]) + * self.data.pf_coil.fcupfsu + * (1.0e0 - self.data.pf_coil.f_a_pf_coil_void[i]) * abs( - pfcoil_variables.c_pf_cs_coils_peak_ma[i] - / pfcoil_variables.n_pf_coil_turns[i] + self.data.pf_coil.c_pf_cs_coils_peak_ma[i] + / self.data.pf_coil.n_pf_coil_turns[i] ) * 1.0e6 - / pfcoil_variables.j_pf_coil_wp_peak[i] + / self.data.pf_coil.j_pf_coil_wp_peak[i] * constants.den_copper ) else: costpfcu = ( self.data.costs.uccu - * (1.0e0 - pfcoil_variables.f_a_pf_coil_void[i]) + * (1.0e0 - self.data.pf_coil.f_a_pf_coil_void[i]) * abs( - pfcoil_variables.c_pf_cs_coils_peak_ma[i] - / pfcoil_variables.n_pf_coil_turns[i] + self.data.pf_coil.c_pf_cs_coils_peak_ma[i] + / self.data.pf_coil.n_pf_coil_turns[i] ) * 1.0e6 - / pfcoil_variables.j_pf_coil_wp_peak[i] + / self.data.pf_coil.j_pf_coil_wp_peak[i] * constants.den_copper ) @@ -1706,8 +1704,8 @@ def acc2222(self): 1.0e-6 * 2.0 * np.pi - * pfcoil_variables.r_pf_coil_middle[i] - * pfcoil_variables.n_pf_coil_turns[i] + * self.data.pf_coil.r_pf_coil_middle[i] + * self.data.pf_coil.n_pf_coil_turns[i] * cpfconpm ) @@ -1717,44 +1715,44 @@ def acc2222(self): # Superconductor ($/m) if self.data.costs.supercond_cost_model == 0: # Issue #328 Use CS conductor cross-sectional area (m2) - if pfcoil_variables.i_pf_conductor == 0: + if self.data.pf_coil.i_pf_conductor == 0: costpfsc = ( - self.data.costs.ucsc[pfcoil_variables.i_cs_superconductor - 1] - * pfcoil_variables.awpoh - * (1 - pfcoil_variables.f_a_cs_void) - * (1 - pfcoil_variables.fcuohsu) - / pfcoil_variables.n_pf_coil_turns[ - pfcoil_variables.n_cs_pf_coils - 1 + self.data.costs.ucsc[self.data.pf_coil.i_cs_superconductor - 1] + * self.data.pf_coil.awpoh + * (1 - self.data.pf_coil.f_a_cs_void) + * (1 - self.data.pf_coil.fcuohsu) + / self.data.pf_coil.n_pf_coil_turns[ + self.data.pf_coil.n_cs_pf_coils - 1 ] * tfcoil_variables.dcond[ - pfcoil_variables.i_cs_superconductor - 1 + self.data.pf_coil.i_cs_superconductor - 1 ] ) else: costpfsc = 0.0e0 - elif pfcoil_variables.i_pf_conductor == 0: + elif self.data.pf_coil.i_pf_conductor == 0: costpfsc = ( self.data.costs.sc_mat_cost_0[ - pfcoil_variables.i_cs_superconductor - 1 + self.data.pf_coil.i_cs_superconductor - 1 ] * tfcoil_variables.j_crit_str_0[ - pfcoil_variables.i_cs_superconductor - 1 + self.data.pf_coil.i_cs_superconductor - 1 ] - / pfcoil_variables.j_crit_str_cs + / self.data.pf_coil.j_crit_str_cs ) else: costpfsc = 0.0e0 # Copper ($/m) - if pfcoil_variables.i_pf_conductor == 0: + if self.data.pf_coil.i_pf_conductor == 0: costpfcu = ( self.data.costs.uccu - * pfcoil_variables.awpoh - * (1 - pfcoil_variables.f_a_cs_void) - * pfcoil_variables.fcuohsu - / pfcoil_variables.n_pf_coil_turns[ - pfcoil_variables.n_cs_pf_coils - 1 + * self.data.pf_coil.awpoh + * (1 - self.data.pf_coil.f_a_cs_void) + * self.data.pf_coil.fcuohsu + / self.data.pf_coil.n_pf_coil_turns[ + self.data.pf_coil.n_cs_pf_coils - 1 ] * constants.den_copper ) @@ -1762,10 +1760,10 @@ def acc2222(self): # MDK I don't know if this is ccorrect as we never use the resistive model costpfcu = ( self.data.costs.uccu - * pfcoil_variables.awpoh - * (1 - pfcoil_variables.f_a_cs_void) - / pfcoil_variables.n_pf_coil_turns[ - pfcoil_variables.n_cs_pf_coils - 1 + * self.data.pf_coil.awpoh + * (1 - self.data.pf_coil.f_a_cs_void) + / self.data.pf_coil.n_pf_coil_turns[ + self.data.pf_coil.n_cs_pf_coils - 1 ] * constants.den_copper ) @@ -1784,8 +1782,8 @@ def acc2222(self): 1.0e-6 * 2.0 * np.pi - * pfcoil_variables.r_pf_coil_middle[pfcoil_variables.n_cs_pf_coils - 1] - * pfcoil_variables.n_pf_coil_turns[pfcoil_variables.n_cs_pf_coils - 1] + * self.data.pf_coil.r_pf_coil_middle[self.data.pf_coil.n_cs_pf_coils - 1] + * self.data.pf_coil.n_pf_coil_turns[self.data.pf_coil.n_cs_pf_coils - 1] * cpfconpm ) @@ -1807,7 +1805,7 @@ def acc2222(self): # Account 222.2.3 : Steel case - will be zero for resistive coils self.data.costs.c22223 = ( - 1.0e-6 * self.data.costs.uccase * pfcoil_variables.m_pf_coil_structure_total + 1.0e-6 * self.data.costs.uccase * self.data.pf_coil.m_pf_coil_structure_total ) self.data.costs.c22223 = ( self.data.costs.fkind @@ -1861,7 +1859,7 @@ def acc223(self): to the system's short life. """ exprf = 1.0e0 - if ife_variables.ife != 1: + if self.data.ife.ife != 1: # Account 223.1 : ECH self.data.costs.c2231 = ( @@ -1921,36 +1919,36 @@ def acc223(self): # Assume offset linear form for generic and SOMBRERO types, # or one of two offset linear forms for OSIRIS type - if ife_variables.ifedrv == 2: - if ife_variables.dcdrv1 <= ife_variables.dcdrv2: + if self.data.ife.ifedrv == 2: + if self.data.ife.dcdrv1 <= self.data.ife.dcdrv2: switch = 0.0e0 else: - switch = (ife_variables.cdriv2 - ife_variables.cdriv1) / ( - ife_variables.dcdrv1 - ife_variables.dcdrv2 + switch = (self.data.ife.cdriv2 - self.data.ife.cdriv1) / ( + self.data.ife.dcdrv1 - self.data.ife.dcdrv2 ) - if ife_variables.edrive <= switch: - self.data.costs.c2231 = ife_variables.mcdriv * ( - ife_variables.cdriv1 - + ife_variables.dcdrv1 * 1.0e-6 * ife_variables.edrive + if self.data.ife.edrive <= switch: + self.data.costs.c2231 = self.data.ife.mcdriv * ( + self.data.ife.cdriv1 + + self.data.ife.dcdrv1 * 1.0e-6 * self.data.ife.edrive ) else: - self.data.costs.c2231 = ife_variables.mcdriv * ( - ife_variables.cdriv2 - + ife_variables.dcdrv2 * 1.0e-6 * ife_variables.edrive + self.data.costs.c2231 = self.data.ife.mcdriv * ( + self.data.ife.cdriv2 + + self.data.ife.dcdrv2 * 1.0e-6 * self.data.ife.edrive ) - elif ife_variables.ifedrv == 3: + elif self.data.ife.ifedrv == 3: self.data.costs.c2231 = ( - ife_variables.mcdriv + self.data.ife.mcdriv * 1.0e-6 - * ife_variables.cdriv3 - * (ife_variables.edrive / ife_variables.etadrv) + * self.data.ife.cdriv3 + * (self.data.ife.edrive / self.data.ife.etadrv) ) else: - self.data.costs.c2231 = ife_variables.mcdriv * ( - ife_variables.cdriv0 - + ife_variables.dcdrv0 * 1.0e-6 * ife_variables.edrive + self.data.costs.c2231 = self.data.ife.mcdriv * ( + self.data.ife.cdriv0 + + self.data.ife.dcdrv0 * 1.0e-6 * self.data.ife.edrive ) if self.data.costs.ifueltyp == 1: @@ -2273,13 +2271,13 @@ def acc2262(self): ) ) - if ife_variables.ife == 1: + if self.data.ife.ife == 1: self.data.costs.cppa += ( 1.0e-6 * self.data.costs.UCAHTS * ( - (1.0e6 * ife_variables.tdspmw) ** exphts - + (1.0e6 * ife_variables.tfacmw) ** exphts + (1.0e6 * self.data.ife.tdspmw) ** exphts + + (1.0e6 * self.data.ife.tfacmw) ** exphts ) ) @@ -2337,7 +2335,7 @@ def acc2272(self): """Account 2272 : Fuel processing and purification This routine evaluates the Account 2272 - Fuel processing """ - if ife_variables.ife != 1: + if self.data.ife.ife != 1: # Previous calculation, using molflow_plasma_fuelling_required in Amps: # 1.3 should have been physics_variables.m_fuel_amu*umass/electron_charge*1000*s/day = 2.2 # wtgpd = burnup * molflow_plasma_fuelling_required * 1.3e0 @@ -2353,14 +2351,14 @@ def acc2272(self): ) else: targtm = ( - ife_variables.gain - * ife_variables.edrive + self.data.ife.gain + * self.data.ife.edrive * 3.0e0 * 1.67e-27 * 1.0e3 - / (constants.ELECTRON_VOLT * 17.6e6 * ife_variables.fburn) + / (constants.ELECTRON_VOLT * 17.6e6 * self.data.ife.fburn) ) - physics_variables.wtgpd = targtm * ife_variables.reprat * 86400.0e0 + physics_variables.wtgpd = targtm * self.data.ife.reprat * 86400.0e0 # Assumes that He3 costs same as tritium to process... self.data.costs.c2272 = ( @@ -2697,7 +2695,7 @@ def coelc(self): millidollars/kWh, while other costs are in megadollars. All values are based on 1990 dollars. """ - if ife_variables.ife == 1: + if self.data.ife.ife == 1: kwhpy = ( 1.0e3 * self.data.heat_transport.p_plant_electric_net_mw @@ -2770,7 +2768,7 @@ def coelc(self): # Costs due to divertor renewal # ============================= - if ife_variables.ife == 1: + if self.data.ife.ife == 1: anndiv = 0.0e0 coediv = 0.0e0 else: @@ -2803,7 +2801,7 @@ def coelc(self): # Costs due to centrepost renewal # =============================== - if (physics_variables.itart == 1) and (ife_variables.ife != 1): + if (physics_variables.itart == 1) and (self.data.ife.ife != 1): # Compound interest factor fefcp = (1.0e0 + self.data.costs.discount_rate) ** self.data.costs.cplife_cal @@ -2888,7 +2886,7 @@ def coelc(self): # Annual cost of fuel - if ife_variables.ife != 1: + if self.data.ife.ife != 1: # Sum D-T fuel cost and He3 fuel cost annfuel = ( self.data.costs.ucfuel @@ -2905,8 +2903,8 @@ def coelc(self): else: annfuel = ( 1.0e-6 - * ife_variables.uctarg - * ife_variables.reprat + * self.data.ife.uctarg + * self.data.ife.reprat * 3.1536e7 * self.data.costs.f_t_plant_available ) diff --git a/process/models/costs/costs_2015.py b/process/models/costs/costs_2015.py index 296c10c92..be133393e 100644 --- a/process/models/costs/costs_2015.py +++ b/process/models/costs/costs_2015.py @@ -8,7 +8,6 @@ from process.data_structure import ( global_variables, pf_power_variables, - pfcoil_variables, physics_variables, tfcoil_variables, ) @@ -520,7 +519,7 @@ def calc_building_costs(self): 190000.0e0 * self.data.costs.light_build_cost_per_vol ) # Scale with the radius of the largest PF coil squared (m^2) - self.data.costs_2015.s_k[4] = pfcoil_variables.r_pf_coil_outer_max**2 + self.data.costs_2015.s_k[4] = self.data.pf_coil.r_pf_coil_outer_max**2 self.data.costs_2015.s_kref[4] = 12.4e0**2 self.data.costs_2015.s_cost[4] = ( self.data.costs_2015.s_cost_factor[4] @@ -889,7 +888,7 @@ def calc_remaining_subsystems(self): # # Cost of ITER CS and PF magnets self.data.costs_2015.s_cref[35] = 1538.0e6 # Scale with sum of (A x turns x radius) of CS and all PF coils - self.data.costs_2015.s_k[35] = pfcoil_variables.itr_sum + self.data.costs_2015.s_k[35] = self.data.pf_coil.itr_sum self.data.costs_2015.s_kref[35] = 7.4e8 self.data.costs_2015.s_cost[35] = ( self.data.costs_2015.s_cost_factor[35] diff --git a/process/models/cryostat.py b/process/models/cryostat.py index adb83ed21..c3d45f414 100644 --- a/process/models/cryostat.py +++ b/process/models/cryostat.py @@ -3,9 +3,6 @@ from process.core import constants from process.core import process_output as po from process.core.model import Model -from process.data_structure import ( - pfcoil_variables, -) class Cryostat(Model): @@ -31,7 +28,7 @@ def external_cryo_geometry(self): # Cryostat radius [m] # Take radius of furthest PF coil and add clearance self.data.fwbs.r_cryostat_inboard = ( - np.max(pfcoil_variables.r_pf_coil_outer) + self.data.fwbs.dr_pf_cryostat + np.max(self.data.pf_coil.r_pf_coil_outer) + self.data.fwbs.dr_pf_cryostat ) # Clearance between uppermost PF coil and cryostat lid [m]. @@ -45,7 +42,7 @@ def external_cryo_geometry(self): # Half-height of cryostat [m] # Take height of furthest PF coil and add clearance self.data.fwbs.z_cryostat_half_inside = ( - np.max(pfcoil_variables.z_pf_coil_upper) + self.data.blanket.dz_pf_cryostat + np.max(self.data.pf_coil.z_pf_coil_upper) + self.data.blanket.dz_pf_cryostat ) # Vertical clearance between TF coil and cryostat (m) diff --git a/process/models/ife.py b/process/models/ife.py index ca7def271..f609f278d 100644 --- a/process/models/ife.py +++ b/process/models/ife.py @@ -10,10 +10,8 @@ from process.core import constants, process_output from process.core.exceptions import ProcessValueError from process.core.model import Model -from process.data_structure import ( - ife_variables, - physics_variables, -) +from process.data_structure import physics_variables +from process.data_structure.ife_variables import MAXMAT MATERIALS = [ "void", @@ -124,7 +122,7 @@ def ifebld(self, output: bool = False): output: boolean to control writing of output to outfile/mfile """ - match ife_variables.ifetyp: + match self.data.ife.ifetyp: case 1: self.osibld() case 2: @@ -141,13 +139,13 @@ def ifebld(self, output: bool = False): radial_build_data = [ ["Device centreline", None, 0.0, 0.0], - ["Chamber", "chrad", ife_variables.chrad, ife_variables.r1], - ["First Wall", "fwdr", ife_variables.fwdr, ife_variables.r2], - ["Void 1", "v1dr", ife_variables.v1dr, ife_variables.r3], - ["Blanket", "bldr", ife_variables.bldr, ife_variables.r4], - ["Void 2", "v2dr", ife_variables.v2dr, ife_variables.r5], - ["Shield", "shdr", ife_variables.shdr, ife_variables.r6], - ["Void 3", "v3dr", ife_variables.v3dr, ife_variables.r7], + ["Chamber", "chrad", self.data.ife.chrad, self.data.ife.r1], + ["First Wall", "fwdr", self.data.ife.fwdr, self.data.ife.r2], + ["Void 1", "v1dr", self.data.ife.v1dr, self.data.ife.r3], + ["Blanket", "bldr", self.data.ife.bldr, self.data.ife.r4], + ["Void 2", "v2dr", self.data.ife.v2dr, self.data.ife.r5], + ["Shield", "shdr", self.data.ife.shdr, self.data.ife.r6], + ["Void 3", "v3dr", self.data.ife.v3dr, self.data.ife.r7], ] process_output.oheadr(self.outfile, "Radial build") @@ -163,24 +161,24 @@ def ifebld(self, output: bool = False): process_output.ovarre(self.outfile, f"{title} (m)", f"({name})", thickness) vertical_build_data = [ - ["Base of device", None, 0.0, -ife_variables.zl7], - ["Void 3 lower", "v3dzl", ife_variables.v3dzl, -ife_variables.zl6], - ["Shield lower", "shdzl", ife_variables.shdzl, -ife_variables.zl5], - ["Void 2 lower", "v2dzl", ife_variables.v2dzl, -ife_variables.zl4], - ["Blanket lower", "bldzl", ife_variables.bldzl, -ife_variables.zl3], - ["Void 1 lower", "v1dzl", ife_variables.v1dzl, -ife_variables.zl2], - ["First wall lower", "fwdzl", ife_variables.fwdzl, -ife_variables.zl1], - ["Chamber lower", "chdzl", ife_variables.chdzl, 0.0], - ["Chamber upper", "chdzu", ife_variables.chdzu, ife_variables.zu1], - ["First wall upper", "fwdzu", ife_variables.fwdzu, ife_variables.zu2], - ["Void 1 upper", "v1dzu", ife_variables.v1dzu, ife_variables.zu3], - ["Blanket upper", "bldzu", ife_variables.bldzu, ife_variables.zu4], - ["Void 2 upper", "v2dzu", ife_variables.v2dzu, ife_variables.zu5], - ["Shield upper", "shdzu", ife_variables.shdzu, ife_variables.zu6], - ["Void 3 upper", "v3dzu", ife_variables.v3dzu, ife_variables.zu7], + ["Base of device", None, 0.0, -self.data.ife.zl7], + ["Void 3 lower", "v3dzl", self.data.ife.v3dzl, -self.data.ife.zl6], + ["Shield lower", "shdzl", self.data.ife.shdzl, -self.data.ife.zl5], + ["Void 2 lower", "v2dzl", self.data.ife.v2dzl, -self.data.ife.zl4], + ["Blanket lower", "bldzl", self.data.ife.bldzl, -self.data.ife.zl3], + ["Void 1 lower", "v1dzl", self.data.ife.v1dzl, -self.data.ife.zl2], + ["First wall lower", "fwdzl", self.data.ife.fwdzl, -self.data.ife.zl1], + ["Chamber lower", "chdzl", self.data.ife.chdzl, 0.0], + ["Chamber upper", "chdzu", self.data.ife.chdzu, self.data.ife.zu1], + ["First wall upper", "fwdzu", self.data.ife.fwdzu, self.data.ife.zu2], + ["Void 1 upper", "v1dzu", self.data.ife.v1dzu, self.data.ife.zu3], + ["Blanket upper", "bldzu", self.data.ife.bldzu, self.data.ife.zu4], + ["Void 2 upper", "v2dzu", self.data.ife.v2dzu, self.data.ife.zu5], + ["Shield upper", "shdzu", self.data.ife.shdzu, self.data.ife.zu6], + ["Void 3 upper", "v3dzu", self.data.ife.v3dzu, self.data.ife.zu7], ] - if ife_variables.ifetyp == 4: + if self.data.ife.ifetyp == 4: process_output.oheadr(self.outfile, "Vertical build - Midplane") process_output.write( self.outfile, "\t" * 20 + "Thickness (m)" + "\t" * 3 + "Radius (m)" @@ -192,26 +190,26 @@ def ifebld(self, output: bool = False): process_output.obuild( self.outfile, "Blanket upper", - ife_variables.bldzu - ife_variables.bldzu, - ife_variables.zu4 - ife_variables.bldzu, + self.data.ife.bldzu - self.data.ife.bldzu, + self.data.ife.zu4 - self.data.ife.bldzu, ) process_output.obuild( self.outfile, "Void 2 upper", - ife_variables.v2dzu, - ife_variables.zu5 - ife_variables.bldzu, + self.data.ife.v2dzu, + self.data.ife.zu5 - self.data.ife.bldzu, ) process_output.obuild( self.outfile, "Shield upper", - ife_variables.shdzu, - ife_variables.zu6 - ife_variables.bldzu, + self.data.ife.shdzu, + self.data.ife.zu6 - self.data.ife.bldzu, ) process_output.obuild( self.outfile, "Void 3 upper", - ife_variables.v3dzu + ife_variables.bldzu, - ife_variables.zu7, + self.data.ife.v3dzu + self.data.ife.bldzu, + self.data.ife.zu7, ) process_output.oheadr(self.outfile, "Vertical build - Edge") @@ -246,13 +244,13 @@ def ifebld(self, output: bool = False): + "Void 3".ljust(10), ) material_row_gen = _material_string_generator( - ife_variables.chmatv, - ife_variables.fwmatv, - ife_variables.v1matv, - ife_variables.blmatv, - ife_variables.v2matv, - ife_variables.shmatv, - ife_variables.v3matv, + self.data.ife.chmatv, + self.data.ife.fwmatv, + self.data.ife.v1matv, + self.data.ife.blmatv, + self.data.ife.v2matv, + self.data.ife.shmatv, + self.data.ife.v3matv, ) for i in range(len(MATERIALS)): @@ -273,8 +271,8 @@ def osibld(self): # First wall area: no true first wall at bottom of chamber self.data.first_wall.a_fw_total = ( - 2.0 * np.pi * ife_variables.r1 * (ife_variables.zu1 + ife_variables.zl1) - + np.pi * ife_variables.r1 * ife_variables.r1 + 2.0 * np.pi * self.data.ife.r1 * (self.data.ife.zu1 + self.data.ife.zl1) + + np.pi * self.data.ife.r1 * self.data.ife.r1 ) def sombld(self): @@ -287,31 +285,31 @@ def sombld(self): Sviatoslavsky et al, Fusion Technology vol.21 (1992) 1470 """ # Radial build - ife_variables.r1 = ife_variables.chrad - ife_variables.r2 = ife_variables.r1 + ife_variables.fwdr - ife_variables.r3 = ife_variables.r2 + ife_variables.v1dr - ife_variables.r4 = ife_variables.r3 + ife_variables.bldr - ife_variables.r5 = ife_variables.r4 + ife_variables.v2dr - ife_variables.r6 = ife_variables.r5 + ife_variables.shdr - ife_variables.r7 = ife_variables.r6 + ife_variables.v3dr + self.data.ife.r1 = self.data.ife.chrad + self.data.ife.r2 = self.data.ife.r1 + self.data.ife.fwdr + self.data.ife.r3 = self.data.ife.r2 + self.data.ife.v1dr + self.data.ife.r4 = self.data.ife.r3 + self.data.ife.bldr + self.data.ife.r5 = self.data.ife.r4 + self.data.ife.v2dr + self.data.ife.r6 = self.data.ife.r5 + self.data.ife.shdr + self.data.ife.r7 = self.data.ife.r6 + self.data.ife.v3dr # Vertical build (below midplane) - ife_variables.zl1 = ife_variables.chdzl - ife_variables.zl2 = ife_variables.zl1 + ife_variables.fwdzl - ife_variables.zl3 = ife_variables.zl2 + ife_variables.v1dzl - ife_variables.zl4 = ife_variables.zl3 + ife_variables.bldzl - ife_variables.zl5 = ife_variables.zl4 + ife_variables.v2dzl - ife_variables.zl6 = ife_variables.zl5 + ife_variables.shdzl - ife_variables.zl7 = ife_variables.zl6 + ife_variables.v3dzl + self.data.ife.zl1 = self.data.ife.chdzl + self.data.ife.zl2 = self.data.ife.zl1 + self.data.ife.fwdzl + self.data.ife.zl3 = self.data.ife.zl2 + self.data.ife.v1dzl + self.data.ife.zl4 = self.data.ife.zl3 + self.data.ife.bldzl + self.data.ife.zl5 = self.data.ife.zl4 + self.data.ife.v2dzl + self.data.ife.zl6 = self.data.ife.zl5 + self.data.ife.shdzl + self.data.ife.zl7 = self.data.ife.zl6 + self.data.ife.v3dzl # Vertical build (above midplane) - ife_variables.zu1 = ife_variables.chdzu - ife_variables.zu2 = ife_variables.zu1 + ife_variables.fwdzu - ife_variables.zu3 = ife_variables.zu2 + ife_variables.v1dzu - ife_variables.zu4 = ife_variables.zu3 + ife_variables.bldzu - ife_variables.zu5 = ife_variables.zu4 + ife_variables.v2dzu - ife_variables.zu6 = ife_variables.zu5 + ife_variables.shdzu - ife_variables.zu7 = ife_variables.zu6 + ife_variables.v3dzu + self.data.ife.zu1 = self.data.ife.chdzu + self.data.ife.zu2 = self.data.ife.zu1 + self.data.ife.fwdzu + self.data.ife.zu3 = self.data.ife.zu2 + self.data.ife.v1dzu + self.data.ife.zu4 = self.data.ife.zu3 + self.data.ife.bldzu + self.data.ife.zu5 = self.data.ife.zu4 + self.data.ife.v2dzu + self.data.ife.zu6 = self.data.ife.zu5 + self.data.ife.shdzu + self.data.ife.zu7 = self.data.ife.zu6 + self.data.ife.v3dzu # The SOMBRERO chamber is made up of a cylindrical first wall/ # blanket, with conical regions above and below. Outside this is @@ -324,70 +322,70 @@ def sombld(self): # J=3 : bottom part # Chamber : CHCYLH is the height of the cylindrical part - chcylh = ife_variables.chdzu + ife_variables.chdzl - 2.0 * ife_variables.chrad + chcylh = self.data.ife.chdzu + self.data.ife.chdzl - 2.0 * self.data.ife.chrad - ife_variables.chvol = ( + self.data.ife.chvol = ( np.pi - * ife_variables.r1 - * ife_variables.r1 - * (chcylh + (2.0 / 3.0) * ife_variables.chrad) + * self.data.ife.r1 + * self.data.ife.r1 + * (chcylh + (2.0 / 3.0) * self.data.ife.chrad) ) # First wall - ife_variables.fwvol[0] = ( + self.data.ife.fwvol[0] = ( np.pi - * (ife_variables.r2 * ife_variables.r2 - ife_variables.r1 * ife_variables.r1) + * (self.data.ife.r2 * self.data.ife.r2 - self.data.ife.r1 * self.data.ife.r1) * chcylh ) - ife_variables.fwvol[1] = ( + self.data.ife.fwvol[1] = ( (1.0 / 3.0) * np.pi * ( - ife_variables.r2 - * ife_variables.r2 - * (ife_variables.chrad + ife_variables.fwdzu) - - ife_variables.r1 * ife_variables.r1 * ife_variables.chrad + self.data.ife.r2 + * self.data.ife.r2 + * (self.data.ife.chrad + self.data.ife.fwdzu) + - self.data.ife.r1 * self.data.ife.r1 * self.data.ife.chrad ) ) - ife_variables.fwvol[2] = ( + self.data.ife.fwvol[2] = ( (1.0 / 3.0) * np.pi * ( - ife_variables.r2 - * ife_variables.r2 - * (ife_variables.chrad + ife_variables.fwdzl) - - ife_variables.r1 * ife_variables.r1 * ife_variables.chrad + self.data.ife.r2 + * self.data.ife.r2 + * (self.data.ife.chrad + self.data.ife.fwdzl) + - self.data.ife.r1 * self.data.ife.r1 * self.data.ife.chrad ) ) # First void - ife_variables.v1vol[0] = ( + self.data.ife.v1vol[0] = ( np.pi - * (ife_variables.r3 * ife_variables.r3 - ife_variables.r2 * ife_variables.r2) + * (self.data.ife.r3 * self.data.ife.r3 - self.data.ife.r2 * self.data.ife.r2) * chcylh ) - ife_variables.v1vol[1] = ( + self.data.ife.v1vol[1] = ( (1.0 / 3.0) * np.pi * ( - ife_variables.r3 - * ife_variables.r3 - * (ife_variables.chrad + ife_variables.fwdzu + ife_variables.v1dzu) - - ife_variables.r2 - * ife_variables.r2 - * (ife_variables.chrad + ife_variables.fwdzu) + self.data.ife.r3 + * self.data.ife.r3 + * (self.data.ife.chrad + self.data.ife.fwdzu + self.data.ife.v1dzu) + - self.data.ife.r2 + * self.data.ife.r2 + * (self.data.ife.chrad + self.data.ife.fwdzu) ) ) - ife_variables.v1vol[2] = ( + self.data.ife.v1vol[2] = ( (1.0 / 3.0) * np.pi * ( - ife_variables.r3 - * ife_variables.r3 - * (ife_variables.chrad + ife_variables.fwdzl + ife_variables.v1dzl) - - ife_variables.r2 - * ife_variables.r2 - * (ife_variables.chrad + ife_variables.fwdzl) + self.data.ife.r3 + * self.data.ife.r3 + * (self.data.ife.chrad + self.data.ife.fwdzl + self.data.ife.v1dzl) + - self.data.ife.r2 + * self.data.ife.r2 + * (self.data.ife.chrad + self.data.ife.fwdzl) ) ) @@ -396,223 +394,223 @@ def sombld(self): # DDZ = Height of top cylindrical section (by similar triangles) # DVOL = Volume of top cylindrical section, less the internal cone - ife_variables.blvol[0] = ( + self.data.ife.blvol[0] = ( np.pi - * (ife_variables.r4 * ife_variables.r4 - ife_variables.r3 * ife_variables.r3) + * (self.data.ife.r4 * self.data.ife.r4 - self.data.ife.r3 * self.data.ife.r3) * chcylh ) - ife_variables.blvol[1] = ( + self.data.ife.blvol[1] = ( (1.0 / 3.0) * np.pi * ( - ife_variables.r4 - * ife_variables.r4 + self.data.ife.r4 + * self.data.ife.r4 * ( - ife_variables.chrad - + ife_variables.fwdzu - + ife_variables.v1dzu - + ife_variables.bldzu + self.data.ife.chrad + + self.data.ife.fwdzu + + self.data.ife.v1dzu + + self.data.ife.bldzu ) - - ife_variables.r3 - * ife_variables.r3 - * (ife_variables.chrad + ife_variables.fwdzu + ife_variables.v1dzu) + - self.data.ife.r3 + * self.data.ife.r3 + * (self.data.ife.chrad + self.data.ife.fwdzu + self.data.ife.v1dzu) ) ) ddz = ( ( - ife_variables.chrad - + ife_variables.fwdzu - + ife_variables.v1dzu - + ife_variables.bldzu + self.data.ife.chrad + + self.data.ife.fwdzu + + self.data.ife.v1dzu + + self.data.ife.bldzu ) / ( - ife_variables.chrad - + ife_variables.fwdr - + ife_variables.v1dr - + ife_variables.bldr + self.data.ife.chrad + + self.data.ife.fwdr + + self.data.ife.v1dr + + self.data.ife.bldr ) - * ife_variables.somtdr + * self.data.ife.somtdr ) dvol = ( - 2.0 * (1.0 / 3.0) * np.pi * ife_variables.somtdr * ife_variables.somtdr * ddz + 2.0 * (1.0 / 3.0) * np.pi * self.data.ife.somtdr * self.data.ife.somtdr * ddz ) - ife_variables.blvol[1] += dvol + self.data.ife.blvol[1] += dvol # Ditto for bottom region... - ife_variables.blvol[2] = ( + self.data.ife.blvol[2] = ( (1.0 / 3.0) * np.pi * ( - ife_variables.r4 - * ife_variables.r4 + self.data.ife.r4 + * self.data.ife.r4 * ( - ife_variables.chrad - + ife_variables.fwdzl - + ife_variables.v1dzl - + ife_variables.bldzl + self.data.ife.chrad + + self.data.ife.fwdzl + + self.data.ife.v1dzl + + self.data.ife.bldzl ) - - ife_variables.r3 - * ife_variables.r3 - * (ife_variables.chrad + ife_variables.fwdzl + ife_variables.v1dzl) + - self.data.ife.r3 + * self.data.ife.r3 + * (self.data.ife.chrad + self.data.ife.fwdzl + self.data.ife.v1dzl) ) ) ddz = ( ( - ife_variables.chrad - + ife_variables.fwdzl - + ife_variables.v1dzl - + ife_variables.bldzl + self.data.ife.chrad + + self.data.ife.fwdzl + + self.data.ife.v1dzl + + self.data.ife.bldzl ) / ( - ife_variables.chrad - + ife_variables.fwdr - + ife_variables.v1dr - + ife_variables.bldr + self.data.ife.chrad + + self.data.ife.fwdr + + self.data.ife.v1dr + + self.data.ife.bldr ) - * ife_variables.sombdr + * self.data.ife.sombdr ) dvol = ( - 2.0 * (1.0 / 3.0) * np.pi * ife_variables.sombdr * ife_variables.sombdr * ddz + 2.0 * (1.0 / 3.0) * np.pi * self.data.ife.sombdr * self.data.ife.sombdr * ddz ) - ife_variables.blvol[2] += dvol + self.data.ife.blvol[2] += dvol # Second void - ife_variables.v2vol[0] = ( + self.data.ife.v2vol[0] = ( np.pi - * (ife_variables.r5 * ife_variables.r5 - ife_variables.r4 * ife_variables.r4) + * (self.data.ife.r5 * self.data.ife.r5 - self.data.ife.r4 * self.data.ife.r4) * chcylh ) - ife_variables.v2vol[1] = np.pi * ife_variables.r5 * ife_variables.r5 * ( - ife_variables.zu5 - ife_variables.chdzu + ife_variables.chrad + self.data.ife.v2vol[1] = np.pi * self.data.ife.r5 * self.data.ife.r5 * ( + self.data.ife.zu5 - self.data.ife.chdzu + self.data.ife.chrad ) - ( - ife_variables.fwvol[1] - + ife_variables.v1vol[1] - + ife_variables.blvol[1] + self.data.ife.fwvol[1] + + self.data.ife.v1vol[1] + + self.data.ife.blvol[1] + ( (1.0 / 3.0) * np.pi - * ife_variables.r1 - * ife_variables.r1 - * ife_variables.chrad + * self.data.ife.r1 + * self.data.ife.r1 + * self.data.ife.chrad ) ) - ife_variables.v2vol[2] = np.pi * ife_variables.r5 * ife_variables.r5 * ( - ife_variables.zl5 - ife_variables.chdzl + ife_variables.chrad + self.data.ife.v2vol[2] = np.pi * self.data.ife.r5 * self.data.ife.r5 * ( + self.data.ife.zl5 - self.data.ife.chdzl + self.data.ife.chrad ) - ( - ife_variables.fwvol[2] - + ife_variables.v1vol[2] - + ife_variables.blvol[2] + self.data.ife.fwvol[2] + + self.data.ife.v1vol[2] + + self.data.ife.blvol[2] + ( (1.0 / 3.0) * np.pi - * ife_variables.r1 - * ife_variables.r1 - * ife_variables.chrad + * self.data.ife.r1 + * self.data.ife.r1 + * self.data.ife.chrad ) ) # Shield - ife_variables.shvol[0] = ( + self.data.ife.shvol[0] = ( np.pi - * (ife_variables.r6 * ife_variables.r6 - ife_variables.r5 * ife_variables.r5) - * (ife_variables.zu6 + ife_variables.zl6) + * (self.data.ife.r6 * self.data.ife.r6 - self.data.ife.r5 * self.data.ife.r5) + * (self.data.ife.zu6 + self.data.ife.zl6) ) - ife_variables.shvol[1] = ( + self.data.ife.shvol[1] = ( np.pi - * ife_variables.r5 - * ife_variables.r5 - * (ife_variables.zu6 - ife_variables.zu5) + * self.data.ife.r5 + * self.data.ife.r5 + * (self.data.ife.zu6 - self.data.ife.zu5) ) - ife_variables.shvol[2] = ( + self.data.ife.shvol[2] = ( np.pi - * ife_variables.r5 - * ife_variables.r5 - * (ife_variables.zl6 - ife_variables.zl5) + * self.data.ife.r5 + * self.data.ife.r5 + * (self.data.ife.zl6 - self.data.ife.zl5) ) # Third void - ife_variables.v3vol[0] = ( + self.data.ife.v3vol[0] = ( np.pi - * (ife_variables.r7 * ife_variables.r7 - ife_variables.r6 * ife_variables.r6) - * (ife_variables.zu7 + ife_variables.zl7) + * (self.data.ife.r7 * self.data.ife.r7 - self.data.ife.r6 * self.data.ife.r6) + * (self.data.ife.zu7 + self.data.ife.zl7) ) - ife_variables.v3vol[1] = ( + self.data.ife.v3vol[1] = ( np.pi - * ife_variables.r6 - * ife_variables.r6 - * (ife_variables.zu7 - ife_variables.zu6) + * self.data.ife.r6 + * self.data.ife.r6 + * (self.data.ife.zu7 - self.data.ife.zu6) ) - ife_variables.v3vol[2] = ( + self.data.ife.v3vol[2] = ( np.pi - * ife_variables.r6 - * ife_variables.r6 - * (ife_variables.zl7 - ife_variables.zl6) + * self.data.ife.r6 + * self.data.ife.r6 + * (self.data.ife.zl7 - self.data.ife.zl6) ) # Material volumes - for i in range(ife_variables.MAXMAT): - ife_variables.chmatv[i] = max( - 0.0, ife_variables.chvol * ife_variables.chmatf[i] + for i in range(MAXMAT): + self.data.ife.chmatv[i] = max( + 0.0, self.data.ife.chvol * self.data.ife.chmatf[i] ) for j in range(3): - ife_variables.fwmatv[j, i] = max( - 0.0, ife_variables.fwvol[j] * ife_variables.fwmatf[j, i] + self.data.ife.fwmatv[j, i] = max( + 0.0, self.data.ife.fwvol[j] * self.data.ife.fwmatf[j, i] ) - ife_variables.v1matv[j, i] = max( - 0.0, ife_variables.v1vol[j] * ife_variables.v1matf[j, i] + self.data.ife.v1matv[j, i] = max( + 0.0, self.data.ife.v1vol[j] * self.data.ife.v1matf[j, i] ) - ife_variables.blmatv[j, i] = max( - 0.0, ife_variables.blvol[j] * ife_variables.blmatf[j, i] + self.data.ife.blmatv[j, i] = max( + 0.0, self.data.ife.blvol[j] * self.data.ife.blmatf[j, i] ) - ife_variables.v2matv[j, i] = max( - 0.0, ife_variables.v2vol[j] * ife_variables.v2matf[j, i] + self.data.ife.v2matv[j, i] = max( + 0.0, self.data.ife.v2vol[j] * self.data.ife.v2matf[j, i] ) - ife_variables.shmatv[j, i] = max( - 0.0, ife_variables.shvol[j] * ife_variables.shmatf[j, i] + self.data.ife.shmatv[j, i] = max( + 0.0, self.data.ife.shvol[j] * self.data.ife.shmatf[j, i] ) - ife_variables.v3matv[j, i] = max( - 0.0, ife_variables.v3vol[j] * ife_variables.v3matf[j, i] + self.data.ife.v3matv[j, i] = max( + 0.0, self.data.ife.v3vol[j] * self.data.ife.v3matf[j, i] ) # First wall area self.data.first_wall.a_fw_total = ( 2.0 * np.pi - * ife_variables.r1 - * ((ife_variables.zu1 + ife_variables.zl1) + ife_variables.r1 * np.sqrt(2.0)) + * self.data.ife.r1 + * ((self.data.ife.zu1 + self.data.ife.zl1) + self.data.ife.r1 * np.sqrt(2.0)) ) def hylbld(self): # Radial build - ife_variables.r1 = ife_variables.chrad - ife_variables.r2 = ife_variables.r1 + ife_variables.fwdr - ife_variables.r3 = ife_variables.r2 + ife_variables.v1dr - ife_variables.r4 = ife_variables.r3 + ife_variables.bldr - ife_variables.r5 = ife_variables.r4 + ife_variables.v2dr - ife_variables.r6 = ife_variables.r5 + ife_variables.shdr - ife_variables.r7 = ife_variables.r6 + ife_variables.v3dr + self.data.ife.r1 = self.data.ife.chrad + self.data.ife.r2 = self.data.ife.r1 + self.data.ife.fwdr + self.data.ife.r3 = self.data.ife.r2 + self.data.ife.v1dr + self.data.ife.r4 = self.data.ife.r3 + self.data.ife.bldr + self.data.ife.r5 = self.data.ife.r4 + self.data.ife.v2dr + self.data.ife.r6 = self.data.ife.r5 + self.data.ife.shdr + self.data.ife.r7 = self.data.ife.r6 + self.data.ife.v3dr # Vertical build (below midplane) - ife_variables.zl1 = ife_variables.chdzl - ife_variables.zl2 = ife_variables.zl1 + ife_variables.fwdzl - ife_variables.zl3 = ife_variables.zl2 + ife_variables.v1dzl - ife_variables.zl4 = ife_variables.zl3 + ife_variables.bldzl - ife_variables.zl5 = ife_variables.zl4 + ife_variables.v2dzl - ife_variables.zl6 = ife_variables.zl5 + ife_variables.shdzl - ife_variables.zl7 = ife_variables.zl6 + ife_variables.v3dzl + self.data.ife.zl1 = self.data.ife.chdzl + self.data.ife.zl2 = self.data.ife.zl1 + self.data.ife.fwdzl + self.data.ife.zl3 = self.data.ife.zl2 + self.data.ife.v1dzl + self.data.ife.zl4 = self.data.ife.zl3 + self.data.ife.bldzl + self.data.ife.zl5 = self.data.ife.zl4 + self.data.ife.v2dzl + self.data.ife.zl6 = self.data.ife.zl5 + self.data.ife.shdzl + self.data.ife.zl7 = self.data.ife.zl6 + self.data.ife.v3dzl # Vertical build (above midplane) - ife_variables.zu1 = ife_variables.chdzu - ife_variables.zu2 = ife_variables.zu1 + ife_variables.fwdzu - ife_variables.zu3 = ife_variables.zu2 + ife_variables.v1dzu - ife_variables.zu4 = ife_variables.zu3 + ife_variables.bldzu - ife_variables.zu5 = ife_variables.zu4 + ife_variables.v2dzu - ife_variables.zu6 = ife_variables.zu5 + ife_variables.shdzu - ife_variables.zu7 = ife_variables.zu6 + ife_variables.v3dzu + self.data.ife.zu1 = self.data.ife.chdzu + self.data.ife.zu2 = self.data.ife.zu1 + self.data.ife.fwdzu + self.data.ife.zu3 = self.data.ife.zu2 + self.data.ife.v1dzu + self.data.ife.zu4 = self.data.ife.zu3 + self.data.ife.bldzu + self.data.ife.zu5 = self.data.ife.zu4 + self.data.ife.v2dzu + self.data.ife.zu6 = self.data.ife.zu5 + self.data.ife.shdzu + self.data.ife.zu7 = self.data.ife.zu6 + self.data.ife.v3dzu # The HYLIFE-II chamber is assumed to be mostly cylindrical, but # with a conical region below the midplane that causes the Flibe @@ -623,185 +621,185 @@ def hylbld(self): # J=1 : side part # J=2 : top part # J=3 : bottom part - ife_variables.chvol = ( + self.data.ife.chvol = ( np.pi - * ife_variables.r1 - * ife_variables.r1 + * self.data.ife.r1 + * self.data.ife.r1 * ( - (ife_variables.zu1 + ife_variables.zl5) - - (1 / 3) * (ife_variables.zl5 - ife_variables.zl1) + (self.data.ife.zu1 + self.data.ife.zl5) + - (1 / 3) * (self.data.ife.zl5 - self.data.ife.zl1) ) ) # First wall # FLIRAD is the radius of the Flibe inlet - ife_variables.fwvol[0] = ( + self.data.ife.fwvol[0] = ( np.pi - * (ife_variables.r2 * ife_variables.r2 - ife_variables.r1 * ife_variables.r1) - * (ife_variables.zu2 + ife_variables.zl5) + * (self.data.ife.r2 * self.data.ife.r2 - self.data.ife.r1 * self.data.ife.r1) + * (self.data.ife.zu2 + self.data.ife.zl5) ) - ife_variables.fwvol[1] = ( + self.data.ife.fwvol[1] = ( np.pi * ( - ife_variables.r1 * ife_variables.r1 - - ife_variables.flirad * ife_variables.flirad + self.data.ife.r1 * self.data.ife.r1 + - self.data.ife.flirad * self.data.ife.flirad ) - * (ife_variables.zu2 - ife_variables.zu1) + * (self.data.ife.zu2 - self.data.ife.zu1) ) - ife_variables.fwvol[2] = ( + self.data.ife.fwvol[2] = ( (1 / 3) * np.pi * ( - ife_variables.r2 - * ife_variables.r2 - * (ife_variables.zl5 - ife_variables.zl1) - - ife_variables.r1 - * ife_variables.r1 - * (ife_variables.zl5 - ife_variables.zl2) + self.data.ife.r2 + * self.data.ife.r2 + * (self.data.ife.zl5 - self.data.ife.zl1) + - self.data.ife.r1 + * self.data.ife.r1 + * (self.data.ife.zl5 - self.data.ife.zl2) ) ) # First void - ife_variables.v1vol[0] = ( + self.data.ife.v1vol[0] = ( np.pi - * (ife_variables.r3 * ife_variables.r3 - ife_variables.r2 * ife_variables.r2) - * (ife_variables.zu2 + ife_variables.zl3) + * (self.data.ife.r3 * self.data.ife.r3 - self.data.ife.r2 * self.data.ife.r2) + * (self.data.ife.zu2 + self.data.ife.zl3) ) - ife_variables.v1vol[1] = ( + self.data.ife.v1vol[1] = ( np.pi * ( - ife_variables.r4 * ife_variables.r4 - - ife_variables.flirad * ife_variables.flirad + self.data.ife.r4 * self.data.ife.r4 + - self.data.ife.flirad * self.data.ife.flirad ) - * (ife_variables.zu3 - ife_variables.zu2) + * (self.data.ife.zu3 - self.data.ife.zu2) ) - ife_variables.v1vol[2] = ( + self.data.ife.v1vol[2] = ( (1 / 3) * np.pi - * ife_variables.r1 - * ife_variables.r1 - * (ife_variables.zl3 - ife_variables.zl2) + * self.data.ife.r1 + * self.data.ife.r1 + * (self.data.ife.zl3 - self.data.ife.zl2) ) # Blanket - ife_variables.blvol[0] = ( + self.data.ife.blvol[0] = ( np.pi - * (ife_variables.r4 * ife_variables.r4 - ife_variables.r3 * ife_variables.r3) - * (ife_variables.zu2 + ife_variables.zl3) + * (self.data.ife.r4 * self.data.ife.r4 - self.data.ife.r3 * self.data.ife.r3) + * (self.data.ife.zu2 + self.data.ife.zl3) ) - ife_variables.blvol[1] = ( + self.data.ife.blvol[1] = ( np.pi * ( - ife_variables.r4 * ife_variables.r4 - - ife_variables.flirad * ife_variables.flirad + self.data.ife.r4 * self.data.ife.r4 + - self.data.ife.flirad * self.data.ife.flirad ) - * (ife_variables.zu4 - ife_variables.zu3) + * (self.data.ife.zu4 - self.data.ife.zu3) ) - ife_variables.blvol[2] = ( + self.data.ife.blvol[2] = ( np.pi - * ife_variables.r4 - * ife_variables.r4 - * (ife_variables.zl4 - ife_variables.zl3) + * self.data.ife.r4 + * self.data.ife.r4 + * (self.data.ife.zl4 - self.data.ife.zl3) ) # Second void - ife_variables.v2vol[0] = ( + self.data.ife.v2vol[0] = ( np.pi - * (ife_variables.r5 * ife_variables.r5 - ife_variables.r4 * ife_variables.r4) - * (ife_variables.zu4 + ife_variables.zl4) + * (self.data.ife.r5 * self.data.ife.r5 - self.data.ife.r4 * self.data.ife.r4) + * (self.data.ife.zu4 + self.data.ife.zl4) ) - ife_variables.v2vol[1] = ( + self.data.ife.v2vol[1] = ( np.pi * ( - ife_variables.r5 * ife_variables.r5 - - ife_variables.flirad * ife_variables.flirad + self.data.ife.r5 * self.data.ife.r5 + - self.data.ife.flirad * self.data.ife.flirad ) - * (ife_variables.zu5 - ife_variables.zu4) + * (self.data.ife.zu5 - self.data.ife.zu4) ) - ife_variables.v2vol[2] = ( + self.data.ife.v2vol[2] = ( np.pi - * ife_variables.r5 - * ife_variables.r5 - * (ife_variables.zl5 - ife_variables.zl4) + * self.data.ife.r5 + * self.data.ife.r5 + * (self.data.ife.zl5 - self.data.ife.zl4) ) # Shield - ife_variables.shvol[0] = ( + self.data.ife.shvol[0] = ( np.pi - * (ife_variables.r6 * ife_variables.r6 - ife_variables.r5 * ife_variables.r5) - * (ife_variables.zu5 + ife_variables.zl5) + * (self.data.ife.r6 * self.data.ife.r6 - self.data.ife.r5 * self.data.ife.r5) + * (self.data.ife.zu5 + self.data.ife.zl5) ) - ife_variables.shvol[1] = ( + self.data.ife.shvol[1] = ( np.pi - * ife_variables.r6 - * ife_variables.r6 - * (ife_variables.zu6 - ife_variables.zu5) + * self.data.ife.r6 + * self.data.ife.r6 + * (self.data.ife.zu6 - self.data.ife.zu5) ) - ife_variables.shvol[2] = ( + self.data.ife.shvol[2] = ( np.pi - * ife_variables.r6 - * ife_variables.r6 - * (ife_variables.zl6 - ife_variables.zl5) + * self.data.ife.r6 + * self.data.ife.r6 + * (self.data.ife.zl6 - self.data.ife.zl5) ) # Third void - ife_variables.v3vol[0] = ( + self.data.ife.v3vol[0] = ( np.pi - * (ife_variables.r7 * ife_variables.r7 - ife_variables.r6 * ife_variables.r6) - * (ife_variables.zu6 + ife_variables.zl6) + * (self.data.ife.r7 * self.data.ife.r7 - self.data.ife.r6 * self.data.ife.r6) + * (self.data.ife.zu6 + self.data.ife.zl6) ) - ife_variables.v3vol[1] = ( + self.data.ife.v3vol[1] = ( np.pi - * ife_variables.r7 - * ife_variables.r7 - * (ife_variables.zu7 - ife_variables.zu6) + * self.data.ife.r7 + * self.data.ife.r7 + * (self.data.ife.zu7 - self.data.ife.zu6) ) - ife_variables.v3vol[2] = ( + self.data.ife.v3vol[2] = ( np.pi - * ife_variables.r7 - * ife_variables.r7 - * (ife_variables.zl7 - ife_variables.zl6) + * self.data.ife.r7 + * self.data.ife.r7 + * (self.data.ife.zl7 - self.data.ife.zl6) ) # Material volumes - for i in range(ife_variables.MAXMAT + 1): - ife_variables.chmatv[i] = max( - 0.0, ife_variables.chvol * ife_variables.chmatf[i] + for i in range(MAXMAT + 1): + self.data.ife.chmatv[i] = max( + 0.0, self.data.ife.chvol * self.data.ife.chmatf[i] ) for j in range(3): - ife_variables.fwmatv[j, i] = max( - 0.0, ife_variables.fwvol[j] * ife_variables.fwmatf[j, i] + self.data.ife.fwmatv[j, i] = max( + 0.0, self.data.ife.fwvol[j] * self.data.ife.fwmatf[j, i] ) - ife_variables.v1matv[j, i] = max( - 0.0, ife_variables.v1vol[j] * ife_variables.v1matf[j, i] + self.data.ife.v1matv[j, i] = max( + 0.0, self.data.ife.v1vol[j] * self.data.ife.v1matf[j, i] ) - ife_variables.blmatv[j, i] = max( - 0.0, ife_variables.blvol[j] * ife_variables.blmatf[j, i] + self.data.ife.blmatv[j, i] = max( + 0.0, self.data.ife.blvol[j] * self.data.ife.blmatf[j, i] ) - ife_variables.v2matv[j, i] = max( - 0.0, ife_variables.v2vol[j] * ife_variables.v2matf[j, i] + self.data.ife.v2matv[j, i] = max( + 0.0, self.data.ife.v2vol[j] * self.data.ife.v2matf[j, i] ) - ife_variables.shmatv[j, i] = max( - 0.0, ife_variables.shvol[j] * ife_variables.shmatf[j, i] + self.data.ife.shmatv[j, i] = max( + 0.0, self.data.ife.shvol[j] * self.data.ife.shmatf[j, i] ) - ife_variables.v3matv[j, i] = max( - 0.0, ife_variables.v3vol[j] * ife_variables.v3matf[j, i] + self.data.ife.v3matv[j, i] = max( + 0.0, self.data.ife.v3vol[j] * self.data.ife.v3matf[j, i] ) # First wall area self.data.first_wall.a_fw_total = ( - 2.0 * np.pi * ife_variables.r1 * (ife_variables.zu1 + ife_variables.zl5) + 2.0 * np.pi * self.data.ife.r1 * (self.data.ife.zu1 + self.data.ife.zl5) ) self.data.first_wall.a_fw_total += np.pi * ( - ife_variables.r1 * ife_variables.r1 - - ife_variables.flirad * ife_variables.flirad + self.data.ife.r1 * self.data.ife.r1 + - self.data.ife.flirad * self.data.ife.flirad ) self.data.first_wall.a_fw_total += ( np.pi - * ife_variables.r1 + * self.data.ife.r1 * np.sqrt( - ife_variables.r1 * ife_variables.r1 - + (ife_variables.zl3 - ife_variables.zl1) ** 2 + self.data.ife.r1 * self.data.ife.r1 + + (self.data.ife.zl3 - self.data.ife.zl1) ** 2 ) ) @@ -815,13 +813,13 @@ def bld2019(self): Issue #907 """ # Check input - if ife_variables.fwdr > 0 or ife_variables.v1dr > 0: + if self.data.ife.fwdr > 0 or self.data.ife.v1dr > 0: raise ProcessValueError("fwdr and v1dr should be zero for 2019 IFE build") - if ife_variables.fwdzu > 0 or ife_variables.v1dzu > 0 or ife_variables.v2dzu > 0: + if self.data.ife.fwdzu > 0 or self.data.ife.v1dzu > 0 or self.data.ife.v2dzu > 0: raise ProcessValueError( "fwdzu, v1dzu and v2dzu should be zero for 2019 IFE build" ) - if ife_variables.fwdzl > 0 or ife_variables.v1dzl > 0 or ife_variables.v2dzu > 0: + if self.data.ife.fwdzl > 0 or self.data.ife.v1dzl > 0 or self.data.ife.v2dzu > 0: raise ProcessValueError( "fwdzl, v1dzl and v2dzl should be zero for 2019 IFE build" ) @@ -831,105 +829,105 @@ def bld2019(self): vel = np.sqrt( 2.0 * constants.ACCELERATION_GRAVITY - * (ife_variables.chdzu + ife_variables.bldzu) + * (self.data.ife.chdzu + self.data.ife.bldzu) ) # Lithium Fraction - ife_variables.blmatf[0, 8] = 0.91 * np.sqrt( - ife_variables.bldzu / (ife_variables.chdzu + ife_variables.bldzu) + self.data.ife.blmatf[0, 8] = 0.91 * np.sqrt( + self.data.ife.bldzu / (self.data.ife.chdzu + self.data.ife.bldzu) ) - ife_variables.blmatf[0, 0] = 1.0 - ife_variables.blmatf[0, 8] + self.data.ife.blmatf[0, 0] = 1.0 - self.data.ife.blmatf[0, 8] # Spatial Thickness - ife_variables.bldr = ife_variables.bldrc / ife_variables.blmatf[0, 8] + self.data.ife.bldr = self.data.ife.bldrc / self.data.ife.blmatf[0, 8] # Area acurt = np.pi * ( - (ife_variables.chrad + ife_variables.bldr) ** 2.0 - ife_variables.chrad**2.0 + (self.data.ife.chrad + self.data.ife.bldr) ** 2.0 - self.data.ife.chrad**2.0 ) # Mass Flow - mdot = 512.0 * vel * ife_variables.blmatf[0, 8] * acurt + mdot = 512.0 * vel * self.data.ife.blmatf[0, 8] * acurt # Pump Power (MW) - ife_variables.lipmw = ( + self.data.ife.lipmw = ( 1e-6 * mdot * constants.ACCELERATION_GRAVITY * ( - ife_variables.chdzl - + ife_variables.chdzu - + ife_variables.bldzu - + ife_variables.bldzl + self.data.ife.chdzl + + self.data.ife.chdzu + + self.data.ife.bldzu + + self.data.ife.bldzl ) - / ife_variables.etali + / self.data.ife.etali ) # Fall Time - ife_variables.taufall = ( - 2.0 * (ife_variables.chdzl + ife_variables.chdzu + ife_variables.bldzu) / vel + self.data.ife.taufall = ( + 2.0 * (self.data.ife.chdzl + self.data.ife.chdzu + self.data.ife.bldzu) / vel ) - ife_variables.rrmax = 1.0 / ife_variables.taufall + self.data.ife.rrmax = 1.0 / self.data.ife.taufall # TBR and Emult model was for spherical lithium # Remove reactor head - phi = np.arctan(ife_variables.chrad / ife_variables.chdzu) + phi = np.arctan(self.data.ife.chrad / self.data.ife.chdzu) sang = 1.0 - np.cos(phi) li_frac = 1.0 - 0.5 * sang # TBR self.data.fwbs.tbr = ( 3.7418 - * (1.0 / (1.0 + np.exp(-2.6366 * ife_variables.bldrc)) - 0.5) + * (1.0 / (1.0 + np.exp(-2.6366 * self.data.ife.bldrc)) - 0.5) * li_frac ) # Energy Multiplication self.data.fwbs.f_p_blkt_multiplication = ( 2.2414 - * (1.0 / (1.0 + np.exp(-3.0038 * ife_variables.bldrc)) - 0.5) + * (1.0 / (1.0 + np.exp(-3.0038 * self.data.ife.bldrc)) - 0.5) * li_frac ) # Radial build - ife_variables.r1 = ife_variables.chrad - ife_variables.r2 = ife_variables.r1 + ife_variables.fwdr - ife_variables.r3 = ife_variables.r2 + ife_variables.v1dr - ife_variables.r4 = ife_variables.r3 + ife_variables.bldr - ife_variables.r5 = ife_variables.r4 + ife_variables.v2dr - ife_variables.r6 = ife_variables.r5 + ife_variables.shdr - ife_variables.r7 = ife_variables.r6 + ife_variables.v3dr + self.data.ife.r1 = self.data.ife.chrad + self.data.ife.r2 = self.data.ife.r1 + self.data.ife.fwdr + self.data.ife.r3 = self.data.ife.r2 + self.data.ife.v1dr + self.data.ife.r4 = self.data.ife.r3 + self.data.ife.bldr + self.data.ife.r5 = self.data.ife.r4 + self.data.ife.v2dr + self.data.ife.r6 = self.data.ife.r5 + self.data.ife.shdr + self.data.ife.r7 = self.data.ife.r6 + self.data.ife.v3dr # Vertical build (below midplane) - ife_variables.zl1 = ife_variables.chdzl - ife_variables.zl2 = ife_variables.zl1 + ife_variables.fwdzl - ife_variables.zl3 = ife_variables.zl2 + ife_variables.v1dzl - ife_variables.zl4 = ife_variables.zl3 + ife_variables.bldzl - ife_variables.zl5 = ife_variables.zl4 + ife_variables.v2dzl - ife_variables.zl6 = ife_variables.zl5 + ife_variables.shdzl - ife_variables.zl7 = ife_variables.zl6 + ife_variables.v3dzl + self.data.ife.zl1 = self.data.ife.chdzl + self.data.ife.zl2 = self.data.ife.zl1 + self.data.ife.fwdzl + self.data.ife.zl3 = self.data.ife.zl2 + self.data.ife.v1dzl + self.data.ife.zl4 = self.data.ife.zl3 + self.data.ife.bldzl + self.data.ife.zl5 = self.data.ife.zl4 + self.data.ife.v2dzl + self.data.ife.zl6 = self.data.ife.zl5 + self.data.ife.shdzl + self.data.ife.zl7 = self.data.ife.zl6 + self.data.ife.v3dzl # Vertical build (above midplane) - ife_variables.zu1 = ife_variables.chdzu - ife_variables.zu2 = ife_variables.zu1 + ife_variables.fwdzu - ife_variables.zu3 = ife_variables.zu2 + ife_variables.v1dzu - ife_variables.zu4 = ife_variables.zu3 + ife_variables.bldzu - ife_variables.zu5 = ife_variables.zu4 + ife_variables.v2dzu - ife_variables.zu6 = ife_variables.zu5 + ife_variables.shdzu + self.data.ife.zu1 = self.data.ife.chdzu + self.data.ife.zu2 = self.data.ife.zu1 + self.data.ife.fwdzu + self.data.ife.zu3 = self.data.ife.zu2 + self.data.ife.v1dzu + self.data.ife.zu4 = self.data.ife.zu3 + self.data.ife.bldzu + self.data.ife.zu5 = self.data.ife.zu4 + self.data.ife.v2dzu + self.data.ife.zu6 = self.data.ife.zu5 + self.data.ife.shdzu - ife_variables.v3dzu = ( - (ife_variables.zu6 + ife_variables.zl6) + self.data.ife.v3dzu = ( + (self.data.ife.zu6 + self.data.ife.zl6) + self.data.buildings.trcl + self.data.buildings.stcl + 5.1 + 9.41e-6 * 1.0e5 ) - ife_variables.zu7 = ife_variables.zu6 + ife_variables.v3dzu + self.data.ife.zu7 = self.data.ife.zu6 + self.data.ife.v3dzu # Component volumes # The following notation applies below: @@ -941,173 +939,173 @@ def bld2019(self): chvol = ( np.pi - * ife_variables.r1 - * ife_variables.r1 - * (ife_variables.zu1 + ife_variables.zl1) + * self.data.ife.r1 + * self.data.ife.r1 + * (self.data.ife.zu1 + self.data.ife.zl1) ) # First wall - ife_variables.fwvol[0] = ( + self.data.ife.fwvol[0] = ( np.pi - * (ife_variables.r2 * ife_variables.r2 - ife_variables.r1 * ife_variables.r1) - * (ife_variables.zu1 + ife_variables.zl1) + * (self.data.ife.r2 * self.data.ife.r2 - self.data.ife.r1 * self.data.ife.r1) + * (self.data.ife.zu1 + self.data.ife.zl1) ) - ife_variables.fwvol[1] = ( + self.data.ife.fwvol[1] = ( np.pi - * ife_variables.r2 - * ife_variables.r2 - * (ife_variables.zu2 - ife_variables.zu1) + * self.data.ife.r2 + * self.data.ife.r2 + * (self.data.ife.zu2 - self.data.ife.zu1) ) - ife_variables.fwvol[2] = ( + self.data.ife.fwvol[2] = ( np.pi - * ife_variables.r2 - * ife_variables.r2 - * (ife_variables.zl2 - ife_variables.zl1) + * self.data.ife.r2 + * self.data.ife.r2 + * (self.data.ife.zl2 - self.data.ife.zl1) ) # First void - ife_variables.v1vol[0] = ( + self.data.ife.v1vol[0] = ( np.pi - * (ife_variables.r3 * ife_variables.r3 - ife_variables.r2 * ife_variables.r2) - * (ife_variables.zu2 + ife_variables.zl2) + * (self.data.ife.r3 * self.data.ife.r3 - self.data.ife.r2 * self.data.ife.r2) + * (self.data.ife.zu2 + self.data.ife.zl2) ) - ife_variables.v1vol[1] = ( + self.data.ife.v1vol[1] = ( np.pi - * ife_variables.r3 - * ife_variables.r3 - * (ife_variables.zu3 - ife_variables.zu2) + * self.data.ife.r3 + * self.data.ife.r3 + * (self.data.ife.zu3 - self.data.ife.zu2) ) - ife_variables.v1vol[2] = ( + self.data.ife.v1vol[2] = ( np.pi - * ife_variables.r3 - * ife_variables.r3 - * (ife_variables.zl3 - ife_variables.zl2) + * self.data.ife.r3 + * self.data.ife.r3 + * (self.data.ife.zl3 - self.data.ife.zl2) ) # Blanket # Radial Blanket - between void 2 and chamber - ife_variables.blvol[0] = ( + self.data.ife.blvol[0] = ( np.pi - * (ife_variables.r4 * ife_variables.r4 - ife_variables.r3 * ife_variables.r3) - * (ife_variables.zu3 + ife_variables.zl3) + * (self.data.ife.r4 * self.data.ife.r4 - self.data.ife.r3 * self.data.ife.r3) + * (self.data.ife.zu3 + self.data.ife.zl3) ) # Upper Blanket - Pool radially between shield and # chamber of input height. - ife_variables.blvol[1] = ( + self.data.ife.blvol[1] = ( np.pi - * (ife_variables.r5 * ife_variables.r5 - ife_variables.r3 * ife_variables.r3) - * ife_variables.bldzu + * (self.data.ife.r5 * self.data.ife.r5 - self.data.ife.r3 * self.data.ife.r3) + * self.data.ife.bldzu ) # Lower Blanket - Pool filling base of device - ife_variables.blvol[2] = ( + self.data.ife.blvol[2] = ( np.pi - * ife_variables.r5 - * ife_variables.r5 - * (ife_variables.zl4 - ife_variables.zl3) + * self.data.ife.r5 + * self.data.ife.r5 + * (self.data.ife.zl4 - self.data.ife.zl3) ) # Second void - ife_variables.v2vol[0] = ( + self.data.ife.v2vol[0] = ( np.pi - * (ife_variables.r5 * ife_variables.r5 - ife_variables.r4 * ife_variables.r4) - * (ife_variables.chdzl + ife_variables.chdzu) + * (self.data.ife.r5 * self.data.ife.r5 - self.data.ife.r4 * self.data.ife.r4) + * (self.data.ife.chdzl + self.data.ife.chdzu) ) - ife_variables.v2vol[1] = 0.0 - ife_variables.v2vol[2] = 0.0 + self.data.ife.v2vol[1] = 0.0 + self.data.ife.v2vol[2] = 0.0 # Shield - ife_variables.shvol[0] = ( + self.data.ife.shvol[0] = ( np.pi - * (ife_variables.r6 * ife_variables.r6 - ife_variables.r5 * ife_variables.r5) - * (ife_variables.zu5 + ife_variables.zl5) + * (self.data.ife.r6 * self.data.ife.r6 - self.data.ife.r5 * self.data.ife.r5) + * (self.data.ife.zu5 + self.data.ife.zl5) ) # Top Section is in three parts to account for the dip at # the centre. The first is the horizontal top, the second is the # horizontal - ife_variables.shvol[1] = np.pi * ( + self.data.ife.shvol[1] = np.pi * ( ( ( - ife_variables.r6 * ife_variables.r6 - - (ife_variables.chrad - ife_variables.shdr) - * (ife_variables.chrad - ife_variables.shdr) + self.data.ife.r6 * self.data.ife.r6 + - (self.data.ife.chrad - self.data.ife.shdr) + * (self.data.ife.chrad - self.data.ife.shdr) ) - * ife_variables.shdzu + * self.data.ife.shdzu ) + ( ( - ife_variables.r1 * ife_variables.r1 - - ife_variables.flirad * ife_variables.flirad + self.data.ife.r1 * self.data.ife.r1 + - self.data.ife.flirad * self.data.ife.flirad ) - * ife_variables.shdzu + * self.data.ife.shdzu ) + ( ( - ife_variables.r1 * ife_variables.r1 - - (ife_variables.r1 - ife_variables.shdzu) - * (ife_variables.r1 - ife_variables.shdzu) + self.data.ife.r1 * self.data.ife.r1 + - (self.data.ife.r1 - self.data.ife.shdzu) + * (self.data.ife.r1 - self.data.ife.shdzu) ) - * (ife_variables.bldzu - ife_variables.shdzu) + * (self.data.ife.bldzu - self.data.ife.shdzu) ) ) - ife_variables.shvol[2] = ( + self.data.ife.shvol[2] = ( np.pi - * ife_variables.r6 - * ife_variables.r6 - * (ife_variables.zl6 - ife_variables.zl5) + * self.data.ife.r6 + * self.data.ife.r6 + * (self.data.ife.zl6 - self.data.ife.zl5) ) # Third void - ife_variables.v3vol[0] = ( + self.data.ife.v3vol[0] = ( np.pi - * (ife_variables.r7 * ife_variables.r7 - ife_variables.r6 * ife_variables.r6) - * (ife_variables.zu6 + ife_variables.zl6) + * (self.data.ife.r7 * self.data.ife.r7 - self.data.ife.r6 * self.data.ife.r6) + * (self.data.ife.zu6 + self.data.ife.zl6) ) - ife_variables.v3vol[1] = ( + self.data.ife.v3vol[1] = ( np.pi - * ife_variables.r7 - * ife_variables.r7 - * (ife_variables.zu7 - ife_variables.zu6) + * self.data.ife.r7 + * self.data.ife.r7 + * (self.data.ife.zu7 - self.data.ife.zu6) + np.pi * ( - (ife_variables.r1 - ife_variables.shdzu) - * (ife_variables.r1 - ife_variables.shdzu) - - ife_variables.flirad * ife_variables.flirad + (self.data.ife.r1 - self.data.ife.shdzu) + * (self.data.ife.r1 - self.data.ife.shdzu) + - self.data.ife.flirad * self.data.ife.flirad ) - * ife_variables.bldzu + * self.data.ife.bldzu ) - ife_variables.v3vol[2] = ( + self.data.ife.v3vol[2] = ( np.pi - * ife_variables.r7 - * ife_variables.r7 - * (ife_variables.zl7 - ife_variables.zl6) + * self.data.ife.r7 + * self.data.ife.r7 + * (self.data.ife.zl7 - self.data.ife.zl6) ) # Material volumes - for i in range(ife_variables.MAXMAT + 1): - ife_variables.chmatv[i] = max(0.0, chvol * ife_variables.chmatf[i]) + for i in range(MAXMAT + 1): + self.data.ife.chmatv[i] = max(0.0, chvol * self.data.ife.chmatf[i]) for j in range(3): - ife_variables.fwmatv[j, i] = max( - 0.0, ife_variables.fwvol[j] * ife_variables.fwmatf[j, i] + self.data.ife.fwmatv[j, i] = max( + 0.0, self.data.ife.fwvol[j] * self.data.ife.fwmatf[j, i] ) - ife_variables.v1matv[j, i] = max( - 0.0, ife_variables.v1vol[j] * ife_variables.v1matf[j, i] + self.data.ife.v1matv[j, i] = max( + 0.0, self.data.ife.v1vol[j] * self.data.ife.v1matf[j, i] ) - ife_variables.blmatv[j, i] = max( - 0.0, ife_variables.blvol[j] * ife_variables.blmatf[j, i] + self.data.ife.blmatv[j, i] = max( + 0.0, self.data.ife.blvol[j] * self.data.ife.blmatf[j, i] ) - ife_variables.v2matv[j, i] = max( - 0.0, ife_variables.v2vol[j] * ife_variables.v2matf[j, i] + self.data.ife.v2matv[j, i] = max( + 0.0, self.data.ife.v2vol[j] * self.data.ife.v2matf[j, i] ) - ife_variables.shmatv[j, i] = max( - 0.0, ife_variables.shvol[j] * ife_variables.shmatf[j, i] + self.data.ife.shmatv[j, i] = max( + 0.0, self.data.ife.shvol[j] * self.data.ife.shmatf[j, i] ) - ife_variables.v3matv[j, i] = max( - 0.0, ife_variables.v3vol[j] * ife_variables.v3matf[j, i] + self.data.ife.v3matv[j, i] = max( + 0.0, self.data.ife.v3vol[j] * self.data.ife.v3matf[j, i] ) # First wall area @@ -1116,8 +1114,8 @@ def bld2019(self): # of the shield. There is a target injector tube at the # centre of this area. self.data.first_wall.a_fw_total = np.pi * ( - ife_variables.r1 * ife_variables.r1 - - ife_variables.flirad * ife_variables.flirad + self.data.ife.r1 * self.data.ife.r1 + - self.data.ife.flirad * self.data.ife.flirad ) def genbld(self): @@ -1130,33 +1128,33 @@ def genbld(self): """ # Radial build - ife_variables.r1 = ife_variables.chrad - ife_variables.r2 = ife_variables.r1 + ife_variables.fwdr - ife_variables.r3 = ife_variables.r2 + ife_variables.v1dr - ife_variables.r4 = ife_variables.r3 + ife_variables.bldr - ife_variables.r5 = ife_variables.r4 + ife_variables.v2dr - ife_variables.r6 = ife_variables.r5 + ife_variables.shdr - ife_variables.r7 = ife_variables.r6 + ife_variables.v3dr + self.data.ife.r1 = self.data.ife.chrad + self.data.ife.r2 = self.data.ife.r1 + self.data.ife.fwdr + self.data.ife.r3 = self.data.ife.r2 + self.data.ife.v1dr + self.data.ife.r4 = self.data.ife.r3 + self.data.ife.bldr + self.data.ife.r5 = self.data.ife.r4 + self.data.ife.v2dr + self.data.ife.r6 = self.data.ife.r5 + self.data.ife.shdr + self.data.ife.r7 = self.data.ife.r6 + self.data.ife.v3dr # Vertical build (below midplane) - ife_variables.zl1 = ife_variables.chdzl - ife_variables.zl2 = ife_variables.zl1 + ife_variables.fwdzl - ife_variables.zl3 = ife_variables.zl2 + ife_variables.v1dzl - ife_variables.zl4 = ife_variables.zl3 + ife_variables.bldzl - ife_variables.zl5 = ife_variables.zl4 + ife_variables.v2dzl - ife_variables.zl6 = ife_variables.zl5 + ife_variables.shdzl - ife_variables.zl7 = ife_variables.zl6 + ife_variables.v3dzl + self.data.ife.zl1 = self.data.ife.chdzl + self.data.ife.zl2 = self.data.ife.zl1 + self.data.ife.fwdzl + self.data.ife.zl3 = self.data.ife.zl2 + self.data.ife.v1dzl + self.data.ife.zl4 = self.data.ife.zl3 + self.data.ife.bldzl + self.data.ife.zl5 = self.data.ife.zl4 + self.data.ife.v2dzl + self.data.ife.zl6 = self.data.ife.zl5 + self.data.ife.shdzl + self.data.ife.zl7 = self.data.ife.zl6 + self.data.ife.v3dzl # Vertical build (above midplane) - ife_variables.zu1 = ife_variables.chdzu - ife_variables.zu2 = ife_variables.zu1 + ife_variables.fwdzu - ife_variables.zu3 = ife_variables.zu2 + ife_variables.v1dzu - ife_variables.zu4 = ife_variables.zu3 + ife_variables.bldzu - ife_variables.zu5 = ife_variables.zu4 + ife_variables.v2dzu - ife_variables.zu6 = ife_variables.zu5 + ife_variables.shdzu - ife_variables.zu7 = ife_variables.zu6 + ife_variables.v3dzu + self.data.ife.zu1 = self.data.ife.chdzu + self.data.ife.zu2 = self.data.ife.zu1 + self.data.ife.fwdzu + self.data.ife.zu3 = self.data.ife.zu2 + self.data.ife.v1dzu + self.data.ife.zu4 = self.data.ife.zu3 + self.data.ife.bldzu + self.data.ife.zu5 = self.data.ife.zu4 + self.data.ife.v2dzu + self.data.ife.zu6 = self.data.ife.zu5 + self.data.ife.shdzu + self.data.ife.zu7 = self.data.ife.zu6 + self.data.ife.v3dzu # Component volumes # The following notation applies below: @@ -1168,153 +1166,153 @@ def genbld(self): chvol = ( np.pi - * ife_variables.r1 - * ife_variables.r1 - * (ife_variables.zu1 + ife_variables.zl1) + * self.data.ife.r1 + * self.data.ife.r1 + * (self.data.ife.zu1 + self.data.ife.zl1) ) # First wall - ife_variables.fwvol[0] = ( + self.data.ife.fwvol[0] = ( np.pi - * (ife_variables.r2 * ife_variables.r2 - ife_variables.r1 * ife_variables.r1) - * (ife_variables.zu1 + ife_variables.zl1) + * (self.data.ife.r2 * self.data.ife.r2 - self.data.ife.r1 * self.data.ife.r1) + * (self.data.ife.zu1 + self.data.ife.zl1) ) - ife_variables.fwvol[1] = ( + self.data.ife.fwvol[1] = ( np.pi - * ife_variables.r2 - * ife_variables.r2 - * (ife_variables.zu2 - ife_variables.zu1) + * self.data.ife.r2 + * self.data.ife.r2 + * (self.data.ife.zu2 - self.data.ife.zu1) ) - ife_variables.fwvol[2] = ( + self.data.ife.fwvol[2] = ( np.pi - * ife_variables.r2 - * ife_variables.r2 - * (ife_variables.zl2 - ife_variables.zl1) + * self.data.ife.r2 + * self.data.ife.r2 + * (self.data.ife.zl2 - self.data.ife.zl1) ) # First void - ife_variables.v1vol[0] = ( + self.data.ife.v1vol[0] = ( np.pi - * (ife_variables.r3 * ife_variables.r3 - ife_variables.r2 * ife_variables.r2) - * (ife_variables.zu2 + ife_variables.zl2) + * (self.data.ife.r3 * self.data.ife.r3 - self.data.ife.r2 * self.data.ife.r2) + * (self.data.ife.zu2 + self.data.ife.zl2) ) - ife_variables.v1vol[1] = ( + self.data.ife.v1vol[1] = ( np.pi - * ife_variables.r3 - * ife_variables.r3 - * (ife_variables.zu3 - ife_variables.zu2) + * self.data.ife.r3 + * self.data.ife.r3 + * (self.data.ife.zu3 - self.data.ife.zu2) ) - ife_variables.v1vol[2] = ( + self.data.ife.v1vol[2] = ( np.pi - * ife_variables.r3 - * ife_variables.r3 - * (ife_variables.zl3 - ife_variables.zl2) + * self.data.ife.r3 + * self.data.ife.r3 + * (self.data.ife.zl3 - self.data.ife.zl2) ) # Blanket - ife_variables.blvol[0] = ( + self.data.ife.blvol[0] = ( np.pi - * (ife_variables.r4 * ife_variables.r4 - ife_variables.r3 * ife_variables.r3) - * (ife_variables.zu3 + ife_variables.zl3) + * (self.data.ife.r4 * self.data.ife.r4 - self.data.ife.r3 * self.data.ife.r3) + * (self.data.ife.zu3 + self.data.ife.zl3) ) - ife_variables.blvol[1] = ( + self.data.ife.blvol[1] = ( np.pi - * ife_variables.r4 - * ife_variables.r4 - * (ife_variables.zu4 - ife_variables.zu3) + * self.data.ife.r4 + * self.data.ife.r4 + * (self.data.ife.zu4 - self.data.ife.zu3) ) - ife_variables.blvol[2] = ( + self.data.ife.blvol[2] = ( np.pi - * ife_variables.r4 - * ife_variables.r4 - * (ife_variables.zl4 - ife_variables.zl3) + * self.data.ife.r4 + * self.data.ife.r4 + * (self.data.ife.zl4 - self.data.ife.zl3) ) # Second void - ife_variables.v2vol[0] = ( + self.data.ife.v2vol[0] = ( np.pi - * (ife_variables.r5 * ife_variables.r5 - ife_variables.r4 * ife_variables.r4) - * (ife_variables.zu4 + ife_variables.zl4) + * (self.data.ife.r5 * self.data.ife.r5 - self.data.ife.r4 * self.data.ife.r4) + * (self.data.ife.zu4 + self.data.ife.zl4) ) - ife_variables.v2vol[1] = ( + self.data.ife.v2vol[1] = ( np.pi - * ife_variables.r5 - * ife_variables.r5 - * (ife_variables.zu5 - ife_variables.zu4) + * self.data.ife.r5 + * self.data.ife.r5 + * (self.data.ife.zu5 - self.data.ife.zu4) ) - ife_variables.v2vol[2] = ( + self.data.ife.v2vol[2] = ( np.pi - * ife_variables.r5 - * ife_variables.r5 - * (ife_variables.zl5 - ife_variables.zl4) + * self.data.ife.r5 + * self.data.ife.r5 + * (self.data.ife.zl5 - self.data.ife.zl4) ) # Shield - ife_variables.shvol[0] = ( + self.data.ife.shvol[0] = ( np.pi - * (ife_variables.r6 * ife_variables.r6 - ife_variables.r5 * ife_variables.r5) - * (ife_variables.zu5 + ife_variables.zl5) + * (self.data.ife.r6 * self.data.ife.r6 - self.data.ife.r5 * self.data.ife.r5) + * (self.data.ife.zu5 + self.data.ife.zl5) ) - ife_variables.shvol[1] = ( + self.data.ife.shvol[1] = ( np.pi - * ife_variables.r6 - * ife_variables.r6 - * (ife_variables.zu6 - ife_variables.zu5) + * self.data.ife.r6 + * self.data.ife.r6 + * (self.data.ife.zu6 - self.data.ife.zu5) ) - ife_variables.shvol[2] = ( + self.data.ife.shvol[2] = ( np.pi - * ife_variables.r6 - * ife_variables.r6 - * (ife_variables.zl6 - ife_variables.zl5) + * self.data.ife.r6 + * self.data.ife.r6 + * (self.data.ife.zl6 - self.data.ife.zl5) ) # Third void - ife_variables.v3vol[0] = ( + self.data.ife.v3vol[0] = ( np.pi - * (ife_variables.r7 * ife_variables.r7 - ife_variables.r6 * ife_variables.r6) - * (ife_variables.zu6 + ife_variables.zl6) + * (self.data.ife.r7 * self.data.ife.r7 - self.data.ife.r6 * self.data.ife.r6) + * (self.data.ife.zu6 + self.data.ife.zl6) ) - ife_variables.v3vol[1] = ( + self.data.ife.v3vol[1] = ( np.pi - * ife_variables.r7 - * ife_variables.r7 - * (ife_variables.zu7 - ife_variables.zu6) + * self.data.ife.r7 + * self.data.ife.r7 + * (self.data.ife.zu7 - self.data.ife.zu6) ) - ife_variables.v3vol[2] = ( + self.data.ife.v3vol[2] = ( np.pi - * ife_variables.r7 - * ife_variables.r7 - * (ife_variables.zl7 - ife_variables.zl6) + * self.data.ife.r7 + * self.data.ife.r7 + * (self.data.ife.zl7 - self.data.ife.zl6) ) # Material volumes - for i in range(ife_variables.MAXMAT + 1): - ife_variables.chmatv[i] = max(0.0, chvol * ife_variables.chmatf[i]) + for i in range(MAXMAT + 1): + self.data.ife.chmatv[i] = max(0.0, chvol * self.data.ife.chmatf[i]) for j in range(3): - ife_variables.fwmatv[j, i] = max( - 0.0, ife_variables.fwvol[j] * ife_variables.fwmatf[j, i] + self.data.ife.fwmatv[j, i] = max( + 0.0, self.data.ife.fwvol[j] * self.data.ife.fwmatf[j, i] ) - ife_variables.v1matv[j, i] = max( - 0.0, ife_variables.v1vol[j] * ife_variables.v1matf[j, i] + self.data.ife.v1matv[j, i] = max( + 0.0, self.data.ife.v1vol[j] * self.data.ife.v1matf[j, i] ) - ife_variables.blmatv[j, i] = max( - 0.0, ife_variables.blvol[j] * ife_variables.blmatf[j, i] + self.data.ife.blmatv[j, i] = max( + 0.0, self.data.ife.blvol[j] * self.data.ife.blmatf[j, i] ) - ife_variables.v2matv[j, i] = max( - 0.0, ife_variables.v2vol[j] * ife_variables.v2matf[j, i] + self.data.ife.v2matv[j, i] = max( + 0.0, self.data.ife.v2vol[j] * self.data.ife.v2matf[j, i] ) - ife_variables.shmatv[j, i] = max( - 0.0, ife_variables.shvol[j] * ife_variables.shmatf[j, i] + self.data.ife.shmatv[j, i] = max( + 0.0, self.data.ife.shvol[j] * self.data.ife.shmatf[j, i] ) - ife_variables.v3matv[j, i] = max( - 0.0, ife_variables.v3vol[j] * ife_variables.v3matf[j, i] + self.data.ife.v3matv[j, i] = max( + 0.0, self.data.ife.v3vol[j] * self.data.ife.v3matf[j, i] ) # First wall area @@ -1322,8 +1320,8 @@ def genbld(self): self.data.first_wall.a_fw_total = ( 2.0 * np.pi - * ife_variables.r1 - * ((ife_variables.zu1 + ife_variables.zl1) + ife_variables.r1) + * self.data.ife.r1 + * ((self.data.ife.zu1 + self.data.ife.zl1) + self.data.ife.r1) ) def ifephy(self, output: bool = False): @@ -1340,54 +1338,54 @@ def ifephy(self, output: bool = False): output: bool (Default value = False) """ - match ife_variables.ifedrv: + match self.data.ife.ifedrv: case -1: # Target gain and driver efficiency dependencies on # driver energy are input - ife_variables.gain, ife_variables.etadrv = self.driver( - ife_variables.edrive, ife_variables.gainve, ife_variables.etave + self.data.ife.gain, self.data.ife.etadrv = self.driver( + self.data.ife.edrive, self.data.ife.gainve, self.data.ife.etave ) case 0: # Target gain and driver efficiency are input - ife_variables.gain = ife_variables.tgain - ife_variables.etadrv = ife_variables.drveff + self.data.ife.gain = self.data.ife.tgain + self.data.ife.etadrv = self.data.ife.drveff case 1: # Laser driver based on SOMBRERO design - ife_variables.gain, ife_variables.etadrv = self.lasdrv( - ife_variables.edrive + self.data.ife.gain, self.data.ife.etadrv = self.lasdrv( + self.data.ife.edrive ) case 2: # Heavy-ion beam driver based on OSIRIS design - ife_variables.gain, ife_variables.etadrv = self.iondrv( - ife_variables.edrive + self.data.ife.gain, self.data.ife.etadrv = self.iondrv( + self.data.ife.edrive ) case 3: - ife_variables.etadrv = ife_variables.drveff + self.data.ife.etadrv = self.data.ife.drveff case _: raise ProcessValueError( - f"ifedrv={ife_variables.ifedrv} is an invalid option" + f"ifedrv={self.data.ife.ifedrv} is an invalid option" ) - if ife_variables.ifedrv != 3: + if self.data.ife.ifedrv != 3: # Repetition rate (Hz) - ife_variables.reprat = ife_variables.pdrive / ife_variables.edrive + self.data.ife.reprat = self.data.ife.pdrive / self.data.ife.edrive # Fusion power (MW) physics_variables.p_fusion_total_mw = ( - 1.0e-6 * ife_variables.pdrive * ife_variables.gain + 1.0e-6 * self.data.ife.pdrive * self.data.ife.gain ) else: # Driver Power - ife_variables.reprat = ife_variables.rrin - ife_variables.pdrive = ife_variables.reprat * ife_variables.edrive + self.data.ife.reprat = self.data.ife.rrin + self.data.ife.pdrive = self.data.ife.reprat * self.data.ife.edrive # Gain - physics_variables.p_fusion_total_mw = ife_variables.pfusife - ife_variables.gain = physics_variables.p_fusion_total_mw / ( - 1.0e-6 * ife_variables.pdrive + physics_variables.p_fusion_total_mw = self.data.ife.pfusife + self.data.ife.gain = physics_variables.p_fusion_total_mw / ( + 1.0e-6 * self.data.ife.pdrive ) # Wall load (assume total fusion power applies) - if ife_variables.ifetyp == 1: + if self.data.ife.ifetyp == 1: # OSIRIS-type build: First wall subtends a solid angle of 2 pi * SANG - phi = 0.5 * np.pi + np.arctan(ife_variables.zl1 / ife_variables.r1) + phi = 0.5 * np.pi + np.arctan(self.data.ife.zl1 / self.data.ife.r1) sang = 1.0 - np.cos(phi) physics_variables.pflux_fw_neutron_mw = ( physics_variables.p_fusion_total_mw @@ -1396,13 +1394,13 @@ def ifephy(self, output: bool = False): / self.data.first_wall.a_fw_total ) - elif ife_variables.ifetyp == 4: + elif self.data.ife.ifetyp == 4: # 2019 build only has first wall at the top which has a tube at # its centre. This calculates solid angle and removes tube. - phi = np.arctan(ife_variables.r1 / ife_variables.zu1) + phi = np.arctan(self.data.ife.r1 / self.data.ife.zu1) sang = 1.0 - np.cos(phi) - phi = np.arctan(ife_variables.flirad / ife_variables.zu1) + phi = np.arctan(self.data.ife.flirad / self.data.ife.zu1) sang -= 1.0 - np.cos(phi) physics_variables.pflux_fw_neutron_mw = ( physics_variables.p_fusion_total_mw @@ -1421,7 +1419,7 @@ def ifephy(self, output: bool = False): process_output.oheadr(self.outfile, "Physics / Driver Issues") - match ife_variables.ifedrv: + match self.data.ife.ifedrv: case -1 | 0: process_output.ocmmnt(self.outfile, "Driver type : generic") case 1: @@ -1432,24 +1430,24 @@ def ifephy(self, output: bool = False): process_output.oblnkl(self.outfile) process_output.ovarre( - self.outfile, "Driver energy (J)", "(edrive)", ife_variables.edrive + self.outfile, "Driver energy (J)", "(edrive)", self.data.ife.edrive ) process_output.ovarre( - self.outfile, "Driver efficiency", "(etadrv)", ife_variables.etadrv + self.outfile, "Driver efficiency", "(etadrv)", self.data.ife.etadrv ) process_output.ovarre( self.outfile, "Driver power reaching target (W)", "(pdrive)", - ife_variables.pdrive, + self.data.ife.pdrive, ) process_output.ovarre( self.outfile, "Driver repetition rate (Hz)", "(reprat)", - ife_variables.reprat, + self.data.ife.reprat, ) - process_output.ovarre(self.outfile, "Target gain", "(gain)", ife_variables.gain) + process_output.ovarre(self.outfile, "Target gain", "(gain)", self.data.ife.gain) process_output.ovarre( self.outfile, "Fusion power (MW)", @@ -1663,7 +1661,7 @@ def ifetgt(self): # Target factory power (MWe) # Assumed to scale with repetition rate (not quite linearly) - ife_variables.tfacmw = ife_variables.ptargf * (ife_variables.reprat / 6.0) ** 0.7 + self.data.ife.tfacmw = self.data.ife.ptargf * (self.data.ife.reprat / 6.0) ** 0.7 def ifefbs(self, output: bool = False): """Routine to calculate the first wall, blanket and shield volumes, @@ -1703,16 +1701,16 @@ def ifefbs(self, output: bool = False): ] # Material masses - for i in range(ife_variables.MAXMAT + 1): + for i in range(MAXMAT + 1): den = matden[i] - ife_variables.chmatm[i] = ife_variables.chmatv[i] * den + self.data.ife.chmatm[i] = self.data.ife.chmatv[i] * den for j in range(3): - ife_variables.fwmatm[j, i] = ife_variables.fwmatv[j, i] * den - ife_variables.v1matm[j, i] = ife_variables.v1matv[j, i] * den - ife_variables.blmatm[j, i] = ife_variables.blmatv[j, i] * den - ife_variables.v2matm[j, i] = ife_variables.v2matv[j, i] * den - ife_variables.shmatm[j, i] = ife_variables.shmatv[j, i] * den - ife_variables.v3matm[j, i] = ife_variables.v3matv[j, i] * den + self.data.ife.fwmatm[j, i] = self.data.ife.fwmatv[j, i] * den + self.data.ife.v1matm[j, i] = self.data.ife.v1matv[j, i] * den + self.data.ife.blmatm[j, i] = self.data.ife.blmatv[j, i] * den + self.data.ife.v2matm[j, i] = self.data.ife.v2matv[j, i] * den + self.data.ife.shmatm[j, i] = self.data.ife.shmatv[j, i] * den + self.data.ife.v3matm[j, i] = self.data.ife.v3matv[j, i] * den # Total masses of components (excluding coolant) self.data.fwbs.m_fw_total = 0.0 @@ -1720,9 +1718,9 @@ def ifefbs(self, output: bool = False): self.data.fwbs.whtshld = 0.0 for i in range(5): for j in range(3): - self.data.fwbs.m_fw_total += ife_variables.fwmatm[j, i] - self.data.fwbs.m_blkt_total += ife_variables.blmatm[j, i] - self.data.fwbs.whtshld += ife_variables.shmatm[j, i] + self.data.fwbs.m_fw_total += self.data.ife.fwmatm[j, i] + self.data.fwbs.m_blkt_total += self.data.ife.blmatm[j, i] + self.data.fwbs.whtshld += self.data.ife.shmatm[j, i] # Other masses self.data.fwbs.m_blkt_beryllium = 0.0 @@ -1732,36 +1730,36 @@ def ifefbs(self, output: bool = False): self.data.fwbs.m_blkt_lithium = 0.0 for j in range(3): - self.data.fwbs.m_blkt_steel_total += ife_variables.blmatm[j, 1] - self.data.fwbs.m_blkt_li2o += ife_variables.blmatm[j, 4] - self.data.fwbs.m_blkt_lithium += ife_variables.blmatm[j, 8] + self.data.fwbs.m_blkt_steel_total += self.data.ife.blmatm[j, 1] + self.data.fwbs.m_blkt_li2o += self.data.ife.blmatm[j, 4] + self.data.fwbs.m_blkt_lithium += self.data.ife.blmatm[j, 8] # Total mass of FLiBe - ife_variables.mflibe = ife_variables.chmatm[3] + self.data.ife.mflibe = self.data.ife.chmatm[3] for j in range(3): - ife_variables.mflibe = ( - ife_variables.mflibe - + ife_variables.fwmatm[j, 3] - + ife_variables.v1matm[j, 3] - + ife_variables.blmatm[j, 3] - + ife_variables.v2matm[j, 3] - + ife_variables.shmatm[j, 3] - + ife_variables.v3matm[j, 3] + self.data.ife.mflibe = ( + self.data.ife.mflibe + + self.data.ife.fwmatm[j, 3] + + self.data.ife.v1matm[j, 3] + + self.data.ife.blmatm[j, 3] + + self.data.ife.v2matm[j, 3] + + self.data.ife.shmatm[j, 3] + + self.data.ife.v3matm[j, 3] ) # A fraction FBREED of the total breeder inventory is outside the # core region, i.e. is in the rest of the heat transport system - if (ife_variables.fbreed < 0.0) or (ife_variables.fbreed > 0.999): - raise ProcessValueError("Illegal fbreed value", fbreed=ife_variables.fbreed) + if (self.data.ife.fbreed < 0.0) or (self.data.ife.fbreed > 0.999): + raise ProcessValueError("Illegal fbreed value", fbreed=self.data.ife.fbreed) # Following assumes that use of FLiBe and Li2O are # mutually exclusive - ife_variables.mflibe /= 1.0 - ife_variables.fbreed - self.data.fwbs.m_blkt_li2o /= 1.0 - ife_variables.fbreed - self.data.fwbs.m_blkt_lithium /= 1.0 - ife_variables.fbreed + self.data.ife.mflibe /= 1.0 - self.data.ife.fbreed + self.data.fwbs.m_blkt_li2o /= 1.0 - self.data.ife.fbreed + self.data.fwbs.m_blkt_lithium /= 1.0 - self.data.ife.fbreed # Blanket and first wall lifetimes (HYLIFE-II: = plant life) - if ife_variables.ifetyp in {3, 4}: + if self.data.ife.ifetyp in {3, 4}: life = self.data.costs.life_plant else: life = min( @@ -1808,7 +1806,7 @@ def ifefbs(self, output: bool = False): self.outfile, "Total mass of FLiBe (kg)", "(mflibe)", - ife_variables.mflibe, + self.data.ife.mflibe, ) process_output.ovarre( self.outfile, "Shield mass (kg)", "(whtshld)", self.data.fwbs.whtshld @@ -1824,7 +1822,7 @@ def ifepw1(self): """ # Driver power reaching target (MW) - pdrvmw = 1.0e-6 * ife_variables.pdrive + pdrvmw = 1.0e-6 * self.data.ife.pdrive # Primary nuclear heating (MW) # Total thermal power removed from fusion core @@ -1845,7 +1843,7 @@ def ifepw1(self): # and provide the energy multiplication as though it were a # conventional blanket - if ife_variables.ifetyp not in {3, 4}: + if self.data.ife.ifetyp not in {3, 4}: self.data.heat_transport.p_fw_div_heat_deposited_mw = ( 0.24 * self.data.heat_transport.p_plant_primary_heat_mw ) @@ -1878,7 +1876,7 @@ def ifepw1(self): # Wall plug driver power (MW) - self.data.heat_transport.p_hcd_electric_total_mw = pdrvmw / ife_variables.etadrv + self.data.heat_transport.p_hcd_electric_total_mw = pdrvmw / self.data.ife.etadrv # Waste driver power (MW) @@ -1889,7 +1887,7 @@ def ifepw1(self): # Cryogenic power (MW) # Cryogenic temperature is assumed to be 4.5K - self.data.heat_transport.p_cryo_plant_electric_mw = ife_variables.pifecr + self.data.heat_transport.p_cryo_plant_electric_mw = self.data.ife.pifecr self.data.heat_transport.helpow = ( 1.0e6 * self.data.heat_transport.p_cryo_plant_electric_mw @@ -1925,10 +1923,10 @@ def ifepw2(self, output: bool = False): + self.data.heat_transport.fachtmw + self.data.heat_transport.vachtmw + self.data.heat_transport.p_tritium_plant_electric_mw - + ife_variables.tdspmw - + ife_variables.tfacmw + + self.data.ife.tdspmw + + self.data.ife.tfacmw + self.data.heat_transport.p_cryo_plant_electric_mw - + ife_variables.htpmw_ife + + self.data.ife.htpmw_ife ) # Calculate powers relevant to a power-producing plant @@ -1943,7 +1941,7 @@ def ifepw2(self, output: bool = False): self.data.heat_transport.fgrosbop = min( 0.5, ( - ife_variables.fauxbop + self.data.ife.fauxbop / (self.data.heat_transport.p_plant_electric_gross_mw / 1000.0) ** 0.6 ), @@ -1977,7 +1975,7 @@ def ifepw2(self, output: bool = False): "(f_p_blkt_multiplication)", self.data.fwbs.f_p_blkt_multiplication, ) - if ife_variables.ifetyp == 4: + if self.data.ife.ifetyp == 4: process_output.ovarre( self.outfile, "Tritium Breeding Ratio", "(tbr)", self.data.fwbs.tbr ) @@ -1985,7 +1983,7 @@ def ifepw2(self, output: bool = False): self.outfile, "Lithium Fall Time (s)", "(taufall)", - ife_variables.taufall, + self.data.ife.taufall, ) process_output.ovarre( @@ -2041,13 +2039,13 @@ def ifepw2(self, output: bool = False): self.outfile, "Heat removal from target factory (MW)", "(tfacmw)", - ife_variables.tfacmw, + self.data.ife.tfacmw, ) process_output.ovarre( self.outfile, "Heat removal from delivery system (MW)", "(tdspmw)", - ife_variables.tdspmw, + self.data.ife.tdspmw, ) process_output.ovarre( self.outfile, @@ -2113,14 +2111,14 @@ def ifeacp(self, output: bool = False): self.data.heat_transport.pacpmw = ( self.data.heat_transport.p_cryo_plant_electric_mw + self.data.heat_transport.vachtmw - + ife_variables.tdspmw - + ife_variables.tfacmw - + (ife_variables.htpmw_ife * ife_variables.reprat / 6.0) + + self.data.ife.tdspmw + + self.data.ife.tfacmw + + (self.data.ife.htpmw_ife * self.data.ife.reprat / 6.0) + self.data.heat_transport.p_tritium_plant_electric_mw + self.data.heat_transport.p_hcd_electric_total_mw + basemw + (self.data.buildings.a_plant_floor_effective * pmwpm2) - + ife_variables.lipmw + + self.data.ife.lipmw ) # Total baseline power to facility loads, MW @@ -2134,10 +2132,10 @@ def ifeacp(self, output: bool = False): self.data.heat_transport.tlvpmw = ( self.data.heat_transport.p_plant_electric_base_total_mw + self.data.heat_transport.p_tritium_plant_electric_mw - + (ife_variables.htpmw_ife * ife_variables.reprat / 6.0) + + (self.data.ife.htpmw_ife * self.data.ife.reprat / 6.0) + self.data.heat_transport.vachtmw + 0.5 * self.data.heat_transport.p_cryo_plant_electric_mw - + ife_variables.tfacmw + + self.data.ife.tfacmw ) if not output: @@ -2167,10 +2165,10 @@ def ifeacp(self, output: bool = False): self.outfile, "Target delivery system (MW)", "(tdspmw)", - ife_variables.tdspmw, + self.data.ife.tdspmw, ) process_output.ovarre( - self.outfile, "Target factory (MW)", "(tfacmw)", ife_variables.tfacmw + self.outfile, "Target factory (MW)", "(tfacmw)", self.data.ife.tfacmw ) process_output.ovarre( self.outfile, @@ -2194,14 +2192,14 @@ def ifeacp(self, output: bool = False): self.outfile, "Heat transport system pump motors (MW)", "(htpmw_ife*reprat/6)", - ife_variables.htpmw_ife * ife_variables.reprat / 6.0, + self.data.ife.htpmw_ife * self.data.ife.reprat / 6.0, ) - if ife_variables.ifetyp == 4: + if self.data.ife.ifetyp == 4: process_output.ovarre( self.outfile, "Lithium Pump Power (MW)", "(lipmw)", - ife_variables.lipmw, + self.data.ife.lipmw, ) process_output.oblnkl(self.outfile) process_output.ovarre( @@ -2240,10 +2238,10 @@ def ifebdg(self, output: bool = False): # ================ # Total internal height - hrbi = ife_variables.zl7 + ife_variables.zu7 + hrbi = self.data.ife.zl7 + self.data.ife.zu7 # Distance from centre of device to wall - self.data.buildings.wrbi = ife_variables.r7 + self.data.buildings.wrbi = self.data.ife.r7 # Internal volume (square floor) vrci = (2.0 * self.data.buildings.wrbi) ** 2 * hrbi @@ -2252,7 +2250,7 @@ def ifebdg(self, output: bool = False): # RBWT = wall thickness # RBRT = roof thickness # FNDT = foundation thickness - rbw = 2.0 * (ife_variables.r7 + self.data.buildings.rbwt) + rbw = 2.0 * (self.data.ife.r7 + self.data.buildings.rbwt) rbl = rbw rbh = hrbi + self.data.buildings.rbrt + self.data.buildings.fndt @@ -2269,11 +2267,11 @@ def ifebdg(self, output: bool = False): # Shield height - shh = ife_variables.zl6 + ife_variables.zu6 + shh = self.data.ife.zl6 + self.data.ife.zu6 # Transport corridor size - tcw = ife_variables.r6 + 4.0 * self.data.buildings.trcl + tcw = self.data.ife.r6 + 4.0 * self.data.buildings.trcl tcl = 5.0 * tcw + 2.0 * self.data.buildings.hcwt # Decontamination cell size @@ -2282,8 +2280,8 @@ def ifebdg(self, output: bool = False): # Hot cell size - hcw = ife_variables.r6 + 3.0 * self.data.buildings.hccl + 2.0 - hcl = 3.0 * ife_variables.r6 + 4.0 * self.data.buildings.hccl + tcw + hcw = self.data.ife.r6 + 3.0 * self.data.buildings.hccl + 2.0 + hcl = 3.0 * self.data.ife.r6 + 4.0 * self.data.buildings.hccl + tcw # Radioactive waste treatment # rww = dcw @@ -2304,7 +2302,7 @@ def ifebdg(self, output: bool = False): cran = 9.41e-6 * wgts + 5.1 rmbh = ( 10.0 - + (ife_variables.zl6 + ife_variables.zu6) + + (self.data.ife.zl6 + self.data.ife.zu6) + self.data.buildings.trcl + cran + 5.1 diff --git a/process/models/pfcoil.py b/process/models/pfcoil.py index 5e6801758..3d7731a2b 100644 --- a/process/models/pfcoil.py +++ b/process/models/pfcoil.py @@ -11,13 +11,17 @@ from process.core import process_output as op from process.core.exceptions import ProcessValueError from process.core.model import DataStructure, Model -from process.data_structure import ( - pfcoil_variables, - superconducting_tf_coil_variables, -) from process.data_structure import physics_variables as pv from process.data_structure import rebco_variables as rcv +from process.data_structure import superconducting_tf_coil_variables from process.data_structure import tfcoil_variables as tfv +from process.data_structure.pfcoil_variables import ( + N_PF_COILS_IN_GROUP_MAX, + N_PF_GROUPS_MAX, + NFIXMX, + NGC2, + NPTSMX, +) from process.models import superconductors from process.models.superconductors import SuperconductorMaterial, SuperconductorModel from process.models.tfcoil.base import TFCoilShapeModel @@ -32,7 +36,6 @@ def __init__(self, cs_fatigue, cs_coil): """Initialise Fortran module variables.""" self.outfile = constants.NOUT # output file unit self.mfile = constants.MFILE # mfile file unit - pfcoil_variables.init_pfcoil_module() self.cs_fatigue = cs_fatigue self.cs_coil = cs_coil @@ -64,68 +67,65 @@ def pfcoil(self): Central Solenoid coils, to determine their size, location, current waveforms, stresses etc. """ - lrow1 = 2 * pfcoil_variables.NPTSMX + pfcoil_variables.N_PF_GROUPS_MAX - lcol1 = pfcoil_variables.N_PF_GROUPS_MAX + lrow1 = 2 * NPTSMX + N_PF_GROUPS_MAX + lcol1 = N_PF_GROUPS_MAX - pcls0 = np.zeros(pfcoil_variables.N_PF_GROUPS_MAX, dtype=int) - ncls0 = np.zeros(pfcoil_variables.N_PF_GROUPS_MAX + 2, dtype=int) + pcls0 = np.zeros(N_PF_GROUPS_MAX, dtype=int) + ncls0 = np.zeros(N_PF_GROUPS_MAX + 2, dtype=int) - pfcoil_variables.rcls0, pfcoil_variables.zcls0 = np.zeros( + self.data.pf_coil.rcls0, self.data.pf_coil.zcls0 = np.zeros( ( 2, - pfcoil_variables.N_PF_GROUPS_MAX, - pfcoil_variables.N_PF_COILS_IN_GROUP_MAX, + N_PF_GROUPS_MAX, + N_PF_COILS_IN_GROUP_MAX, ), order="F", ) - pfcoil_variables.ccls0 = np.zeros(int(pfcoil_variables.N_PF_GROUPS_MAX / 2)) - brin, bzin, rpts, zpts = np.zeros((4, pfcoil_variables.NPTSMX)) + self.data.pf_coil.ccls0 = np.zeros(int(N_PF_GROUPS_MAX / 2)) + brin, bzin, rpts, zpts = np.zeros((4, NPTSMX)) bfix, bvec = np.zeros((2, lrow1)) gmat, _, _ = np.zeros((3, lrow1, lcol1), order="F") signn = np.zeros(2) - aturn = np.zeros(pfcoil_variables.NGC2) + aturn = np.zeros(NGC2) # Toggle switch for i_pf_location()=2 coils above/below midplane top_bottom = 1 # Set up the number of PF coils including the Central Solenoid (n_cs_pf_coils), # and the number of PF circuits including the plasma (n_pf_cs_plasma_circuits) - if pfcoil_variables.n_pf_coil_groups > pfcoil_variables.N_PF_GROUPS_MAX: + if self.data.pf_coil.n_pf_coil_groups > N_PF_GROUPS_MAX: raise ProcessValueError( "n_pf_coil_groups is larger than n_pf_groups_max", - n_pf_coil_groups=pfcoil_variables.n_pf_coil_groups, - n_pf_groups_max=pfcoil_variables.N_PF_GROUPS_MAX, + n_pf_coil_groups=self.data.pf_coil.n_pf_coil_groups, + n_pf_groups_max=N_PF_GROUPS_MAX, ) # Total the number of PF coils in all groups, and check that none # exceeds the limit - pfcoil_variables.n_cs_pf_coils = 0 - for i in range(pfcoil_variables.n_pf_coil_groups): - if ( - pfcoil_variables.n_pf_coils_in_group[i] - > pfcoil_variables.N_PF_COILS_IN_GROUP_MAX - ): + self.data.pf_coil.n_cs_pf_coils = 0 + for i in range(self.data.pf_coil.n_pf_coil_groups): + if self.data.pf_coil.n_pf_coils_in_group[i] > N_PF_COILS_IN_GROUP_MAX: raise ProcessValueError( "PFCOIL: Too many coils in a PF coil group", i=i, - n_pf_coils_in_group=pfcoil_variables.n_pf_coils_in_group[i], - n_pf_coils_in_group_max=pfcoil_variables.N_PF_COILS_IN_GROUP_MAX, + n_pf_coils_in_group=self.data.pf_coil.n_pf_coils_in_group[i], + n_pf_coils_in_group_max=N_PF_COILS_IN_GROUP_MAX, ) - pfcoil_variables.n_cs_pf_coils += pfcoil_variables.n_pf_coils_in_group[i] + self.data.pf_coil.n_cs_pf_coils += self.data.pf_coil.n_pf_coils_in_group[i] # Add one if an Central Solenoid is present, and make an extra group if self.data.build.iohcl != 0: - pfcoil_variables.n_cs_pf_coils += 1 - pfcoil_variables.n_pf_coils_in_group[pfcoil_variables.n_pf_coil_groups] = 1 + self.data.pf_coil.n_cs_pf_coils += 1 + self.data.pf_coil.n_pf_coils_in_group[self.data.pf_coil.n_pf_coil_groups] = 1 # Add one for the plasma - pfcoil_variables.n_pf_cs_plasma_circuits = pfcoil_variables.n_cs_pf_coils + 1 + self.data.pf_coil.n_pf_cs_plasma_circuits = self.data.pf_coil.n_cs_pf_coils + 1 # Overall current density in the Central Solenoid at beginning of pulse - pfcoil_variables.j_cs_pulse_start = ( - pfcoil_variables.j_cs_flat_top_end - * pfcoil_variables.f_j_cs_start_pulse_end_flat_top + self.data.pf_coil.j_cs_pulse_start = ( + self.data.pf_coil.j_cs_flat_top_end + * self.data.pf_coil.f_j_cs_start_pulse_end_flat_top ) # Set up array of times @@ -153,19 +153,19 @@ def pfcoil(self): # First break up Central Solenoid solenoid into 'filaments' ( - pfcoil_variables.z_pf_coil_upper[pfcoil_variables.n_cs_pf_coils - 1], - pfcoil_variables.z_pf_coil_lower[pfcoil_variables.n_cs_pf_coils - 1], - pfcoil_variables.r_pf_coil_middle[pfcoil_variables.n_cs_pf_coils - 1], - pfcoil_variables.r_cs_middle, - pfcoil_variables.z_pf_coil_middle[pfcoil_variables.n_cs_pf_coils - 1], - pfcoil_variables.r_pf_coil_outer[pfcoil_variables.n_cs_pf_coils - 1], - pfcoil_variables.r_pf_coil_inner[pfcoil_variables.n_cs_pf_coils - 1], - pfcoil_variables.a_cs_poloidal, - pfcoil_variables.dz_cs_full, - pfcoil_variables.dr_cs_full, + self.data.pf_coil.z_pf_coil_upper[self.data.pf_coil.n_cs_pf_coils - 1], + self.data.pf_coil.z_pf_coil_lower[self.data.pf_coil.n_cs_pf_coils - 1], + self.data.pf_coil.r_pf_coil_middle[self.data.pf_coil.n_cs_pf_coils - 1], + self.data.pf_coil.r_cs_middle, + self.data.pf_coil.z_pf_coil_middle[self.data.pf_coil.n_cs_pf_coils - 1], + self.data.pf_coil.r_pf_coil_outer[self.data.pf_coil.n_cs_pf_coils - 1], + self.data.pf_coil.r_pf_coil_inner[self.data.pf_coil.n_cs_pf_coils - 1], + self.data.pf_coil.a_cs_poloidal, + self.data.pf_coil.dz_cs_full, + self.data.pf_coil.dr_cs_full, ) = self.cs_coil.calculate_cs_geometry( z_tf_inside_half=self.data.build.z_tf_inside_half, - f_z_cs_tf_internal=pfcoil_variables.f_z_cs_tf_internal, + f_z_cs_tf_internal=self.data.pf_coil.f_z_cs_tf_internal, dr_cs=self.data.build.dr_cs, dr_bore=self.data.build.dr_bore, ) @@ -173,84 +173,84 @@ def pfcoil(self): # nfxf is the total no of filaments into which the Central Solenoid is split, # if present if self.data.build.iohcl == 0: - pfcoil_variables.nfxf = 0 + self.data.pf_coil.nfxf = 0 c_cs_flat_top_end = 0.0e0 else: - pfcoil_variables.nfxf = 2 * pfcoil_variables.n_cs_current_filaments + self.data.pf_coil.nfxf = 2 * self.data.pf_coil.n_cs_current_filaments # total Central Solenoid current at EOF c_cs_flat_top_end = -( - pfcoil_variables.a_cs_poloidal * pfcoil_variables.j_cs_flat_top_end + self.data.pf_coil.a_cs_poloidal * self.data.pf_coil.j_cs_flat_top_end ) - if pfcoil_variables.nfxf > pfcoil_variables.NFIXMX: + if self.data.pf_coil.nfxf > NFIXMX: raise ProcessValueError( "Too many filaments nfxf repesenting the OH coil", - nfxf=pfcoil_variables.nfxf, - nfixmx=pfcoil_variables.NFIXMX, + nfxf=self.data.pf_coil.nfxf, + nfixmx=NFIXMX, ) # Symmetric up/down Central Solenoid : Find (R,Z) and current of each filament at BOP ( - pfcoil_variables.r_pf_cs_current_filaments, - pfcoil_variables.z_pf_cs_current_filaments, - pfcoil_variables.c_pf_cs_current_filaments, + self.data.pf_coil.r_pf_cs_current_filaments, + self.data.pf_coil.z_pf_cs_current_filaments, + self.data.pf_coil.c_pf_cs_current_filaments, ) = self.cs_coil.place_cs_filaments( - n_cs_current_filaments=pfcoil_variables.n_cs_current_filaments, - r_cs_middle=pfcoil_variables.r_cs_middle, - z_cs_inside_half=pfcoil_variables.dz_cs_full / 2, + n_cs_current_filaments=self.data.pf_coil.n_cs_current_filaments, + r_cs_middle=self.data.pf_coil.r_cs_middle, + z_cs_inside_half=self.data.pf_coil.dz_cs_full / 2, c_cs_flat_top_end=c_cs_flat_top_end, - f_j_cs_start_pulse_end_flat_top=pfcoil_variables.f_j_cs_start_pulse_end_flat_top, - nfxf=pfcoil_variables.nfxf, + f_j_cs_start_pulse_end_flat_top=self.data.pf_coil.f_j_cs_start_pulse_end_flat_top, + nfxf=self.data.pf_coil.nfxf, ) # Scale PF coil locations signn[0] = 1.0e0 signn[1] = -1.0e0 - pfcoil_variables.r_pf_outside_tf_midplane = ( + self.data.pf_coil.r_pf_outside_tf_midplane = ( superconducting_tf_coil_variables.r_tf_outboard_out - + pfcoil_variables.dr_pf_tf_outboard_out_offset + + self.data.pf_coil.dr_pf_tf_outboard_out_offset ) # Place the PF coils: # N.B. Problems here if coil=n_pf_coils_in_group(group) is greater than 2. - for group in range(pfcoil_variables.n_pf_coil_groups): - if pfcoil_variables.i_pf_location[group] == 1: + for group in range(self.data.pf_coil.n_pf_coil_groups): + if self.data.pf_coil.i_pf_location[group] == 1: # PF coil is stacked on top of the Central Solenoid # Use a helper function to compute r_pf_coil_middle_group_array and # z_pf_coil_middle_group_array arrays for this group r_pf_coil_middle_group_array, z_pf_coil_middle_group_array = ( self.place_pf_above_cs( - n_pf_coils_in_group=pfcoil_variables.n_pf_coils_in_group, + n_pf_coils_in_group=self.data.pf_coil.n_pf_coils_in_group, n_pf_group=group, - r_cs_middle=pfcoil_variables.r_cs_middle, - dr_pf_cs_middle_offset=pfcoil_variables.dr_pf_cs_middle_offset, + r_cs_middle=self.data.pf_coil.r_cs_middle, + dr_pf_cs_middle_offset=self.data.pf_coil.dr_pf_cs_middle_offset, z_tf_inside_half=self.data.build.z_tf_inside_half, dr_tf_inboard=self.data.build.dr_tf_inboard, - z_cs_coil_upper=pfcoil_variables.dz_cs_full / 2, + z_cs_coil_upper=self.data.pf_coil.dz_cs_full / 2, ) ) - for coil in range(pfcoil_variables.n_pf_coils_in_group[group]): - pfcoil_variables.r_pf_coil_middle_group_array[group, coil] = ( + for coil in range(self.data.pf_coil.n_pf_coils_in_group[group]): + self.data.pf_coil.r_pf_coil_middle_group_array[group, coil] = ( r_pf_coil_middle_group_array[group, coil] ) - pfcoil_variables.z_pf_coil_middle_group_array[group, coil] = ( + self.data.pf_coil.z_pf_coil_middle_group_array[group, coil] = ( z_pf_coil_middle_group_array[group, coil] ) # ========================================================================= - elif pfcoil_variables.i_pf_location[group] == 2: + elif self.data.pf_coil.i_pf_location[group] == 2: # PF coil is on top of the TF coil ( r_pf_coil_middle_group_array, z_pf_coil_middle_group_array, top_bottom, ) = self.place_pf_above_tf( - n_pf_coils_in_group=pfcoil_variables.n_pf_coils_in_group, + n_pf_coils_in_group=self.data.pf_coil.n_pf_coils_in_group, n_pf_group=group, rmajor=pv.rmajor, triang=pv.triang, @@ -261,62 +261,62 @@ def pfcoil(self): dz_tf_upper_lower_midplane=self.data.build.dz_tf_upper_lower_midplane, z_tf_top=self.data.build.z_tf_top, top_bottom=top_bottom, - rpf2=pfcoil_variables.rpf2, - zref=pfcoil_variables.zref, + rpf2=self.data.pf_coil.rpf2, + zref=self.data.pf_coil.zref, ) - for coil in range(pfcoil_variables.n_pf_coils_in_group[group]): - pfcoil_variables.r_pf_coil_middle_group_array[group, coil] = ( + for coil in range(self.data.pf_coil.n_pf_coils_in_group[group]): + self.data.pf_coil.r_pf_coil_middle_group_array[group, coil] = ( r_pf_coil_middle_group_array[group, coil] ) - pfcoil_variables.z_pf_coil_middle_group_array[group, coil] = ( + self.data.pf_coil.z_pf_coil_middle_group_array[group, coil] = ( z_pf_coil_middle_group_array[group, coil] ) # ========================================================================= - elif pfcoil_variables.i_pf_location[group] == 3: + elif self.data.pf_coil.i_pf_location[group] == 3: # PF coil is radially outside the TF coil ( r_pf_coil_middle_group_array, z_pf_coil_middle_group_array, ) = self.place_pf_outside_tf( - n_pf_coils_in_group=pfcoil_variables.n_pf_coils_in_group, + n_pf_coils_in_group=self.data.pf_coil.n_pf_coils_in_group, n_pf_group=group, rminor=pv.rminor, - zref=pfcoil_variables.zref, + zref=self.data.pf_coil.zref, i_tf_shape=tfv.i_tf_shape, - i_r_pf_outside_tf_placement=pfcoil_variables.i_r_pf_outside_tf_placement, - r_pf_outside_tf_midplane=pfcoil_variables.r_pf_outside_tf_midplane, + i_r_pf_outside_tf_placement=self.data.pf_coil.i_r_pf_outside_tf_placement, + r_pf_outside_tf_midplane=self.data.pf_coil.r_pf_outside_tf_midplane, ) - for coil in range(pfcoil_variables.n_pf_coils_in_group[group]): - pfcoil_variables.r_pf_coil_middle_group_array[group, coil] = ( + for coil in range(self.data.pf_coil.n_pf_coils_in_group[group]): + self.data.pf_coil.r_pf_coil_middle_group_array[group, coil] = ( r_pf_coil_middle_group_array[group, coil] ) - pfcoil_variables.z_pf_coil_middle_group_array[group, coil] = ( + self.data.pf_coil.z_pf_coil_middle_group_array[group, coil] = ( z_pf_coil_middle_group_array[group, coil] ) # ========================================================================= - elif pfcoil_variables.i_pf_location[group] == 4: + elif self.data.pf_coil.i_pf_location[group] == 4: ( r_pf_coil_middle_group_array, z_pf_coil_middle_group_array, ) = self.place_pf_generally( - n_pf_coils_in_group=pfcoil_variables.n_pf_coils_in_group, + n_pf_coils_in_group=self.data.pf_coil.n_pf_coils_in_group, n_pf_group=group, rminor=pv.rminor, rmajor=pv.rmajor, - zref=pfcoil_variables.zref, - rref=pfcoil_variables.rref, + zref=self.data.pf_coil.zref, + rref=self.data.pf_coil.rref, ) - for coil in range(pfcoil_variables.n_pf_coils_in_group[group]): - pfcoil_variables.r_pf_coil_middle_group_array[group, coil] = ( + for coil in range(self.data.pf_coil.n_pf_coils_in_group[group]): + self.data.pf_coil.r_pf_coil_middle_group_array[group, coil] = ( r_pf_coil_middle_group_array[group, coil] ) - pfcoil_variables.z_pf_coil_middle_group_array[group, coil] = ( + self.data.pf_coil.z_pf_coil_middle_group_array[group, coil] = ( z_pf_coil_middle_group_array[group, coil] ) @@ -324,7 +324,7 @@ def pfcoil(self): raise ProcessValueError( "Illegal i_pf_location value", group=group, - i_pf_location=pfcoil_variables.i_pf_location[group], + i_pf_location=self.data.pf_coil.i_pf_location[group], ) # ========================================================================= @@ -338,14 +338,14 @@ def pfcoil(self): # coils. # Flux swing coils: - if pfcoil_variables.j_cs_pulse_start != 0.0e0: # noqa: RUF069 + if self.data.pf_coil.j_cs_pulse_start != 0.0e0: # noqa: RUF069 # Find currents for plasma initiation to null field across plasma npts = 32 # Number of test points across plasma midplane - if npts > pfcoil_variables.NPTSMX: + if npts > NPTSMX: raise ProcessValueError( "Too many test points npts across plasma midplane", npts=npts, - nptsmx=pfcoil_variables.NPTSMX, + nptsmx=NPTSMX, ) # Position and B-field at each test point @@ -359,54 +359,54 @@ def pfcoil(self): bzin[i] = 0.0e0 # Calculate currents in coils to produce the given field - pfcoil_variables.ssq0, pfcoil_variables.ccl0 = self.efc( + self.data.pf_coil.ssq0, self.data.pf_coil.ccl0 = self.efc( npts, rpts, zpts, brin, bzin, - pfcoil_variables.nfxf, - pfcoil_variables.r_pf_cs_current_filaments, - pfcoil_variables.z_pf_cs_current_filaments, - pfcoil_variables.c_pf_cs_current_filaments, - pfcoil_variables.n_pf_coil_groups, - pfcoil_variables.n_pf_coils_in_group, - pfcoil_variables.r_pf_coil_middle_group_array, - pfcoil_variables.z_pf_coil_middle_group_array, - pfcoil_variables.alfapf, + self.data.pf_coil.nfxf, + self.data.pf_coil.r_pf_cs_current_filaments, + self.data.pf_coil.z_pf_cs_current_filaments, + self.data.pf_coil.c_pf_cs_current_filaments, + self.data.pf_coil.n_pf_coil_groups, + self.data.pf_coil.n_pf_coils_in_group, + self.data.pf_coil.r_pf_coil_middle_group_array, + self.data.pf_coil.z_pf_coil_middle_group_array, + self.data.pf_coil.alfapf, bfix, gmat, bvec, ) # Equilibrium coil currents determined by SVD targeting B - if pfcoil_variables.i_pf_current == 1: + if self.data.pf_coil.i_pf_current == 1: # Simple coil current scaling for STs (good only for A < about 1.8) # Bypasses SVD solver if pv.itart == 1 and pv.itartpf == 0: - for i in range(pfcoil_variables.n_pf_coil_groups): - if pfcoil_variables.i_pf_location[i] == 1: + for i in range(self.data.pf_coil.n_pf_coil_groups): + if self.data.pf_coil.i_pf_location[i] == 1: # PF coil is stacked on top of the Central Solenoid - pfcoil_variables.ccls[i] = 0.0e0 + self.data.pf_coil.ccls[i] = 0.0e0 raise ProcessValueError( "i_pf_location(i) should not be 1 if itart=1", i=i ) - if pfcoil_variables.i_pf_location[i] == 2: + if self.data.pf_coil.i_pf_location[i] == 2: # PF coil is on top of the TF coil - pfcoil_variables.ccls[i] = ( + self.data.pf_coil.ccls[i] = ( 0.3e0 * pv.aspect**1.6e0 * pv.plasma_current ) - elif pfcoil_variables.i_pf_location[i] == 3: + elif self.data.pf_coil.i_pf_location[i] == 3: # PF coil is radially outside the TF coil - pfcoil_variables.ccls[i] = -0.4e0 * pv.plasma_current + self.data.pf_coil.ccls[i] = -0.4e0 * pv.plasma_current else: raise ProcessValueError( "Illegal value of i_pf_location(i)", i=i, - i_pf_location=pfcoil_variables.i_pf_location[i], + i_pf_location=self.data.pf_coil.i_pf_location[i], ) # Vertical field (T) @@ -427,8 +427,8 @@ def pfcoil(self): nfxf0 = 0 ngrp0 = 0 nocoil = 0 - for i in range(pfcoil_variables.n_pf_coil_groups): - if pfcoil_variables.i_pf_location[i] == 1: + for i in range(self.data.pf_coil.n_pf_coil_groups): + if self.data.pf_coil.i_pf_location[i] == 1: # Do not allow if no central solenoid if self.data.build.iohcl == 0: raise ProcessValueError( @@ -437,56 +437,56 @@ def pfcoil(self): # PF coil is stacked on top of the Central Solenoid # This coil is to balance Central Solenoid flux and should not be involved # in equilibrium calculation -- RK 07/12 - pfcoil_variables.ccls[i] = 0.0e0 - nfxf0 += pfcoil_variables.n_pf_coils_in_group[i] - for ccount in range(pfcoil_variables.n_pf_coils_in_group[i]): - pfcoil_variables.r_pf_cs_current_filaments[nocoil] = ( - pfcoil_variables.r_pf_coil_middle_group_array[i, ccount] + self.data.pf_coil.ccls[i] = 0.0e0 + nfxf0 += self.data.pf_coil.n_pf_coils_in_group[i] + for ccount in range(self.data.pf_coil.n_pf_coils_in_group[i]): + self.data.pf_coil.r_pf_cs_current_filaments[nocoil] = ( + self.data.pf_coil.r_pf_coil_middle_group_array[i, ccount] ) - pfcoil_variables.z_pf_cs_current_filaments[nocoil] = ( - pfcoil_variables.z_pf_coil_middle_group_array[i, ccount] + self.data.pf_coil.z_pf_cs_current_filaments[nocoil] = ( + self.data.pf_coil.z_pf_coil_middle_group_array[i, ccount] ) - pfcoil_variables.c_pf_cs_current_filaments[nocoil] = ( - pfcoil_variables.ccls[i] + self.data.pf_coil.c_pf_cs_current_filaments[nocoil] = ( + self.data.pf_coil.ccls[i] ) nocoil += 1 - elif pfcoil_variables.i_pf_location[i] == 2: + elif self.data.pf_coil.i_pf_location[i] == 2: # PF coil is on top of the TF coil; divertor coil # This is a fixed current for this calculation -- RK 07/12 - pfcoil_variables.ccls[i] = ( + self.data.pf_coil.ccls[i] = ( pv.plasma_current * 2.0e0 * ( 1.0e0 - (pv.kappa * pv.rminor) / abs( - pfcoil_variables.z_pf_coil_middle_group_array[i, 0] + self.data.pf_coil.z_pf_coil_middle_group_array[i, 0] ) ) ) - nfxf0 += pfcoil_variables.n_pf_coils_in_group[i] - for ccount in range(pfcoil_variables.n_pf_coils_in_group[i]): - pfcoil_variables.r_pf_cs_current_filaments[nocoil] = ( - pfcoil_variables.r_pf_coil_middle_group_array[i, ccount] + nfxf0 += self.data.pf_coil.n_pf_coils_in_group[i] + for ccount in range(self.data.pf_coil.n_pf_coils_in_group[i]): + self.data.pf_coil.r_pf_cs_current_filaments[nocoil] = ( + self.data.pf_coil.r_pf_coil_middle_group_array[i, ccount] ) - pfcoil_variables.z_pf_cs_current_filaments[nocoil] = ( - pfcoil_variables.z_pf_coil_middle_group_array[i, ccount] + self.data.pf_coil.z_pf_cs_current_filaments[nocoil] = ( + self.data.pf_coil.z_pf_coil_middle_group_array[i, ccount] ) - pfcoil_variables.c_pf_cs_current_filaments[nocoil] = ( - pfcoil_variables.ccls[i] + self.data.pf_coil.c_pf_cs_current_filaments[nocoil] = ( + self.data.pf_coil.ccls[i] ) nocoil += 1 - elif pfcoil_variables.i_pf_location[i] == 3: + elif self.data.pf_coil.i_pf_location[i] == 3: # PF coil is radially outside the TF coil # This is an equilibrium coil, current must be solved for pcls0[ngrp0] = i + 1 ngrp0 += 1 - elif pfcoil_variables.i_pf_location[i] == 4: + elif self.data.pf_coil.i_pf_location[i] == 4: # PF coil is generally placed # See issue 1418 # https://git.ccfe.ac.uk/process/process/-/issues/1418 @@ -499,28 +499,28 @@ def pfcoil(self): raise ProcessValueError( "Illegal value of i_pf_location(i)", i=i, - i_pf_location=pfcoil_variables.i_pf_location[i], + i_pf_location=self.data.pf_coil.i_pf_location[i], ) for ccount in range(ngrp0): ncls0[ccount] = 2 - pfcoil_variables.rcls0[ccount, 0] = ( - pfcoil_variables.r_pf_coil_middle_group_array[ + self.data.pf_coil.rcls0[ccount, 0] = ( + self.data.pf_coil.r_pf_coil_middle_group_array[ pcls0[ccount] - 1, 0 ] ) - pfcoil_variables.rcls0[ccount, 1] = ( - pfcoil_variables.r_pf_coil_middle_group_array[ + self.data.pf_coil.rcls0[ccount, 1] = ( + self.data.pf_coil.r_pf_coil_middle_group_array[ pcls0[ccount] - 1, 1 ] ) - pfcoil_variables.zcls0[ccount, 0] = ( - pfcoil_variables.z_pf_coil_middle_group_array[ + self.data.pf_coil.zcls0[ccount, 0] = ( + self.data.pf_coil.z_pf_coil_middle_group_array[ pcls0[ccount] - 1, 0 ] ) - pfcoil_variables.zcls0[ccount, 1] = ( - pfcoil_variables.z_pf_coil_middle_group_array[ + self.data.pf_coil.zcls0[ccount, 1] = ( + self.data.pf_coil.z_pf_coil_middle_group_array[ pcls0[ccount] - 1, 1 ] ) @@ -546,28 +546,28 @@ def pfcoil(self): pv.b_plasma_vertical_required = bzin[0] - _ssqef, pfcoil_variables.ccls0 = self.efc( + _ssqef, self.data.pf_coil.ccls0 = self.efc( npts0, rpts, zpts, brin, bzin, nfxf0, - pfcoil_variables.r_pf_cs_current_filaments, - pfcoil_variables.z_pf_cs_current_filaments, - pfcoil_variables.c_pf_cs_current_filaments, + self.data.pf_coil.r_pf_cs_current_filaments, + self.data.pf_coil.z_pf_cs_current_filaments, + self.data.pf_coil.c_pf_cs_current_filaments, ngrp0, ncls0, - pfcoil_variables.rcls0, - pfcoil_variables.zcls0, - pfcoil_variables.alfapf, + self.data.pf_coil.rcls0, + self.data.pf_coil.zcls0, + self.data.pf_coil.alfapf, bfix, gmat, bvec, ) for ccount in range(ngrp0): - pfcoil_variables.ccls[pcls0[ccount] - 1] = pfcoil_variables.ccls0[ + self.data.pf_coil.ccls[pcls0[ccount] - 1] = self.data.pf_coil.ccls0[ ccount ] @@ -576,21 +576,21 @@ def pfcoil(self): # If this is the first visit to the routine the inductance matrix # ind_pf_cs_plasma_mutual and the turns array have not yet been calculated, so we set # them to (very) approximate values to avoid strange behaviour... - if pfcoil_variables.first_call: - pfcoil_variables.ind_pf_cs_plasma_mutual[:, :] = 1.0e0 - pfcoil_variables.n_pf_coil_turns[:] = 100.0e0 - pfcoil_variables.first_call = False + if self.data.pf_coil.first_call: + self.data.pf_coil.ind_pf_cs_plasma_mutual[:, :] = 1.0e0 + self.data.pf_coil.n_pf_coil_turns[:] = 100.0e0 + self.data.pf_coil.first_call = False pfflux = 0.0e0 nocoil = 0 - for ccount in range(pfcoil_variables.n_pf_coil_groups): - for _i in range(pfcoil_variables.n_pf_coils_in_group[ccount]): + for ccount in range(self.data.pf_coil.n_pf_coil_groups): + for _i in range(self.data.pf_coil.n_pf_coils_in_group[ccount]): pfflux += ( - pfcoil_variables.ccls[ccount] - * pfcoil_variables.ind_pf_cs_plasma_mutual[ - nocoil, pfcoil_variables.n_pf_cs_plasma_circuits - 1 + self.data.pf_coil.ccls[ccount] + * self.data.pf_coil.ind_pf_cs_plasma_mutual[ + nocoil, self.data.pf_coil.n_pf_cs_plasma_circuits - 1 ] - / pfcoil_variables.n_pf_coil_turns[nocoil] + / self.data.pf_coil.n_pf_coil_turns[nocoil] ) nocoil += 1 @@ -615,70 +615,70 @@ def pfcoil(self): ) / ( self.data.build.z_tf_inside_half - * pfcoil_variables.f_z_cs_tf_internal + * self.data.pf_coil.f_z_cs_tf_internal * 2.0e0 ) ) dics = csflux / ddics - pfcoil_variables.f_j_cs_start_end_flat_top = ( - (-c_cs_flat_top_end * pfcoil_variables.f_j_cs_start_pulse_end_flat_top) + self.data.pf_coil.f_j_cs_start_end_flat_top = ( + (-c_cs_flat_top_end * self.data.pf_coil.f_j_cs_start_pulse_end_flat_top) + dics ) / c_cs_flat_top_end - if np.abs(pfcoil_variables.f_j_cs_start_end_flat_top) > 1.0: + if np.abs(self.data.pf_coil.f_j_cs_start_end_flat_top) > 1.0: logger.warning( "Ratio of central solenoid overall current density at " "beginning of flat-top / end of flat-top > 1 (|f_j_cs_start_end_flat_top| > 1)" ) else: dics = 0.0e0 - pfcoil_variables.f_j_cs_start_end_flat_top = 1.0e0 + self.data.pf_coil.f_j_cs_start_end_flat_top = 1.0e0 logger.error("OH coil not present; check volt-second calculations...") # Split groups of coils into one set containing ncl coils ncl = 0 - for nng in range(pfcoil_variables.n_pf_coil_groups): - for ng2 in range(pfcoil_variables.n_pf_coils_in_group[nng]): - pfcoil_variables.r_pf_coil_middle[ncl] = ( - pfcoil_variables.r_pf_coil_middle_group_array[nng, ng2] + for nng in range(self.data.pf_coil.n_pf_coil_groups): + for ng2 in range(self.data.pf_coil.n_pf_coils_in_group[nng]): + self.data.pf_coil.r_pf_coil_middle[ncl] = ( + self.data.pf_coil.r_pf_coil_middle_group_array[nng, ng2] ) - pfcoil_variables.z_pf_coil_middle[ncl] = ( - pfcoil_variables.z_pf_coil_middle_group_array[nng, ng2] + self.data.pf_coil.z_pf_coil_middle[ncl] = ( + self.data.pf_coil.z_pf_coil_middle_group_array[nng, ng2] ) # Currents at different times: # If PF coil currents are computed, not input via ccl0_ma, ccls_ma: - # Then set ccl0_ma,ccls_ma from the computed pfcoil_variables.ccl0,pfcoil_variables.ccls - if pfcoil_variables.i_pf_current != 0: - pfcoil_variables.ccl0_ma[nng] = 1.0e-6 * pfcoil_variables.ccl0[nng] - pfcoil_variables.ccls_ma[nng] = 1.0e-6 * pfcoil_variables.ccls[nng] + # Then set ccl0_ma,ccls_ma from the computed self.data.pf_coil.ccl0,self.data.pf_coil.ccls + if self.data.pf_coil.i_pf_current != 0: + self.data.pf_coil.ccl0_ma[nng] = 1.0e-6 * self.data.pf_coil.ccl0[nng] + self.data.pf_coil.ccls_ma[nng] = 1.0e-6 * self.data.pf_coil.ccls[nng] else: - # Otherwise set pfcoil_variables.ccl0,pfcoil_variables.ccls via the input ccl0_ma and ccls_ma - pfcoil_variables.ccl0[nng] = 1.0e6 * pfcoil_variables.ccl0_ma[nng] - pfcoil_variables.ccls[nng] = 1.0e6 * pfcoil_variables.ccls_ma[nng] + # Otherwise set self.data.pf_coil.ccl0,self.data.pf_coil.ccls via the input ccl0_ma and ccls_ma + self.data.pf_coil.ccl0[nng] = 1.0e6 * self.data.pf_coil.ccl0_ma[nng] + self.data.pf_coil.ccls[nng] = 1.0e6 * self.data.pf_coil.ccls_ma[nng] # Beginning of pulse: t = self.data.times.t_plant_pulse_coil_precharge - pfcoil_variables.c_pf_cs_coil_pulse_start_ma[ncl] = ( - 1.0e-6 * pfcoil_variables.ccl0[nng] + self.data.pf_coil.c_pf_cs_coil_pulse_start_ma[ncl] = ( + 1.0e-6 * self.data.pf_coil.ccl0[nng] ) # Beginning of flat-top: t = self.data.times.t_plant_pulse_coil_precharge+self.data.times.t_plant_pulse_plasma_current_ramp_up - pfcoil_variables.c_pf_cs_coil_flat_top_ma[ncl] = 1.0e-6 * ( - pfcoil_variables.ccls[nng] + self.data.pf_coil.c_pf_cs_coil_flat_top_ma[ncl] = 1.0e-6 * ( + self.data.pf_coil.ccls[nng] - ( - pfcoil_variables.ccl0[nng] - * pfcoil_variables.f_j_cs_start_end_flat_top - / pfcoil_variables.f_j_cs_start_pulse_end_flat_top + self.data.pf_coil.ccl0[nng] + * self.data.pf_coil.f_j_cs_start_end_flat_top + / self.data.pf_coil.f_j_cs_start_pulse_end_flat_top ) ) # End of flat-top: t = self.data.times.t_plant_pulse_coil_precharge+self.data.times.t_plant_pulse_plasma_current_ramp_up+self.data.times.t_plant_pulse_fusion_ramp+self.data.times.t_plant_pulse_burn - pfcoil_variables.c_pf_cs_coil_pulse_end_ma[ncl] = 1.0e-6 * ( - pfcoil_variables.ccls[nng] + self.data.pf_coil.c_pf_cs_coil_pulse_end_ma[ncl] = 1.0e-6 * ( + self.data.pf_coil.ccls[nng] - ( - pfcoil_variables.ccl0[nng] - * (1.0e0 / pfcoil_variables.f_j_cs_start_pulse_end_flat_top) + self.data.pf_coil.ccl0[nng] + * (1.0e0 / self.data.pf_coil.f_j_cs_start_pulse_end_flat_top) ) ) @@ -686,15 +686,15 @@ def pfcoil(self): # Current in Central Solenoid as a function of time # N.B. If the Central Solenoid is not present then c_cs_flat_top_end is zero. - pfcoil_variables.c_pf_cs_coil_pulse_start_ma[ncl] = ( + self.data.pf_coil.c_pf_cs_coil_pulse_start_ma[ncl] = ( -1.0e-6 * c_cs_flat_top_end - * pfcoil_variables.f_j_cs_start_pulse_end_flat_top + * self.data.pf_coil.f_j_cs_start_pulse_end_flat_top ) - pfcoil_variables.c_pf_cs_coil_flat_top_ma[ncl] = ( - 1.0e-6 * c_cs_flat_top_end * pfcoil_variables.f_j_cs_start_end_flat_top + self.data.pf_coil.c_pf_cs_coil_flat_top_ma[ncl] = ( + 1.0e-6 * c_cs_flat_top_end * self.data.pf_coil.f_j_cs_start_end_flat_top ) - pfcoil_variables.c_pf_cs_coil_pulse_end_ma[ncl] = 1.0e-6 * c_cs_flat_top_end + self.data.pf_coil.c_pf_cs_coil_pulse_end_ma[ncl] = 1.0e-6 * c_cs_flat_top_end # Set up coil current waveforms, normalised to the peak current in # each coil @@ -704,62 +704,62 @@ def pfcoil(self): # Dimensions are those of the winding pack, and exclude # the steel supporting case i = 0 - pfcoil_variables.r_pf_coil_outer_max = 0.0e0 + self.data.pf_coil.r_pf_coil_outer_max = 0.0e0 dz = 0 - for ii in range(pfcoil_variables.n_pf_coil_groups): - for _ij in range(pfcoil_variables.n_pf_coils_in_group[ii]): - if pfcoil_variables.i_pf_location[ii] == 1: + for ii in range(self.data.pf_coil.n_pf_coil_groups): + for _ij in range(self.data.pf_coil.n_pf_coils_in_group[ii]): + if self.data.pf_coil.i_pf_location[ii] == 1: # PF coil is stacked on top of the Central Solenoid dx = 0.5e0 * self.data.build.dr_cs dz = 0.5e0 * ( self.data.build.z_tf_inside_half - * (1.0e0 - pfcoil_variables.f_z_cs_tf_internal) + * (1.0e0 - self.data.pf_coil.f_z_cs_tf_internal) + self.data.build.dr_tf_inboard + 0.1e0 ) # ??? - area = 4.0e0 * dx * dz * pfcoil_variables.pf_current_safety_factor + area = 4.0e0 * dx * dz * self.data.pf_coil.pf_current_safety_factor # Number of turns # c_pf_coil_turn_peak_input[i] is the current per turn (input) - pfcoil_variables.n_pf_coil_turns[i] = abs( - (pfcoil_variables.c_pf_cs_coils_peak_ma[i] * 1.0e6) - / pfcoil_variables.c_pf_coil_turn_peak_input[i] + self.data.pf_coil.n_pf_coil_turns[i] = abs( + (self.data.pf_coil.c_pf_cs_coils_peak_ma[i] * 1.0e6) + / self.data.pf_coil.c_pf_coil_turn_peak_input[i] ) - aturn[i] = area / pfcoil_variables.n_pf_coil_turns[i] + aturn[i] = area / self.data.pf_coil.n_pf_coil_turns[i] # Actual winding pack current density - pfcoil_variables.j_pf_coil_wp_peak[i] = ( - 1.0e6 * abs(pfcoil_variables.c_pf_cs_coils_peak_ma[i]) / area + self.data.pf_coil.j_pf_coil_wp_peak[i] = ( + 1.0e6 * abs(self.data.pf_coil.c_pf_cs_coils_peak_ma[i]) / area ) # Location of edges of each coil: # r_pf_coil_inner = inner radius, r_pf_coil_outer = outer radius # z_pf_coil_lower = 'lower' edge z (i.e. edge nearer to midplane) # z_pf_coil_upper = 'upper' edge z (i.e. edge further from midplane) - pfcoil_variables.r_pf_coil_inner[i] = ( - pfcoil_variables.r_pf_coil_middle[i] - dx + self.data.pf_coil.r_pf_coil_inner[i] = ( + self.data.pf_coil.r_pf_coil_middle[i] - dx ) - pfcoil_variables.r_pf_coil_outer[i] = ( - pfcoil_variables.r_pf_coil_middle[i] + dx + self.data.pf_coil.r_pf_coil_outer[i] = ( + self.data.pf_coil.r_pf_coil_middle[i] + dx ) - pfcoil_variables.z_pf_coil_lower[i] = ( - pfcoil_variables.z_pf_coil_middle[i] - dz + self.data.pf_coil.z_pf_coil_lower[i] = ( + self.data.pf_coil.z_pf_coil_middle[i] - dz ) - if pfcoil_variables.z_pf_coil_middle[i] < 0.0e0: - pfcoil_variables.z_pf_coil_lower[i] = ( - pfcoil_variables.z_pf_coil_middle[i] + dz + if self.data.pf_coil.z_pf_coil_middle[i] < 0.0e0: + self.data.pf_coil.z_pf_coil_lower[i] = ( + self.data.pf_coil.z_pf_coil_middle[i] + dz ) - pfcoil_variables.z_pf_coil_upper[i] = ( - pfcoil_variables.z_pf_coil_middle[i] + dz + self.data.pf_coil.z_pf_coil_upper[i] = ( + self.data.pf_coil.z_pf_coil_middle[i] + dz ) - if pfcoil_variables.z_pf_coil_middle[i] < 0.0e0: - pfcoil_variables.z_pf_coil_upper[i] = ( - pfcoil_variables.z_pf_coil_middle[i] - dz + if self.data.pf_coil.z_pf_coil_middle[i] < 0.0e0: + self.data.pf_coil.z_pf_coil_upper[i] = ( + self.data.pf_coil.z_pf_coil_middle[i] - dz ) else: @@ -767,48 +767,48 @@ def pfcoil(self): # routine INITIAL for these coils. area = ( abs( - pfcoil_variables.c_pf_cs_coils_peak_ma[i] + self.data.pf_coil.c_pf_cs_coils_peak_ma[i] * 1.0e6 - / pfcoil_variables.j_pf_coil_wp_peak[i] + / self.data.pf_coil.j_pf_coil_wp_peak[i] ) - * pfcoil_variables.pf_current_safety_factor + * self.data.pf_coil.pf_current_safety_factor ) - pfcoil_variables.n_pf_coil_turns[i] = abs( - (pfcoil_variables.c_pf_cs_coils_peak_ma[i] * 1.0e6) - / pfcoil_variables.c_pf_coil_turn_peak_input[i] + self.data.pf_coil.n_pf_coil_turns[i] = abs( + (self.data.pf_coil.c_pf_cs_coils_peak_ma[i] * 1.0e6) + / self.data.pf_coil.c_pf_coil_turn_peak_input[i] ) - aturn[i] = area / pfcoil_variables.n_pf_coil_turns[i] + aturn[i] = area / self.data.pf_coil.n_pf_coil_turns[i] dx = 0.5e0 * math.sqrt(area) # square cross-section - pfcoil_variables.r_pf_coil_inner[i] = ( - pfcoil_variables.r_pf_coil_middle[i] - dx + self.data.pf_coil.r_pf_coil_inner[i] = ( + self.data.pf_coil.r_pf_coil_middle[i] - dx ) - pfcoil_variables.r_pf_coil_outer[i] = ( - pfcoil_variables.r_pf_coil_middle[i] + dx + self.data.pf_coil.r_pf_coil_outer[i] = ( + self.data.pf_coil.r_pf_coil_middle[i] + dx ) - pfcoil_variables.z_pf_coil_lower[i] = ( - pfcoil_variables.z_pf_coil_middle[i] - dx + self.data.pf_coil.z_pf_coil_lower[i] = ( + self.data.pf_coil.z_pf_coil_middle[i] - dx ) - if pfcoil_variables.z_pf_coil_middle[i] < 0.0e0: - pfcoil_variables.z_pf_coil_lower[i] = ( - pfcoil_variables.z_pf_coil_middle[i] + dx + if self.data.pf_coil.z_pf_coil_middle[i] < 0.0e0: + self.data.pf_coil.z_pf_coil_lower[i] = ( + self.data.pf_coil.z_pf_coil_middle[i] + dx ) - pfcoil_variables.z_pf_coil_upper[i] = ( - pfcoil_variables.z_pf_coil_middle[i] + dx + self.data.pf_coil.z_pf_coil_upper[i] = ( + self.data.pf_coil.z_pf_coil_middle[i] + dx ) - if pfcoil_variables.z_pf_coil_middle[i] < 0.0e0: - pfcoil_variables.z_pf_coil_upper[i] = ( - pfcoil_variables.z_pf_coil_middle[i] - dx + if self.data.pf_coil.z_pf_coil_middle[i] < 0.0e0: + self.data.pf_coil.z_pf_coil_upper[i] = ( + self.data.pf_coil.z_pf_coil_middle[i] - dx ) # Outside radius of largest PF coil (m) - pfcoil_variables.r_pf_coil_outer_max = max( - pfcoil_variables.r_pf_coil_outer_max, - pfcoil_variables.r_pf_coil_outer[i], + self.data.pf_coil.r_pf_coil_outer_max = max( + self.data.pf_coil.r_pf_coil_outer_max, + self.data.pf_coil.r_pf_coil_outer[i], ) i += 1 @@ -817,12 +817,12 @@ def pfcoil(self): # power losses and volumes and weights for each PF coil, index i i = 0 it = 0 - pfcoil_variables.p_pf_coil_resistive_total_flat_top = 0.0e0 - pfcoil_variables.m_pf_coil_max = 0.0e0 + self.data.pf_coil.p_pf_coil_resistive_total_flat_top = 0.0e0 + self.data.pf_coil.m_pf_coil_max = 0.0e0 - for ii in range(pfcoil_variables.n_pf_coil_groups): + for ii in range(self.data.pf_coil.n_pf_coil_groups): iii = ii - for ij in range(pfcoil_variables.n_pf_coils_in_group[ii]): + for ij in range(self.data.pf_coil.n_pf_coils_in_group[ii]): # Peak field if ij == 0: @@ -836,19 +836,19 @@ def pfcoil(self): # Issue 1871. MDK # Allowable current density (for superconducting coils) for each coil, index i - if pfcoil_variables.i_pf_conductor == 0: + if self.data.pf_coil.i_pf_conductor == 0: bmax = max( - abs(pfcoil_variables.b_pf_coil_peak[i]), - abs(pfcoil_variables.bpf2[i]), + abs(self.data.pf_coil.b_pf_coil_peak[i]), + abs(self.data.pf_coil.bpf2[i]), ) - pfcoil_variables.j_pf_wp_critical[i], _jstrand, jsc, _tmarg = ( + self.data.pf_coil.j_pf_wp_critical[i], _jstrand, jsc, _tmarg = ( superconpf( bmax, - pfcoil_variables.f_a_pf_coil_void[i], - pfcoil_variables.fcupfsu, - pfcoil_variables.j_pf_coil_wp_peak[i], - pfcoil_variables.i_pf_superconductor, + self.data.pf_coil.f_a_pf_coil_void[i], + self.data.pf_coil.fcupfsu, + self.data.pf_coil.j_pf_coil_wp_peak[i], + self.data.pf_coil.i_pf_superconductor, tfv.fhts, tfv.str_pf_con_res, tfv.tftmp, @@ -859,11 +859,11 @@ def pfcoil(self): # Strand critical current calculation for costing in $/kAm # = superconducting filaments jc * (1 - strand copper fraction) - if pfcoil_variables.i_cs_superconductor in {2, 6, 8}: - pfcoil_variables.j_crit_str_pf = jsc + if self.data.pf_coil.i_cs_superconductor in {2, 6, 8}: + self.data.pf_coil.j_crit_str_pf = jsc else: - pfcoil_variables.j_crit_str_pf = jsc * ( - 1 - pfcoil_variables.fcupfsu + self.data.pf_coil.j_crit_str_pf = jsc * ( + 1 - self.data.pf_coil.fcupfsu ) # Length of conductor @@ -871,29 +871,29 @@ def pfcoil(self): rll = ( 2.0e0 * np.pi - * pfcoil_variables.r_pf_coil_middle[i] - * pfcoil_variables.n_pf_coil_turns[i] + * self.data.pf_coil.r_pf_coil_middle[i] + * self.data.pf_coil.n_pf_coil_turns[i] ) # Resistive coils - if pfcoil_variables.i_pf_conductor == 1: + if self.data.pf_coil.i_pf_conductor == 1: # Coil resistance (f_a_pf_coil_void is the void fraction) respf = ( - pfcoil_variables.rho_pf_coil + self.data.pf_coil.rho_pf_coil * rll - / (aturn[i] * (1.0e0 - pfcoil_variables.f_a_pf_coil_void[i])) + / (aturn[i] * (1.0e0 - self.data.pf_coil.f_a_pf_coil_void[i])) ) # Sum resistive power losses - pfcoil_variables.p_pf_coil_resistive_total_flat_top += ( + self.data.pf_coil.p_pf_coil_resistive_total_flat_top += ( respf * ( 1.0e6 - * pfcoil_variables.c_pf_cs_coil_pulse_start_ma[i] - / pfcoil_variables.n_pf_coil_turns[i] + * self.data.pf_coil.c_pf_cs_coil_pulse_start_ma[i] + / self.data.pf_coil.n_pf_coil_turns[i] ) ** 2 ) @@ -904,40 +904,40 @@ def pfcoil(self): # Conductor weight (f_a_pf_coil_void is the void fraction) - if pfcoil_variables.i_pf_conductor == 0: - pfcoil_variables.m_pf_coil_conductor[i] = ( + if self.data.pf_coil.i_pf_conductor == 0: + self.data.pf_coil.m_pf_coil_conductor[i] = ( volpf - * tfv.dcond[pfcoil_variables.i_pf_superconductor - 1] - * (1.0e0 - pfcoil_variables.f_a_pf_coil_void[i]) + * tfv.dcond[self.data.pf_coil.i_pf_superconductor - 1] + * (1.0e0 - self.data.pf_coil.f_a_pf_coil_void[i]) ) else: - pfcoil_variables.m_pf_coil_conductor[i] = ( + self.data.pf_coil.m_pf_coil_conductor[i] = ( volpf * constants.den_copper - * (1.0e0 - pfcoil_variables.f_a_pf_coil_void[i]) + * (1.0e0 - self.data.pf_coil.f_a_pf_coil_void[i]) ) # (J x B) force on coil forcepf = ( 0.5e6 - * (pfcoil_variables.b_pf_coil_peak[i] + pfcoil_variables.bpf2[i]) - * abs(pfcoil_variables.c_pf_cs_coils_peak_ma[i]) - * pfcoil_variables.r_pf_coil_middle[i] + * (self.data.pf_coil.b_pf_coil_peak[i] + self.data.pf_coil.bpf2[i]) + * abs(self.data.pf_coil.c_pf_cs_coils_peak_ma[i]) + * self.data.pf_coil.r_pf_coil_middle[i] ) # Stress ==> cross-sectional area of supporting steel to use - if pfcoil_variables.i_pf_conductor == 0: + if self.data.pf_coil.i_pf_conductor == 0: # Superconducting coil # Updated assumptions: 500 MPa stress limit with all of the force # supported in the conduit (steel) case. # Now, 500 MPa replaced by sigpfcalw, sigpfcf now defaultly set to 1 areaspf = ( - pfcoil_variables.sigpfcf + self.data.pf_coil.sigpfcf * forcepf - / (pfcoil_variables.sigpfcalw * 1.0e6) + / (self.data.pf_coil.sigpfcalw * 1.0e6) ) # Thickness of hypothetical steel casing assumed to encase the PF @@ -947,40 +947,40 @@ def pfcoil(self): # Thickness found via a simple quadratic equation drpdz = ( - pfcoil_variables.r_pf_coil_outer[i] - - pfcoil_variables.r_pf_coil_inner[i] + self.data.pf_coil.r_pf_coil_outer[i] + - self.data.pf_coil.r_pf_coil_inner[i] + abs( - pfcoil_variables.z_pf_coil_upper[i] - - pfcoil_variables.z_pf_coil_lower[i] + self.data.pf_coil.z_pf_coil_upper[i] + - self.data.pf_coil.z_pf_coil_lower[i] ) ) # dr + dz - pfcoil_variables.pfcaseth[i] = 0.25e0 * ( + self.data.pf_coil.pfcaseth[i] = 0.25e0 * ( -drpdz + math.sqrt(drpdz * drpdz + 4.0e0 * areaspf) ) else: areaspf = 0.0e0 # Resistive coil - no steel needed - pfcoil_variables.pfcaseth[i] = 0.0e0 + self.data.pf_coil.pfcaseth[i] = 0.0e0 # Weight of steel case - pfcoil_variables.m_pf_coil_structure[i] = ( + self.data.pf_coil.m_pf_coil_structure[i] = ( areaspf * 2.0e0 * np.pi - * pfcoil_variables.r_pf_coil_middle[i] + * self.data.pf_coil.r_pf_coil_middle[i] * self.data.fwbs.den_steel ) # Mass of heaviest PF coil (tonnes) - pfcoil_variables.m_pf_coil_max = max( - pfcoil_variables.m_pf_coil_max, + self.data.pf_coil.m_pf_coil_max = max( + self.data.pf_coil.m_pf_coil_max, ( 1.0e-3 * ( - pfcoil_variables.m_pf_coil_conductor[i] - + pfcoil_variables.m_pf_coil_structure[i] + self.data.pf_coil.m_pf_coil_conductor[i] + + self.data.pf_coil.m_pf_coil_structure[i] ) ), ) @@ -988,21 +988,21 @@ def pfcoil(self): # Find sum of current x turns x radius for all coils for 2015 costs model c = 0 - pfcoil_variables.itr_sum = 0.0e0 - for m in range(pfcoil_variables.n_pf_coil_groups): - for _n in range(pfcoil_variables.n_pf_coils_in_group[m]): - pfcoil_variables.itr_sum += ( - pfcoil_variables.r_pf_coil_middle[c] - * pfcoil_variables.n_pf_coil_turns[c] - * pfcoil_variables.c_pf_coil_turn_peak_input[c] + self.data.pf_coil.itr_sum = 0.0e0 + for m in range(self.data.pf_coil.n_pf_coil_groups): + for _n in range(self.data.pf_coil.n_pf_coils_in_group[m]): + self.data.pf_coil.itr_sum += ( + self.data.pf_coil.r_pf_coil_middle[c] + * self.data.pf_coil.n_pf_coil_turns[c] + * self.data.pf_coil.c_pf_coil_turn_peak_input[c] ) c += 1 - pfcoil_variables.itr_sum += ( + self.data.pf_coil.itr_sum += ( (self.data.build.dr_bore + 0.5 * self.data.build.dr_cs) - * pfcoil_variables.n_pf_coil_turns[pfcoil_variables.n_cs_pf_coils - 1] - * pfcoil_variables.c_pf_coil_turn_peak_input[ - pfcoil_variables.n_cs_pf_coils - 1 + * self.data.pf_coil.n_pf_coil_turns[self.data.pf_coil.n_cs_pf_coils - 1] + * self.data.pf_coil.c_pf_coil_turn_peak_input[ + self.data.pf_coil.n_cs_pf_coils - 1 ] ) @@ -1011,64 +1011,64 @@ def pfcoil(self): self.cs_coil.ohcalc() # Summation of weights and current - pfcoil_variables.m_pf_coil_conductor_total = 0.0e0 - pfcoil_variables.m_pf_coil_structure_total = 0.0e0 - pfcoil_variables.ricpf = 0.0e0 + self.data.pf_coil.m_pf_coil_conductor_total = 0.0e0 + self.data.pf_coil.m_pf_coil_structure_total = 0.0e0 + self.data.pf_coil.ricpf = 0.0e0 - for i in range(pfcoil_variables.n_cs_pf_coils): - pfcoil_variables.m_pf_coil_conductor_total += ( - pfcoil_variables.m_pf_coil_conductor[i] + for i in range(self.data.pf_coil.n_cs_pf_coils): + self.data.pf_coil.m_pf_coil_conductor_total += ( + self.data.pf_coil.m_pf_coil_conductor[i] ) - pfcoil_variables.m_pf_coil_structure_total += ( - pfcoil_variables.m_pf_coil_structure[i] + self.data.pf_coil.m_pf_coil_structure_total += ( + self.data.pf_coil.m_pf_coil_structure[i] ) - pfcoil_variables.ricpf += abs(pfcoil_variables.c_pf_cs_coils_peak_ma[i]) + self.data.pf_coil.ricpf += abs(self.data.pf_coil.c_pf_cs_coils_peak_ma[i]) # Plasma size and shape - pfcoil_variables.z_pf_coil_upper[pfcoil_variables.n_cs_pf_coils] = ( + self.data.pf_coil.z_pf_coil_upper[self.data.pf_coil.n_cs_pf_coils] = ( pv.rminor * pv.kappa ) - pfcoil_variables.z_pf_coil_lower[pfcoil_variables.n_cs_pf_coils] = ( + self.data.pf_coil.z_pf_coil_lower[self.data.pf_coil.n_cs_pf_coils] = ( -pv.rminor * pv.kappa ) - pfcoil_variables.r_pf_coil_inner[pfcoil_variables.n_cs_pf_coils] = ( + self.data.pf_coil.r_pf_coil_inner[self.data.pf_coil.n_cs_pf_coils] = ( pv.rmajor - pv.rminor ) - pfcoil_variables.r_pf_coil_outer[pfcoil_variables.n_cs_pf_coils] = ( + self.data.pf_coil.r_pf_coil_outer[self.data.pf_coil.n_cs_pf_coils] = ( pv.rmajor + pv.rminor ) - pfcoil_variables.n_pf_coil_turns[pfcoil_variables.n_cs_pf_coils] = 1.0e0 + self.data.pf_coil.n_pf_coil_turns[self.data.pf_coil.n_cs_pf_coils] = 1.0e0 # Generate coil currents as a function of time using # user-provided waveforms etc. (c_pf_coil_turn_peak_input, f_j_cs_start_pulse_end_flat_top, f_j_cs_start_end_flat_top) for k in range(6): # time points - for i in range(pfcoil_variables.n_pf_cs_plasma_circuits - 1): - pfcoil_variables.c_pf_coil_turn[i, k] = ( - pfcoil_variables.f_c_pf_cs_peak_time_array[i, k] + for i in range(self.data.pf_coil.n_pf_cs_plasma_circuits - 1): + self.data.pf_coil.c_pf_coil_turn[i, k] = ( + self.data.pf_coil.f_c_pf_cs_peak_time_array[i, k] * math.copysign( - pfcoil_variables.c_pf_coil_turn_peak_input[i], - pfcoil_variables.c_pf_cs_coils_peak_ma[i], + self.data.pf_coil.c_pf_coil_turn_peak_input[i], + self.data.pf_coil.c_pf_cs_coils_peak_ma[i], ) ) # Plasma wave form - pfcoil_variables.c_pf_coil_turn[ - pfcoil_variables.n_pf_cs_plasma_circuits - 1, 0 + self.data.pf_coil.c_pf_coil_turn[ + self.data.pf_coil.n_pf_cs_plasma_circuits - 1, 0 ] = 0.0e0 - pfcoil_variables.c_pf_coil_turn[ - pfcoil_variables.n_pf_cs_plasma_circuits - 1, 1 + self.data.pf_coil.c_pf_coil_turn[ + self.data.pf_coil.n_pf_cs_plasma_circuits - 1, 1 ] = 0.0e0 - pfcoil_variables.c_pf_coil_turn[ - pfcoil_variables.n_pf_cs_plasma_circuits - 1, 2 + self.data.pf_coil.c_pf_coil_turn[ + self.data.pf_coil.n_pf_cs_plasma_circuits - 1, 2 ] = pv.plasma_current - pfcoil_variables.c_pf_coil_turn[ - pfcoil_variables.n_pf_cs_plasma_circuits - 1, 3 + self.data.pf_coil.c_pf_coil_turn[ + self.data.pf_coil.n_pf_cs_plasma_circuits - 1, 3 ] = pv.plasma_current - pfcoil_variables.c_pf_coil_turn[ - pfcoil_variables.n_pf_cs_plasma_circuits - 1, 4 + self.data.pf_coil.c_pf_coil_turn[ + self.data.pf_coil.n_pf_cs_plasma_circuits - 1, 4 ] = pv.plasma_current - pfcoil_variables.c_pf_coil_turn[ - pfcoil_variables.n_pf_cs_plasma_circuits - 1, 5 + self.data.pf_coil.c_pf_coil_turn[ + self.data.pf_coil.n_pf_cs_plasma_circuits - 1, 5 ] = 0.0e0 def place_pf_above_cs( @@ -1107,12 +1107,12 @@ def place_pf_above_cs( """ # Initialise as empty arrays; will be resized in the loop r_pf_coil_middle_group_array = np.zeros(( - pfcoil_variables.n_pf_coil_groups, - pfcoil_variables.N_PF_COILS_IN_GROUP_MAX, + self.data.pf_coil.n_pf_coil_groups, + N_PF_COILS_IN_GROUP_MAX, )) z_pf_coil_middle_group_array = np.zeros(( - pfcoil_variables.n_pf_coil_groups, - pfcoil_variables.N_PF_COILS_IN_GROUP_MAX, + self.data.pf_coil.n_pf_coil_groups, + N_PF_COILS_IN_GROUP_MAX, )) for coil in range(n_pf_coils_in_group[n_pf_group]): @@ -1187,12 +1187,12 @@ def place_pf_above_tf( """ # Initialise as empty arrays; will be resized in the loop r_pf_coil_middle_group_array = np.zeros(( - pfcoil_variables.n_pf_coil_groups, - pfcoil_variables.N_PF_COILS_IN_GROUP_MAX, + self.data.pf_coil.n_pf_coil_groups, + N_PF_COILS_IN_GROUP_MAX, )) z_pf_coil_middle_group_array = np.zeros(( - pfcoil_variables.n_pf_coil_groups, - pfcoil_variables.N_PF_COILS_IN_GROUP_MAX, + self.data.pf_coil.n_pf_coil_groups, + N_PF_COILS_IN_GROUP_MAX, )) for coil in range(n_pf_coils_in_group[n_pf_group]): @@ -1254,12 +1254,12 @@ def place_pf_outside_tf( """ # Initialise as empty arrays; will be resized in the loop r_pf_coil_middle_group_array = np.zeros(( - pfcoil_variables.n_pf_coil_groups, - pfcoil_variables.N_PF_COILS_IN_GROUP_MAX, + self.data.pf_coil.n_pf_coil_groups, + N_PF_COILS_IN_GROUP_MAX, )) z_pf_coil_middle_group_array = np.zeros(( - pfcoil_variables.n_pf_coil_groups, - pfcoil_variables.N_PF_COILS_IN_GROUP_MAX, + self.data.pf_coil.n_pf_coil_groups, + N_PF_COILS_IN_GROUP_MAX, )) # PF coil is radially outside the TF coil @@ -1284,7 +1284,7 @@ def place_pf_outside_tf( ) if np.isinf(r_pf_coil_middle_group_array[n_pf_group, coil]): logger.error( - "Element of pfcoil_variables.r_pf_coil_middle_group_array is inf. Kludging to 1e10." + "Element of self.data.pf_coil.r_pf_coil_middle_group_array is inf. Kludging to 1e10." ) r_pf_coil_middle_group_array[n_pf_group, coil] = 1e10 return ( @@ -1324,12 +1324,12 @@ def place_pf_generally( Tuple containing arrays of radial and vertical positions of PF coil centers for the specified group. """ r_pf_coil_middle_group_array: np.ndarray = np.zeros(( - pfcoil_variables.n_pf_coil_groups, - pfcoil_variables.N_PF_COILS_IN_GROUP_MAX, + self.data.pf_coil.n_pf_coil_groups, + N_PF_COILS_IN_GROUP_MAX, )) z_pf_coil_middle_group_array: np.ndarray = np.zeros(( - pfcoil_variables.n_pf_coil_groups, - pfcoil_variables.N_PF_COILS_IN_GROUP_MAX, + self.data.pf_coil.n_pf_coil_groups, + N_PF_COILS_IN_GROUP_MAX, )) for coil in range(n_pf_coils_in_group[n_pf_group]): @@ -1440,13 +1440,11 @@ def efc( z_pf_coil_middle_group_array, alfa, bfix, - int(pfcoil_variables.N_PF_COILS_IN_GROUP_MAX), + int(N_PF_COILS_IN_GROUP_MAX), ) # Solve matrix equation - ccls = self.solv( - pfcoil_variables.N_PF_GROUPS_MAX, n_pf_coil_groups, nrws, gmat, bvec - ) + ccls = self.solv(N_PF_GROUPS_MAX, n_pf_coil_groups, nrws, gmat, bvec) # Calculate the norm of the residual vectors _brssq, _brnrm, _bzssq, _bznrm, ssq = rsid( @@ -1463,22 +1461,22 @@ def tf_pf_collision_detector(self): if tfv.i_tf_shape == 2: pf_tf_collision = 0 - for i in range(pfcoil_variables.n_pf_coil_groups): - for ii in range(pfcoil_variables.n_pf_coil_groups): - for ij in range(pfcoil_variables.n_pf_coils_in_group[ii]): - if pfcoil_variables.r_pf_coil_middle_group_array[ + for i in range(self.data.pf_coil.n_pf_coil_groups): + for ii in range(self.data.pf_coil.n_pf_coil_groups): + for ij in range(self.data.pf_coil.n_pf_coils_in_group[ii]): + if self.data.pf_coil.r_pf_coil_middle_group_array[ ii, ij ] <= ( # Outboard TF coil collision - pfcoil_variables.r_pf_outside_tf_midplane - - pfcoil_variables.dr_pf_tf_outboard_out_offset - + pfcoil_variables.r_pf_coil_middle[i] - ) and pfcoil_variables.r_pf_coil_middle_group_array[ii, ij] >= ( + self.data.pf_coil.r_pf_outside_tf_midplane + - self.data.pf_coil.dr_pf_tf_outboard_out_offset + + self.data.pf_coil.r_pf_coil_middle[i] + ) and self.data.pf_coil.r_pf_coil_middle_group_array[ii, ij] >= ( self.data.build.r_tf_outboard_mid - (0.5 * self.data.build.dr_tf_outboard) - - pfcoil_variables.r_pf_coil_middle[i] + - self.data.pf_coil.r_pf_coil_middle[i] ): pf_tf_collision += 1 - if pfcoil_variables.r_pf_coil_middle_group_array[ + if self.data.pf_coil.r_pf_coil_middle_group_array[ ii, ij ] <= ( # Inboard TF coil collision self.data.build.dr_bore @@ -1486,25 +1484,25 @@ def tf_pf_collision_detector(self): + self.data.build.dr_cs_precomp + self.data.build.dr_cs_tf_gap + self.data.build.dr_tf_inboard - + pfcoil_variables.r_pf_coil_middle[i] - ) and pfcoil_variables.r_pf_coil_middle_group_array[ii, ij] >= ( + + self.data.pf_coil.r_pf_coil_middle[i] + ) and self.data.pf_coil.r_pf_coil_middle_group_array[ii, ij] >= ( self.data.build.dr_bore + self.data.build.dr_cs + self.data.build.dr_cs_precomp + self.data.build.dr_cs_tf_gap - - pfcoil_variables.r_pf_coil_middle[i] + - self.data.pf_coil.r_pf_coil_middle[i] ): pf_tf_collision += 1 if ( # Vertical TF coil collision - abs(pfcoil_variables.z_pf_coil_middle_group_array[ii, ij]) + abs(self.data.pf_coil.z_pf_coil_middle_group_array[ii, ij]) <= self.data.build.z_tf_top - + pfcoil_variables.r_pf_coil_middle[i] + + self.data.pf_coil.r_pf_coil_middle[i] and abs( - pfcoil_variables.z_pf_coil_middle_group_array[ii, ij] + self.data.pf_coil.z_pf_coil_middle_group_array[ii, ij] ) >= self.data.build.z_tf_top - (0.5 * self.data.build.dr_tf_outboard) - - pfcoil_variables.r_pf_coil_middle[i] + - self.data.pf_coil.r_pf_coil_middle[i] ): pf_tf_collision += 1 @@ -1569,101 +1567,101 @@ def vsec(self): """ if self.data.build.iohcl == 0: # No Central Solenoid - pfcoil_variables.nef = pfcoil_variables.n_pf_cs_plasma_circuits - 1 + self.data.pf_coil.nef = self.data.pf_coil.n_pf_cs_plasma_circuits - 1 else: - pfcoil_variables.nef = pfcoil_variables.n_pf_cs_plasma_circuits - 2 + self.data.pf_coil.nef = self.data.pf_coil.n_pf_cs_plasma_circuits - 2 - pfcoil_variables.vs_pf_coils_total_ramp = 0.0e0 + self.data.pf_coil.vs_pf_coils_total_ramp = 0.0e0 - for i in range(pfcoil_variables.nef): - pfcoil_variables.vsdum[i, 0] = ( - pfcoil_variables.ind_pf_cs_plasma_mutual[ - pfcoil_variables.n_pf_cs_plasma_circuits - 1, i + for i in range(self.data.pf_coil.nef): + self.data.pf_coil.vsdum[i, 0] = ( + self.data.pf_coil.ind_pf_cs_plasma_mutual[ + self.data.pf_coil.n_pf_cs_plasma_circuits - 1, i ] - * pfcoil_variables.c_pf_coil_turn[i, 1] + * self.data.pf_coil.c_pf_coil_turn[i, 1] ) - pfcoil_variables.vsdum[i, 1] = ( - pfcoil_variables.ind_pf_cs_plasma_mutual[ - pfcoil_variables.n_pf_cs_plasma_circuits - 1, i + self.data.pf_coil.vsdum[i, 1] = ( + self.data.pf_coil.ind_pf_cs_plasma_mutual[ + self.data.pf_coil.n_pf_cs_plasma_circuits - 1, i ] - * pfcoil_variables.c_pf_coil_turn[i, 2] + * self.data.pf_coil.c_pf_coil_turn[i, 2] ) - pfcoil_variables.vs_pf_coils_total_ramp += ( - pfcoil_variables.vsdum[i, 1] - pfcoil_variables.vsdum[i, 0] + self.data.pf_coil.vs_pf_coils_total_ramp += ( + self.data.pf_coil.vsdum[i, 1] - self.data.pf_coil.vsdum[i, 0] ) # Central Solenoid startup volt-seconds if self.data.build.iohcl != 0: - pfcoil_variables.vsdum[pfcoil_variables.n_cs_pf_coils - 1, 0] = ( - pfcoil_variables.ind_pf_cs_plasma_mutual[ - pfcoil_variables.n_pf_cs_plasma_circuits - 1, - pfcoil_variables.n_pf_cs_plasma_circuits - 2, + self.data.pf_coil.vsdum[self.data.pf_coil.n_cs_pf_coils - 1, 0] = ( + self.data.pf_coil.ind_pf_cs_plasma_mutual[ + self.data.pf_coil.n_pf_cs_plasma_circuits - 1, + self.data.pf_coil.n_pf_cs_plasma_circuits - 2, ] - * pfcoil_variables.c_pf_coil_turn[ - pfcoil_variables.n_pf_cs_plasma_circuits - 2, 1 + * self.data.pf_coil.c_pf_coil_turn[ + self.data.pf_coil.n_pf_cs_plasma_circuits - 2, 1 ] ) - pfcoil_variables.vsdum[pfcoil_variables.n_cs_pf_coils - 1, 1] = ( - pfcoil_variables.ind_pf_cs_plasma_mutual[ - pfcoil_variables.n_pf_cs_plasma_circuits - 1, - pfcoil_variables.n_pf_cs_plasma_circuits - 2, + self.data.pf_coil.vsdum[self.data.pf_coil.n_cs_pf_coils - 1, 1] = ( + self.data.pf_coil.ind_pf_cs_plasma_mutual[ + self.data.pf_coil.n_pf_cs_plasma_circuits - 1, + self.data.pf_coil.n_pf_cs_plasma_circuits - 2, ] - * pfcoil_variables.c_pf_coil_turn[ - pfcoil_variables.n_pf_cs_plasma_circuits - 2, 2 + * self.data.pf_coil.c_pf_coil_turn[ + self.data.pf_coil.n_pf_cs_plasma_circuits - 2, 2 ] ) - pfcoil_variables.vs_cs_ramp = ( - pfcoil_variables.vsdum[pfcoil_variables.n_cs_pf_coils - 1, 1] - - pfcoil_variables.vsdum[pfcoil_variables.n_cs_pf_coils - 1, 0] + self.data.pf_coil.vs_cs_ramp = ( + self.data.pf_coil.vsdum[self.data.pf_coil.n_cs_pf_coils - 1, 1] + - self.data.pf_coil.vsdum[self.data.pf_coil.n_cs_pf_coils - 1, 0] ) # Total available volt-seconds for start-up - pfcoil_variables.vs_cs_pf_total_ramp = ( - pfcoil_variables.vs_cs_ramp + pfcoil_variables.vs_pf_coils_total_ramp + self.data.pf_coil.vs_cs_pf_total_ramp = ( + self.data.pf_coil.vs_cs_ramp + self.data.pf_coil.vs_pf_coils_total_ramp ) # Burn volt-seconds if self.data.build.iohcl != 0: - pfcoil_variables.vsdum[pfcoil_variables.n_cs_pf_coils - 1, 2] = ( - pfcoil_variables.ind_pf_cs_plasma_mutual[ - pfcoil_variables.n_pf_cs_plasma_circuits - 1, - pfcoil_variables.n_pf_cs_plasma_circuits - 2, + self.data.pf_coil.vsdum[self.data.pf_coil.n_cs_pf_coils - 1, 2] = ( + self.data.pf_coil.ind_pf_cs_plasma_mutual[ + self.data.pf_coil.n_pf_cs_plasma_circuits - 1, + self.data.pf_coil.n_pf_cs_plasma_circuits - 2, ] - * pfcoil_variables.c_pf_coil_turn[ - pfcoil_variables.n_pf_cs_plasma_circuits - 2, 4 + * self.data.pf_coil.c_pf_coil_turn[ + self.data.pf_coil.n_pf_cs_plasma_circuits - 2, 4 ] ) - pfcoil_variables.vs_cs_burn = ( - pfcoil_variables.vsdum[pfcoil_variables.n_cs_pf_coils - 1, 2] - - pfcoil_variables.vsdum[pfcoil_variables.n_cs_pf_coils - 1, 1] + self.data.pf_coil.vs_cs_burn = ( + self.data.pf_coil.vsdum[self.data.pf_coil.n_cs_pf_coils - 1, 2] + - self.data.pf_coil.vsdum[self.data.pf_coil.n_cs_pf_coils - 1, 1] ) # PF volt-seconds during burn - pfcoil_variables.vs_pf_coils_total_burn = 0.0e0 - for i in range(pfcoil_variables.nef): - pfcoil_variables.vsdum[i, 2] = ( - pfcoil_variables.ind_pf_cs_plasma_mutual[ - pfcoil_variables.n_pf_cs_plasma_circuits - 1, i + self.data.pf_coil.vs_pf_coils_total_burn = 0.0e0 + for i in range(self.data.pf_coil.nef): + self.data.pf_coil.vsdum[i, 2] = ( + self.data.pf_coil.ind_pf_cs_plasma_mutual[ + self.data.pf_coil.n_pf_cs_plasma_circuits - 1, i ] - * pfcoil_variables.c_pf_coil_turn[i, 4] + * self.data.pf_coil.c_pf_coil_turn[i, 4] ) - pfcoil_variables.vs_pf_coils_total_burn += ( - pfcoil_variables.vsdum[i, 2] - pfcoil_variables.vsdum[i, 1] + self.data.pf_coil.vs_pf_coils_total_burn += ( + self.data.pf_coil.vsdum[i, 2] - self.data.pf_coil.vsdum[i, 1] ) - pfcoil_variables.vs_cs_pf_total_burn = ( - pfcoil_variables.vs_cs_burn + pfcoil_variables.vs_pf_coils_total_burn + self.data.pf_coil.vs_cs_pf_total_burn = ( + self.data.pf_coil.vs_cs_burn + self.data.pf_coil.vs_pf_coils_total_burn ) - pfcoil_variables.vs_cs_pf_total_pulse = ( - pfcoil_variables.vs_cs_pf_total_ramp + pfcoil_variables.vs_cs_pf_total_burn + self.data.pf_coil.vs_cs_pf_total_pulse = ( + self.data.pf_coil.vs_cs_pf_total_ramp + self.data.pf_coil.vs_cs_pf_total_burn ) - pfcoil_variables.vs_pf_coils_total_pulse = ( - pfcoil_variables.vs_pf_coils_total_ramp - + pfcoil_variables.vs_pf_coils_total_burn + self.data.pf_coil.vs_pf_coils_total_pulse = ( + self.data.pf_coil.vs_pf_coils_total_ramp + + self.data.pf_coil.vs_pf_coils_total_burn ) - pfcoil_variables.vs_cs_total_pulse = ( - pfcoil_variables.vs_cs_burn + pfcoil_variables.vs_cs_ramp + self.data.pf_coil.vs_cs_total_pulse = ( + self.data.pf_coil.vs_cs_burn + self.data.pf_coil.vs_cs_ramp ) def induct(self, output): @@ -1684,16 +1682,16 @@ def induct(self, output): _br = 0.0 _bz = 0.0 _psi = 0.0 - rc = np.zeros(pfcoil_variables.NGC2 + nohmax) - zc = np.zeros(pfcoil_variables.NGC2 + nohmax) - xc = np.zeros(pfcoil_variables.NGC2 + nohmax) - cc = np.zeros(pfcoil_variables.NGC2 + nohmax) - xcin = np.zeros(pfcoil_variables.NGC2 + nohmax) - xcout = np.zeros(pfcoil_variables.NGC2 + nohmax) + rc = np.zeros(NGC2 + nohmax) + zc = np.zeros(NGC2 + nohmax) + xc = np.zeros(NGC2 + nohmax) + cc = np.zeros(NGC2 + nohmax) + xcin = np.zeros(NGC2 + nohmax) + xcout = np.zeros(NGC2 + nohmax) rplasma = np.zeros(nplas) zplasma = np.zeros(nplas) - pfcoil_variables.ind_pf_cs_plasma_mutual[:, :] = 0.0 + self.data.pf_coil.ind_pf_cs_plasma_mutual[:, :] = 0.0 # Break Central Solenoid into noh segments # @@ -1703,10 +1701,10 @@ def induct(self, output): noh = math.ceil( 2.0e0 - * pfcoil_variables.z_pf_coil_upper[pfcoil_variables.n_cs_pf_coils - 1] + * self.data.pf_coil.z_pf_coil_upper[self.data.pf_coil.n_cs_pf_coils - 1] / ( - pfcoil_variables.r_pf_coil_outer[pfcoil_variables.n_cs_pf_coils - 1] - - pfcoil_variables.r_pf_coil_inner[pfcoil_variables.n_cs_pf_coils - 1] + self.data.pf_coil.r_pf_coil_outer[self.data.pf_coil.n_cs_pf_coils - 1] + - self.data.pf_coil.r_pf_coil_inner[self.data.pf_coil.n_cs_pf_coils - 1] ) ) @@ -1726,16 +1724,16 @@ def induct(self, output): zoh = np.zeros(noh) if self.data.build.iohcl != 0: - roh[:] = pfcoil_variables.r_cs_middle + roh[:] = self.data.pf_coil.r_cs_middle delzoh = ( 2.0e0 - * pfcoil_variables.z_pf_coil_upper[pfcoil_variables.n_cs_pf_coils - 1] + * self.data.pf_coil.z_pf_coil_upper[self.data.pf_coil.n_cs_pf_coils - 1] / noh ) # z_pf_coil_upper(n_cs_pf_coils) is the half-height of the coil for i in range(noh): - zoh[i] = pfcoil_variables.z_pf_coil_upper[ - pfcoil_variables.n_cs_pf_coils - 1 + zoh[i] = self.data.pf_coil.z_pf_coil_upper[ + self.data.pf_coil.n_cs_pf_coils - 1 ] - delzoh * (0.5e0 + i) rplasma[0] = pv.rmajor # assumes nplas==1 @@ -1789,36 +1787,36 @@ def induct(self, output): xc[ii] = 0.5e0 * (xcin[ii] + xcout[ii]) xohpl += xc[ii] - pfcoil_variables.ind_pf_cs_plasma_mutual[ - pfcoil_variables.n_pf_cs_plasma_circuits - 1, - pfcoil_variables.n_cs_pf_coils - 1, + self.data.pf_coil.ind_pf_cs_plasma_mutual[ + self.data.pf_coil.n_pf_cs_plasma_circuits - 1, + self.data.pf_coil.n_cs_pf_coils - 1, ] = ( xohpl / (nplas * noh) - * pfcoil_variables.n_pf_coil_turns[pfcoil_variables.n_cs_pf_coils - 1] + * self.data.pf_coil.n_pf_coil_turns[self.data.pf_coil.n_cs_pf_coils - 1] ) - pfcoil_variables.ind_pf_cs_plasma_mutual[ - pfcoil_variables.n_cs_pf_coils - 1, - pfcoil_variables.n_pf_cs_plasma_circuits - 1, - ] = pfcoil_variables.ind_pf_cs_plasma_mutual[ - pfcoil_variables.n_pf_cs_plasma_circuits - 1, - pfcoil_variables.n_cs_pf_coils - 1, + self.data.pf_coil.ind_pf_cs_plasma_mutual[ + self.data.pf_coil.n_cs_pf_coils - 1, + self.data.pf_coil.n_pf_cs_plasma_circuits - 1, + ] = self.data.pf_coil.ind_pf_cs_plasma_mutual[ + self.data.pf_coil.n_pf_cs_plasma_circuits - 1, + self.data.pf_coil.n_cs_pf_coils - 1, ] # Plasma self inductance - pfcoil_variables.ind_pf_cs_plasma_mutual[ - pfcoil_variables.n_pf_cs_plasma_circuits - 1, - pfcoil_variables.n_pf_cs_plasma_circuits - 1, + self.data.pf_coil.ind_pf_cs_plasma_mutual[ + self.data.pf_coil.n_pf_cs_plasma_circuits - 1, + self.data.pf_coil.n_pf_cs_plasma_circuits - 1, ] = pv.ind_plasma # PF coil / plasma mutual inductances ncoils = 0 - for i in range(pfcoil_variables.n_pf_coil_groups): + for i in range(self.data.pf_coil.n_pf_coil_groups): xpfpl = 0.0 - ncoils += pfcoil_variables.n_pf_coils_in_group[i] - rp = pfcoil_variables.r_pf_coil_middle[ncoils - 1] - zp = pfcoil_variables.z_pf_coil_middle[ncoils - 1] + ncoils += self.data.pf_coil.n_pf_coils_in_group[i] + rp = self.data.pf_coil.r_pf_coil_middle[ncoils - 1] + zp = self.data.pf_coil.z_pf_coil_middle[ncoils - 1] xc, _br, _bz, _psi = calculate_b_field_at_point( r_current_loop=rc, z_current_loop=zc, @@ -1829,35 +1827,35 @@ def induct(self, output): for ii in range(nplas): xpfpl += xc[ii] - for j in range(pfcoil_variables.n_pf_coils_in_group[i]): + for j in range(self.data.pf_coil.n_pf_coils_in_group[i]): ncoilj = ncoils + 1 - (j + 1) - pfcoil_variables.ind_pf_cs_plasma_mutual[ - ncoilj - 1, pfcoil_variables.n_pf_cs_plasma_circuits - 1 - ] = xpfpl / nplas * pfcoil_variables.n_pf_coil_turns[ncoilj - 1] - pfcoil_variables.ind_pf_cs_plasma_mutual[ - pfcoil_variables.n_pf_cs_plasma_circuits - 1, ncoilj - 1 - ] = pfcoil_variables.ind_pf_cs_plasma_mutual[ - ncoilj - 1, pfcoil_variables.n_pf_cs_plasma_circuits - 1 + self.data.pf_coil.ind_pf_cs_plasma_mutual[ + ncoilj - 1, self.data.pf_coil.n_pf_cs_plasma_circuits - 1 + ] = xpfpl / nplas * self.data.pf_coil.n_pf_coil_turns[ncoilj - 1] + self.data.pf_coil.ind_pf_cs_plasma_mutual[ + self.data.pf_coil.n_pf_cs_plasma_circuits - 1, ncoilj - 1 + ] = self.data.pf_coil.ind_pf_cs_plasma_mutual[ + ncoilj - 1, self.data.pf_coil.n_pf_cs_plasma_circuits - 1 ] if self.data.build.iohcl != 0: # Central Solenoid self inductance - a = pfcoil_variables.r_cs_middle # mean radius of coil + a = self.data.pf_coil.r_cs_middle # mean radius of coil b = ( 2.0e0 - * pfcoil_variables.z_pf_coil_upper[pfcoil_variables.n_cs_pf_coils - 1] + * self.data.pf_coil.z_pf_coil_upper[self.data.pf_coil.n_cs_pf_coils - 1] ) # length of coil c = ( - pfcoil_variables.r_pf_coil_outer[pfcoil_variables.n_cs_pf_coils - 1] - - pfcoil_variables.r_pf_coil_inner[pfcoil_variables.n_cs_pf_coils - 1] + self.data.pf_coil.r_pf_coil_outer[self.data.pf_coil.n_cs_pf_coils - 1] + - self.data.pf_coil.r_pf_coil_inner[self.data.pf_coil.n_cs_pf_coils - 1] ) # radial winding thickness - pfcoil_variables.ind_pf_cs_plasma_mutual[ - pfcoil_variables.n_cs_pf_coils - 1, pfcoil_variables.n_cs_pf_coils - 1 + self.data.pf_coil.ind_pf_cs_plasma_mutual[ + self.data.pf_coil.n_cs_pf_coils - 1, self.data.pf_coil.n_cs_pf_coils - 1 ] = self.selfinductance( a, b, c, - pfcoil_variables.n_pf_coil_turns[pfcoil_variables.n_cs_pf_coils - 1], + self.data.pf_coil.n_pf_coil_turns[self.data.pf_coil.n_cs_pf_coils - 1], ) # Central Solenoid / PF coil mutual inductances @@ -1866,11 +1864,11 @@ def induct(self, output): zc[i] = zoh[i] ncoils = 0 - for i in range(pfcoil_variables.n_pf_coil_groups): + for i in range(self.data.pf_coil.n_pf_coil_groups): xohpf = 0.0 - ncoils += pfcoil_variables.n_pf_coils_in_group[i] - rp = pfcoil_variables.r_pf_coil_middle[ncoils - 1] - zp = pfcoil_variables.z_pf_coil_middle[ncoils - 1] + ncoils += self.data.pf_coil.n_pf_coils_in_group[i] + rp = self.data.pf_coil.r_pf_coil_middle[ncoils - 1] + zp = self.data.pf_coil.z_pf_coil_middle[ncoils - 1] xc, _br, _bz, _psi = calculate_b_field_at_point( r_current_loop=rc, z_current_loop=zc, @@ -1881,39 +1879,39 @@ def induct(self, output): for ii in range(noh): xohpf += xc[ii] - for j in range(pfcoil_variables.n_pf_coils_in_group[i]): + for j in range(self.data.pf_coil.n_pf_coils_in_group[i]): ncoilj = ncoils + 1 - (j + 1) - pfcoil_variables.ind_pf_cs_plasma_mutual[ - ncoilj - 1, pfcoil_variables.n_cs_pf_coils - 1 + self.data.pf_coil.ind_pf_cs_plasma_mutual[ + ncoilj - 1, self.data.pf_coil.n_cs_pf_coils - 1 ] = ( xohpf - * pfcoil_variables.n_pf_coil_turns[ncoilj - 1] - * pfcoil_variables.n_pf_coil_turns[ - pfcoil_variables.n_cs_pf_coils - 1 + * self.data.pf_coil.n_pf_coil_turns[ncoilj - 1] + * self.data.pf_coil.n_pf_coil_turns[ + self.data.pf_coil.n_cs_pf_coils - 1 ] / noh ) - pfcoil_variables.ind_pf_cs_plasma_mutual[ - pfcoil_variables.n_cs_pf_coils - 1, ncoilj - 1 - ] = pfcoil_variables.ind_pf_cs_plasma_mutual[ - ncoilj - 1, pfcoil_variables.n_cs_pf_coils - 1 + self.data.pf_coil.ind_pf_cs_plasma_mutual[ + self.data.pf_coil.n_cs_pf_coils - 1, ncoilj - 1 + ] = self.data.pf_coil.ind_pf_cs_plasma_mutual[ + ncoilj - 1, self.data.pf_coil.n_cs_pf_coils - 1 ] # PF coil - PF coil inductances if self.data.build.iohcl == 0: - pfcoil_variables.nef = pfcoil_variables.n_cs_pf_coils + self.data.pf_coil.nef = self.data.pf_coil.n_cs_pf_coils else: - pfcoil_variables.nef = pfcoil_variables.n_cs_pf_coils - 1 + self.data.pf_coil.nef = self.data.pf_coil.n_cs_pf_coils - 1 - for i in range(pfcoil_variables.nef): - for j in range(pfcoil_variables.nef - 1): + for i in range(self.data.pf_coil.nef): + for j in range(self.data.pf_coil.nef - 1): jj = j + 1 + 1 if j >= i else j + 1 - zc[j] = pfcoil_variables.z_pf_coil_middle[jj - 1] - rc[j] = pfcoil_variables.r_pf_coil_middle[jj - 1] + zc[j] = self.data.pf_coil.z_pf_coil_middle[jj - 1] + rc[j] = self.data.pf_coil.r_pf_coil_middle[jj - 1] - rp = pfcoil_variables.r_pf_coil_middle[i] - zp = pfcoil_variables.z_pf_coil_middle[i] + rp = self.data.pf_coil.r_pf_coil_middle[i] + zp = self.data.pf_coil.z_pf_coil_middle[i] xc, _br, _bz, _psi = calculate_b_field_at_point( r_current_loop=rc, z_current_loop=zc, @@ -1921,32 +1919,32 @@ def induct(self, output): r_test_point=rp, z_test_point=zp, ) - for k in range(pfcoil_variables.nef): + for k in range(self.data.pf_coil.nef): if k < i: - pfcoil_variables.ind_pf_cs_plasma_mutual[i, k] = ( + self.data.pf_coil.ind_pf_cs_plasma_mutual[i, k] = ( xc[k] - * pfcoil_variables.n_pf_coil_turns[k] - * pfcoil_variables.n_pf_coil_turns[i] + * self.data.pf_coil.n_pf_coil_turns[k] + * self.data.pf_coil.n_pf_coil_turns[i] ) elif k == i: rl = abs( - pfcoil_variables.z_pf_coil_upper[k] - - pfcoil_variables.z_pf_coil_lower[k] + self.data.pf_coil.z_pf_coil_upper[k] + - self.data.pf_coil.z_pf_coil_lower[k] ) / math.sqrt(np.pi) - pfcoil_variables.ind_pf_cs_plasma_mutual[k, k] = ( + self.data.pf_coil.ind_pf_cs_plasma_mutual[k, k] = ( constants.RMU0 - * pfcoil_variables.n_pf_coil_turns[k] ** 2 - * pfcoil_variables.r_pf_coil_middle[k] + * self.data.pf_coil.n_pf_coil_turns[k] ** 2 + * self.data.pf_coil.r_pf_coil_middle[k] * ( - math.log(8.0e0 * pfcoil_variables.r_pf_coil_middle[k] / rl) + math.log(8.0e0 * self.data.pf_coil.r_pf_coil_middle[k] / rl) - 1.75e0 ) ) else: - pfcoil_variables.ind_pf_cs_plasma_mutual[i, k] = ( + self.data.pf_coil.ind_pf_cs_plasma_mutual[i, k] = ( xc[k - 1] - * pfcoil_variables.n_pf_coil_turns[k] - * pfcoil_variables.n_pf_coil_turns[i] + * self.data.pf_coil.n_pf_coil_turns[k] + * self.data.pf_coil.n_pf_coil_turns[i] ) # Output section @@ -1958,21 +1956,21 @@ def induct(self, output): op.oblnkl(self.outfile) with np.printoptions(precision=1): - for ig in range(pfcoil_variables.nef): + for ig in range(self.data.pf_coil.nef): op.write( self.outfile, - f"{ig}\t{pfcoil_variables.ind_pf_cs_plasma_mutual[: pfcoil_variables.n_pf_cs_plasma_circuits, ig]}", + f"{ig}\t{self.data.pf_coil.ind_pf_cs_plasma_mutual[: self.data.pf_coil.n_pf_cs_plasma_circuits, ig]}", ) if self.data.build.iohcl != 0: op.write( self.outfile, - f"CS\t\t\t{pfcoil_variables.ind_pf_cs_plasma_mutual[: pfcoil_variables.n_pf_cs_plasma_circuits, pfcoil_variables.n_pf_cs_plasma_circuits - 2]}", + f"CS\t\t\t{self.data.pf_coil.ind_pf_cs_plasma_mutual[: self.data.pf_coil.n_pf_cs_plasma_circuits, self.data.pf_coil.n_pf_cs_plasma_circuits - 2]}", ) op.write( self.outfile, - f"Plasma\t{pfcoil_variables.ind_pf_cs_plasma_mutual[: pfcoil_variables.n_pf_cs_plasma_circuits, pfcoil_variables.n_pf_cs_plasma_circuits - 1]}", + f"Plasma\t{self.data.pf_coil.ind_pf_cs_plasma_mutual[: self.data.pf_coil.n_pf_cs_plasma_circuits, self.data.pf_coil.n_pf_cs_plasma_circuits - 1]}", ) def outpf(self): @@ -1992,42 +1990,42 @@ def outpf(self): "(iohcl)", self.data.build.iohcl, ) - elif pfcoil_variables.i_pf_conductor == 0: + elif self.data.pf_coil.i_pf_conductor == 0: op.ocmmnt(self.outfile, "Superconducting central solenoid") op.ovarin( self.outfile, "Central solenoid superconductor material", "(i_cs_superconductor)", - pfcoil_variables.i_cs_superconductor, + self.data.pf_coil.i_cs_superconductor, ) - if pfcoil_variables.i_cs_superconductor == 1: + if self.data.pf_coil.i_cs_superconductor == 1: op.ocmmnt(self.outfile, " (ITER Nb3Sn critical surface model)") - elif pfcoil_variables.i_cs_superconductor == 2: + elif self.data.pf_coil.i_cs_superconductor == 2: op.ocmmnt(self.outfile, " (Bi-2212 high temperature superconductor)") - elif pfcoil_variables.i_cs_superconductor == 3: + elif self.data.pf_coil.i_cs_superconductor == 3: op.ocmmnt(self.outfile, " (NbTi)") - elif pfcoil_variables.i_cs_superconductor == 4: + elif self.data.pf_coil.i_cs_superconductor == 4: op.ocmmnt( self.outfile, " (ITER Nb3Sn critical surface model, user-defined parameters)", ) - elif pfcoil_variables.i_cs_superconductor == 5: + elif self.data.pf_coil.i_cs_superconductor == 5: op.ocmmnt(self.outfile, " (WST Nb3Sn critical surface model)") - elif pfcoil_variables.i_cs_superconductor == 6: + elif self.data.pf_coil.i_cs_superconductor == 6: op.ocmmnt(self.outfile, " (REBCO HTS)") - elif pfcoil_variables.i_cs_superconductor == 7: + elif self.data.pf_coil.i_cs_superconductor == 7: op.ocmmnt( self.outfile, " (Durham Ginzburg-Landau critical surface model for Nb-Ti)", ) - elif pfcoil_variables.i_cs_superconductor == 8: + elif self.data.pf_coil.i_cs_superconductor == 8: op.ocmmnt( self.outfile, " (Durham Ginzburg-Landau critical surface model for REBCO)", ) - elif pfcoil_variables.i_cs_superconductor == 9: + elif self.data.pf_coil.i_cs_superconductor == 9: op.ocmmnt( self.outfile, " (Hazelton experimental data + Zhai conceptual model for REBCO)", @@ -2038,35 +2036,35 @@ def outpf(self): self.outfile, "Maximum field at Beginning Of Pulse (T)", "(b_cs_peak_pulse_start)", - pfcoil_variables.b_cs_peak_pulse_start, + self.data.pf_coil.b_cs_peak_pulse_start, "OP ", ) op.ovarre( self.outfile, "Critical superconductor current density at BOP (A/m2)", "(j_cs_conductor_critical_pulse_start)", - pfcoil_variables.j_cs_conductor_critical_pulse_start, + self.data.pf_coil.j_cs_conductor_critical_pulse_start, "OP ", ) op.ovarre( self.outfile, "Critical cable current density at BOP (A/m2)", "(jcableoh_bop)", - pfcoil_variables.jcableoh_bop, + self.data.pf_coil.jcableoh_bop, "OP ", ) op.ovarre( self.outfile, "Allowable overall current density at BOP (A/m2)", "(j_cs_critical_pulse_start)", - pfcoil_variables.j_cs_critical_pulse_start, + self.data.pf_coil.j_cs_critical_pulse_start, "OP ", ) op.ovarre( self.outfile, "Actual overall current density at BOP (A/m2)", "(j_cs_pulse_start)", - pfcoil_variables.j_cs_pulse_start, + self.data.pf_coil.j_cs_pulse_start, "OP ", ) op.oblnkl(self.outfile) @@ -2074,49 +2072,49 @@ def outpf(self): self.outfile, "Maximum field at End Of Flattop (T)", "(b_cs_peak_flat_top_end)", - pfcoil_variables.b_cs_peak_flat_top_end, + self.data.pf_coil.b_cs_peak_flat_top_end, "OP ", ) op.ovarre( self.outfile, "Critical superconductor current density at EOF (A/m2)", "(j_cs_conductor_critical_flat_top_end)", - pfcoil_variables.j_cs_conductor_critical_flat_top_end, + self.data.pf_coil.j_cs_conductor_critical_flat_top_end, "OP ", ) op.ovarre( self.outfile, "Critical cable current density at EOF (A/m2)", "(jcableoh_eof)", - pfcoil_variables.jcableoh_eof, + self.data.pf_coil.jcableoh_eof, "OP ", ) op.ovarre( self.outfile, "Allowable overall current density at EOF (A/m2)", "(j_cs_critical_flat_top_end)", - pfcoil_variables.j_cs_critical_flat_top_end, + self.data.pf_coil.j_cs_critical_flat_top_end, "OP ", ) op.ovarre( self.outfile, "Actual overall current density at EOF (A/m2)", "(j_cs_flat_top_end)", - pfcoil_variables.j_cs_flat_top_end, + self.data.pf_coil.j_cs_flat_top_end, ) - for i in range(len(pfcoil_variables.r_pf_cs_current_filaments)): + for i in range(len(self.data.pf_coil.r_pf_cs_current_filaments)): op.ovarre( self.mfile, f"Radial position of CS filament {i}", f"r_pf_cs_current_filaments{i}", - pfcoil_variables.r_pf_cs_current_filaments[i], + self.data.pf_coil.r_pf_cs_current_filaments[i], ) - for i in range(len(pfcoil_variables.z_pf_cs_current_filaments)): + for i in range(len(self.data.pf_coil.z_pf_cs_current_filaments)): op.ovarre( self.mfile, f"Vertical position of CS filament {i}", f"z_pf_cs_current_filaments{i}", - pfcoil_variables.z_pf_cs_current_filaments[i], + self.data.pf_coil.z_pf_cs_current_filaments[i], ) op.oblnkl(self.outfile) # MDK add self.data.build.dr_cs, self.data.build.dr_bore and self.data.build.dr_cs_tf_gap as they can be iteration variables @@ -2137,51 +2135,51 @@ def outpf(self): self.outfile, "CS overall cross-sectional area (m2)", "(a_cs_poloidal)", - pfcoil_variables.a_cs_poloidal, + self.data.pf_coil.a_cs_poloidal, "OP ", ) op.ovarre( self.outfile, "CS radial middle (m)", "(r_cs_middle)", - pfcoil_variables.r_cs_middle, + self.data.pf_coil.r_cs_middle, "OP ", ) op.ovarre( self.outfile, "CS conductor+void cross-sectional area (m2)", "(awpoh)", - pfcoil_variables.awpoh, + self.data.pf_coil.awpoh, "OP ", ) op.ovarre( self.outfile, " CS conductor cross-sectional area (m2)", "(awpoh*(1-f_a_cs_void))", - pfcoil_variables.awpoh * (1.0e0 - pfcoil_variables.f_a_cs_void), + self.data.pf_coil.awpoh * (1.0e0 - self.data.pf_coil.f_a_cs_void), "OP ", ) op.ovarre( self.outfile, " CS void cross-sectional area (m2)", "(awpoh*f_a_cs_void)", - pfcoil_variables.awpoh * pfcoil_variables.f_a_cs_void, + self.data.pf_coil.awpoh * self.data.pf_coil.f_a_cs_void, "OP ", ) op.ovarre( self.outfile, "CS steel cross-sectional area (m2)", "(a_cs_poloidal-awpoh)", - pfcoil_variables.a_cs_poloidal - pfcoil_variables.awpoh, + self.data.pf_coil.a_cs_poloidal - self.data.pf_coil.awpoh, "OP ", ) op.ovarre( self.outfile, "CS steel area fraction", "(f_a_cs_turn_steel)", - pfcoil_variables.f_a_cs_turn_steel, + self.data.pf_coil.f_a_cs_turn_steel, ) - if pfcoil_variables.i_cs_stress == 1: + if self.data.pf_coil.i_cs_stress == 1: op.ocmmnt(self.outfile, "Hoop + axial stress considered") else: op.ocmmnt(self.outfile, "Only hoop stress considered") @@ -2190,40 +2188,40 @@ def outpf(self): self.outfile, "Switch for CS stress calculation", "(i_cs_stress)", - pfcoil_variables.i_cs_stress, + self.data.pf_coil.i_cs_stress, ) op.ovarre( self.outfile, "Allowable stress in CS steel (Pa)", "(alstroh)", - pfcoil_variables.alstroh, + self.data.pf_coil.alstroh, ) op.ovarre( self.outfile, "Hoop stress in CS steel (Pa)", "(sig_hoop)", - pfcoil_variables.sig_hoop, + self.data.pf_coil.sig_hoop, "OP ", ) op.ovarre( self.outfile, "Axial stress in CS steel (Pa)", "(stress_z_cs_self_peak_midplane)", - pfcoil_variables.stress_z_cs_self_peak_midplane, + self.data.pf_coil.stress_z_cs_self_peak_midplane, "OP ", ) op.ovarre( self.outfile, "Maximum shear stress in CS steel for the Tresca criterion (Pa)", "(s_shear_cs_peak)", - pfcoil_variables.s_shear_cs_peak, + self.data.pf_coil.s_shear_cs_peak, "OP ", ) op.ovarre( self.outfile, "Axial force in CS (N)", "(forc_z_cs_self_peak_midplane)", - pfcoil_variables.forc_z_cs_self_peak_midplane, + self.data.pf_coil.forc_z_cs_self_peak_midplane, "OP ", ) op.ovarre( @@ -2236,10 +2234,10 @@ def outpf(self): self.outfile, "Copper fraction in strand", "(fcuohsu)", - pfcoil_variables.fcuohsu, + self.data.pf_coil.fcuohsu, ) # If REBCO material is used, print copperaoh_m2 - if pfcoil_variables.i_cs_superconductor in {6, 8, 9}: + if self.data.pf_coil.i_cs_superconductor in {6, 8, 9}: op.ovarre( self.outfile, "CS current/copper area (A/m2)", @@ -2257,7 +2255,7 @@ def outpf(self): self.outfile, "Void (coolant) fraction in conductor", "(f_a_cs_void)", - pfcoil_variables.f_a_cs_void, + self.data.pf_coil.f_a_cs_void, ) op.ovarre( self.outfile, @@ -2269,7 +2267,7 @@ def outpf(self): self.outfile, "CS temperature margin (K)", "(temp_cs_superconductor_margin)", - pfcoil_variables.temp_cs_superconductor_margin, + self.data.pf_coil.temp_cs_superconductor_margin, "OP ", ) op.ovarre( @@ -2308,25 +2306,25 @@ def outpf(self): self.outfile, "CS turn area (m)", "(a_cs_turn)", - pfcoil_variables.a_cs_turn, + self.data.pf_coil.a_cs_turn, ) op.ovarre( self.outfile, "CS turn length (m)", "(dr_cs_turn)", - pfcoil_variables.dr_cs_turn, + self.data.pf_coil.dr_cs_turn, ) op.ovarre( self.outfile, "CS turn internal cable space radius (m)", "(radius_cs_turn_cable_space)", - pfcoil_variables.radius_cs_turn_cable_space, + self.data.pf_coil.radius_cs_turn_cable_space, ) op.ovarre( self.outfile, "CS turn width (m)", "(dz_cs_turn)", - pfcoil_variables.dz_cs_turn, + self.data.pf_coil.dz_cs_turn, ) op.ovarre( self.outfile, @@ -2356,25 +2354,25 @@ def outpf(self): ) # Check whether CS coil is hitting any limits if ( - abs(pfcoil_variables.j_cs_flat_top_end) + abs(self.data.pf_coil.j_cs_flat_top_end) > 0.99e0 * abs( self.data.constraints.fjohc - * pfcoil_variables.j_cs_critical_flat_top_end + * self.data.pf_coil.j_cs_critical_flat_top_end ) ) or ( - abs(pfcoil_variables.j_cs_pulse_start) + abs(self.data.pf_coil.j_cs_pulse_start) > 0.99e0 * abs( self.data.constraints.fjohc0 - * pfcoil_variables.j_cs_critical_pulse_start + * self.data.pf_coil.j_cs_critical_pulse_start ) ): - pfcoil_variables.cslimit = True + self.data.pf_coil.cslimit = True if ( - pfcoil_variables.j_cs_flat_top_end - / pfcoil_variables.j_cs_critical_flat_top_end + self.data.pf_coil.j_cs_flat_top_end + / self.data.pf_coil.j_cs_critical_flat_top_end > 0.7 ): logger.error( @@ -2383,8 +2381,8 @@ def outpf(self): ) if ( - pfcoil_variables.j_cs_pulse_start - / pfcoil_variables.j_cs_critical_pulse_start + self.data.pf_coil.j_cs_pulse_start + / self.data.pf_coil.j_cs_critical_pulse_start > 0.7 ): logger.error( @@ -2393,18 +2391,18 @@ def outpf(self): ) if ( - pfcoil_variables.temp_cs_superconductor_margin + self.data.pf_coil.temp_cs_superconductor_margin < 1.01e0 * tfv.temp_cs_superconductor_margin_min ): - pfcoil_variables.cslimit = True - if not pfcoil_variables.cslimit: + self.data.pf_coil.cslimit = True + if not self.data.pf_coil.cslimit: logger.warning( "CS not using max current density: further optimisation may be possible" ) # REBCO fractures in strains above ~+/- 0.7% if ( - SuperconductorModel(pfcoil_variables.i_pf_superconductor).material + SuperconductorModel(self.data.pf_coil.i_pf_superconductor).material == SuperconductorMaterial.REBCO ) and abs(tfv.str_cs_con_res) > 0.7e-2: logger.error( @@ -2412,7 +2410,7 @@ def outpf(self): ) if ( - SuperconductorModel(pfcoil_variables.i_pf_superconductor).material + SuperconductorModel(self.data.pf_coil.i_pf_superconductor).material == SuperconductorMaterial.REBCO and abs(tfv.str_pf_con_res) > 0.7e-2 ): @@ -2423,7 +2421,7 @@ def outpf(self): else: op.ocmmnt(self.outfile, "Resistive central solenoid") - if pfcoil_variables.i_pf_conductor == 0: + if self.data.pf_coil.i_pf_conductor == 0: op.oblnkl(self.outfile) op.ocmmnt(self.outfile, "Superconducting PF coils") @@ -2431,19 +2429,19 @@ def outpf(self): self.outfile, "PF coil superconductor material", "(i_pf_superconductor)", - pfcoil_variables.i_pf_superconductor, + self.data.pf_coil.i_pf_superconductor, ) op.ocmmnt( self.outfile, - f" -> {SuperconductorModel(pfcoil_variables.i_pf_superconductor).full_name}", + f" -> {SuperconductorModel(self.data.pf_coil.i_pf_superconductor).full_name}", ) op.ovarre( self.outfile, "Copper fraction in conductor", "(fcupfsu)", - pfcoil_variables.fcupfsu, + self.data.pf_coil.fcupfsu, ) op.osubhd(self.outfile, "PF Coil Case Stress :") @@ -2451,13 +2449,13 @@ def outpf(self): self.outfile, "Maximum permissible tensile stress (MPa)", "(sigpfcalw)", - pfcoil_variables.sigpfcalw, + self.data.pf_coil.sigpfcalw, ) op.ovarre( self.outfile, "JxB hoop force fraction supported by case", "(sigpfcf)", - pfcoil_variables.sigpfcf, + self.data.pf_coil.sigpfcf, ) else: @@ -2469,7 +2467,7 @@ def outpf(self): self.outfile, "PF coil resistive power (W)", "(p_pf_coil_resistive_total_flat_top)", - pfcoil_variables.p_pf_coil_resistive_total_flat_top, + self.data.pf_coil.p_pf_coil_resistive_total_flat_top, "OP ", ) if self.data.build.iohcl != 0: @@ -2477,14 +2475,14 @@ def outpf(self): self.outfile, "Central solenoid resistive power (W)", "(p_cs_resistive_flat_top)", - pfcoil_variables.p_cs_resistive_flat_top, + self.data.pf_coil.p_cs_resistive_flat_top, "OP ", ) - # pfcoil_variables.nef is the number of coils excluding the Central Solenoid - pfcoil_variables.nef = pfcoil_variables.n_cs_pf_coils + # self.data.pf_coil.nef is the number of coils excluding the Central Solenoid + self.data.pf_coil.nef = self.data.pf_coil.n_cs_pf_coils if self.data.build.iohcl != 0: - pfcoil_variables.nef -= 1 + self.data.pf_coil.nef -= 1 op.osubhd(self.outfile, "Geometry of PF coils, central solenoid and plasma:") op.write( @@ -2494,56 +2492,56 @@ def outpf(self): op.oblnkl(self.outfile) # PF coils - for k in range(pfcoil_variables.nef): + for k in range(self.data.pf_coil.nef): op.write( self.outfile, - f"PF {k}\t\t\t{pfcoil_variables.r_pf_coil_middle[k]:.2e}\t{pfcoil_variables.z_pf_coil_middle[k]:.2e}\t{pfcoil_variables.r_pf_coil_outer[k] - pfcoil_variables.r_pf_coil_inner[k]:.2e}\t{abs(pfcoil_variables.z_pf_coil_upper[k] - pfcoil_variables.z_pf_coil_lower[k]):.2e}\t{pfcoil_variables.n_pf_coil_turns[k]:.2e}", + f"PF {k}\t\t\t{self.data.pf_coil.r_pf_coil_middle[k]:.2e}\t{self.data.pf_coil.z_pf_coil_middle[k]:.2e}\t{self.data.pf_coil.r_pf_coil_outer[k] - self.data.pf_coil.r_pf_coil_inner[k]:.2e}\t{abs(self.data.pf_coil.z_pf_coil_upper[k] - self.data.pf_coil.z_pf_coil_lower[k]):.2e}\t{self.data.pf_coil.n_pf_coil_turns[k]:.2e}", ) - for k in range(pfcoil_variables.nef): + for k in range(self.data.pf_coil.nef): op.ovarre( self.mfile, f"PF coil {k} radius (m)", f"(r_pf_coil_middle[{k}])", - pfcoil_variables.r_pf_coil_middle[k], + self.data.pf_coil.r_pf_coil_middle[k], ) op.ovarre( self.mfile, f"PF coil {k} vertical position (m)", f"(z_pf_coil_middle[{k}])", - pfcoil_variables.z_pf_coil_middle[k], + self.data.pf_coil.z_pf_coil_middle[k], ) op.ovarre( self.mfile, f"PF coil {k} radial thickness (m)", f"(pfdr({k}))", - pfcoil_variables.r_pf_coil_outer[k] - - pfcoil_variables.r_pf_coil_inner[k], + self.data.pf_coil.r_pf_coil_outer[k] + - self.data.pf_coil.r_pf_coil_inner[k], ) op.ovarre( self.mfile, f"PF coil {k} vertical thickness (m)", f"(pfdz({k}))", - pfcoil_variables.z_pf_coil_upper[k] - - pfcoil_variables.z_pf_coil_lower[k], + self.data.pf_coil.z_pf_coil_upper[k] + - self.data.pf_coil.z_pf_coil_lower[k], ) op.ovarre( self.mfile, f"PF coil {k} turns", f"(n_pf_coil_turns[{k}])", - pfcoil_variables.n_pf_coil_turns[k], + self.data.pf_coil.n_pf_coil_turns[k], ) op.ovarre( self.mfile, f"PF coil {k} current (MA)", f"(c_pf_cs_coils_peak_ma[{k}])", - pfcoil_variables.c_pf_cs_coils_peak_ma[k], + self.data.pf_coil.c_pf_cs_coils_peak_ma[k], ) op.ovarre( self.mfile, f"PF coil {k} field (T)", f"(b_pf_coil_peak[{k}])", - pfcoil_variables.b_pf_coil_peak[k], + self.data.pf_coil.b_pf_coil_peak[k], ) self.tf_pf_collision_detector() @@ -2551,28 +2549,30 @@ def outpf(self): if self.data.build.iohcl != 0: op.write( self.outfile, - f"CS\t\t\t\t{pfcoil_variables.r_pf_coil_middle[pfcoil_variables.n_cs_pf_coils - 1]:.2e}\t{pfcoil_variables.z_pf_coil_middle[pfcoil_variables.n_cs_pf_coils - 1]:.2e}\t{pfcoil_variables.r_pf_coil_outer[pfcoil_variables.n_cs_pf_coils - 1] - pfcoil_variables.r_pf_coil_inner[pfcoil_variables.n_cs_pf_coils - 1]:.2e}\t{abs(pfcoil_variables.z_pf_coil_upper[pfcoil_variables.n_cs_pf_coils - 1] - pfcoil_variables.z_pf_coil_lower[pfcoil_variables.n_cs_pf_coils - 1]):.2e}\t{pfcoil_variables.n_pf_coil_turns[pfcoil_variables.n_cs_pf_coils - 1]:.2e}\t{pfcoil_variables.pfcaseth[pfcoil_variables.n_cs_pf_coils - 1]:.2e}", + f"CS\t\t\t\t{self.data.pf_coil.r_pf_coil_middle[self.data.pf_coil.n_cs_pf_coils - 1]:.2e}\t{self.data.pf_coil.z_pf_coil_middle[self.data.pf_coil.n_cs_pf_coils - 1]:.2e}\t{self.data.pf_coil.r_pf_coil_outer[self.data.pf_coil.n_cs_pf_coils - 1] - self.data.pf_coil.r_pf_coil_inner[self.data.pf_coil.n_cs_pf_coils - 1]:.2e}\t{abs(self.data.pf_coil.z_pf_coil_upper[self.data.pf_coil.n_cs_pf_coils - 1] - self.data.pf_coil.z_pf_coil_lower[self.data.pf_coil.n_cs_pf_coils - 1]):.2e}\t{self.data.pf_coil.n_pf_coil_turns[self.data.pf_coil.n_cs_pf_coils - 1]:.2e}\t{self.data.pf_coil.pfcaseth[self.data.pf_coil.n_cs_pf_coils - 1]:.2e}", ) op.ovarre( self.mfile, "Central solenoid radius (m)", "(r_pf_coil_middle[n_cs_pf_coils-1])", - pfcoil_variables.r_pf_coil_middle[pfcoil_variables.n_cs_pf_coils - 1], + self.data.pf_coil.r_pf_coil_middle[self.data.pf_coil.n_cs_pf_coils - 1], ) op.ovarre( self.mfile, "Central solenoid vertical position (m)", "(z_pf_coil_middle[n_cs_pf_coils-1])", - pfcoil_variables.z_pf_coil_middle[pfcoil_variables.n_cs_pf_coils - 1], + self.data.pf_coil.z_pf_coil_middle[self.data.pf_coil.n_cs_pf_coils - 1], ) op.ovarre( self.mfile, "Central solenoid radial thickness (m)", "(ohdr)", ( - pfcoil_variables.r_pf_coil_outer[pfcoil_variables.n_cs_pf_coils - 1] - - pfcoil_variables.r_pf_coil_inner[ - pfcoil_variables.n_cs_pf_coils - 1 + self.data.pf_coil.r_pf_coil_outer[ + self.data.pf_coil.n_cs_pf_coils - 1 + ] + - self.data.pf_coil.r_pf_coil_inner[ + self.data.pf_coil.n_cs_pf_coils - 1 ] ), ) @@ -2580,33 +2580,33 @@ def outpf(self): self.mfile, "Central solenoid vertical thickness (m)", "(dz_cs_full)", - (pfcoil_variables.dz_cs_full), + (self.data.pf_coil.dz_cs_full), ) op.ovarre( self.mfile, "Central solenoid full radial width (m)", "(dr_cs_full)", - (pfcoil_variables.dr_cs_full), + (self.data.pf_coil.dr_cs_full), ) op.ovarre( self.mfile, "Central solenoid turns", "(n_pf_coil_turns[n_cs_pf_coils-1])", - pfcoil_variables.n_pf_coil_turns[pfcoil_variables.n_cs_pf_coils - 1], + self.data.pf_coil.n_pf_coil_turns[self.data.pf_coil.n_cs_pf_coils - 1], ) op.ovarre( self.mfile, "Central solenoid current (MA)", "(c_pf_cs_coils_peak_ma[n_cs_pf_coils-1])", - pfcoil_variables.c_pf_cs_coils_peak_ma[ - pfcoil_variables.n_cs_pf_coils - 1 + self.data.pf_coil.c_pf_cs_coils_peak_ma[ + self.data.pf_coil.n_cs_pf_coils - 1 ], ) op.ovarre( self.mfile, "Central solenoid field (T)", "(b_pf_coil_peak[n_cs_pf_coils-1])", - pfcoil_variables.b_pf_coil_peak[pfcoil_variables.n_cs_pf_coils - 1], + self.data.pf_coil.b_pf_coil_peak[self.data.pf_coil.n_cs_pf_coils - 1], ) # Plasma @@ -2629,30 +2629,30 @@ def outpf(self): op.oblnkl(self.outfile) # PF coils - for k in range(pfcoil_variables.nef): - if pfcoil_variables.i_pf_conductor == 0: + for k in range(self.data.pf_coil.nef): + if self.data.pf_coil.i_pf_conductor == 0: op.write( self.outfile, - f"PF {k}\t{pfcoil_variables.c_pf_cs_coils_peak_ma[k]:.2e}\t{pfcoil_variables.j_pf_wp_critical[k]:.2e}\t{pfcoil_variables.j_pf_coil_wp_peak[k]:.2e}\t{pfcoil_variables.j_pf_coil_wp_peak[k] / pfcoil_variables.j_pf_wp_critical[k]:.2e}\t{pfcoil_variables.m_pf_coil_conductor[k]:.2e}\t{pfcoil_variables.m_pf_coil_structure[k]:.2e}\t{pfcoil_variables.b_pf_coil_peak[k]:.2e}", + f"PF {k}\t{self.data.pf_coil.c_pf_cs_coils_peak_ma[k]:.2e}\t{self.data.pf_coil.j_pf_wp_critical[k]:.2e}\t{self.data.pf_coil.j_pf_coil_wp_peak[k]:.2e}\t{self.data.pf_coil.j_pf_coil_wp_peak[k] / self.data.pf_coil.j_pf_wp_critical[k]:.2e}\t{self.data.pf_coil.m_pf_coil_conductor[k]:.2e}\t{self.data.pf_coil.m_pf_coil_structure[k]:.2e}\t{self.data.pf_coil.b_pf_coil_peak[k]:.2e}", ) else: op.write( self.outfile, - f"PF {k}\t{pfcoil_variables.c_pf_cs_coils_peak_ma[k]:.2e}\t-1.0e0\t{pfcoil_variables.j_pf_coil_wp_peak[k]:.2e}\t1.0e0\t{pfcoil_variables.m_pf_coil_conductor[k]:.2e}\t{pfcoil_variables.m_pf_coil_structure[k]:.2e}\t{pfcoil_variables.b_pf_coil_peak[k]:.2e}\t", + f"PF {k}\t{self.data.pf_coil.c_pf_cs_coils_peak_ma[k]:.2e}\t-1.0e0\t{self.data.pf_coil.j_pf_coil_wp_peak[k]:.2e}\t1.0e0\t{self.data.pf_coil.m_pf_coil_conductor[k]:.2e}\t{self.data.pf_coil.m_pf_coil_structure[k]:.2e}\t{self.data.pf_coil.b_pf_coil_peak[k]:.2e}\t", ) # Central Solenoid, if present if self.data.build.iohcl != 0: - if pfcoil_variables.i_pf_conductor == 0: + if self.data.pf_coil.i_pf_conductor == 0: # Issue #328 op.write( self.outfile, - f"CS\t\t{pfcoil_variables.c_pf_cs_coils_peak_ma[pfcoil_variables.n_cs_pf_coils - 1]:.2e}\t{pfcoil_variables.j_pf_wp_critical[pfcoil_variables.n_cs_pf_coils - 1]:.2e}\t{max(abs(pfcoil_variables.j_cs_pulse_start), abs(pfcoil_variables.j_cs_flat_top_end)):.2e}\t{max(abs(pfcoil_variables.j_cs_pulse_start), abs(pfcoil_variables.j_cs_flat_top_end)) / pfcoil_variables.j_pf_wp_critical[pfcoil_variables.n_cs_pf_coils - 1]:.2e}\t{pfcoil_variables.m_pf_coil_conductor[pfcoil_variables.n_cs_pf_coils - 1]:.2e}\t{pfcoil_variables.m_pf_coil_structure[pfcoil_variables.n_cs_pf_coils - 1]:.2e}\t{pfcoil_variables.b_pf_coil_peak[pfcoil_variables.n_cs_pf_coils - 1]:.2e}", + f"CS\t\t{self.data.pf_coil.c_pf_cs_coils_peak_ma[self.data.pf_coil.n_cs_pf_coils - 1]:.2e}\t{self.data.pf_coil.j_pf_wp_critical[self.data.pf_coil.n_cs_pf_coils - 1]:.2e}\t{max(abs(self.data.pf_coil.j_cs_pulse_start), abs(self.data.pf_coil.j_cs_flat_top_end)):.2e}\t{max(abs(self.data.pf_coil.j_cs_pulse_start), abs(self.data.pf_coil.j_cs_flat_top_end)) / self.data.pf_coil.j_pf_wp_critical[self.data.pf_coil.n_cs_pf_coils - 1]:.2e}\t{self.data.pf_coil.m_pf_coil_conductor[self.data.pf_coil.n_cs_pf_coils - 1]:.2e}\t{self.data.pf_coil.m_pf_coil_structure[self.data.pf_coil.n_cs_pf_coils - 1]:.2e}\t{self.data.pf_coil.b_pf_coil_peak[self.data.pf_coil.n_cs_pf_coils - 1]:.2e}", ) else: op.write( self.outfile, - f"CS\t\t{pfcoil_variables.c_pf_cs_coils_peak_ma[pfcoil_variables.n_cs_pf_coils - 1]:.2e}\t-1.0e0\t{max(abs(pfcoil_variables.j_cs_pulse_start)):.2e}\t{abs(pfcoil_variables.j_cs_flat_top_end):.2e}\t1.0e0\t{pfcoil_variables.m_pf_coil_conductor[pfcoil_variables.n_cs_pf_coils - 1]:.2e}\t{pfcoil_variables.m_pf_coil_structure[pfcoil_variables.n_cs_pf_coils - 1]:.2e}\t{pfcoil_variables.b_pf_coil_peak[pfcoil_variables.n_cs_pf_coils - 1]:.2e}", + f"CS\t\t{self.data.pf_coil.c_pf_cs_coils_peak_ma[self.data.pf_coil.n_cs_pf_coils - 1]:.2e}\t-1.0e0\t{max(abs(self.data.pf_coil.j_cs_pulse_start)):.2e}\t{abs(self.data.pf_coil.j_cs_flat_top_end):.2e}\t1.0e0\t{self.data.pf_coil.m_pf_coil_conductor[self.data.pf_coil.n_cs_pf_coils - 1]:.2e}\t{self.data.pf_coil.m_pf_coil_structure[self.data.pf_coil.n_cs_pf_coils - 1]:.2e}\t{self.data.pf_coil.b_pf_coil_peak[self.data.pf_coil.n_cs_pf_coils - 1]:.2e}", ) # Miscellaneous totals @@ -2664,9 +2664,9 @@ def outpf(self): op.write( self.outfile, "\t" * 1 - + f"{pfcoil_variables.ricpf:.2e}" + + f"{self.data.pf_coil.ricpf:.2e}" + "\t" * 7 - + f"{pfcoil_variables.m_pf_coil_conductor_total:.2e}\t{pfcoil_variables.m_pf_coil_structure_total:.2e}", + + f"{self.data.pf_coil.m_pf_coil_conductor_total:.2e}\t{self.data.pf_coil.m_pf_coil_structure_total:.2e}", ) op.osubhd(self.outfile, "PF coil current scaling information :") @@ -2674,11 +2674,11 @@ def outpf(self): self.outfile, "Sum of squares of residuals ", "(ssq0)", - pfcoil_variables.ssq0, + self.data.pf_coil.ssq0, "OP ", ) op.ovarre( - self.outfile, "Smoothing parameter ", "(alfapf)", pfcoil_variables.alfapf + self.outfile, "Smoothing parameter ", "(alfapf)", self.data.pf_coil.alfapf ) def outvolt(self): @@ -2693,18 +2693,18 @@ def outvolt(self): op.write(self.outfile, "\t" * 3 + "start-up\t\t\t_burn\t\t\ttotal") op.write( self.outfile, - f"PF coils:\t\t{pfcoil_variables.vs_pf_coils_total_ramp:.2f}\t\t\t\t{pfcoil_variables.vs_pf_coils_total_burn:.2f}\t\t\t{pfcoil_variables.vs_pf_coils_total_pulse:.2f}", + f"PF coils:\t\t{self.data.pf_coil.vs_pf_coils_total_ramp:.2f}\t\t\t\t{self.data.pf_coil.vs_pf_coils_total_burn:.2f}\t\t\t{self.data.pf_coil.vs_pf_coils_total_pulse:.2f}", ) op.write( self.outfile, - f"CS coil:\t\t{pfcoil_variables.vs_cs_ramp:.2f}\t\t\t\t{pfcoil_variables.vs_cs_burn:.2f}\t\t\t{pfcoil_variables.vs_cs_total_pulse:.2f}", + f"CS coil:\t\t{self.data.pf_coil.vs_cs_ramp:.2f}\t\t\t\t{self.data.pf_coil.vs_cs_burn:.2f}\t\t\t{self.data.pf_coil.vs_cs_total_pulse:.2f}", ) op.write( self.outfile, "\t" * 3 + "-" * 7 + "\t" * 4 + "-" * 7 + "\t" * 3 + "-" * 7 ) op.write( self.outfile, - f"Total:\t\t\t{pfcoil_variables.vs_cs_pf_total_ramp:.2f}\t\t\t\t{pfcoil_variables.vs_cs_pf_total_burn:.2f}\t\t\t{pfcoil_variables.vs_cs_pf_total_pulse:.2f}", + f"Total:\t\t\t{self.data.pf_coil.vs_cs_pf_total_ramp:.2f}\t\t\t\t{self.data.pf_coil.vs_cs_pf_total_burn:.2f}\t\t\t{self.data.pf_coil.vs_cs_pf_total_pulse:.2f}", ) op.oblnkl(self.outfile) @@ -2712,14 +2712,14 @@ def outvolt(self): self.outfile, "Total volt-second consumption by coils (Wb)", "(vs_cs_pf_total_pulse)", - pfcoil_variables.vs_cs_pf_total_pulse, + self.data.pf_coil.vs_cs_pf_total_pulse, "OP", ) op.ovarre( self.outfile, "Total volt-second available for burn phase (Wb)", "(vs_cs_pf_total_burn)", - pfcoil_variables.vs_cs_pf_total_burn, + self.data.pf_coil.vs_cs_pf_total_burn, "OP", ) @@ -2728,15 +2728,15 @@ def outvolt(self): op.write(self.outfile, "circuit\t\t\tBOP\t\t\tBOF\t\tEOF") op.oblnkl(self.outfile) - for k in range(pfcoil_variables.nef): + for k in range(self.data.pf_coil.nef): op.write( self.outfile, - f"\t{k}\t\t\t{pfcoil_variables.vsdum[k, 0]:.3f}\t\t\t{pfcoil_variables.vsdum[k, 1]:.3f}\t\t{pfcoil_variables.vsdum[k, 2]:.3f}", + f"\t{k}\t\t\t{self.data.pf_coil.vsdum[k, 0]:.3f}\t\t\t{self.data.pf_coil.vsdum[k, 1]:.3f}\t\t{self.data.pf_coil.vsdum[k, 2]:.3f}", ) op.write( self.outfile, - f"\tCS coil\t\t\t{pfcoil_variables.vsdum[pfcoil_variables.n_cs_pf_coils - 1, 0]:.3f}\t\t\t{pfcoil_variables.vsdum[pfcoil_variables.n_cs_pf_coils - 1, 1]:.3f}\t\t{pfcoil_variables.vsdum[pfcoil_variables.n_cs_pf_coils - 1, 2]:.3f}", + f"\tCS coil\t\t\t{self.data.pf_coil.vsdum[self.data.pf_coil.n_cs_pf_coils - 1, 0]:.3f}\t\t\t{self.data.pf_coil.vsdum[self.data.pf_coil.n_cs_pf_coils - 1, 1]:.3f}\t\t{self.data.pf_coil.vsdum[self.data.pf_coil.n_cs_pf_coils - 1, 2]:.3f}", ) op.oshead(self.outfile, "Waveforms") @@ -2757,43 +2757,43 @@ def outvolt(self): op.ocmmnt(self.outfile, "circuit") - for k in range(pfcoil_variables.n_pf_cs_plasma_circuits - 1): + for k in range(self.data.pf_coil.n_pf_cs_plasma_circuits - 1): line = f"\t{k}\t\t" for jj in range(6): - line += f"\t{pfcoil_variables.c_pf_coil_turn[k, jj] * pfcoil_variables.n_pf_coil_turns[k]:.3e}" + line += f"\t{self.data.pf_coil.c_pf_coil_turn[k, jj] * self.data.pf_coil.n_pf_coil_turns[k]:.3e}" op.write(self.outfile, line) line = "Plasma (A)\t\t" for jj in range(6): - line += f"\t{pfcoil_variables.c_pf_coil_turn[pfcoil_variables.n_pf_cs_plasma_circuits - 1, jj]:.3e}" + line += f"\t{self.data.pf_coil.c_pf_coil_turn[self.data.pf_coil.n_pf_cs_plasma_circuits - 1, jj]:.3e}" op.write(self.outfile, line) op.oblnkl(self.outfile) op.ocmmnt(self.outfile, "This consists of: CS coil field balancing:") - for k in range(pfcoil_variables.n_pf_cs_plasma_circuits - 1): + for k in range(self.data.pf_coil.n_pf_cs_plasma_circuits - 1): op.write( self.outfile, ( - f"{k}\t\t\t{pfcoil_variables.c_pf_coil_turn[k, 0] * pfcoil_variables.n_pf_coil_turns[k]:.3e}\t" - f"{pfcoil_variables.c_pf_coil_turn[k, 1] * pfcoil_variables.n_pf_coil_turns[k]:.3e}\t" - f"{-pfcoil_variables.c_pf_coil_turn[k, 1] * pfcoil_variables.n_pf_coil_turns[k] * (pfcoil_variables.f_j_cs_start_end_flat_top / pfcoil_variables.f_j_cs_start_pulse_end_flat_top):.3e}\t" - f"{-pfcoil_variables.c_pf_coil_turn[k, 1] * pfcoil_variables.n_pf_coil_turns[k] * (pfcoil_variables.f_j_cs_start_end_flat_top / pfcoil_variables.f_j_cs_start_pulse_end_flat_top):.3e}\t" - f"{-pfcoil_variables.c_pf_coil_turn[k, 1] * pfcoil_variables.n_pf_coil_turns[k] * (1.0e0 / pfcoil_variables.f_j_cs_start_pulse_end_flat_top):.3e}\t" - f"{pfcoil_variables.c_pf_coil_turn[k, 5] * pfcoil_variables.n_pf_coil_turns[k]:.3e}" + f"{k}\t\t\t{self.data.pf_coil.c_pf_coil_turn[k, 0] * self.data.pf_coil.n_pf_coil_turns[k]:.3e}\t" + f"{self.data.pf_coil.c_pf_coil_turn[k, 1] * self.data.pf_coil.n_pf_coil_turns[k]:.3e}\t" + f"{-self.data.pf_coil.c_pf_coil_turn[k, 1] * self.data.pf_coil.n_pf_coil_turns[k] * (self.data.pf_coil.f_j_cs_start_end_flat_top / self.data.pf_coil.f_j_cs_start_pulse_end_flat_top):.3e}\t" + f"{-self.data.pf_coil.c_pf_coil_turn[k, 1] * self.data.pf_coil.n_pf_coil_turns[k] * (self.data.pf_coil.f_j_cs_start_end_flat_top / self.data.pf_coil.f_j_cs_start_pulse_end_flat_top):.3e}\t" + f"{-self.data.pf_coil.c_pf_coil_turn[k, 1] * self.data.pf_coil.n_pf_coil_turns[k] * (1.0e0 / self.data.pf_coil.f_j_cs_start_pulse_end_flat_top):.3e}\t" + f"{self.data.pf_coil.c_pf_coil_turn[k, 5] * self.data.pf_coil.n_pf_coil_turns[k]:.3e}" ), ) op.oblnkl(self.outfile) op.ocmmnt(self.outfile, "And: equilibrium field:") - for k in range(pfcoil_variables.n_pf_cs_plasma_circuits - 1): + for k in range(self.data.pf_coil.n_pf_cs_plasma_circuits - 1): op.write( self.outfile, ( f"{k}\t\t\t{0.0:.3e}\t{0.0:.3e}\t" - f"{(pfcoil_variables.c_pf_coil_turn[k, 2] + pfcoil_variables.c_pf_coil_turn[k, 1] * pfcoil_variables.f_j_cs_start_end_flat_top / pfcoil_variables.f_j_cs_start_pulse_end_flat_top) * pfcoil_variables.n_pf_coil_turns[k]:.3e}\t" - f"{(pfcoil_variables.c_pf_coil_turn[k, 3] + pfcoil_variables.c_pf_coil_turn[k, 1] * pfcoil_variables.f_j_cs_start_end_flat_top / pfcoil_variables.f_j_cs_start_pulse_end_flat_top) * pfcoil_variables.n_pf_coil_turns[k]:.3e}\t" - f"{(pfcoil_variables.c_pf_coil_turn[k, 4] + pfcoil_variables.c_pf_coil_turn[k, 1] * 1.0e0 / pfcoil_variables.f_j_cs_start_pulse_end_flat_top) * pfcoil_variables.n_pf_coil_turns[k]:.3e}\t" + f"{(self.data.pf_coil.c_pf_coil_turn[k, 2] + self.data.pf_coil.c_pf_coil_turn[k, 1] * self.data.pf_coil.f_j_cs_start_end_flat_top / self.data.pf_coil.f_j_cs_start_pulse_end_flat_top) * self.data.pf_coil.n_pf_coil_turns[k]:.3e}\t" + f"{(self.data.pf_coil.c_pf_coil_turn[k, 3] + self.data.pf_coil.c_pf_coil_turn[k, 1] * self.data.pf_coil.f_j_cs_start_end_flat_top / self.data.pf_coil.f_j_cs_start_pulse_end_flat_top) * self.data.pf_coil.n_pf_coil_turns[k]:.3e}\t" + f"{(self.data.pf_coil.c_pf_coil_turn[k, 4] + self.data.pf_coil.c_pf_coil_turn[k, 1] * 1.0e0 / self.data.pf_coil.f_j_cs_start_pulse_end_flat_top) * self.data.pf_coil.n_pf_coil_turns[k]:.3e}\t" "0.0e0" ), ) @@ -2803,13 +2803,13 @@ def outvolt(self): self.outfile, "Ratio of central solenoid current at beginning of Pulse / end of flat-top", "(f_j_cs_start_pulse_end_flat_top)", - pfcoil_variables.f_j_cs_start_pulse_end_flat_top, + self.data.pf_coil.f_j_cs_start_pulse_end_flat_top, ) op.ovarre( self.outfile, "Ratio of central solenoid current at beginning of Flat-top / end of flat-top", "(f_j_cs_start_end_flat_top)", - pfcoil_variables.f_j_cs_start_end_flat_top, + self.data.pf_coil.f_j_cs_start_end_flat_top, "OP ", ) @@ -2818,14 +2818,14 @@ def outvolt(self): self.outfile, "Number of PF circuits including CS and plasma", "(n_pf_cs_plasma_circuits)", - pfcoil_variables.n_pf_cs_plasma_circuits, + self.data.pf_coil.n_pf_cs_plasma_circuits, ) - for k in range(pfcoil_variables.n_pf_cs_plasma_circuits): + for k in range(self.data.pf_coil.n_pf_cs_plasma_circuits): for jjj in range(6): - if k == pfcoil_variables.n_pf_cs_plasma_circuits - 1: + if k == self.data.pf_coil.n_pf_cs_plasma_circuits - 1: circuit_name = f"Plasma Time point {jjj} (A)" circuit_var_name = f"(plasmat{jjj})" - elif k == pfcoil_variables.n_pf_cs_plasma_circuits - 2: + elif k == self.data.pf_coil.n_pf_cs_plasma_circuits - 2: circuit_name = f"CS Circuit Time point {jjj} (A)" circuit_var_name = f"(cs t{jjj})" else: @@ -2836,8 +2836,8 @@ def outvolt(self): self.outfile, circuit_name, circuit_var_name, - pfcoil_variables.c_pf_coil_turn[k, jjj] - * pfcoil_variables.n_pf_coil_turns[k], + self.data.pf_coil.c_pf_coil_turn[k, jjj] + * self.data.pf_coil.n_pf_coil_turns[k], ) def selfinductance(self, a, b, c, n): @@ -2879,67 +2879,67 @@ def waveform(self): f_c_pf_cs_peak_time_array[i,j] is the current in coil i, at time j, normalized to the peak current in that coil at any time. """ - nplas = pfcoil_variables.n_cs_pf_coils + 1 + nplas = self.data.pf_coil.n_cs_pf_coils + 1 for it in range(6): - pfcoil_variables.f_c_pf_cs_peak_time_array[nplas - 1, it] = 1.0e0 + self.data.pf_coil.f_c_pf_cs_peak_time_array[nplas - 1, it] = 1.0e0 - for ic in range(pfcoil_variables.n_cs_pf_coils): + for ic in range(self.data.pf_coil.n_cs_pf_coils): # Find where the peak current occurs # Beginning of pulse, t = t_plant_pulse_coil_precharge if ( - abs(pfcoil_variables.c_pf_cs_coil_pulse_start_ma[ic]) - >= abs(pfcoil_variables.c_pf_cs_coil_pulse_end_ma[ic]) + abs(self.data.pf_coil.c_pf_cs_coil_pulse_start_ma[ic]) + >= abs(self.data.pf_coil.c_pf_cs_coil_pulse_end_ma[ic]) ) and ( - abs(pfcoil_variables.c_pf_cs_coil_pulse_start_ma[ic]) - >= abs(pfcoil_variables.c_pf_cs_coil_flat_top_ma[ic]) + abs(self.data.pf_coil.c_pf_cs_coil_pulse_start_ma[ic]) + >= abs(self.data.pf_coil.c_pf_cs_coil_flat_top_ma[ic]) ): - pfcoil_variables.c_pf_cs_coils_peak_ma[ic] = ( - pfcoil_variables.c_pf_cs_coil_pulse_start_ma[ic] + self.data.pf_coil.c_pf_cs_coils_peak_ma[ic] = ( + self.data.pf_coil.c_pf_cs_coil_pulse_start_ma[ic] ) # Beginning of flat-top, t = t_plant_pulse_coil_precharge + t_plant_pulse_plasma_current_ramp_up if ( - abs(pfcoil_variables.c_pf_cs_coil_flat_top_ma[ic]) - >= abs(pfcoil_variables.c_pf_cs_coil_pulse_start_ma[ic]) + abs(self.data.pf_coil.c_pf_cs_coil_flat_top_ma[ic]) + >= abs(self.data.pf_coil.c_pf_cs_coil_pulse_start_ma[ic]) ) and ( - abs(pfcoil_variables.c_pf_cs_coil_flat_top_ma[ic]) - >= abs(pfcoil_variables.c_pf_cs_coil_pulse_end_ma[ic]) + abs(self.data.pf_coil.c_pf_cs_coil_flat_top_ma[ic]) + >= abs(self.data.pf_coil.c_pf_cs_coil_pulse_end_ma[ic]) ): - pfcoil_variables.c_pf_cs_coils_peak_ma[ic] = ( - pfcoil_variables.c_pf_cs_coil_flat_top_ma[ic] + self.data.pf_coil.c_pf_cs_coils_peak_ma[ic] = ( + self.data.pf_coil.c_pf_cs_coil_flat_top_ma[ic] ) # End of flat-top, t = t_plant_pulse_coil_precharge + t_plant_pulse_plasma_current_ramp_up + t_plant_pulse_fusion_ramp + t_plant_pulse_burn if ( - abs(pfcoil_variables.c_pf_cs_coil_pulse_end_ma[ic]) - >= abs(pfcoil_variables.c_pf_cs_coil_pulse_end_ma[ic]) + abs(self.data.pf_coil.c_pf_cs_coil_pulse_end_ma[ic]) + >= abs(self.data.pf_coil.c_pf_cs_coil_pulse_end_ma[ic]) ) and ( - abs(pfcoil_variables.c_pf_cs_coil_pulse_end_ma[ic]) - >= abs(pfcoil_variables.c_pf_cs_coil_flat_top_ma[ic]) + abs(self.data.pf_coil.c_pf_cs_coil_pulse_end_ma[ic]) + >= abs(self.data.pf_coil.c_pf_cs_coil_flat_top_ma[ic]) ): - pfcoil_variables.c_pf_cs_coils_peak_ma[ic] = ( - pfcoil_variables.c_pf_cs_coil_pulse_end_ma[ic] + self.data.pf_coil.c_pf_cs_coils_peak_ma[ic] = ( + self.data.pf_coil.c_pf_cs_coil_pulse_end_ma[ic] ) # Set normalized current waveforms - pfcoil_variables.f_c_pf_cs_peak_time_array[ic, 0] = 0.0e0 - pfcoil_variables.f_c_pf_cs_peak_time_array[ic, 1] = ( - pfcoil_variables.c_pf_cs_coil_pulse_start_ma[ic] - / pfcoil_variables.c_pf_cs_coils_peak_ma[ic] + self.data.pf_coil.f_c_pf_cs_peak_time_array[ic, 0] = 0.0e0 + self.data.pf_coil.f_c_pf_cs_peak_time_array[ic, 1] = ( + self.data.pf_coil.c_pf_cs_coil_pulse_start_ma[ic] + / self.data.pf_coil.c_pf_cs_coils_peak_ma[ic] ) - pfcoil_variables.f_c_pf_cs_peak_time_array[ic, 2] = ( - pfcoil_variables.c_pf_cs_coil_flat_top_ma[ic] - / pfcoil_variables.c_pf_cs_coils_peak_ma[ic] + self.data.pf_coil.f_c_pf_cs_peak_time_array[ic, 2] = ( + self.data.pf_coil.c_pf_cs_coil_flat_top_ma[ic] + / self.data.pf_coil.c_pf_cs_coils_peak_ma[ic] ) - pfcoil_variables.f_c_pf_cs_peak_time_array[ic, 3] = ( - pfcoil_variables.c_pf_cs_coil_flat_top_ma[ic] - / pfcoil_variables.c_pf_cs_coils_peak_ma[ic] + self.data.pf_coil.f_c_pf_cs_peak_time_array[ic, 3] = ( + self.data.pf_coil.c_pf_cs_coil_flat_top_ma[ic] + / self.data.pf_coil.c_pf_cs_coils_peak_ma[ic] ) - pfcoil_variables.f_c_pf_cs_peak_time_array[ic, 4] = ( - pfcoil_variables.c_pf_cs_coil_pulse_end_ma[ic] - / pfcoil_variables.c_pf_cs_coils_peak_ma[ic] + self.data.pf_coil.f_c_pf_cs_peak_time_array[ic, 4] = ( + self.data.pf_coil.c_pf_cs_coil_pulse_end_ma[ic] + / self.data.pf_coil.c_pf_cs_coils_peak_ma[ic] ) - pfcoil_variables.f_c_pf_cs_peak_time_array[ic, 5] = 0.0e0 + self.data.pf_coil.f_c_pf_cs_peak_time_array[ic, 5] = 0.0e0 class CSCoil(Model): @@ -3147,9 +3147,9 @@ def place_cs_filaments( - z_pf_cs_current_filaments (list of float): Vertical positions of the CS filaments. - c_pf_cs_current_filaments (list of float): Current values assigned to each CS filament. """ - r_pf_cs_current_filaments = np.zeros(pfcoil_variables.NFIXMX) - z_pf_cs_current_filaments = np.zeros(pfcoil_variables.NFIXMX) - c_pf_cs_current_filaments = np.zeros(pfcoil_variables.NFIXMX) + r_pf_cs_current_filaments = np.zeros(NFIXMX) + z_pf_cs_current_filaments = np.zeros(NFIXMX) + c_pf_cs_current_filaments = np.zeros(NFIXMX) for filament in range(n_cs_current_filaments): # Set the R coordinate of the filaments @@ -3183,80 +3183,80 @@ def place_cs_filaments( def ohcalc(self): """Routine to perform calculations for the Central Solenoid.""" ( - pfcoil_variables.z_pf_coil_upper[pfcoil_variables.n_cs_pf_coils - 1], - pfcoil_variables.z_pf_coil_lower[pfcoil_variables.n_cs_pf_coils - 1], - pfcoil_variables.r_pf_coil_middle[pfcoil_variables.n_cs_pf_coils - 1], - pfcoil_variables.r_cs_middle, - pfcoil_variables.z_pf_coil_middle[pfcoil_variables.n_cs_pf_coils - 1], - pfcoil_variables.r_pf_coil_outer[pfcoil_variables.n_cs_pf_coils - 1], - pfcoil_variables.r_pf_coil_inner[pfcoil_variables.n_cs_pf_coils - 1], - pfcoil_variables.a_cs_poloidal, - pfcoil_variables.dz_cs_full, - pfcoil_variables.dr_cs_full, + self.data.pf_coil.z_pf_coil_upper[self.data.pf_coil.n_cs_pf_coils - 1], + self.data.pf_coil.z_pf_coil_lower[self.data.pf_coil.n_cs_pf_coils - 1], + self.data.pf_coil.r_pf_coil_middle[self.data.pf_coil.n_cs_pf_coils - 1], + self.data.pf_coil.r_cs_middle, + self.data.pf_coil.z_pf_coil_middle[self.data.pf_coil.n_cs_pf_coils - 1], + self.data.pf_coil.r_pf_coil_outer[self.data.pf_coil.n_cs_pf_coils - 1], + self.data.pf_coil.r_pf_coil_inner[self.data.pf_coil.n_cs_pf_coils - 1], + self.data.pf_coil.a_cs_poloidal, + self.data.pf_coil.dz_cs_full, + self.data.pf_coil.dr_cs_full, ) = self.calculate_cs_geometry( z_tf_inside_half=self.data.build.z_tf_inside_half, - f_z_cs_tf_internal=pfcoil_variables.f_z_cs_tf_internal, + f_z_cs_tf_internal=self.data.pf_coil.f_z_cs_tf_internal, dr_cs=self.data.build.dr_cs, dr_bore=self.data.build.dr_bore, ) # Maximum current (MA-turns) in central Solenoid, at either BOP or EOF - if pfcoil_variables.j_cs_pulse_start > pfcoil_variables.j_cs_flat_top_end: + if self.data.pf_coil.j_cs_pulse_start > self.data.pf_coil.j_cs_flat_top_end: sgn = 1.0e0 - pfcoil_variables.c_pf_cs_coils_peak_ma[ - pfcoil_variables.n_cs_pf_coils - 1 + self.data.pf_coil.c_pf_cs_coils_peak_ma[ + self.data.pf_coil.n_cs_pf_coils - 1 ] = ( sgn * 1.0e-6 - * pfcoil_variables.j_cs_pulse_start - * pfcoil_variables.a_cs_poloidal + * self.data.pf_coil.j_cs_pulse_start + * self.data.pf_coil.a_cs_poloidal ) else: sgn = -1.0e0 - pfcoil_variables.c_pf_cs_coils_peak_ma[ - pfcoil_variables.n_cs_pf_coils - 1 + self.data.pf_coil.c_pf_cs_coils_peak_ma[ + self.data.pf_coil.n_cs_pf_coils - 1 ] = ( sgn * 1.0e-6 - * pfcoil_variables.j_cs_flat_top_end - * pfcoil_variables.a_cs_poloidal + * self.data.pf_coil.j_cs_flat_top_end + * self.data.pf_coil.a_cs_poloidal ) # Number of turns - pfcoil_variables.n_pf_coil_turns[pfcoil_variables.n_cs_pf_coils - 1] = ( + self.data.pf_coil.n_pf_coil_turns[self.data.pf_coil.n_cs_pf_coils - 1] = ( 1.0e6 * abs( - pfcoil_variables.c_pf_cs_coils_peak_ma[ - pfcoil_variables.n_cs_pf_coils - 1 + self.data.pf_coil.c_pf_cs_coils_peak_ma[ + self.data.pf_coil.n_cs_pf_coils - 1 ] ) - / pfcoil_variables.c_pf_coil_turn_peak_input[ - pfcoil_variables.n_cs_pf_coils - 1 + / self.data.pf_coil.c_pf_coil_turn_peak_input[ + self.data.pf_coil.n_cs_pf_coils - 1 ] ) # Turn vertical cross-sectionnal area - pfcoil_variables.a_cs_turn = ( - pfcoil_variables.a_cs_poloidal - / pfcoil_variables.n_pf_coil_turns[pfcoil_variables.n_cs_pf_coils - 1] + self.data.pf_coil.a_cs_turn = ( + self.data.pf_coil.a_cs_poloidal + / self.data.pf_coil.n_pf_coil_turns[self.data.pf_coil.n_cs_pf_coils - 1] ) ( - pfcoil_variables.dz_cs_turn, - pfcoil_variables.dr_cs_turn, - pfcoil_variables.radius_cs_turn_cable_space, + self.data.pf_coil.dz_cs_turn, + self.data.pf_coil.dr_cs_turn, + self.data.pf_coil.radius_cs_turn_cable_space, self.data.cs_fatigue.dr_cs_turn_conduit, self.data.cs_fatigue.dz_cs_turn_conduit, ) = self.calculate_cs_turn_geometry_eu_demo( - a_cs_turn=pfcoil_variables.a_cs_turn, - f_dr_dz_cs_turn=pfcoil_variables.f_dr_dz_cs_turn, - radius_cs_turn_corners=pfcoil_variables.radius_cs_turn_corners, - f_a_cs_turn_steel=pfcoil_variables.f_a_cs_turn_steel, + a_cs_turn=self.data.pf_coil.a_cs_turn, + f_dr_dz_cs_turn=self.data.pf_coil.f_dr_dz_cs_turn, + radius_cs_turn_corners=self.data.pf_coil.radius_cs_turn_corners, + f_a_cs_turn_steel=self.data.pf_coil.f_a_cs_turn_steel, ) # Non-steel area void fraction for coolant - pfcoil_variables.f_a_pf_coil_void[pfcoil_variables.n_cs_pf_coils - 1] = ( - pfcoil_variables.f_a_cs_void + self.data.pf_coil.f_a_pf_coil_void[self.data.pf_coil.n_cs_pf_coils - 1] = ( + self.data.pf_coil.f_a_cs_void ) # Peak field at the End-Of-Flattop (EOF) @@ -3264,28 +3264,28 @@ def ohcalc(self): # Peak field due to central Solenoid itself bmaxoh2 = self.calculate_cs_self_peak_magnetic_field( - j_cs=pfcoil_variables.j_cs_flat_top_end, - r_cs_inner=pfcoil_variables.r_pf_coil_inner[ - pfcoil_variables.n_cs_pf_coils - 1 + j_cs=self.data.pf_coil.j_cs_flat_top_end, + r_cs_inner=self.data.pf_coil.r_pf_coil_inner[ + self.data.pf_coil.n_cs_pf_coils - 1 ], - r_cs_outer=pfcoil_variables.r_pf_coil_outer[ - pfcoil_variables.n_cs_pf_coils - 1 + r_cs_outer=self.data.pf_coil.r_pf_coil_outer[ + self.data.pf_coil.n_cs_pf_coils - 1 ], - dz_cs_half=pfcoil_variables.z_pf_coil_upper[ - pfcoil_variables.n_cs_pf_coils - 1 + dz_cs_half=self.data.pf_coil.z_pf_coil_upper[ + self.data.pf_coil.n_cs_pf_coils - 1 ], ) # Peak field due to other PF coils plus plasma timepoint = 5 _bri, _bro, bzi, bzo = peak_b_field_at_pf_coil( - n_coil=pfcoil_variables.n_cs_pf_coils, + n_coil=self.data.pf_coil.n_cs_pf_coils, n_coil_group=99, t_b_field_peak=timepoint, data=self.data, ) - pfcoil_variables.b_cs_peak_flat_top_end = abs(bzi - bmaxoh2) + self.data.pf_coil.b_cs_peak_flat_top_end = abs(bzi - bmaxoh2) # Peak field on outboard side of central Solenoid # (self-field is assumed to be zero - long solenoid approximation) @@ -3293,62 +3293,64 @@ def ohcalc(self): # Peak field at the Beginning-Of-Pulse (BOP) # Occurs at inner edge of coil; b_cs_peak_pulse_start and bzi are of same sign at BOP - pfcoil_variables.b_cs_peak_pulse_start = ( + self.data.pf_coil.b_cs_peak_pulse_start = ( self.calculate_cs_self_peak_magnetic_field( - j_cs=pfcoil_variables.j_cs_pulse_start, - r_cs_inner=pfcoil_variables.r_pf_coil_inner[ - pfcoil_variables.n_cs_pf_coils - 1 + j_cs=self.data.pf_coil.j_cs_pulse_start, + r_cs_inner=self.data.pf_coil.r_pf_coil_inner[ + self.data.pf_coil.n_cs_pf_coils - 1 ], - r_cs_outer=pfcoil_variables.r_pf_coil_outer[ - pfcoil_variables.n_cs_pf_coils - 1 + r_cs_outer=self.data.pf_coil.r_pf_coil_outer[ + self.data.pf_coil.n_cs_pf_coils - 1 ], - dz_cs_half=pfcoil_variables.z_pf_coil_upper[ - pfcoil_variables.n_cs_pf_coils - 1 + dz_cs_half=self.data.pf_coil.z_pf_coil_upper[ + self.data.pf_coil.n_cs_pf_coils - 1 ], ) ) timepoint = 2 _bri, _bro, bzi, bzo = peak_b_field_at_pf_coil( - n_coil=pfcoil_variables.n_cs_pf_coils, + n_coil=self.data.pf_coil.n_cs_pf_coils, n_coil_group=99, t_b_field_peak=timepoint, data=self.data, ) - pfcoil_variables.b_cs_peak_pulse_start = abs( - pfcoil_variables.b_cs_peak_pulse_start + bzi + self.data.pf_coil.b_cs_peak_pulse_start = abs( + self.data.pf_coil.b_cs_peak_pulse_start + bzi ) # Maximum field values - pfcoil_variables.b_pf_coil_peak[pfcoil_variables.n_cs_pf_coils - 1] = max( - pfcoil_variables.b_cs_peak_flat_top_end, - abs(pfcoil_variables.b_cs_peak_pulse_start), + self.data.pf_coil.b_pf_coil_peak[self.data.pf_coil.n_cs_pf_coils - 1] = max( + self.data.pf_coil.b_cs_peak_flat_top_end, + abs(self.data.pf_coil.b_cs_peak_pulse_start), + ) + self.data.pf_coil.bpf2[self.data.pf_coil.n_cs_pf_coils - 1] = max( + bohco, abs(bzo) ) - pfcoil_variables.bpf2[pfcoil_variables.n_cs_pf_coils - 1] = max(bohco, abs(bzo)) # Stress ==> cross-sectional area of supporting steel to use - if pfcoil_variables.i_pf_conductor == 0: + if self.data.pf_coil.i_pf_conductor == 0: # Superconducting coil # New calculation from M. N. Wilson for hoop stress - pfcoil_variables.sig_hoop = self.hoop_stress( - pfcoil_variables.r_pf_coil_inner[pfcoil_variables.n_cs_pf_coils - 1] + self.data.pf_coil.sig_hoop = self.hoop_stress( + self.data.pf_coil.r_pf_coil_inner[self.data.pf_coil.n_cs_pf_coils - 1] ) # New calculation from Y. Iwasa for axial stress ( - pfcoil_variables.stress_z_cs_self_peak_midplane, - pfcoil_variables.forc_z_cs_self_peak_midplane, + self.data.pf_coil.stress_z_cs_self_peak_midplane, + self.data.pf_coil.forc_z_cs_self_peak_midplane, ) = self.calculate_cs_self_peak_midplane_axial_stress( - r_cs_outer=pfcoil_variables.r_pf_coil_outer[ - pfcoil_variables.n_cs_pf_coils - 1 + r_cs_outer=self.data.pf_coil.r_pf_coil_outer[ + self.data.pf_coil.n_cs_pf_coils - 1 ], - r_cs_inner=pfcoil_variables.r_pf_coil_inner[ - pfcoil_variables.n_cs_pf_coils - 1 + r_cs_inner=self.data.pf_coil.r_pf_coil_inner[ + self.data.pf_coil.n_cs_pf_coils - 1 ], - dz_cs_half=pfcoil_variables.dz_cs_full / 2.0, - c_cs_peak=pfcoil_variables.c_pf_cs_coils_peak_ma[ - pfcoil_variables.n_cs_pf_coils - 1 + dz_cs_half=self.data.pf_coil.dz_cs_full / 2.0, + c_cs_peak=self.data.pf_coil.c_pf_cs_coils_peak_ma[ + self.data.pf_coil.n_cs_pf_coils - 1 ] * 1.0e6, ) @@ -3364,7 +3366,7 @@ def ohcalc(self): self.data.cs_fatigue.n_cycle, self.data.cs_fatigue.t_crack_radial, ) = self.cs_fatigue.ncycle( - pfcoil_variables.sig_hoop, + self.data.pf_coil.sig_hoop, self.data.cs_fatigue.residual_sig_hoop, self.data.cs_fatigue.t_crack_vertical, self.data.cs_fatigue.dz_cs_turn_conduit, @@ -3375,99 +3377,105 @@ def ohcalc(self): # equation is used for Central Solenoid stress # Area of steel in Central Solenoid - areaspf = pfcoil_variables.f_a_cs_turn_steel * pfcoil_variables.a_cs_poloidal + areaspf = ( + self.data.pf_coil.f_a_cs_turn_steel * self.data.pf_coil.a_cs_poloidal + ) - if pfcoil_variables.i_cs_stress == 1: - pfcoil_variables.s_shear_cs_peak = max( + if self.data.pf_coil.i_cs_stress == 1: + self.data.pf_coil.s_shear_cs_peak = max( abs( - pfcoil_variables.sig_hoop - - pfcoil_variables.stress_z_cs_self_peak_midplane + self.data.pf_coil.sig_hoop + - self.data.pf_coil.stress_z_cs_self_peak_midplane ), - abs(pfcoil_variables.stress_z_cs_self_peak_midplane - 0.0e0), - abs(0.0e0 - pfcoil_variables.sig_hoop), + abs(self.data.pf_coil.stress_z_cs_self_peak_midplane - 0.0e0), + abs(0.0e0 - self.data.pf_coil.sig_hoop), ) else: - pfcoil_variables.s_shear_cs_peak = max( - abs(pfcoil_variables.sig_hoop - 0.0e0), + self.data.pf_coil.s_shear_cs_peak = max( + abs(self.data.pf_coil.sig_hoop - 0.0e0), abs(0.0e0 - 0.0e0), - abs(0.0e0 - pfcoil_variables.sig_hoop), + abs(0.0e0 - self.data.pf_coil.sig_hoop), ) # Thickness of hypothetical steel cylinders assumed to encase the CS along # its inside and outside edges; in reality, the steel is distributed # throughout the conductor - pfcoil_variables.pfcaseth[pfcoil_variables.n_cs_pf_coils - 1] = ( + self.data.pf_coil.pfcaseth[self.data.pf_coil.n_cs_pf_coils - 1] = ( 0.25e0 * areaspf - / pfcoil_variables.z_pf_coil_upper[pfcoil_variables.n_cs_pf_coils - 1] + / self.data.pf_coil.z_pf_coil_upper[self.data.pf_coil.n_cs_pf_coils - 1] ) else: areaspf = 0.0e0 # Resistive Central Solenoid - no steel needed - pfcoil_variables.pfcaseth[pfcoil_variables.n_cs_pf_coils - 1] = 0.0e0 + self.data.pf_coil.pfcaseth[self.data.pf_coil.n_cs_pf_coils - 1] = 0.0e0 # Weight of steel - pfcoil_variables.m_pf_coil_structure[pfcoil_variables.n_cs_pf_coils - 1] = ( + self.data.pf_coil.m_pf_coil_structure[self.data.pf_coil.n_cs_pf_coils - 1] = ( areaspf * 2.0e0 * np.pi - * pfcoil_variables.r_pf_coil_middle[pfcoil_variables.n_cs_pf_coils - 1] + * self.data.pf_coil.r_pf_coil_middle[self.data.pf_coil.n_cs_pf_coils - 1] * self.data.fwbs.den_steel ) # Non-steel cross-sectional area - pfcoil_variables.awpoh = pfcoil_variables.a_cs_poloidal - areaspf + self.data.pf_coil.awpoh = self.data.pf_coil.a_cs_poloidal - areaspf # Issue #97. Fudge to ensure awpoh is positive; result is continuous, smooth and # monotonically decreases da = 0.0001e0 # 1 cm^2 - if pfcoil_variables.awpoh < da: - pfcoil_variables.awpoh = da * da / (2.0e0 * da - pfcoil_variables.awpoh) + if self.data.pf_coil.awpoh < da: + self.data.pf_coil.awpoh = da * da / (2.0e0 * da - self.data.pf_coil.awpoh) # Weight of conductor in central Solenoid - if pfcoil_variables.i_pf_conductor == 0: - pfcoil_variables.m_pf_coil_conductor[pfcoil_variables.n_cs_pf_coils - 1] = ( - pfcoil_variables.awpoh - * (1.0e0 - pfcoil_variables.f_a_cs_void) + if self.data.pf_coil.i_pf_conductor == 0: + self.data.pf_coil.m_pf_coil_conductor[ + self.data.pf_coil.n_cs_pf_coils - 1 + ] = ( + self.data.pf_coil.awpoh + * (1.0e0 - self.data.pf_coil.f_a_cs_void) * 2.0e0 * np.pi - * pfcoil_variables.r_pf_coil_middle[pfcoil_variables.n_cs_pf_coils - 1] - * tfv.dcond[pfcoil_variables.i_cs_superconductor - 1] + * self.data.pf_coil.r_pf_coil_middle[self.data.pf_coil.n_cs_pf_coils - 1] + * tfv.dcond[self.data.pf_coil.i_cs_superconductor - 1] ) else: - pfcoil_variables.m_pf_coil_conductor[pfcoil_variables.n_cs_pf_coils - 1] = ( - pfcoil_variables.awpoh - * (1.0e0 - pfcoil_variables.f_a_cs_void) + self.data.pf_coil.m_pf_coil_conductor[ + self.data.pf_coil.n_cs_pf_coils - 1 + ] = ( + self.data.pf_coil.awpoh + * (1.0e0 - self.data.pf_coil.f_a_cs_void) * 2.0e0 * np.pi - * pfcoil_variables.r_pf_coil_middle[pfcoil_variables.n_cs_pf_coils - 1] + * self.data.pf_coil.r_pf_coil_middle[self.data.pf_coil.n_cs_pf_coils - 1] * constants.den_copper ) - if pfcoil_variables.i_pf_conductor == 0: + if self.data.pf_coil.i_pf_conductor == 0: # Allowable coil overall current density at EOF # (superconducting coils only) ( jcritwp, - pfcoil_variables.jcableoh_eof, - pfcoil_variables.j_cs_conductor_critical_flat_top_end, + self.data.pf_coil.jcableoh_eof, + self.data.pf_coil.j_cs_conductor_critical_flat_top_end, tmarg1, ) = superconpf( - pfcoil_variables.b_cs_peak_flat_top_end, - pfcoil_variables.f_a_cs_void, - pfcoil_variables.fcuohsu, + self.data.pf_coil.b_cs_peak_flat_top_end, + self.data.pf_coil.f_a_cs_void, + self.data.pf_coil.fcuohsu, ( abs( - pfcoil_variables.c_pf_cs_coils_peak_ma[ - pfcoil_variables.n_cs_pf_coils - 1 + self.data.pf_coil.c_pf_cs_coils_peak_ma[ + self.data.pf_coil.n_cs_pf_coils - 1 ] ) - / pfcoil_variables.awpoh + / self.data.pf_coil.awpoh ) * 1.0e6, - pfcoil_variables.i_cs_superconductor, + self.data.pf_coil.i_cs_superconductor, tfv.fhts, tfv.str_cs_con_res, tfv.tftmp, @@ -3476,41 +3484,41 @@ def ohcalc(self): ) # Strand critical current calculation for costing in $/kAm # = superconducting filaments jc * (1 - strand copper fraction) - if pfcoil_variables.i_cs_superconductor in {2, 6, 8}: - pfcoil_variables.j_crit_str_cs = ( - pfcoil_variables.j_cs_conductor_critical_flat_top_end + if self.data.pf_coil.i_cs_superconductor in {2, 6, 8}: + self.data.pf_coil.j_crit_str_cs = ( + self.data.pf_coil.j_cs_conductor_critical_flat_top_end ) else: - pfcoil_variables.j_crit_str_cs = ( - pfcoil_variables.j_cs_conductor_critical_flat_top_end - * (1 - pfcoil_variables.fcuohsu) + self.data.pf_coil.j_crit_str_cs = ( + self.data.pf_coil.j_cs_conductor_critical_flat_top_end + * (1 - self.data.pf_coil.fcuohsu) ) - pfcoil_variables.j_cs_critical_flat_top_end = ( - jcritwp * pfcoil_variables.awpoh / pfcoil_variables.a_cs_poloidal + self.data.pf_coil.j_cs_critical_flat_top_end = ( + jcritwp * self.data.pf_coil.awpoh / self.data.pf_coil.a_cs_poloidal ) # Allowable coil overall current density at BOP ( jcritwp, - pfcoil_variables.jcableoh_bop, - pfcoil_variables.j_cs_conductor_critical_pulse_start, + self.data.pf_coil.jcableoh_bop, + self.data.pf_coil.j_cs_conductor_critical_pulse_start, tmarg2, ) = superconpf( - pfcoil_variables.b_cs_peak_pulse_start, - pfcoil_variables.f_a_cs_void, - pfcoil_variables.fcuohsu, + self.data.pf_coil.b_cs_peak_pulse_start, + self.data.pf_coil.f_a_cs_void, + self.data.pf_coil.fcuohsu, ( abs( - pfcoil_variables.c_pf_cs_coils_peak_ma[ - pfcoil_variables.n_cs_pf_coils - 1 + self.data.pf_coil.c_pf_cs_coils_peak_ma[ + self.data.pf_coil.n_cs_pf_coils - 1 ] ) - / pfcoil_variables.awpoh + / self.data.pf_coil.awpoh ) * 1.0e6, - pfcoil_variables.i_cs_superconductor, + self.data.pf_coil.i_cs_superconductor, tfv.fhts, tfv.str_cs_con_res, tfv.tftmp, @@ -3518,37 +3526,37 @@ def ohcalc(self): tfv.tcritsc, ) - pfcoil_variables.j_pf_wp_critical[pfcoil_variables.n_cs_pf_coils - 1] = ( - jcritwp * pfcoil_variables.awpoh / pfcoil_variables.a_cs_poloidal + self.data.pf_coil.j_pf_wp_critical[self.data.pf_coil.n_cs_pf_coils - 1] = ( + jcritwp * self.data.pf_coil.awpoh / self.data.pf_coil.a_cs_poloidal ) - pfcoil_variables.j_cs_critical_pulse_start = ( - pfcoil_variables.j_pf_wp_critical[pfcoil_variables.n_cs_pf_coils - 1] + self.data.pf_coil.j_cs_critical_pulse_start = ( + self.data.pf_coil.j_pf_wp_critical[self.data.pf_coil.n_cs_pf_coils - 1] ) - pfcoil_variables.temp_cs_superconductor_margin = min(tmarg1, tmarg2) + self.data.pf_coil.temp_cs_superconductor_margin = min(tmarg1, tmarg2) else: # Resistive power losses (non-superconducting coil) - pfcoil_variables.p_cs_resistive_flat_top = ( + self.data.pf_coil.p_cs_resistive_flat_top = ( 2.0e0 * np.pi - * pfcoil_variables.r_cs_middle - * pfcoil_variables.rho_pf_coil + * self.data.pf_coil.r_cs_middle + * self.data.pf_coil.rho_pf_coil / ( - pfcoil_variables.a_cs_poloidal - * (1.0e0 - pfcoil_variables.f_a_cs_void) + self.data.pf_coil.a_cs_poloidal + * (1.0e0 - self.data.pf_coil.f_a_cs_void) ) * ( 1.0e6 - * pfcoil_variables.c_pf_cs_coils_peak_ma[ - pfcoil_variables.n_cs_pf_coils - 1 + * self.data.pf_coil.c_pf_cs_coils_peak_ma[ + self.data.pf_coil.n_cs_pf_coils - 1 ] ) ** 2 ) - pfcoil_variables.p_pf_coil_resistive_total_flat_top += ( - pfcoil_variables.p_cs_resistive_flat_top + self.data.pf_coil.p_pf_coil_resistive_total_flat_top += ( + self.data.pf_coil.p_cs_resistive_flat_top ) def calculate_cs_self_peak_magnetic_field( @@ -3638,35 +3646,35 @@ def output_cs_structure(self): self.outfile, "Poloidal area of a CS turn [m^2]", "(a_cs_turn)", - pfcoil_variables.a_cs_turn, + self.data.pf_coil.a_cs_turn, "OP ", ) op.ovarre( self.outfile, "Radial width a CS turn [m^2]", "(dz_cs_turn)", - pfcoil_variables.dz_cs_turn, + self.data.pf_coil.dz_cs_turn, "OP ", ) op.ovarre( self.outfile, "Length of a CS turn [m]", "(dr_cs_turn)", - pfcoil_variables.dr_cs_turn, + self.data.pf_coil.dr_cs_turn, "OP ", ) op.ovarre( self.outfile, "Length to diameter ratio of a CS turn", "(f_dr_dz_cs_turn)", - pfcoil_variables.f_dr_dz_cs_turn, + self.data.pf_coil.f_dr_dz_cs_turn, "OP ", ) op.ovarre( self.outfile, "Radius of CS turn cable space [m]", "(radius_cs_turn_cable_space)", - pfcoil_variables.radius_cs_turn_cable_space, + self.data.pf_coil.radius_cs_turn_cable_space, "OP ", ) op.ovarre( @@ -3687,7 +3695,7 @@ def output_cs_structure(self): self.outfile, "Corner radius of CS turn [m]", "(radius_cs_turn_corners)", - pfcoil_variables.radius_cs_turn_corners, + self.data.pf_coil.radius_cs_turn_corners, "OP ", ) @@ -3789,10 +3797,10 @@ def hoop_stress(self, r): float hoop stress (MPa) """ - a = pfcoil_variables.r_pf_coil_inner[pfcoil_variables.n_cs_pf_coils - 1] + a = self.data.pf_coil.r_pf_coil_inner[self.data.pf_coil.n_cs_pf_coils - 1] # Outer radius of central Solenoid [m] - b = pfcoil_variables.r_pf_coil_outer[pfcoil_variables.n_cs_pf_coils - 1] + b = self.data.pf_coil.r_pf_coil_outer[self.data.pf_coil.n_cs_pf_coils - 1] # alpha alpha = b / a @@ -3801,14 +3809,14 @@ def hoop_stress(self, r): epsilon = r / a # Field at inner radius of coil [T] - b_a = pfcoil_variables.b_cs_peak_pulse_start + b_a = self.data.pf_coil.b_cs_peak_pulse_start # Field at outer radius of coil [T] # Assume to be 0 for now b_b = 0.0e0 # current density [A/m^2] - j = pfcoil_variables.j_cs_pulse_start + j = self.data.pf_coil.j_cs_pulse_start # K term k = ((alpha * b_a - b_b) * j * a) / (alpha - 1.0e0) @@ -3843,7 +3851,7 @@ def hoop_stress(self, r): s_hoop_nom = hp_term_1 * hp_term_2 - hp_term_3 * hp_term_4 - return s_hoop_nom / pfcoil_variables.f_a_cs_turn_steel + return s_hoop_nom / self.data.pf_coil.f_a_cs_turn_steel def peak_b_field_at_pf_coil( @@ -3876,7 +3884,7 @@ def peak_b_field_at_pf_coil( This routine calculates the peak magnetic field components at the inner and outer edges of a given PF coil. The calculation includes the effects from all the coils and the plasma. """ - if data.build.iohcl != 0 and n_coil == pfcoil_variables.n_cs_pf_coils: + if data.build.iohcl != 0 and n_coil == data.pf_coil.n_cs_pf_coils: # Peak field is to be calculated at the Central Solenoid itself, # so exclude its own contribution; its self field is # dealt with externally using routine calculate_cs_self_peak_magnetic_field() @@ -3885,24 +3893,24 @@ def peak_b_field_at_pf_coil( # Check different times for maximum current if ( abs( - pfcoil_variables.c_pf_cs_coil_pulse_start_ma[n_coil - 1] - - pfcoil_variables.c_pf_cs_coils_peak_ma[n_coil - 1] + data.pf_coil.c_pf_cs_coil_pulse_start_ma[n_coil - 1] + - data.pf_coil.c_pf_cs_coils_peak_ma[n_coil - 1] ) < 1.0e-12 ): t_b_field_peak = 2 elif ( abs( - pfcoil_variables.c_pf_cs_coil_flat_top_ma[n_coil - 1] - - pfcoil_variables.c_pf_cs_coils_peak_ma[n_coil - 1] + data.pf_coil.c_pf_cs_coil_flat_top_ma[n_coil - 1] + - data.pf_coil.c_pf_cs_coils_peak_ma[n_coil - 1] ) < 1.0e-12 ): t_b_field_peak = 4 elif ( abs( - pfcoil_variables.c_pf_cs_coil_pulse_end_ma[n_coil - 1] - - pfcoil_variables.c_pf_cs_coils_peak_ma[n_coil - 1] + data.pf_coil.c_pf_cs_coil_pulse_end_ma[n_coil - 1] + - data.pf_coil.c_pf_cs_coils_peak_ma[n_coil - 1] ) < 1.0e-12 ): @@ -3919,31 +3927,31 @@ def peak_b_field_at_pf_coil( else: sgn = ( 1.0 - if pfcoil_variables.j_cs_pulse_start > pfcoil_variables.j_cs_flat_top_end + if data.pf_coil.j_cs_pulse_start > data.pf_coil.j_cs_flat_top_end else -1.0 ) # Current in each filament representing part of the Central Solenoid - for iohc in range(pfcoil_variables.nfxf): - pfcoil_variables.c_pf_cs_current_filaments[iohc] = ( - pfcoil_variables.f_c_pf_cs_peak_time_array[ - pfcoil_variables.n_cs_pf_coils - 1, t_b_field_peak - 1 + for iohc in range(data.pf_coil.nfxf): + data.pf_coil.c_pf_cs_current_filaments[iohc] = ( + data.pf_coil.f_c_pf_cs_peak_time_array[ + data.pf_coil.n_cs_pf_coils - 1, t_b_field_peak - 1 ] - * pfcoil_variables.j_cs_flat_top_end + * data.pf_coil.j_cs_flat_top_end * sgn * data.build.dr_cs - * pfcoil_variables.f_z_cs_tf_internal + * data.pf_coil.f_z_cs_tf_internal * data.build.z_tf_inside_half - / pfcoil_variables.nfxf + / data.pf_coil.nfxf * 2.0e0 ) - kk = pfcoil_variables.nfxf + kk = data.pf_coil.nfxf # Non-Central Solenoid coils' contributions jj = 0 - for iii in range(pfcoil_variables.n_pf_coil_groups): - for _jjj in range(pfcoil_variables.n_pf_coils_in_group[iii]): + for iii in range(data.pf_coil.n_pf_coil_groups): + for _jjj in range(data.pf_coil.n_pf_coils_in_group[iii]): jj += 1 # Radius, z-coordinate and current for each coil if iii == n_coil_group - 1: @@ -3951,112 +3959,102 @@ def peak_b_field_at_pf_coil( kk += 1 dzpf = ( - pfcoil_variables.z_pf_coil_upper[jj - 1] - - pfcoil_variables.z_pf_coil_lower[jj - 1] + data.pf_coil.z_pf_coil_upper[jj - 1] + - data.pf_coil.z_pf_coil_lower[jj - 1] ) - pfcoil_variables.r_pf_cs_current_filaments[kk - 1] = ( - pfcoil_variables.r_pf_coil_middle[jj - 1] + data.pf_coil.r_pf_cs_current_filaments[kk - 1] = ( + data.pf_coil.r_pf_coil_middle[jj - 1] ) - pfcoil_variables.z_pf_cs_current_filaments[kk - 1] = ( - pfcoil_variables.z_pf_coil_middle[jj - 1] + dzpf * 0.125e0 + data.pf_coil.z_pf_cs_current_filaments[kk - 1] = ( + data.pf_coil.z_pf_coil_middle[jj - 1] + dzpf * 0.125e0 ) - pfcoil_variables.c_pf_cs_current_filaments[kk - 1] = ( - pfcoil_variables.c_pf_cs_coils_peak_ma[jj - 1] - * pfcoil_variables.f_c_pf_cs_peak_time_array[ - jj - 1, t_b_field_peak - 1 - ] + data.pf_coil.c_pf_cs_current_filaments[kk - 1] = ( + data.pf_coil.c_pf_cs_coils_peak_ma[jj - 1] + * data.pf_coil.f_c_pf_cs_peak_time_array[jj - 1, t_b_field_peak - 1] * 0.25e6 ) kk += 1 - pfcoil_variables.r_pf_cs_current_filaments[kk - 1] = ( - pfcoil_variables.r_pf_coil_middle[jj - 1] + data.pf_coil.r_pf_cs_current_filaments[kk - 1] = ( + data.pf_coil.r_pf_coil_middle[jj - 1] ) - pfcoil_variables.z_pf_cs_current_filaments[kk - 1] = ( - pfcoil_variables.z_pf_coil_middle[jj - 1] + dzpf * 0.375e0 + data.pf_coil.z_pf_cs_current_filaments[kk - 1] = ( + data.pf_coil.z_pf_coil_middle[jj - 1] + dzpf * 0.375e0 ) - pfcoil_variables.c_pf_cs_current_filaments[kk - 1] = ( - pfcoil_variables.c_pf_cs_coils_peak_ma[jj - 1] - * pfcoil_variables.f_c_pf_cs_peak_time_array[ - jj - 1, t_b_field_peak - 1 - ] + data.pf_coil.c_pf_cs_current_filaments[kk - 1] = ( + data.pf_coil.c_pf_cs_coils_peak_ma[jj - 1] + * data.pf_coil.f_c_pf_cs_peak_time_array[jj - 1, t_b_field_peak - 1] * 0.25e6 ) kk += 1 - pfcoil_variables.r_pf_cs_current_filaments[kk - 1] = ( - pfcoil_variables.r_pf_coil_middle[jj - 1] + data.pf_coil.r_pf_cs_current_filaments[kk - 1] = ( + data.pf_coil.r_pf_coil_middle[jj - 1] ) - pfcoil_variables.z_pf_cs_current_filaments[kk - 1] = ( - pfcoil_variables.z_pf_coil_middle[jj - 1] - dzpf * 0.125e0 + data.pf_coil.z_pf_cs_current_filaments[kk - 1] = ( + data.pf_coil.z_pf_coil_middle[jj - 1] - dzpf * 0.125e0 ) - pfcoil_variables.c_pf_cs_current_filaments[kk - 1] = ( - pfcoil_variables.c_pf_cs_coils_peak_ma[jj - 1] - * pfcoil_variables.f_c_pf_cs_peak_time_array[ - jj - 1, t_b_field_peak - 1 - ] + data.pf_coil.c_pf_cs_current_filaments[kk - 1] = ( + data.pf_coil.c_pf_cs_coils_peak_ma[jj - 1] + * data.pf_coil.f_c_pf_cs_peak_time_array[jj - 1, t_b_field_peak - 1] * 0.25e6 ) kk += 1 - pfcoil_variables.r_pf_cs_current_filaments[kk - 1] = ( - pfcoil_variables.r_pf_coil_middle[jj - 1] + data.pf_coil.r_pf_cs_current_filaments[kk - 1] = ( + data.pf_coil.r_pf_coil_middle[jj - 1] ) - pfcoil_variables.z_pf_cs_current_filaments[kk - 1] = ( - pfcoil_variables.z_pf_coil_middle[jj - 1] - dzpf * 0.375e0 + data.pf_coil.z_pf_cs_current_filaments[kk - 1] = ( + data.pf_coil.z_pf_coil_middle[jj - 1] - dzpf * 0.375e0 ) - pfcoil_variables.c_pf_cs_current_filaments[kk - 1] = ( - pfcoil_variables.c_pf_cs_coils_peak_ma[jj - 1] - * pfcoil_variables.f_c_pf_cs_peak_time_array[ - jj - 1, t_b_field_peak - 1 - ] + data.pf_coil.c_pf_cs_current_filaments[kk - 1] = ( + data.pf_coil.c_pf_cs_coils_peak_ma[jj - 1] + * data.pf_coil.f_c_pf_cs_peak_time_array[jj - 1, t_b_field_peak - 1] * 0.25e6 ) else: # Field from different coil kk += 1 - pfcoil_variables.r_pf_cs_current_filaments[kk - 1] = ( - pfcoil_variables.r_pf_coil_middle[jj - 1] + data.pf_coil.r_pf_cs_current_filaments[kk - 1] = ( + data.pf_coil.r_pf_coil_middle[jj - 1] ) - pfcoil_variables.z_pf_cs_current_filaments[kk - 1] = ( - pfcoil_variables.z_pf_coil_middle[jj - 1] + data.pf_coil.z_pf_cs_current_filaments[kk - 1] = ( + data.pf_coil.z_pf_coil_middle[jj - 1] ) - pfcoil_variables.c_pf_cs_current_filaments[kk - 1] = ( - pfcoil_variables.c_pf_cs_coils_peak_ma[jj - 1] - * pfcoil_variables.f_c_pf_cs_peak_time_array[ - jj - 1, t_b_field_peak - 1 - ] + data.pf_coil.c_pf_cs_current_filaments[kk - 1] = ( + data.pf_coil.c_pf_cs_coils_peak_ma[jj - 1] + * data.pf_coil.f_c_pf_cs_peak_time_array[jj - 1, t_b_field_peak - 1] * 1.0e6 ) # Plasma contribution if t_b_field_peak > 2: kk += 1 - pfcoil_variables.r_pf_cs_current_filaments[kk - 1] = pv.rmajor - pfcoil_variables.z_pf_cs_current_filaments[kk - 1] = 0.0e0 - pfcoil_variables.c_pf_cs_current_filaments[kk - 1] = pv.plasma_current + data.pf_coil.r_pf_cs_current_filaments[kk - 1] = pv.rmajor + data.pf_coil.z_pf_cs_current_filaments[kk - 1] = 0.0e0 + data.pf_coil.c_pf_cs_current_filaments[kk - 1] = pv.plasma_current # Calculate the field at the inner and outer edges # of the coil of interest - pfcoil_variables.xind[:kk], b_pf_inner_radial, b_pf_inner_vertical, _psi = ( + data.pf_coil.xind[:kk], b_pf_inner_radial, b_pf_inner_vertical, _psi = ( calculate_b_field_at_point( - r_current_loop=pfcoil_variables.r_pf_cs_current_filaments[:kk], - z_current_loop=pfcoil_variables.z_pf_cs_current_filaments[:kk], - c_current_loop=pfcoil_variables.c_pf_cs_current_filaments[:kk], - r_test_point=pfcoil_variables.r_pf_coil_inner[n_coil - 1], - z_test_point=pfcoil_variables.z_pf_coil_middle[n_coil - 1], + r_current_loop=data.pf_coil.r_pf_cs_current_filaments[:kk], + z_current_loop=data.pf_coil.z_pf_cs_current_filaments[:kk], + c_current_loop=data.pf_coil.c_pf_cs_current_filaments[:kk], + r_test_point=data.pf_coil.r_pf_coil_inner[n_coil - 1], + z_test_point=data.pf_coil.z_pf_coil_middle[n_coil - 1], ) ) - pfcoil_variables.xind[:kk], b_pf_outer_radial, b_pf_outer_vertical, _psi = ( + data.pf_coil.xind[:kk], b_pf_outer_radial, b_pf_outer_vertical, _psi = ( calculate_b_field_at_point( - r_current_loop=pfcoil_variables.r_pf_cs_current_filaments[:kk], - z_current_loop=pfcoil_variables.z_pf_cs_current_filaments[:kk], - c_current_loop=pfcoil_variables.c_pf_cs_current_filaments[:kk], - r_test_point=pfcoil_variables.r_pf_coil_outer[n_coil - 1], - z_test_point=pfcoil_variables.z_pf_coil_middle[n_coil - 1], + r_current_loop=data.pf_coil.r_pf_cs_current_filaments[:kk], + z_current_loop=data.pf_coil.z_pf_cs_current_filaments[:kk], + c_current_loop=data.pf_coil.c_pf_cs_current_filaments[:kk], + r_test_point=data.pf_coil.r_pf_coil_outer[n_coil - 1], + z_test_point=data.pf_coil.z_pf_coil_middle[n_coil - 1], ) ) # b_pf_coil_peak and bpf2 for the Central Solenoid are calculated in OHCALC - if (data.build.iohcl != 0) and (n_coil == pfcoil_variables.n_cs_pf_coils): + if (data.build.iohcl != 0) and (n_coil == data.pf_coil.n_cs_pf_coils): return ( b_pf_inner_radial, b_pf_outer_radial, @@ -4066,9 +4064,9 @@ def peak_b_field_at_pf_coil( bpfin = math.sqrt(b_pf_inner_radial**2 + b_pf_inner_vertical**2) bpfout = math.sqrt(b_pf_outer_radial**2 + b_pf_outer_vertical**2) - for n in range(pfcoil_variables.n_pf_coils_in_group[n_coil_group - 1]): - pfcoil_variables.b_pf_coil_peak[n_coil - 1 + n] = bpfin - pfcoil_variables.bpf2[n_coil - 1 + n] = bpfout + for n in range(data.pf_coil.n_pf_coils_in_group[n_coil_group - 1]): + data.pf_coil.b_pf_coil_peak[n_coil - 1 + n] = bpfin + data.pf_coil.bpf2[n_coil - 1 + n] = bpfout return ( b_pf_inner_radial, diff --git a/process/models/physics/confinement_time.py b/process/models/physics/confinement_time.py index e02a511ff..451b634e1 100644 --- a/process/models/physics/confinement_time.py +++ b/process/models/physics/confinement_time.py @@ -10,10 +10,7 @@ from process.core import process_output as po from process.core.exceptions import ProcessValueError from process.core.model import Model -from process.data_structure import ( - physics_variables, - stellarator_variables, -) +from process.data_structure import physics_variables from process.models.physics.plasma_geometry import PlasmaGeom logger = logging.getLogger(__name__) @@ -1395,7 +1392,7 @@ def output_confinement_time_info(self): po.oblnkl(self.outfile) # Plot table of al the H-factor scalings and coparison values - self.output_confinement_comparison(istell=stellarator_variables.istell) + self.output_confinement_comparison(istell=self.data.stellarator.istell) def output_confinement_comparison(self, istell: int): """Routine to calculate ignition margin for different confinement scalings and diff --git a/process/models/physics/physics.py b/process/models/physics/physics.py index cde24511a..30768c388 100644 --- a/process/models/physics/physics.py +++ b/process/models/physics/physics.py @@ -22,7 +22,6 @@ impurity_radiation_module, numerics, physics_variables, - stellarator_variables, ) from process.models.physics import impurity_radiation from process.models.physics.plasma_geometry import PlasmaGeom @@ -1726,7 +1725,7 @@ def outplas(self): self.geometry.output() self.current.output() - if stellarator_variables.istell == 0: + if self.data.stellarator.istell == 0: self.fields.output() # Output beta information @@ -1735,7 +1734,7 @@ def outplas(self): self.output_temperature_density_profile_info() po.oblnkl(self.outfile) - if stellarator_variables.istell == 0: + if self.data.stellarator.istell == 0: self.density_limit.output() po.oheadr(self.outfile, "Plasma Reactions :") @@ -2062,7 +2061,7 @@ def outplas(self): "OP ", ) - if stellarator_variables.istell != 0: + if self.data.stellarator.istell != 0: po.ovarre( self.outfile, "SOL radiation power as imposed by f_rad (MW)", @@ -2087,7 +2086,7 @@ def outplas(self): "OP ", ) - if stellarator_variables.istell == 0: + if self.data.stellarator.istell == 0: po.oblnkl(self.outfile) po.ovarre( self.outfile, @@ -2248,12 +2247,12 @@ def outplas(self): self.exhaust.output() - if stellarator_variables.istell == 0: + if self.data.stellarator.istell == 0: self.plasma_transition.output_l_h_threshold_powers() self.confinement.output_confinement_time_info() - if stellarator_variables.istell == 0: + if self.data.stellarator.istell == 0: # Issues 363 Output dimensionless plasma parameters MDK po.osubhd(self.outfile, "Dimensionless plasma parameters") po.ocmmnt(self.outfile, "For definitions see") @@ -2292,7 +2291,7 @@ def outplas(self): po.oblnkl(self.outfile) self.inductance.output_volt_second_information() - if stellarator_variables.istell == 0: + if self.data.stellarator.istell == 0: self.plasma_bootstrap_current.output() self.dia_current.output() @@ -2572,7 +2571,7 @@ def output_temperature_density_profile_info(self) -> None: physics_variables.nd_plasma_electron_line, "OP ", ) - if stellarator_variables.istell == 0: + if self.data.stellarator.istell == 0: po.ovarre( self.outfile, "Greenwald fraction (f_GW)", @@ -3880,7 +3879,7 @@ def output_beta_information(self): ) po.oblnkl(self.outfile) - if stellarator_variables.istell == 0: + if self.data.stellarator.istell == 0: if ( BetaNormMaxModel(physics_variables.i_beta_norm_max) != BetaNormMaxModel.USER_INPUT diff --git a/process/models/physics/plasma_current.py b/process/models/physics/plasma_current.py index 293029019..5c35b83d5 100644 --- a/process/models/physics/plasma_current.py +++ b/process/models/physics/plasma_current.py @@ -16,10 +16,7 @@ from process.core import process_output as po from process.core.exceptions import ProcessValueError from process.core.model import Model -from process.data_structure import ( - physics_variables, - stellarator_variables, -) +from process.data_structure import physics_variables from process.models.physics.plasma_geometry import PlasmaGeometryModelType logger = logging.getLogger(__name__) @@ -68,7 +65,7 @@ def full_name(self): return self._full_name_ -class PlasmaCurrent: +class PlasmaCurrent(Model): """Class to hold plasma current calculations for plasma processing.""" def __init__(self): @@ -76,11 +73,14 @@ def __init__(self): self.outfile = constants.NOUT self.mfile = constants.MFILE + def run(self): + """This model doesn't need to be run""" + def output(self) -> None: """Output plasma current and safety factor information.""" po.oheadr(self.outfile, "Plasma Current and Safety Factor") - if stellarator_variables.istell == 0: + if self.data.stellarator.istell == 0: po.oblnkl(self.outfile) po.ovarin( self.outfile, @@ -148,7 +148,7 @@ def output(self) -> None: "OP ", ) - if stellarator_variables.istell == 0: + if self.data.stellarator.istell == 0: po.ovarrf( self.outfile, "Safety factor on axis (q₀)", "(q0)", physics_variables.q0 ) @@ -194,7 +194,7 @@ def output(self) -> None: self.outfile, "Rotational transform", "(iotabar)", - stellarator_variables.iotabar, + self.data.stellarator.iotabar, ) def calculate_plasma_current( diff --git a/process/models/physics/plasma_geometry.py b/process/models/physics/plasma_geometry.py index 99ae8d37d..c7270ae2e 100644 --- a/process/models/physics/plasma_geometry.py +++ b/process/models/physics/plasma_geometry.py @@ -13,7 +13,6 @@ from process.data_structure import ( divertor_variables, physics_variables, - stellarator_variables, ) logger = logging.getLogger(__name__) @@ -525,7 +524,7 @@ def output(self): """ po.oheadr(self.outfile, "Plasma Geometry") - if stellarator_variables.istell == 0: + if self.data.stellarator.istell == 0: if divertor_variables.n_divertors == 0: po.ocmmnt(self.outfile, "Plasma configuration = limiter") elif divertor_variables.n_divertors == 1: @@ -540,7 +539,7 @@ def output(self): else: po.ocmmnt(self.outfile, "Plasma configuration = stellarator") - if stellarator_variables.istell == 0: + if self.data.stellarator.istell == 0: if physics_variables.itart == 0: physics_variables.itart_r = physics_variables.itart po.ovarin( @@ -608,7 +607,7 @@ def output(self): po.oblnkl(self.outfile) geom_type = PlasmaGeometryModelType(physics_variables.i_plasma_geometry) - if stellarator_variables.istell == 0: + if self.data.stellarator.istell == 0: po.ocmmnt( self.outfile, f"X-Point Elongation set from: {geom_type.kappa_model.description}", diff --git a/process/models/power.py b/process/models/power.py index 7a6abf312..803907f0d 100644 --- a/process/models/power.py +++ b/process/models/power.py @@ -14,11 +14,10 @@ from process.data_structure import ( numerics, pf_power_variables, - pfcoil_variables, physics_variables, - power_variables, tfcoil_variables, ) +from process.data_structure.pfcoil_variables import NGC2 class PumpingPowerModelTypes(IntEnum): @@ -298,22 +297,22 @@ def pfpwr(self, output: bool): """ # Local aliases for readability (no functional change) t_pulse_cumulative = self.data.times.t_pulse_cumulative # [s] - c_pf_coil_turn = pfcoil_variables.c_pf_coil_turn # [A] - ind_pf_cs_plasma_mutual = pfcoil_variables.ind_pf_cs_plasma_mutual # [H] + c_pf_coil_turn = self.data.pf_coil.c_pf_coil_turn # [A] + ind_pf_cs_plasma_mutual = self.data.pf_coil.ind_pf_cs_plasma_mutual # [H] f_p_pf_energy_store_loss = ( pf_power_variables.f_p_pf_energy_store_loss ) # [unitless] - n_pf_cs_plasma_circuits = pfcoil_variables.n_pf_cs_plasma_circuits # [unitless] - - powpfii = np.zeros((pfcoil_variables.NGC2,)) - res_pf_coil = np.zeros((pfcoil_variables.NGC2,)) - res_pf_circuit_total = np.zeros((pfcoil_variables.NGC2,)) - albusa = np.zeros((pfcoil_variables.NGC2,)) - res_pf_bus = np.zeros((pfcoil_variables.NGC2,)) - v_pf_circuit_peak = np.zeros((pfcoil_variables.NGC2,)) - p_pf_circuit_resistive_peak = np.zeros((pfcoil_variables.NGC2,)) - vpfi = np.zeros((pfcoil_variables.NGC2,)) - psmva = np.zeros((pfcoil_variables.NGC2,)) + n_pf_cs_plasma_circuits = self.data.pf_coil.n_pf_cs_plasma_circuits # [unitless] + + powpfii = np.zeros((NGC2,)) + res_pf_coil = np.zeros((NGC2,)) + res_pf_circuit_total = np.zeros((NGC2,)) + albusa = np.zeros((NGC2,)) + res_pf_bus = np.zeros((NGC2,)) + v_pf_circuit_peak = np.zeros((NGC2,)) + p_pf_circuit_resistive_peak = np.zeros((NGC2,)) + vpfi = np.zeros((NGC2,)) + psmva = np.zeros((NGC2,)) poloidalenergy = np.zeros((6,)) inductxcurrent = np.zeros((6,)) pfdissipation = np.zeros((5,)) @@ -327,7 +326,7 @@ def pfpwr(self, output: bool): # PF coil resistive power requirements # Bussing losses assume aluminium bussing with 100 A/cm**2 ic = -1 - n_pf_coil_groups = pfcoil_variables.n_pf_coil_groups + n_pf_coil_groups = self.data.pf_coil.n_pf_coil_groups if self.data.build.iohcl != 0: n_pf_coil_groups += 1 @@ -338,14 +337,14 @@ def pfpwr(self, output: bool): pfbuspwr = 0.0e0 for a_pf_bus_cm in range(n_pf_coil_groups): - ic += pfcoil_variables.n_pf_coils_in_group[a_pf_bus_cm] + ic += self.data.pf_coil.n_pf_coils_in_group[a_pf_bus_cm] pf_group_circuit_index[a_pf_bus_cm] = ic # Section area of aluminium bussing for circuit (cm**2) - # pfcoil_variables.c_pf_coil_turn_peak_input : max current per turn of + # self.data.pf_coil.c_pf_coil_turn_peak_input : max current per turn of # coil (A) albusa[a_pf_bus_cm] = ( - abs(pfcoil_variables.c_pf_coil_turn_peak_input[ic]) / 100.0e0 + abs(self.data.pf_coil.c_pf_coil_turn_peak_input[ic]) / 100.0e0 ) # Resistance of bussing for circuit (ohm) @@ -354,35 +353,35 @@ def pfpwr(self, output: bool): # I have removed the fudge factor of 1.5 but included it in the value # of rhopfbus res_pf_bus[a_pf_bus_cm] = ( - pfcoil_variables.rhopfbus * pfbusl / (albusa[a_pf_bus_cm] / 10000) + self.data.pf_coil.rhopfbus * pfbusl / (albusa[a_pf_bus_cm] / 10000) ) # Total PF coil resistance (during burn) - # pfcoil_variables.c_pf_cs_coils_peak_ma : maximum current in coil (A) + # self.data.pf_coil.c_pf_cs_coils_peak_ma : maximum current in coil (A) res_pf_coil[a_pf_bus_cm] = ( - pfcoil_variables.rho_pf_coil + self.data.pf_coil.rho_pf_coil * 2.0e0 * np.pi - * pfcoil_variables.r_pf_coil_middle[ic] + * self.data.pf_coil.r_pf_coil_middle[ic] * abs( - pfcoil_variables.j_pf_coil_wp_peak[ic] + self.data.pf_coil.j_pf_coil_wp_peak[ic] / ( - (1.0e0 - pfcoil_variables.f_a_pf_coil_void[ic]) + (1.0e0 - self.data.pf_coil.f_a_pf_coil_void[ic]) * 1.0e6 - * pfcoil_variables.c_pf_cs_coils_peak_ma[ic] + * self.data.pf_coil.c_pf_cs_coils_peak_ma[ic] ) ) - * pfcoil_variables.n_pf_coil_turns[ic] ** 2 - * pfcoil_variables.n_pf_coils_in_group[a_pf_bus_cm] + * self.data.pf_coil.n_pf_coil_turns[ic] ** 2 + * self.data.pf_coil.n_pf_coils_in_group[a_pf_bus_cm] ) res_pf_circuit_total[a_pf_bus_cm] = ( res_pf_coil[a_pf_bus_cm] + res_pf_bus[a_pf_bus_cm] ) # total resistance of circuit (ohms) cptburn = ( - pfcoil_variables.c_pf_coil_turn_peak_input[ic] - * pfcoil_variables.c_pf_cs_coil_pulse_end_ma[ic] - / pfcoil_variables.c_pf_cs_coils_peak_ma[ic] + self.data.pf_coil.c_pf_coil_turn_peak_input[ic] + * self.data.pf_coil.c_pf_cs_coil_pulse_end_ma[ic] + / self.data.pf_coil.c_pf_cs_coils_peak_ma[ic] ) v_pf_circuit_peak[a_pf_bus_cm] = ( abs(cptburn) * res_pf_circuit_total[a_pf_bus_cm] @@ -401,18 +400,18 @@ def pfpwr(self, output: bool): delktim = self.data.times.t_plant_pulse_plasma_current_ramp_up # PF system (including Central Solenoid solenoid) inductive MVA requirements - # pfcoil_variables.c_pf_coil_turn(i,j) : current per turn of coil i at (end) + # self.data.pf_coil.c_pf_coil_turn(i,j) : current per turn of coil i at (end) # time period j (A) powpfi = 0.0e0 powpfr = 0.0e0 powpfr2 = 0.0e0 - # pfcoil_variables.n_pf_cs_plasma_circuits : total number of PF coils + # self.data.pf_coil.n_pf_cs_plasma_circuits : total number of PF coils # (including Central Solenoid and plasma) plasma is #n_pf_cs_plasma_circuits, - # and Central Solenoid is #(pfcoil_variables.n_pf_cs_plasma_circuits-1) - # pfcoil_variables.ind_pf_cs_plasma_mutual(i,j) + # and Central Solenoid is #(self.data.pf_coil.n_pf_cs_plasma_circuits-1) + # self.data.pf_coil.ind_pf_cs_plasma_mutual(i,j) # : mutual inductance between coil i and j - for idx_circuit in range(pfcoil_variables.n_pf_cs_plasma_circuits): + for idx_circuit in range(self.data.pf_coil.n_pf_cs_plasma_circuits): powpfii[idx_circuit] = 0.0e0 vpfi[idx_circuit] = 0.0e0 @@ -420,11 +419,11 @@ def pfpwr(self, output: bool): poloidalenergy[:] = 0.0e0 for idx_group in range(n_pf_coil_groups): # Loop over all groups of PF coils. for _ in range( - pfcoil_variables.n_pf_coils_in_group[idx_group] + self.data.pf_coil.n_pf_coils_in_group[idx_group] ): # Loop over all coils in each group idx_pf_coil += 1 inductxcurrent[:] = 0.0e0 - for idx_circuit in range(pfcoil_variables.n_pf_cs_plasma_circuits): + for idx_circuit in range(self.data.pf_coil.n_pf_cs_plasma_circuits): # Voltage in circuit idx_pf_coil due to change in current from # circuit idx_circuit vpfij = ( @@ -467,13 +466,13 @@ def pfpwr(self, output: bool): # self.data.times.t_pulse_cumulative(3) and # self.data.times.t_pulse_cumulative(5) respectively (MW) powpfr += ( - pfcoil_variables.n_pf_coil_turns[idx_pf_coil] + self.data.pf_coil.n_pf_coil_turns[idx_pf_coil] * c_pf_coil_turn[idx_pf_coil, 2] * res_pf_circuit_total[idx_group] / 1.0e6 ) powpfr2 += ( - pfcoil_variables.n_pf_coil_turns[idx_pf_coil] + self.data.pf_coil.n_pf_coil_turns[idx_pf_coil] * c_pf_coil_turn[idx_pf_coil, 4] * res_pf_circuit_total[idx_group] / 1.0e6 @@ -548,17 +547,17 @@ def pfpwr(self, output: bool): pf_power_variables.vpfskv = 20.0e0 pf_power_variables.pfckts = ( - pfcoil_variables.n_pf_cs_plasma_circuits - 2 + self.data.pf_coil.n_pf_cs_plasma_circuits - 2 ) + 6.0e0 pf_power_variables.spfbusl = pfbusl * pf_power_variables.pfckts pf_power_variables.acptmax = 0.0e0 pf_power_variables.spsmva = 0.0e0 - for idx_circuit in range(pfcoil_variables.n_pf_cs_plasma_circuits - 1): + for idx_circuit in range(self.data.pf_coil.n_pf_cs_plasma_circuits - 1): # Power supply MVA for each PF circuit psmva[idx_circuit] = 1.0e-6 * abs( vpfi[idx_circuit] - * pfcoil_variables.c_pf_coil_turn_peak_input[idx_circuit] + * self.data.pf_coil.c_pf_coil_turn_peak_input[idx_circuit] ) # Sum of the power supply MVA of the PF circuits @@ -567,19 +566,19 @@ def pfpwr(self, output: bool): # Average of the maximum currents in the PF circuits, kA pf_power_variables.acptmax += ( 1.0e-3 - * abs(pfcoil_variables.c_pf_coil_turn_peak_input[idx_circuit]) + * abs(self.data.pf_coil.c_pf_coil_turn_peak_input[idx_circuit]) / pf_power_variables.pfckts ) # PF wall plug power dissipated in power supply for ohmic heating (MW) # This is additional to that required for moving stored energy around # p_pf_electric_supplies_mw = physics_variables.p_plasma_ohmic_mw - # / pfcoil_variables.etapsu + # / self.data.pf_coil.etapsu wall_plug_ohmicmw = physics_variables.p_plasma_ohmic_mw * ( - 1.0e0 / pfcoil_variables.etapsu - 1.0e0 + 1.0e0 / self.data.pf_coil.etapsu - 1.0e0 ) # Total mean wall plug power dissipated in PFC and CS power supplies. Issue #713 - pfcoil_variables.p_pf_electric_supplies_mw = wall_plug_ohmicmw + pfpowermw + self.data.pf_coil.p_pf_electric_supplies_mw = wall_plug_ohmicmw + pfpowermw # Output Section if output == 0: @@ -630,7 +629,7 @@ def pfpwr(self, output: bool): self.outfile, "Efficiency of transfer of PF stored energy into or out of storage", "(etapsu)", - pfcoil_variables.etapsu, + self.data.pf_coil.etapsu, ) po.ocmmnt( self.outfile, @@ -811,27 +810,27 @@ def component_thermal_powers(self): # than the power deposited in the coolant. # The difference should be lost as secondary heat. - power_variables.p_fw_blkt_coolant_pump_elec_mw = ( + self.data.power.p_fw_blkt_coolant_pump_elec_mw = ( self.data.primary_pumping.p_fw_blkt_coolant_pump_mw / self.data.fwbs.eta_coolant_pump_electric ) - power_variables.p_shld_coolant_pump_elec_mw = ( + self.data.power.p_shld_coolant_pump_elec_mw = ( self.data.heat_transport.p_shld_coolant_pump_mw / self.data.fwbs.eta_coolant_pump_electric ) - power_variables.p_div_coolant_pump_elec_mw = ( + self.data.power.p_div_coolant_pump_elec_mw = ( self.data.heat_transport.p_div_coolant_pump_mw / self.data.fwbs.eta_coolant_pump_electric ) # Secondary breeder coolant loop. Should return zero if not used. - power_variables.p_blkt_breeder_pump_elec_mw = ( + self.data.power.p_blkt_breeder_pump_elec_mw = ( self.data.heat_transport.p_blkt_breeder_pump_mw / self.data.fwbs.eta_coolant_pump_electric ) # Total mechanical pump power needed (deposited in coolant) - power_variables.p_coolant_pump_total_mw = ( + self.data.power.p_coolant_pump_total_mw = ( self.data.primary_pumping.p_fw_blkt_coolant_pump_mw + self.data.heat_transport.p_blkt_breeder_pump_mw + self.data.heat_transport.p_shld_coolant_pump_mw @@ -840,16 +839,16 @@ def component_thermal_powers(self): # Minimum total electrical power for primary coolant pumps (MW) self.data.heat_transport.p_coolant_pump_elec_total_mw = ( - power_variables.p_fw_blkt_coolant_pump_elec_mw - + power_variables.p_blkt_breeder_pump_elec_mw - + power_variables.p_shld_coolant_pump_elec_mw - + power_variables.p_div_coolant_pump_elec_mw + self.data.power.p_fw_blkt_coolant_pump_elec_mw + + self.data.power.p_blkt_breeder_pump_elec_mw + + self.data.power.p_shld_coolant_pump_elec_mw + + self.data.power.p_div_coolant_pump_elec_mw ) # Heat lost through pump power inefficiencies (MW) self.data.heat_transport.p_coolant_pump_loss_total_mw = ( self.data.heat_transport.p_coolant_pump_elec_total_mw - - power_variables.p_coolant_pump_total_mw + - self.data.power.p_coolant_pump_total_mw ) # Heat lost in power supplies for heating and current drive @@ -862,20 +861,20 @@ def component_thermal_powers(self): # Calculate fraction of blanket nuclear power deposited in # liquid breeder / coolant if self.data.fwbs.i_blkt_dual_coolant == 2: - power_variables.p_blkt_liquid_breeder_heat_deposited_mw = ( + self.data.power.p_blkt_liquid_breeder_heat_deposited_mw = ( self.data.fwbs.p_blkt_nuclear_heat_total_mw * self.data.fwbs.f_nuc_pow_bz_liq ) + self.data.heat_transport.p_blkt_breeder_pump_mw # Liquid breeder is circulated but does no cooling elif self.data.fwbs.i_blkt_dual_coolant == 1: - power_variables.p_blkt_liquid_breeder_heat_deposited_mw = ( + self.data.power.p_blkt_liquid_breeder_heat_deposited_mw = ( self.data.heat_transport.p_blkt_breeder_pump_mw ) # Liquid breeder also acts a coolant if int(self.data.fwbs.i_blkt_dual_coolant) in {1, 2}: - power_variables.p_fw_blkt_heat_deposited_mw = ( + self.data.power.p_fw_blkt_heat_deposited_mw = ( self.data.fwbs.p_fw_nuclear_heat_total_mw + self.data.fwbs.p_fw_rad_total_mw + self.data.fwbs.p_blkt_nuclear_heat_total_mw @@ -887,7 +886,7 @@ def component_thermal_powers(self): ) else: # No secondary liquid metal breeder/coolant - power_variables.p_fw_blkt_heat_deposited_mw = ( + self.data.power.p_fw_blkt_heat_deposited_mw = ( self.data.fwbs.p_fw_nuclear_heat_total_mw + self.data.fwbs.p_fw_rad_total_mw + self.data.fwbs.p_blkt_nuclear_heat_total_mw @@ -898,7 +897,7 @@ def component_thermal_powers(self): ) # Total power deposited in first wall coolant (MW) - power_variables.p_fw_heat_deposited_mw = ( + self.data.power.p_fw_heat_deposited_mw = ( self.data.fwbs.p_fw_nuclear_heat_total_mw + self.data.fwbs.p_fw_rad_total_mw + self.data.heat_transport.p_fw_coolant_pump_mw @@ -908,20 +907,20 @@ def component_thermal_powers(self): ) # Total power deposited in blanket coolant (MW) - power_variables.p_blkt_heat_deposited_mw = ( + self.data.power.p_blkt_heat_deposited_mw = ( self.data.fwbs.p_blkt_nuclear_heat_total_mw + self.data.heat_transport.p_blkt_coolant_pump_mw ) # Total power deposited in shield coolant (MW) - power_variables.p_shld_heat_deposited_mw = ( + self.data.power.p_shld_heat_deposited_mw = ( self.data.fwbs.p_cp_shield_nuclear_heat_mw + self.data.fwbs.p_shld_nuclear_heat_mw + self.data.heat_transport.p_shld_coolant_pump_mw ) # Total thermal power deposited in divertor (MW) - power_variables.p_div_heat_deposited_mw = ( + self.data.power.p_div_heat_deposited_mw = ( physics_variables.p_plasma_separatrix_mw + ( self.data.fwbs.p_div_nuclear_heat_total_mw @@ -934,8 +933,8 @@ def component_thermal_powers(self): i_p_coolant_pumping = PumpingPowerModelTypes(self.data.fwbs.i_p_coolant_pumping) if i_p_coolant_pumping != PumpingPowerModelTypes.MECHANICAL_WITH_PRESSURE_DROP: self.data.heat_transport.p_fw_div_heat_deposited_mw = ( - power_variables.p_fw_heat_deposited_mw - + power_variables.p_div_heat_deposited_mw + self.data.power.p_fw_heat_deposited_mw + + self.data.power.p_div_heat_deposited_mw ) # Thermal to electric efficiency @@ -955,41 +954,41 @@ def component_thermal_powers(self): if i_thermal_electric_conversion == ElectricConversionModelTypes.CCFE_HCPB_VALUE: # Primary thermal power (MW) self.data.heat_transport.p_plant_primary_heat_mw = ( - power_variables.p_fw_blkt_heat_deposited_mw + self.data.power.p_fw_blkt_heat_deposited_mw + self.data.heat_transport.i_shld_primary_heat - * power_variables.p_shld_heat_deposited_mw + * self.data.power.p_shld_heat_deposited_mw ) # Secondary thermal power deposited in divertor (MW) self.data.heat_transport.p_div_secondary_heat_mw = ( - power_variables.p_div_heat_deposited_mw + self.data.power.p_div_heat_deposited_mw ) # Divertor primary/secondary power switch: does NOT contribute to # energy generation cycle - power_variables.i_div_primary_heat = 0 + self.data.power.i_div_primary_heat = 0 else: # Primary thermal power used to generate electricity (MW) self.data.heat_transport.p_plant_primary_heat_mw = ( - power_variables.p_fw_blkt_heat_deposited_mw + self.data.power.p_fw_blkt_heat_deposited_mw + self.data.heat_transport.i_shld_primary_heat - * power_variables.p_shld_heat_deposited_mw - + power_variables.p_div_heat_deposited_mw + * self.data.power.p_shld_heat_deposited_mw + + self.data.power.p_div_heat_deposited_mw ) # Secondary thermal power deposited in divertor (MW) self.data.heat_transport.p_div_secondary_heat_mw = 0.0e0 # Divertor primary/secondary power switch: contributes to energy # generation cycle - power_variables.i_div_primary_heat = 1 + self.data.power.i_div_primary_heat = 1 if abs(self.data.heat_transport.p_plant_primary_heat_mw) < 1.0e-4: logger.error(f"{'ERROR Primary thermal power is zero or negative'}") # #284 Fraction of total high-grade thermal power to divertor - power_variables.f_p_div_primary_heat = ( - power_variables.p_div_heat_deposited_mw + self.data.power.f_p_div_primary_heat = ( + self.data.power.p_div_heat_deposited_mw / self.data.heat_transport.p_plant_primary_heat_mw ) # Loss in efficiency as this primary power is collecetd at very low temperature - power_variables.delta_eta = 0.339 * power_variables.f_p_div_primary_heat + self.data.power.delta_eta = 0.339 * self.data.power.f_p_div_primary_heat # =============================================== # Secondary thermal powers @@ -997,7 +996,7 @@ def component_thermal_powers(self): # Secondary thermal power deposited in shield self.data.heat_transport.p_shld_secondary_heat_mw = ( - power_variables.p_shld_heat_deposited_mw + self.data.power.p_shld_heat_deposited_mw * (1 - self.data.heat_transport.i_shld_primary_heat) ) @@ -1030,7 +1029,7 @@ def calculate_cryo_loads(self): tfcoil_variables.cryo_cool_req = 0.0e0 # Superconductors TF/PF cryogenic cooling - if tfcoil_variables.i_tf_sup == 1 or pfcoil_variables.i_pf_conductor == 0: + if tfcoil_variables.i_tf_sup == 1 or self.data.pf_coil.i_pf_conductor == 0: # self.data.heat_transport.helpow calculation self.data.heat_transport.helpow = self.cryo( tfcoil_variables.i_tf_sup, @@ -1140,7 +1139,7 @@ def output_plant_thermal_powers(self): self.outfile, "Total heat deposited in FW and coolant [MW]", "(p_fw_heat_deposited_mw)", - power_variables.p_fw_heat_deposited_mw, + self.data.power.p_fw_heat_deposited_mw, ) po.oblnkl(self.outfile) @@ -1177,7 +1176,7 @@ def output_plant_thermal_powers(self): self.outfile, "Total heat deposited in Blanket(s) and coolant [MW]", "(p_blkt_heat_deposited_mw)", - power_variables.p_blkt_heat_deposited_mw, + self.data.power.p_blkt_heat_deposited_mw, ) po.oblnkl(self.outfile) @@ -1194,7 +1193,7 @@ def output_plant_thermal_powers(self): self.outfile, "Total heat deposited in Blanket(s) and FW coolant [MW]", "(p_fw_blkt_heat_deposited_mw)", - power_variables.p_fw_blkt_heat_deposited_mw, + self.data.power.p_fw_blkt_heat_deposited_mw, ) po.oblnkl(self.outfile) @@ -1227,7 +1226,7 @@ def output_plant_thermal_powers(self): self.outfile, "Total heat deposited in VV and shield coolant(s) [MW]", "(p_shld_heat_deposited_mw)", - power_variables.p_shld_heat_deposited_mw, + self.data.power.p_shld_heat_deposited_mw, ) po.oblnkl(self.outfile) @@ -1266,7 +1265,7 @@ def output_plant_thermal_powers(self): self.outfile, "Total heat deposited in divertor and coolants [MW]", "(p_div_heat_deposited_mw)", - power_variables.p_div_heat_deposited_mw, + self.data.power.p_div_heat_deposited_mw, ) po.oblnkl(self.outfile) @@ -1277,7 +1276,7 @@ def output_plant_thermal_powers(self): self.outfile, "Mechanical pumping power of all coolant pumps [MW]", "(p_coolant_pump_total_mw)", - power_variables.p_coolant_pump_total_mw, + self.data.power.p_coolant_pump_total_mw, ) po.oblnkl(self.outfile) @@ -1290,7 +1289,7 @@ def output_plant_thermal_powers(self): self.outfile, "Electric power for core plant systems [MW]", "(p_plant_core_systems_elec_mw)", - power_variables.p_plant_core_systems_elec_mw, + self.data.power.p_plant_core_systems_elec_mw, ) po.ovarre( self.outfile, @@ -1359,19 +1358,19 @@ def output_plant_thermal_powers(self): self.outfile, "Total heat deposited in FW and coolant [MW]", "(p_fw_heat_deposited_mw)", - power_variables.p_fw_heat_deposited_mw, + self.data.power.p_fw_heat_deposited_mw, ) po.ovarre( self.outfile, "Total heat deposited in Blanket(s) and coolant [MW]", "(p_blkt_heat_deposited_mw)", - power_variables.p_blkt_heat_deposited_mw, + self.data.power.p_blkt_heat_deposited_mw, ) po.ovarre( self.outfile, "Total heat deposited in Blanket(s) and FW coolant [MW]", "(p_fw_blkt_heat_deposited_mw)", - power_variables.p_fw_blkt_heat_deposited_mw, + self.data.power.p_fw_blkt_heat_deposited_mw, ) po.oblnkl(self.outfile) @@ -1379,20 +1378,20 @@ def output_plant_thermal_powers(self): self.outfile, "Total heat deposited in VV and shield coolant(s) [MW]", "(p_shld_heat_deposited_mw)", - power_variables.p_shld_heat_deposited_mw, + self.data.power.p_shld_heat_deposited_mw, ) po.oblnkl(self.outfile) po.ovarre( self.outfile, "Total heat deposited in divertor and coolants [MW]", "(p_div_heat_deposited_mw)", - power_variables.p_div_heat_deposited_mw, + self.data.power.p_div_heat_deposited_mw, ) po.ovarre( self.outfile, "Fraction of total primary heat originating from divertor", "(f_p_div_primary_heat)", - power_variables.f_p_div_primary_heat, + self.data.power.f_p_div_primary_heat, ) po.oblnkl(self.outfile) po.ovarre( @@ -1426,7 +1425,7 @@ def output_plant_electric_powers(self): self.outfile, "Total thermal power lost in power conversion [MWth]", "(p_turbine_loss_mw)", - power_variables.p_turbine_loss_mw, + self.data.power.p_turbine_loss_mw, ) po.oblnkl(self.outfile) po.ovarre( @@ -1496,20 +1495,20 @@ def output_plant_electric_powers(self): self.outfile, "Electric power demand for PF coil system [MWe]", "(p_pf_electric_supplies_mw)", - pfcoil_variables.p_pf_electric_supplies_mw, + self.data.pf_coil.p_pf_electric_supplies_mw, ) po.ovarre( self.outfile, "Electric power demand for CP coolant pumps [MWe]", "(p_cp_coolant_pump_elec_mw)", - power_variables.p_cp_coolant_pump_elec_mw, + self.data.power.p_cp_coolant_pump_elec_mw, ) po.oblnkl(self.outfile) po.ovarre( self.outfile, "Electric power demand of core plant systems needed at all times [MWe]", "(p_plant_core_systems_elec_mw)", - power_variables.p_plant_core_systems_elec_mw, + self.data.power.p_plant_core_systems_elec_mw, ) po.oblnkl(self.outfile) @@ -1523,25 +1522,25 @@ def output_plant_electric_powers(self): self.outfile, "Electric power demand of FW and Blanket coolant pumps [MWe]", "(p_fw_blkt_coolant_pump_elec_mw)", - power_variables.p_fw_blkt_coolant_pump_elec_mw, + self.data.power.p_fw_blkt_coolant_pump_elec_mw, ) po.ovarre( self.outfile, "Electric power demand of Blanket secondary breeder coolant pumps [MWe]", "(p_blkt_breeder_pump_elec_mw)", - power_variables.p_blkt_breeder_pump_elec_mw, + self.data.power.p_blkt_breeder_pump_elec_mw, ) po.ovarre( self.outfile, "Electric power demand of VV and Shield coolant pumps [MWe]", "(p_shld_coolant_pump_elec_mw)", - power_variables.p_shld_coolant_pump_elec_mw, + self.data.power.p_shld_coolant_pump_elec_mw, ) po.ovarre( self.outfile, "Electric power demand of Divertor colant pumps [MWe]", "(p_div_coolant_pump_elec_mw)", - power_variables.p_div_coolant_pump_elec_mw, + self.data.power.p_div_coolant_pump_elec_mw, ) po.oblnkl(self.outfile) po.ovarre( @@ -1594,13 +1593,13 @@ def output_plant_electric_powers(self): self.outfile, "Total electric energy output per pulse (MJ)", "(e_plant_net_electric_pulse_mj)", - power_variables.e_plant_net_electric_pulse_mj, + self.data.power.e_plant_net_electric_pulse_mj, ) po.ovarre( self.outfile, "Total electric energy output per pulse (kWh)", "(e_plant_net_electric_pulse_kwh)", - power_variables.e_plant_net_electric_pulse_kwh, + self.data.power.e_plant_net_electric_pulse_kwh, ) def plant_electric_production(self): @@ -1613,11 +1612,11 @@ def plant_electric_production(self): specified output file. """ if physics_variables.itart == 1 and tfcoil_variables.i_tf_sup == 0: - power_variables.p_cp_coolant_pump_elec_mw = ( + self.data.power.p_cp_coolant_pump_elec_mw = ( 1.0e-6 * tfcoil_variables.p_cp_coolant_pump_elec ) else: - power_variables.p_cp_coolant_pump_elec_mw = 0.0e0 + self.data.power.p_cp_coolant_pump_elec_mw = 0.0e0 # Total baseline power to facility loads, MW self.data.heat_transport.p_plant_electric_base_total_mw = ( @@ -1636,21 +1635,21 @@ def plant_electric_production(self): # Electrical power consumed by fusion power core systems # (excluding heat transport pumps and auxiliary injection power system) - power_variables.p_plant_core_systems_elec_mw = ( + self.data.power.p_plant_core_systems_elec_mw = ( self.data.heat_transport.p_cryo_plant_electric_mw + self.data.heat_transport.fachtmw - + power_variables.p_cp_coolant_pump_elec_mw + + self.data.power.p_cp_coolant_pump_elec_mw + self.data.heat_transport.p_tf_electric_supplies_mw + self.data.heat_transport.p_tritium_plant_electric_mw + self.data.heat_transport.vachtmw - + pfcoil_variables.p_pf_electric_supplies_mw + + self.data.pf_coil.p_pf_electric_supplies_mw ) # Total secondary heat not used for electricity production, but which # contributes to the plant heat load and must be removed # by the cooling system (MW) self.data.heat_transport.p_plant_secondary_heat_mw = ( - power_variables.p_plant_core_systems_elec_mw + self.data.power.p_plant_core_systems_elec_mw + self.data.heat_transport.p_hcd_electric_loss_mw + self.data.heat_transport.p_coolant_pump_loss_total_mw + self.data.heat_transport.p_div_secondary_heat_mw @@ -1672,10 +1671,10 @@ def plant_electric_production(self): self.data.heat_transport.p_plant_electric_gross_mw = ( ( self.data.heat_transport.p_plant_primary_heat_mw - - power_variables.p_blkt_liquid_breeder_heat_deposited_mw + - self.data.power.p_blkt_liquid_breeder_heat_deposited_mw ) * self.data.heat_transport.eta_turbine - + power_variables.p_blkt_liquid_breeder_heat_deposited_mw + + self.data.power.p_blkt_liquid_breeder_heat_deposited_mw * self.data.heat_transport.etath_liq ) else: @@ -1685,14 +1684,14 @@ def plant_electric_production(self): ) # Total lost thermal power in the turbine - power_variables.p_turbine_loss_mw = ( + self.data.power.p_turbine_loss_mw = ( self.data.heat_transport.p_plant_primary_heat_mw * (1 - self.data.heat_transport.eta_turbine) ) # Total recirculating power self.data.heat_transport.p_plant_electric_recirc_mw = ( - power_variables.p_plant_core_systems_elec_mw + self.data.power.p_plant_core_systems_elec_mw + self.data.heat_transport.p_hcd_electric_total_mw + self.data.heat_transport.p_coolant_pump_elec_total_mw ) @@ -1710,19 +1709,19 @@ def plant_electric_production(self): ) / self.data.heat_transport.p_plant_electric_gross_mw ( - power_variables.e_plant_net_electric_pulse_kwh, - power_variables.e_plant_net_electric_pulse_mj, - power_variables.p_plant_electric_base_total_profile_mw, - power_variables.p_plant_electric_gross_profile_mw, - power_variables.p_plant_electric_net_profile_mw, - power_variables.p_hcd_electric_total_profile_mw, - power_variables.p_coolant_pump_elec_total_profile_mw, - power_variables.p_tf_electric_supplies_profile_mw, - power_variables.p_pf_electric_supplies_profile_mw, - power_variables.vachtmw_profile_mw, - power_variables.p_tritium_plant_electric_profile_mw, - power_variables.p_cryo_plant_electric_profile_mw, - power_variables.p_fusion_total_profile_mw, + self.data.power.e_plant_net_electric_pulse_kwh, + self.data.power.e_plant_net_electric_pulse_mj, + self.data.power.p_plant_electric_base_total_profile_mw, + self.data.power.p_plant_electric_gross_profile_mw, + self.data.power.p_plant_electric_net_profile_mw, + self.data.power.p_hcd_electric_total_profile_mw, + self.data.power.p_coolant_pump_elec_total_profile_mw, + self.data.power.p_tf_electric_supplies_profile_mw, + self.data.power.p_pf_electric_supplies_profile_mw, + self.data.power.vachtmw_profile_mw, + self.data.power.p_tritium_plant_electric_profile_mw, + self.data.power.p_cryo_plant_electric_profile_mw, + self.data.power.p_fusion_total_profile_mw, ) = self.power_profiles_over_time( t_precharge=self.data.times.t_plant_pulse_coil_precharge, t_current_ramp_up=self.data.times.t_plant_pulse_plasma_current_ramp_up, @@ -1735,7 +1734,7 @@ def plant_electric_production(self): p_tritium_plant_electric_mw=self.data.heat_transport.p_tritium_plant_electric_mw, vachtmw=self.data.heat_transport.vachtmw, p_tf_electric_supplies_mw=self.data.heat_transport.p_tf_electric_supplies_mw, - p_pf_electric_supplies_mw=pfcoil_variables.p_pf_electric_supplies_mw, + p_pf_electric_supplies_mw=self.data.pf_coil.p_pf_electric_supplies_mw, p_coolant_pump_elec_total_mw=self.data.heat_transport.p_coolant_pump_elec_total_mw, p_hcd_electric_total_mw=self.data.heat_transport.p_hcd_electric_total_mw, p_fusion_total_mw=physics_variables.p_fusion_total_mw, @@ -1790,9 +1789,9 @@ def cryo( n_tf_coils : """ - power_variables.qss = 4.3e-4 * coldmass + self.data.power.qss = 4.3e-4 * coldmass if i_tf_sup == 1: - power_variables.qss += 2.0e0 * tfcryoarea + self.data.power.qss += 2.0e0 * tfcryoarea # Nuclear heating of TF coils (W) (zero if resistive) if self.data.fwbs.inuclear == 0 and i_tf_sup == 1: @@ -1800,28 +1799,28 @@ def cryo( # Issue #511: if self.data.fwbs.inuclear = 1 : self.data.fwbs.qnuc is input. # AC losses - power_variables.qac = 1.0e3 * ensxpfm / t_plant_pulse_plasma_present + self.data.power.qac = 1.0e3 * ensxpfm / t_plant_pulse_plasma_present # Current leads if i_tf_sup == 1: - power_variables.qcl = 13.6e-3 * n_tf_coils * c_tf_turn + self.data.power.qcl = 13.6e-3 * n_tf_coils * c_tf_turn else: - power_variables.qcl = 0.0e0 + self.data.power.qcl = 0.0e0 # 45% extra miscellaneous, piping and reserves - power_variables.qmisc = 0.45e0 * ( - power_variables.qss + self.data.power.qmisc = 0.45e0 * ( + self.data.power.qss + self.data.fwbs.qnuc - + power_variables.qac - + power_variables.qcl + + self.data.power.qac + + self.data.power.qcl ) return max( 0.0e0, - power_variables.qmisc - + power_variables.qss + self.data.power.qmisc + + self.data.power.qss + self.data.fwbs.qnuc - + power_variables.qac - + power_variables.qcl, + + self.data.power.qac + + self.data.power.qcl, ) def output_cryogenics(self): @@ -1840,7 +1839,7 @@ def output_cryogenics(self): self.outfile, "Conduction and radiation heat loads on cryogenic components (MW)", "(qss/1.0d6)", - power_variables.qss / 1.0e6, + self.data.power.qss / 1.0e6, "OP ", ) po.ovarre( @@ -1858,21 +1857,21 @@ def output_cryogenics(self): self.outfile, "AC losses in cryogenic components (MW)", "(qac/1.0d6)", - power_variables.qac / 1.0e6, + self.data.power.qac / 1.0e6, "OP ", ) po.ovarre( self.outfile, "Resistive losses in current leads (MW)", "(qcl/1.0d6)", - power_variables.qcl / 1.0e6, + self.data.power.qcl / 1.0e6, "OP ", ) po.ovarre( self.outfile, "45% allowance for heat loads in transfer lines, storage tanks etc (MW)", "(qmisc/1.0d6)", - power_variables.qmisc / 1.0e6, + self.data.power.qmisc / 1.0e6, "OP ", ) @@ -1956,7 +1955,7 @@ def plant_thermal_efficiency(self, eta_turbine: float) -> float: # Part 2: Engineering # https://www.sciencedirect.com/science/article/pii/S0920379616300072 # Feedheat & reheat cycle assumed - eta_turbine = 0.411e0 - power_variables.delta_eta + eta_turbine = 0.411e0 - self.data.power.delta_eta else: logger.log(f"{'i_blanket_type is not equal to 1.'}") @@ -1998,7 +1997,7 @@ def plant_thermal_efficiency(self, eta_turbine: float) -> float: eta_turbine = ( 0.1802e0 * np.log(self.data.heat_transport.temp_turbine_coolant_in) - 0.7823 - - power_variables.delta_eta + - self.data.power.delta_eta ) else: @@ -2785,77 +2784,77 @@ def output_power_profiles_over_time( self, ): """Outputs the time-dependent power profiles to the output file""" - for i, val in enumerate(power_variables.p_plant_electric_base_total_profile_mw): + for i, val in enumerate(self.data.power.p_plant_electric_base_total_profile_mw): po.ovarre( self.mfile, f"Plant total electric base load at time point {i}", f"(p_plant_electric_base_total_profile_mw{i})", val, ) - for i, val in enumerate(power_variables.p_plant_electric_gross_profile_mw): + for i, val in enumerate(self.data.power.p_plant_electric_gross_profile_mw): po.ovarre( self.mfile, f"Plant total electric gross at time point {i}", f"(p_plant_electric_gross_profile_mw{i})", val, ) - for i, val in enumerate(power_variables.p_plant_electric_net_profile_mw): + for i, val in enumerate(self.data.power.p_plant_electric_net_profile_mw): po.ovarre( self.mfile, f"Plant total electric net at time point {i}", f"(p_plant_electric_net_profile_mw{i})", val, ) - for i, val in enumerate(power_variables.p_hcd_electric_total_profile_mw): + for i, val in enumerate(self.data.power.p_hcd_electric_total_profile_mw): po.ovarre( self.mfile, f"Plant total electric HCD at time point {i}", f"(p_hcd_electric_total_profile_mw{i})", val, ) - for i, val in enumerate(power_variables.p_coolant_pump_elec_total_profile_mw): + for i, val in enumerate(self.data.power.p_coolant_pump_elec_total_profile_mw): po.ovarre( self.mfile, f"Plant total electric coolant pump at time point {i}", f"(p_coolant_pump_elec_total_profile_mw{i})", val, ) - for i, val in enumerate(power_variables.p_tf_electric_supplies_profile_mw): + for i, val in enumerate(self.data.power.p_tf_electric_supplies_profile_mw): po.ovarre( self.mfile, f"Plant total electric TF supplies at time point {i}", f"(p_tf_electric_supplies_profile_mw{i})", val, ) - for i, val in enumerate(power_variables.p_pf_electric_supplies_profile_mw): + for i, val in enumerate(self.data.power.p_pf_electric_supplies_profile_mw): po.ovarre( self.mfile, f"Plant total electric PF supplies at time point {i}", f"(p_pf_electric_supplies_profile_mw{i})", val, ) - for i, val in enumerate(power_variables.vachtmw_profile_mw): + for i, val in enumerate(self.data.power.vachtmw_profile_mw): po.ovarre( self.mfile, f"Plant total electric vacuum pump power at time point {i}", f"(vachtmw_profile_mw{i})", val, ) - for i, val in enumerate(power_variables.p_tritium_plant_electric_profile_mw): + for i, val in enumerate(self.data.power.p_tritium_plant_electric_profile_mw): po.ovarre( self.mfile, f"Plant total electric tritium plant power at time point {i}", f"(p_tritium_plant_electric_profile_mw{i})", val, ) - for i, val in enumerate(power_variables.p_cryo_plant_electric_profile_mw): + for i, val in enumerate(self.data.power.p_cryo_plant_electric_profile_mw): po.ovarre( self.mfile, f"Plant total electric cryo plant power at time point {i}", f"(p_cryo_plant_electric_profile_mw{i})", val, ) - for i, val in enumerate(power_variables.p_fusion_total_profile_mw): + for i, val in enumerate(self.data.power.p_fusion_total_profile_mw): po.ovarre( self.mfile, f"Plant total electric fusion plant power at time point {i}", diff --git a/process/models/pulse.py b/process/models/pulse.py index 8ba239dc5..184e946f1 100644 --- a/process/models/pulse.py +++ b/process/models/pulse.py @@ -8,7 +8,6 @@ from process.data_structure import ( numerics, pf_power_variables, - pfcoil_variables, physics_variables, ) @@ -42,7 +41,7 @@ def run(self, output: bool = False): # Burn time calculation self.data.times.t_plant_pulse_burn = self.calculate_burn_time( - vs_cs_pf_total_burn=pfcoil_variables.vs_cs_pf_total_burn, + vs_cs_pf_total_burn=self.data.pf_coil.vs_cs_pf_total_burn, v_plasma_loop_burn=physics_variables.v_plasma_loop_burn, t_plant_pulse_fusion_ramp=self.data.times.t_plant_pulse_fusion_ramp, ) @@ -65,23 +64,23 @@ def tohswg(self, output: bool): # Current/turn in Central Solenoid at beginning of pulse (A/turn) - ioht1 = pfcoil_variables.c_pf_coil_turn[pfcoil_variables.n_cs_pf_coils - 1, 1] + ioht1 = self.data.pf_coil.c_pf_coil_turn[self.data.pf_coil.n_cs_pf_coils - 1, 1] # Current/turn in Central Solenoid at start of flat-top (A/turn) - ioht2 = pfcoil_variables.c_pf_coil_turn[pfcoil_variables.n_cs_pf_coils - 1, 2] + ioht2 = self.data.pf_coil.c_pf_coil_turn[self.data.pf_coil.n_cs_pf_coils - 1, 2] # Central Solenoid resistance (ohms) - if pfcoil_variables.i_pf_conductor == 0: + if self.data.pf_coil.i_pf_conductor == 0: r = 0.0e0 else: r = ( - pfcoil_variables.p_cs_resistive_flat_top + self.data.pf_coil.p_cs_resistive_flat_top / ( 1.0e6 - * pfcoil_variables.c_pf_cs_coils_peak_ma[ - pfcoil_variables.n_cs_pf_coils - 1 + * self.data.pf_coil.c_pf_cs_coils_peak_ma[ + self.data.pf_coil.n_cs_pf_coils - 1 ] ) ** 2 @@ -93,8 +92,8 @@ def tohswg(self, output: bool): pfbusl = 8.0e0 * physics_variables.rmajor + 140.0e0 albusa = ( abs( - pfcoil_variables.c_pf_coil_turn_peak_input[ - pfcoil_variables.n_cs_pf_coils - 1 + self.data.pf_coil.c_pf_coil_turn_peak_input[ + self.data.pf_coil.n_cs_pf_coils - 1 ] ) / 100.0e0 @@ -103,7 +102,7 @@ def tohswg(self, output: bool): # rho = 1.5e0 * 2.62e-4 * pfbusl / albusa # I have removed the fudge factor of 1.5 but included it in the value of # rhopfbus - rho = pfcoil_variables.rhopfbus * pfbusl / (albusa / 10000) + rho = self.data.pf_coil.rhopfbus * pfbusl / (albusa / 10000) # Central Solenoid power source emf (volts) @@ -111,15 +110,15 @@ def tohswg(self, output: bool): # Mutual inductance between Central Solenoid and plasma (H) - m = pfcoil_variables.ind_pf_cs_plasma_mutual[ - pfcoil_variables.n_cs_pf_coils - 1, - pfcoil_variables.n_pf_cs_plasma_circuits - 1, + m = self.data.pf_coil.ind_pf_cs_plasma_mutual[ + self.data.pf_coil.n_cs_pf_coils - 1, + self.data.pf_coil.n_pf_cs_plasma_circuits - 1, ] # Self inductance of Central Solenoid (H) - loh = pfcoil_variables.ind_pf_cs_plasma_mutual[ - pfcoil_variables.n_cs_pf_coils - 1, pfcoil_variables.n_cs_pf_coils - 1 + loh = self.data.pf_coil.ind_pf_cs_plasma_mutual[ + self.data.pf_coil.n_cs_pf_coils - 1, self.data.pf_coil.n_cs_pf_coils - 1 ] # Maximum rate of change of plasma current (A/s) @@ -128,7 +127,7 @@ def tohswg(self, output: bool): ipdot = 0.0455e0 * physics_variables.plasma_current # Minimum plasma current ramp-up time (s) - # - corrected (bus resistance is not a function of pfcoil_variables.turns) + # - corrected (bus resistance is not a function of self.data.pf_coil.turns) self.data.constraints.t_current_ramp_up_min = ( loh @@ -137,8 +136,8 @@ def tohswg(self, output: bool): ioht2 * ( r - * pfcoil_variables.n_pf_coil_turns[ - pfcoil_variables.n_cs_pf_coils - 1 + * self.data.pf_coil.n_pf_coil_turns[ + self.data.pf_coil.n_cs_pf_coils - 1 ] + rho ) diff --git a/process/models/stellarator/build.py b/process/models/stellarator/build.py index 3a8bfd81d..64c6087ca 100644 --- a/process/models/stellarator/build.py +++ b/process/models/stellarator/build.py @@ -1,12 +1,6 @@ from process.core import process_output as po from process.core.model import DataStructure -from process.data_structure import ( - physics_variables, - stellarator_configuration, -) -from process.data_structure import ( - stellarator_variables as st, -) +from process.data_structure import physics_variables def st_build(stellarator, f_output: bool, data: DataStructure): @@ -92,12 +86,14 @@ def st_build(stellarator, f_output: bool, data: DataStructure): # derivative_min_LCFS_coils_dist for how strong the stellarator shape changes wrt to aspect ratio data.build.available_radial_space = ( - st.r_coil_minor * st.f_coil_shape - physics_variables.rminor + data.stellarator.r_coil_minor * data.stellarator.f_coil_shape + - physics_variables.rminor ) - +stellarator_configuration.stella_config_derivative_min_lcfs_coils_dist * ( + +data.stellarator_config.stella_config_derivative_min_lcfs_coils_dist * ( physics_variables.rminor - - st.f_st_rmajor * stellarator_configuration.stella_config_rminor_ref + - data.stellarator.f_st_rmajor * data.stellarator_config.stella_config_rminor_ref ) + # Radius to inner edge of inboard shield data.build.r_shld_inboard_inner = ( physics_variables.rmajor diff --git a/process/models/stellarator/coils/calculate.py b/process/models/stellarator/coils/calculate.py index 84481e2d3..4c99264ca 100644 --- a/process/models/stellarator/coils/calculate.py +++ b/process/models/stellarator/coils/calculate.py @@ -5,8 +5,6 @@ from process.core.model import DataStructure from process.data_structure import ( rebco_variables, - stellarator_configuration, - stellarator_variables, tfcoil_variables, ) from process.models.stellarator.coils import forces @@ -41,14 +39,14 @@ def st_coil(stellarator, output: bool, data: DataStructure): data structure object to provide model data """ - r_coil_major = stellarator_variables.r_coil_major - r_coil_minor = stellarator_variables.r_coil_minor + r_coil_major = data.stellarator.r_coil_major + r_coil_minor = data.stellarator.r_coil_minor ####################################################################################### calculate_winding_pack_geometry() # Total coil current (MA) - coilcurrent = calculate_current() + coilcurrent = calculate_current(data) awp_rad, a_tf_wp_no_insulation, a_tf_wp_with_insulation, f_a_scu_of_wp = ( winding_pack_total_size(r_coil_major, r_coil_minor, coilcurrent, data) @@ -60,8 +58,8 @@ def st_coil(stellarator, output: bool, data: DataStructure): ####################################################################################### # Port calculations - calculate_vertical_ports() - calculate_horizontal_ports() + calculate_vertical_ports(data) + calculate_horizontal_ports(data) ####################################################################################### # General Coil Geometry values @@ -75,34 +73,34 @@ def st_coil(stellarator, output: bool, data: DataStructure): calculate_plasma_facing_coil_area() - coil_coil_gap, _ = calculate_coil_coil_toroidal_gap(r_coil_major, r_coil_minor) + coil_coil_gap, _ = calculate_coil_coil_toroidal_gap(r_coil_major, r_coil_minor, data) calculate_coils_summary_variables(coilcurrent, r_coil_major, r_coil_minor, awp_rad) - inductance = calculate_inductnace(r_coil_minor) - calculate_stored_magnetic_energy(r_coil_minor) + inductance = calculate_inductance(r_coil_minor, data) + calculate_stored_magnetic_energy(r_coil_minor, data) # Coil dimensions data.build.z_tf_inside_half = ( 0.5e0 - * stellarator_configuration.stella_config_maximal_coil_height - * (r_coil_minor / stellarator_configuration.stella_config_coil_rminor) + * data.stellarator_config.stella_config_maximal_coil_height + * (r_coil_minor / data.stellarator_config.stella_config_coil_rminor) ) # [m] maximum half-height of coil # [m] estimated average length of a coil tfcoil_variables.len_tf_coil = ( - stellarator_configuration.stella_config_coillength - * (r_coil_minor / stellarator_configuration.stella_config_coil_rminor) + data.stellarator_config.stella_config_coillength + * (r_coil_minor / data.stellarator_config.stella_config_coil_rminor) / tfcoil_variables.n_tf_coils ) # [m^2] Total surface area of toroidal shells covering coils tfcoil_variables.tfcryoarea = ( - stellarator_configuration.stella_config_coilsurface - * stellarator_variables.f_st_rmajor + data.stellarator_config.stella_config_coilsurface + * data.stellarator.f_st_rmajor * ( - stellarator_variables.r_coil_minor - / stellarator_configuration.stella_config_coil_rminor + data.stellarator.r_coil_minor + / data.stellarator_config.stella_config_coil_rminor ) * 1.1e0 ) @@ -110,8 +108,8 @@ def st_coil(stellarator, output: bool, data: DataStructure): # Minimal bending radius: min_bending_radius = ( - stellarator_configuration.stella_config_min_bend_radius - * stellarator_variables.f_st_rmajor + data.stellarator_config.stella_config_min_bend_radius + * data.stellarator.f_st_rmajor / (1.0 - tfcoil_variables.dr_tf_wp_with_insulation / (2.0 * r_coil_minor)) ) @@ -128,22 +126,22 @@ def st_coil(stellarator, output: bool, data: DataStructure): # ####################################################################################### # Forces scaling # - forces.calculate_max_force_density(a_tf_wp_no_insulation) + forces.calculate_max_force_density(a_tf_wp_no_insulation, data) forces.calculate_maximum_stress() # Units: MN/m - max_force_density_mnm = forces.calculate_max_force_density_mnm() + max_force_density_mnm = forces.calculate_max_force_density_mnm(data) max_lateral_force_density = forces.calculate_max_lateral_force_density( - a_tf_wp_no_insulation + a_tf_wp_no_insulation, data ) max_radial_force_density = forces.calculate_max_radial_force_density( - a_tf_wp_no_insulation + a_tf_wp_no_insulation, data ) # # F = f*V = B*j*V \propto B/B0 * I/I0 * A0/A * A/A0 * len/len0 - centering_force_max_mn = forces.calculate_centering_force_max_mn() - centering_force_min_mn = forces.calculate_centering_force_min_mn() - centering_force_avg_mn = forces.calculate_centering_force_avg_mn() + centering_force_max_mn = forces.calculate_centering_force_max_mn(data) + centering_force_min_mn = forces.calculate_centering_force_min_mn(data) + centering_force_avg_mn = forces.calculate_centering_force_avg_mn(data) # #################################### @@ -230,7 +228,7 @@ def calculate_plasma_facing_coil_area(): tfcoil_variables.tfsao = tfcoil_variables.tfsai -def calculate_coil_coil_toroidal_gap(r_coil_major, r_coil_minor): +def calculate_coil_coil_toroidal_gap(r_coil_major, r_coil_minor, data: DataStructure): """[m] Minimal distance in toroidal direction between two stellarator coils Consistency with coil width is checked in constraint equation 82 @@ -240,14 +238,17 @@ def calculate_coil_coil_toroidal_gap(r_coil_major, r_coil_minor): r_coil_minor : + data: DataStructure + data structure object + """ # [m] Toroidal gap between two coil filaments tfcoil_variables.toroidalgap = ( - stellarator_configuration.stella_config_dmin + data.stellarator_config.stella_config_dmin * (r_coil_major - r_coil_minor) / ( - stellarator_configuration.stella_config_coil_rmajor - - stellarator_configuration.stella_config_coil_rminor + data.stellarator_config.stella_config_coil_rmajor + - data.stellarator_config.stella_config_coil_rminor ) ) # Left-Over coil gap between two coils (m) @@ -289,37 +290,41 @@ def calculate_coils_summary_variables(coilcurrent, r_coil_major, r_coil_minor, a # useful for stellarators -def calculate_inductnace(r_coil_minor): +def calculate_inductance(r_coil_minor, data: DataStructure): """This uses the reference value for the inductance and scales it with a^2/R (toroid inductance scaling) Parameters ---------- r_coil_minor : + data: DataStructure + data structure object """ return ( - stellarator_configuration.stella_config_inductance - / stellarator_variables.f_st_rmajor - * (r_coil_minor / stellarator_configuration.stella_config_coil_rminor) ** 2 - * stellarator_variables.f_st_n_coils**2 + data.stellarator_config.stella_config_inductance + / data.stellarator.f_st_rmajor + * (r_coil_minor / data.stellarator_config.stella_config_coil_rminor) ** 2 + * data.stellarator.f_st_n_coils**2 ) -def calculate_stored_magnetic_energy(r_coil_minor): +def calculate_stored_magnetic_energy(r_coil_minor, data: DataStructure): """[GJ] Total magnetic energy Parameters ---------- r_coil_minor : + data: DataStructure + data structure object """ tfcoil_variables.e_tf_magnetic_stored_total_gj = ( 0.5e0 * ( - stellarator_configuration.stella_config_inductance - / stellarator_variables.f_st_rmajor - * (r_coil_minor / stellarator_configuration.stella_config_coil_rminor) ** 2 - * stellarator_variables.f_st_n_coils**2 + data.stellarator_config.stella_config_inductance + / data.stellarator.f_st_rmajor + * (r_coil_minor / data.stellarator_config.stella_config_coil_rminor) ** 2 + * data.stellarator.f_st_n_coils**2 ) * (tfcoil_variables.c_tf_total / tfcoil_variables.n_tf_coils) ** 2 * 1.0e-9 @@ -353,20 +358,20 @@ def calculate_winding_pack_geometry(): ) ** 2 - tfcoil_variables.a_tf_turn_cable_space_no_void -def calculate_current(): +def calculate_current(data: DataStructure): """Recalculate the coil current from global stellarator configuration and variables: coilcurrent = f_b * stella_config_i0 * f_r / f_n - Update stellarator_variables.f_i + Update data.stellarator.f_i """ coilcurrent = ( - stellarator_variables.f_st_b - * stellarator_configuration.stella_config_i0 - * stellarator_variables.f_st_rmajor - / stellarator_variables.f_st_n_coils + data.stellarator.f_st_b + * data.stellarator_config.stella_config_i0 + * data.stellarator.f_st_rmajor + / data.stellarator.f_st_n_coils ) - stellarator_variables.f_st_i_total = ( - coilcurrent / stellarator_configuration.stella_config_i0 + data.stellarator.f_st_i_total = ( + coilcurrent / data.stellarator_config.stella_config_i0 ) return coilcurrent @@ -401,6 +406,7 @@ def winding_pack_total_size( tfcoil_variables.n_tf_coils, r_coil_major, r_coil_minor, + data, ) # Two margins can be applied for jcrit: direct or by temperature margin. # Temperature margin is implemented in the jcrit_vector definition, @@ -436,7 +442,7 @@ def winding_pack_total_size( rhs[:] = coilcurrent / ( wp_width_r**2 - / stellarator_configuration.stella_config_wp_ratio + / data.stellarator_config.stella_config_wp_ratio * fraction_area_superconductor_of_wp ) # f_a_scu_of_wp should be the fraction of the sc that is in the winding pack. @@ -461,11 +467,12 @@ def winding_pack_total_size( tfcoil_variables.n_tf_coils, r_coil_major, r_coil_minor, + data, ) # Winding pack toroidal, radial cross-sections (m) awp_tor = ( - wp_width_r_min / stellarator_configuration.stella_config_wp_ratio + wp_width_r_min / data.stellarator_config.stella_config_wp_ratio ) # Toroidal dimension awp_rad = wp_width_r_min # Radial dimension @@ -549,43 +556,37 @@ def calculate_casing(): tfcoil_variables.dx_tf_side_case_min = tfcoil_variables.dr_tf_nose_case -def calculate_vertical_ports(): +def calculate_vertical_ports(data: DataStructure): # Maximal toroidal port size (vertical ports) (m) # The maximal distance is correct but the vertical extension of this port is not clear# # This is simplified for now and can be made more accurate in the future# - stellarator_variables.vporttmax = ( + data.stellarator.vporttmax = ( 0.4e0 - * stellarator_configuration.stella_config_max_portsize_width - * stellarator_variables.f_st_rmajor - / stellarator_variables.f_st_n_coils + * data.stellarator_config.stella_config_max_portsize_width + * data.stellarator.f_st_rmajor + / data.stellarator.f_st_n_coils ) # This is not accurate yet. Needs more insight# # Maximal poloidal port size (vertical ports) (m) - stellarator_variables.vportpmax = ( - 2.0 * stellarator_variables.vporttmax - ) # Simple approximation + data.stellarator.vportpmax = 2.0 * data.stellarator.vporttmax # Simple approximation # Maximal vertical port clearance area (m2) - stellarator_variables.vportamax = ( - stellarator_variables.vporttmax * stellarator_variables.vportpmax - ) + data.stellarator.vportamax = data.stellarator.vporttmax * data.stellarator.vportpmax -def calculate_horizontal_ports(): +def calculate_horizontal_ports(data: DataStructure): # Maximal toroidal port size (horizontal ports) (m) - stellarator_variables.hporttmax = ( + data.stellarator.hporttmax = ( 0.8e0 - * stellarator_configuration.stella_config_max_portsize_width - * stellarator_variables.f_st_rmajor - / stellarator_variables.f_st_n_coils + * data.stellarator_config.stella_config_max_portsize_width + * data.stellarator.f_st_rmajor + / data.stellarator.f_st_n_coils ) # Factor 0.8 to take the variation with height into account # Maximal poloidal port size (horizontal ports) (m) - stellarator_variables.hportpmax = ( - 2.0e0 * stellarator_variables.hporttmax + data.stellarator.hportpmax = ( + 2.0e0 * data.stellarator.hporttmax ) # Simple approximation # Maximal horizontal port clearance area (m2) - stellarator_variables.hportamax = ( - stellarator_variables.hporttmax * stellarator_variables.hportpmax - ) + data.stellarator.hportamax = data.stellarator.hporttmax * data.stellarator.hportpmax diff --git a/process/models/stellarator/coils/coils.py b/process/models/stellarator/coils/coils.py index 1fe177c6a..efb400ea0 100644 --- a/process/models/stellarator/coils/coils.py +++ b/process/models/stellarator/coils/coils.py @@ -3,9 +3,7 @@ import numpy as np from process.core.exceptions import ProcessValueError -from process.data_structure import ( - stellarator_configuration, -) +from process.core.model import DataStructure from process.models import superconductors logger = logging.getLogger(__name__) @@ -255,7 +253,9 @@ def intersect(x1, y1, x2, y2, xin): return x -def bmax_from_awp(wp_width_radial, current, n_tf_coils, r_coil_major, r_coil_minor): +def bmax_from_awp( + wp_width_radial, current, n_tf_coils, r_coil_major, r_coil_minor, data: DataStructure +): """Returns a fitted function for bmax for stellarators Returns a fitted function for bmax in dependence @@ -274,7 +274,8 @@ def bmax_from_awp(wp_width_radial, current, n_tf_coils, r_coil_major, r_coil_min r_coil_minor : - + data: DataStructure + data structure object """ return ( 2e-1 # this is mu x 1e6, to use current in MA @@ -282,7 +283,7 @@ def bmax_from_awp(wp_width_radial, current, n_tf_coils, r_coil_major, r_coil_min * n_tf_coils / (r_coil_major - r_coil_minor) * ( - stellarator_configuration.stella_config_a1 - + stellarator_configuration.stella_config_a2 * r_coil_major / wp_width_radial + data.stellarator_config.stella_config_a1 + + data.stellarator_config.stella_config_a2 * r_coil_major / wp_width_radial ) ) diff --git a/process/models/stellarator/coils/forces.py b/process/models/stellarator/coils/forces.py index 60b2162dd..9ed801c0d 100644 --- a/process/models/stellarator/coils/forces.py +++ b/process/models/stellarator/coils/forces.py @@ -1,39 +1,38 @@ """Module for coil force calculations in stellarators.""" -from process.data_structure import ( - stellarator_configuration, - stellarator_variables, - tfcoil_variables, -) +from process.core.model import DataStructure +from process.data_structure import tfcoil_variables -def calculate_max_force_density(a_tf_wp_no_insulation): +def calculate_max_force_density(a_tf_wp_no_insulation, data: DataStructure): """Calculate the maximum force density in the TF coil winding pack from scaling. [MN/m3] Parameters ---------- a_tf_wp_no_insulation : + data: DataStructure + data structure object """ tfcoil_variables.max_force_density = ( - stellarator_configuration.stella_config_max_force_density - * stellarator_variables.f_st_i_total - / stellarator_variables.f_st_n_coils + data.stellarator_config.stella_config_max_force_density + * data.stellarator.f_st_i_total + / data.stellarator.f_st_n_coils * tfcoil_variables.b_tf_inboard_peak_symmetric - / stellarator_configuration.stella_config_wp_bmax - * stellarator_configuration.stella_config_wp_area + / data.stellarator_config.stella_config_wp_bmax + * data.stellarator_config.stella_config_wp_area / a_tf_wp_no_insulation ) -def calculate_max_force_density_mnm(): +def calculate_max_force_density_mnm(data: DataStructure): """Calculate the maximum force per meter in the TF coil winding pack from scaling. [MN/m]""" return ( - stellarator_configuration.stella_config_max_force_density_mnm - * stellarator_variables.f_st_i_total - / stellarator_variables.f_st_n_coils + data.stellarator_config.stella_config_max_force_density_mnm + * data.stellarator.f_st_i_total + / data.stellarator.f_st_n_coils * tfcoil_variables.b_tf_inboard_peak_symmetric - / stellarator_configuration.stella_config_wp_bmax + / data.stellarator_config.stella_config_wp_bmax ) @@ -46,81 +45,85 @@ def calculate_maximum_stress(): ) -def calculate_max_lateral_force_density(a_tf_wp_no_insulation): +def calculate_max_lateral_force_density(a_tf_wp_no_insulation, data: DataStructure): """Calculate the maximum lateral force density in the TF coil winding pack from scaling. [MN/m3] Parameters ---------- a_tf_wp_no_insulation : + data: DataStructure + data structure object """ return ( - stellarator_configuration.stella_config_max_lateral_force_density - * stellarator_variables.f_st_i_total - / stellarator_variables.f_st_n_coils + data.stellarator_config.stella_config_max_lateral_force_density + * data.stellarator.f_st_i_total + / data.stellarator.f_st_n_coils * tfcoil_variables.b_tf_inboard_peak_symmetric - / stellarator_configuration.stella_config_wp_bmax - * stellarator_configuration.stella_config_wp_area + / data.stellarator_config.stella_config_wp_bmax + * data.stellarator_config.stella_config_wp_area / a_tf_wp_no_insulation ) -def calculate_max_radial_force_density(a_tf_wp_no_insulation): +def calculate_max_radial_force_density(a_tf_wp_no_insulation, data): """Calculate the maximum radial force density in the TF coil winding pack from scaling. [MN/m3] Parameters ---------- a_tf_wp_no_insulation : + data: DataStructure + data structure object """ return ( - stellarator_configuration.stella_config_max_radial_force_density - * stellarator_variables.f_st_i_total - / stellarator_variables.f_st_n_coils + data.stellarator_config.stella_config_max_radial_force_density + * data.stellarator.f_st_i_total + / data.stellarator.f_st_n_coils * tfcoil_variables.b_tf_inboard_peak_symmetric - / stellarator_configuration.stella_config_wp_bmax - * stellarator_configuration.stella_config_wp_area + / data.stellarator_config.stella_config_wp_bmax + * data.stellarator_config.stella_config_wp_area / a_tf_wp_no_insulation ) -def calculate_centering_force_max_mn(): +def calculate_centering_force_max_mn(data: DataStructure): """Calculate the maximum centering force in the TF coils from scaling. [MN]""" return ( - stellarator_configuration.stella_config_centering_force_max_mn - * stellarator_variables.f_st_i_total - / stellarator_variables.f_st_n_coils + data.stellarator_config.stella_config_centering_force_max_mn + * data.stellarator.f_st_i_total + / data.stellarator.f_st_n_coils * tfcoil_variables.b_tf_inboard_peak_symmetric - / stellarator_configuration.stella_config_wp_bmax - * stellarator_configuration.stella_config_coillength + / data.stellarator_config.stella_config_wp_bmax + * data.stellarator_config.stella_config_coillength / tfcoil_variables.n_tf_coils / tfcoil_variables.len_tf_coil ) -def calculate_centering_force_min_mn(): +def calculate_centering_force_min_mn(data: DataStructure): """Calculate the minimum centering force in the TF coils from scaling. [MN]""" return ( - stellarator_configuration.stella_config_centering_force_min_mn - * stellarator_variables.f_st_i_total - / stellarator_variables.f_st_n_coils + data.stellarator_config.stella_config_centering_force_min_mn + * data.stellarator.f_st_i_total + / data.stellarator.f_st_n_coils * tfcoil_variables.b_tf_inboard_peak_symmetric - / stellarator_configuration.stella_config_wp_bmax - * stellarator_configuration.stella_config_coillength + / data.stellarator_config.stella_config_wp_bmax + * data.stellarator_config.stella_config_coillength / tfcoil_variables.n_tf_coils / tfcoil_variables.len_tf_coil ) -def calculate_centering_force_avg_mn(): +def calculate_centering_force_avg_mn(data: DataStructure): """Calculate the average centering force in the TF coils from scaling. [MN]""" return ( - stellarator_configuration.stella_config_centering_force_avg_mn - * stellarator_variables.f_st_i_total - / stellarator_variables.f_st_n_coils + data.stellarator_config.stella_config_centering_force_avg_mn + * data.stellarator.f_st_i_total + / data.stellarator.f_st_n_coils * tfcoil_variables.b_tf_inboard_peak_symmetric - / stellarator_configuration.stella_config_wp_bmax - * stellarator_configuration.stella_config_coillength + / data.stellarator_config.stella_config_wp_bmax + * data.stellarator_config.stella_config_coillength / tfcoil_variables.n_tf_coils / tfcoil_variables.len_tf_coil ) diff --git a/process/models/stellarator/coils/output.py b/process/models/stellarator/coils/output.py index ba40cada6..d2e31248a 100644 --- a/process/models/stellarator/coils/output.py +++ b/process/models/stellarator/coils/output.py @@ -1,8 +1,5 @@ from process.core import process_output as po -from process.data_structure import ( - stellarator_variables, - tfcoil_variables, -) +from process.data_structure import tfcoil_variables def write( @@ -513,35 +510,35 @@ def write( stellarator.outfile, "Max toroidal size of vertical ports (m)", "(vporttmax)", - stellarator_variables.vporttmax, + data.stellarator.vporttmax, ) po.ovarre( stellarator.outfile, "Max poloidal size of vertical ports (m)", "(vportpmax)", - stellarator_variables.vportpmax, + data.stellarator.vportpmax, ) po.ovarre( stellarator.outfile, "Max area of vertical ports (m2)", "(vportamax)", - stellarator_variables.vportamax, + data.stellarator.vportamax, ) po.ovarre( stellarator.outfile, "Max toroidal size of horizontal ports (m)", "(hporttmax)", - stellarator_variables.hporttmax, + data.stellarator.hporttmax, ) po.ovarre( stellarator.outfile, "Max poloidal size of horizontal ports (m)", "(hportpmax)", - stellarator_variables.hportpmax, + data.stellarator.hportpmax, ) po.ovarre( stellarator.outfile, "Max area of horizontal ports (m2)", "(hportamax)", - stellarator_variables.hportamax, + data.stellarator.hportamax, ) diff --git a/process/models/stellarator/denisty_limits.py b/process/models/stellarator/denisty_limits.py index 52ac9cf82..7f4e8b1c1 100644 --- a/process/models/stellarator/denisty_limits.py +++ b/process/models/stellarator/denisty_limits.py @@ -5,15 +5,12 @@ from process.core import process_output as po from process.core.exceptions import ProcessValueError -from process.data_structure import ( - physics_variables, - stellarator_variables, -) +from process.data_structure import physics_variables logger = logging.getLogger(__name__) -def st_denisty_limits(stellarator, f_output): +def st_denisty_limits(stellarator, f_output, data): """Routine to reiterate the physics loop This routine reiterates some physics modules. @@ -24,6 +21,8 @@ def st_denisty_limits(stellarator, f_output): f_output : + data: DataStructure + data structure object """ # Set the required value for icc=5 @@ -37,7 +36,7 @@ def st_denisty_limits(stellarator, f_output): # Calculates the ECRH parameters ne0_max_ECRH, bt_ecrh = st_d_limit_ecrh( - stellarator_variables.max_gyrotron_frequency, + data.stellarator.max_gyrotron_frequency, physics_variables.b_plasma_toroidal_on_axis, ) @@ -45,11 +44,7 @@ def st_denisty_limits(stellarator, f_output): bt_ecrh = min(physics_variables.b_plasma_toroidal_on_axis, bt_ecrh) if f_output: - output( - stellarator, - bt_ecrh, - ne0_max_ECRH, - ) + output(stellarator, bt_ecrh, ne0_max_ECRH, data) def st_sudo_density_limit(b_plasma_toroidal_on_axis, powht, rmajor, rminor): @@ -218,14 +213,14 @@ def power_at_ignition_point(stellarator, gyro_frequency_max, te0_available): return powerht_out, pscalingmw_out -def output(stellarator, bt_ecrh, ne0_max_ECRH): +def output(stellarator, bt_ecrh, ne0_max_ECRH, data): po.oheadr(stellarator.outfile, "ECRH Ignition at lower values. Information:") po.ovarre( stellarator.outfile, "Maximal available gyrotron freq (input)", "(max_gyro_frequency)", - stellarator_variables.max_gyrotron_frequency, + data.stellarator.max_gyrotron_frequency, ) po.ovarre( @@ -259,13 +254,13 @@ def output(stellarator, bt_ecrh, ne0_max_ECRH): stellarator.outfile, "Maximum reachable ECRH temperature (pseudo) (KEV)", "(te0_ecrh_achievable)", - stellarator_variables.te0_ecrh_achievable, + data.stellarator.te0_ecrh_achievable, ) powerht_local, pscalingmw_local = power_at_ignition_point( stellarator, - stellarator_variables.max_gyrotron_frequency, - stellarator_variables.te0_ecrh_achievable, + data.stellarator.max_gyrotron_frequency, + data.stellarator.te0_ecrh_achievable, ) po.ovarre( stellarator.outfile, diff --git a/process/models/stellarator/divertor.py b/process/models/stellarator/divertor.py index 34c846f9e..28ca60558 100644 --- a/process/models/stellarator/divertor.py +++ b/process/models/stellarator/divertor.py @@ -6,7 +6,6 @@ from process.data_structure import ( divertor_variables, physics_variables, - stellarator_variables, ) @@ -28,7 +27,7 @@ def st_div(stellarator, f_output: bool, data: DataStructure): ---------- Stellarator Divertor Model for the Systems Code PROCESS, F. Warmer, 21/06/2013 """ - Theta = stellarator_variables.flpitch # ~bmn [rad] field line pitch + Theta = data.stellarator.flpitch # ~bmn [rad] field line pitch r = physics_variables.rmajor p_div = physics_variables.p_plasma_separatrix_mw alpha = divertor_variables.anginc @@ -46,18 +45,16 @@ def st_div(stellarator, f_output: bool, data: DataStructure): # Island size (m) w_r = 4.0e0 * np.sqrt( - stellarator_variables.bmn - * r - / (stellarator_variables.shear * stellarator_variables.n_res) + data.stellarator.bmn * r / (data.stellarator.shear * data.stellarator.n_res) ) # Perpendicular (to plate) distance from X-point to divertor plate (m) - Delta = stellarator_variables.f_w * w_r + Delta = data.stellarator.f_w * w_r # Length 'along' plasma (m) - l_p = 2 * np.pi * r * (stellarator_variables.m_res) / stellarator_variables.n_res + l_p = 2 * np.pi * r * (data.stellarator.m_res) / data.stellarator.n_res # Connection length from X-point to divertor plate (m) @@ -81,20 +78,20 @@ def st_div(stellarator, f_output: bool, data: DataStructure): # Total length of divertor plates (m) - l_t = 2.0e0 * stellarator_variables.n_res * l_d + l_t = 2.0e0 * data.stellarator.n_res * l_d # Wetted area (m2) a_eff = l_t * l_q - # Divertor plate width (m): assume total area is wetted area/stellarator_variables.fdivwet + # Divertor plate width (m): assume total area is wetted area/data.stellarator.fdivwet - darea = a_eff / stellarator_variables.fdivwet + darea = a_eff / data.stellarator.fdivwet l_w = darea / l_t # Divertor heat load (MW/m2) - q_div = stellarator_variables.f_asym * (p_div / a_eff) + q_div = data.stellarator.f_asym * (p_div / a_eff) # Transfer to global variables @@ -104,10 +101,10 @@ def st_div(stellarator, f_output: bool, data: DataStructure): data.fwbs.f_ster_div_single = darea / data.first_wall.a_fw_total if f_output: - output(stellarator, a_eff, l_d, l_w, f_x, l_q, w_r, Delta) + output(stellarator, a_eff, l_d, l_w, f_x, l_q, w_r, Delta, data) -def output(stellarator, a_eff, l_d, l_w, f_x, l_q, w_r, Delta): +def output(stellarator, a_eff, l_d, l_w, f_x, l_q, w_r, Delta, data): """Outputs a summary of divertor-related parameters and results to the stellartor object. stellarator: An object containing stellarator configuration and output handle. @@ -165,56 +162,56 @@ def output(stellarator, a_eff, l_d, l_w, f_x, l_q, w_r, Delta): stellarator.outfile, "Radiated power fraction in SOL", "(f_rad)", - stellarator_variables.f_rad, + data.stellarator.f_rad, ) po.ovarre( stellarator.outfile, "Heat load peaking factor", "(f_asym)", - stellarator_variables.f_asym, + data.stellarator.f_asym, ) po.ovarin( stellarator.outfile, "Poloidal resonance number", "(m_res)", - stellarator_variables.m_res, + data.stellarator.m_res, ) po.ovarin( stellarator.outfile, "Toroidal resonance number", "(n_res)", - stellarator_variables.n_res, + data.stellarator.n_res, ) po.ovarre( stellarator.outfile, "Relative radial field perturbation", "(bmn)", - stellarator_variables.bmn, + data.stellarator.bmn, ) po.ovarre( stellarator.outfile, "Field line pitch (rad)", "(flpitch)", - stellarator_variables.flpitch, + data.stellarator.flpitch, ) po.ovarre( stellarator.outfile, "Island size fraction factor", "(f_w)", - stellarator_variables.f_w, + data.stellarator.f_w, ) po.ovarre( stellarator.outfile, - "Magnetic stellarator_variables.shear (/m)", + "Magnetic data.stellarator.shear (/m)", "(shear)", - stellarator_variables.shear, + data.stellarator.shear, ) po.ovarre(stellarator.outfile, "Divertor wetted area (m2)", "(A_eff)", a_eff) po.ovarre( stellarator.outfile, "Wetted area fraction of total plate area", "(fdivwet)", - stellarator_variables.fdivwet, + data.stellarator.fdivwet, ) po.ovarre(stellarator.outfile, "Divertor plate length (m)", "(L_d)", l_d) po.ovarre(stellarator.outfile, "Divertor plate width (m)", "(L_w)", l_w) diff --git a/process/models/stellarator/heating.py b/process/models/stellarator/heating.py index c19a9b0eb..9bbf3d878 100644 --- a/process/models/stellarator/heating.py +++ b/process/models/stellarator/heating.py @@ -3,10 +3,7 @@ from process.core import process_output as po from process.core.exceptions import ProcessValueError from process.core.model import DataStructure -from process.data_structure import ( - physics_variables, - stellarator_variables, -) +from process.data_structure import physics_variables logger = logging.getLogger(__name__) @@ -29,7 +26,7 @@ def st_heat(stellarator, f_output: bool, data: DataStructure): """ f_p_beam_injected_ions = None - if stellarator_variables.isthtr == 1: + if data.stellarator.isthtr == 1: data.current_drive.p_hcd_ecrh_injected_total_mw = ( data.current_drive.p_hcd_primary_extra_heat_mw ) @@ -45,7 +42,7 @@ def st_heat(stellarator, f_output: bool, data: DataStructure): + data.current_drive.p_hcd_injected_electrons_mw ) / data.current_drive.eta_hcd_primary_injector_wall_plug - elif stellarator_variables.isthtr == 2: + elif data.stellarator.isthtr == 2: data.current_drive.p_hcd_lowhyb_injected_total_mw = ( data.current_drive.p_hcd_primary_extra_heat_mw ) @@ -61,7 +58,7 @@ def st_heat(stellarator, f_output: bool, data: DataStructure): + data.current_drive.p_hcd_injected_electrons_mw ) / data.current_drive.eta_hcd_primary_injector_wall_plug - elif stellarator_variables.isthtr == 3: + elif data.stellarator.isthtr == 3: ( _effnbss, f_p_beam_injected_ions, @@ -90,10 +87,10 @@ def st_heat(stellarator, f_output: bool, data: DataStructure): + data.current_drive.p_hcd_injected_electrons_mw ) / data.current_drive.eta_hcd_primary_injector_wall_plug else: - logger.error(f"isthtr {stellarator_variables.isthtr}") - logger.error(f"isthtr type {type(stellarator_variables.isthtr)}") + logger.error(f"isthtr {data.stellarator.isthtr}") + logger.error(f"isthtr type {type(data.stellarator.isthtr)}") raise ProcessValueError( - "Illegal value for isthtr", isthtr=stellarator_variables.isthtr + "Illegal value for isthtr", isthtr=data.stellarator.isthtr ) # Total injected power @@ -139,11 +136,11 @@ def st_heat(stellarator, f_output: bool, data: DataStructure): def output(stellarator, data: DataStructure, f_p_beam_injected_ions=None): po.oheadr(stellarator.outfile, "Auxiliary Heating System") - if stellarator_variables.isthtr == 1: + if data.stellarator.isthtr == 1: po.ocmmnt(stellarator.outfile, "Electron Cyclotron Resonance Heating") - elif stellarator_variables.isthtr == 2: + elif data.stellarator.isthtr == 2: po.ocmmnt(stellarator.outfile, "Lower Hybrid Heating") - elif stellarator_variables.isthtr == 3: + elif data.stellarator.isthtr == 3: po.ocmmnt(stellarator.outfile, "Neutral Beam Injection Heating") if physics_variables.i_plasma_ignited == 1: diff --git a/process/models/stellarator/initialization.py b/process/models/stellarator/initialization.py index 65d6566a6..15801a286 100644 --- a/process/models/stellarator/initialization.py +++ b/process/models/stellarator/initialization.py @@ -1,9 +1,7 @@ from process.core.model import DataStructure from process.data_structure import ( numerics, - pfcoil_variables, physics_variables, - stellarator_variables, ) @@ -14,7 +12,7 @@ def st_init(data: DataStructure): Many of these may override the values set in routine """ - if stellarator_variables.istell == 0: + if data.stellarator.istell == 0: return numerics.boundu[0] = 40.0 # allow higher aspect ratio @@ -26,7 +24,7 @@ def st_init(data: DataStructure): data.build.dr_cs = 0.0 data.build.iohcl = 0 - pfcoil_variables.f_z_cs_tf_internal = 0.0 + data.pf_coil.f_z_cs_tf_internal = 0.0 data.build.dr_cs_tf_gap = 0.0 data.build.f_dr_tf_outboard_inboard = 1.0 diff --git a/process/models/stellarator/neoclassics.py b/process/models/stellarator/neoclassics.py index ceab08c95..99644fd72 100644 --- a/process/models/stellarator/neoclassics.py +++ b/process/models/stellarator/neoclassics.py @@ -3,23 +3,28 @@ import numpy as np from process.core import constants +from process.core.model import Model from process.data_structure import ( impurity_radiation_module, neoclassics_variables, physics_variables, - stellarator_configuration, - stellarator_variables, ) from process.models.stellarator.stellarator import KEV logger = logging.getLogger(__name__) -class Neoclassics: +class Neoclassics(Model): @property def no_roots(self): return neoclassics_variables.roots.shape[0] + def output(self): + """This model doesn't have any output""" + + def run(self): + """This model doesn't need to be run""" + def init_neoclassics(self, r_effin, eps_effin, iotain): """Constructor of the neoclassics object from the effective radius, epsilon effective and iota only. @@ -275,14 +280,14 @@ def init_profile_values_from_PROCESS(self, rho): return dens, temp, dr_dens, dr_temp def calc_neoclassics(self): - if stellarator_configuration.stella_config_epseff < 0: + if self.data.stellarator_config.stella_config_epseff < 0: logger.error( - f"epseff value lower than 0: {stellarator_configuration.stella_config_epseff}" + f"epseff value lower than 0: {self.data.stellarator_config.stella_config_epseff}" ) self.init_neoclassics( 0.6, - stellarator_configuration.stella_config_epseff, - stellarator_variables.iotabar, + self.data.stellarator_config.stella_config_epseff, + self.data.stellarator.iotabar, ) q_PROCESS = ( @@ -781,21 +786,21 @@ def neoclassics_calc_q_flux(self): def st_calc_eff_chi(self): volscaling = ( physics_variables.vol_plasma - * stellarator_variables.f_st_rmajor + * self.data.stellarator.f_st_rmajor * ( impurity_radiation_module.radius_plasma_core_norm * physics_variables.rminor - / stellarator_configuration.stella_config_rminor_ref + / self.data.stellarator_config.stella_config_rminor_ref ) ** 2 ) surfacescaling = ( physics_variables.a_plasma_surface - * stellarator_variables.f_st_rmajor + * self.data.stellarator.f_st_rmajor * ( impurity_radiation_module.radius_plasma_core_norm * physics_variables.rminor - / stellarator_configuration.stella_config_rminor_ref + / self.data.stellarator_config.stella_config_rminor_ref ) ) diff --git a/process/models/stellarator/preset_config.py b/process/models/stellarator/preset_config.py index 242996e2f..88ee84296 100644 --- a/process/models/stellarator/preset_config.py +++ b/process/models/stellarator/preset_config.py @@ -2,7 +2,7 @@ from pathlib import Path from process.core.exceptions import ProcessValueError -from process.data_structure import stellarator_configuration +from process.core.model import DataStructure HELIAS5B = { "name": "Helias 5b", @@ -209,7 +209,7 @@ } -def load_stellarator_config(istell: int, config_file: Path | None): +def load_stellarator_config(istell: int, config_file: Path | None, data: DataStructure): """Load the appropriate Stellarator machine configuration Parameters @@ -223,6 +223,8 @@ def load_stellarator_config(istell: int, config_file: Path | None): istell = 6: Init from json config_file: + data: DataStructure + data structure object """ match istell: @@ -247,7 +249,7 @@ def load_stellarator_config(istell: int, config_file: Path | None): for variable_name, variable_value in machine_config.items(): setattr( - stellarator_configuration, + data.stellarator_config, f"stella_config_{variable_name.lower()}", variable_value, ) diff --git a/process/models/stellarator/stellarator.py b/process/models/stellarator/stellarator.py index 87b7f72d1..b477c87b9 100644 --- a/process/models/stellarator/stellarator.py +++ b/process/models/stellarator/stellarator.py @@ -18,8 +18,6 @@ global_variables, numerics, physics_variables, - stellarator_configuration, - stellarator_variables, tfcoil_variables, ) from process.models.physics.physics import Physics, rether @@ -134,7 +132,7 @@ def run(self, output: bool = False): self.physics.outplas() st_heat(self, True, self.data) self.st_phys(True) - st_denisty_limits(self, True) + st_denisty_limits(self, True, self.data) # Change in density limit can result in changed dene? # A second call of st_phys is used to make sure it is consitent. @@ -160,7 +158,7 @@ def run(self, output: bool = False): self.st_new_config() self.st_geom() self.st_phys(False) - st_denisty_limits(self, False) + st_denisty_limits(self, False, self.data) st_coil(self, False, self.data) st_build(self, False, self.data) self.st_strc(False) @@ -183,14 +181,14 @@ def run(self, output: bool = False): # This call is comparably time consuming.. # If the respective constraint equation is not called, do not set the values ( - stellarator_variables.powerht_constraint, - stellarator_variables.powerscaling_constraint, + self.data.stellarator.powerht_constraint, + self.data.stellarator.powerscaling_constraint, ) = power_at_ignition_point( - stellarator_variables.max_gyrotron_frequency, - stellarator_variables.te0_ecrh_achievable, + self.data.stellarator.max_gyrotron_frequency, + self.data.stellarator.te0_ecrh_achievable, ) - stellarator_variables.first_call = False + self.data.stellarator.first_call = False def st_new_config(self): """ @@ -203,70 +201,76 @@ def st_new_config(self): To clarify the coils scaling factor: Coil aspect ratio factor can be described with the reversed equation (so if we would know r_coil_minor) - stellarator_variables.f_coil_aspect = ( - (physics_variables.rmajor / stellarator_variables.r_coil_minor) / - (stellarator_configuration.stella_config_rmajor_ref / - stellarator_configuration.stella_config_coil_rminor) + self.data.stellarator.f_coil_aspect = ( + (physics_variables.rmajor / self.data.stellarator.r_coil_minor) / + (self.data.stellarator_config.stella_config_rmajor_ref / + self.data.stellarator_config.stella_config_coil_rminor) ) """ load_stellarator_config( - stellarator_variables.istell, + self.data.stellarator.istell, Path(f"{global_variables.output_prefix}stella_conf.json"), + self.data, ) # If physics_variables.aspect ratio is not in numerics.ixc set it to default value # Or when you call it the first time if 1 not in numerics.ixc: - physics_variables.aspect = stellarator_configuration.stella_config_aspect_ref + physics_variables.aspect = ( + self.data.stellarator_config.stella_config_aspect_ref + ) # Set the physics_variables.rminor radius as result here. physics_variables.rminor = physics_variables.rmajor / physics_variables.aspect physics_variables.eps = 1.0e0 / physics_variables.aspect tfcoil_variables.n_tf_coils = ( - stellarator_configuration.stella_config_coilspermodule - * stellarator_configuration.stella_config_symmetry + self.data.stellarator_config.stella_config_coilspermodule + * self.data.stellarator_config.stella_config_symmetry ) # This overwrites tfcoil_variables.n_tf_coils in input file. - stellarator_variables.f_st_rmajor = ( - physics_variables.rmajor / stellarator_configuration.stella_config_rmajor_ref + self.data.stellarator.f_st_rmajor = ( + physics_variables.rmajor + / self.data.stellarator_config.stella_config_rmajor_ref ) # Size scaling factor with respect to the reference calculation - stellarator_variables.f_st_rminor = ( - physics_variables.rminor / stellarator_configuration.stella_config_rminor_ref + self.data.stellarator.f_st_rminor = ( + physics_variables.rminor + / self.data.stellarator_config.stella_config_rminor_ref ) # Size scaling factor with respect to the reference calculation - stellarator_variables.f_st_aspect = ( - physics_variables.aspect / stellarator_configuration.stella_config_aspect_ref + self.data.stellarator.f_st_aspect = ( + physics_variables.aspect + / self.data.stellarator_config.stella_config_aspect_ref ) - stellarator_variables.f_st_n_coils = tfcoil_variables.n_tf_coils / ( - stellarator_configuration.stella_config_coilspermodule - * stellarator_configuration.stella_config_symmetry + self.data.stellarator.f_st_n_coils = tfcoil_variables.n_tf_coils / ( + self.data.stellarator_config.stella_config_coilspermodule + * self.data.stellarator_config.stella_config_symmetry ) # Coil number factor - stellarator_variables.f_st_b = ( + self.data.stellarator.f_st_b = ( physics_variables.b_plasma_toroidal_on_axis - / stellarator_configuration.stella_config_bt_ref + / self.data.stellarator_config.stella_config_bt_ref ) # B-field scaling factor # Coil aspect ratio factor to the reference calculation (we use it to scale the coil minor radius) - stellarator_variables.f_coil_aspect = stellarator_variables.f_st_coil_aspect + self.data.stellarator.f_coil_aspect = self.data.stellarator.f_st_coil_aspect # Coil major radius, scaled with respect to the reference calculation - stellarator_variables.r_coil_major = ( - stellarator_configuration.stella_config_coil_rmajor - * stellarator_variables.f_st_rmajor + self.data.stellarator.r_coil_major = ( + self.data.stellarator_config.stella_config_coil_rmajor + * self.data.stellarator.f_st_rmajor ) # Coil minor radius, scaled with respect to the reference calculation - stellarator_variables.r_coil_minor = ( - stellarator_configuration.stella_config_coil_rminor - * stellarator_variables.f_st_rmajor - / stellarator_variables.f_coil_aspect + self.data.stellarator.r_coil_minor = ( + self.data.stellarator_config.stella_config_coil_rminor + * self.data.stellarator.f_st_rmajor + / self.data.stellarator.f_coil_aspect ) - stellarator_variables.f_coil_shape = ( - stellarator_configuration.stella_config_min_plasma_coil_distance - + stellarator_configuration.stella_config_rminor_ref - ) / stellarator_configuration.stella_config_coil_rminor + self.data.stellarator.f_coil_shape = ( + self.data.stellarator_config.stella_config_min_plasma_coil_distance + + self.data.stellarator_config.stella_config_rminor_ref + ) / self.data.stellarator_config.stella_config_coil_rminor def st_geom(self): """ @@ -287,16 +291,16 @@ def st_geom(self): """ physics_variables.vol_plasma = ( - stellarator_variables.f_st_rmajor - * stellarator_variables.f_st_rminor**2 - * stellarator_configuration.stella_config_vol_plasma + self.data.stellarator.f_st_rmajor + * self.data.stellarator.f_st_rminor**2 + * self.data.stellarator_config.stella_config_vol_plasma ) # Plasma surface scaled from effective parameter: physics_variables.a_plasma_surface = ( - stellarator_variables.f_st_rmajor - * stellarator_variables.f_st_rminor - * stellarator_configuration.stella_config_plasma_surface + self.data.stellarator.f_st_rmajor + * self.data.stellarator.f_st_rminor + * self.data.stellarator_config.stella_config_plasma_surface ) # Plasma cross section area. Approximated @@ -349,11 +353,11 @@ def st_strc(self, output): # Calculate the intercoil bolted plates structure from the coil surface intercoil_surface = ( - stellarator_configuration.stella_config_coilsurface - * stellarator_variables.f_st_rmajor + self.data.stellarator_config.stella_config_coilsurface + * self.data.stellarator.f_st_rmajor * ( - stellarator_variables.r_coil_minor - / stellarator_configuration.stella_config_coil_rminor + self.data.stellarator.r_coil_minor + / self.data.stellarator_config.stella_config_coil_rminor ) - tfcoil_variables.dx_tf_inboard_out_toroidal * tfcoil_variables.len_tf_coil @@ -586,7 +590,7 @@ def st_fwbs(self, output: bool): # The peaking factor, obtained as precalculated parameter self.data.fwbs.wallpf = ( - stellarator_configuration.stella_config_neutron_peakfactor + self.data.stellarator_config.stella_config_neutron_peakfactor ) # Blanket neutronics calculations @@ -1994,7 +1998,7 @@ def st_phys(self, output): physics_variables.rminor * physics_variables.b_plasma_toroidal_on_axis / physics_variables.rmajor - * stellarator_variables.iotabar + * self.data.stellarator.iotabar ) # Perform auxiliary power calculations @@ -2207,10 +2211,10 @@ def st_phys(self, output): # is not taken care of by the rad module. We restrict the radiation power here by the heating power: physics_variables.p_plasma_rad_mw = max(0.0e0, physics_variables.p_plasma_rad_mw) - # Power to divertor, = (1-stellarator_variables.f_rad)*Psol + # Power to divertor, = (1-self.data.stellarator.f_rad)*Psol # The SOL radiation needs to be smaller than the physics_variables.p_plasma_rad_mw - physics_variables.psolradmw = stellarator_variables.f_rad * powht + physics_variables.psolradmw = self.data.stellarator.f_rad * powht physics_variables.p_plasma_separatrix_mw = powht - physics_variables.psolradmw # Add SOL Radiation to total @@ -2268,7 +2272,7 @@ def st_phys(self, output): # Calculate transport losses and energy confinement time using the # chosen scaling law - # N.B. stellarator_variables.iotabar replaces tokamak physics_variables.q95 in argument list + # N.B. self.data.stellarator.iotabar replaces tokamak physics_variables.q95 in argument list ( physics_variables.pden_electron_transport_loss_mw, @@ -2299,7 +2303,7 @@ def st_phys(self, output): physics_variables.rminor, physics_variables.temp_plasma_electron_density_weighted_kev, physics_variables.temp_plasma_ion_density_weighted_kev, - stellarator_variables.iotabar, + self.data.stellarator.iotabar, physics_variables.qstar, physics_variables.vol_plasma, physics_variables.n_charge_plasma_effective_vol_avg, diff --git a/process/models/structure.py b/process/models/structure.py index 59ad7d47b..f48a34657 100644 --- a/process/models/structure.py +++ b/process/models/structure.py @@ -9,7 +9,6 @@ from process.core import process_output as po from process.core.model import Model from process.data_structure import divertor_variables as divv -from process.data_structure import pfcoil_variables as pfv from process.data_structure import physics_variables as pv from process.data_structure import tfcoil_variables as tfv @@ -42,7 +41,10 @@ def run(self, output: bool = False): indicate whether output should be written to the output file, or not """ # Total weight of the PF coil conductor and its structure - total_weight_pf = pfv.m_pf_coil_conductor_total + pfv.m_pf_coil_structure_total + total_weight_pf = ( + self.data.pf_coil.m_pf_coil_conductor_total + + self.data.pf_coil.m_pf_coil_structure_total + ) ( self.data.structure.fncmass, @@ -57,7 +59,7 @@ def run(self, output: bool = False): pv.kappa, pv.b_plasma_toroidal_on_axis, tfv.i_tf_sup, - pfv.i_pf_conductor, + self.data.pf_coil.i_pf_conductor, self.data.build.dr_tf_inner_bore + self.data.build.dr_tf_outboard + self.data.build.dr_tf_inboard, diff --git a/process/models/tfcoil/resistive.py b/process/models/tfcoil/resistive.py index c3a1b630a..51d812089 100644 --- a/process/models/tfcoil/resistive.py +++ b/process/models/tfcoil/resistive.py @@ -5,7 +5,6 @@ from process.core import constants from process.data_structure import ( - pfcoil_variables, physics_variables, superconducting_tf_coil_variables, tfcoil_variables, @@ -137,19 +136,19 @@ def run(self, output: bool = False): float(self.data.build.r_tf_inboard_in), self.data.build.dr_bore, self.data.build.z_tf_inside_half, - pfcoil_variables.f_z_cs_tf_internal, + self.data.pf_coil.f_z_cs_tf_internal, self.data.build.dr_cs, self.data.build.i_tf_inside_cs, self.data.build.dr_tf_inboard, self.data.build.dr_cs_tf_gap, - pfcoil_variables.i_pf_conductor, - pfcoil_variables.j_cs_flat_top_end, - pfcoil_variables.j_cs_pulse_start, - pfcoil_variables.c_pf_coil_turn_peak_input, - pfcoil_variables.n_pf_coils_in_group, - pfcoil_variables.f_dr_dz_cs_turn, - pfcoil_variables.radius_cs_turn_corners, - pfcoil_variables.f_a_cs_turn_steel, + self.data.pf_coil.i_pf_conductor, + self.data.pf_coil.j_cs_flat_top_end, + self.data.pf_coil.j_cs_pulse_start, + self.data.pf_coil.c_pf_coil_turn_peak_input, + self.data.pf_coil.n_pf_coils_in_group, + self.data.pf_coil.f_dr_dz_cs_turn, + self.data.pf_coil.radius_cs_turn_corners, + self.data.pf_coil.f_a_cs_turn_steel, tfcoil_variables.eyoung_steel, tfcoil_variables.poisson_steel, tfcoil_variables.eyoung_cond_axial, diff --git a/process/models/tfcoil/superconducting.py b/process/models/tfcoil/superconducting.py index 7b2df817a..0ea80e8d4 100644 --- a/process/models/tfcoil/superconducting.py +++ b/process/models/tfcoil/superconducting.py @@ -13,7 +13,6 @@ from process.data_structure import ( divertor_variables, global_variables, - pfcoil_variables, physics_variables, rebco_variables, superconducting_tf_coil_variables, @@ -129,19 +128,19 @@ def output(self): float(self.data.build.r_tf_inboard_in), self.data.build.dr_bore, self.data.build.z_tf_inside_half, - pfcoil_variables.f_z_cs_tf_internal, + self.data.pf_coil.f_z_cs_tf_internal, self.data.build.dr_cs, self.data.build.i_tf_inside_cs, self.data.build.dr_tf_inboard, self.data.build.dr_cs_tf_gap, - pfcoil_variables.i_pf_conductor, - pfcoil_variables.j_cs_flat_top_end, - pfcoil_variables.j_cs_pulse_start, - pfcoil_variables.c_pf_coil_turn_peak_input, - pfcoil_variables.n_pf_coils_in_group, - pfcoil_variables.f_dr_dz_cs_turn, - pfcoil_variables.radius_cs_turn_corners, - pfcoil_variables.f_a_cs_turn_steel, + self.data.pf_coil.i_pf_conductor, + self.data.pf_coil.j_cs_flat_top_end, + self.data.pf_coil.j_cs_pulse_start, + self.data.pf_coil.c_pf_coil_turn_peak_input, + self.data.pf_coil.n_pf_coils_in_group, + self.data.pf_coil.f_dr_dz_cs_turn, + self.data.pf_coil.radius_cs_turn_corners, + self.data.pf_coil.f_a_cs_turn_steel, tfcoil_variables.eyoung_steel, tfcoil_variables.poisson_steel, tfcoil_variables.eyoung_cond_axial, @@ -1774,19 +1773,19 @@ def run(self, output: bool = False): float(self.data.build.r_tf_inboard_in), self.data.build.dr_bore, self.data.build.z_tf_inside_half, - pfcoil_variables.f_z_cs_tf_internal, + self.data.pf_coil.f_z_cs_tf_internal, self.data.build.dr_cs, self.data.build.i_tf_inside_cs, self.data.build.dr_tf_inboard, self.data.build.dr_cs_tf_gap, - pfcoil_variables.i_pf_conductor, - pfcoil_variables.j_cs_flat_top_end, - pfcoil_variables.j_cs_pulse_start, - pfcoil_variables.c_pf_coil_turn_peak_input, - pfcoil_variables.n_pf_coils_in_group, - pfcoil_variables.f_dr_dz_cs_turn, - pfcoil_variables.radius_cs_turn_corners, - pfcoil_variables.f_a_cs_turn_steel, + self.data.pf_coil.i_pf_conductor, + self.data.pf_coil.j_cs_flat_top_end, + self.data.pf_coil.j_cs_pulse_start, + self.data.pf_coil.c_pf_coil_turn_peak_input, + self.data.pf_coil.n_pf_coils_in_group, + self.data.pf_coil.f_dr_dz_cs_turn, + self.data.pf_coil.radius_cs_turn_corners, + self.data.pf_coil.f_a_cs_turn_steel, tfcoil_variables.eyoung_steel, tfcoil_variables.poisson_steel, tfcoil_variables.eyoung_cond_axial, @@ -3104,19 +3103,19 @@ def run(self, output: bool = False): float(self.data.build.r_tf_inboard_in), self.data.build.dr_bore, self.data.build.z_tf_inside_half, - pfcoil_variables.f_z_cs_tf_internal, + self.data.pf_coil.f_z_cs_tf_internal, self.data.build.dr_cs, self.data.build.i_tf_inside_cs, self.data.build.dr_tf_inboard, self.data.build.dr_cs_tf_gap, - pfcoil_variables.i_pf_conductor, - pfcoil_variables.j_cs_flat_top_end, - pfcoil_variables.j_cs_pulse_start, - pfcoil_variables.c_pf_coil_turn_peak_input, - pfcoil_variables.n_pf_coils_in_group, - pfcoil_variables.f_dr_dz_cs_turn, - pfcoil_variables.radius_cs_turn_corners, - pfcoil_variables.f_a_cs_turn_steel, + self.data.pf_coil.i_pf_conductor, + self.data.pf_coil.j_cs_flat_top_end, + self.data.pf_coil.j_cs_pulse_start, + self.data.pf_coil.c_pf_coil_turn_peak_input, + self.data.pf_coil.n_pf_coils_in_group, + self.data.pf_coil.f_dr_dz_cs_turn, + self.data.pf_coil.radius_cs_turn_corners, + self.data.pf_coil.f_a_cs_turn_steel, tfcoil_variables.eyoung_steel, tfcoil_variables.poisson_steel, tfcoil_variables.eyoung_cond_axial, diff --git a/tests/unit/models/stellarator/test_stellarator.py b/tests/unit/models/stellarator/test_stellarator.py index c6e9af300..15e45beba 100644 --- a/tests/unit/models/stellarator/test_stellarator.py +++ b/tests/unit/models/stellarator/test_stellarator.py @@ -6,8 +6,6 @@ from process.data_structure import ( impurity_radiation_module, physics_variables, - stellarator_configuration, - stellarator_variables, tfcoil_variables, ) from process.models.stellarator.build import st_build @@ -149,20 +147,24 @@ def test_stgeom(stgeomparam, monkeypatch, stellarator): ) monkeypatch.setattr( - stellarator_configuration, + stellarator.data.stellarator_config, "stella_config_vol_plasma", stgeomparam.stella_config_vol_plasma, ) monkeypatch.setattr( - stellarator_configuration, + stellarator.data.stellarator_config, "stella_config_plasma_surface", stgeomparam.stella_config_plasma_surface, ) - monkeypatch.setattr(stellarator_variables, "f_st_rmajor", stgeomparam.f_st_rmajor) + monkeypatch.setattr( + stellarator.data.stellarator, "f_st_rmajor", stgeomparam.f_st_rmajor + ) - monkeypatch.setattr(stellarator_variables, "f_st_rminor", stgeomparam.f_st_rminor) + monkeypatch.setattr( + stellarator.data.stellarator, "f_st_rminor", stgeomparam.f_st_rminor + ) stellarator.st_geom() @@ -634,25 +636,25 @@ def test_stbild(stbildparam, monkeypatch, stellarator): ) monkeypatch.setattr( - stellarator_configuration, + stellarator.data.stellarator_config, "stella_config_derivative_min_lcfs_coils_dist", stbildparam.stella_config_derivative_min_lcfs_coils_dist, ) monkeypatch.setattr( - stellarator_configuration, + stellarator.data.stellarator_config, "stella_config_rminor_ref", stbildparam.stella_config_rminor_ref, ) monkeypatch.setattr( - stellarator_configuration, + stellarator.data.stellarator_config, "stella_config_min_plasma_coil_distance", stbildparam.stella_config_min_plasma_coil_distance, ) monkeypatch.setattr( - stellarator_variables, + stellarator.data.stellarator, "r_coil_minor", ( stbildparam.stella_config_min_plasma_coil_distance @@ -661,13 +663,19 @@ def test_stbild(stbildparam, monkeypatch, stellarator): * stbildparam.f_st_rminor, ) - monkeypatch.setattr(stellarator_variables, "f_st_rmajor", stbildparam.f_st_rmajor) + monkeypatch.setattr( + stellarator.data.stellarator, "f_st_rmajor", stbildparam.f_st_rmajor + ) - monkeypatch.setattr(stellarator_variables, "f_st_aspect", stbildparam.f_st_aspect) + monkeypatch.setattr( + stellarator.data.stellarator, "f_st_aspect", stbildparam.f_st_aspect + ) - monkeypatch.setattr(stellarator_variables, "f_st_rminor", stbildparam.f_st_rminor) + monkeypatch.setattr( + stellarator.data.stellarator, "f_st_rminor", stbildparam.f_st_rminor + ) - monkeypatch.setattr(stellarator_variables, "f_coil_shape", 1.0) + monkeypatch.setattr(stellarator.data.stellarator, "f_coil_shape", 1.0) st_build(stellarator, False, stellarator.data) @@ -873,25 +881,25 @@ def test_ststrc(ststrcparam, monkeypatch, stellarator): ) monkeypatch.setattr( - stellarator_configuration, + stellarator.data.stellarator_config, "stella_config_coilsurface", ststrcparam.stella_config_coilsurface, ) monkeypatch.setattr( - stellarator_configuration, + stellarator.data.stellarator_config, "stella_config_coillength", ststrcparam.stella_config_coillength, ) monkeypatch.setattr( - stellarator_configuration, + stellarator.data.stellarator_config, "stella_config_coil_rminor", 1.0, ) monkeypatch.setattr( - stellarator_variables, + stellarator.data.stellarator, "r_coil_minor", ststrcparam.f_st_rmajor, ) @@ -908,11 +916,15 @@ def test_ststrc(ststrcparam, monkeypatch, stellarator): 1, ) - monkeypatch.setattr(stellarator_variables, "f_st_n_coils", ststrcparam.f_st_n_coils) + monkeypatch.setattr( + stellarator.data.stellarator, "f_st_n_coils", ststrcparam.f_st_n_coils + ) - monkeypatch.setattr(stellarator_variables, "f_st_rmajor", ststrcparam.f_st_rmajor) + monkeypatch.setattr( + stellarator.data.stellarator, "f_st_rmajor", ststrcparam.f_st_rmajor + ) - monkeypatch.setattr(stellarator_variables, "f_st_b", ststrcparam.f_st_b) + monkeypatch.setattr(stellarator.data.stellarator, "f_st_b", ststrcparam.f_st_b) stellarator.st_strc(False) @@ -947,9 +959,9 @@ def test_j_max_protect_am2(): ) == pytest.approx(54919989.379449144) -def test_bmax_from_awp(monkeypatch): - monkeypatch.setattr(stellarator_configuration, "stella_config_a1", 0.688) - monkeypatch.setattr(stellarator_configuration, "stella_config_a2", 0.025) +def test_bmax_from_awp(stellarator, monkeypatch): + monkeypatch.setattr(stellarator.data.stellarator_config, "stella_config_a1", 0.688) + monkeypatch.setattr(stellarator.data.stellarator_config, "stella_config_a2", 0.025) assert bmax_from_awp( wp_width_radial=0.11792792792792792, @@ -957,6 +969,7 @@ def test_bmax_from_awp(monkeypatch): n_tf_coils=50, r_coil_major=22.237837837837837, r_coil_minor=4.7171171171171169, + data=stellarator.data, ) == pytest.approx(39.193416982177489) @@ -2103,13 +2116,13 @@ def test_st_calc_eff_chi(stcalceffchiparam, monkeypatch, stellarator): ) monkeypatch.setattr( - stellarator_configuration, + stellarator.data.stellarator_config, "stella_config_rminor_ref", stcalceffchiparam.stella_config_rminor_ref, ) monkeypatch.setattr( - stellarator_variables, "f_st_rmajor", stcalceffchiparam.f_st_rmajor + stellarator.data.stellarator, "f_st_rmajor", stcalceffchiparam.f_st_rmajor ) output = stellarator.neoclassics.st_calc_eff_chi() diff --git a/tests/unit/models/test_availability.py b/tests/unit/models/test_availability.py index 066417747..d530c719e 100644 --- a/tests/unit/models/test_availability.py +++ b/tests/unit/models/test_availability.py @@ -4,7 +4,6 @@ from process.core.init import init_all_module_vars from process.data_structure import divertor_variables as dv -from process.data_structure import ife_variables as ifev from process.data_structure import physics_variables as pv from process.data_structure import tfcoil_variables as tfv @@ -33,7 +32,7 @@ def test_avail_0(monkeypatch, availability, life_fw_fpy, ibkt_life, bktlife_exp_ """ # Mock module vars - monkeypatch.setattr(ifev, "ife", 0) + monkeypatch.setattr(availability.data.ife, "ife", 0) monkeypatch.setattr(pv, "p_fusion_total_mw", 4.0e3) monkeypatch.setattr(availability.data.fwbs, "life_fw_fpy", life_fw_fpy) monkeypatch.setattr(availability.data.costs, "ibkt_life", ibkt_life) @@ -553,7 +552,7 @@ def mock_calc_u_unplanned_vacuum(*args, **kwargs): # Mock module variables monkeypatch.setattr(availability.data.times, "t_plant_pulse_burn", 5.0) monkeypatch.setattr(availability.data.times, "t_plant_pulse_total", 50.0) - monkeypatch.setattr(ifev, "ife", 0) + monkeypatch.setattr(availability.data.ife, "ife", 0) monkeypatch.setattr(pv, "itart", 1) monkeypatch.setattr(availability.data.fwbs, "life_blkt_fpy", 5.0) monkeypatch.setattr(availability.data.costs, "life_div_fpy", 10.0) diff --git a/tests/unit/models/test_buildings.py b/tests/unit/models/test_buildings.py index 36ec198e5..44988a3fd 100644 --- a/tests/unit/models/test_buildings.py +++ b/tests/unit/models/test_buildings.py @@ -4,7 +4,6 @@ from process.data_structure import ( divertor_variables, - pfcoil_variables, physics_variables, tfcoil_variables, ) @@ -741,7 +740,9 @@ def test_bldgs_sizes(buildings, bldgssizesparam, monkeypatch): monkeypatch.setattr(tfcoil_variables, "n_tf_coils", bldgssizesparam.n_tf_coils) monkeypatch.setattr(tfcoil_variables, "i_tf_sup", bldgssizesparam.i_tf_sup) monkeypatch.setattr( - pfcoil_variables, "r_pf_coil_outer_max", bldgssizesparam.r_pf_coil_outer_max + buildings.data.pf_coil, + "r_pf_coil_outer_max", + bldgssizesparam.r_pf_coil_outer_max, ) monkeypatch.setattr(buildings.data.costs, "life_plant", bldgssizesparam.life_plant) monkeypatch.setattr(buildings.data.costs, "cplife", bldgssizesparam.cplife) diff --git a/tests/unit/models/test_costs_1990.py b/tests/unit/models/test_costs_1990.py index 5b21e4de4..8036eeffa 100644 --- a/tests/unit/models/test_costs_1990.py +++ b/tests/unit/models/test_costs_1990.py @@ -8,9 +8,7 @@ from process import data_structure from process.data_structure import ( divertor_variables, - ife_variables, pf_power_variables, - pfcoil_variables, physics_variables, tfcoil_variables, ) @@ -1094,13 +1092,13 @@ def test_acc2211(acc2211param, monkeypatch, costs): monkeypatch.setattr(costs.data.costs, "lsa", acc2211param.lsa) - monkeypatch.setattr(ife_variables, "fwmatm", acc2211param.fwmatm) + monkeypatch.setattr(costs.data.ife, "fwmatm", acc2211param.fwmatm) - monkeypatch.setattr(ife_variables, "uccarb", acc2211param.uccarb) + monkeypatch.setattr(costs.data.ife, "uccarb", acc2211param.uccarb) - monkeypatch.setattr(ife_variables, "ife", acc2211param.ife) + monkeypatch.setattr(costs.data.ife, "ife", acc2211param.ife) - monkeypatch.setattr(ife_variables, "ucconc", acc2211param.ucconc) + monkeypatch.setattr(costs.data.ife, "ucconc", acc2211param.ucconc) monkeypatch.setattr(costs.data.costs, "c22", acc2211param.c22) @@ -1359,17 +1357,17 @@ def test_acc2212(acc2212param, monkeypatch, costs): monkeypatch.setattr(costs.data.fwbs, "wtbllipb", acc2212param.wtbllipb) - monkeypatch.setattr(ife_variables, "ucflib", acc2212param.ucflib) + monkeypatch.setattr(costs.data.ife, "ucflib", acc2212param.ucflib) - monkeypatch.setattr(ife_variables, "blmatm", acc2212param.blmatm) + monkeypatch.setattr(costs.data.ife, "blmatm", acc2212param.blmatm) - monkeypatch.setattr(ife_variables, "ife", acc2212param.ife) + monkeypatch.setattr(costs.data.ife, "ife", acc2212param.ife) - monkeypatch.setattr(ife_variables, "ucconc", acc2212param.ucconc) + monkeypatch.setattr(costs.data.ife, "ucconc", acc2212param.ucconc) - monkeypatch.setattr(ife_variables, "mflibe", acc2212param.mflibe) + monkeypatch.setattr(costs.data.ife, "mflibe", acc2212param.mflibe) - monkeypatch.setattr(ife_variables, "uccarb", acc2212param.uccarb) + monkeypatch.setattr(costs.data.ife, "uccarb", acc2212param.uccarb) monkeypatch.setattr(costs.data.costs, "c22", acc2212param.c22) @@ -1538,13 +1536,13 @@ def test_acc2213(acc2213param, monkeypatch, costs): monkeypatch.setattr(costs.data.fwbs, "whtshld", acc2213param.whtshld) - monkeypatch.setattr(ife_variables, "shmatm", acc2213param.shmatm) + monkeypatch.setattr(costs.data.ife, "shmatm", acc2213param.shmatm) - monkeypatch.setattr(ife_variables, "uccarb", acc2213param.uccarb) + monkeypatch.setattr(costs.data.ife, "uccarb", acc2213param.uccarb) - monkeypatch.setattr(ife_variables, "ife", acc2213param.ife) + monkeypatch.setattr(costs.data.ife, "ife", acc2213param.ife) - monkeypatch.setattr(ife_variables, "ucconc", acc2213param.ucconc) + monkeypatch.setattr(costs.data.ife, "ucconc", acc2213param.ucconc) monkeypatch.setattr(costs.data.costs, "c22", acc2213param.c22) @@ -1698,7 +1696,7 @@ def test_acc2215(acc2215param, monkeypatch, costs): divertor_variables, "a_div_surface_total", acc2215param.a_div_surface_total ) - monkeypatch.setattr(ife_variables, "ife", acc2215param.ife) + monkeypatch.setattr(costs.data.ife, "ife", acc2215param.ife) monkeypatch.setattr(costs.data.costs, "c22", acc2215param.c22) @@ -2718,58 +2716,60 @@ def test_acc2222(acc2222param, monkeypatch, costs): monkeypatch.setattr(costs.data.costs, "fkind", acc2222param.fkind) monkeypatch.setattr( - pfcoil_variables, "j_pf_coil_wp_peak", acc2222param.j_pf_coil_wp_peak + costs.data.pf_coil, "j_pf_coil_wp_peak", acc2222param.j_pf_coil_wp_peak ) monkeypatch.setattr( costs.data.costs, "supercond_cost_model", acc2222param.supercond_cost_model ) - monkeypatch.setattr(pfcoil_variables, "j_crit_str_cs", acc2222param.j_crit_str_cs) + monkeypatch.setattr(costs.data.pf_coil, "j_crit_str_cs", acc2222param.j_crit_str_cs) - monkeypatch.setattr(pfcoil_variables, "j_crit_str_pf", acc2222param.j_crit_str_pf) + monkeypatch.setattr(costs.data.pf_coil, "j_crit_str_pf", acc2222param.j_crit_str_pf) - monkeypatch.setattr(pfcoil_variables, "i_pf_conductor", acc2222param.i_pf_conductor) + monkeypatch.setattr( + costs.data.pf_coil, "i_pf_conductor", acc2222param.i_pf_conductor + ) - monkeypatch.setattr(pfcoil_variables, "f_a_cs_void", acc2222param.f_a_cs_void) + monkeypatch.setattr(costs.data.pf_coil, "f_a_cs_void", acc2222param.f_a_cs_void) - monkeypatch.setattr(pfcoil_variables, "n_cs_pf_coils", acc2222param.n_cs_pf_coils) + monkeypatch.setattr(costs.data.pf_coil, "n_cs_pf_coils", acc2222param.n_cs_pf_coils) monkeypatch.setattr( - pfcoil_variables, "n_pf_coil_turns", acc2222param.n_pf_coil_turns + costs.data.pf_coil, "n_pf_coil_turns", acc2222param.n_pf_coil_turns ) monkeypatch.setattr( - pfcoil_variables, "i_pf_superconductor", acc2222param.i_pf_superconductor + costs.data.pf_coil, "i_pf_superconductor", acc2222param.i_pf_superconductor ) monkeypatch.setattr( - pfcoil_variables, + costs.data.pf_coil, "m_pf_coil_structure_total", acc2222param.m_pf_coil_structure_total, ) monkeypatch.setattr( - pfcoil_variables, "c_pf_cs_coils_peak_ma", acc2222param.c_pf_cs_coils_peak_ma + costs.data.pf_coil, "c_pf_cs_coils_peak_ma", acc2222param.c_pf_cs_coils_peak_ma ) monkeypatch.setattr( - pfcoil_variables, "r_pf_coil_middle", acc2222param.r_pf_coil_middle + costs.data.pf_coil, "r_pf_coil_middle", acc2222param.r_pf_coil_middle ) monkeypatch.setattr( - pfcoil_variables, "i_cs_superconductor", acc2222param.i_cs_superconductor + costs.data.pf_coil, "i_cs_superconductor", acc2222param.i_cs_superconductor ) - monkeypatch.setattr(pfcoil_variables, "fcupfsu", acc2222param.fcupfsu) + monkeypatch.setattr(costs.data.pf_coil, "fcupfsu", acc2222param.fcupfsu) - monkeypatch.setattr(pfcoil_variables, "fcuohsu", acc2222param.fcuohsu) + monkeypatch.setattr(costs.data.pf_coil, "fcuohsu", acc2222param.fcuohsu) monkeypatch.setattr( - pfcoil_variables, "f_a_pf_coil_void", acc2222param.f_a_pf_coil_void + costs.data.pf_coil, "f_a_pf_coil_void", acc2222param.f_a_pf_coil_void ) - monkeypatch.setattr(pfcoil_variables, "awpoh", acc2222param.awpoh) + monkeypatch.setattr(costs.data.pf_coil, "awpoh", acc2222param.awpoh) monkeypatch.setattr(costs.data.structure, "fncmass", acc2222param.fncmass) @@ -3061,29 +3061,29 @@ def test_acc223(acc223param, monkeypatch, costs): costs.data.current_drive, "p_beam_injected_mw", acc223param.p_beam_injected_mw ) - monkeypatch.setattr(ife_variables, "dcdrv2", acc223param.dcdrv2) + monkeypatch.setattr(costs.data.ife, "dcdrv2", acc223param.dcdrv2) - monkeypatch.setattr(ife_variables, "mcdriv", acc223param.mcdriv) + monkeypatch.setattr(costs.data.ife, "mcdriv", acc223param.mcdriv) - monkeypatch.setattr(ife_variables, "cdriv2", acc223param.cdriv2) + monkeypatch.setattr(costs.data.ife, "cdriv2", acc223param.cdriv2) - monkeypatch.setattr(ife_variables, "dcdrv0", acc223param.dcdrv0) + monkeypatch.setattr(costs.data.ife, "dcdrv0", acc223param.dcdrv0) - monkeypatch.setattr(ife_variables, "edrive", acc223param.edrive) + monkeypatch.setattr(costs.data.ife, "edrive", acc223param.edrive) - monkeypatch.setattr(ife_variables, "etadrv", acc223param.etadrv) + monkeypatch.setattr(costs.data.ife, "etadrv", acc223param.etadrv) - monkeypatch.setattr(ife_variables, "ifedrv", acc223param.ifedrv) + monkeypatch.setattr(costs.data.ife, "ifedrv", acc223param.ifedrv) - monkeypatch.setattr(ife_variables, "ife", acc223param.ife) + monkeypatch.setattr(costs.data.ife, "ife", acc223param.ife) - monkeypatch.setattr(ife_variables, "dcdrv1", acc223param.dcdrv1) + monkeypatch.setattr(costs.data.ife, "dcdrv1", acc223param.dcdrv1) - monkeypatch.setattr(ife_variables, "cdriv1", acc223param.cdriv1) + monkeypatch.setattr(costs.data.ife, "cdriv1", acc223param.cdriv1) - monkeypatch.setattr(ife_variables, "cdriv3", acc223param.cdriv3) + monkeypatch.setattr(costs.data.ife, "cdriv3", acc223param.cdriv3) - monkeypatch.setattr(ife_variables, "cdriv0", acc223param.cdriv0) + monkeypatch.setattr(costs.data.ife, "cdriv0", acc223param.cdriv0) monkeypatch.setattr(costs.data.costs, "c22", acc223param.c22) @@ -4116,11 +4116,11 @@ def test_acc2262_rut(acc2262param, monkeypatch, costs): monkeypatch.setattr(costs.data.costs, "fkind", acc2262param.fkind) - monkeypatch.setattr(ife_variables, "tfacmw", acc2262param.tfacmw) + monkeypatch.setattr(costs.data.ife, "tfacmw", acc2262param.tfacmw) - monkeypatch.setattr(ife_variables, "ife", acc2262param.ife) + monkeypatch.setattr(costs.data.ife, "ife", acc2262param.ife) - monkeypatch.setattr(ife_variables, "tdspmw", acc2262param.tdspmw) + monkeypatch.setattr(costs.data.ife, "tdspmw", acc2262param.tdspmw) monkeypatch.setattr( costs.data.heat_transport, @@ -4456,15 +4456,15 @@ def test_acc2272_rut(acc2272param, monkeypatch, costs): monkeypatch.setattr(costs.data.costs, "fkind", acc2272param.fkind) - monkeypatch.setattr(ife_variables, "fburn", acc2272param.fburn) + monkeypatch.setattr(costs.data.ife, "fburn", acc2272param.fburn) - monkeypatch.setattr(ife_variables, "reprat", acc2272param.reprat) + monkeypatch.setattr(costs.data.ife, "reprat", acc2272param.reprat) - monkeypatch.setattr(ife_variables, "ife", acc2272param.ife) + monkeypatch.setattr(costs.data.ife, "ife", acc2272param.ife) - monkeypatch.setattr(ife_variables, "gain", acc2272param.gain) + monkeypatch.setattr(costs.data.ife, "gain", acc2272param.gain) - monkeypatch.setattr(ife_variables, "edrive", acc2272param.edrive) + monkeypatch.setattr(costs.data.ife, "edrive", acc2272param.edrive) monkeypatch.setattr(physics_variables, "wtgpd", acc2272param.wtgpd) @@ -5910,11 +5910,11 @@ def test_coelc(coelcparam, monkeypatch, costs): monkeypatch.setattr(costs.data.fwbs, "life_blkt", coelcparam.life_blkt) - monkeypatch.setattr(ife_variables, "uctarg", coelcparam.uctarg) + monkeypatch.setattr(costs.data.ife, "uctarg", coelcparam.uctarg) - monkeypatch.setattr(ife_variables, "ife", coelcparam.ife) + monkeypatch.setattr(costs.data.ife, "ife", coelcparam.ife) - monkeypatch.setattr(ife_variables, "reprat", coelcparam.reprat) + monkeypatch.setattr(costs.data.ife, "reprat", coelcparam.reprat) monkeypatch.setattr( costs.data.heat_transport, diff --git a/tests/unit/models/test_costs_2015.py b/tests/unit/models/test_costs_2015.py index b0701a051..e5dc1d2b4 100644 --- a/tests/unit/models/test_costs_2015.py +++ b/tests/unit/models/test_costs_2015.py @@ -7,7 +7,6 @@ from process.data_structure import ( pf_power_variables, - pfcoil_variables, physics_variables, tfcoil_variables, ) @@ -2268,7 +2267,7 @@ def test_calc_building_costs(calcbuildingcostsparam, monkeypatch, costs2015): ) monkeypatch.setattr( - pfcoil_variables, + costs2015.data.pf_coil, "r_pf_coil_outer_max", calcbuildingcostsparam.r_pf_coil_outer_max, ) @@ -15941,7 +15940,7 @@ def test_calc_remaining_subsystems(calcremainingsubsystemsparam, monkeypatch, co ) monkeypatch.setattr( - pfcoil_variables, "itr_sum", calcremainingsubsystemsparam.itr_sum + costs2015.data.pf_coil, "itr_sum", calcremainingsubsystemsparam.itr_sum ) monkeypatch.setattr( diff --git a/tests/unit/models/test_cryostat.py b/tests/unit/models/test_cryostat.py index 61b34f460..43d5edd4b 100644 --- a/tests/unit/models/test_cryostat.py +++ b/tests/unit/models/test_cryostat.py @@ -3,10 +3,6 @@ import numpy as np import pytest -from process.data_structure import ( - pfcoil_variables, -) - @pytest.fixture def cryostat(process_models): @@ -187,10 +183,14 @@ def test_external_cryo_geometry(externalcryogeometryparam, monkeypatch, cryostat ) monkeypatch.setattr(cryostat.data.fwbs, "dewmkg", externalcryogeometryparam.dewmkg) monkeypatch.setattr( - pfcoil_variables, "r_pf_coil_outer", externalcryogeometryparam.r_pf_coil_outer + cryostat.data.pf_coil, + "r_pf_coil_outer", + externalcryogeometryparam.r_pf_coil_outer, ) monkeypatch.setattr( - pfcoil_variables, "z_pf_coil_upper", externalcryogeometryparam.z_pf_coil_upper + cryostat.data.pf_coil, + "z_pf_coil_upper", + externalcryogeometryparam.z_pf_coil_upper, ) monkeypatch.setattr( cryostat.data.buildings, diff --git a/tests/unit/models/test_ife.py b/tests/unit/models/test_ife.py index 64c2e5bf6..1802a4cb4 100644 --- a/tests/unit/models/test_ife.py +++ b/tests/unit/models/test_ife.py @@ -5,10 +5,7 @@ import numpy as np import pytest -from process.data_structure import ( - ife_variables, - physics_variables, -) +from process.data_structure import physics_variables @pytest.fixture @@ -29,13 +26,13 @@ def test_ifetgt(monkeypatch, ife): """ # Mock module variables # Repetition Rate (Hz) - monkeypatch.setattr(ife_variables, "reprat", 4.0) + monkeypatch.setattr(ife.data.ife, "reprat", 4.0) # IFE target factory power at 6 Hz repetition rate - monkeypatch.setattr(ife_variables, "ptargf", 2.0) - monkeypatch.setattr(ife_variables, "tfacmw", 0.0) + monkeypatch.setattr(ife.data.ife, "ptargf", 2.0) + monkeypatch.setattr(ife.data.ife, "tfacmw", 0.0) ife.ifetgt() - assert ife_variables.tfacmw == pytest.approx(1.506, abs=0.001) + assert ife.data.ife.tfacmw == pytest.approx(1.506, abs=0.001) class SombldParam(NamedTuple): @@ -612,48 +609,48 @@ def test_sombld(sombldparam, monkeypatch, ife): ("shmatf", sombldparam.shmatf), ("v3matf", sombldparam.v3matf), ): - monkeypatch.setattr(ife_variables, name, val) + monkeypatch.setattr(ife.data.ife, name, val) ife.sombld() assert ife.data.first_wall.a_fw_total == pytest.approx( sombldparam.expected_a_fw_total ) - assert ife_variables.r1 == pytest.approx(sombldparam.expected_r1) - assert ife_variables.r2 == pytest.approx(sombldparam.expected_r2) - assert ife_variables.r3 == pytest.approx(sombldparam.expected_r3) - assert ife_variables.r4 == pytest.approx(sombldparam.expected_r4) - assert ife_variables.r5 == pytest.approx(sombldparam.expected_r5) - assert ife_variables.r6 == pytest.approx(sombldparam.expected_r6) - assert ife_variables.r7 == pytest.approx(sombldparam.expected_r7) - assert ife_variables.zl7 == pytest.approx(sombldparam.expected_zl7) - assert ife_variables.zl6 == pytest.approx(sombldparam.expected_zl6) - assert ife_variables.zl5 == pytest.approx(sombldparam.expected_zl5) - assert ife_variables.zl4 == pytest.approx(sombldparam.expected_zl4) - assert ife_variables.zl3 == pytest.approx(sombldparam.expected_zl3) - assert ife_variables.zl2 == pytest.approx(sombldparam.expected_zl2) - assert ife_variables.zl1 == pytest.approx(sombldparam.expected_zl1) - assert ife_variables.zu1 == pytest.approx(sombldparam.expected_zu1) - assert ife_variables.zu2 == pytest.approx(sombldparam.expected_zu2) - assert ife_variables.zu3 == pytest.approx(sombldparam.expected_zu3) - assert ife_variables.zu4 == pytest.approx(sombldparam.expected_zu4) - assert ife_variables.zu5 == pytest.approx(sombldparam.expected_zu5) - assert ife_variables.zu6 == pytest.approx(sombldparam.expected_zu6) - assert ife_variables.zu7 == pytest.approx(sombldparam.expected_zu7) - assert ife_variables.fwmatv == pytest.approx(sombldparam.expected_fwmatv) - assert ife_variables.v1matv == pytest.approx(sombldparam.expected_v1matv) - assert ife_variables.blmatv == pytest.approx(sombldparam.expected_blmatv) - assert ife_variables.v2matv == pytest.approx(sombldparam.expected_v2matv) - assert ife_variables.shmatv == pytest.approx(sombldparam.expected_shmatv) - assert ife_variables.v3matv == pytest.approx(sombldparam.expected_v3matv) - assert ife_variables.chmatv == pytest.approx(sombldparam.expected_chmatv) - assert ife_variables.chvol == pytest.approx(sombldparam.expected_chvol) - assert ife_variables.fwvol == pytest.approx(sombldparam.expected_fwvol) - assert ife_variables.v1vol == pytest.approx(sombldparam.expected_v1vol) - assert ife_variables.blvol == pytest.approx(sombldparam.expected_blvol) - assert ife_variables.v2vol == pytest.approx(sombldparam.expected_v2vol) - assert ife_variables.shvol == pytest.approx(sombldparam.expected_shvol) - assert ife_variables.v3vol == pytest.approx(sombldparam.expected_v3vol) + assert ife.data.ife.r1 == pytest.approx(sombldparam.expected_r1) + assert ife.data.ife.r2 == pytest.approx(sombldparam.expected_r2) + assert ife.data.ife.r3 == pytest.approx(sombldparam.expected_r3) + assert ife.data.ife.r4 == pytest.approx(sombldparam.expected_r4) + assert ife.data.ife.r5 == pytest.approx(sombldparam.expected_r5) + assert ife.data.ife.r6 == pytest.approx(sombldparam.expected_r6) + assert ife.data.ife.r7 == pytest.approx(sombldparam.expected_r7) + assert ife.data.ife.zl7 == pytest.approx(sombldparam.expected_zl7) + assert ife.data.ife.zl6 == pytest.approx(sombldparam.expected_zl6) + assert ife.data.ife.zl5 == pytest.approx(sombldparam.expected_zl5) + assert ife.data.ife.zl4 == pytest.approx(sombldparam.expected_zl4) + assert ife.data.ife.zl3 == pytest.approx(sombldparam.expected_zl3) + assert ife.data.ife.zl2 == pytest.approx(sombldparam.expected_zl2) + assert ife.data.ife.zl1 == pytest.approx(sombldparam.expected_zl1) + assert ife.data.ife.zu1 == pytest.approx(sombldparam.expected_zu1) + assert ife.data.ife.zu2 == pytest.approx(sombldparam.expected_zu2) + assert ife.data.ife.zu3 == pytest.approx(sombldparam.expected_zu3) + assert ife.data.ife.zu4 == pytest.approx(sombldparam.expected_zu4) + assert ife.data.ife.zu5 == pytest.approx(sombldparam.expected_zu5) + assert ife.data.ife.zu6 == pytest.approx(sombldparam.expected_zu6) + assert ife.data.ife.zu7 == pytest.approx(sombldparam.expected_zu7) + assert ife.data.ife.fwmatv == pytest.approx(sombldparam.expected_fwmatv) + assert ife.data.ife.v1matv == pytest.approx(sombldparam.expected_v1matv) + assert ife.data.ife.blmatv == pytest.approx(sombldparam.expected_blmatv) + assert ife.data.ife.v2matv == pytest.approx(sombldparam.expected_v2matv) + assert ife.data.ife.shmatv == pytest.approx(sombldparam.expected_shmatv) + assert ife.data.ife.v3matv == pytest.approx(sombldparam.expected_v3matv) + assert ife.data.ife.chmatv == pytest.approx(sombldparam.expected_chmatv) + assert ife.data.ife.chvol == pytest.approx(sombldparam.expected_chvol) + assert ife.data.ife.fwvol == pytest.approx(sombldparam.expected_fwvol) + assert ife.data.ife.v1vol == pytest.approx(sombldparam.expected_v1vol) + assert ife.data.ife.blvol == pytest.approx(sombldparam.expected_blvol) + assert ife.data.ife.v2vol == pytest.approx(sombldparam.expected_v2vol) + assert ife.data.ife.shvol == pytest.approx(sombldparam.expected_shvol) + assert ife.data.ife.v3vol == pytest.approx(sombldparam.expected_v3vol) class DriverParam(NamedTuple): @@ -1186,41 +1183,41 @@ def test_hylbld(hylbldparam, monkeypatch, ife): ("v3matv", hylbldparam.v3matv), ("chmatv", hylbldparam.chmatv), ): - monkeypatch.setattr(ife_variables, name, val) + monkeypatch.setattr(ife.data.ife, name, val) ife.hylbld() assert ife.data.first_wall.a_fw_total == pytest.approx( hylbldparam.expected_a_fw_total ) - assert ife_variables.r1 == pytest.approx(hylbldparam.expected_r1) - assert ife_variables.r2 == pytest.approx(hylbldparam.expected_r2) - assert ife_variables.r3 == pytest.approx(hylbldparam.expected_r3) - assert ife_variables.r4 == pytest.approx(hylbldparam.expected_r4) - assert ife_variables.r5 == pytest.approx(hylbldparam.expected_r5) - assert ife_variables.r6 == pytest.approx(hylbldparam.expected_r6) - assert ife_variables.r7 == pytest.approx(hylbldparam.expected_r7) - assert ife_variables.zl7 == pytest.approx(hylbldparam.expected_zl7) - assert ife_variables.zl6 == pytest.approx(hylbldparam.expected_zl6) - assert ife_variables.zl5 == pytest.approx(hylbldparam.expected_zl5) - assert ife_variables.zl4 == pytest.approx(hylbldparam.expected_zl4) - assert ife_variables.zl3 == pytest.approx(hylbldparam.expected_zl3) - assert ife_variables.zl2 == pytest.approx(hylbldparam.expected_zl2) - assert ife_variables.zl1 == pytest.approx(hylbldparam.expected_zl1) - assert ife_variables.zu1 == pytest.approx(hylbldparam.expected_zu1) - assert ife_variables.zu2 == pytest.approx(hylbldparam.expected_zu2) - assert ife_variables.zu3 == pytest.approx(hylbldparam.expected_zu3) - assert ife_variables.zu4 == pytest.approx(hylbldparam.expected_zu4) - assert ife_variables.zu5 == pytest.approx(hylbldparam.expected_zu5) - assert ife_variables.zu6 == pytest.approx(hylbldparam.expected_zu6) - assert ife_variables.zu7 == pytest.approx(hylbldparam.expected_zu7) - assert ife_variables.fwmatv == pytest.approx(hylbldparam.expected_fwmatv) - assert ife_variables.v1matv == pytest.approx(hylbldparam.expected_v1matv) - assert ife_variables.blmatv == pytest.approx(hylbldparam.expected_blmatv) - assert ife_variables.v2matv == pytest.approx(hylbldparam.expected_v2matv) - assert ife_variables.shmatv == pytest.approx(hylbldparam.expected_shmatv) - assert ife_variables.v3matv == pytest.approx(hylbldparam.expected_v3matv) - assert ife_variables.chmatv == pytest.approx(hylbldparam.expected_chmatv) + assert ife.data.ife.r1 == pytest.approx(hylbldparam.expected_r1) + assert ife.data.ife.r2 == pytest.approx(hylbldparam.expected_r2) + assert ife.data.ife.r3 == pytest.approx(hylbldparam.expected_r3) + assert ife.data.ife.r4 == pytest.approx(hylbldparam.expected_r4) + assert ife.data.ife.r5 == pytest.approx(hylbldparam.expected_r5) + assert ife.data.ife.r6 == pytest.approx(hylbldparam.expected_r6) + assert ife.data.ife.r7 == pytest.approx(hylbldparam.expected_r7) + assert ife.data.ife.zl7 == pytest.approx(hylbldparam.expected_zl7) + assert ife.data.ife.zl6 == pytest.approx(hylbldparam.expected_zl6) + assert ife.data.ife.zl5 == pytest.approx(hylbldparam.expected_zl5) + assert ife.data.ife.zl4 == pytest.approx(hylbldparam.expected_zl4) + assert ife.data.ife.zl3 == pytest.approx(hylbldparam.expected_zl3) + assert ife.data.ife.zl2 == pytest.approx(hylbldparam.expected_zl2) + assert ife.data.ife.zl1 == pytest.approx(hylbldparam.expected_zl1) + assert ife.data.ife.zu1 == pytest.approx(hylbldparam.expected_zu1) + assert ife.data.ife.zu2 == pytest.approx(hylbldparam.expected_zu2) + assert ife.data.ife.zu3 == pytest.approx(hylbldparam.expected_zu3) + assert ife.data.ife.zu4 == pytest.approx(hylbldparam.expected_zu4) + assert ife.data.ife.zu5 == pytest.approx(hylbldparam.expected_zu5) + assert ife.data.ife.zu6 == pytest.approx(hylbldparam.expected_zu6) + assert ife.data.ife.zu7 == pytest.approx(hylbldparam.expected_zu7) + assert ife.data.ife.fwmatv == pytest.approx(hylbldparam.expected_fwmatv) + assert ife.data.ife.v1matv == pytest.approx(hylbldparam.expected_v1matv) + assert ife.data.ife.blmatv == pytest.approx(hylbldparam.expected_blmatv) + assert ife.data.ife.v2matv == pytest.approx(hylbldparam.expected_v2matv) + assert ife.data.ife.shmatv == pytest.approx(hylbldparam.expected_shmatv) + assert ife.data.ife.v3matv == pytest.approx(hylbldparam.expected_v3matv) + assert ife.data.ife.chmatv == pytest.approx(hylbldparam.expected_chmatv) class IondrvParam(NamedTuple): @@ -1594,23 +1591,23 @@ def test_ifefbs(ifefbsparam, monkeypatch, ife): monkeypatch.setattr(ife.data.fwbs, "m_blkt_lithium", ifefbsparam.m_blkt_lithium) monkeypatch.setattr(ife.data.fwbs, "life_blkt_fpy", ifefbsparam.life_blkt_fpy) monkeypatch.setattr(ife.data.fwbs, "life_fw_fpy", ifefbsparam.life_fw_fpy) - monkeypatch.setattr(ife_variables, "chmatm", ifefbsparam.chmatm) - monkeypatch.setattr(ife_variables, "chmatv", ifefbsparam.chmatv) - monkeypatch.setattr(ife_variables, "fwmatm", ifefbsparam.fwmatm) - monkeypatch.setattr(ife_variables, "fwmatv", ifefbsparam.fwmatv) - monkeypatch.setattr(ife_variables, "v1matm", ifefbsparam.v1matm) - monkeypatch.setattr(ife_variables, "v1matv", ifefbsparam.v1matv) - monkeypatch.setattr(ife_variables, "blmatm", ifefbsparam.blmatm) - monkeypatch.setattr(ife_variables, "blmatv", ifefbsparam.blmatv) - monkeypatch.setattr(ife_variables, "v2matm", ifefbsparam.v2matm) - monkeypatch.setattr(ife_variables, "v2matv", ifefbsparam.v2matv) - monkeypatch.setattr(ife_variables, "shmatm", ifefbsparam.shmatm) - monkeypatch.setattr(ife_variables, "shmatv", ifefbsparam.shmatv) - monkeypatch.setattr(ife_variables, "v3matm", ifefbsparam.v3matm) - monkeypatch.setattr(ife_variables, "v3matv", ifefbsparam.v3matv) - monkeypatch.setattr(ife_variables, "mflibe", ifefbsparam.mflibe) - monkeypatch.setattr(ife_variables, "fbreed", ifefbsparam.fbreed) - monkeypatch.setattr(ife_variables, "ifetyp", ifefbsparam.ifetyp) + monkeypatch.setattr(ife.data.ife, "chmatm", ifefbsparam.chmatm) + monkeypatch.setattr(ife.data.ife, "chmatv", ifefbsparam.chmatv) + monkeypatch.setattr(ife.data.ife, "fwmatm", ifefbsparam.fwmatm) + monkeypatch.setattr(ife.data.ife, "fwmatv", ifefbsparam.fwmatv) + monkeypatch.setattr(ife.data.ife, "v1matm", ifefbsparam.v1matm) + monkeypatch.setattr(ife.data.ife, "v1matv", ifefbsparam.v1matv) + monkeypatch.setattr(ife.data.ife, "blmatm", ifefbsparam.blmatm) + monkeypatch.setattr(ife.data.ife, "blmatv", ifefbsparam.blmatv) + monkeypatch.setattr(ife.data.ife, "v2matm", ifefbsparam.v2matm) + monkeypatch.setattr(ife.data.ife, "v2matv", ifefbsparam.v2matv) + monkeypatch.setattr(ife.data.ife, "shmatm", ifefbsparam.shmatm) + monkeypatch.setattr(ife.data.ife, "shmatv", ifefbsparam.shmatv) + monkeypatch.setattr(ife.data.ife, "v3matm", ifefbsparam.v3matm) + monkeypatch.setattr(ife.data.ife, "v3matv", ifefbsparam.v3matv) + monkeypatch.setattr(ife.data.ife, "mflibe", ifefbsparam.mflibe) + monkeypatch.setattr(ife.data.ife, "fbreed", ifefbsparam.fbreed) + monkeypatch.setattr(ife.data.ife, "ifetyp", ifefbsparam.ifetyp) monkeypatch.setattr( physics_variables, "pflux_fw_neutron_mw", ifefbsparam.pflux_fw_neutron_mw ) @@ -1624,12 +1621,12 @@ def test_ifefbs(ifefbsparam, monkeypatch, ife): ifefbsparam.expected_life_blkt_fpy ) assert ife.data.fwbs.life_fw_fpy == pytest.approx(ifefbsparam.expected_life_fw_fpy) - assert ife_variables.fwmatm == pytest.approx(ifefbsparam.expected_fwmatm) - assert ife_variables.v1matm == pytest.approx(ifefbsparam.expected_v1matm) - assert ife_variables.blmatm == pytest.approx(ifefbsparam.expected_blmatm) - assert ife_variables.v2matm == pytest.approx(ifefbsparam.expected_v2matm) - assert ife_variables.shmatm == pytest.approx(ifefbsparam.expected_shmatm) - assert ife_variables.mflibe == pytest.approx(ifefbsparam.expected_mflibe) + assert ife.data.ife.fwmatm == pytest.approx(ifefbsparam.expected_fwmatm) + assert ife.data.ife.v1matm == pytest.approx(ifefbsparam.expected_v1matm) + assert ife.data.ife.blmatm == pytest.approx(ifefbsparam.expected_blmatm) + assert ife.data.ife.v2matm == pytest.approx(ifefbsparam.expected_v2matm) + assert ife.data.ife.shmatm == pytest.approx(ifefbsparam.expected_shmatm) + assert ife.data.ife.mflibe == pytest.approx(ifefbsparam.expected_mflibe) class GenbldParam(NamedTuple): @@ -2077,41 +2074,41 @@ def test_genbld(genbldparam, monkeypatch, ife): ("v3matv", genbldparam.v3matv), ("chmatv", genbldparam.chmatv), ): - monkeypatch.setattr(ife_variables, name, val) + monkeypatch.setattr(ife.data.ife, name, val) ife.genbld() assert ife.data.first_wall.a_fw_total == pytest.approx( genbldparam.expected_a_fw_total ) - assert ife_variables.r1 == pytest.approx(genbldparam.expected_r1) - assert ife_variables.r2 == pytest.approx(genbldparam.expected_r2) - assert ife_variables.r3 == pytest.approx(genbldparam.expected_r3) - assert ife_variables.r4 == pytest.approx(genbldparam.expected_r4) - assert ife_variables.r5 == pytest.approx(genbldparam.expected_r5) - assert ife_variables.r6 == pytest.approx(genbldparam.expected_r6) - assert ife_variables.r7 == pytest.approx(genbldparam.expected_r7) - assert ife_variables.zl7 == pytest.approx(genbldparam.expected_zl7) - assert ife_variables.zl6 == pytest.approx(genbldparam.expected_zl6) - assert ife_variables.zl5 == pytest.approx(genbldparam.expected_zl5) - assert ife_variables.zl4 == pytest.approx(genbldparam.expected_zl4) - assert ife_variables.zl3 == pytest.approx(genbldparam.expected_zl3) - assert ife_variables.zl2 == pytest.approx(genbldparam.expected_zl2) - assert ife_variables.zl1 == pytest.approx(genbldparam.expected_zl1) - assert ife_variables.zu1 == pytest.approx(genbldparam.expected_zu1) - assert ife_variables.zu2 == pytest.approx(genbldparam.expected_zu2) - assert ife_variables.zu3 == pytest.approx(genbldparam.expected_zu3) - assert ife_variables.zu4 == pytest.approx(genbldparam.expected_zu4) - assert ife_variables.zu5 == pytest.approx(genbldparam.expected_zu5) - assert ife_variables.zu6 == pytest.approx(genbldparam.expected_zu6) - assert ife_variables.zu7 == pytest.approx(genbldparam.expected_zu7) - assert ife_variables.fwmatv == pytest.approx(genbldparam.expected_fwmatv) - assert ife_variables.v1matv == pytest.approx(genbldparam.expected_v1matv) - assert ife_variables.blmatv == pytest.approx(genbldparam.expected_blmatv) - assert ife_variables.v2matv == pytest.approx(genbldparam.expected_v2matv) - assert ife_variables.shmatv == pytest.approx(genbldparam.expected_shmatv) - assert ife_variables.v3matv == pytest.approx(genbldparam.expected_v3matv) - assert ife_variables.chmatv == pytest.approx(genbldparam.expected_chmatv) + assert ife.data.ife.r1 == pytest.approx(genbldparam.expected_r1) + assert ife.data.ife.r2 == pytest.approx(genbldparam.expected_r2) + assert ife.data.ife.r3 == pytest.approx(genbldparam.expected_r3) + assert ife.data.ife.r4 == pytest.approx(genbldparam.expected_r4) + assert ife.data.ife.r5 == pytest.approx(genbldparam.expected_r5) + assert ife.data.ife.r6 == pytest.approx(genbldparam.expected_r6) + assert ife.data.ife.r7 == pytest.approx(genbldparam.expected_r7) + assert ife.data.ife.zl7 == pytest.approx(genbldparam.expected_zl7) + assert ife.data.ife.zl6 == pytest.approx(genbldparam.expected_zl6) + assert ife.data.ife.zl5 == pytest.approx(genbldparam.expected_zl5) + assert ife.data.ife.zl4 == pytest.approx(genbldparam.expected_zl4) + assert ife.data.ife.zl3 == pytest.approx(genbldparam.expected_zl3) + assert ife.data.ife.zl2 == pytest.approx(genbldparam.expected_zl2) + assert ife.data.ife.zl1 == pytest.approx(genbldparam.expected_zl1) + assert ife.data.ife.zu1 == pytest.approx(genbldparam.expected_zu1) + assert ife.data.ife.zu2 == pytest.approx(genbldparam.expected_zu2) + assert ife.data.ife.zu3 == pytest.approx(genbldparam.expected_zu3) + assert ife.data.ife.zu4 == pytest.approx(genbldparam.expected_zu4) + assert ife.data.ife.zu5 == pytest.approx(genbldparam.expected_zu5) + assert ife.data.ife.zu6 == pytest.approx(genbldparam.expected_zu6) + assert ife.data.ife.zu7 == pytest.approx(genbldparam.expected_zu7) + assert ife.data.ife.fwmatv == pytest.approx(genbldparam.expected_fwmatv) + assert ife.data.ife.v1matv == pytest.approx(genbldparam.expected_v1matv) + assert ife.data.ife.blmatv == pytest.approx(genbldparam.expected_blmatv) + assert ife.data.ife.v2matv == pytest.approx(genbldparam.expected_v2matv) + assert ife.data.ife.shmatv == pytest.approx(genbldparam.expected_shmatv) + assert ife.data.ife.v3matv == pytest.approx(genbldparam.expected_v3matv) + assert ife.data.ife.chmatv == pytest.approx(genbldparam.expected_chmatv) class Ifepw1Param(NamedTuple): @@ -2235,10 +2232,10 @@ def test_ifepw1(ifepw1param, monkeypatch, ife): ifepw1param.p_cryo_plant_electric_mw, ) monkeypatch.setattr(ife.data.heat_transport, "helpow", ifepw1param.helpow) - monkeypatch.setattr(ife_variables, "pdrive", ifepw1param.pdrive) - monkeypatch.setattr(ife_variables, "ifetyp", ifepw1param.ifetyp) - monkeypatch.setattr(ife_variables, "etadrv", ifepw1param.etadrv) - monkeypatch.setattr(ife_variables, "pifecr", ifepw1param.pifecr) + monkeypatch.setattr(ife.data.ife, "pdrive", ifepw1param.pdrive) + monkeypatch.setattr(ife.data.ife, "ifetyp", ifepw1param.ifetyp) + monkeypatch.setattr(ife.data.ife, "etadrv", ifepw1param.etadrv) + monkeypatch.setattr(ife.data.ife, "pifecr", ifepw1param.pifecr) monkeypatch.setattr( physics_variables, "p_fusion_total_mw", ifepw1param.p_fusion_total_mw ) @@ -2703,7 +2700,7 @@ def test_bld2019(bld2019param, monkeypatch, ife): ("v3matv", bld2019param.v3matv), ("chmatv", bld2019param.chmatv), ): - monkeypatch.setattr(ife_variables, name, val) + monkeypatch.setattr(ife.data.ife, name, val) ife.bld2019() @@ -2714,34 +2711,34 @@ def test_bld2019(bld2019param, monkeypatch, ife): assert ife.data.fwbs.f_p_blkt_multiplication == pytest.approx( bld2019param.expected_emult ) - assert ife_variables.r1 == pytest.approx(bld2019param.expected_r1) - assert ife_variables.r2 == pytest.approx(bld2019param.expected_r2) - assert ife_variables.r3 == pytest.approx(bld2019param.expected_r3) - assert ife_variables.bldr == pytest.approx(bld2019param.expected_bldr) - assert ife_variables.r4 == pytest.approx(bld2019param.expected_r4) - assert ife_variables.r5 == pytest.approx(bld2019param.expected_r5) - assert ife_variables.r6 == pytest.approx(bld2019param.expected_r6) - assert ife_variables.r7 == pytest.approx(bld2019param.expected_r7) - assert ife_variables.zl7 == pytest.approx(bld2019param.expected_zl7) - assert ife_variables.zl6 == pytest.approx(bld2019param.expected_zl6) - assert ife_variables.zl5 == pytest.approx(bld2019param.expected_zl5) - assert ife_variables.zl4 == pytest.approx(bld2019param.expected_zl4) - assert ife_variables.zl3 == pytest.approx(bld2019param.expected_zl3) - assert ife_variables.zl2 == pytest.approx(bld2019param.expected_zl2) - assert ife_variables.zl1 == pytest.approx(bld2019param.expected_zl1) - assert ife_variables.zu1 == pytest.approx(bld2019param.expected_zu1) - assert ife_variables.zu2 == pytest.approx(bld2019param.expected_zu2) - assert ife_variables.zu3 == pytest.approx(bld2019param.expected_zu3) - assert ife_variables.zu4 == pytest.approx(bld2019param.expected_zu4) - assert ife_variables.zu5 == pytest.approx(bld2019param.expected_zu5) - assert ife_variables.zu6 == pytest.approx(bld2019param.expected_zu6) - assert ife_variables.v3dzu == pytest.approx(bld2019param.expected_v3dzu) - assert ife_variables.zu7 == pytest.approx(bld2019param.expected_zu7) - assert ife_variables.blmatv == pytest.approx(bld2019param.expected_blmatv) - assert ife_variables.v2matv == pytest.approx(bld2019param.expected_v2matv) - assert ife_variables.shmatv == pytest.approx(bld2019param.expected_shmatv) - assert ife_variables.v3matv == pytest.approx(bld2019param.expected_v3matv) - assert ife_variables.chmatv == pytest.approx(bld2019param.expected_chmatv) + assert ife.data.ife.r1 == pytest.approx(bld2019param.expected_r1) + assert ife.data.ife.r2 == pytest.approx(bld2019param.expected_r2) + assert ife.data.ife.r3 == pytest.approx(bld2019param.expected_r3) + assert ife.data.ife.bldr == pytest.approx(bld2019param.expected_bldr) + assert ife.data.ife.r4 == pytest.approx(bld2019param.expected_r4) + assert ife.data.ife.r5 == pytest.approx(bld2019param.expected_r5) + assert ife.data.ife.r6 == pytest.approx(bld2019param.expected_r6) + assert ife.data.ife.r7 == pytest.approx(bld2019param.expected_r7) + assert ife.data.ife.zl7 == pytest.approx(bld2019param.expected_zl7) + assert ife.data.ife.zl6 == pytest.approx(bld2019param.expected_zl6) + assert ife.data.ife.zl5 == pytest.approx(bld2019param.expected_zl5) + assert ife.data.ife.zl4 == pytest.approx(bld2019param.expected_zl4) + assert ife.data.ife.zl3 == pytest.approx(bld2019param.expected_zl3) + assert ife.data.ife.zl2 == pytest.approx(bld2019param.expected_zl2) + assert ife.data.ife.zl1 == pytest.approx(bld2019param.expected_zl1) + assert ife.data.ife.zu1 == pytest.approx(bld2019param.expected_zu1) + assert ife.data.ife.zu2 == pytest.approx(bld2019param.expected_zu2) + assert ife.data.ife.zu3 == pytest.approx(bld2019param.expected_zu3) + assert ife.data.ife.zu4 == pytest.approx(bld2019param.expected_zu4) + assert ife.data.ife.zu5 == pytest.approx(bld2019param.expected_zu5) + assert ife.data.ife.zu6 == pytest.approx(bld2019param.expected_zu6) + assert ife.data.ife.v3dzu == pytest.approx(bld2019param.expected_v3dzu) + assert ife.data.ife.zu7 == pytest.approx(bld2019param.expected_zu7) + assert ife.data.ife.blmatv == pytest.approx(bld2019param.expected_blmatv) + assert ife.data.ife.v2matv == pytest.approx(bld2019param.expected_v2matv) + assert ife.data.ife.shmatv == pytest.approx(bld2019param.expected_shmatv) + assert ife.data.ife.v3matv == pytest.approx(bld2019param.expected_v3matv) + assert ife.data.ife.chmatv == pytest.approx(bld2019param.expected_chmatv) class IfeacpParam(NamedTuple): @@ -2842,12 +2839,12 @@ def test_ifeacp(ifeacpparam, monkeypatch, ife): ifeacpparam.p_plant_electric_base_total_mw, ) monkeypatch.setattr(ife.data.heat_transport, "tlvpmw", ifeacpparam.tlvpmw) - monkeypatch.setattr(ife_variables, "tdspmw", ifeacpparam.tdspmw) - monkeypatch.setattr(ife_variables, "tfacmw", ifeacpparam.tfacmw) - monkeypatch.setattr(ife_variables, "htpmw_ife", ifeacpparam.htpmw_ife) - monkeypatch.setattr(ife_variables, "reprat", ifeacpparam.reprat) - monkeypatch.setattr(ife_variables, "lipmw", ifeacpparam.lipmw) - monkeypatch.setattr(ife_variables, "ifetyp", ifeacpparam.ifetyp) + monkeypatch.setattr(ife.data.ife, "tdspmw", ifeacpparam.tdspmw) + monkeypatch.setattr(ife.data.ife, "tfacmw", ifeacpparam.tfacmw) + monkeypatch.setattr(ife.data.ife, "htpmw_ife", ifeacpparam.htpmw_ife) + monkeypatch.setattr(ife.data.ife, "reprat", ifeacpparam.reprat) + monkeypatch.setattr(ife.data.ife, "lipmw", ifeacpparam.lipmw) + monkeypatch.setattr(ife.data.ife, "ifetyp", ifeacpparam.ifetyp) ife.ifeacp() @@ -2996,12 +2993,12 @@ def test_ifebdg(ifebdgparam, monkeypatch, ife): monkeypatch.setattr(ife.data.buildings, "volnucb", ifebdgparam.volnucb) monkeypatch.setattr(ife.data.fwbs, "whtshld", ifebdgparam.whtshld) monkeypatch.setattr(ife.data.heat_transport, "helpow", ifebdgparam.helpow) - monkeypatch.setattr(ife_variables, "zl7", ifebdgparam.zl7) - monkeypatch.setattr(ife_variables, "zu7", ifebdgparam.zu7) - monkeypatch.setattr(ife_variables, "r7", ifebdgparam.r7) - monkeypatch.setattr(ife_variables, "zl6", ifebdgparam.zl6) - monkeypatch.setattr(ife_variables, "zu6", ifebdgparam.zu6) - monkeypatch.setattr(ife_variables, "r6", ifebdgparam.r6) + monkeypatch.setattr(ife.data.ife, "zl7", ifebdgparam.zl7) + monkeypatch.setattr(ife.data.ife, "zu7", ifebdgparam.zu7) + monkeypatch.setattr(ife.data.ife, "r7", ifebdgparam.r7) + monkeypatch.setattr(ife.data.ife, "zl6", ifebdgparam.zl6) + monkeypatch.setattr(ife.data.ife, "zu6", ifebdgparam.zu6) + monkeypatch.setattr(ife.data.ife, "r6", ifebdgparam.r6) ife.ifebdg() @@ -3184,12 +3181,12 @@ def test_ifepw2(ifepw2param, monkeypatch, ife): "n_primary_heat_exchangers", ifepw2param.n_primary_heat_exchangers, ) - monkeypatch.setattr(ife_variables, "tdspmw", ifepw2param.tdspmw) - monkeypatch.setattr(ife_variables, "tfacmw", ifepw2param.tfacmw) - monkeypatch.setattr(ife_variables, "htpmw_ife", ifepw2param.htpmw_ife) - monkeypatch.setattr(ife_variables, "fauxbop", ifepw2param.fauxbop) - monkeypatch.setattr(ife_variables, "ifetyp", ifepw2param.ifetyp) - monkeypatch.setattr(ife_variables, "taufall", ifepw2param.taufall) + monkeypatch.setattr(ife.data.ife, "tdspmw", ifepw2param.tdspmw) + monkeypatch.setattr(ife.data.ife, "tfacmw", ifepw2param.tfacmw) + monkeypatch.setattr(ife.data.ife, "htpmw_ife", ifepw2param.htpmw_ife) + monkeypatch.setattr(ife.data.ife, "fauxbop", ifepw2param.fauxbop) + monkeypatch.setattr(ife.data.ife, "ifetyp", ifepw2param.ifetyp) + monkeypatch.setattr(ife.data.ife, "taufall", ifepw2param.taufall) ife.ifepw2() diff --git a/tests/unit/models/test_pfcoil.py b/tests/unit/models/test_pfcoil.py index 18e1a23d3..5ca0ba00e 100644 --- a/tests/unit/models/test_pfcoil.py +++ b/tests/unit/models/test_pfcoil.py @@ -1,7 +1,7 @@ """Unit tests for pfcoil Vaguely realistic mocked values are taken from baseline2019 output, init values -in the pfcoil_variables module, or where necessary, guesses. +in the pfcoil.data.pf_coil module, or where necessary, guesses. Many of these subroutines are long and perform multiple gets/sets on many "use" dependencies. As a result, many mocks are required to isolate the tests. There @@ -16,9 +16,10 @@ from numpy.testing import assert_array_almost_equal from process.core import constants -from process.data_structure import pfcoil_variables, superconducting_tf_coil_variables from process.data_structure import physics_variables as pv +from process.data_structure import superconducting_tf_coil_variables from process.data_structure import tfcoil_variables as tfv +from process.data_structure.pfcoil_variables import N_PF_COILS_IN_GROUP_MAX from process.models.pfcoil import ( PFCoil, calculate_b_field_at_point, @@ -58,9 +59,9 @@ def test_init_pfcoil(pfcoil): :type pfcoil: process.pfcoil.PFCoil """ # Test a selection of module variables - assert pfcoil_variables.ssq0 == pytest.approx(0.0) - assert pfcoil_variables.cslimit == 0 - assert pfcoil_variables.nef == 0 + assert pfcoil.data.pf_coil.ssq0 == pytest.approx(0.0) + assert pfcoil.data.pf_coil.cslimit == 0 + assert pfcoil.data.pf_coil.nef == 0 def test_rsid(pfcoil): @@ -1054,7 +1055,7 @@ def test_waveform(monkeypatch, pfcoil): baseline 2018 IN.DAT. waveform() alters both c_pf_cs_coils_peak_ma and f_c_pf_cs_peak_time_array - in the pfcoil_variables module, so these are asserted on. + in the pfcoil.data.pf_coil module, so these are asserted on. :param monkeypatch: mocking fixture :type monkeypatch: _pytest.monkeypatch.MonkeyPatch @@ -1062,13 +1063,13 @@ def test_waveform(monkeypatch, pfcoil): :type pfcoil: process.pfcoil.PFCoil """ ngc2 = 22 - monkeypatch.setattr(pfcoil_variables, "c_pf_cs_coils_peak_ma", np.zeros(ngc2)) - monkeypatch.setattr(pfcoil_variables, "n_cs_pf_coils", 7) + monkeypatch.setattr(pfcoil.data.pf_coil, "c_pf_cs_coils_peak_ma", np.zeros(ngc2)) + monkeypatch.setattr(pfcoil.data.pf_coil, "n_cs_pf_coils", 7) monkeypatch.setattr( - pfcoil_variables, "f_c_pf_cs_peak_time_array", np.zeros((ngc2, 6), order="F") + pfcoil.data.pf_coil, "f_c_pf_cs_peak_time_array", np.zeros((ngc2, 6), order="F") ) monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "c_pf_cs_coil_pulse_start_ma", np.array([ 0.067422231232391661, @@ -1096,7 +1097,7 @@ def test_waveform(monkeypatch, pfcoil): ]), ) monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "c_pf_cs_coil_flat_top_ma", np.array([ 0.067422231232391661, @@ -1124,7 +1125,7 @@ def test_waveform(monkeypatch, pfcoil): ]), ) monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "c_pf_cs_coil_pulse_end_ma", np.array([ 14.742063826112622, @@ -1205,8 +1206,8 @@ def test_waveform(monkeypatch, pfcoil): pfcoil.waveform() - assert_array_almost_equal(pfcoil_variables.c_pf_cs_coils_peak_ma, ric_exp) - assert_array_almost_equal(pfcoil_variables.f_c_pf_cs_peak_time_array, waves_exp) + assert_array_almost_equal(pfcoil.data.pf_coil.c_pf_cs_coils_peak_ma, ric_exp) + assert_array_almost_equal(pfcoil.data.pf_coil.f_c_pf_cs_peak_time_array, waves_exp) def test_vsec(pfcoil, monkeypatch): @@ -1223,12 +1224,12 @@ def test_vsec(pfcoil, monkeypatch): :type monkeypatch: _pytest.monkeypatch.MonkeyPatch """ monkeypatch.setattr(pfcoil.data.build, "iohcl", 1) - monkeypatch.setattr(pfcoil_variables, "vs_pf_coils_total_ramp", 0.0) - monkeypatch.setattr(pfcoil_variables, "vs_cs_pf_total_burn", 0.0) - monkeypatch.setattr(pfcoil_variables, "n_cs_pf_coils", 7) - monkeypatch.setattr(pfcoil_variables, "vs_cs_burn", 0.0) + monkeypatch.setattr(pfcoil.data.pf_coil, "vs_pf_coils_total_ramp", 0.0) + monkeypatch.setattr(pfcoil.data.pf_coil, "vs_cs_pf_total_burn", 0.0) + monkeypatch.setattr(pfcoil.data.pf_coil, "n_cs_pf_coils", 7) + monkeypatch.setattr(pfcoil.data.pf_coil, "vs_cs_burn", 0.0) monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "c_pf_coil_turn", np.array( [ @@ -1412,15 +1413,15 @@ def test_vsec(pfcoil, monkeypatch): order="F", ).squeeze(), ) - monkeypatch.setattr(pfcoil_variables, "vs_pf_coils_total_burn", 0.0) - monkeypatch.setattr(pfcoil_variables, "vs_cs_ramp", 0.0) - monkeypatch.setattr(pfcoil_variables, "vs_pf_coils_total_pulse", 0.0) - monkeypatch.setattr(pfcoil_variables, "vs_cs_total_pulse", 0.0) - monkeypatch.setattr(pfcoil_variables, "vs_cs_pf_total_ramp", 0.0) - monkeypatch.setattr(pfcoil_variables, "vs_cs_pf_total_pulse", 0.0) - monkeypatch.setattr(pfcoil_variables, "n_pf_cs_plasma_circuits", 8) + monkeypatch.setattr(pfcoil.data.pf_coil, "vs_pf_coils_total_burn", 0.0) + monkeypatch.setattr(pfcoil.data.pf_coil, "vs_cs_ramp", 0.0) + monkeypatch.setattr(pfcoil.data.pf_coil, "vs_pf_coils_total_pulse", 0.0) + monkeypatch.setattr(pfcoil.data.pf_coil, "vs_cs_total_pulse", 0.0) + monkeypatch.setattr(pfcoil.data.pf_coil, "vs_cs_pf_total_ramp", 0.0) + monkeypatch.setattr(pfcoil.data.pf_coil, "vs_cs_pf_total_pulse", 0.0) + monkeypatch.setattr(pfcoil.data.pf_coil, "n_pf_cs_plasma_circuits", 8) monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "ind_pf_cs_plasma_mutual", np.array( [ @@ -1962,8 +1963,8 @@ def test_vsec(pfcoil, monkeypatch): pfcoil.vsec() - assert_array_almost_equal(pfcoil_variables.vs_cs_pf_total_burn, vsbn_exp) - assert_array_almost_equal(pfcoil_variables.vs_cs_total_pulse, vsoh_exp) + assert_array_almost_equal(pfcoil.data.pf_coil.vs_cs_pf_total_burn, vsbn_exp) + assert_array_almost_equal(pfcoil.data.pf_coil.vs_cs_total_pulse, vsoh_exp) def test_hoop_stress(cs_coil, monkeypatch): @@ -1978,12 +1979,14 @@ def test_hoop_stress(cs_coil, monkeypatch): :param monkeypatch: mocking fixture :type monkeypatch: _pytest.monkeypatch.MonkeyPatch """ - monkeypatch.setattr(pfcoil_variables, "f_a_cs_turn_steel", 0.57874999999999999) - monkeypatch.setattr(pfcoil_variables, "b_cs_peak_pulse_start", 13.522197474024983) - monkeypatch.setattr(pfcoil_variables, "j_cs_pulse_start", 19311657.760000002) - monkeypatch.setattr(pfcoil_variables, "n_cs_pf_coils", 7) + monkeypatch.setattr(cs_coil.data.pf_coil, "f_a_cs_turn_steel", 0.57874999999999999) monkeypatch.setattr( - pfcoil_variables, + cs_coil.data.pf_coil, "b_cs_peak_pulse_start", 13.522197474024983 + ) + monkeypatch.setattr(cs_coil.data.pf_coil, "j_cs_pulse_start", 19311657.760000002) + monkeypatch.setattr(cs_coil.data.pf_coil, "n_cs_pf_coils", 7) + monkeypatch.setattr( + cs_coil.data.pf_coil, "r_pf_coil_outer", np.array([ 6.8520884119768697, @@ -2011,7 +2014,7 @@ def test_hoop_stress(cs_coil, monkeypatch): ]), ) monkeypatch.setattr( - pfcoil_variables, + cs_coil.data.pf_coil, "r_pf_coil_inner", np.array([ 5.6944236847973242, @@ -2452,81 +2455,85 @@ def test_pfcoil(monkeypatch, pfcoil): monkeypatch.setattr(pfcoil.data.build, "r_tf_outboard_mid", 1.66e1) monkeypatch.setattr(pfcoil.data.build, "dr_bore", 2.15) monkeypatch.setattr(pfcoil.data.fwbs, "den_steel", 7.8e3) - monkeypatch.setattr(pfcoil_variables, "dr_pf_cs_middle_offset", 0.0) - monkeypatch.setattr(pfcoil_variables, "m_pf_coil_structure_total", 0.0) - monkeypatch.setattr(pfcoil_variables, "c_pf_cs_coil_flat_top_ma", np.full(22, 0.0)) - monkeypatch.setattr(pfcoil_variables, "n_cs_pf_coils", 0) - monkeypatch.setattr(pfcoil_variables, "r_pf_coil_outer_max", 0.0) - monkeypatch.setattr(pfcoil_variables, "f_j_cs_start_pulse_end_flat_top", 1.0) - monkeypatch.setattr(pfcoil_variables, "j_pf_coil_wp_peak", np.full(22, 1.1e7)) - monkeypatch.setattr(pfcoil_variables, "n_pf_coil_groups", 4) - monkeypatch.setattr(pfcoil_variables, "r_cs_middle", 3.0) + monkeypatch.setattr(pfcoil.data.pf_coil, "dr_pf_cs_middle_offset", 0.0) + monkeypatch.setattr(pfcoil.data.pf_coil, "m_pf_coil_structure_total", 0.0) monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "c_pf_cs_coil_flat_top_ma", np.full(22, 0.0) + ) + monkeypatch.setattr(pfcoil.data.pf_coil, "n_cs_pf_coils", 0) + monkeypatch.setattr(pfcoil.data.pf_coil, "r_pf_coil_outer_max", 0.0) + monkeypatch.setattr(pfcoil.data.pf_coil, "f_j_cs_start_pulse_end_flat_top", 1.0) + monkeypatch.setattr(pfcoil.data.pf_coil, "j_pf_coil_wp_peak", np.full(22, 1.1e7)) + monkeypatch.setattr(pfcoil.data.pf_coil, "n_pf_coil_groups", 4) + monkeypatch.setattr(pfcoil.data.pf_coil, "r_cs_middle", 3.0) + monkeypatch.setattr( + pfcoil.data.pf_coil, "n_pf_coils_in_group", np.array([1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0]), ) - monkeypatch.setattr(pfcoil_variables, "z_pf_coil_middle", np.full(22, 0.0)) + monkeypatch.setattr(pfcoil.data.pf_coil, "z_pf_coil_middle", np.full(22, 0.0)) monkeypatch.setattr( - pfcoil_variables, "c_pf_coil_turn_peak_input", np.full(22, 4.22e4) + pfcoil.data.pf_coil, "c_pf_coil_turn_peak_input", np.full(22, 4.22e4) ) - monkeypatch.setattr(pfcoil_variables, "pfcaseth", np.full(22, 0.0)) - monkeypatch.setattr(pfcoil_variables, "itr_sum", 0.0) - monkeypatch.setattr(pfcoil_variables, "sigpfcf", 6.66e-1) - monkeypatch.setattr(pfcoil_variables, "f_z_cs_tf_internal", 9.0e-1) + monkeypatch.setattr(pfcoil.data.pf_coil, "pfcaseth", np.full(22, 0.0)) + monkeypatch.setattr(pfcoil.data.pf_coil, "itr_sum", 0.0) + monkeypatch.setattr(pfcoil.data.pf_coil, "sigpfcf", 6.66e-1) + monkeypatch.setattr(pfcoil.data.pf_coil, "f_z_cs_tf_internal", 9.0e-1) monkeypatch.setattr( - pfcoil_variables, "i_pf_location", np.array([2, 2, 3, 3, 0, 0, 0, 0, 0, 0]) + pfcoil.data.pf_coil, "i_pf_location", np.array([2, 2, 3, 3, 0, 0, 0, 0, 0, 0]) ) - monkeypatch.setattr(pfcoil_variables, "m_pf_coil_structure", np.full(22, 0.0)) - monkeypatch.setattr(pfcoil_variables, "p_pf_coil_resistive_total_flat_top", 0.0) + monkeypatch.setattr(pfcoil.data.pf_coil, "m_pf_coil_structure", np.full(22, 0.0)) + monkeypatch.setattr(pfcoil.data.pf_coil, "p_pf_coil_resistive_total_flat_top", 0.0) monkeypatch.setattr( - pfcoil_variables, "c_pf_cs_coil_pulse_start_ma", np.full(22, 0.0) + pfcoil.data.pf_coil, "c_pf_cs_coil_pulse_start_ma", np.full(22, 0.0) ) - monkeypatch.setattr(pfcoil_variables, "dr_pf_tf_outboard_out_offset", 1.5) + monkeypatch.setattr(pfcoil.data.pf_coil, "dr_pf_tf_outboard_out_offset", 1.5) monkeypatch.setattr(superconducting_tf_coil_variables, "r_tf_outboard_out", 10.0) - monkeypatch.setattr(pfcoil_variables, "c_pf_cs_coils_peak_ma", np.full(22, 0.0)) - monkeypatch.setattr(pfcoil_variables, "f_j_cs_start_end_flat_top", 2.654e-1) - monkeypatch.setattr(pfcoil_variables, "rpf2", -1.825) - monkeypatch.setattr(pfcoil_variables, "n_cs_current_filaments", 7) - monkeypatch.setattr(pfcoil_variables, "b_pf_coil_peak", np.full(22, 0.0)) - monkeypatch.setattr(pfcoil_variables, "z_pf_coil_lower", np.full(22, 0.0)) - monkeypatch.setattr(pfcoil_variables, "m_pf_coil_conductor", np.full(22, 0.0)) - monkeypatch.setattr(pfcoil_variables, "f_a_pf_coil_void", np.full(22, 3.0e-1)) - monkeypatch.setattr(pfcoil_variables, "n_pf_coil_turns", np.full(22, 0.0)) - monkeypatch.setattr(pfcoil_variables, "c_pf_cs_coil_pulse_end_ma", np.full(22, 0.0)) - monkeypatch.setattr(pfcoil_variables, "r_pf_coil_middle", np.full(22, 0.0)) + monkeypatch.setattr(pfcoil.data.pf_coil, "c_pf_cs_coils_peak_ma", np.full(22, 0.0)) + monkeypatch.setattr(pfcoil.data.pf_coil, "f_j_cs_start_end_flat_top", 2.654e-1) + monkeypatch.setattr(pfcoil.data.pf_coil, "rpf2", -1.825) + monkeypatch.setattr(pfcoil.data.pf_coil, "n_cs_current_filaments", 7) + monkeypatch.setattr(pfcoil.data.pf_coil, "b_pf_coil_peak", np.full(22, 0.0)) + monkeypatch.setattr(pfcoil.data.pf_coil, "z_pf_coil_lower", np.full(22, 0.0)) + monkeypatch.setattr(pfcoil.data.pf_coil, "m_pf_coil_conductor", np.full(22, 0.0)) + monkeypatch.setattr(pfcoil.data.pf_coil, "f_a_pf_coil_void", np.full(22, 3.0e-1)) + monkeypatch.setattr(pfcoil.data.pf_coil, "n_pf_coil_turns", np.full(22, 0.0)) monkeypatch.setattr( - pfcoil_variables, "zref", [3.6, 1.2, 2.5, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] - ) - monkeypatch.setattr(pfcoil_variables, "m_pf_coil_max", 0.0) - monkeypatch.setattr(pfcoil_variables, "i_pf_conductor", 0) - monkeypatch.setattr(pfcoil_variables, "alfapf", 5.0e-10) - monkeypatch.setattr(pfcoil_variables, "n_pf_cs_plasma_circuits", 8) - monkeypatch.setattr(pfcoil_variables, "rho_pf_coil", 2.5e-8) - monkeypatch.setattr(pfcoil_variables, "c_pf_coil_turn", np.full([22, 6], 0.0)) + pfcoil.data.pf_coil, "c_pf_cs_coil_pulse_end_ma", np.full(22, 0.0) + ) + monkeypatch.setattr(pfcoil.data.pf_coil, "r_pf_coil_middle", np.full(22, 0.0)) monkeypatch.setattr( - pfcoil_variables, "f_c_pf_cs_peak_time_array", np.full([22, 6], 0.0) + pfcoil.data.pf_coil, "zref", [3.6, 1.2, 2.5, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] + ) + monkeypatch.setattr(pfcoil.data.pf_coil, "m_pf_coil_max", 0.0) + monkeypatch.setattr(pfcoil.data.pf_coil, "i_pf_conductor", 0) + monkeypatch.setattr(pfcoil.data.pf_coil, "alfapf", 5.0e-10) + monkeypatch.setattr(pfcoil.data.pf_coil, "n_pf_cs_plasma_circuits", 8) + monkeypatch.setattr(pfcoil.data.pf_coil, "rho_pf_coil", 2.5e-8) + monkeypatch.setattr(pfcoil.data.pf_coil, "c_pf_coil_turn", np.full([22, 6], 0.0)) + monkeypatch.setattr( + pfcoil.data.pf_coil, "f_c_pf_cs_peak_time_array", np.full([22, 6], 0.0) ) monkeypatch.setattr( - pfcoil_variables, "ind_pf_cs_plasma_mutual", np.full([22, 22], 0.0) - ) - monkeypatch.setattr(pfcoil_variables, "sigpfcalw", 5.0e2) - monkeypatch.setattr(pfcoil_variables, "j_cs_flat_top_end", 1.6932e7) - monkeypatch.setattr(pfcoil_variables, "z_pf_coil_upper", np.full(22, 0.0)) - monkeypatch.setattr(pfcoil_variables, "f_j_cs_start_end_flat_top", 2.654e-1) - monkeypatch.setattr(pfcoil_variables, "r_pf_coil_inner", np.full(22, 0.0)) - monkeypatch.setattr(pfcoil_variables, "r_pf_coil_outer", np.full(22, 0.0)) - monkeypatch.setattr(pfcoil_variables, "i_pf_superconductor", 3) - monkeypatch.setattr(pfcoil_variables, "i_cs_superconductor", 1) - monkeypatch.setattr(pfcoil_variables, "m_pf_coil_conductor_total", 0.0) - monkeypatch.setattr(pfcoil_variables, "fcupfsu", 6.900e-1) - monkeypatch.setattr(pfcoil_variables, "j_cs_pulse_start", 1.693e7) - monkeypatch.setattr(pfcoil_variables, "j_pf_wp_critical", np.full(22, 0.0)) - monkeypatch.setattr(pfcoil_variables, "i_r_pf_outside_tf_placement", 0) - monkeypatch.setattr(pfcoil_variables, "rref", np.full(10, 7.0)) - monkeypatch.setattr(pfcoil_variables, "i_pf_current", 1) - monkeypatch.setattr(pfcoil_variables, "ccl0_ma", np.full(10, 0.0)) - monkeypatch.setattr(pfcoil_variables, "ccls_ma", np.full(10, 0.0)) + pfcoil.data.pf_coil, "ind_pf_cs_plasma_mutual", np.full([22, 22], 0.0) + ) + monkeypatch.setattr(pfcoil.data.pf_coil, "sigpfcalw", 5.0e2) + monkeypatch.setattr(pfcoil.data.pf_coil, "j_cs_flat_top_end", 1.6932e7) + monkeypatch.setattr(pfcoil.data.pf_coil, "z_pf_coil_upper", np.full(22, 0.0)) + monkeypatch.setattr(pfcoil.data.pf_coil, "f_j_cs_start_end_flat_top", 2.654e-1) + monkeypatch.setattr(pfcoil.data.pf_coil, "r_pf_coil_inner", np.full(22, 0.0)) + monkeypatch.setattr(pfcoil.data.pf_coil, "r_pf_coil_outer", np.full(22, 0.0)) + monkeypatch.setattr(pfcoil.data.pf_coil, "i_pf_superconductor", 3) + monkeypatch.setattr(pfcoil.data.pf_coil, "i_cs_superconductor", 1) + monkeypatch.setattr(pfcoil.data.pf_coil, "m_pf_coil_conductor_total", 0.0) + monkeypatch.setattr(pfcoil.data.pf_coil, "fcupfsu", 6.900e-1) + monkeypatch.setattr(pfcoil.data.pf_coil, "j_cs_pulse_start", 1.693e7) + monkeypatch.setattr(pfcoil.data.pf_coil, "j_pf_wp_critical", np.full(22, 0.0)) + monkeypatch.setattr(pfcoil.data.pf_coil, "i_r_pf_outside_tf_placement", 0) + monkeypatch.setattr(pfcoil.data.pf_coil, "rref", np.full(10, 7.0)) + monkeypatch.setattr(pfcoil.data.pf_coil, "i_pf_current", 1) + monkeypatch.setattr(pfcoil.data.pf_coil, "ccl0_ma", np.full(10, 0.0)) + monkeypatch.setattr(pfcoil.data.pf_coil, "ccls_ma", np.full(10, 0.0)) monkeypatch.setattr(pv, "b_plasma_vertical_required", -6.51e-1) monkeypatch.setattr(pv, "kappa", 1.727) monkeypatch.setattr(pv, "ind_plasma_internal_norm", 1.693) @@ -2560,12 +2567,12 @@ def test_pfcoil(monkeypatch, pfcoil): ) monkeypatch.setattr(pfcoil.data.times, "t_plant_pulse_fusion_ramp", 1.0e1) monkeypatch.setattr(constants, "den_copper", 8.9e3) - monkeypatch.setattr(pfcoil_variables, "first_call", True) + monkeypatch.setattr(pfcoil.data.pf_coil, "first_call", True) pfcoil.pfcoil() assert pytest.approx(pv.b_plasma_vertical_required) == -0.65121393 - assert pytest.approx(pfcoil_variables.z_pf_coil_middle) == np.array([ + assert pytest.approx(pfcoil.data.pf_coil.z_pf_coil_middle) == np.array([ 4.86, -4.86, 7.2075, @@ -2589,51 +2596,53 @@ def test_ohcalc(monkeypatch, reinitialise_error_module, cs_coil): monkeypatch.setattr(cs_coil.data.build, "dr_cs", 6.510e-1) monkeypatch.setattr(cs_coil.data.fwbs, "den_steel", 7.8e3) monkeypatch.setattr(cs_coil.data.build, "dr_bore", 2.6745) - monkeypatch.setattr(pfcoil_variables, "n_cs_pf_coils", 5) - monkeypatch.setattr(pfcoil_variables, "b_cs_peak_flat_top_end", 1.4e1) - monkeypatch.setattr(pfcoil_variables, "i_cs_stress", 0) - monkeypatch.setattr(pfcoil_variables, "j_cs_flat_top_end", 1.693e7) - monkeypatch.setattr(pfcoil_variables, "f_a_cs_void", 3.0e-1) - monkeypatch.setattr(pfcoil_variables, "jcableoh_bop", 1.069e8) - monkeypatch.setattr(pfcoil_variables, "fcuohsu", 7.000e-1) - monkeypatch.setattr(pfcoil_variables, "i_cs_superconductor", 5) - monkeypatch.setattr(pfcoil_variables, "f_z_cs_tf_internal", 0.9) - monkeypatch.setattr(pfcoil_variables, "a_cs_poloidal", 1.039e1) - monkeypatch.setattr(pfcoil_variables, "p_pf_coil_resistive_total_flat_top", 0.0) - monkeypatch.setattr(pfcoil_variables, "jcableoh_eof", 1.427e8) - monkeypatch.setattr(pfcoil_variables, "p_cs_resistive_flat_top", 0.0) - monkeypatch.setattr(pfcoil_variables, "j_cs_critical_pulse_start", 3.048e7) - monkeypatch.setattr(pfcoil_variables, "s_shear_cs_peak", 5.718e8) - monkeypatch.setattr(pfcoil_variables, "awpoh", 4.232) - monkeypatch.setattr(pfcoil_variables, "f_a_cs_turn_steel", 5.926e-1) - monkeypatch.setattr(pfcoil_variables, "b_cs_peak_pulse_start", 1.4e1) - monkeypatch.setattr(pfcoil_variables, "j_cs_critical_flat_top_end", 4.070e7) - monkeypatch.setattr(pfcoil_variables, "temp_cs_superconductor_margin", 1.5) - monkeypatch.setattr(pfcoil_variables, "i_pf_conductor", 0) - monkeypatch.setattr(pfcoil_variables, "j_pf_wp_critical", np.full(22, 0.0)) - monkeypatch.setattr(pfcoil_variables, "rho_pf_coil", 2.8e-8) - monkeypatch.setattr(pfcoil_variables, "f_a_pf_coil_void", np.full(22, 0.3)) - monkeypatch.setattr(pfcoil_variables, "c_pf_cs_coils_peak_ma", np.full(22, 0.0)) - monkeypatch.setattr(pfcoil_variables, "b_pf_coil_peak", np.full(22, 0.0)) + monkeypatch.setattr(cs_coil.data.pf_coil, "n_cs_pf_coils", 5) + monkeypatch.setattr(cs_coil.data.pf_coil, "b_cs_peak_flat_top_end", 1.4e1) + monkeypatch.setattr(cs_coil.data.pf_coil, "i_cs_stress", 0) + monkeypatch.setattr(cs_coil.data.pf_coil, "j_cs_flat_top_end", 1.693e7) + monkeypatch.setattr(cs_coil.data.pf_coil, "f_a_cs_void", 3.0e-1) + monkeypatch.setattr(cs_coil.data.pf_coil, "jcableoh_bop", 1.069e8) + monkeypatch.setattr(cs_coil.data.pf_coil, "fcuohsu", 7.000e-1) + monkeypatch.setattr(cs_coil.data.pf_coil, "i_cs_superconductor", 5) + monkeypatch.setattr(cs_coil.data.pf_coil, "f_z_cs_tf_internal", 0.9) + monkeypatch.setattr(cs_coil.data.pf_coil, "a_cs_poloidal", 1.039e1) + monkeypatch.setattr(cs_coil.data.pf_coil, "p_pf_coil_resistive_total_flat_top", 0.0) + monkeypatch.setattr(cs_coil.data.pf_coil, "jcableoh_eof", 1.427e8) + monkeypatch.setattr(cs_coil.data.pf_coil, "p_cs_resistive_flat_top", 0.0) + monkeypatch.setattr(cs_coil.data.pf_coil, "j_cs_critical_pulse_start", 3.048e7) + monkeypatch.setattr(cs_coil.data.pf_coil, "s_shear_cs_peak", 5.718e8) + monkeypatch.setattr(cs_coil.data.pf_coil, "awpoh", 4.232) + monkeypatch.setattr(cs_coil.data.pf_coil, "f_a_cs_turn_steel", 5.926e-1) + monkeypatch.setattr(cs_coil.data.pf_coil, "b_cs_peak_pulse_start", 1.4e1) + monkeypatch.setattr(cs_coil.data.pf_coil, "j_cs_critical_flat_top_end", 4.070e7) + monkeypatch.setattr(cs_coil.data.pf_coil, "temp_cs_superconductor_margin", 1.5) + monkeypatch.setattr(cs_coil.data.pf_coil, "i_pf_conductor", 0) + monkeypatch.setattr(cs_coil.data.pf_coil, "j_pf_wp_critical", np.full(22, 0.0)) + monkeypatch.setattr(cs_coil.data.pf_coil, "rho_pf_coil", 2.8e-8) + monkeypatch.setattr(cs_coil.data.pf_coil, "f_a_pf_coil_void", np.full(22, 0.3)) + monkeypatch.setattr(cs_coil.data.pf_coil, "c_pf_cs_coils_peak_ma", np.full(22, 0.0)) + monkeypatch.setattr(cs_coil.data.pf_coil, "b_pf_coil_peak", np.full(22, 0.0)) + monkeypatch.setattr( + cs_coil.data.pf_coil, "j_cs_conductor_critical_flat_top_end", 4.758e8 + ) + monkeypatch.setattr(cs_coil.data.pf_coil, "z_pf_coil_middle", np.full(22, 0.0)) + monkeypatch.setattr(cs_coil.data.pf_coil, "r_pf_coil_outer", np.full(22, 0.0)) + monkeypatch.setattr(cs_coil.data.pf_coil, "r_pf_coil_inner", np.full(22, 0.0)) monkeypatch.setattr( - pfcoil_variables, "j_cs_conductor_critical_flat_top_end", 4.758e8 + cs_coil.data.pf_coil, "j_cs_conductor_critical_pulse_start", 3.562e8 ) - monkeypatch.setattr(pfcoil_variables, "z_pf_coil_middle", np.full(22, 0.0)) - monkeypatch.setattr(pfcoil_variables, "r_pf_coil_outer", np.full(22, 0.0)) - monkeypatch.setattr(pfcoil_variables, "r_pf_coil_inner", np.full(22, 0.0)) - monkeypatch.setattr(pfcoil_variables, "j_cs_conductor_critical_pulse_start", 3.562e8) monkeypatch.setattr( - pfcoil_variables, "c_pf_coil_turn_peak_input", np.full(22, 4.22e4) - ) - monkeypatch.setattr(pfcoil_variables, "pfcaseth", np.full(22, 0.0)) - monkeypatch.setattr(pfcoil_variables, "r_pf_coil_middle", np.full(22, 0.0)) - monkeypatch.setattr(pfcoil_variables, "j_cs_pulse_start", 1.693e7) - monkeypatch.setattr(pfcoil_variables, "z_pf_coil_upper", np.full(22, 0.0)) - monkeypatch.setattr(pfcoil_variables, "m_pf_coil_conductor", np.full(22, 0.0)) - monkeypatch.setattr(pfcoil_variables, "z_pf_coil_lower", np.full(22, 0.0)) - monkeypatch.setattr(pfcoil_variables, "n_pf_coil_turns", np.full(22, 0.0)) - monkeypatch.setattr(pfcoil_variables, "m_pf_coil_structure", np.full(22, 0.0)) - monkeypatch.setattr(pfcoil_variables, "a_cs_turn", 0.0) + cs_coil.data.pf_coil, "c_pf_coil_turn_peak_input", np.full(22, 4.22e4) + ) + monkeypatch.setattr(cs_coil.data.pf_coil, "pfcaseth", np.full(22, 0.0)) + monkeypatch.setattr(cs_coil.data.pf_coil, "r_pf_coil_middle", np.full(22, 0.0)) + monkeypatch.setattr(cs_coil.data.pf_coil, "j_cs_pulse_start", 1.693e7) + monkeypatch.setattr(cs_coil.data.pf_coil, "z_pf_coil_upper", np.full(22, 0.0)) + monkeypatch.setattr(cs_coil.data.pf_coil, "m_pf_coil_conductor", np.full(22, 0.0)) + monkeypatch.setattr(cs_coil.data.pf_coil, "z_pf_coil_lower", np.full(22, 0.0)) + monkeypatch.setattr(cs_coil.data.pf_coil, "n_pf_coil_turns", np.full(22, 0.0)) + monkeypatch.setattr(cs_coil.data.pf_coil, "m_pf_coil_structure", np.full(22, 0.0)) + monkeypatch.setattr(cs_coil.data.pf_coil, "a_cs_turn", 0.0) monkeypatch.setattr(tfv, "dcond", np.full(9, 9.0e3)) monkeypatch.setattr(tfv, "tftmp", 4.750) monkeypatch.setattr(tfv, "tcritsc", 1.6e1) @@ -2647,20 +2656,24 @@ def test_ohcalc(monkeypatch, reinitialise_error_module, cs_coil): # Mocks for peak_b_field_at_pf_coil() monkeypatch.setattr(cs_coil.data.build, "iohcl", 1) monkeypatch.setattr( - pfcoil_variables, "f_c_pf_cs_peak_time_array", np.full([22, 6], 0.0) + cs_coil.data.pf_coil, "f_c_pf_cs_peak_time_array", np.full([22, 6], 0.0) ) - monkeypatch.setattr(pfcoil_variables, "n_pf_coil_groups", 4) + monkeypatch.setattr(cs_coil.data.pf_coil, "n_pf_coil_groups", 4) monkeypatch.setattr( - pfcoil_variables, + cs_coil.data.pf_coil, "n_pf_coils_in_group", np.array([1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0]), ) monkeypatch.setattr( - pfcoil_variables, "c_pf_cs_coil_pulse_start_ma", np.full(22, 0.0) + cs_coil.data.pf_coil, "c_pf_cs_coil_pulse_start_ma", np.full(22, 0.0) ) - monkeypatch.setattr(pfcoil_variables, "c_pf_cs_coil_flat_top_ma", np.full(22, 0.0)) monkeypatch.setattr( - pfcoil_variables, "c_pf_cs_coil_pulse_end_ma", np.full(22, -175.84911993600002) + cs_coil.data.pf_coil, "c_pf_cs_coil_flat_top_ma", np.full(22, 0.0) + ) + monkeypatch.setattr( + cs_coil.data.pf_coil, + "c_pf_cs_coil_pulse_end_ma", + np.full(22, -175.84911993600002), ) monkeypatch.setattr(pv, "rmajor", 8.938) monkeypatch.setattr(pv, "plasma_current", 1.8254e7) @@ -2676,8 +2689,11 @@ def test_ohcalc(monkeypatch, reinitialise_error_module, cs_coil): cs_coil.ohcalc() - assert pytest.approx(pfcoil_variables.b_pf_coil_peak[4]) == 13.073958753751993 - assert pytest.approx(pfcoil_variables.j_cs_critical_flat_top_end) == 54101481.7685945 + assert pytest.approx(cs_coil.data.pf_coil.b_pf_coil_peak[4]) == 13.073958753751993 + assert ( + pytest.approx(cs_coil.data.pf_coil.j_cs_critical_flat_top_end) + == 54101481.7685945 + ) def test_efc(pfcoil: PFCoil, monkeypatch: pytest.MonkeyPatch): @@ -2985,7 +3001,7 @@ def test_mtrx(pfcoil: PFCoil): z_pf_coil_middle_group_array, alfa, bfix, - int(pfcoil_variables.N_PF_COILS_IN_GROUP_MAX), + int(N_PF_COILS_IN_GROUP_MAX), ) gmat_exp = np.zeros((74, 10)) @@ -3311,9 +3327,9 @@ def test_peakb(monkeypatch: pytest.MonkeyPatch, pfcoil: PFCoil): """ # Mock module vars np.zeros(64) - monkeypatch.setattr(pfcoil_variables, "nfxf", 14) + monkeypatch.setattr(pfcoil.data.pf_coil, "nfxf", 14) monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "r_pf_cs_current_filaments", np.array(( 6.2732560483870969, @@ -3323,7 +3339,7 @@ def test_peakb(monkeypatch: pytest.MonkeyPatch, pfcoil: PFCoil): )), ) monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "z_pf_cs_current_filaments", np.array(( 9.606146709677418, @@ -3344,7 +3360,7 @@ def test_peakb(monkeypatch: pytest.MonkeyPatch, pfcoil: PFCoil): )), ) monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "c_pf_cs_current_filaments", np.array(( 15889161.548344759, @@ -3353,14 +3369,14 @@ def test_peakb(monkeypatch: pytest.MonkeyPatch, pfcoil: PFCoil): *np.zeros(50), )), ) - monkeypatch.setattr(pfcoil_variables, "xind", np.zeros(64)) - monkeypatch.setattr(pfcoil_variables, "bpf2", np.zeros(22)) + monkeypatch.setattr(pfcoil.data.pf_coil, "xind", np.zeros(64)) + monkeypatch.setattr(pfcoil.data.pf_coil, "bpf2", np.zeros(22)) monkeypatch.setattr(pfcoil.data.build, "iohcl", 1) monkeypatch.setattr(pfcoil.data.build, "z_tf_inside_half", 9.0730900215620327) monkeypatch.setattr(pfcoil.data.build, "dr_cs", 0.55242000000000002) monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "r_pf_coil_inner", np.array([ 5.6944236847973242, @@ -3372,9 +3388,9 @@ def test_peakb(monkeypatch: pytest.MonkeyPatch, pfcoil: PFCoil): *np.zeros(16), ]), ) - monkeypatch.setattr(pfcoil_variables, "n_cs_pf_coils", 7) + monkeypatch.setattr(pfcoil.data.pf_coil, "n_cs_pf_coils", 7) monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "c_pf_cs_coils_peak_ma", np.array([ 14.742063826112622, @@ -3387,9 +3403,9 @@ def test_peakb(monkeypatch: pytest.MonkeyPatch, pfcoil: PFCoil): *np.zeros(15), ]), ) - monkeypatch.setattr(pfcoil_variables, "f_z_cs_tf_internal", 0.90000000000000002) + monkeypatch.setattr(pfcoil.data.pf_coil, "f_z_cs_tf_internal", 0.90000000000000002) monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "r_pf_coil_outer", np.array([ 6.8520884119768697, @@ -3402,7 +3418,7 @@ def test_peakb(monkeypatch: pytest.MonkeyPatch, pfcoil: PFCoil): ]), ) monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "r_pf_coil_middle", np.array([ 6.2732560483870969, @@ -3415,7 +3431,7 @@ def test_peakb(monkeypatch: pytest.MonkeyPatch, pfcoil: PFCoil): ]), ) monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "f_c_pf_cs_peak_time_array", np.array( [ @@ -3445,13 +3461,13 @@ def test_peakb(monkeypatch: pytest.MonkeyPatch, pfcoil: PFCoil): order="F", ), ) - monkeypatch.setattr(pfcoil_variables, "j_cs_flat_top_end", 20726000) - monkeypatch.setattr(pfcoil_variables, "n_pf_coil_groups", 4) + monkeypatch.setattr(pfcoil.data.pf_coil, "j_cs_flat_top_end", 20726000) + monkeypatch.setattr(pfcoil.data.pf_coil, "n_pf_coil_groups", 4) monkeypatch.setattr( - pfcoil_variables, "b_pf_coil_peak", np.zeros(22, dtype=int) + pfcoil.data.pf_coil, "b_pf_coil_peak", np.zeros(22, dtype=int) ) # maybe monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "z_pf_coil_middle", np.array([ 9.606146709677418, @@ -3464,12 +3480,12 @@ def test_peakb(monkeypatch: pytest.MonkeyPatch, pfcoil: PFCoil): ]), ) monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "n_pf_coils_in_group", np.array([1, 1, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0]), ) monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "z_pf_coil_lower", np.array([ 9.0273143460876444, @@ -3482,7 +3498,7 @@ def test_peakb(monkeypatch: pytest.MonkeyPatch, pfcoil: PFCoil): ]), ) monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "c_pf_cs_coil_pulse_start_ma", np.array([ 14.742063826112622, @@ -3496,7 +3512,7 @@ def test_peakb(monkeypatch: pytest.MonkeyPatch, pfcoil: PFCoil): ]), ) monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "c_pf_cs_coil_flat_top_ma", np.array([ 0.067422231232391661, @@ -3510,7 +3526,7 @@ def test_peakb(monkeypatch: pytest.MonkeyPatch, pfcoil: PFCoil): ]), ) monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "c_pf_cs_coil_pulse_end_ma", np.array([ 0.067422231232391661, @@ -3523,9 +3539,9 @@ def test_peakb(monkeypatch: pytest.MonkeyPatch, pfcoil: PFCoil): *np.zeros(15), ]), ) - monkeypatch.setattr(pfcoil_variables, "j_cs_pulse_start", 19311657.760000002) + monkeypatch.setattr(pfcoil.data.pf_coil, "j_cs_pulse_start", 19311657.760000002) monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "z_pf_coil_upper", np.array([ 10.184979073267192, @@ -3615,9 +3631,9 @@ def test_induct(pfcoil: PFCoil, monkeypatch: pytest.MonkeyPatch): """ monkeypatch.setattr(pfcoil.data.build, "iohcl", 1) monkeypatch.setattr(pfcoil.data.build, "dr_cs", 0.55242000000000002) - monkeypatch.setattr(pfcoil_variables, "n_cs_pf_coils", 7) + monkeypatch.setattr(pfcoil.data.pf_coil, "n_cs_pf_coils", 7) monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "n_pf_coil_turns", np.array([ 349.33800535811901, @@ -3632,7 +3648,7 @@ def test_induct(pfcoil: PFCoil, monkeypatch: pytest.MonkeyPatch): ]), ) monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "z_pf_coil_middle", np.array([ 9.606146709677418, @@ -3645,7 +3661,7 @@ def test_induct(pfcoil: PFCoil, monkeypatch: pytest.MonkeyPatch): ]), ) monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "r_pf_coil_middle", np.array([ 6.2732560483870969, @@ -3658,16 +3674,18 @@ def test_induct(pfcoil: PFCoil, monkeypatch: pytest.MonkeyPatch): *np.zeros(15), ]), ) - monkeypatch.setattr(pfcoil_variables, "ind_pf_cs_plasma_mutual", np.ones((22, 22))) - monkeypatch.setattr(pfcoil_variables, "r_cs_middle", 2.6084100000000001) - monkeypatch.setattr(pfcoil_variables, "n_pf_coil_groups", 4) monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "ind_pf_cs_plasma_mutual", np.ones((22, 22)) + ) + monkeypatch.setattr(pfcoil.data.pf_coil, "r_cs_middle", 2.6084100000000001) + monkeypatch.setattr(pfcoil.data.pf_coil, "n_pf_coil_groups", 4) + monkeypatch.setattr( + pfcoil.data.pf_coil, "n_pf_coils_in_group", np.array([1, 1, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0]), ) monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "z_pf_coil_lower", np.array([ 9.0273143460876444, @@ -3681,9 +3699,9 @@ def test_induct(pfcoil: PFCoil, monkeypatch: pytest.MonkeyPatch): *np.zeros(15), ]), ) - monkeypatch.setattr(pfcoil_variables, "n_pf_cs_plasma_circuits", 8) + monkeypatch.setattr(pfcoil.data.pf_coil, "n_pf_cs_plasma_circuits", 8) monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "r_pf_coil_inner", np.array([ 5.6944236847973242, @@ -3698,7 +3716,7 @@ def test_induct(pfcoil: PFCoil, monkeypatch: pytest.MonkeyPatch): ]), ) monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "z_pf_coil_upper", np.array([ 10.184979073267192, @@ -3713,7 +3731,7 @@ def test_induct(pfcoil: PFCoil, monkeypatch: pytest.MonkeyPatch): ]), ) monkeypatch.setattr( - pfcoil_variables, + pfcoil.data.pf_coil, "r_pf_coil_outer", np.array([ 6.8520884119768697, @@ -3813,5 +3831,5 @@ def test_induct(pfcoil: PFCoil, monkeypatch: pytest.MonkeyPatch): ] pfcoil.induct(False) assert_array_almost_equal( - pfcoil_variables.ind_pf_cs_plasma_mutual, ind_pf_cs_plasma_mutual_exp + pfcoil.data.pf_coil.ind_pf_cs_plasma_mutual, ind_pf_cs_plasma_mutual_exp ) diff --git a/tests/unit/models/test_power.py b/tests/unit/models/test_power.py index adbfd997c..421d9fa7a 100644 --- a/tests/unit/models/test_power.py +++ b/tests/unit/models/test_power.py @@ -7,9 +7,7 @@ divertor_variables, numerics, pf_power_variables, - pfcoil_variables, physics_variables, - power_variables, tfcoil_variables, ) @@ -128,13 +126,13 @@ def test_cryo(cryoparam, monkeypatch, power): monkeypatch.setattr(power.data.fwbs, "inuclear", cryoparam.inuclear) - monkeypatch.setattr(power_variables, "qss", cryoparam.qss) + monkeypatch.setattr(power.data.power, "qss", cryoparam.qss) - monkeypatch.setattr(power_variables, "qac", cryoparam.qac) + monkeypatch.setattr(power.data.power, "qac", cryoparam.qac) - monkeypatch.setattr(power_variables, "qcl", cryoparam.qcl) + monkeypatch.setattr(power.data.power, "qcl", cryoparam.qcl) - monkeypatch.setattr(power_variables, "qmisc", cryoparam.qmisc) + monkeypatch.setattr(power.data.power, "qmisc", cryoparam.qmisc) helpow = power.cryo( i_tf_sup=cryoparam.i_tf_sup, @@ -147,13 +145,13 @@ def test_cryo(cryoparam, monkeypatch, power): t_plant_pulse_plasma_present=cryoparam.t_plant_pulse_plasma_present, ) - assert power_variables.qss == pytest.approx(cryoparam.expected_qss) + assert power.data.power.qss == pytest.approx(cryoparam.expected_qss) - assert power_variables.qac == pytest.approx(cryoparam.expected_qac) + assert power.data.power.qac == pytest.approx(cryoparam.expected_qac) - assert power_variables.qcl == pytest.approx(cryoparam.expected_qcl) + assert power.data.power.qcl == pytest.approx(cryoparam.expected_qcl) - assert power_variables.qmisc == pytest.approx(cryoparam.expected_qmisc) + assert power.data.power.qmisc == pytest.approx(cryoparam.expected_qmisc) assert helpow == pytest.approx(cryoparam.expected_helpow) @@ -1789,61 +1787,63 @@ def test_pfpwr(pfpwrparam, monkeypatch, power): monkeypatch.setattr(pf_power_variables, "srcktpm", pfpwrparam.srcktpm) monkeypatch.setattr( - pfcoil_variables, "n_pf_coil_groups", pfpwrparam.n_pf_coil_groups + power.data.pf_coil, "n_pf_coil_groups", pfpwrparam.n_pf_coil_groups ) - monkeypatch.setattr(pfcoil_variables, "c_pf_coil_turn", pfpwrparam.c_pf_coil_turn) + monkeypatch.setattr(power.data.pf_coil, "c_pf_coil_turn", pfpwrparam.c_pf_coil_turn) monkeypatch.setattr( - pfcoil_variables, + power.data.pf_coil, "p_pf_electric_supplies_mw", pfpwrparam.p_pf_electric_supplies_mw, ) - monkeypatch.setattr(pfcoil_variables, "rho_pf_coil", pfpwrparam.rho_pf_coil) + monkeypatch.setattr(power.data.pf_coil, "rho_pf_coil", pfpwrparam.rho_pf_coil) monkeypatch.setattr( - pfcoil_variables, "n_pf_cs_plasma_circuits", pfpwrparam.n_pf_cs_plasma_circuits + power.data.pf_coil, "n_pf_cs_plasma_circuits", pfpwrparam.n_pf_cs_plasma_circuits ) monkeypatch.setattr( - pfcoil_variables, "n_pf_coils_in_group", pfpwrparam.n_pf_coils_in_group + power.data.pf_coil, "n_pf_coils_in_group", pfpwrparam.n_pf_coils_in_group ) monkeypatch.setattr( - pfcoil_variables, "c_pf_cs_coils_peak_ma", pfpwrparam.c_pf_cs_coils_peak_ma + power.data.pf_coil, "c_pf_cs_coils_peak_ma", pfpwrparam.c_pf_cs_coils_peak_ma ) - monkeypatch.setattr(pfcoil_variables, "etapsu", pfpwrparam.etapsu) + monkeypatch.setattr(power.data.pf_coil, "etapsu", pfpwrparam.etapsu) monkeypatch.setattr( - pfcoil_variables, + power.data.pf_coil, "c_pf_coil_turn_peak_input", pfpwrparam.c_pf_coil_turn_peak_input, ) monkeypatch.setattr( - pfcoil_variables, + power.data.pf_coil, "c_pf_cs_coil_pulse_end_ma", pfpwrparam.c_pf_cs_coil_pulse_end_ma, ) monkeypatch.setattr( - pfcoil_variables, "ind_pf_cs_plasma_mutual", pfpwrparam.ind_pf_cs_plasma_mutual + power.data.pf_coil, "ind_pf_cs_plasma_mutual", pfpwrparam.ind_pf_cs_plasma_mutual ) - monkeypatch.setattr(pfcoil_variables, "n_pf_coil_turns", pfpwrparam.n_pf_coil_turns) + monkeypatch.setattr( + power.data.pf_coil, "n_pf_coil_turns", pfpwrparam.n_pf_coil_turns + ) monkeypatch.setattr( - pfcoil_variables, "f_a_pf_coil_void", pfpwrparam.f_a_pf_coil_void + power.data.pf_coil, "f_a_pf_coil_void", pfpwrparam.f_a_pf_coil_void ) monkeypatch.setattr( - pfcoil_variables, "j_pf_coil_wp_peak", pfpwrparam.j_pf_coil_wp_peak + power.data.pf_coil, "j_pf_coil_wp_peak", pfpwrparam.j_pf_coil_wp_peak ) monkeypatch.setattr( - pfcoil_variables, "r_pf_coil_middle", pfpwrparam.r_pf_coil_middle + power.data.pf_coil, "r_pf_coil_middle", pfpwrparam.r_pf_coil_middle ) monkeypatch.setattr( @@ -2767,7 +2767,7 @@ def test_power2(power2param, monkeypatch, power): ) monkeypatch.setattr( - pfcoil_variables, + power.data.pf_coil, "p_pf_electric_supplies_mw", power2param.p_pf_electric_supplies_mw, ) @@ -2845,70 +2845,70 @@ def test_power2(power2param, monkeypatch, power): ) monkeypatch.setattr( - power_variables, + power.data.power, "p_shld_coolant_pump_elec_mw", power2param.p_shld_coolant_pump_elec_mw, ) monkeypatch.setattr( - power_variables, + power.data.power, "p_div_coolant_pump_elec_mw", power2param.p_div_coolant_pump_elec_mw, ) monkeypatch.setattr( - power_variables, "p_coolant_pump_total_mw", power2param.p_coolant_pump_total_mw + power.data.power, "p_coolant_pump_total_mw", power2param.p_coolant_pump_total_mw ) monkeypatch.setattr( - power_variables, + power.data.power, "p_fw_blkt_heat_deposited_mw", power2param.p_fw_blkt_heat_deposited_mw, ) monkeypatch.setattr( - power_variables, + power.data.power, "p_fw_blkt_coolant_pump_elec_mw", power2param.p_fw_blkt_coolant_pump_elec_mw, ) monkeypatch.setattr( - power_variables, "p_div_heat_deposited_mw", power2param.p_div_heat_deposited_mw + power.data.power, "p_div_heat_deposited_mw", power2param.p_div_heat_deposited_mw ) monkeypatch.setattr( - power_variables, "p_fw_heat_deposited_mw", power2param.p_fw_heat_deposited_mw + power.data.power, "p_fw_heat_deposited_mw", power2param.p_fw_heat_deposited_mw ) monkeypatch.setattr( - power_variables, + power.data.power, "p_shld_heat_deposited_mw", power2param.p_shld_heat_deposited_mw, ) monkeypatch.setattr( - power_variables, + power.data.power, "p_cp_coolant_pump_elec_mw", power2param.p_cp_coolant_pump_elec_mw, ) monkeypatch.setattr( - power_variables, + power.data.power, "p_plant_core_systems_elec_mw", power2param.p_plant_core_systems_elec_mw, ) monkeypatch.setattr( - power_variables, "f_p_div_primary_heat", power2param.f_p_div_primary_heat + power.data.power, "f_p_div_primary_heat", power2param.f_p_div_primary_heat ) - monkeypatch.setattr(power_variables, "qss", power2param.qss) + monkeypatch.setattr(power.data.power, "qss", power2param.qss) - monkeypatch.setattr(power_variables, "qac", power2param.qac) + monkeypatch.setattr(power.data.power, "qac", power2param.qac) - monkeypatch.setattr(power_variables, "qcl", power2param.qcl) + monkeypatch.setattr(power.data.power, "qcl", power2param.qcl) - monkeypatch.setattr(power_variables, "qmisc", power2param.qmisc) + monkeypatch.setattr(power.data.power, "qmisc", power2param.qmisc) power.plant_electric_production() @@ -2932,6 +2932,6 @@ def test_power2(power2param, monkeypatch, power): power2param.expected_p_plant_secondary_heat_mw ) - assert power_variables.p_plant_core_systems_elec_mw == pytest.approx( + assert power.data.power.p_plant_core_systems_elec_mw == pytest.approx( power2param.expected_pcoresystems ) diff --git a/tests/unit/models/test_pulse.py b/tests/unit/models/test_pulse.py index 851e5e652..b5cae3512 100644 --- a/tests/unit/models/test_pulse.py +++ b/tests/unit/models/test_pulse.py @@ -6,7 +6,6 @@ from process.data_structure import ( numerics, pf_power_variables, - pfcoil_variables, physics_variables, ) @@ -1202,31 +1201,39 @@ def test_tohswg(tohswgparam, monkeypatch, pulse): monkeypatch.setattr(pf_power_variables, "vpfskv", tohswgparam.vpfskv) monkeypatch.setattr( - pfcoil_variables, "n_pf_cs_plasma_circuits", tohswgparam.n_pf_cs_plasma_circuits + pulse.data.pf_coil, + "n_pf_cs_plasma_circuits", + tohswgparam.n_pf_cs_plasma_circuits, ) - monkeypatch.setattr(pfcoil_variables, "i_pf_conductor", tohswgparam.i_pf_conductor) + monkeypatch.setattr(pulse.data.pf_coil, "i_pf_conductor", tohswgparam.i_pf_conductor) - monkeypatch.setattr(pfcoil_variables, "n_cs_pf_coils", tohswgparam.n_cs_pf_coils) + monkeypatch.setattr(pulse.data.pf_coil, "n_cs_pf_coils", tohswgparam.n_cs_pf_coils) monkeypatch.setattr( - pfcoil_variables, "p_cs_resistive_flat_top", tohswgparam.p_cs_resistive_flat_top + pulse.data.pf_coil, + "p_cs_resistive_flat_top", + tohswgparam.p_cs_resistive_flat_top, ) monkeypatch.setattr( - pfcoil_variables, "ind_pf_cs_plasma_mutual", tohswgparam.ind_pf_cs_plasma_mutual + pulse.data.pf_coil, + "ind_pf_cs_plasma_mutual", + tohswgparam.ind_pf_cs_plasma_mutual, ) - monkeypatch.setattr(pfcoil_variables, "c_pf_coil_turn", tohswgparam.c_pf_coil_turn) + monkeypatch.setattr(pulse.data.pf_coil, "c_pf_coil_turn", tohswgparam.c_pf_coil_turn) monkeypatch.setattr( - pfcoil_variables, "c_pf_cs_coils_peak_ma", tohswgparam.c_pf_cs_coils_peak_ma + pulse.data.pf_coil, "c_pf_cs_coils_peak_ma", tohswgparam.c_pf_cs_coils_peak_ma ) - monkeypatch.setattr(pfcoil_variables, "n_pf_coil_turns", tohswgparam.n_pf_coil_turns) + monkeypatch.setattr( + pulse.data.pf_coil, "n_pf_coil_turns", tohswgparam.n_pf_coil_turns + ) monkeypatch.setattr( - pfcoil_variables, + pulse.data.pf_coil, "c_pf_coil_turn_peak_input", tohswgparam.c_pf_coil_turn_peak_input, )