diff --git a/process/core/caller.py b/process/core/caller.py index d880d884f..9d8bb1430 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) @@ -273,7 +275,7 @@ def _call_models_once(self, xc: np.ndarray): 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..0c6c09494 100644 --- a/process/core/init.py +++ b/process/core/init.py @@ -17,16 +17,11 @@ 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, @@ -72,7 +67,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,9 +247,7 @@ 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() @@ -262,7 +255,6 @@ def init_all_module_vars(): init_stellarator_variables() init_tfcoil_variables() constants.init_constants() - init_pfcoil_variables() init_pf_power_variables() init_rebco_variables() init_power_variables() @@ -394,10 +386,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 +604,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 +746,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 +1108,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: @@ -1217,7 +1206,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 +1245,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: data_structure.global_variables.icase = "Stellarator model" diff --git a/process/core/input.py b/process/core/input.py index 49bca620b..ae33eb419 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,15 +237,13 @@ 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) - ), + "b_cs_limit_max": InputVariable("pf_coil", float, range=(0.01, 100.0)), "bmn": InputVariable( data_structure.stellarator_variables, float, range=(0.0001, 0.01) ), @@ -274,21 +271,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 +347,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 +410,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 +448,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)), @@ -520,7 +513,7 @@ def __post_init__(self): data_structure.stellarator_variables, 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 +525,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) ), @@ -567,7 +558,7 @@ 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)), + "flirad": InputVariable("ife", float, range=(0.0, 10.0)), "flpitch": InputVariable( data_structure.stellarator_variables, float, range=(0.0001, 0.01) ), @@ -610,9 +601,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 +641,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) ), @@ -680,9 +671,7 @@ def __post_init__(self): "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) @@ -720,7 +709,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 +734,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 +747,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 +758,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 +792,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 +861,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 +871,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,9 +887,9 @@ 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)), + "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( data_structure.stellarator_variables, float, range=(0.1, 10.0) ), @@ -929,12 +904,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) ), @@ -1041,7 +1014,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 +1086,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 +1097,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 +1118,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 +1132,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 +1150,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 +1184,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 +1212,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 +1225,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 +1252,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 +1282,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 +1295,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]), @@ -1351,12 +1316,8 @@ def __post_init__(self): "istell": InputVariable(data_structure.stellarator_variables, int, range=(0, 6)), "isthtr": InputVariable(data_structure.stellarator_variables, 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)), @@ -1415,40 +1376,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), - ), - "rref": InputVariable(data_structure.pfcoil_variables, float, array=True), - "f_a_pf_coil_void": InputVariable( - data_structure.pfcoil_variables, float, array=True + range=(0, N_PF_GROUPS_MAX), ), - "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 +1429,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..f9309e349 100644 --- a/process/core/model.py +++ b/process/core/model.py @@ -14,6 +14,8 @@ 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.primary_pumping_variables import PrimaryPumpingData from process.data_structure.pulse_variables import PulseData from process.data_structure.reinke_variables import ReinkeData @@ -47,6 +49,8 @@ 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 def __post_init__(self): for f in fields(self): diff --git a/process/core/output.py b/process/core/output.py index c8d9530b2..6a2fc187e 100644 --- a/process/core/output.py +++ b/process/core/output.py @@ -30,7 +30,7 @@ def write(models, data, _outfile): 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..a1fc5e039 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, ) @@ -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, ) diff --git a/process/core/solver/iteration_variables.py b/process/core/solver/iteration_variables.py index af5c0e189..fc8dcf78b 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,8 +240,8 @@ 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 ), 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/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/power.py b/process/models/power.py index 7a6abf312..4cec38f21 100644 --- a/process/models/power.py +++ b/process/models/power.py @@ -14,11 +14,11 @@ 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 +298,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 +327,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 +338,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 +354,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 +401,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 +420,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 +467,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 +548,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 +567,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 +630,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, @@ -1030,7 +1030,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, @@ -1496,7 +1496,7 @@ 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, @@ -1643,7 +1643,7 @@ def plant_electric_production(self): + 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 @@ -1735,7 +1735,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, 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/initialization.py b/process/models/stellarator/initialization.py index 65d6566a6..79d7b7887 100644 --- a/process/models/stellarator/initialization.py +++ b/process/models/stellarator/initialization.py @@ -1,7 +1,6 @@ from process.core.model import DataStructure from process.data_structure import ( numerics, - pfcoil_variables, physics_variables, stellarator_variables, ) @@ -26,7 +25,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/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/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..9ee2bdeb7 100644 --- a/tests/unit/models/test_power.py +++ b/tests/unit/models/test_power.py @@ -7,7 +7,6 @@ divertor_variables, numerics, pf_power_variables, - pfcoil_variables, physics_variables, power_variables, tfcoil_variables, @@ -1789,61 +1788,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 +2768,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, ) 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, )