diff --git a/examples/vary_run_example.ex.py b/examples/vary_run_example.ex.py index 7183ae1e4..82aa463df 100644 --- a/examples/vary_run_example.ex.py +++ b/examples/vary_run_example.ex.py @@ -113,14 +113,14 @@ # Get the initial values from the original input file iteration_variable_names, original_iteration_variable_values = ( - get_mfile_initial_ixc_values(input_file) + get_mfile_initial_ixc_values(input_file, vary_run.data) ) # Get the initial values from the new input file produced by VaryRun # VaryRun always produces a file called IN.DAT in the same directory # as the conf file _, updated_iteration_variable_values = get_mfile_initial_ixc_values( - Path(temp_dir.name) / "IN.DAT" + Path(temp_dir.name) / "IN.DAT", vary_run.data ) # %% [markdown] diff --git a/process/core/caller.py b/process/core/caller.py index 6b6c7e495..d880d884f 100644 --- a/process/core/caller.py +++ b/process/core/caller.py @@ -263,7 +263,7 @@ def _call_models_once(self, xc: np.ndarray): data_structure.numerics.ncalls += 1 # Convert variables - set_scaled_iteration_variable(xc, nvars) + set_scaled_iteration_variable(xc, nvars, self.data) # Perform the various function calls # Stellarator caller @@ -342,11 +342,11 @@ def _call_models_once(self, xc: np.ndarray): 4 | KIT HCLL model 5 | DCLL model """ - if data_structure.fwbs_variables.i_blanket_type == 1: + if self.data.fwbs.i_blanket_type == 1: # CCFE HCPB model self.models.ccfe_hcpb.run() - elif data_structure.fwbs_variables.i_blanket_type == 5: + elif self.data.fwbs.i_blanket_type == 5: # DCLL model self.models.dcll.run() diff --git a/process/core/final.py b/process/core/final.py index d2c777190..be55db69c 100644 --- a/process/core/final.py +++ b/process/core/final.py @@ -41,7 +41,7 @@ def finalise(models, data, ifail: int, non_idempotent_msg: str | None = None): po.ocmmnt(constants.NOUT, non_idempotent_msg) # Write output to OUT.DAT and MFILE.DAT - op.write(models, constants.NOUT) + op.write(models, data, constants.NOUT) def output_evaluation(data): diff --git a/process/core/init.py b/process/core/init.py index 9a63a841f..78ce099b4 100644 --- a/process/core/init.py +++ b/process/core/init.py @@ -24,7 +24,6 @@ from process.data_structure.current_drive_variables import init_current_drive_variables from process.data_structure.dcll_variables import init_dcll_module from process.data_structure.divertor_variables import init_divertor_variables -from process.data_structure.fwbs_variables import init_fwbs_variables from process.data_structure.heat_transport_variables import ( init_heat_transport_variables, ) @@ -270,7 +269,6 @@ def init_all_module_vars(): data_structure.numerics.init_numerics() init_buildings_variables() init_divertor_variables() - init_fwbs_variables() data_structure.global_variables.init_global_variables() init_ccfe_hcpb_module() init_heat_transport_variables() @@ -1169,27 +1167,23 @@ def check_process(inputs, data): # noqa: ARG001 # Set inboard blanket thickness to zero if no inboard blanket switch # used (Issue #732) - if data_structure.fwbs_variables.i_blkt_inboard == 0: + if data.fwbs.i_blkt_inboard == 0: data_structure.build_variables.dr_blkt_inboard = 0.0 # Ensure that blanket material fractions allow non-zero space for steel # CCFE HCPB Model if data_structure.stellarator_variables.istell == 0 and ( - data_structure.fwbs_variables.i_blanket_type == 1 + data.fwbs.i_blanket_type == 1 ): - fsum = ( - data_structure.fwbs_variables.breeder_multiplier - + data_structure.fwbs_variables.vfcblkt - + data_structure.fwbs_variables.vfpblkt - ) + fsum = data.fwbs.breeder_multiplier + data.fwbs.vfcblkt + data.fwbs.vfpblkt if fsum >= 1.0: raise ProcessValidationError( "Blanket material fractions do not sum to 1.0", - i_blanket_type=data_structure.fwbs_variables.i_blanket_type, - breeder_multiplier=data_structure.fwbs_variables.breeder_multiplier, - vfcblkt=data_structure.fwbs_variables.vfcblkt, - vfpblkt=data_structure.fwbs_variables.vfpblkt, + i_blanket_type=data.fwbs.i_blanket_type, + breeder_multiplier=data.fwbs.breeder_multiplier, + vfcblkt=data.fwbs.vfcblkt, + vfpblkt=data.fwbs.vfpblkt, fsum=fsum, ) diff --git a/process/core/input.py b/process/core/input.py index 4535d75e7..7566f3284 100644 --- a/process/core/input.py +++ b/process/core/input.py @@ -265,12 +265,8 @@ def __post_init__(self): "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)), - "pres_blkt_coolant": InputVariable( - data_structure.fwbs_variables, float, range=(100000.0, 100000000.0) - ), - "blpressure_liq": InputVariable( - data_structure.fwbs_variables, float, range=(100000.0, 100000000.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) ), @@ -286,13 +282,9 @@ def __post_init__(self): "f_c_plasma_bootstrap": InputVariable( data_structure.current_drive_variables, float, range=(0.0, 1.0) ), - "breeder_f": InputVariable(data_structure.fwbs_variables, float, range=(0.0, 1.0)), - "breeder_multiplier": InputVariable( - data_structure.fwbs_variables, float, range=(0.0, 1.0) - ), - "bz_channel_conduct_liq": InputVariable( - data_structure.fwbs_variables, float, range=(1e-06, 1000000.0) - ), + "breeder_f": InputVariable("fwbs", float, range=(0.0, 1.0)), + "breeder_multiplier": InputVariable("fwbs", float, range=(0.0, 1.0)), + "bz_channel_conduct_liq": InputVariable("fwbs", float, range=(1e-06, 1000000.0)), "dr_tf_plasma_case": InputVariable( data_structure.tfcoil_variables, float, range=(0.0, 1.0) ), @@ -345,9 +337,7 @@ def __post_init__(self): "conv": InputVariable( data_structure.buildings_variables, float, range=(10000.0, 1000000.0) ), - "coolp": InputVariable( - data_structure.fwbs_variables, float, range=(100000.0, 100000000.0) - ), + "coolp": InputVariable("fwbs", float, range=(100000.0, 100000000.0)), "copper_rrr": InputVariable( data_structure.rebco_variables, float, range=(1.0, 10000.0) ), @@ -436,13 +426,11 @@ def __post_init__(self): data_structure.tfcoil_variables, float, range=(500.0, 10000.0) ), "den_copper": InputVariable(process.core.constants, float, range=(8000.0, 10000.0)), - "declblkt": InputVariable(data_structure.fwbs_variables, float, range=(0.01, 0.2)), - "declfw": InputVariable(data_structure.fwbs_variables, float, range=(0.01, 0.2)), - "declshld": InputVariable(data_structure.fwbs_variables, float, range=(0.01, 0.2)), + "declblkt": InputVariable("fwbs", float, range=(0.01, 0.2)), + "declfw": InputVariable("fwbs", float, range=(0.01, 0.2)), + "declshld": InputVariable("fwbs", float, range=(0.01, 0.2)), "decomf": InputVariable("costs", float, range=(0.0, 1.0)), - "den_steel": InputVariable( - data_structure.fwbs_variables, float, range=(5000.0, 10000.0) - ), + "den_steel": InputVariable("fwbs", float, range=(5000.0, 10000.0)), "dia_tf_turn_coolant_channel": InputVariable( data_structure.tfcoil_variables, float, range=(0.0, 0.1) ), @@ -502,12 +490,8 @@ def __post_init__(self): "dr_fw_plasma_gap_outboard": InputVariable( data_structure.build_variables, float, range=(0.0, 10.0) ), - "dr_fw_wall": InputVariable( - data_structure.fwbs_variables, float, range=(0.0005, 0.1) - ), - "dr_pf_cryostat": InputVariable( - data_structure.fwbs_variables, float, range=(0.1, 5.0) - ), + "dr_fw_wall": InputVariable("fwbs", float, range=(0.0005, 0.1)), + "dr_pf_cryostat": InputVariable("fwbs", float, range=(0.1, 5.0)), "dr_shld_blkt_gap": InputVariable( data_structure.build_variables, float, range=(0.0, 5.0) ), @@ -545,9 +529,7 @@ def __post_init__(self): "drveff": InputVariable(data_structure.ife_variables, float, range=(0.01, 1.0)), "dtlife": InputVariable("costs", float, range=(0.0, 15.0)), "dtstor": InputVariable(data_structure.pulse_variables, float, range=(50.0, 500.0)), - "dx_fw_module": InputVariable( - data_structure.fwbs_variables, float, range=(0.0005, 0.1) - ), + "dx_fw_module": InputVariable("fwbs", float, range=(0.0005, 0.1)), "dz_tf_cryostat": InputVariable( data_structure.buildings_variables, float, range=(0.0, 20.0) ), @@ -588,9 +570,7 @@ def __post_init__(self): "elecstore_w": InputVariable( data_structure.buildings_variables, float, range=(10.0, 1000.0) ), - "f_p_blkt_multiplication": InputVariable( - data_structure.fwbs_variables, float, range=(1.0, 2.0) - ), + "f_p_blkt_multiplication": InputVariable("fwbs", float, range=(1.0, 2.0)), "esbldgm3": InputVariable( data_structure.buildings_variables, float, range=(1000.0, 1000000.0) ), @@ -603,10 +583,8 @@ def __post_init__(self): "eta_ebw_injector_wall_plug": InputVariable( data_structure.current_drive_variables, float, range=(0.0, 1.0) ), - "eta_coolant_pump_electric": InputVariable( - data_structure.fwbs_variables, float, range=(0.1, 1.0) - ), - "etaiso": InputVariable(data_structure.fwbs_variables, float, range=(0.1, 1.0)), + "eta_coolant_pump_electric": InputVariable("fwbs", float, range=(0.1, 1.0)), + "etaiso": InputVariable("fwbs", float, range=(0.1, 1.0)), "eta_lowhyb_injector_wall_plug": InputVariable( data_structure.current_drive_variables, float, range=(0.0, 1.0) ), @@ -647,7 +625,7 @@ def __post_init__(self): "f_asym": InputVariable( data_structure.stellarator_variables, float, range=(0.9, 2.0) ), - "f_fw_peak": InputVariable(data_structure.fwbs_variables, float, range=(1.0, 100.0)), + "f_fw_peak": InputVariable("fwbs", float, range=(1.0, 100.0)), "f_fw_rad_max": InputVariable( data_structure.constraint_variables, float, range=(0.1, 10) ), @@ -660,12 +638,8 @@ def __post_init__(self): "f_nd_protium_electrons": InputVariable( data_structure.physics_variables, float, range=(0.0, 1.0) ), - "f_neut_shield": InputVariable( - data_structure.fwbs_variables, float, range=(0.0, 1.0) - ), - "f_nuc_pow_bz_struct": InputVariable( - data_structure.fwbs_variables, float, range=(0.0, 1.0) - ), + "f_neut_shield": InputVariable("fwbs", float, range=(0.0, 1.0)), + "f_nuc_pow_bz_struct": InputVariable("fwbs", float, range=(0.0, 1.0)), "f_r_cp": InputVariable(data_structure.build_variables, float, range=(1.0, 100.0)), "f_rad": InputVariable( data_structure.stellarator_variables, float, range=(0.0, 1.0) @@ -690,17 +664,17 @@ def __post_init__(self): data_structure.build_variables, float, range=(2.0, 10.0) ), "fauxbop": InputVariable(data_structure.ife_variables, float, range=(0.0, 1.0)), - "fblbe": InputVariable(data_structure.fwbs_variables, float, range=(0.0, 1.0)), - "fblbreed": InputVariable(data_structure.fwbs_variables, float, range=(0.0, 1.0)), - "fblhebmi": InputVariable(data_structure.fwbs_variables, float, range=(0.0, 1.0)), - "fblhebmo": InputVariable(data_structure.fwbs_variables, float, range=(0.0, 1.0)), - "fblhebpi": InputVariable(data_structure.fwbs_variables, float, range=(0.0, 1.0)), - "fblhebpo": InputVariable(data_structure.fwbs_variables, float, range=(0.0, 1.0)), - "fblli": InputVariable(data_structure.fwbs_variables, float, range=(0.0, 1.0)), - "fblli2o": InputVariable(data_structure.fwbs_variables, float, range=(0.0, 1.0)), - "fbllipb": InputVariable(data_structure.fwbs_variables, float, range=(0.0, 1.0)), - "fblss": InputVariable(data_structure.fwbs_variables, float, range=(0.0, 1.0)), - "fblvd": InputVariable(data_structure.fwbs_variables, 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)), + "fblhebmo": InputVariable("fwbs", float, range=(0.0, 1.0)), + "fblhebpi": InputVariable("fwbs", float, range=(0.0, 1.0)), + "fblhebpo": InputVariable("fwbs", float, range=(0.0, 1.0)), + "fblli": InputVariable("fwbs", float, range=(0.0, 1.0)), + "fblli2o": InputVariable("fwbs", float, range=(0.0, 1.0)), + "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)), "fc_building_l": InputVariable( @@ -736,9 +710,7 @@ def __post_init__(self): "fjohc0": InputVariable( data_structure.constraint_variables, float, range=(0.001, 1.0) ), - "f_ster_div_single": InputVariable( - data_structure.fwbs_variables, float, range=(0.0, 1.0) - ), + "f_ster_div_single": InputVariable("fwbs", float, range=(0.0, 1.0)), "fdiva": InputVariable(data_structure.divertor_variables, float, range=(0.1, 2.0)), "fdivwet": InputVariable( data_structure.stellarator_variables, float, range=(0.01, 1.0) @@ -746,10 +718,8 @@ def __post_init__(self): "feffcd": InputVariable( data_structure.current_drive_variables, float, range=(0.0, 20.0) ), - "f_a_fw_outboard_hcd": InputVariable( - data_structure.fwbs_variables, float, range=(0.0, 1.0) - ), - "fhole": InputVariable(data_structure.fwbs_variables, float, range=(0.0, 1.0)), + "f_a_fw_outboard_hcd": InputVariable("fwbs", float, range=(0.0, 1.0)), + "fhole": InputVariable("fwbs", float, range=(0.0, 1.0)), "fhts": InputVariable(data_structure.tfcoil_variables, float, range=(0.01, 1.0)), "fkind": InputVariable("costs", float, range=(0.5, 1.0)), "f_h_mode_margin": InputVariable( @@ -796,23 +766,19 @@ def __post_init__(self): "fseppc": InputVariable( data_structure.build_variables, float, range=(1000000.0, 1000000000.0) ), - "fvoldw": InputVariable(data_structure.fwbs_variables, float, range=(0.0, 10.0)), - "fvolsi": InputVariable(data_structure.fwbs_variables, float, range=(0.0, 10.0)), - "fvolso": InputVariable(data_structure.fwbs_variables, float, range=(0.0, 10.0)), + "fvoldw": InputVariable("fwbs", float, range=(0.0, 10.0)), + "fvolsi": InputVariable("fwbs", float, range=(0.0, 10.0)), + "fvolso": InputVariable("fwbs", float, range=(0.0, 10.0)), "f_c_plasma_non_inductive": InputVariable( data_structure.physics_variables, float, range=(0.0, 1.0) ), - "fw_armour_thickness": InputVariable( - data_structure.fwbs_variables, float, range=(0.0, 1.0) - ), - "fw_th_conductivity": InputVariable( - data_structure.fwbs_variables, float, range=(1.0, 100.0) - ), + "fw_armour_thickness": InputVariable("fwbs", float, range=(0.0, 1.0)), + "fw_th_conductivity": InputVariable("fwbs", float, range=(1.0, 100.0)), "fwbs_nref": InputVariable("costs", float, range=(1000.0, 100000000.0)), "fwbs_nu": InputVariable("costs", float, range=(1000.0, 100000000.0)), "fwbs_prob_fail": InputVariable("costs", float, range=(0.0, 1.0)), "fwbs_umain_time": InputVariable("costs", float, range=(0.1, 2.0)), - "fwclfr": InputVariable(data_structure.fwbs_variables, float, range=(0.0, 1.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)), @@ -924,12 +890,8 @@ def __post_init__(self): "pres_vv_chamber_dwell_start": InputVariable( "vacuum", float, range=(1e-06, 10000.0) ), - "temp_blkt_coolant_in": InputVariable( - data_structure.fwbs_variables, float, range=(200.0, 600.0) - ), - "inlet_temp_liq": InputVariable( - data_structure.fwbs_variables, float, range=(508.0, 1500.0) - ), + "temp_blkt_coolant_in": InputVariable("fwbs", float, range=(200.0, 600.0)), + "inlet_temp_liq": InputVariable("fwbs", float, range=(508.0, 1500.0)), "iotabar": InputVariable( data_structure.stellarator_variables, float, range=(0.1, 10.0) ), @@ -942,16 +904,12 @@ def __post_init__(self): "f_dr_dz_cs_turn": InputVariable( data_structure.pfcoil_variables, float, range=(0.0, 5.0) ), - "len_fw_channel": InputVariable( - data_structure.fwbs_variables, float, range=(0.001, 1000.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) ), "lhat": InputVariable(data_structure.reinke_variables, float, range=(1.0, 15.0)), - "f_blkt_li6_enrichment": InputVariable( - data_structure.fwbs_variables, float, range=(7.4, 100.0) - ), + "f_blkt_li6_enrichment": InputVariable("fwbs", float, range=(7.4, 100.0)), "life_dpa": InputVariable("costs", float, range=(10.0, 100.0)), "llw_storage_h": InputVariable( data_structure.buildings_variables, float, range=(1.0, 100.0) @@ -1052,12 +1010,8 @@ def __post_init__(self): ), "outgasfactor": InputVariable("vacuum", float, range=(1e-06, 1000.0)), "outgasindex": InputVariable("vacuum", float, range=(1e-06, 1000.0)), - "temp_blkt_coolant_out": InputVariable( - data_structure.fwbs_variables, float, range=(450.0, 900.0) - ), - "outlet_temp_liq": InputVariable( - data_structure.fwbs_variables, float, range=(508.0, 1500.0) - ), + "temp_blkt_coolant_out": InputVariable("fwbs", float, range=(450.0, 900.0)), + "outlet_temp_liq": InputVariable("fwbs", float, range=(508.0, 1500.0)), "p_he": InputVariable( data_structure.primary_pumping_variables, float, range=(0.0, 100000000.0) ), @@ -1106,9 +1060,7 @@ def __post_init__(self): "p_plant_electric_net_required_mw": InputVariable( data_structure.constraint_variables, float, range=(1.0, 10000.0) ), - "pnuc_fw_ratio_dcll": InputVariable( - data_structure.fwbs_variables, float, range=(0.0, 1.0) - ), + "pnuc_fw_ratio_dcll": InputVariable("fwbs", float, range=(0.0, 1.0)), "poisson_al": InputVariable( data_structure.tfcoil_variables, float, range=(0.0, 1.0) ), @@ -1122,9 +1074,7 @@ def __post_init__(self): data_structure.constraint_variables, float, range=(1.0, 10000.0) ), "pres_div_chamber_burn": InputVariable("vacuum", float, range=(0.0, 10.0)), - "pres_fw_coolant": InputVariable( - data_structure.fwbs_variables, float, range=(100000.0, 100000000.0) - ), + "pres_fw_coolant": InputVariable("fwbs", float, range=(100000.0, 100000000.0)), "prn1": InputVariable(data_structure.divertor_variables, float, range=(0.0, 1.0)), "psepbqarmax": InputVariable( data_structure.constraint_variables, float, range=(1.0, 50.0) @@ -1159,16 +1109,14 @@ def __post_init__(self): "qnty_sfty_fac": InputVariable( data_structure.buildings_variables, float, range=(0.0, 10.0) ), - "qnuc": InputVariable(data_structure.fwbs_variables, float, range=(0.0, 1000000.0)), + "qnuc": InputVariable("fwbs", float, range=(0.0, 1000000.0)), "r_cp_top": InputVariable( data_structure.build_variables, float, range=(0.001, 10.0) ), "rad_fraction_sol": InputVariable( data_structure.physics_variables, float, range=(0.0, 1.0) ), - "radius_fw_channel": InputVariable( - data_structure.fwbs_variables, float, range=(0.001, 0.5) - ), + "radius_fw_channel": InputVariable("fwbs", float, range=(0.001, 0.5)), "outgrat_fw": InputVariable("vacuum", float, range=(1e-10, 1e-06)), "rbrt": InputVariable(data_structure.buildings_variables, float, range=(0.0, 10.0)), "rbvfac": InputVariable(data_structure.buildings_variables, float, range=(0.9, 3.0)), @@ -1244,9 +1192,7 @@ def __post_init__(self): "robotics_w": InputVariable( data_structure.buildings_variables, float, range=(10.0, 1000.0) ), - "roughness_fw_channel": InputVariable( - data_structure.fwbs_variables, float, range=(0.0, 0.01) - ), + "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) ), @@ -1415,15 +1361,9 @@ def __post_init__(self): "temp_cp_average": InputVariable( data_structure.tfcoil_variables, float, range=(4.0, 573.15) ), - "temp_fw_coolant_in": InputVariable( - data_structure.fwbs_variables, float, range=(300.0, 1500.0) - ), - "temp_fw_coolant_out": InputVariable( - data_structure.fwbs_variables, float, range=(300.0, 1500.0) - ), - "temp_fw_max": InputVariable( - data_structure.fwbs_variables, float, range=(500.0, 2000.0) - ), + "temp_fw_coolant_in": InputVariable("fwbs", float, range=(300.0, 1500.0)), + "temp_fw_coolant_out": InputVariable("fwbs", float, range=(300.0, 1500.0)), + "temp_fw_max": InputVariable("fwbs", float, range=(500.0, 2000.0)), "temp_plasma_pedestal_kev": InputVariable( data_structure.physics_variables, float, range=(0.0, 20.0) ), @@ -1596,15 +1536,13 @@ def __post_init__(self): "v_tf_coil_dump_quench_max_kv": InputVariable( data_structure.tfcoil_variables, float, range=(0.0, 100.0) ), - "f_a_blkt_cooling_channels": InputVariable( - data_structure.fwbs_variables, float, range=(0.0, 1.0) - ), - "vfcblkt": InputVariable(data_structure.fwbs_variables, float, range=(0.0, 1.0)), + "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) ), - "vfpblkt": InputVariable(data_structure.fwbs_variables, float, range=(0.0, 1.0)), - "vfshld": InputVariable(data_structure.fwbs_variables, 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( data_structure.tfcoil_variables, float, range=(0.0, 1.0) ), @@ -1621,7 +1559,7 @@ def __post_init__(self): data_structure.constraint_variables, float, range=(0.001, 50.0) ), "walker_coefficient": InputVariable("cs_fatigue", float, range=(0.1, 10.0)), - "wallpf": InputVariable(data_structure.fwbs_variables, float, range=(1.0, 2.0)), + "wallpf": InputVariable("fwbs", float, range=(1.0, 2.0)), "warm_shop_h": InputVariable( data_structure.buildings_variables, float, range=(1.0, 100.0) ), @@ -1667,39 +1605,33 @@ def __post_init__(self): "zeff_max": InputVariable( data_structure.constraint_variables, float, range=(1.0, 10.0) ), - "blktmodel": InputVariable(data_structure.fwbs_variables, int, choices=[0, 1]), - "blkttype": InputVariable(data_structure.fwbs_variables, int, choices=[1, 2, 3]), - "breedmat": InputVariable(data_structure.fwbs_variables, int, choices=[1, 2, 3]), + "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), "cfind": InputVariable("costs", float, array=True), - "i_blkt_coolant_type": InputVariable( - data_structure.fwbs_variables, int, choices=[1, 2] - ), + "i_blkt_coolant_type": InputVariable("fwbs", int, choices=[1, 2]), "coppera_m2_max": InputVariable( data_structure.rebco_variables, float, range=(1.0e6, 1.0e10) ), "cost_model": InputVariable("costs", int, choices=[0, 1, 2]), "i_vac_pump_dwell": InputVariable("vacuum", int, choices=[0, 1, 2]), - "i_fw_blkt_vv_shape": InputVariable( - data_structure.fwbs_variables, int, range=(1, 2) - ), - "hcdportsize": InputVariable(data_structure.fwbs_variables, int, range=(1, 2)), - "i_blkt_liquid_breeder_type": InputVariable( - data_structure.fwbs_variables, int, choices=[0, 1] - ), + "i_fw_blkt_vv_shape": InputVariable("fwbs", int, range=(1, 2)), + "hcdportsize": InputVariable("fwbs", int, range=(1, 2)), + "i_blkt_liquid_breeder_type": InputVariable("fwbs", int, choices=[0, 1]), "i_beta_component": InputVariable( data_structure.physics_variables, int, range=(0, 3) ), "i_beta_fast_alpha": InputVariable( data_structure.physics_variables, int, choices=[0, 1] ), - "i_blanket_type": InputVariable(data_structure.fwbs_variables, int, choices=[1, 5]), + "i_blanket_type": InputVariable("fwbs", int, choices=[1, 5]), "i_bldgs_size": InputVariable( data_structure.buildings_variables, int, choices=[0, 1] ), "i_bldgs_v": InputVariable(data_structure.buildings_variables, int, choices=[0, 1]), - "i_blkt_inboard": InputVariable(data_structure.fwbs_variables, int, choices=[0, 1]), + "i_blkt_inboard": InputVariable("fwbs", int, choices=[0, 1]), "i_bootstrap_current": InputVariable( data_structure.physics_variables, int, range=(0, 13) ), @@ -1745,7 +1677,7 @@ def __post_init__(self): "i_rad_loss": InputVariable( data_structure.physics_variables, int, choices=[0, 1, 2] ), - "i_shield_mat": InputVariable(data_structure.fwbs_variables, int, choices=[0, 1]), + "i_shield_mat": InputVariable("fwbs", int, choices=[0, 1]), "i_single_null": InputVariable( data_structure.physics_variables, int, choices=[0, 1] ), @@ -1778,18 +1710,14 @@ def __post_init__(self): ), "i_plant_availability": InputVariable("costs", int, range=(0, 3)), "ibkt_life": InputVariable("costs", int, choices=[0, 1, 2]), - "i_blkt_dual_coolant": InputVariable( - data_structure.fwbs_variables, int, choices=[0, 1, 2] - ), + "i_blkt_dual_coolant": InputVariable("fwbs", int, choices=[0, 1, 2]), "i_hcd_primary": InputVariable( data_structure.current_drive_variables, int, range=(1, 13) ), "i_hcd_secondary": InputVariable( data_structure.current_drive_variables, int, range=(0, 13) ), - "i_blkt_liquid_breeder_channel_type": InputVariable( - data_structure.fwbs_variables, int, choices=[0, 1, 2] - ), + "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)), @@ -1797,10 +1725,8 @@ def __post_init__(self): "i_plasma_ignited": InputVariable( data_structure.physics_variables, int, choices=[0, 1] ), - "i_blkt_module_segmentation": InputVariable( - data_structure.fwbs_variables, int, choices=[0, 1] - ), - "inuclear": InputVariable(data_structure.fwbs_variables, int, choices=[0, 1]), + "i_blkt_module_segmentation": InputVariable("fwbs", int, choices=[0, 1]), + "inuclear": InputVariable("fwbs", int, choices=[0, 1]), "iohcl": InputVariable(data_structure.build_variables, int, choices=[0, 1]), "i_plasma_pedestal": InputVariable( data_structure.physics_variables, int, choices=[0, 1] @@ -1822,11 +1748,9 @@ def __post_init__(self): data_structure.physics_variables, int, range=(0, 2) ), "i_alphaj": InputVariable(data_structure.physics_variables, int, range=(0, 1)), - "i_fw_blkt_shared_coolant": InputVariable( - data_structure.fwbs_variables, int, choices=[0, 1, 2] - ), + "i_fw_blkt_shared_coolant": InputVariable("fwbs", int, choices=[0, 1, 2]), "ireactor": InputVariable("costs", int, choices=[0, 1]), - "irefprop": InputVariable(data_structure.fwbs_variables, int, choices=[0, 1]), + "irefprop": InputVariable("fwbs", int, choices=[0, 1]), "i_hcd_calculations": InputVariable( data_structure.current_drive_variables, int, choices=[0, 1] ), @@ -1856,7 +1780,7 @@ def __post_init__(self): "i_tf_turn_type": InputVariable( data_structure.superconducting_tf_coil_variables, int, choices=[1, 2] ), - "n_liq_recirc": InputVariable(data_structure.fwbs_variables, int, range=(1, 50)), + "n_liq_recirc": InputVariable("fwbs", int, range=(1, 50)), "n_tf_wp_pancakes": InputVariable( data_structure.tfcoil_variables, int, range=(1, 100) ), @@ -1871,35 +1795,21 @@ def __post_init__(self): "n_tf_joints_contact": InputVariable( data_structure.tfcoil_variables, int, range=(1, 50) ), - "n_blkt_inboard_modules_poloidal": InputVariable( - data_structure.fwbs_variables, int, range=(1, 16) - ), - "n_blkt_outboard_modules_poloidal": InputVariable( - data_structure.fwbs_variables, int, range=(1, 16) - ), - "n_blkt_inboard_modules_toroidal": InputVariable( - data_structure.fwbs_variables, int, range=(8, 96) - ), - "n_blkt_outboard_modules_toroidal": InputVariable( - data_structure.fwbs_variables, int, range=(8, 96) - ), - "npdiv": InputVariable(data_structure.fwbs_variables, int, range=(0, 4)), - "nphcdin": InputVariable(data_structure.fwbs_variables, int, range=(0, 4)), - "nphcdout": InputVariable(data_structure.fwbs_variables, int, range=(0, 4)), + "n_blkt_inboard_modules_poloidal": InputVariable("fwbs", int, range=(1, 16)), + "n_blkt_outboard_modules_poloidal": InputVariable("fwbs", int, range=(1, 16)), + "n_blkt_inboard_modules_toroidal": InputVariable("fwbs", int, range=(8, 96)), + "n_blkt_outboard_modules_toroidal": InputVariable("fwbs", int, range=(8, 96)), + "npdiv": InputVariable("fwbs", int, range=(0, 4)), + "nphcdin": InputVariable("fwbs", int, range=(0, 4)), + "nphcdout": InputVariable("fwbs", int, range=(0, 4)), "i_vacuum_pump_type": InputVariable("vacuum", int, choices=[0, 1]), "num_rh_systems": InputVariable("costs", int, range=(1, 10)), "output_costs": InputVariable("costs", int, choices=[0, 1]), - "i_p_coolant_pumping": InputVariable( - data_structure.fwbs_variables, int, range=(0, 3) - ), + "i_p_coolant_pumping": InputVariable("fwbs", int, range=(0, 3)), "reinke_mode": InputVariable(data_structure.reinke_variables, int, choices=[0, 1]), "scan_dim": InputVariable(data_structure.scan_variables, int, range=(1, 2)), - "i_thermal_electric_conversion": InputVariable( - data_structure.fwbs_variables, int, range=(0, 4) - ), - "secondary_cycle_liq": InputVariable( - data_structure.fwbs_variables, int, range=(2, 4) - ), + "i_thermal_electric_conversion": InputVariable("fwbs", int, range=(0, 4)), + "secondary_cycle_liq": InputVariable("fwbs", int, range=(2, 4)), "supercond_cost_model": InputVariable("costs", int, choices=[0, 1]), "i_tf_inside_cs": InputVariable(data_structure.build_variables, int, choices=[0, 1]), "i_ecrh_wave_mode": InputVariable( @@ -1913,9 +1823,7 @@ def __post_init__(self): "quench_model": InputVariable( data_structure.tfcoil_variables, str, choices=["exponential", "linear"] ), - "i_fw_coolant_type": InputVariable( - data_structure.fwbs_variables, str, choices=["helium", "water"] - ), + "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( diff --git a/process/core/io/mfile/base.py b/process/core/io/mfile/base.py index d8c36a578..2bd7248c6 100644 --- a/process/core/io/mfile/base.py +++ b/process/core/io/mfile/base.py @@ -14,6 +14,7 @@ import numpy as np from process import data_structure +from process.core.model import DataStructure from process.core.solver import iteration_variables logger = logging.getLogger(__name__) @@ -581,7 +582,7 @@ def get_unit(variable_desc): return None -def get_mfile_initial_ixc_values(file_path: Path): +def get_mfile_initial_ixc_values(file_path: Path, data: DataStructure): """Initialise the input file and obtain the initial values of the iteration variables Parameters @@ -597,7 +598,7 @@ def get_mfile_initial_ixc_values(file_path: Path): from process.main import SingleRun # noqa:PLC0415 SingleRun(file_path.as_posix()) - iteration_variables.load_iteration_variables() + iteration_variables.load_iteration_variables(data) iteration_variable_names = [] iteration_variable_values = [] diff --git a/process/core/model.py b/process/core/model.py index 055989883..e7438d504 100644 --- a/process/core/model.py +++ b/process/core/model.py @@ -5,6 +5,7 @@ from process.data_structure.cost_variables import CostData from process.data_structure.cs_fatigue_variables import CSFatigueData from process.data_structure.first_wall_variables import FirstWallData +from process.data_structure.fwbs_variables import FWBSData from process.data_structure.vacuum_variables import VacuumData from process.data_structure.water_usage_variables import WaterUseData @@ -19,6 +20,7 @@ class DataStructure: vacuum: VacuumData = initialise_later costs: CostData = initialise_later first_wall: FirstWallData = initialise_later + fwbs: FWBSData = initialise_later def __post_init__(self): for f in fields(self): diff --git a/process/core/output.py b/process/core/output.py index 07982308d..c8d9530b2 100644 --- a/process/core/output.py +++ b/process/core/output.py @@ -6,7 +6,7 @@ ) -def write(models, _outfile): +def write(models, data, _outfile): """Write the results to the main output file (OUT.DAT). Write the program results to a file, in a tidy format. @@ -122,11 +122,11 @@ def write(models, _outfile): # First wall geometry models.fw.output() - if data_structure.fwbs_variables.i_blanket_type == 1: + if data.fwbs.i_blanket_type == 1: # CCFE HCPB model models.ccfe_hcpb.output() - elif data_structure.fwbs_variables.i_blanket_type == 5: + elif data.fwbs.i_blanket_type == 5: # DCLL model models.dcll.output() diff --git a/process/core/scan.py b/process/core/scan.py index 9515fc3fc..1c445127a 100644 --- a/process/core/scan.py +++ b/process/core/scan.py @@ -20,7 +20,6 @@ constraint_variables, current_drive_variables, divertor_variables, - fwbs_variables, global_variables, heat_transport_variables, impurity_radiation_module, @@ -1194,21 +1193,21 @@ def scan_select(self, nwp, swp, iscn): case 67: self.data.cs_fatigue.t_crack_vertical = swp[iscn - 1] case 68: - fwbs_variables.inlet_temp_liq = swp[iscn - 1] + self.data.fwbs.inlet_temp_liq = swp[iscn - 1] case 69: - fwbs_variables.outlet_temp_liq = swp[iscn - 1] + self.data.fwbs.outlet_temp_liq = swp[iscn - 1] case 70: - fwbs_variables.blpressure_liq = swp[iscn - 1] + self.data.fwbs.blpressure_liq = swp[iscn - 1] case 71: - fwbs_variables.n_liq_recirc = swp[iscn - 1] + self.data.fwbs.n_liq_recirc = swp[iscn - 1] case 72: - fwbs_variables.bz_channel_conduct_liq = swp[iscn - 1] + self.data.fwbs.bz_channel_conduct_liq = swp[iscn - 1] case 73: - fwbs_variables.pnuc_fw_ratio_dcll = swp[iscn - 1] + self.data.fwbs.pnuc_fw_ratio_dcll = swp[iscn - 1] case 74: - fwbs_variables.f_nuc_pow_bz_struct = swp[iscn - 1] + self.data.fwbs.f_nuc_pow_bz_struct = swp[iscn - 1] case 75: - fwbs_variables.dx_fw_module = swp[iscn - 1] + self.data.fwbs.dx_fw_module = swp[iscn - 1] case 76: heat_transport_variables.eta_turbine = swp[iscn - 1] case 77: diff --git a/process/core/solver/constraints.py b/process/core/solver/constraints.py index 7e3458335..fc1457136 100644 --- a/process/core/solver/constraints.py +++ b/process/core/solver/constraints.py @@ -1016,20 +1016,20 @@ def constraint_equation_37(constraint_registration, _data): @ConstraintManager.register_constraint(39, "K", "<=") -def constraint_equation_39(constraint_registration, _data): +def constraint_equation_39(constraint_registration, data): """Equation for first wall temperature upper limit temp_fw_max: maximum temperature of first wall material (K) (i_thermal_electric_conversion>1) temp_fw_peak: peak first wall temperature (K) """ - if data_structure.fwbs_variables.temp_fw_peak < 1.0: + if data.fwbs.temp_fw_peak < 1.0: raise ProcessValueError( "temp_fw_peak = 0 implies i_pulsed_plant=0; do not use constraint 39 if i_pulsed_plant=0" ) return leq( - data_structure.fwbs_variables.temp_fw_peak, - data_structure.fwbs_variables.temp_fw_max, + data.fwbs.temp_fw_peak, + data.fwbs.temp_fw_max, constraint_registration, ) @@ -1220,7 +1220,7 @@ def constraint_equation_51(constraint_registration, _data): @ConstraintManager.register_constraint(52, "", ">=") -def constraint_equation_52(constraint_registration, _data): +def constraint_equation_52(constraint_registration, data): """Equation for tritium breeding ratio lower limit The tritium breeding ratio is only calculated when using the IFE model. @@ -1234,35 +1234,35 @@ def constraint_equation_52(constraint_registration, _data): ) return geq( - data_structure.fwbs_variables.tbr, + data.fwbs.tbr, data_structure.constraint_variables.tbrmin, constraint_registration, ) @ConstraintManager.register_constraint(53, "neutron/m²", "<=") -def constraint_equation_53(constraint_registration, _data): +def constraint_equation_53(constraint_registration, data): """Equation for fast neutron fluence on TF coil upper limit nflutfmax: max fast neutron fluence on TF coil (n/m²) nflutf: peak fast neutron fluence on TF coil superconductor (n/m²) """ return leq( - data_structure.fwbs_variables.nflutf, + data.fwbs.nflutf, data_structure.constraint_variables.nflutfmax, constraint_registration, ) @ConstraintManager.register_constraint(54, "MW/m³", "<=") -def constraint_equation_54(constraint_registration, _data): +def constraint_equation_54(constraint_registration, data): """Equation for peak TF coil nuclear heating upper limit ptfnucmax: maximum nuclear heating in TF coil (MW/m³) ptfnucpm3: nuclear heating in the TF coil (MW/m³) (blktmodel>0) """ return leq( - data_structure.fwbs_variables.ptfnucpm3, + data.fwbs.ptfnucpm3, data_structure.constraint_variables.ptfnucmax, constraint_registration, ) @@ -1739,7 +1739,7 @@ def constraint_equation_85(constraint_registration, data): # The CP lifetime is equal to the tritium breeding blankets / FW one elif data.costs.i_cp_lifetime == 2: - bound = data_structure.fwbs_variables.life_blkt_fpy + bound = data.fwbs.life_blkt_fpy elif data.costs.i_cp_lifetime == 3: bound = data.costs.life_plant diff --git a/process/core/solver/iteration_variables.py b/process/core/solver/iteration_variables.py index bad8e701e..d661de082 100644 --- a/process/core/solver/iteration_variables.py +++ b/process/core/solver/iteration_variables.py @@ -7,13 +7,14 @@ from process import data_structure from process.core.exceptions import ProcessValueError +from process.core.model import DataStructure @dataclass class IterationVariable: name: str """The name of the variable""" - module: Any + module: str | Any """The Fortran module that this variable should be set on.""" lower_bound: float """The default lower bound of the iteration variable""" @@ -131,17 +132,13 @@ class IterationVariable: 94: IterationVariable( "dr_shld_outboard", data_structure.build_variables, 0.001, 10.00 ), - 98: IterationVariable( - "f_blkt_li6_enrichment", data_structure.fwbs_variables, 10.00, 100.0 - ), + 98: IterationVariable("f_blkt_li6_enrichment", "fwbs", 10.00, 100.0), 104: IterationVariable("fcwr", data_structure.constraint_variables, 0.001, 1.0), - 108: IterationVariable("breeder_f", data_structure.fwbs_variables, 0.060, 1.0), + 108: IterationVariable("breeder_f", "fwbs", 0.060, 1.0), 109: IterationVariable( "f_nd_alpha_electron", data_structure.physics_variables, 0.05, 0.15 ), - 114: IterationVariable( - "len_fw_channel", data_structure.fwbs_variables, 0.001, 1.0e3 - ), + 114: IterationVariable("len_fw_channel", "fwbs", 0.001, 1.0e3), 119: IterationVariable( "temp_plasma_separatrix_kev", data_structure.physics_variables, 0.0, 1.0e1 ), @@ -319,19 +316,27 @@ def check_iteration_variable(iteration_variable_value, name: str = ""): ) -def load_iteration_variables(): +def load_iteration_variables(data): """Loads the physics and engineering variables into the optimisation variable array.""" for i in range(data_structure.numerics.nvar): variable_index = data_structure.numerics.ixc[i] iteration_variable = ITERATION_VARIABLES[variable_index] # use ... as the default return value because None might be a valid return from Fortran? + + module = ( + getattr(data, iteration_variable.module) + if isinstance(iteration_variable.module, str) + else iteration_variable.module + ) + iteration_variable_value = getattr( - iteration_variable.module, + module, iteration_variable.target_name or iteration_variable.name, ..., ) + # If iteration variable is missing if iteration_variable_value is ...: error_msg = ( f"Could not get the value for iteration variable {variable_index} " @@ -382,7 +387,7 @@ def load_iteration_variables(): ) -def set_scaled_iteration_variable(xc, nn: int): +def set_scaled_iteration_variable(xc, nn: int, data: DataStructure): """Converts scaled iteration variables back to their real values and sets them in the code. Parameters @@ -391,7 +396,8 @@ def set_scaled_iteration_variable(xc, nn: int): scaled iteration variable values nn : number of iteration variables - + data: DataStructure + data structure """ for i in range(nn): # there is less error handling here than in load_iteration_variables @@ -402,21 +408,35 @@ def set_scaled_iteration_variable(xc, nn: int): ratio = xc[i] / data_structure.numerics.scale[i] + module = ( + getattr(data, iteration_variable.module) + if isinstance(iteration_variable.module, str) + else iteration_variable.module + ) + if iteration_variable.array_index is None: - setattr( - iteration_variable.module, - iteration_variable.target_name or iteration_variable.name, - ratio, - ) + if isinstance(iteration_variable.module, str): + setattr( + module, + iteration_variable.target_name or iteration_variable.name, + ratio, + ) + else: + setattr( + module, + iteration_variable.target_name or iteration_variable.name, + ratio, + ) + else: current_array = getattr( - iteration_variable.module, + module, iteration_variable.target_name or iteration_variable.name, ) new_array = deepcopy(current_array) new_array[iteration_variable.array_index] = ratio setattr( - iteration_variable.module, + module, iteration_variable.target_name or iteration_variable.name, new_array, ) diff --git a/process/core/solver/solver_handler.py b/process/core/solver/solver_handler.py index f98f147f4..5094c5a9e 100644 --- a/process/core/solver/solver_handler.py +++ b/process/core/solver/solver_handler.py @@ -31,7 +31,7 @@ def __init__(self, models, solver_name, data): def run(self): """Run solver and retry if it fails in certain ways.""" # Initialise iteration variables and bounds in Fortran - load_iteration_variables() + load_iteration_variables(self.data) load_scaled_bounds() # Initialise iteration variables and bounds in Python: relies on Fortran diff --git a/process/data_structure/fwbs_variables.py b/process/data_structure/fwbs_variables.py index b4a58ad3f..4ac163e17 100644 --- a/process/data_structure/fwbs_variables.py +++ b/process/data_structure/fwbs_variables.py @@ -5,1311 +5,726 @@ - """ -life_blkt_fpy: float = None -"""Full power blanket lifetime (years)""" +from dataclasses import dataclass, field -life_blkt: float = None -"""Calendar year blanket lifetime (years)""" +@dataclass +class FWBSData: + life_blkt_fpy: float = 0.0 + """Full power blanket lifetime (years)""" + life_blkt: float = 0.0 + """Calendar year blanket lifetime (years)""" -m_fw_blkt_div_coolant_total: float = None -"""mass of water coolant (in shield, blanket, first wall, divertor) [kg]""" + m_fw_blkt_div_coolant_total: float = 0.0 + """mass of water coolant (in shield, blanket, first wall, divertor) [kg]""" + m_vv: float = 0.0 + """vacuum vessel mass [kg]""" -m_vv: float = None -"""vacuum vessel mass [kg]""" + den_steel: float = 7800.0 + """density of steel [kg m^-3]""" + denwc: float = 15630.0 + """density of tungsten carbide [kg m^-3]""" -den_steel: float = None -"""density of steel [kg m^-3]""" + dewmkg: float = 0.0 + """total mass of vacuum vessel + cryostat [kg] (calculated if blktmodel>0)""" + f_p_blkt_multiplication: float = 1.269 + """energy multiplication in blanket and shield""" -denwc: float = None -"""density of tungsten carbide [kg m^-3]""" + p_blkt_multiplication_mw: float = 0.0 + """power due to energy multiplication in blanket and shield [MW]""" + fblss: float = 0.09705 + """KIT blanket model: steel fraction of breeding zone""" -dewmkg: float = None -"""total mass of vacuum vessel + cryostat [kg] (calculated if blktmodel>0)""" + f_ster_div_single: float = 0.115 + """Solid angle fraction taken by one divertor""" + f_a_fw_outboard_hcd: float = 0.0 + """area fraction of first wall covered by heating/current drive apparatus plus diagnostics""" -f_p_blkt_multiplication: float = None -"""energy multiplication in blanket and shield""" + fhole: float = 0.0 + """area fraction taken up by other holes (IFE)""" + i_fw_blkt_vv_shape: int = 2 + """switch for first wall, blanket, shield and vacuum vessel shape: + - =1 D-shaped (cylinder inboard + ellipse outboard) + - =2 defined by two ellipses + """ -p_blkt_multiplication_mw: float = None -"""power due to energy multiplication in blanket and shield [MW]""" + life_fw_fpy: float = 0.0 + """first wall full-power year lifetime (y)""" + m_fw_total: float = 0.0 + """first wall mass [kg]""" -fblss: float = None -"""KIT blanket model: steel fraction of breeding zone""" + fw_armour_mass: float = 0.0 + """first wall armour mass [kg]""" + fw_armour_thickness: float = 0.005 + """first wall armour thickness [m]""" -f_ster_div_single: float = None -"""Solid angle fraction taken by one divertor""" + fw_armour_vol: float = 0.0 + """first wall armour volume [m^3]""" + i_blanket_type: int = 1 + """switch for blanket model: + - =1 CCFE HCPB model + - =2 KIT HCPB model # REMOVED, no longer usable + - =3 CCFE HCPB model with Tritium Breeding Ratio calculation # REMOVED, no longer usable + - =4 KIT HCLL model # REMOVED, no longer usable + - =5 DCLL model - no nutronics model included (in development) please check/choose values for + 'dual-coolant blanket' fractions (provided in this file). + - please use i_p_coolant_pumping = 0 or 1. + """ -f_a_fw_outboard_hcd: float = None -"""area fraction of first wall covered by heating/current drive apparatus plus diagnostics""" + i_blkt_inboard: int = 1 + """switch for inboard blanket: + - =0 No inboard blanket (dr_blkt_inboard=0.0) + - =1 Inboard blanket present + """ + inuclear: int = 0 + """switch for nuclear heating in the coils: + - =0 Frances Fox model (default) + - =1 Fixed by user (qnuc) + """ -fhole: float = None -"""area fraction taken up by other holes (IFE)""" + qnuc: float = 0.0 + """nuclear heating in the coils (W) (`inuclear=1`)""" + f_blkt_li6_enrichment: float = 30.0 + """lithium-6 enrichment of breeding material (%)""" -i_fw_blkt_vv_shape: int = None -"""switch for first wall, blanket, shield and vacuum vessel shape: -- =1 D-shaped (cylinder inboard + ellipse outboard) -- =2 defined by two ellipses -""" - - -life_fw_fpy: float = None -"""first wall full-power year lifetime (y)""" - - -m_fw_total: float = None -"""first wall mass [kg]""" - - -fw_armour_mass: float = None -"""first wall armour mass [kg]""" - - -fw_armour_thickness: float = None -"""first wall armour thickness [m]""" - - -fw_armour_vol: float = None -"""first wall armour volume [m^3]""" - - -i_blanket_type: int = None -"""switch for blanket model: -- =1 CCFE HCPB model -- =2 KIT HCPB model # REMOVED, no longer usable -- =3 CCFE HCPB model with Tritium Breeding Ratio calculation # REMOVED, no longer usable -- =4 KIT HCLL model # REMOVED, no longer usable -- =5 DCLL model - no nutronics model included (in development) please check/choose values for -'dual-coolant blanket' fractions (provided in this file). -- please use i_p_coolant_pumping = 0 or 1. -""" - - -i_blkt_inboard: int = None -"""switch for inboard blanket: -- =0 No inboard blanket (dr_blkt_inboard=0.0) -- =1 Inboard blanket present -""" - - -inuclear: int = None -"""switch for nuclear heating in the coils: -- =0 Frances Fox model (default) -- =1 Fixed by user (qnuc) -""" - - -qnuc: float = None -"""nuclear heating in the coils (W) (`inuclear=1`)""" - - -f_blkt_li6_enrichment: float = None -"""lithium-6 enrichment of breeding material (%)""" - - -p_blkt_nuclear_heat_total_mw: float = None -"""nuclear heating in the blanket [MW]""" - - -pnuc_cp: float = None -"""Total nuclear heating in the ST centrepost [MW]""" - - -p_cp_shield_nuclear_heat_mw: float = None -"""Neutronic shield nuclear heating in the ST centrepost [MW]""" - - -pnuc_cp_tf: float = None -"""TF neutronic nuclear heating in the ST centrepost [MW]""" - - -p_div_nuclear_heat_total_mw: float = None -"""nuclear heating in the divertor [MW]""" - - -p_fw_nuclear_heat_total_mw: float = None -"""nuclear heating in the first wall [MW]""" - - -p_fw_hcd_nuclear_heat_mw: float = None -"""Nuclear heating in the HCD apparatus and diagnostics on the first wall [MW]""" - - -pnucloss: float = None -"""nuclear heating lost via holes [MW]""" - - -pnucvvplus: float = None -"""nuclear heating to vacuum vessel and beyond [MW]""" - - -p_shld_nuclear_heat_mw: float = None -"""nuclear heating in the shield [MW]""" - - -m_blkt_total: float = None -"""mass of blanket [kg]""" - - -m_blkt_steel_total: float = None -"""mass of blanket - steel part [kg]""" - - -armour_fw_bl_mass: float = None -"""Total mass of armour, first wall and blanket [kg]""" - - -# CCFE HCPB Blanket Model i_blanket_type=1 - - -breeder_f: float = None -"""Volume ratio: Li4SiO4/(Be12Ti+Li4SiO4) (`iteration variable 108`)""" + p_blkt_nuclear_heat_total_mw: float = 0.0 + """nuclear heating in the blanket [MW]""" + pnuc_cp: float = 0.0 + """Total nuclear heating in the ST centrepost [MW]""" -breeder_multiplier: float = None -"""combined breeder/multipler fraction of blanket by volume""" + p_cp_shield_nuclear_heat_mw: float = 0.0 + """Neutronic shield nuclear heating in the ST centrepost [MW]""" + pnuc_cp_tf: float = 0.0 + """TF neutronic nuclear heating in the ST centrepost [MW]""" -vfcblkt: float = None -"""He coolant fraction of blanket by volume (`i_blanket_type= 1` (CCFE HCPB))""" + p_div_nuclear_heat_total_mw: float = 0.0 + """nuclear heating in the divertor [MW]""" + p_fw_nuclear_heat_total_mw: float = 0.0 + """nuclear heating in the first wall [MW]""" -vfpblkt: float = None -"""He purge gas fraction of blanket by volume (`i_blanket_type= 1` (CCFE HCPB))""" + p_fw_hcd_nuclear_heat_mw: float = 0.0 + """Nuclear heating in the HCD apparatus and diagnostics on the first wall [MW]""" + pnucloss: float = 0.0 + """nuclear heating lost via holes [MW]""" -m_blkt_li4sio4: float = None -"""mass of lithium orthosilicate in blanket [kg] (`i_blanket_type=1` (CCFE HCPB))""" + pnucvvplus: float = 0.0 + """nuclear heating to vacuum vessel and beyond [MW]""" + p_shld_nuclear_heat_mw: float = 0.0 + """nuclear heating in the shield [MW]""" -m_blkt_tibe12: float = None -"""mass of titanium beryllide in blanket [kg] (`i_blanket_type=1` (CCFE HCPB))""" + m_blkt_total: float = 0.0 + """mass of blanket [kg]""" + m_blkt_steel_total: float = 0.0 + """mass of blanket - steel part [kg]""" -neut_flux_cp: float = None -"""Centrepost TF fast neutron flux (E > 0.1 MeV) [m^(-2).^(-1)] -This variable is only calculated for superconducting (i_tf_sup = 1 ) -spherical tokamal magnet designs (itart = 0) -""" - - -f_neut_shield: float = None -"""Fraction of nuclear power shielded before the CP magnet (ST) -( neut_absorb = -1 --> a fit on simplified MCNP neutronic -calculation is used assuming water cooled (13%) tungesten carbyde ) -""" - - -f_a_fw_coolant_inboard: float = None -"""Inboard FW coolant cross-sectional area void fraction""" - - -f_a_fw_coolant_outboard: float = None -"""Outboard FW coolant cross-sectional area void fraction""" - - -psurffwi: float = None -"""Surface heat flux on first wall [MW] (sum = p_fw_rad_total_mw)""" - - -psurffwo: float = None -"""Surface heat flux on first wall [MW] (sum = p_fw_rad_total_mw)""" - - -vol_fw_total: float = None -"""First wall volume [m3]""" - - -f_vol_blkt_steel: float = None -"""Fractions of blanket by volume: steel""" - - -f_vol_blkt_li4sio4: float = None -"""Fractions of blanket by volume: lithium orthosilicate""" - - -f_vol_blkt_tibe12: float = None -"""Fractions of blanket by volume: titanium beryllide""" - - -breedmat: int = None -"""breeder material switch: -- =1 Lithium orthosilicate -- =2 Lithium methatitanate -- =3 Lithium zirconate -""" - - -densbreed: float = None -"""density of breeder material [kg m^-3]""" - - -fblbe: float = None -"""beryllium fraction of blanket by volume""" + armour_fw_bl_mass: float = 0.0 + """Total mass of armour, first wall and blanket [kg]""" + # CCFE HCPB Blanket Model i_blanket_type=1 -fblbreed: float = None -"""breeder fraction of blanket breeding zone by volume""" + breeder_f: float = 0.5 + """Volume ratio: Li4SiO4/(Be12Ti+Li4SiO4) (`iteration variable 108`)""" + breeder_multiplier: float = 0.75 + """combined breeder/multipler fraction of blanket by volume""" -fblhebmi: float = None -"""helium fraction of inboard blanket box manifold by volume""" + vfcblkt: float = 0.05295 + """He coolant fraction of blanket by volume (`i_blanket_type= 1` (CCFE HCPB))""" + vfpblkt: float = 0.1 + """He purge gas fraction of blanket by volume (`i_blanket_type= 1` (CCFE HCPB))""" -fblhebmo: float = None -"""helium fraction of outboard blanket box manifold by volume """ + m_blkt_li4sio4: float = 0.0 + """mass of lithium orthosilicate in blanket [kg] (`i_blanket_type=1` (CCFE HCPB))""" + m_blkt_tibe12: float = 0.0 + """mass of titanium beryllide in blanket [kg] (`i_blanket_type=1` (CCFE HCPB))""" -fblhebpi: float = None -"""helium fraction of inboard blanket back plate by volume """ + neut_flux_cp: float = 0.0 + """Centrepost TF fast neutron flux (E > 0.1 MeV) [m^(-2).^(-1)] + This variable is only calculated for superconducting (i_tf_sup = 1 ) + spherical tokamal magnet designs (itart = 0) + """ + f_neut_shield: float = -1.0 + """Fraction of nuclear power shielded before the CP magnet (ST) + ( neut_absorb = -1 --> a fit on simplified MCNP neutronic + calculation is used assuming water cooled (13%) tungesten carbyde ) + """ -fblhebpo: float = None -"""helium fraction of outboard blanket back plate by volume """ + f_a_fw_coolant_inboard: float = 0.0 + """Inboard FW coolant cross-sectional area void fraction""" + f_a_fw_coolant_outboard: float = 0.0 + """Outboard FW coolant cross-sectional area void fraction""" -hcdportsize: int = None -"""switch for size of heating/current drive ports : -- =1 'small' -- =2 'large' -""" + psurffwi: float = 0.0 + """Surface heat flux on first wall [MW] (sum = p_fw_rad_total_mw)""" + psurffwo: float = 0.0 + """Surface heat flux on first wall [MW] (sum = p_fw_rad_total_mw)""" -nflutf: float = None -"""peak fast neutron fluence on TF coil superconductor [n m^-2] """ + vol_fw_total: float = 0.0 + """First wall volume [m3]""" + f_vol_blkt_steel: float = 0.0 + """Fractions of blanket by volume: steel""" -npdiv: int = None -"""number of divertor ports """ + f_vol_blkt_li4sio4: float = 0.0 + """Fractions of blanket by volume: lithium orthosilicate""" + f_vol_blkt_tibe12: float = 0.0 + """Fractions of blanket by volume: titanium beryllide""" -nphcdin: int = None -"""number of inboard ports for heating/current drive """ + breedmat: int = 1 + """breeder material switch: + - =1 Lithium orthosilicate + - =2 Lithium methatitanate + - =3 Lithium zirconate + """ + densbreed: float = 0.0 + """density of breeder material [kg m^-3]""" -nphcdout: int = None -"""number of outboard ports for heating/current drive """ + fblbe: float = 0.6 + """beryllium fraction of blanket by volume""" + fblbreed: float = 0.154 + """breeder fraction of blanket breeding zone by volume""" -tbr: float = None -"""tritium breeding ratio""" + fblhebmi: float = 0.4 + """helium fraction of inboard blanket box manifold by volume""" + fblhebmo: float = 0.4 + """helium fraction of outboard blanket box manifold by volume """ -tritprate: float = None -"""tritium production rate [g day^-1] """ + fblhebpi: float = 0.6595 + """helium fraction of inboard blanket back plate by volume """ + fblhebpo: float = 0.6713 + """helium fraction of outboard blanket back plate by volume """ -wallpf: float = None -"""neutron wall load peaking factor """ + hcdportsize: int = 1 + """switch for size of heating/current drive ports : + - =1 'small' + - =2 'large' + """ + nflutf: float = 0.0 + """peak fast neutron fluence on TF coil superconductor [n m^-2] """ -whtblbreed: float = None -"""mass of blanket - breeder part [kg] """ + npdiv: int = 2 + """number of divertor ports """ + nphcdin: int = 2 + """number of inboard ports for heating/current drive """ -m_blkt_beryllium: float = None -"""mass of blanket - beryllium part [kg]""" + nphcdout: int = 2 + """number of outboard ports for heating/current drive """ + tbr: float = 0.0 + """tritium breeding ratio""" -i_p_coolant_pumping: int = None -"""Switch for pumping power for primary coolant (mechanical power only and peak first wall -temperature is only calculated if `i_p_coolant_pumping=2`): -- =0 User sets pump power directly (p_blkt_coolant_pump_mw, p_fw_coolant_pump_mw, p_div_coolant_pump_mw, p_shld_coolant_pump_mw) -- =1 User sets pump power as a fraction of thermal power (f_p_blkt_coolant_pump_total_heat, f_p_fw_coolant_pump_total_heat, f_p_div_coolant_pump_total_heat, f_p_shld_coolant_pump_total_heat) -- =2 Mechanical pumping power is calculated -- =3 Mechanical pumping power is calculated using specified pressure drop -""" + tritprate: float = 0.0 + """tritium production rate [g day^-1] """ + wallpf: float = 1.21 + """neutron wall load peaking factor """ -i_shield_mat: int = None -"""Switch for shield material - *currently only applied in costing routines* `cost_model = 2` -- =0 Tungsten (default) -- =1 Tungsten carbide -""" + whtblbreed: float = 0.0 + """mass of blanket - breeder part [kg] """ + m_blkt_beryllium: float = 0.0 + """mass of blanket - beryllium part [kg]""" -i_thermal_electric_conversion: int = None -"""Switch for power conversion cycle: -- =0 Set efficiency for chosen blanket, from detailed models (divertor heat not used) -- =1 Set efficiency for chosen blanket, from detailed models (divertor heat used) -- =2 user input thermal-electric efficiency (eta_turbine) -- =3 steam Rankine cycle -- =4 supercritical CO2 cycle -""" + i_p_coolant_pumping: int = 2 + """Switch for pumping power for primary coolant (mechanical power only and peak first wall + temperature is only calculated if `i_p_coolant_pumping=2`): + - =0 User sets pump power directly (p_blkt_coolant_pump_mw, p_fw_coolant_pump_mw, p_div_coolant_pump_mw, p_shld_coolant_pump_mw) + - =1 User sets pump power as a fraction of thermal power (f_p_blkt_coolant_pump_total_heat, f_p_fw_coolant_pump_total_heat, f_p_div_coolant_pump_total_heat, f_p_shld_coolant_pump_total_heat) + - =2 Mechanical pumping power is calculated + - =3 Mechanical pumping power is calculated using specified pressure drop + """ + i_shield_mat: int = 0 + """Switch for shield material - *currently only applied in costing routines* `cost_model = 2` + - =0 Tungsten (default) + - =1 Tungsten carbide + """ -secondary_cycle_liq: int = None -"""Switch for power conversion cycle for the liquid breeder component of the blanket: -- =2 user input thermal-electric efficiency (eta_turbine) -- =4 supercritical CO2 cycle -""" + i_thermal_electric_conversion: int = 0 + """Switch for power conversion cycle: + - =0 Set efficiency for chosen blanket, from detailed models (divertor heat not used) + - =1 Set efficiency for chosen blanket, from detailed models (divertor heat used) + - =2 user input thermal-electric efficiency (eta_turbine) + - =3 steam Rankine cycle + - =4 supercritical CO2 cycle + """ + secondary_cycle_liq: int = 4 + """Switch for power conversion cycle for the liquid breeder component of the blanket: + - =2 user input thermal-electric efficiency (eta_turbine) + - =4 supercritical CO2 cycle + """ -i_blkt_coolant_type: int = None -"""Switch for blanket coolant (set via blkttype): -- =1 helium -- =2 pressurized water -""" + i_blkt_coolant_type: int = 1 + """Switch for blanket coolant (set via blkttype): + - =1 helium + - =2 pressurized water + """ + i_fw_coolant_type: str = "helium" + """switch for first wall coolant (can be different from blanket coolant): + - 'helium' + - 'water' + """ -i_fw_coolant_type: str = None -"""switch for first wall coolant (can be different from blanket coolant): -- 'helium' -- 'water' -""" + dr_fw_wall: float = 0.003 + """wall thickness of first wall coolant channels [m]""" + radius_fw_channel: float = 0.006 + """radius of first wall cooling channels [m]""" -dr_fw_wall: float = None -"""wall thickness of first wall coolant channels [m]""" + dx_fw_module: float = 0.02 + """Width of a FW module containing a cooling channel [m]""" + temp_fw_coolant_in: float = 573.0 + """inlet temperature of first wall coolant [K]""" -radius_fw_channel: float = None -"""radius of first wall cooling channels [m]""" + temp_fw_coolant_out: float = 823.0 + """outlet temperature of first wall coolant [K]""" + pres_fw_coolant: float = 15.5e6 + """first wall coolant pressure [Pa] (`i_thermal_electric_conversion>1`)""" -dx_fw_module: float = None -"""Width of a FW module containing a cooling channel [m]""" + temp_fw_peak: float = 873.0 + """peak first wall temperature [K]""" + roughness_fw_channel: float = 1.0e-6 + """first wall channel roughness epsilon [m]""" -temp_fw_coolant_in: float = None -"""inlet temperature of first wall coolant [K]""" + len_fw_channel: float = 4.0 + """Length of a single first wall channel (all in parallel) [m] + (`iteration variable 114`, useful for `constraint equation 39`) + """ + f_fw_peak: float = 1.0 + """peaking factor for first wall heat loads. (Applied separately to inboard and outboard loads. + Applies to both neutron and surface loads. Only used to calculate peak temperature - not + the coolant flow rate.) + """ -temp_fw_coolant_out: float = None -"""outlet temperature of first wall coolant [K]""" + pres_blkt_coolant: float = 15.50e6 + """blanket coolant pressure [Pa] (`i_thermal_electric_conversion>1`)""" + temp_blkt_coolant_in: float = 573.0 + """inlet temperature of blanket coolant [K] (`i_thermal_electric_conversion>1`)""" -pres_fw_coolant: float = None -"""first wall coolant pressure [Pa] (`i_thermal_electric_conversion>1`)""" + temp_blkt_coolant_out: float = 823.0 + """Outlet temperature of blanket coolant [K] (`i_thermal_electric_conversion>1`) + - input if `i_blkt_coolant_type=1` (helium) + - calculated if `i_blkt_coolant_type=2` (water) + """ + coolp: float = 15.5e6 + """blanket coolant pressure [Pa] (stellarator only)""" -temp_fw_peak: float = None -"""peak first wall temperature [K]""" + n_blkt_outboard_modules_poloidal: int = 8 + """number of outboard blanket modules in poloidal direction (`i_thermal_electric_conversion>1`)""" + n_blkt_inboard_modules_poloidal: int = 7 + """number of inboard blanket modules in poloidal direction (`i_thermal_electric_conversion>1`)""" -roughness_fw_channel: float = None -"""first wall channel roughness epsilon [m]""" + n_blkt_outboard_modules_toroidal: int = 48 + """number of outboard blanket modules in toroidal direction (`i_thermal_electric_conversion>1`)""" + n_blkt_inboard_modules_toroidal: int = 32 + """number of inboard blanket modules in toroidal direction (`i_thermal_electric_conversion>1`)""" -len_fw_channel: float = None -"""Length of a single first wall channel (all in parallel) [m] -(`iteration variable 114`, useful for `constraint equation 39`) -""" + temp_fw_max: float = 823.0 + """maximum temperature of first wall material [K] (`i_thermal_electric_conversion>1`)""" + fw_th_conductivity: float = 28.34 + """thermal conductivity of first wall material at 293 K (W/m/K) (Temperature dependence + is as for unirradiated Eurofer) + """ -f_fw_peak: float = None -"""peaking factor for first wall heat loads. (Applied separately to inboard and outboard loads. -Applies to both neutron and surface loads. Only used to calculate peak temperature - not -the coolant flow rate.) -""" + fvoldw: float = 1.74 + """area coverage factor for vacuum vessel volume""" + fvolsi: float = 1.0 + """area coverage factor for inboard shield volume""" -pres_blkt_coolant: float = None -"""blanket coolant pressure [Pa] (`i_thermal_electric_conversion>1`)""" + fvolso: float = 0.64 + """area coverage factor for outboard shield volume""" + fwclfr: float = 0.15 + """first wall coolant fraction (calculated if `i_pulsed_plant=1` or `ipowerflow=1`)""" -temp_blkt_coolant_in: float = None -"""inlet temperature of blanket coolant [K] (`i_thermal_electric_conversion>1`)""" + p_div_rad_total_mw: float = 0.0 + """Total radiation power incident on the divertor(s) (MW)""" + p_fw_rad_total_mw: float = 0.0 + """Radiation power incident on the first wall (MW)""" -temp_blkt_coolant_out: float = None -"""Outlet temperature of blanket coolant [K] (`i_thermal_electric_conversion>1`) -- input if `i_blkt_coolant_type=1` (helium) -- calculated if `i_blkt_coolant_type=2` (water) -""" + p_fw_hcd_rad_total_mw: float = 0.0 + """Radiation power incident on the heating and current drive systems on the first wall (MW)""" + pradloss: float = 0.0 + """Radiation power lost through holes (eventually hits shield) (MW) + Only used for stellarator + """ -coolp: float = None -"""blanket coolant pressure [Pa] (stellarator only)""" + p_tf_nuclear_heat_mw: float = 0.0 + """nuclear heating in the TF coil (MW)""" + ptfnucpm3: float = 0.0 + """nuclear heating in the TF coil (MW/m3) (`blktmodel>0`)""" -n_blkt_outboard_modules_poloidal: int = None -"""number of outboard blanket modules in poloidal direction (`i_thermal_electric_conversion>1`)""" + r_cryostat_inboard: float = 0.0 + """cryostat radius [m]""" + z_cryostat_half_inside: float = 0.0 + """cryostat height [m]""" -n_blkt_inboard_modules_poloidal: int = None -"""number of inboard blanket modules in poloidal direction (`i_thermal_electric_conversion>1`)""" + dr_pf_cryostat: float = 0.5 + """Radial distance between outer edge of furthest away PF coil (or stellarator + modular coil) and cryostat [m] + """ + vol_cryostat: float = 0.0 + """Cryostat structure volume [m^3]""" -n_blkt_outboard_modules_toroidal: int = None -"""number of outboard blanket modules in toroidal direction (`i_thermal_electric_conversion>1`)""" + vol_cryostat_internal: float = 0.0 + """Internal volume of the cryostat [m^3]""" + vol_vv: float = 0.0 + """vacuum vessel volume [m^3]""" -n_blkt_inboard_modules_toroidal: int = None -"""number of inboard blanket modules in toroidal direction (`i_thermal_electric_conversion>1`)""" + vfshld: float = 0.25 + """coolant void fraction in shield""" + vol_blkt_total: float = 0.0 + """volume of blanket [m^3]""" -temp_fw_max: float = None -"""maximum temperature of first wall material [K] (`i_thermal_electric_conversion>1`)""" + vol_blkt_total_full_coverage: float = 0.0 + """Volume of blanket with no holes or ports (toroidally continuous) [m³]""" + vol_blkt_inboard: float = 0.0 + """volume of inboard blanket [m^3]""" -fw_th_conductivity: float = None -"""thermal conductivity of first wall material at 293 K (W/m/K) (Temperature dependence -is as for unirradiated Eurofer) -""" + vol_blkt_inboard_full_coverage: float = 0.0 + """Volume of inboard blanket with no holes or ports (toroidally continuous) [m³]""" + vol_blkt_outboard: float = 0.0 + """volume of outboard blanket [m^3]""" -fvoldw: float = None -"""area coverage factor for vacuum vessel volume""" + vol_blkt_outboard_full_coverage: float = 0.0 + """Volume of outboard blanket with no holes or ports (toroidally continuous) [m³]""" + vol_shld_total: float = 0.0 + """volume of shield [m^3]""" -fvolsi: float = None -"""area coverage factor for inboard shield volume""" + whtshld: float = 0.0 + """mass of shield [kg]""" + wpenshld: float = 0.0 + """mass of the penetration shield [kg]""" -fvolso: float = None -"""area coverage factor for outboard shield volume""" + wtshldi: float = 0.0 + """mass of inboard shield [kg]""" + wtshldo: float = 0.0 + """mass of outboard shield [kg]""" -fwclfr: float = None -"""first wall coolant fraction (calculated if `i_pulsed_plant=1` or `ipowerflow=1`)""" + irefprop: int = 1 + """Switch to use REFPROP routines (stellarator only)""" + fblli: float = 0.0 + """lithium fraction of blanket by volume (stellarator only)""" -p_div_rad_total_mw: float = None -"""Total radiation power incident on the divertor(s) (MW)""" + fblli2o: float = 0.08 + """lithium oxide fraction of blanket by volume (stellarator only)""" + fbllipb: float = 0.68 + """lithium lead fraction of blanket by volume (stellarator only)""" -p_fw_rad_total_mw: float = None -"""Radiation power incident on the first wall (MW)""" + fblvd: float = 0.0 + """vanadium fraction of blanket by volume (stellarator only)""" + m_blkt_li2o: float = 0.0 + """mass of blanket - Li_2O part [kg]""" -p_fw_hcd_rad_total_mw: float = None -"""Radiation power incident on the heating and current drive systems on the first wall (MW)""" + wtbllipb: float = 0.0 + """mass of blanket - Li-Pb part [kg]""" + m_blkt_vanadium: float = 0.0 + """mass of blanket - vanadium part [kg]""" -pradloss: float = None -"""Radiation power lost through holes (eventually hits shield) (MW) -Only used for stellarator -""" + m_blkt_lithium: float = 0.0 + """mass of blanket - lithium part [kg]""" + f_a_blkt_cooling_channels: float = 0.25 + """coolant void fraction in blanket.""" -p_tf_nuclear_heat_mw: float = None -"""nuclear heating in the TF coil (MW)""" + blktmodel: int = 0 + """switch for blanket/tritium breeding model (see i_blanket_type): + - =0 original simple model + - =1 KIT model based on a helium-cooled pebble-bed blanket (HCPB) reference design + """ + declblkt: float = 0.075 + """neutron power deposition decay length of blanket structural material [m] (stellarators only)""" -ptfnucpm3: float = None -"""nuclear heating in the TF coil (MW/m3) (`blktmodel>0`)""" + declfw: float = 0.075 + """neutron power deposition decay length of first wall structural material [m] (stellarators only)""" + declshld: float = 0.075 + """neutron power deposition decay length of shield structural material [m] (stellarators only)""" -r_cryostat_inboard: float = None -"""cryostat radius [m]""" + blkttype: int = 3 + """Switch for blanket type: + - =1 WCLL; + - =2 HCLL; efficiency taken from M. Kovari 2016 + "PROCESS": A systems code for fusion power plants - Part 2: Engineering + https://www.sciencedirect.com/science/article/pii/S0920379616300072 + Feedheat & reheat cycle assumed + - =3 HCPB; efficiency taken from M. Kovari 2016 + "PROCESS": A systems code for fusion power plants - Part 2: Engineering + https://www.sciencedirect.com/science/article/pii/S0920379616300072 + Feedheat & reheat cycle assumed + """ + etaiso: float = 0.85 + """isentropic efficiency of FW and blanket coolant pumps""" -z_cryostat_half_inside: float = None -"""cryostat height [m]""" + eta_coolant_pump_electric: float = 0.95 + """electrical efficiency of primary coolant pumps""" + i_fw_blkt_shared_coolant: int = 0 + """Switch for whether the FW and BB are on the same pump system + i.e. do they have the same primary coolant or not + - =0 FW and BB have the same primary coolant, flow = FWin->FWout->BBin->BBout + - =1 FW and BB have the different primary coolant and are on different pump systems + """ -dr_pf_cryostat: float = None -"""Radial distance between outer edge of furthest away PF coil (or stellarator -modular coil) and cryostat [m] -""" + i_blkt_liquid_breeder_type: int = 0 + """Switch for Liquid Metal Breeder Material + - =0 PbLi + - =1 Li + """ + i_blkt_dual_coolant: int = 0 + """Switch to specify whether breeding blanket is single-cooled or dual-coolant. + - =0 Single coolant used for FW and Blanket (H2O or He). Solid Breeder. + - =1 Single coolant used for FW and Blanket (H2O or He). Liquid metal breeder + circulted for tritium extraction. + - =2 Dual coolant: primary coolant (H2O or He) for FW and blanket structure; + secondary coolant is self-cooled liquid metal breeder. + """ -vol_cryostat: float = None -"""Cryostat structure volume [m^3]""" + i_blkt_liquid_breeder_channel_type: int = 0 + """Switch for Flow Channel Insert (FCI) type if liquid metal breeder blanket. + - =0 Thin conducting walls, default electrical conductivity (bz_channel_conduct_liq) is Eurofer + - =1 Insulating Material, assumed perfect electrical insulator, default density (den_ceramic) is for SiC + - =2 Insulating Material, electrical conductivity (bz_channel_conduct_liq) is input (default Eurofer), default density (den_ceramic) is for SiC + """ + i_blkt_module_segmentation: int = 0 + """Switch for Multi Module Segment (MMS) or Single Modle Segment (SMS) + - =0 MMS + - =1 SMS + """ -vol_cryostat_internal: float = None -"""Internal volume of the cryostat [m^3]""" + n_liq_recirc: int = 10 + """Number of liquid metal breeder recirculations per day, for use with i_blkt_dual_coolant=1""" + r_f_liq_ib: float = 0.5 + """Radial fraction of BZ liquid channels""" -vol_vv: float = None -"""vacuum vessel volume [m^3]""" + r_f_liq_ob: float = 0.5 + """Radial fraction of BZ liquid channels""" + w_f_liq_ib: float = 0.5 + """Toroidal fraction of BZ liquid channels""" -vfshld: float = None -"""coolant void fraction in shield""" + w_f_liq_ob: float = 0.5 + """Toroidal fraction of BZ liquid channels""" + den_ceramic: float = 3.21e3 + """FCI material density""" -vol_blkt_total: float = None -"""volume of blanket [m^3]""" + th_wall_secondary: float = 1.25e-2 + """Liquid metal coolant/breeder wall thickness thin conductor or FCI [m]""" -vol_blkt_total_full_coverage: float = None -"""Volume of blanket with no holes or ports (toroidally continuous) [m³]""" + bz_channel_conduct_liq: float = 8.33e5 + """Liquid metal coolant/breeder thin conductor or FCI wall conductance [A V^-1 m^-1]""" + a_bz_liq: float = 0.2 + """Toroidal width of the rectangular cooling channel [m] for long poloidal sections of blanket breeding zone""" -vol_blkt_inboard: float = None -"""volume of inboard blanket [m^3]""" + b_bz_liq: float = 0.2 + """Radial width of the rectangular cooling channel [m] for long poloidal sections of blanket breeding zone""" -vol_blkt_inboard_full_coverage: float = None -"""Volume of inboard blanket with no holes or ports (toroidally continuous) [m³]""" + nopol: int = 2 + """Number of poloidal sections in a liquid metal breeder/coolant channel for module/segment""" + nopipes: int = 4 + """Number of Liquid metal breeder/coolant channels per module/segment""" -vol_blkt_outboard: float = None -"""volume of outboard blanket [m^3]""" + den_liq: float = 9.5e3 + """Liquid metal breeder/coolant density [kg m^-3]""" -vol_blkt_outboard_full_coverage: float = None -"""Volume of outboard blanket with no holes or ports (toroidally continuous) [m³]""" + wht_liq: float = 0.0 + """Liquid metal""" + wht_liq_ib: float = 0.0 + """Liquid metal""" -vol_shld_total: float = None -"""volume of shield [m^3]""" + wht_liq_ob: float = 0.0 + """Liquid metal""" + specific_heat_liq: float = 1.9e2 + """Liquid metal breeder/coolant specific heat [J kg^-1 K^-1]""" -whtshld: float = None -"""mass of shield [kg]""" + thermal_conductivity_liq: float = 30.0 + """Liquid metal breeder/coolant thermal conductivity [W m^-1 K^-1]""" + dynamic_viscosity_liq: float = 0.0 + """Liquid metal breeder/coolant dynamic viscosity [Pa s]""" -wpenshld: float = None -"""mass of the penetration shield [kg]""" + electrical_conductivity_liq: float = 0.0 + """Liquid metal breeder/coolant electrical conductivity [Ohm m]""" + hartmann_liq: list[float] = field(default_factory=lambda: [0.0, 0.0]) + """Hartmann number""" -wtshldi: float = None -"""mass of inboard shield [kg]""" + b_mag_blkt: list[float] = field(default_factory=lambda: [5.0, 5.0]) + """Toroidal Magnetic feild strength for IB/OB blanket [T]""" + etaiso_liq: float = 0.85 + """Isentropic efficiency of blanket liquid breeder/coolant pumps""" -wtshldo: float = None -"""mass of outboard shield [kg]""" + blpressure_liq: float = 1.7e6 + """blanket liquid metal breeder/coolant pressure [Pa]""" + inlet_temp_liq: float = 570.0 + """Inlet (scan var 68) temperature of the liquid breeder/coolant [K]""" -irefprop: int = None -"""Switch to use REFPROP routines (stellarator only)""" + outlet_temp_liq: float = 720.0 + """Outlet (scan var 69) temperature of the liquid breeder/coolant [K]""" + den_fw_coolant: float = 0.0 + """Density of the FW primary coolant""" -fblli: float = None -"""lithium fraction of blanket by volume (stellarator only)""" + visc_fw_coolant: float = 0.0 + """Viscosity of the FW primary coolant""" + den_blkt_coolant: float = 0.0 + """Density of the blanket primary coolant""" -fblli2o: float = None -"""lithium oxide fraction of blanket by volume (stellarator only)""" + visc_blkt_coolant: float = 0.0 + """Viscosity of the blanket primary coolant""" + cp_fw: float = 0.0 + """Spesific heat for FW and blanket primary coolant(s)""" -fbllipb: float = None -"""lithium lead fraction of blanket by volume (stellarator only)""" + cv_fw: float = 0.0 + """Spesific heat for FW and blanket primary coolant(s)""" + cp_bl: float = 0.0 + """Spesific heat for FW and blanket primary coolant(s)""" -fblvd: float = None -"""vanadium fraction of blanket by volume (stellarator only)""" + cv_bl: float = 0.0 + """Spesific heat for FW and blanket primary coolant(s)""" + f_nuc_pow_bz_struct: float = 0.34 + """For a dual-coolant blanket, fraction of BZ power cooled by primary coolant""" -m_blkt_li2o: float = None -"""mass of blanket - Li_2O part [kg]""" + f_nuc_pow_bz_liq: float = 0.66 + """For a dual-coolant blanket, fraction of BZ self-cooled power (secondary coolant)""" + pnuc_fw_ratio_dcll: float = 0.14 + """For a dual-coolant blanket, ratio of FW nuclear power as fraction of total""" -wtbllipb: float = None -"""mass of blanket - Li-Pb part [kg]""" + pnuc_blkt_ratio_dcll: float = 0.86 + """For a dual-coolant blanket, ratio of Blanket nuclear power as fraction of total""" + n_blkt_inboard_module_coolant_sections_radial: int = 4 + """Number of radial and poloidal sections that make up the total primary coolant flow + length in a blanket module (IB and OB) + """ -m_blkt_vanadium: float = None -"""mass of blanket - vanadium part [kg]""" + n_blkt_inboard_module_coolant_sections_poloidal: int = 2 + """Number of radial and poloidal sections that make up the total primary coolant flow + length in a blanket module (IB and OB) + """ + n_blkt_outboard_module_coolant_sections_radial: int = 4 + """Number of radial and poloidal sections that make up the total primary coolant flow + length in a blanket module (IB and OB) + """ -m_blkt_lithium: float = None -"""mass of blanket - lithium part [kg]""" + n_blkt_outboard_module_coolant_sections_poloidal: int = 2 + """Number of radial and poloidal sections that make up the total primary coolant flow + length in a blanket module (IB and OB) + """ + bzfllengi_n_rad_liq: int = 2 + """Number of radial and poloidal sections that make up the total secondary coolant/breeder + flow length in a blanket module (IB and OB) + """ -f_a_blkt_cooling_channels: float = None -"""coolant void fraction in blanket.""" + bzfllengi_n_pol_liq: int = 2 + """Number of radial and poloidal sections that make up the total secondary coolant/breeder + flow length in a blanket module (IB and OB) + """ + bzfllengo_n_rad_liq: int = 2 + """Number of radial and poloidal sections that make up the total secondary coolant/breeder + flow length in a blanket module (IB and OB) + """ -blktmodel: int = None -"""switch for blanket/tritium breeding model (see i_blanket_type): -- =0 original simple model -- =1 KIT model based on a helium-cooled pebble-bed blanket (HCPB) reference design -""" + bzfllengo_n_pol_liq: int = 2 + """Number of radial and poloidal sections that make up the total secondary coolant/breeder + flow length in a blanket module (IB and OB) + """ + radius_blkt_channel: float = 0.0 + """Radius of blanket cooling channels [m]""" -declblkt: float = None -"""neutron power deposition decay length of blanket structural material [m] (stellarators only)""" + radius_blkt_channel_90_bend: float = 0.0 + """Radius of blanket cooling channel 90° bend [m]""" + radius_fw_channel_90_bend: float = 0.0 + """Radius of first wall cooling channel 90° bend [m]""" -declfw: float = None -"""neutron power deposition decay length of first wall structural material [m] (stellarators only)""" + radius_fw_channel_180_bend: float = 0.0 + """Radius of first wall cooling channel 180° bend [m]""" + radius_blkt_channel_180_bend: float = 0.0 + """Radius of blanket cooling channel 180° bend [m]""" -declshld: float = None -"""neutron power deposition decay length of shield structural material [m] (stellarators only)""" - - -blkttype: int = None -"""Switch for blanket type: -- =1 WCLL; -- =2 HCLL; efficiency taken from M. Kovari 2016 -"PROCESS": A systems code for fusion power plants - Part 2: Engineering -https://www.sciencedirect.com/science/article/pii/S0920379616300072 -Feedheat & reheat cycle assumed -- =3 HCPB; efficiency taken from M. Kovari 2016 -"PROCESS": A systems code for fusion power plants - Part 2: Engineering -https://www.sciencedirect.com/science/article/pii/S0920379616300072 -Feedheat & reheat cycle assumed -""" - - -etaiso: float = None -"""isentropic efficiency of FW and blanket coolant pumps""" - - -eta_coolant_pump_electric: float = None -"""electrical efficiency of primary coolant pumps""" - - -i_fw_blkt_shared_coolant: int = None -"""Switch for whether the FW and BB are on the same pump system -i.e. do they have the same primary coolant or not -- =0 FW and BB have the same primary coolant, flow = FWin->FWout->BBin->BBout -- =1 FW and BB have the different primary coolant and are on different pump systems -""" - - -i_blkt_liquid_breeder_type: int = None -"""Switch for Liquid Metal Breeder Material -- =0 PbLi -- =1 Li -""" + dz_fw_half: float = 0.0 + """Half-height of first wall structure [m]""" -i_blkt_dual_coolant: int = None -"""Switch to specify whether breeding blanket is single-cooled or dual-coolant. -- =0 Single coolant used for FW and Blanket (H2O or He). Solid Breeder. -- =1 Single coolant used for FW and Blanket (H2O or He). Liquid metal breeder -circulted for tritium extraction. -- =2 Dual coolant: primary coolant (H2O or He) for FW and blanket structure; -secondary coolant is self-cooled liquid metal breeder. -""" - - -i_blkt_liquid_breeder_channel_type: int = None -"""Switch for Flow Channel Insert (FCI) type if liquid metal breeder blanket. -- =0 Thin conducting walls, default electrical conductivity (bz_channel_conduct_liq) is Eurofer -- =1 Insulating Material, assumed perfect electrical insulator, default density (den_ceramic) is for SiC -- =2 Insulating Material, electrical conductivity (bz_channel_conduct_liq) is input (default Eurofer), default density (den_ceramic) is for SiC -""" - - -i_blkt_module_segmentation: int = None -"""Switch for Multi Module Segment (MMS) or Single Modle Segment (SMS) -- =0 MMS -- =1 SMS -""" - - -n_liq_recirc: int = None -"""Number of liquid metal breeder recirculations per day, for use with i_blkt_dual_coolant=1""" - - -r_f_liq_ib: float = None -"""Radial fraction of BZ liquid channels""" - - -r_f_liq_ob: float = None -"""Radial fraction of BZ liquid channels""" - - -w_f_liq_ib: float = None -"""Toroidal fraction of BZ liquid channels""" - - -w_f_liq_ob: float = None -"""Toroidal fraction of BZ liquid channels""" - - -den_ceramic: float = None -"""FCI material density""" - - -th_wall_secondary: float = None -"""Liquid metal coolant/breeder wall thickness thin conductor or FCI [m]""" - - -bz_channel_conduct_liq: float = None -"""Liquid metal coolant/breeder thin conductor or FCI wall conductance [A V^-1 m^-1]""" - - -a_bz_liq: float = None -"""Toroidal width of the rectangular cooling channel [m] for long poloidal sections of blanket breeding zone""" - - -b_bz_liq: float = None -"""Radial width of the rectangular cooling channel [m] for long poloidal sections of blanket breeding zone""" - - -nopol: int = None -"""Number of poloidal sections in a liquid metal breeder/coolant channel for module/segment""" - - -nopipes: int = None -"""Number of Liquid metal breeder/coolant channels per module/segment""" - - -den_liq: float = None -"""Liquid metal breeder/coolant density [kg m^-3]""" - - -wht_liq: float = None -"""Liquid metal""" - - -wht_liq_ib: float = None -"""Liquid metal""" - - -wht_liq_ob: float = None -"""Liquid metal""" - - -specific_heat_liq: float = None -"""Liquid metal breeder/coolant specific heat [J kg^-1 K^-1]""" - - -thermal_conductivity_liq: float = None -"""Liquid metal breeder/coolant thermal conductivity [W m^-1 K^-1]""" - - -dynamic_viscosity_liq: float = None -"""Liquid metal breeder/coolant dynamic viscosity [Pa s]""" - - -electrical_conductivity_liq: float = None -"""Liquid metal breeder/coolant electrical conductivity [Ohm m]""" - - -hartmann_liq: list[float] = None -"""Hartmann number""" - - -b_mag_blkt: list[float] = None -"""Toroidal Magnetic feild strength for IB/OB blanket [T]""" - - -etaiso_liq: float = None -"""Isentropic efficiency of blanket liquid breeder/coolant pumps""" - - -blpressure_liq: float = None -"""blanket liquid metal breeder/coolant pressure [Pa]""" - - -inlet_temp_liq: float = None -"""Inlet (scan var 68) temperature of the liquid breeder/coolant [K]""" - - -outlet_temp_liq: float = None -"""Outlet (scan var 69) temperature of the liquid breeder/coolant [K]""" - - -den_fw_coolant: float = None -"""Density of the FW primary coolant""" - - -visc_fw_coolant: float = None -"""Viscosity of the FW primary coolant""" - - -den_blkt_coolant: float = None -"""Density of the blanket primary coolant""" - - -visc_blkt_coolant: float = None -"""Viscosity of the blanket primary coolant""" - - -cp_fw: float = None -"""Spesific heat for FW and blanket primary coolant(s)""" - - -cv_fw: float = None -"""Spesific heat for FW and blanket primary coolant(s)""" - - -cp_bl: float = None -"""Spesific heat for FW and blanket primary coolant(s)""" - - -cv_bl: float = None -"""Spesific heat for FW and blanket primary coolant(s)""" - - -f_nuc_pow_bz_struct: float = None -"""For a dual-coolant blanket, fraction of BZ power cooled by primary coolant""" - - -f_nuc_pow_bz_liq: float = None -"""For a dual-coolant blanket, fraction of BZ self-cooled power (secondary coolant)""" - - -pnuc_fw_ratio_dcll: float = None -"""For a dual-coolant blanket, ratio of FW nuclear power as fraction of total""" - - -pnuc_blkt_ratio_dcll: float = None -"""For a dual-coolant blanket, ratio of Blanket nuclear power as fraction of total""" - - -n_blkt_inboard_module_coolant_sections_radial: int = None -"""Number of radial and poloidal sections that make up the total primary coolant flow -length in a blanket module (IB and OB) -""" - - -n_blkt_inboard_module_coolant_sections_poloidal: int = None -"""Number of radial and poloidal sections that make up the total primary coolant flow -length in a blanket module (IB and OB) -""" - - -n_blkt_outboard_module_coolant_sections_radial: int = None -"""Number of radial and poloidal sections that make up the total primary coolant flow -length in a blanket module (IB and OB) -""" - - -n_blkt_outboard_module_coolant_sections_poloidal: int = None -"""Number of radial and poloidal sections that make up the total primary coolant flow -length in a blanket module (IB and OB) -""" - -bzfllengi_n_rad_liq: int = None -"""Number of radial and poloidal sections that make up the total secondary coolant/breeder -flow length in a blanket module (IB and OB) -""" - - -bzfllengi_n_pol_liq: int = None -"""Number of radial and poloidal sections that make up the total secondary coolant/breeder -flow length in a blanket module (IB and OB) -""" - - -bzfllengo_n_rad_liq: int = None -"""Number of radial and poloidal sections that make up the total secondary coolant/breeder -flow length in a blanket module (IB and OB) -""" - - -bzfllengo_n_pol_liq: int = None -"""Number of radial and poloidal sections that make up the total secondary coolant/breeder -flow length in a blanket module (IB and OB) -""" - -radius_blkt_channel: float = None -"""Radius of blanket cooling channels [m]""" - -radius_blkt_channel_90_bend: float = None -"""Radius of blanket cooling channel 90° bend [m]""" - -radius_fw_channel_90_bend: float = None -"""Radius of first wall cooling channel 90° bend [m]""" - -radius_fw_channel_180_bend: float = None -"""Radius of first wall cooling channel 180° bend [m]""" - -radius_blkt_channel_180_bend: float = None -"""Radius of blanket cooling channel 180° bend [m]""" - -dz_fw_half: float = None -"""Half-height of first wall structure [m]""" - - -def init_fwbs_variables(): - """Initialise FWBS variables""" - global \ - life_blkt_fpy, \ - life_blkt, \ - m_fw_blkt_div_coolant_total, \ - m_vv, \ - den_steel, \ - denwc, \ - dewmkg, \ - f_p_blkt_multiplication, \ - p_blkt_multiplication_mw, \ - fblss, \ - f_ster_div_single, \ - f_a_fw_outboard_hcd, \ - fhole, \ - i_fw_blkt_vv_shape, \ - life_fw_fpy, \ - m_fw_total, \ - fw_armour_mass, \ - fw_armour_thickness, \ - fw_armour_vol, \ - i_blanket_type, \ - i_blkt_inboard, \ - inuclear, \ - qnuc, \ - f_blkt_li6_enrichment, \ - p_blkt_nuclear_heat_total_mw, \ - pnuc_cp, \ - p_cp_shield_nuclear_heat_mw, \ - pnuc_cp_tf, \ - p_div_nuclear_heat_total_mw, \ - p_fw_nuclear_heat_total_mw, \ - p_fw_hcd_nuclear_heat_mw, \ - pnucloss, \ - pnucvvplus, \ - p_shld_nuclear_heat_mw, \ - m_blkt_total, \ - m_blkt_steel_total, \ - armour_fw_bl_mass, \ - breeder_f, \ - breeder_multiplier, \ - vfcblkt, \ - vfpblkt, \ - m_blkt_li4sio4, \ - m_blkt_tibe12, \ - neut_flux_cp, \ - f_neut_shield, \ - f_a_fw_coolant_inboard, \ - f_a_fw_coolant_outboard, \ - psurffwi, \ - psurffwo, \ - vol_fw_total, \ - f_vol_blkt_steel, \ - f_vol_blkt_li4sio4, \ - f_vol_blkt_tibe12, \ - breedmat, \ - densbreed, \ - fblbe, \ - fblbreed, \ - fblhebmi, \ - fblhebmo, \ - fblhebpi, \ - fblhebpo, \ - hcdportsize, \ - nflutf, \ - npdiv, \ - nphcdin, \ - nphcdout, \ - tbr, \ - tritprate, \ - wallpf, \ - whtblbreed, \ - m_blkt_beryllium, \ - i_p_coolant_pumping, \ - i_shield_mat, \ - i_thermal_electric_conversion, \ - secondary_cycle_liq, \ - i_blkt_coolant_type, \ - i_fw_coolant_type, \ - dr_fw_wall, \ - radius_fw_channel, \ - dx_fw_module, \ - temp_fw_coolant_in, \ - temp_fw_coolant_out, \ - pres_fw_coolant, \ - temp_fw_peak, \ - roughness_fw_channel, \ - len_fw_channel, \ - f_fw_peak, \ - pres_blkt_coolant, \ - temp_blkt_coolant_in, \ - temp_blkt_coolant_out, \ - coolp, \ - n_blkt_outboard_modules_poloidal, \ - n_blkt_inboard_modules_poloidal, \ - n_blkt_outboard_modules_toroidal, \ - n_blkt_inboard_modules_toroidal, \ - temp_fw_max, \ - fw_th_conductivity, \ - fvoldw, \ - fvolsi, \ - fvolso, \ - fwclfr, \ - p_div_rad_total_mw, \ - p_fw_rad_total_mw, \ - p_fw_hcd_rad_total_mw, \ - pradloss, \ - p_tf_nuclear_heat_mw, \ - ptfnucpm3, \ - r_cryostat_inboard, \ - z_cryostat_half_inside, \ - dr_pf_cryostat, \ - vol_cryostat, \ - vol_cryostat_internal, \ - vol_vv, \ - vfshld, \ - vol_blkt_total, \ - vol_blkt_total_full_coverage, \ - vol_blkt_inboard, \ - vol_blkt_inboard_full_coverage, \ - vol_blkt_outboard, \ - vol_blkt_outboard_full_coverage, \ - vol_shld_total, \ - whtshld, \ - wpenshld, \ - wtshldi, \ - wtshldo, \ - irefprop, \ - fblli, \ - fblli2o, \ - fbllipb, \ - fblvd, \ - m_blkt_li2o, \ - wtbllipb, \ - m_blkt_vanadium, \ - m_blkt_lithium, \ - f_a_blkt_cooling_channels, \ - blktmodel, \ - declblkt, \ - declfw, \ - declshld, \ - blkttype, \ - etaiso, \ - eta_coolant_pump_electric, \ - i_fw_blkt_shared_coolant, \ - i_blkt_liquid_breeder_type, \ - i_blkt_dual_coolant, \ - i_blkt_liquid_breeder_channel_type, \ - i_blkt_module_segmentation, \ - n_liq_recirc, \ - r_f_liq_ib, \ - r_f_liq_ob, \ - w_f_liq_ib, \ - w_f_liq_ob, \ - den_ceramic, \ - th_wall_secondary, \ - bz_channel_conduct_liq, \ - a_bz_liq, \ - b_bz_liq, \ - nopol, \ - nopipes, \ - den_liq, \ - wht_liq, \ - wht_liq_ib, \ - wht_liq_ob, \ - specific_heat_liq, \ - thermal_conductivity_liq, \ - dynamic_viscosity_liq, \ - electrical_conductivity_liq, \ - hartmann_liq, \ - b_mag_blkt, \ - etaiso_liq, \ - blpressure_liq, \ - inlet_temp_liq, \ - outlet_temp_liq, \ - den_fw_coolant, \ - visc_fw_coolant, \ - den_blkt_coolant, \ - visc_blkt_coolant, \ - cp_fw, \ - cv_fw, \ - cp_bl, \ - cv_bl, \ - f_nuc_pow_bz_struct, \ - f_nuc_pow_bz_liq, \ - pnuc_fw_ratio_dcll, \ - pnuc_blkt_ratio_dcll, \ - n_blkt_inboard_module_coolant_sections_radial, \ - n_blkt_inboard_module_coolant_sections_poloidal, \ - n_blkt_outboard_module_coolant_sections_radial, \ - n_blkt_outboard_module_coolant_sections_poloidal, \ - bzfllengi_n_rad_liq, \ - bzfllengi_n_pol_liq, \ - bzfllengo_n_rad_liq, \ - bzfllengo_n_pol_liq, \ - radius_blkt_channel, \ - radius_fw_channel_90_bend, \ - radius_fw_channel_180_bend, \ - radius_blkt_channel_90_bend, \ - radius_blkt_channel_180_bend, \ - dz_fw_half - - life_blkt_fpy = 0.0 - life_blkt = 0.0 - m_fw_blkt_div_coolant_total = 0.0 - m_vv = 0.0 - den_steel = 7800.0 - denwc = 15630.0 - dewmkg = 0.0 - f_p_blkt_multiplication = 1.269 - p_blkt_multiplication_mw = 0.0 - fblss = 0.09705 - f_ster_div_single = 0.115 - f_a_fw_outboard_hcd = 0.0 - fhole = 0.0 - i_fw_blkt_vv_shape = 2 - life_fw_fpy = 0.0 - m_fw_total = 0.0 - fw_armour_mass = 0.0 - fw_armour_thickness = 0.005 - fw_armour_vol = 0.0 - i_blanket_type = 1 - i_blkt_inboard = 1 - inuclear = 0 - qnuc = 0.0 - f_blkt_li6_enrichment = 30.0 - p_blkt_nuclear_heat_total_mw = 0.0 - p_div_nuclear_heat_total_mw = 0.0 - p_fw_nuclear_heat_total_mw = 0.0 - p_fw_hcd_nuclear_heat_mw = 0.0 - pnucloss = 0.0 - pnucvvplus = 0.0 - p_shld_nuclear_heat_mw = 0.0 - m_blkt_total = 0.0 - m_blkt_steel_total = 0.0 - armour_fw_bl_mass = 0.0 - breeder_f = 0.5 - breeder_multiplier = 0.75 - vfcblkt = 0.05295 - vfpblkt = 0.1 - m_blkt_li4sio4 = 0.0 - m_blkt_tibe12 = 0.0 - f_neut_shield = -1.0 - f_a_fw_coolant_inboard = 0.0 - f_a_fw_coolant_outboard = 0.0 - psurffwi = 0.0 - psurffwo = 0.0 - vol_fw_total = 0.0 - f_vol_blkt_steel = 0.0 - f_vol_blkt_li4sio4 = 0.0 - f_vol_blkt_tibe12 = 0.0 - breedmat = 1 - densbreed = 0.0 - fblbe = 0.6 - fblbreed = 0.154 - fblhebmi = 0.4 - fblhebmo = 0.4 - fblhebpi = 0.6595 - fblhebpo = 0.6713 - hcdportsize = 1 - nflutf = 0.0 - npdiv = 2 - nphcdin = 2 - nphcdout = 2 - tbr = 0.0 - tritprate = 0.0 - wallpf = 1.21 - whtblbreed = 0.0 - m_blkt_beryllium = 0.0 - i_p_coolant_pumping = 2 - i_shield_mat = 0 - i_thermal_electric_conversion = 0 - secondary_cycle_liq = 4 - i_blkt_coolant_type = 1 - i_fw_coolant_type = "helium" - dr_fw_wall = 0.003 - radius_fw_channel = 0.006 - dx_fw_module = 0.02 - temp_fw_coolant_in = 573.0 - temp_fw_coolant_out = 823.0 - pres_fw_coolant = 15.5e6 - temp_fw_peak = 873.0 - roughness_fw_channel = 1.0e-6 - len_fw_channel = 4.0 - f_fw_peak = 1.0 - pres_blkt_coolant = 15.50e6 - temp_blkt_coolant_in = 573.0 - temp_blkt_coolant_out = 823.0 - coolp = 15.5e6 - n_blkt_outboard_modules_poloidal = 8 - n_blkt_inboard_modules_poloidal = 7 - n_blkt_outboard_modules_toroidal = 48 - n_blkt_inboard_modules_toroidal = 32 - temp_fw_max = 823.0 - fw_th_conductivity = 28.34 - fvoldw = 1.74 - fvolsi = 1.0 - fvolso = 0.64 - fwclfr = 0.15 - p_div_rad_total_mw = 0.0 - p_fw_rad_total_mw = 0.0 - p_fw_hcd_rad_total_mw = 0.0 - pradloss = 0.0 - p_tf_nuclear_heat_mw = 0.0 - ptfnucpm3 = 0.0 - r_cryostat_inboard = 0.0 - z_cryostat_half_inside = 0.0 - dr_pf_cryostat = 0.5 - vol_cryostat = 0.0 - vol_cryostat_internal = 0.0 - vol_vv = 0.0 - vfshld = 0.25 - vol_blkt_total = 0.0 - vol_blkt_total_full_coverage = 0.0 - vol_blkt_inboard = 0.0 - vol_blkt_inboard_full_coverage = 0.0 - vol_blkt_outboard = 0.0 - vol_blkt_outboard_full_coverage = 0.0 - vol_shld_total = 0.0 - whtshld = 0.0 - wpenshld = 0.0 - wtshldi = 0.0 - wtshldo = 0.0 - irefprop = 1 - fblli = 0.0 - fblli2o = 0.08 - fbllipb = 0.68 - fblvd = 0.0 - m_blkt_li2o = 0.0 - wtbllipb = 0.0 - m_blkt_vanadium = 0.0 - m_blkt_lithium = 0.0 - f_a_blkt_cooling_channels = 0.25 - blktmodel = 0 - declblkt = 0.075 - declfw = 0.075 - declshld = 0.075 - blkttype = 3 - etaiso = 0.85 - eta_coolant_pump_electric = 0.95 - pnuc_cp = 0.0 - p_cp_shield_nuclear_heat_mw = 0.0 - pnuc_cp_tf = 0.0 - neut_flux_cp = 0.0 - i_fw_blkt_shared_coolant = 0 - i_blkt_liquid_breeder_type = 0 - i_blkt_dual_coolant = 0 - i_blkt_liquid_breeder_channel_type = 0 - i_blkt_module_segmentation = 0 - n_liq_recirc = 10 - r_f_liq_ib = 0.5 - r_f_liq_ob = 0.5 - w_f_liq_ib = 0.5 - w_f_liq_ob = 0.5 - den_ceramic = 3.21e3 - th_wall_secondary = 1.25e-2 - bz_channel_conduct_liq = 8.33e5 - a_bz_liq = 0.2 - b_bz_liq = 0.2 - nopol = 2 - nopipes = 4 - den_liq = 9.5e3 - specific_heat_liq = 1.9e2 - thermal_conductivity_liq = 30.0 - wht_liq = 0.0 - wht_liq_ib = 0.0 - wht_liq_ob = 0.0 - dynamic_viscosity_liq = 0.0 - electrical_conductivity_liq = 0.0 - hartmann_liq = [0.0, 0.0] - b_mag_blkt = [5.0, 5.0] - etaiso_liq = 0.85 - blpressure_liq = 1.7e6 - inlet_temp_liq = 570.0 - outlet_temp_liq = 720.0 - den_fw_coolant = 0.0 - visc_fw_coolant = 0.0 - den_blkt_coolant = 0.0 - visc_blkt_coolant = 0.0 - cp_fw = 0.0 - cv_fw = 0.0 - cp_bl = 0.0 - cv_bl = 0.0 - f_nuc_pow_bz_struct = 0.34 - f_nuc_pow_bz_liq = 0.66 - pnuc_fw_ratio_dcll = 0.14 - pnuc_blkt_ratio_dcll = 0.86 - n_blkt_inboard_module_coolant_sections_radial = 4 - n_blkt_inboard_module_coolant_sections_poloidal = 2 - n_blkt_outboard_module_coolant_sections_radial = 4 - n_blkt_outboard_module_coolant_sections_poloidal = 2 - bzfllengi_n_rad_liq = 2 - bzfllengi_n_pol_liq = 2 - bzfllengo_n_rad_liq = 2 - bzfllengo_n_pol_liq = 2 - radius_blkt_channel = 0.0 - radius_fw_channel_90_bend = 0.0 - radius_fw_channel_180_bend = 0.0 - radius_blkt_channel_90_bend = 0.0 - radius_blkt_channel_180_bend = 0.0 - dz_fw_half = 0.0 +CREATE_DICTS_FROM_DATACLASS = FWBSData diff --git a/process/main.py b/process/main.py index 0fec4f35b..b60c031e2 100644 --- a/process/main.py +++ b/process/main.py @@ -713,6 +713,18 @@ def models(self) -> tuple[Model, ...]: self.ccfe_hcpb, self.fw, self.dcll, + self.blanket_library, + self.pfcoil, + self.cryostat, + self.fw, + self.sctfcoil, + self.cicc_sctfcoil, + self.croco_sctfcoil, + self.tfcoil, + self.build, + self.shield, + self.divertor, + self.structure, ) def setup_data_structure(self): diff --git a/process/models/availability.py b/process/models/availability.py index 3852682c6..1110cb287 100644 --- a/process/models/availability.py +++ b/process/models/availability.py @@ -9,7 +9,6 @@ from process.core.model import Model from process.data_structure import constraint_variables as ctv from process.data_structure import divertor_variables as dv -from process.data_structure import fwbs_variables as fwbsv 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 @@ -110,11 +109,11 @@ def avail(self, output: bool): # First wall / blanket lifetime (years) # TODO MDK Do this calculation whatever the value of blktmodel (whatever that is) # For some reason life_fw_fpy is not always calculated, so ignore it if it is still zero. - if fwbsv.life_fw_fpy < 0.0001e0: + if self.data.fwbs.life_fw_fpy < 0.0001e0: # Calculate blanket lifetime using neutron fluence model (ibkt_life=0) # or DEMO fusion power model (ibkt_life=1) if self.data.costs.ibkt_life == 0: - fwbsv.life_blkt_fpy = ( + self.data.fwbs.life_blkt_fpy = ( self.data.costs.life_plant if pv.pflux_fw_neutron_mw == 0.0 # noqa: RUF069 else min( @@ -123,18 +122,18 @@ def avail(self, output: bool): ) ) else: - fwbsv.life_blkt_fpy = min( + self.data.fwbs.life_blkt_fpy = min( self.data.costs.life_dpa / dpa_fpy, self.data.costs.life_plant ) # DEMO elif self.data.costs.ibkt_life == 0: - fwbsv.life_blkt_fpy = min( - fwbsv.life_fw_fpy, + self.data.fwbs.life_blkt_fpy = min( + self.data.fwbs.life_fw_fpy, self.data.costs.abktflnc / pv.pflux_fw_neutron_mw, self.data.costs.life_plant, ) else: - fwbsv.life_blkt_fpy = min( - fwbsv.life_fw_fpy, + self.data.fwbs.life_blkt_fpy = min( + self.data.fwbs.life_fw_fpy, self.data.costs.life_dpa / dpa_fpy, self.data.costs.life_plant, ) # DEMO @@ -154,19 +153,19 @@ def avail(self, output: bool): # Calculate the number of fusion cycles for a given blanket lifetime pulse_fpy = tv.t_plant_pulse_total / YEAR_SECONDS - self.data.costs.bktcycles = (fwbsv.life_blkt_fpy / pulse_fpy) + 1 + self.data.costs.bktcycles = (self.data.fwbs.life_blkt_fpy / pulse_fpy) + 1 # if i_plant_availability = 0 use input value for f_t_plant_available # Taylor and Ward 1999 model (i_plant_availability=1) if self.data.costs.i_plant_availability == 1: # Which component has the shorter life? - if self.data.costs.life_div_fpy < fwbsv.life_blkt_fpy: + if self.data.costs.life_div_fpy < self.data.fwbs.life_blkt_fpy: ld = self.data.costs.life_div_fpy - lb = fwbsv.life_blkt_fpy + lb = self.data.fwbs.life_blkt_fpy td = self.data.costs.t_div_replace_yrs else: - ld = fwbsv.life_blkt_fpy + ld = self.data.fwbs.life_blkt_fpy lb = self.data.costs.life_div_fpy td = self.data.costs.t_blkt_replace_yrs @@ -204,9 +203,9 @@ def avail(self, output: bool): # Modify lifetimes to take account of the availability if ifev.ife != 1: # First wall / blanket - if fwbsv.life_blkt_fpy < self.data.costs.life_plant: - fwbsv.life_blkt_fpy = min( - fwbsv.life_blkt_fpy / self.data.costs.f_t_plant_available, + if self.data.fwbs.life_blkt_fpy < self.data.costs.life_plant: + self.data.fwbs.life_blkt_fpy = min( + self.data.fwbs.life_blkt_fpy / self.data.costs.f_t_plant_available, self.data.costs.life_plant, ) @@ -225,12 +224,12 @@ def avail(self, output: bool): ) # Current drive system lifetime (assumed equal to first wall and blanket lifetime) - self.data.costs.life_hcd_fpy = fwbsv.life_blkt_fpy + self.data.costs.life_hcd_fpy = self.data.fwbs.life_blkt_fpy # Output section if output: po.oheadr(self.outfile, "Plant Availability") - if fwbsv.blktmodel == 0: + if self.data.fwbs.blktmodel == 0: po.ovarre( self.outfile, "Allowable blanket neutron fluence (MW-yr/m2)", @@ -248,7 +247,7 @@ def avail(self, output: bool): self.outfile, "First wall / blanket lifetime (years)", "(life_blkt_fpy)", - fwbsv.life_blkt_fpy, + self.data.fwbs.life_blkt_fpy, "OP ", ) po.ovarre( @@ -283,7 +282,7 @@ def avail(self, output: bool): ) if self.data.costs.i_plant_availability == 1: - if self.data.costs.life_div_fpy < fwbsv.life_blkt_fpy: + if self.data.costs.life_div_fpy < self.data.fwbs.life_blkt_fpy: po.ovarre( self.outfile, "Time needed to replace divertor (years)", @@ -412,13 +411,13 @@ def avail_2(self, output: bool): # Modify lifetimes to take account of the availability if ifev.ife != 1: # First wall / blanket - if fwbsv.life_blkt_fpy < self.data.costs.life_plant: - fwbsv.life_blkt_fpy = min( - fwbsv.life_blkt_fpy / self.data.costs.f_t_plant_available, + if self.data.fwbs.life_blkt_fpy < self.data.costs.life_plant: + self.data.fwbs.life_blkt_fpy = min( + self.data.fwbs.life_blkt_fpy / self.data.costs.f_t_plant_available, self.data.costs.life_plant, ) # Current drive system lifetime (assumed equal to first wall and blanket lifetime) - self.data.costs.life_hcd_fpy = fwbsv.life_blkt_fpy + self.data.costs.life_hcd_fpy = self.data.fwbs.life_blkt_fpy # Divertor if self.data.costs.life_div_fpy < self.data.costs.life_plant: @@ -445,7 +444,7 @@ def avail_2(self, output: bool): self.outfile, "First wall / blanket lifetime (FPY)", "(life_blkt_fpy)", - fwbsv.life_blkt_fpy, + self.data.fwbs.life_blkt_fpy, "OP ", ) po.ovarre( @@ -548,12 +547,12 @@ def calc_u_planned(self, output: bool) -> float: # Calculate blanket lifetime using neutron fluence model (ibkt_life=0) # or DEMO fusion power model (ibkt_life=1) if self.data.costs.ibkt_life == 0: - fwbsv.life_blkt_fpy = min( + self.data.fwbs.life_blkt_fpy = min( self.data.costs.abktflnc / pv.pflux_fw_neutron_mw, self.data.costs.life_plant, ) else: - fwbsv.life_blkt_fpy = min( + self.data.fwbs.life_blkt_fpy = min( self.data.costs.life_dpa / dpa_fpy, self.data.costs.life_plant ) # DEMO @@ -565,7 +564,7 @@ def calc_u_planned(self, output: bool) -> float: self.data.costs.cplife = self.cp_lifetime() # Current drive lifetime (assumed equal to first wall and blanket lifetime) - self.data.costs.life_hcd_fpy = fwbsv.life_blkt_fpy + self.data.costs.life_hcd_fpy = self.data.fwbs.life_blkt_fpy # Calculate the blanket and divertor replacement times ! @@ -584,12 +583,12 @@ def calc_u_planned(self, output: bool) -> float: mttr_divertor = 0.7e0 * mttr_blanket # Which component has the shorter life? - if self.data.costs.life_div_fpy < fwbsv.life_blkt_fpy: + if self.data.costs.life_div_fpy < self.data.fwbs.life_blkt_fpy: lifetime_shortest = self.data.costs.life_div_fpy - lifetime_longest = fwbsv.life_blkt_fpy + lifetime_longest = self.data.fwbs.life_blkt_fpy mttr_shortest = mttr_divertor else: - lifetime_shortest = fwbsv.life_blkt_fpy + lifetime_shortest = self.data.fwbs.life_blkt_fpy lifetime_longest = self.data.costs.life_div_fpy mttr_shortest = mttr_blanket @@ -861,7 +860,7 @@ def calc_u_unplanned_fwbs(self, output: bool) -> float: # Calculate cycle limit in terms of days # Number of cycles between planned blanket replacements, N - n = fwbsv.life_blkt_fpy * YEAR_SECONDS / tv.t_plant_pulse_total + n = self.data.fwbs.life_blkt_fpy * YEAR_SECONDS / tv.t_plant_pulse_total # The probability of failure in one pulse cycle # (before the reference cycle life) @@ -1166,12 +1165,12 @@ def avail_st(self, output: bool): dpa_fpy = f_scale * ref_dpa_fpy if self.data.costs.ibkt_life == 0: - fwbsv.life_blkt_fpy = min( + self.data.fwbs.life_blkt_fpy = min( self.data.costs.abktflnc / pv.pflux_fw_neutron_mw, self.data.costs.life_plant, ) else: - fwbsv.life_blkt_fpy = min( + self.data.fwbs.life_blkt_fpy = min( self.data.costs.life_dpa / dpa_fpy, self.data.costs.life_plant ) # DEMO @@ -1182,12 +1181,12 @@ def avail_st(self, output: bool): self.data.costs.cplife = self.cp_lifetime() # Current drive lifetime (assumed equal to first wall and blanket lifetime) - self.data.costs.life_hcd_fpy = fwbsv.life_blkt_fpy + self.data.costs.life_hcd_fpy = self.data.fwbs.life_blkt_fpy # Time for a maintenance cycle (years) # Shortest component lifetime + time to replace shortest_lifetime = min( - fwbsv.life_blkt_fpy, + self.data.fwbs.life_blkt_fpy, self.data.costs.life_div_fpy, self.data.costs.cplife, self.data.costs.life_hcd_fpy, @@ -1259,12 +1258,12 @@ def avail_st(self, output: bool): # Modify lifetimes to take account of the availability if ifev.ife != 1: # First wall / blanket - if fwbsv.life_blkt_fpy < self.data.costs.life_plant: - fwbsv.life_blkt_fpy = min( - fwbsv.life_blkt_fpy / self.data.costs.f_t_plant_available, + if self.data.fwbs.life_blkt_fpy < self.data.costs.life_plant: + self.data.fwbs.life_blkt_fpy = min( + self.data.fwbs.life_blkt_fpy / self.data.costs.f_t_plant_available, self.data.costs.life_plant, ) - self.data.costs.life_hcd_fpy = fwbsv.life_blkt_fpy + self.data.costs.life_hcd_fpy = self.data.fwbs.life_blkt_fpy # Divertor if self.data.costs.life_div_fpy < self.data.costs.life_plant: @@ -1304,7 +1303,7 @@ def avail_st(self, output: bool): self.outfile, "First wall / blanket lifetime (FPY)", "(life_blkt_fpy)", - fwbsv.life_blkt_fpy, + self.data.fwbs.life_blkt_fpy, "OP ", ) po.ovarre( @@ -1326,7 +1325,7 @@ def avail_st(self, output: bool): self.outfile, "Centrepost TF fast neutron flux (E > 0.1 MeV) (m^(-2).^(-1))", "(neut_flux_cp)", - fwbsv.neut_flux_cp, + self.data.fwbs.neut_flux_cp, "OP ", ) else: @@ -1440,9 +1439,9 @@ def cp_lifetime(self): if tfv.i_tf_sup == TFConductorModel.SUPERCONDUCTING: cplife = ( self.data.costs.life_plant - if fwbsv.neut_flux_cp <= 0.0 + if self.data.fwbs.neut_flux_cp <= 0.0 else min( - (ctv.nflutfmax / (fwbsv.neut_flux_cp * YEAR_SECONDS)), + (ctv.nflutfmax / (self.data.fwbs.neut_flux_cp * YEAR_SECONDS)), self.data.costs.life_plant, ) ) diff --git a/process/models/blankets/blanket_library.py b/process/models/blankets/blanket_library.py index 61516d1c3..3c31a376c 100644 --- a/process/models/blankets/blanket_library.py +++ b/process/models/blankets/blanket_library.py @@ -14,7 +14,6 @@ blanket_library, build_variables, divertor_variables, - fwbs_variables, heat_transport_variables, physics_variables, primary_pumping_variables, @@ -85,7 +84,7 @@ def component_volumes(self): # D-shaped blanket and shield if ( physics_variables.itart == 1 - or fwbs_variables.i_fw_blkt_vv_shape == FwBlktVVShape.D_SHAPED + or self.data.fwbs.i_fw_blkt_vv_shape == FwBlktVVShape.D_SHAPED ): ( build_variables.a_blkt_inboard_surface_full_coverage, @@ -104,9 +103,9 @@ def component_volumes(self): ) ( - fwbs_variables.vol_blkt_inboard_full_coverage, - fwbs_variables.vol_blkt_outboard_full_coverage, - fwbs_variables.vol_blkt_total_full_coverage, + self.data.fwbs.vol_blkt_inboard_full_coverage, + self.data.fwbs.vol_blkt_outboard_full_coverage, + self.data.fwbs.vol_blkt_total_full_coverage, ) = self.calculate_dshaped_blkt_volumes( r_shld_inboard_inner=build_variables.r_shld_inboard_inner, dr_shld_inboard=build_variables.dr_shld_inboard, @@ -141,9 +140,9 @@ def component_volumes(self): ) ( - fwbs_variables.vol_blkt_inboard_full_coverage, - fwbs_variables.vol_blkt_outboard_full_coverage, - fwbs_variables.vol_blkt_total_full_coverage, + self.data.fwbs.vol_blkt_inboard_full_coverage, + self.data.fwbs.vol_blkt_outboard_full_coverage, + self.data.fwbs.vol_blkt_total_full_coverage, ) = self.calculate_elliptical_blkt_volumes( rmajor=physics_variables.rmajor, rminor=physics_variables.rminor, @@ -534,8 +533,8 @@ def apply_coverage_factors(self): build_variables.a_blkt_total_surface_full_coverage * ( 1.0 - - 2.0 * fwbs_variables.f_ster_div_single - - fwbs_variables.f_a_fw_outboard_hcd + - 2.0 * self.data.fwbs.f_ster_div_single + - self.data.fwbs.f_a_fw_outboard_hcd ) - build_variables.a_blkt_inboard_surface_full_coverage ) @@ -545,8 +544,8 @@ def apply_coverage_factors(self): build_variables.a_blkt_total_surface_full_coverage * ( 1.0 - - fwbs_variables.f_ster_div_single - - fwbs_variables.f_a_fw_outboard_hcd + - self.data.fwbs.f_ster_div_single + - self.data.fwbs.f_a_fw_outboard_hcd ) - build_variables.a_blkt_inboard_surface_full_coverage ) @@ -556,24 +555,24 @@ def apply_coverage_factors(self): + build_variables.a_blkt_outboard_surface ) - fwbs_variables.vol_blkt_outboard = ( - fwbs_variables.vol_blkt_total_full_coverage + self.data.fwbs.vol_blkt_outboard = ( + self.data.fwbs.vol_blkt_total_full_coverage * ( 1.0 - - fwbs_variables.f_ster_div_single - - fwbs_variables.f_a_fw_outboard_hcd + - self.data.fwbs.f_ster_div_single + - self.data.fwbs.f_a_fw_outboard_hcd ) - - fwbs_variables.vol_blkt_inboard_full_coverage + - self.data.fwbs.vol_blkt_inboard_full_coverage ) - fwbs_variables.vol_blkt_inboard = fwbs_variables.vol_blkt_inboard_full_coverage + self.data.fwbs.vol_blkt_inboard = self.data.fwbs.vol_blkt_inboard_full_coverage build_variables.a_blkt_inboard_surface = ( build_variables.a_blkt_inboard_surface_full_coverage ) - fwbs_variables.vol_blkt_total = ( - fwbs_variables.vol_blkt_inboard_full_coverage - + fwbs_variables.vol_blkt_outboard + self.data.fwbs.vol_blkt_total = ( + self.data.fwbs.vol_blkt_inboard_full_coverage + + self.data.fwbs.vol_blkt_outboard ) def output_blkt_volumes_and_areas(self): @@ -584,38 +583,38 @@ def output_blkt_volumes_and_areas(self): self.outfile, "Inboard Blanket Volume with gaps and holes (m3)", "(vol_blkt_inboard)", - fwbs_variables.vol_blkt_inboard, + self.data.fwbs.vol_blkt_inboard, ) po.ovarst( self.outfile, "Outboard Blanket Volume with gaps and holes (m3)", "(vol_blkt_outboard)", - fwbs_variables.vol_blkt_outboard, + self.data.fwbs.vol_blkt_outboard, ) po.ovarst( self.outfile, "Total Blanket Volume with gaps and holes (m3)", "(vol_blkt_total)", - fwbs_variables.vol_blkt_total, + self.data.fwbs.vol_blkt_total, ) po.ovarst( self.outfile, "Inboard Blanket Volume if toridally continuous (m3)", "(vol_blkt_inboard_full_coverage)", - fwbs_variables.vol_blkt_inboard_full_coverage, + self.data.fwbs.vol_blkt_inboard_full_coverage, ) po.ovarst( self.outfile, "Outboard Blanket Volume if toridally continuous (m3)", "(vol_blkt_outboard_full_coverage)", - fwbs_variables.vol_blkt_outboard_full_coverage, + self.data.fwbs.vol_blkt_outboard_full_coverage, ) po.ovarst( self.outfile, "Total Blanket Volume if toridally continuous (m3)", "(vol_blkt_total_full_coverage)", - fwbs_variables.vol_blkt_total_full_coverage, + self.data.fwbs.vol_blkt_total_full_coverage, ) po.ovarst( @@ -671,91 +670,91 @@ def primary_coolant_properties(self, output: bool): # Make sure that, if the inputs for the FW and blanket inputs are different, # the i_fw_blkt_shared_coolant variable is appropriately set for separate coolants if ( - fwbs_variables.i_fw_coolant_type == "Helium" - and fwbs_variables.i_blkt_coolant_type == 2 + self.data.fwbs.i_fw_coolant_type == "Helium" + and self.data.fwbs.i_blkt_coolant_type == 2 ): - fwbs_variables.i_fw_blkt_shared_coolant = ( + self.data.fwbs.i_fw_blkt_shared_coolant = ( FWBlktCoolantLoopTypes.SEPARATE_LOOPS ) if ( - fwbs_variables.i_fw_coolant_type == "Water" - and fwbs_variables.i_blkt_coolant_type == 1 + self.data.fwbs.i_fw_coolant_type == "Water" + and self.data.fwbs.i_blkt_coolant_type == 1 ): - fwbs_variables.i_fw_blkt_shared_coolant = ( + self.data.fwbs.i_fw_blkt_shared_coolant = ( FWBlktCoolantLoopTypes.SEPARATE_LOOPS ) # If FW and BB have same coolant... i_fw_blkt_shared_coolant = FWBlktCoolantLoopTypes( - fwbs_variables.i_fw_blkt_shared_coolant + self.data.fwbs.i_fw_blkt_shared_coolant ) if i_fw_blkt_shared_coolant == FWBlktCoolantLoopTypes.SHARED_LOOP: # Use FW inlet temp and BB outlet temp mid_temp = ( - fwbs_variables.temp_fw_coolant_in + fwbs_variables.temp_blkt_coolant_out + self.data.fwbs.temp_fw_coolant_in + self.data.fwbs.temp_blkt_coolant_out ) * 0.5 # FW/BB fw_bb_fluid_properties = FluidProperties.of( - fwbs_variables.i_fw_coolant_type, + self.data.fwbs.i_fw_coolant_type, temperature=mid_temp, - pressure=fwbs_variables.pres_fw_coolant, + pressure=self.data.fwbs.pres_fw_coolant, ) - fwbs_variables.den_fw_coolant = fw_bb_fluid_properties.density - fwbs_variables.cp_fw = fw_bb_fluid_properties.specific_heat_const_p - fwbs_variables.cv_fw = fw_bb_fluid_properties.specific_heat_const_v - fwbs_variables.visc_fw_coolant = fw_bb_fluid_properties.viscosity + self.data.fwbs.den_fw_coolant = fw_bb_fluid_properties.density + self.data.fwbs.cp_fw = fw_bb_fluid_properties.specific_heat_const_p + self.data.fwbs.cv_fw = fw_bb_fluid_properties.specific_heat_const_v + self.data.fwbs.visc_fw_coolant = fw_bb_fluid_properties.viscosity - fwbs_variables.den_blkt_coolant = fwbs_variables.den_fw_coolant - fwbs_variables.visc_blkt_coolant = fwbs_variables.visc_fw_coolant - fwbs_variables.cp_bl = fwbs_variables.cp_fw - fwbs_variables.cv_bl = fwbs_variables.cv_fw + self.data.fwbs.den_blkt_coolant = self.data.fwbs.den_fw_coolant + self.data.fwbs.visc_blkt_coolant = self.data.fwbs.visc_fw_coolant + self.data.fwbs.cp_bl = self.data.fwbs.cp_fw + self.data.fwbs.cv_bl = self.data.fwbs.cv_fw # If FW and BB have different coolants... else: # FW mid_temp_fw = ( - fwbs_variables.temp_fw_coolant_in + fwbs_variables.temp_fw_coolant_out + self.data.fwbs.temp_fw_coolant_in + self.data.fwbs.temp_fw_coolant_out ) * 0.5 fw_fluid_properties = FluidProperties.of( - fwbs_variables.i_fw_coolant_type, + self.data.fwbs.i_fw_coolant_type, temperature=mid_temp_fw, - pressure=fwbs_variables.pres_fw_coolant, + pressure=self.data.fwbs.pres_fw_coolant, ) - fwbs_variables.den_fw_coolant = fw_fluid_properties.density - fwbs_variables.cp_fw = fw_fluid_properties.specific_heat_const_p - fwbs_variables.cv_fw = fw_fluid_properties.specific_heat_const_v - fwbs_variables.visc_fw_coolant = fw_fluid_properties.viscosity + self.data.fwbs.den_fw_coolant = fw_fluid_properties.density + self.data.fwbs.cp_fw = fw_fluid_properties.specific_heat_const_p + self.data.fwbs.cv_fw = fw_fluid_properties.specific_heat_const_v + self.data.fwbs.visc_fw_coolant = fw_fluid_properties.viscosity # BB mid_temp_bl = ( - fwbs_variables.temp_blkt_coolant_in - + fwbs_variables.temp_blkt_coolant_out + self.data.fwbs.temp_blkt_coolant_in + + self.data.fwbs.temp_blkt_coolant_out ) * 0.5 bb_fluid_properties = FluidProperties.of( - "Helium" if fwbs_variables.i_blkt_coolant_type == 1 else "Water", + "Helium" if self.data.fwbs.i_blkt_coolant_type == 1 else "Water", temperature=mid_temp_bl, - pressure=fwbs_variables.pres_blkt_coolant, + pressure=self.data.fwbs.pres_blkt_coolant, ) - fwbs_variables.den_blkt_coolant = bb_fluid_properties.density - fwbs_variables.cp_bl = bb_fluid_properties.specific_heat_const_p - fwbs_variables.cv_bl = bb_fluid_properties.specific_heat_const_v - fwbs_variables.visc_blkt_coolant = bb_fluid_properties.viscosity + self.data.fwbs.den_blkt_coolant = bb_fluid_properties.density + self.data.fwbs.cp_bl = bb_fluid_properties.specific_heat_const_p + self.data.fwbs.cv_bl = bb_fluid_properties.specific_heat_const_v + self.data.fwbs.visc_blkt_coolant = bb_fluid_properties.viscosity if ( - fwbs_variables.den_fw_coolant > 1e9 - or fwbs_variables.den_fw_coolant <= 0 - or np.isnan(fwbs_variables.den_fw_coolant) + self.data.fwbs.den_fw_coolant > 1e9 + or self.data.fwbs.den_fw_coolant <= 0 + or np.isnan(self.data.fwbs.den_fw_coolant) ): raise ProcessValueError( - f"Error in primary_coolant_properties. {fwbs_variables.den_fw_coolant = }" + f"Error in primary_coolant_properties. {self.data.fwbs.den_fw_coolant = }" ) if ( - fwbs_variables.den_blkt_coolant > 1e9 - or fwbs_variables.den_blkt_coolant <= 0 - or np.isnan(fwbs_variables.den_blkt_coolant) + self.data.fwbs.den_blkt_coolant > 1e9 + or self.data.fwbs.den_blkt_coolant <= 0 + or np.isnan(self.data.fwbs.den_blkt_coolant) ): raise ProcessValueError( - f"Error in primary_coolant_properties. {fwbs_variables.den_blkt_coolant = }" + f"Error in primary_coolant_properties. {self.data.fwbs.den_blkt_coolant = }" ) if output: @@ -769,7 +768,7 @@ def primary_coolant_properties(self, output: bool): # FW (or FW/BB) if ( - fwbs_variables.i_fw_blkt_shared_coolant + self.data.fwbs.i_fw_blkt_shared_coolant == FWBlktCoolantLoopTypes.SEPARATE_LOOPS ): po.osubhd(self.outfile, "First Wall :") @@ -778,20 +777,20 @@ def primary_coolant_properties(self, output: bool): self.outfile, "Coolant type", "(i_fw_coolant_type)", - f'"{fwbs_variables.i_fw_coolant_type}"', + f'"{self.data.fwbs.i_fw_coolant_type}"', ) po.ovarrf( self.outfile, "Density (kg m-3)", "(den_fw_coolant)", - fwbs_variables.den_fw_coolant, + self.data.fwbs.den_fw_coolant, "OP ", ) po.ovarrf( self.outfile, "Viscosity (Pa s)", "(visc_fw_coolant)", - fwbs_variables.visc_fw_coolant, + self.data.fwbs.visc_fw_coolant, "OP ", ) @@ -799,19 +798,19 @@ def primary_coolant_properties(self, output: bool): self.outfile, "Inlet Temperature (Celcius)", "(temp_fw_coolant_in)", - fwbs_variables.temp_fw_coolant_in, + self.data.fwbs.temp_fw_coolant_in, "OP ", ) if ( - fwbs_variables.i_fw_blkt_shared_coolant + self.data.fwbs.i_fw_blkt_shared_coolant == FWBlktCoolantLoopTypes.SHARED_LOOP ): po.ovarre( self.outfile, "Outlet Temperature (Celcius)", "(temp_blkt_coolant_out)", - fwbs_variables.temp_blkt_coolant_out, + self.data.fwbs.temp_blkt_coolant_out, "OP ", ) @@ -820,22 +819,22 @@ def primary_coolant_properties(self, output: bool): self.outfile, "Outlet Temperature (Celcius)", "(temp_fw_coolant_out)", - fwbs_variables.temp_fw_coolant_out, + self.data.fwbs.temp_fw_coolant_out, "OP ", ) # BB if ( - fwbs_variables.i_fw_blkt_shared_coolant + self.data.fwbs.i_fw_blkt_shared_coolant == FWBlktCoolantLoopTypes.SEPARATE_LOOPS ): po.osubhd(self.outfile, "Breeding Blanket :") - if fwbs_variables.i_blkt_coolant_type == 1: + if self.data.fwbs.i_blkt_coolant_type == 1: po.ocmmnt( self.outfile, "Coolant type (i_blkt_coolant_type=1), Helium" ) - if fwbs_variables.i_blkt_coolant_type == 2: + if self.data.fwbs.i_blkt_coolant_type == 2: po.ocmmnt( self.outfile, "Coolant type (i_blkt_coolant_type=2), Water" ) @@ -843,14 +842,14 @@ def primary_coolant_properties(self, output: bool): self.outfile, "Density (kg m-3)", "(den_blkt_coolant)", - fwbs_variables.den_blkt_coolant, + self.data.fwbs.den_blkt_coolant, "OP ", ) po.ovarrf( self.outfile, "Viscosity (Pa s)", "(visc_blkt_coolant)", - fwbs_variables.visc_blkt_coolant, + self.data.fwbs.visc_blkt_coolant, "OP ", ) @@ -858,14 +857,14 @@ def primary_coolant_properties(self, output: bool): self.outfile, "Inlet Temperature (Celcius)", "(temp_blkt_coolant_in)", - fwbs_variables.temp_blkt_coolant_in, + self.data.fwbs.temp_blkt_coolant_in, "OP ", ) po.ovarre( self.outfile, "Outlet Temperature (Celcius)", "(temp_blkt_coolant_out)", - fwbs_variables.temp_blkt_coolant_out, + self.data.fwbs.temp_blkt_coolant_out, "OP ", ) @@ -887,7 +886,7 @@ def set_blanket_module_geometry(self): Error If the poloidal segment length is less than three times the minimum liquid breeder pipe width. """ - if fwbs_variables.i_blanket_type == 5: + if self.data.fwbs.i_blanket_type == 5: # Unless DCLL then we will use BZ blanket_library.len_blkt_inboard_coolant_channel_radial = ( build_variables.blbuith @@ -908,27 +907,27 @@ def set_blanket_module_geometry(self): # If SMS blanket then do not have separate poloidal modules.... # Should not need this as n_blkt_inboard_modules_poloidal is input but make sure here. - if fwbs_variables.i_blkt_module_segmentation == 1: - fwbs_variables.n_blkt_inboard_modules_poloidal = 1 - fwbs_variables.n_blkt_outboard_modules_poloidal = 1 + if self.data.fwbs.i_blkt_module_segmentation == 1: + self.data.fwbs.n_blkt_inboard_modules_poloidal = 1 + self.data.fwbs.n_blkt_outboard_modules_poloidal = 1 if ( physics_variables.itart == 1 - or fwbs_variables.i_fw_blkt_vv_shape == FwBlktVVShape.D_SHAPED + or self.data.fwbs.i_fw_blkt_vv_shape == FwBlktVVShape.D_SHAPED ): blanket_library.len_blkt_inboard_segment_poloidal = self.calculate_dshaped_inboard_blkt_segment_poloidal( dz_blkt_half=blanket_library.dz_blkt_half, - n_blkt_inboard_modules_poloidal=fwbs_variables.n_blkt_inboard_modules_poloidal, + n_blkt_inboard_modules_poloidal=self.data.fwbs.n_blkt_inboard_modules_poloidal, ) blanket_library.len_blkt_outboard_segment_poloidal = self.calculate_dshaped_outboard_blkt_segment_poloidal( - n_blkt_outboard_modules_poloidal=fwbs_variables.n_blkt_outboard_modules_poloidal, + n_blkt_outboard_modules_poloidal=self.data.fwbs.n_blkt_outboard_modules_poloidal, dr_fw_plasma_gap_inboard=build_variables.dr_fw_plasma_gap_inboard, rminor=physics_variables.rminor, dr_fw_plasma_gap_outboard=build_variables.dr_fw_plasma_gap_outboard, dz_blkt_half=blanket_library.dz_blkt_half, n_divertors=divertor_variables.n_divertors, - f_ster_div_single=fwbs_variables.f_ster_div_single, + f_ster_div_single=self.data.fwbs.f_ster_div_single, ) else: blanket_library.len_blkt_inboard_segment_poloidal = self.calculate_elliptical_inboard_blkt_segment_poloidal( @@ -937,9 +936,9 @@ def set_blanket_module_geometry(self): triang=physics_variables.triang, dr_fw_plasma_gap_inboard=build_variables.dr_fw_plasma_gap_inboard, dz_blkt_half=blanket_library.dz_blkt_half, - n_blkt_inboard_modules_poloidal=fwbs_variables.n_blkt_inboard_modules_poloidal, + n_blkt_inboard_modules_poloidal=self.data.fwbs.n_blkt_inboard_modules_poloidal, n_divertors=divertor_variables.n_divertors, - f_ster_div_single=fwbs_variables.f_ster_div_single, + f_ster_div_single=self.data.fwbs.f_ster_div_single, ) blanket_library.len_blkt_outboard_segment_poloidal = self.calculate_elliptical_outboard_blkt_segment_poloidal( @@ -948,50 +947,50 @@ def set_blanket_module_geometry(self): triang=physics_variables.triang, dz_blkt_half=blanket_library.dz_blkt_half, dr_fw_plasma_gap_outboard=build_variables.dr_fw_plasma_gap_outboard, - n_blkt_outboard_modules_poloidal=fwbs_variables.n_blkt_outboard_modules_poloidal, + n_blkt_outboard_modules_poloidal=self.data.fwbs.n_blkt_outboard_modules_poloidal, n_divertors=divertor_variables.n_divertors, - f_ster_div_single=fwbs_variables.f_ster_div_single, + f_ster_div_single=self.data.fwbs.f_ster_div_single, ) # If liquid breeder or dual coolant blanket then calculate - if fwbs_variables.i_blkt_dual_coolant > 0: + if self.data.fwbs.i_blkt_dual_coolant > 0: # Use smallest space available to pipes for pipe sizes in pumping calculations (worst case) - if fwbs_variables.i_blkt_inboard == 1: + if self.data.fwbs.i_blkt_inboard == 1: # Radial direction - fwbs_variables.b_bz_liq = ( + self.data.fwbs.b_bz_liq = ( min( ( blanket_library.len_blkt_inboard_coolant_channel_radial - * fwbs_variables.r_f_liq_ib + * self.data.fwbs.r_f_liq_ib ), ( blanket_library.len_blkt_outboard_coolant_channel_radial - * fwbs_variables.r_f_liq_ob + * self.data.fwbs.r_f_liq_ob ), ) - / fwbs_variables.nopol + / self.data.fwbs.nopol ) # Toroidal direction - fwbs_variables.a_bz_liq = ( + self.data.fwbs.a_bz_liq = ( min( ( blanket_library.len_blkt_inboard_segment_toroidal - * fwbs_variables.w_f_liq_ib + * self.data.fwbs.w_f_liq_ib ), ( blanket_library.len_blkt_outboard_segment_toroidal - * fwbs_variables.w_f_liq_ob + * self.data.fwbs.w_f_liq_ob ), ) - / fwbs_variables.nopipes + / self.data.fwbs.nopipes ) # Poloidal if ( blanket_library.len_blkt_inboard_segment_poloidal - < (fwbs_variables.b_bz_liq * 3) + < (self.data.fwbs.b_bz_liq * 3) ) or ( blanket_library.len_blkt_outboard_segment_poloidal - < (fwbs_variables.b_bz_liq * 3) + < (self.data.fwbs.b_bz_liq * 3) ): logger.error( "Your blanket modules are too small for the Liquid Metal pipes" @@ -1000,18 +999,18 @@ def set_blanket_module_geometry(self): # Unless there is no IB blanket... else: # Radial direction - fwbs_variables.b_bz_liq = ( + self.data.fwbs.b_bz_liq = ( blanket_library.len_blkt_outboard_coolant_channel_radial - * fwbs_variables.r_f_liq_ob - ) / fwbs_variables.nopol + * self.data.fwbs.r_f_liq_ob + ) / self.data.fwbs.nopol # Toroidal direction - fwbs_variables.a_bz_liq = ( + self.data.fwbs.a_bz_liq = ( blanket_library.len_blkt_outboard_segment_toroidal - * fwbs_variables.w_f_liq_ob - ) / fwbs_variables.nopipes + * self.data.fwbs.w_f_liq_ob + ) / self.data.fwbs.nopipes # Poloidal if blanket_library.len_blkt_outboard_segment_poloidal < ( - fwbs_variables.b_bz_liq * 3 + self.data.fwbs.b_bz_liq * 3 ): logger.error( "Your blanket modules are too small for the Liquid Metal pipes" @@ -1020,15 +1019,15 @@ def set_blanket_module_geometry(self): # Calculate total flow lengths, used for pressure drop calculation # Blanket primary coolant flow blanket_library.len_blkt_inboard_channel_total = ( - fwbs_variables.n_blkt_inboard_module_coolant_sections_radial + self.data.fwbs.n_blkt_inboard_module_coolant_sections_radial * blanket_library.len_blkt_inboard_coolant_channel_radial - + fwbs_variables.n_blkt_inboard_module_coolant_sections_poloidal + + self.data.fwbs.n_blkt_inboard_module_coolant_sections_poloidal * blanket_library.len_blkt_inboard_segment_poloidal ) blanket_library.len_blkt_outboard_channel_total = ( - fwbs_variables.n_blkt_outboard_module_coolant_sections_radial + self.data.fwbs.n_blkt_outboard_module_coolant_sections_radial * blanket_library.len_blkt_outboard_coolant_channel_radial - + fwbs_variables.n_blkt_outboard_module_coolant_sections_poloidal + + self.data.fwbs.n_blkt_outboard_module_coolant_sections_poloidal * blanket_library.len_blkt_outboard_segment_poloidal ) @@ -1056,18 +1055,18 @@ def thermo_hydraulic_model_pressure_drop_calculations(self, output: bool): # Blanket secondary coolant/breeder flow pollengi = blanket_library.len_blkt_inboard_segment_poloidal pollengo = blanket_library.len_blkt_outboard_segment_poloidal - fwbs_variables.nopol = 2 - fwbs_variables.nopipes = 4 + self.data.fwbs.nopol = 2 + self.data.fwbs.nopipes = 4 bzfllengi_liq = ( - fwbs_variables.bzfllengi_n_rad_liq + self.data.fwbs.bzfllengi_n_rad_liq * blanket_library.len_blkt_inboard_coolant_channel_radial - + fwbs_variables.bzfllengi_n_pol_liq + + self.data.fwbs.bzfllengi_n_pol_liq * blanket_library.len_blkt_inboard_segment_poloidal ) bzfllengo_liq = ( - fwbs_variables.bzfllengo_n_rad_liq + self.data.fwbs.bzfllengo_n_rad_liq * blanket_library.len_blkt_outboard_coolant_channel_radial - + fwbs_variables.bzfllengo_n_pol_liq + + self.data.fwbs.bzfllengo_n_pol_liq * blanket_library.len_blkt_outboard_segment_poloidal ) @@ -1082,7 +1081,7 @@ def thermo_hydraulic_model_pressure_drop_calculations(self, output: bool): N_FW_PIPE_180_DEG_BENDS = 0 # N.B. This is for BZ only, does not include MF/BSS. - if fwbs_variables.i_blkt_dual_coolant in {1, 2}: + if self.data.fwbs.i_blkt_dual_coolant in {1, 2}: N_BLKT_PIPE_90_DEG_BENDS = 4 N_BLKT_PIPE_180_DEG_BENDS = 1 no90bz_liq = 2 @@ -1109,32 +1108,32 @@ def thermo_hydraulic_model_pressure_drop_calculations(self, output: bool): vel_fw_inboard_coolant = self.flow_velocity( i_channel_shape=1, mass_flow_rate=blanket_library.mflow_fw_inboard_coolant_channel, - flow_density=fwbs_variables.den_fw_coolant, + flow_density=self.data.fwbs.den_fw_coolant, ) vel_fw_outboard_coolant = self.flow_velocity( i_channel_shape=1, mass_flow_rate=blanket_library.mflow_fw_outboard_coolant_channel, - flow_density=fwbs_variables.den_fw_coolant, + flow_density=self.data.fwbs.den_fw_coolant, ) # If the blanket is dual-coolant... - if fwbs_variables.i_blkt_dual_coolant == 2: + if self.data.fwbs.i_blkt_dual_coolant == 2: # Calc total num of pipes (in all inboard modules) from # coolant frac and channel dimensions # Assumes up/down flow, two 90 deg bends per length blanket_library.n_blkt_outboard_channels = ( - fwbs_variables.f_a_blkt_cooling_channels - * fwbs_variables.vol_blkt_outboard + self.data.fwbs.f_a_blkt_cooling_channels + * self.data.fwbs.vol_blkt_outboard ) / ( np.pi - * fwbs_variables.radius_fw_channel - * fwbs_variables.radius_fw_channel + * self.data.fwbs.radius_fw_channel + * self.data.fwbs.radius_fw_channel * blanket_library.len_blkt_outboard_channel_total ) npblkto_liq = ( - fwbs_variables.nopipes - * fwbs_variables.n_blkt_outboard_modules_toroidal - * fwbs_variables.n_blkt_outboard_modules_poloidal + self.data.fwbs.nopipes + * self.data.fwbs.n_blkt_outboard_modules_toroidal + * self.data.fwbs.n_blkt_outboard_modules_poloidal ) # Mass flow rate per coolant pipe @@ -1148,32 +1147,32 @@ def thermo_hydraulic_model_pressure_drop_calculations(self, output: bool): blanket_library.vel_blkt_outboard_coolant = self.flow_velocity( i_channel_shape=1, mass_flow_rate=blanket_library.mfblktpo, - flow_density=fwbs_variables.den_blkt_coolant, + flow_density=self.data.fwbs.den_blkt_coolant, ) velblkto_liq = self.flow_velocity( i_channel_shape=2, mass_flow_rate=mfblktpo_liq, - flow_density=fwbs_variables.den_liq, + flow_density=self.data.fwbs.den_liq, ) - if fwbs_variables.i_blkt_inboard == 1: + if self.data.fwbs.i_blkt_inboard == 1: # Calc total num of pipes (in all inboard modules) from # coolant frac and channel dimensions # Assumes up/down flow, two 90 deg bends per length blanket_library.n_blkt_inboard_channels = ( - fwbs_variables.f_a_blkt_cooling_channels - * fwbs_variables.vol_blkt_inboard + self.data.fwbs.f_a_blkt_cooling_channels + * self.data.fwbs.vol_blkt_inboard ) / ( np.pi - * fwbs_variables.radius_fw_channel - * fwbs_variables.radius_fw_channel + * self.data.fwbs.radius_fw_channel + * self.data.fwbs.radius_fw_channel * blanket_library.len_blkt_inboard_channel_total ) # Have DEMO DCLL set here for now npblkti_liq = ( - fwbs_variables.nopipes - * fwbs_variables.n_blkt_inboard_modules_toroidal - * fwbs_variables.n_blkt_inboard_modules_poloidal + self.data.fwbs.nopipes + * self.data.fwbs.n_blkt_inboard_modules_toroidal + * self.data.fwbs.n_blkt_inboard_modules_poloidal ) # Mass flow rate per coolant pipe @@ -1188,32 +1187,32 @@ def thermo_hydraulic_model_pressure_drop_calculations(self, output: bool): blanket_library.vel_blkt_inboard_coolant = self.flow_velocity( i_channel_shape=1, mass_flow_rate=blanket_library.mfblktpi, - flow_density=fwbs_variables.den_blkt_coolant, + flow_density=self.data.fwbs.den_blkt_coolant, ) velblkti_liq = self.flow_velocity( i_channel_shape=2, mass_flow_rate=blanket_library.mfblktpi_liq, - flow_density=fwbs_variables.den_liq, + flow_density=self.data.fwbs.den_liq, ) # If the blanket is single-coolant with liquid metal breeder... - elif fwbs_variables.i_blkt_dual_coolant == 1: + elif self.data.fwbs.i_blkt_dual_coolant == 1: # Calc total num of pipes (in all inboard modules) from # coolant frac and channel dimensions # Assumes up/down flow, two 90 deg bends per length blanket_library.n_blkt_outboard_channels = ( - fwbs_variables.f_a_blkt_cooling_channels - * fwbs_variables.vol_blkt_outboard + self.data.fwbs.f_a_blkt_cooling_channels + * self.data.fwbs.vol_blkt_outboard ) / ( np.pi - * fwbs_variables.radius_fw_channel - * fwbs_variables.radius_fw_channel + * self.data.fwbs.radius_fw_channel + * self.data.fwbs.radius_fw_channel * blanket_library.len_blkt_outboard_channel_total ) npblkto_liq = ( - fwbs_variables.nopipes - * fwbs_variables.n_blkt_outboard_modules_toroidal - * fwbs_variables.n_blkt_outboard_modules_poloidal + self.data.fwbs.nopipes + * self.data.fwbs.n_blkt_outboard_modules_toroidal + * self.data.fwbs.n_blkt_outboard_modules_poloidal ) # Mass flow rate per coolant pipe @@ -1227,40 +1226,40 @@ def thermo_hydraulic_model_pressure_drop_calculations(self, output: bool): blanket_library.vel_blkt_outboard_coolant = self.flow_velocity( i_channel_shape=1, mass_flow_rate=blanket_library.mfblktpo, - flow_density=fwbs_variables.den_blkt_coolant, + flow_density=self.data.fwbs.den_blkt_coolant, ) # Get mass flow rate etc. for inboard blanket breeder flow for tritium extraction # Use the number of desired recirculations ([Aub2013]=10) and mass from dcll_masses # N.B. wht_liq is BZ mass, does not include manifold. blanket_library.mfblkto_liq = ( - fwbs_variables.n_liq_recirc * fwbs_variables.wht_liq_ob + self.data.fwbs.n_liq_recirc * self.data.fwbs.wht_liq_ob ) / (24 * 3600) blanket_library.mfblktpo_liq = blanket_library.mfblkto_liq / npblkto_liq velblkto_liq = self.flow_velocity( i_channel_shape=2, mass_flow_rate=blanket_library.mfblktpo_liq, - flow_density=fwbs_variables.den_liq, + flow_density=self.data.fwbs.den_liq, ) - if fwbs_variables.i_blkt_inboard == 1: + if self.data.fwbs.i_blkt_inboard == 1: # Calc total num of pipes (in all inboard modules) from # coolant frac and channel dimensions # Assumes up/down flow, two 90 deg bends per length blanket_library.n_blkt_inboard_channels = ( - fwbs_variables.f_a_blkt_cooling_channels - * fwbs_variables.vol_blkt_inboard + self.data.fwbs.f_a_blkt_cooling_channels + * self.data.fwbs.vol_blkt_inboard ) / ( np.pi - * fwbs_variables.radius_fw_channel - * fwbs_variables.radius_fw_channel + * self.data.fwbs.radius_fw_channel + * self.data.fwbs.radius_fw_channel * blanket_library.len_blkt_inboard_channel_total ) # Have DEMO DCLL set here for now npblkti_liq = ( - fwbs_variables.nopipes - * fwbs_variables.n_blkt_inboard_modules_toroidal - * fwbs_variables.n_blkt_inboard_modules_poloidal + self.data.fwbs.nopipes + * self.data.fwbs.n_blkt_inboard_modules_toroidal + * self.data.fwbs.n_blkt_inboard_modules_poloidal ) # Mass flow rate per coolant pipe @@ -1274,20 +1273,20 @@ def thermo_hydraulic_model_pressure_drop_calculations(self, output: bool): blanket_library.vel_blkt_inboard_coolant = self.flow_velocity( i_channel_shape=1, mass_flow_rate=blanket_library.mfblktpi, - flow_density=fwbs_variables.den_blkt_coolant, + flow_density=self.data.fwbs.den_blkt_coolant, ) # Get mass flow rate etc. for inboard blanket breeder flow for tritium extraction # Use the number of desired recirculations ([Aub2013]=10) and mass from dcll_masses # N.B. wht_liq is BZ mass, does not include manifold. blanket_library.mfblkti_liq = ( - fwbs_variables.n_liq_recirc * fwbs_variables.wht_liq_ib + self.data.fwbs.n_liq_recirc * self.data.fwbs.wht_liq_ib ) / (24 * 3600) blanket_library.mfblktpi_liq = blanket_library.mfblkti_liq / npblkti_liq velblkti_liq = self.flow_velocity( i_channel_shape=2, mass_flow_rate=blanket_library.mfblktpi_liq, - flow_density=fwbs_variables.den_liq, + flow_density=self.data.fwbs.den_liq, ) # If the blanket is single-coolant with solid breeder... @@ -1295,12 +1294,12 @@ def thermo_hydraulic_model_pressure_drop_calculations(self, output: bool): # Calculate total number of pipes (in all outboard modules) from coolant fraction and # channel dimensions (assumes up/down flow, two 90 deg bends per length) blanket_library.n_blkt_outboard_channels = ( - fwbs_variables.f_a_blkt_cooling_channels - * fwbs_variables.vol_blkt_outboard + self.data.fwbs.f_a_blkt_cooling_channels + * self.data.fwbs.vol_blkt_outboard ) / ( np.pi - * fwbs_variables.radius_fw_channel - * fwbs_variables.radius_fw_channel + * self.data.fwbs.radius_fw_channel + * self.data.fwbs.radius_fw_channel * blanket_library.len_blkt_outboard_channel_total ) @@ -1315,20 +1314,20 @@ def thermo_hydraulic_model_pressure_drop_calculations(self, output: bool): blanket_library.vel_blkt_outboard_coolant = self.flow_velocity( i_channel_shape=1, mass_flow_rate=blanket_library.mfblktpo, - flow_density=fwbs_variables.den_blkt_coolant, + flow_density=self.data.fwbs.den_blkt_coolant, ) - if fwbs_variables.i_blkt_inboard == 1: + if self.data.fwbs.i_blkt_inboard == 1: # Calc total num of pipes (in all inboard modules) from # coolant frac and channel dimensions # Assumes up/down flow, two 90 deg bends per length blanket_library.n_blkt_inboard_channels = ( - fwbs_variables.f_a_blkt_cooling_channels - * fwbs_variables.vol_blkt_inboard + self.data.fwbs.f_a_blkt_cooling_channels + * self.data.fwbs.vol_blkt_inboard ) / ( np.pi - * fwbs_variables.radius_fw_channel - * fwbs_variables.radius_fw_channel + * self.data.fwbs.radius_fw_channel + * self.data.fwbs.radius_fw_channel * blanket_library.len_blkt_inboard_channel_total ) @@ -1343,25 +1342,29 @@ def thermo_hydraulic_model_pressure_drop_calculations(self, output: bool): blanket_library.vel_blkt_inboard_coolant = self.flow_velocity( i_channel_shape=1, mass_flow_rate=blanket_library.mfblktpi, - flow_density=fwbs_variables.den_blkt_coolant, + flow_density=self.data.fwbs.den_blkt_coolant, ) # FW Presure Drops ############### ( - fwbs_variables.radius_blkt_channel_90_bend, - fwbs_variables.radius_blkt_channel_180_bend, - ) = self.calculate_pipe_bend_radius(i_ps=1) + self.data.fwbs.radius_blkt_channel_90_bend, + self.data.fwbs.radius_blkt_channel_180_bend, + ) = self.calculate_pipe_bend_radius( + i_ps=1, + radius_fw_channel=self.data.fwbs.radius_fw_channel, + b_bz_liq=self.data.fwbs.b_bz_liq, + ) dpres_fw_inboard_coolant = self.total_pressure_drop( output, icoolpump=1, vel_coolant=vel_fw_inboard_coolant, - len_pipe=fwbs_variables.len_fw_channel, + len_pipe=self.data.fwbs.len_fw_channel, n_pipe_90_deg_bends=N_FW_PIPE_90_DEG_BENDS, n_pipe_180_deg_bends=N_FW_PIPE_180_DEG_BENDS, - den_coolant=fwbs_variables.den_fw_coolant, - visc_coolant_dynamic=fwbs_variables.visc_fw_coolant, + den_coolant=self.data.fwbs.den_fw_coolant, + visc_coolant_dynamic=self.data.fwbs.visc_fw_coolant, coolant_electrical_conductivity=0.0e0, pol_channel_length=pollengi, nopolchan=npoltoti, @@ -1372,11 +1375,11 @@ def thermo_hydraulic_model_pressure_drop_calculations(self, output: bool): output, icoolpump=1, vel_coolant=vel_fw_outboard_coolant, - len_pipe=fwbs_variables.len_fw_channel, + len_pipe=self.data.fwbs.len_fw_channel, n_pipe_90_deg_bends=N_FW_PIPE_90_DEG_BENDS, n_pipe_180_deg_bends=N_FW_PIPE_180_DEG_BENDS, - den_coolant=fwbs_variables.den_fw_coolant, - visc_coolant_dynamic=fwbs_variables.visc_fw_coolant, + den_coolant=self.data.fwbs.den_fw_coolant, + visc_coolant_dynamic=self.data.fwbs.visc_fw_coolant, coolant_electrical_conductivity=0.0e0, pol_channel_length=pollengo, nopolchan=npoltoto, @@ -1385,14 +1388,18 @@ def thermo_hydraulic_model_pressure_drop_calculations(self, output: bool): # BB Presure Drops ############### ( - fwbs_variables.radius_blkt_channel_90_bend, - fwbs_variables.radius_blkt_channel_180_bend, - ) = self.calculate_pipe_bend_radius(i_ps=1) + self.data.fwbs.radius_blkt_channel_90_bend, + self.data.fwbs.radius_blkt_channel_180_bend, + ) = self.calculate_pipe_bend_radius( + i_ps=1, + radius_fw_channel=self.data.fwbs.radius_fw_channel, + b_bz_liq=self.data.fwbs.b_bz_liq, + ) # Long polodal flows - if fwbs_variables.i_blkt_inboard == 1: - npoltoti = fwbs_variables.nopol * npblkti_liq - npoltoto = fwbs_variables.nopol * npblkto_liq + if self.data.fwbs.i_blkt_inboard == 1: + npoltoti = self.data.fwbs.nopol * npblkti_liq + npoltoto = self.data.fwbs.nopol * npblkto_liq dpres_blkt_outboard_coolant = self.total_pressure_drop( output, @@ -1401,15 +1408,15 @@ def thermo_hydraulic_model_pressure_drop_calculations(self, output: bool): len_pipe=blanket_library.len_blkt_outboard_channel_total, n_pipe_90_deg_bends=N_BLKT_PIPE_90_DEG_BENDS, n_pipe_180_deg_bends=N_BLKT_PIPE_180_DEG_BENDS, - den_coolant=fwbs_variables.den_blkt_coolant, - visc_coolant_dynamic=fwbs_variables.visc_blkt_coolant, + den_coolant=self.data.fwbs.den_blkt_coolant, + visc_coolant_dynamic=self.data.fwbs.visc_blkt_coolant, coolant_electrical_conductivity=0.0e0, pol_channel_length=pollengo, nopolchan=npoltoto, label="Outboard blanket", ) - if fwbs_variables.i_blkt_inboard == 1: + if self.data.fwbs.i_blkt_inboard == 1: dpres_blkt_inboard_coolant = self.total_pressure_drop( output, icoolpump=1, @@ -1417,8 +1424,8 @@ def thermo_hydraulic_model_pressure_drop_calculations(self, output: bool): len_pipe=blanket_library.len_blkt_inboard_channel_total, n_pipe_90_deg_bends=N_BLKT_PIPE_90_DEG_BENDS, n_pipe_180_deg_bends=N_BLKT_PIPE_180_DEG_BENDS, - den_coolant=fwbs_variables.den_blkt_coolant, - visc_coolant_dynamic=fwbs_variables.visc_blkt_coolant, + den_coolant=self.data.fwbs.den_blkt_coolant, + visc_coolant_dynamic=self.data.fwbs.visc_blkt_coolant, coolant_electrical_conductivity=0.0e0, pol_channel_length=pollengi, nopolchan=npoltoti, @@ -1426,7 +1433,7 @@ def thermo_hydraulic_model_pressure_drop_calculations(self, output: bool): ) # If the blanket has a liquid metal breeder... - if fwbs_variables.i_blkt_dual_coolant > 0: + if self.data.fwbs.i_blkt_dual_coolant > 0: deltap_blo_liq = self.total_pressure_drop( output, icoolpump=2, @@ -1434,14 +1441,14 @@ def thermo_hydraulic_model_pressure_drop_calculations(self, output: bool): len_pipe=bzfllengo_liq, n_pipe_90_deg_bends=no90bz_liq, n_pipe_180_deg_bends=no180bz_liq, - den_coolant=fwbs_variables.den_liq, - visc_coolant_dynamic=fwbs_variables.dynamic_viscosity_liq, - coolant_electrical_conductivity=fwbs_variables.electrical_conductivity_liq, + den_coolant=self.data.fwbs.den_liq, + visc_coolant_dynamic=self.data.fwbs.dynamic_viscosity_liq, + coolant_electrical_conductivity=self.data.fwbs.electrical_conductivity_liq, pol_channel_length=pollengo, nopolchan=npoltoto, label="Outboard blanket breeder liquid", ) - if fwbs_variables.i_blkt_inboard == 1: + if self.data.fwbs.i_blkt_inboard == 1: deltap_bli_liq = self.total_pressure_drop( output, icoolpump=2, @@ -1449,9 +1456,9 @@ def thermo_hydraulic_model_pressure_drop_calculations(self, output: bool): len_pipe=bzfllengi_liq, n_pipe_90_deg_bends=no90bz_liq, n_pipe_180_deg_bends=no180bz_liq, - den_coolant=fwbs_variables.den_liq, - visc_coolant_dynamic=fwbs_variables.dynamic_viscosity_liq, - coolant_electrical_conductivity=fwbs_variables.electrical_conductivity_liq, + den_coolant=self.data.fwbs.den_liq, + visc_coolant_dynamic=self.data.fwbs.dynamic_viscosity_liq, + coolant_electrical_conductivity=self.data.fwbs.electrical_conductivity_liq, pol_channel_length=pollengi, nopolchan=npoltoti, label="Inboard blanket breeder liquid", @@ -1472,7 +1479,7 @@ def thermo_hydraulic_model_pressure_drop_calculations(self, output: bool): deltap_blo_liq, ] - if fwbs_variables.i_blkt_inboard == 1: + if self.data.fwbs.i_blkt_inboard == 1: return [ dpres_fw_inboard_coolant, dpres_fw_outboard_coolant, @@ -1729,15 +1736,15 @@ def liquid_breeder_properties(self, output: bool = False): thermophysical properties, Fusion Engineering and Design, 138, 183-195. """ # Use mid temp - if fwbs_variables.inlet_temp_liq == fwbs_variables.outlet_temp_liq: - mid_temp_liq = fwbs_variables.outlet_temp_liq + if self.data.fwbs.inlet_temp_liq == self.data.fwbs.outlet_temp_liq: + mid_temp_liq = self.data.fwbs.outlet_temp_liq else: mid_temp_liq = ( - fwbs_variables.inlet_temp_liq + fwbs_variables.outlet_temp_liq + self.data.fwbs.inlet_temp_liq + self.data.fwbs.outlet_temp_liq ) * 0.5 # If the liquid metal is PbLi... - if fwbs_variables.i_blkt_liquid_breeder_type == 0: + if self.data.fwbs.i_blkt_liquid_breeder_type == 0: # PbLi from [Mar2019] # Constant pressure ~ 17 atmospheres ~ 1.7D6 Pa # Li content is ~ 17% @@ -1753,15 +1760,15 @@ def liquid_breeder_properties(self, output: bool = False): # electrical_conductivity A V-1 m-1 T in Kelvin range = 600-800 K # Caculate properties - fwbs_variables.den_liq = 1.052e4 * (1 - mid_temp_liq * 1.13e-4) + self.data.fwbs.den_liq = 1.052e4 * (1 - mid_temp_liq * 1.13e-4) - fwbs_variables.specific_heat_liq = 1.95e2 - mid_temp_liq * 9.116e-3 + self.data.fwbs.specific_heat_liq = 1.95e2 - mid_temp_liq * 9.116e-3 - fwbs_variables.thermal_conductivity_liq = ( + self.data.fwbs.thermal_conductivity_liq = ( 1.95 + (mid_temp_liq - 273.15) * 1.96e-2 ) - fwbs_variables.dynamic_viscosity_liq = ( + self.data.fwbs.dynamic_viscosity_liq = ( 6.11e-3 - (2.257e-5 * (mid_temp_liq - 273.15)) + (3.766e-8 * (mid_temp_liq - 273.15) ** 2) @@ -1773,7 +1780,7 @@ def liquid_breeder_properties(self, output: bool = False): t_ranges[:4, 0] = 508.0 t_ranges[:4, 1] = 880.0 - fwbs_variables.electrical_conductivity_liq = 1.0 / ( + self.data.fwbs.electrical_conductivity_liq = 1.0 / ( 1.03e-6 - (6.75e-11 * mid_temp_liq) + (4.18e-13 * mid_temp_liq**2) ) @@ -1781,7 +1788,7 @@ def liquid_breeder_properties(self, output: bool = False): t_ranges[4, 1] = 800.0 # If the liquid metal is Li... - elif fwbs_variables.i_blkt_liquid_breeder_type == 1: + elif self.data.fwbs.i_blkt_liquid_breeder_type == 1: # Temporary - should be updated with information from Li reviews conducted at CCFE once completed # Li Properties from [Mal1995] at 300 Celcius # den_liq = 505 kg/m3 @@ -1792,30 +1799,30 @@ def liquid_breeder_properties(self, output: bool = False): # New from 'Application of lithium in systems of fusion reactors. 1. Physical and chemical properties of lithium' # Lyublinski et al., 2009, Plasma Devicec and Operations - fwbs_variables.den_liq = ( + self.data.fwbs.den_liq = ( 504.43 - (0.2729 * mid_temp_liq) - (8.0035e-5 * mid_temp_liq**2) + (3.799e-8 * mid_temp_liq**3) ) - fwbs_variables.specific_heat_liq = ( + self.data.fwbs.specific_heat_liq = ( 31.227 + (0.205e6 * mid_temp_liq ** (-2)) - (5.265e-3 * mid_temp_liq) + (2.628e6 * mid_temp_liq ** (-2)) ) # thermal_conductivity_liq also in paper - fwbs_variables.dynamic_viscosity_liq = np.exp( + self.data.fwbs.dynamic_viscosity_liq = np.exp( -4.16e0 - (0.64 * np.log(mid_temp_liq)) + (262.1 / mid_temp_liq) ) - fwbs_variables.electrical_conductivity_liq = ( + self.data.fwbs.electrical_conductivity_liq = ( (0.9249e9 * mid_temp_liq) + 2.3167e6 - (0.7131e3 * mid_temp_liq) ) # Magnetic feild strength in T for Hartmann calculation # IB - if fwbs_variables.i_blkt_inboard == 1: - fwbs_variables.b_mag_blkt[0] = ( + if self.data.fwbs.i_blkt_inboard == 1: + self.data.fwbs.b_mag_blkt[0] = ( physics_variables.b_plasma_toroidal_on_axis * physics_variables.rmajor / ( @@ -1825,8 +1832,8 @@ def liquid_breeder_properties(self, output: bool = False): ) ) # We do not use this if there is no IB blanket, but will use edge as fill value - if fwbs_variables.i_blkt_inboard == 0: - fwbs_variables.b_mag_blkt[0] = ( + if self.data.fwbs.i_blkt_inboard == 0: + self.data.fwbs.b_mag_blkt[0] = ( physics_variables.b_plasma_toroidal_on_axis * physics_variables.rmajor / ( @@ -1835,7 +1842,7 @@ def liquid_breeder_properties(self, output: bool = False): ) ) # OB - fwbs_variables.b_mag_blkt[1] = ( + self.data.fwbs.b_mag_blkt[1] = ( physics_variables.b_plasma_toroidal_on_axis * physics_variables.rmajor / ( @@ -1847,19 +1854,19 @@ def liquid_breeder_properties(self, output: bool = False): # Calculate Hartmann number con_vsc_rat = ( - fwbs_variables.electrical_conductivity_liq - / fwbs_variables.dynamic_viscosity_liq + self.data.fwbs.electrical_conductivity_liq + / self.data.fwbs.dynamic_viscosity_liq ) # Use toroidal width of the rectangular cooling channel as characteristic length scale - fwbs_variables.hartmann_liq = ( - np.asarray(fwbs_variables.b_mag_blkt) - * fwbs_variables.a_bz_liq + self.data.fwbs.hartmann_liq = ( + np.asarray(self.data.fwbs.b_mag_blkt) + * self.data.fwbs.a_bz_liq / 2.0 * np.sqrt(con_vsc_rat) ) # Error for temperature range of breeder property realtions - if fwbs_variables.i_blkt_liquid_breeder_type == 0 and ( + if self.data.fwbs.i_blkt_liquid_breeder_type == 0 and ( (t_ranges[:, 0] > mid_temp_liq).any() or (t_ranges[:, 1] < mid_temp_liq).any() ): @@ -1897,53 +1904,53 @@ def liquid_breeder_properties(self, output: bool = False): po.oheadr(self.outfile, "Blanket : Liquid Breeder Properties") - if fwbs_variables.i_blkt_dual_coolant == 1: + if self.data.fwbs.i_blkt_dual_coolant == 1: po.ocmmnt( self.outfile, "Single coolant: liquid metal circulted for tritium extraction.", ) - if fwbs_variables.i_blkt_dual_coolant == 2: + if self.data.fwbs.i_blkt_dual_coolant == 2: po.ocmmnt(self.outfile, "Dual coolant: self-cooled liquid metal breeder.") - if fwbs_variables.i_blkt_liquid_breeder_type == 0: + if self.data.fwbs.i_blkt_liquid_breeder_type == 0: po.ocmmnt( self.outfile, "Blanket breeder type (i_blkt_liquid_breeder_type=0), PbLi (~ 17% Li)", ) - if fwbs_variables.i_blkt_liquid_breeder_type == 1: + if self.data.fwbs.i_blkt_liquid_breeder_type == 1: po.ocmmnt( self.outfile, "Blanket breeder type (i_blkt_liquid_breeder_type=1), Li" ) po.ovarrf( - self.outfile, "Density (kg m-3)", "(den_liq)", fwbs_variables.den_liq, "OP " + self.outfile, "Density (kg m-3)", "(den_liq)", self.data.fwbs.den_liq, "OP " ) po.ovarrf( self.outfile, "Viscosity (Pa s)", "(dynamic_viscosity_liq)", - fwbs_variables.dynamic_viscosity_liq, + self.data.fwbs.dynamic_viscosity_liq, "OP ", ) po.ovarrf( self.outfile, "Electrical Conductivity (A V-1 m-1)", "(electrical_conductivity_liq)", - fwbs_variables.electrical_conductivity_liq, + self.data.fwbs.electrical_conductivity_liq, "OP ", ) po.ovarrf( self.outfile, "Hartmann Number IB", "(hartmann_liq)", - fwbs_variables.hartmann_liq[0], + self.data.fwbs.hartmann_liq[0], "OP ", ) po.ovarrf( self.outfile, "Hartmann Number OB", "(hartmann_liq)", - fwbs_variables.hartmann_liq[0], + self.data.fwbs.hartmann_liq[0], "OP ", ) @@ -1951,14 +1958,14 @@ def liquid_breeder_properties(self, output: bool = False): self.outfile, "Inlet Temperature (Celcius)", "(inlet_temp_liq)", - fwbs_variables.inlet_temp_liq, + self.data.fwbs.inlet_temp_liq, "OP ", ) po.ovarre( self.outfile, "Outlet Temperature (Celcius)", "(outlet_temp_liq)", - fwbs_variables.outlet_temp_liq, + self.data.fwbs.outlet_temp_liq, "OP ", ) @@ -1983,14 +1990,14 @@ def flow_velocity(self, i_channel_shape, mass_flow_rate, flow_density): return mass_flow_rate / ( flow_density * np.pi - * fwbs_variables.radius_fw_channel - * fwbs_variables.radius_fw_channel + * self.data.fwbs.radius_fw_channel + * self.data.fwbs.radius_fw_channel ) # If secondary coolant then rectangular channels assumed if i_channel_shape == 2: return mass_flow_rate / ( - flow_density * fwbs_variables.a_bz_liq * fwbs_variables.b_bz_liq + flow_density * self.data.fwbs.a_bz_liq * self.data.fwbs.b_bz_liq ) raise ProcessValueError( @@ -2048,12 +2055,12 @@ def thermo_hydraulic_model(self, output: bool): ###################################################### # IB/OB FW (MW) blanket_library.p_fw_inboard_nuclear_heat_mw = ( - fwbs_variables.p_fw_nuclear_heat_total_mw + self.data.fwbs.p_fw_nuclear_heat_total_mw * self.data.first_wall.a_fw_inboard / self.data.first_wall.a_fw_total ) blanket_library.p_fw_outboard_nuclear_heat_mw = ( - fwbs_variables.p_fw_nuclear_heat_total_mw + self.data.fwbs.p_fw_nuclear_heat_total_mw * self.data.first_wall.a_fw_outboard / self.data.first_wall.a_fw_total ) @@ -2061,18 +2068,18 @@ def thermo_hydraulic_model(self, output: bool): # IB/OB Blanket (MW) # Neutron power deposited in inboard blanket (MW) - if fwbs_variables.i_blkt_inboard == 1: + if self.data.fwbs.i_blkt_inboard == 1: blanket_library.p_blkt_nuclear_heat_inboard_mw = ( - fwbs_variables.p_blkt_nuclear_heat_total_mw - * fwbs_variables.vol_blkt_inboard - / fwbs_variables.vol_blkt_total + self.data.fwbs.p_blkt_nuclear_heat_total_mw + * self.data.fwbs.vol_blkt_inboard + / self.data.fwbs.vol_blkt_total ) # Neutron power deposited in outboard blanket (MW) blanket_library.p_blkt_nuclear_heat_outboard_mw = ( - fwbs_variables.p_blkt_nuclear_heat_total_mw - * fwbs_variables.vol_blkt_outboard - / fwbs_variables.vol_blkt_total + self.data.fwbs.p_blkt_nuclear_heat_total_mw + * self.data.fwbs.vol_blkt_outboard + / self.data.fwbs.vol_blkt_total ) # For a dual-coolant blanket, some fraction of the power goes into the @@ -2080,104 +2087,104 @@ def thermo_hydraulic_model(self, output: bool): # goes into the liquid breeder to be cooled by itself. # If the blanket is dual-coolant... - if fwbs_variables.i_blkt_dual_coolant == 2: - f_nuc_pow_bz_liq = 1 - fwbs_variables.f_nuc_pow_bz_struct + if self.data.fwbs.i_blkt_dual_coolant == 2: + f_nuc_pow_bz_liq = 1 - self.data.fwbs.f_nuc_pow_bz_struct # Inboard blanket calc. Will return 0 if no inboard dr_shld_inboard thickness pnucblkti_struct = ( - fwbs_variables.p_blkt_nuclear_heat_total_mw - * fwbs_variables.f_nuc_pow_bz_struct - ) * (fwbs_variables.vol_blkt_inboard / fwbs_variables.vol_blkt_total) + self.data.fwbs.p_blkt_nuclear_heat_total_mw + * self.data.fwbs.f_nuc_pow_bz_struct + ) * (self.data.fwbs.vol_blkt_inboard / self.data.fwbs.vol_blkt_total) pnucblkti_liq = ( - fwbs_variables.p_blkt_nuclear_heat_total_mw * f_nuc_pow_bz_liq - ) * (fwbs_variables.vol_blkt_inboard / fwbs_variables.vol_blkt_total) + self.data.fwbs.p_blkt_nuclear_heat_total_mw * f_nuc_pow_bz_liq + ) * (self.data.fwbs.vol_blkt_inboard / self.data.fwbs.vol_blkt_total) pnucblkto_struct = ( - fwbs_variables.p_blkt_nuclear_heat_total_mw - * fwbs_variables.f_nuc_pow_bz_struct - ) * (fwbs_variables.vol_blkt_outboard / fwbs_variables.vol_blkt_total) + self.data.fwbs.p_blkt_nuclear_heat_total_mw + * self.data.fwbs.f_nuc_pow_bz_struct + ) * (self.data.fwbs.vol_blkt_outboard / self.data.fwbs.vol_blkt_total) pnucblkto_liq = ( - fwbs_variables.p_blkt_nuclear_heat_total_mw * f_nuc_pow_bz_liq - ) * (fwbs_variables.vol_blkt_outboard / fwbs_variables.vol_blkt_total) + self.data.fwbs.p_blkt_nuclear_heat_total_mw * f_nuc_pow_bz_liq + ) * (self.data.fwbs.vol_blkt_outboard / self.data.fwbs.vol_blkt_total) # FW and BB Mass Flow ########### # Make sure that, if the inputs for the FW and blanket inputs are different, # the i_fw_blkt_shared_coolant variable is appropriately set for separate coolants if ( - fwbs_variables.i_fw_coolant_type == "Helium" - and fwbs_variables.i_blkt_coolant_type == 2 + self.data.fwbs.i_fw_coolant_type == "Helium" + and self.data.fwbs.i_blkt_coolant_type == 2 ): - fwbs_variables.i_fw_blkt_shared_coolant = ( + self.data.fwbs.i_fw_blkt_shared_coolant = ( FWBlktCoolantLoopTypes.SEPARATE_LOOPS ) if ( - fwbs_variables.i_fw_coolant_type == "Water" - and fwbs_variables.i_blkt_coolant_type == 1 + self.data.fwbs.i_fw_coolant_type == "Water" + and self.data.fwbs.i_blkt_coolant_type == 1 ): - fwbs_variables.i_fw_blkt_shared_coolant = ( + self.data.fwbs.i_fw_blkt_shared_coolant = ( FWBlktCoolantLoopTypes.SEPARATE_LOOPS ) # If FW and BB have the same coolant... - if fwbs_variables.i_fw_blkt_shared_coolant == FWBlktCoolantLoopTypes.SHARED_LOOP: + if self.data.fwbs.i_fw_blkt_shared_coolant == FWBlktCoolantLoopTypes.SHARED_LOOP: # Fraction of heat to be removed by IB/OB FW - if fwbs_variables.i_blkt_dual_coolant == 2: + if self.data.fwbs.i_blkt_dual_coolant == 2: f_nuc_fwi = ( blanket_library.p_fw_inboard_nuclear_heat_mw - + fwbs_variables.psurffwi + + self.data.fwbs.psurffwi ) / ( blanket_library.p_fw_inboard_nuclear_heat_mw - + fwbs_variables.psurffwi + + self.data.fwbs.psurffwi + pnucblkti_struct ) f_nuc_fwo = ( blanket_library.p_fw_outboard_nuclear_heat_mw - + fwbs_variables.psurffwo + + self.data.fwbs.psurffwo ) / ( blanket_library.p_fw_outboard_nuclear_heat_mw - + fwbs_variables.psurffwo + + self.data.fwbs.psurffwo + pnucblkto_struct ) else: f_nuc_fwi = ( blanket_library.p_fw_inboard_nuclear_heat_mw - + fwbs_variables.psurffwi + + self.data.fwbs.psurffwi ) / ( blanket_library.p_fw_inboard_nuclear_heat_mw - + fwbs_variables.psurffwi + + self.data.fwbs.psurffwi + blanket_library.p_blkt_nuclear_heat_inboard_mw ) f_nuc_fwo = ( blanket_library.p_fw_outboard_nuclear_heat_mw - + fwbs_variables.psurffwo + + self.data.fwbs.psurffwo ) / ( blanket_library.p_fw_outboard_nuclear_heat_mw - + fwbs_variables.psurffwo + + self.data.fwbs.psurffwo + blanket_library.p_blkt_nuclear_heat_outboard_mw ) # Outlet FW/inlet BB temp (mass flow FW = mass flow BB) - if fwbs_variables.i_blkt_inboard == 1: - fwoutleti = (f_nuc_fwi * fwbs_variables.temp_blkt_coolant_out) + ( + if self.data.fwbs.i_blkt_inboard == 1: + fwoutleti = (f_nuc_fwi * self.data.fwbs.temp_blkt_coolant_out) + ( 1 - f_nuc_fwi - ) * fwbs_variables.temp_fw_coolant_in + ) * self.data.fwbs.temp_fw_coolant_in inlet_tempi = fwoutleti else: - fwoutleti = fwbs_variables.temp_fw_coolant_out + fwoutleti = self.data.fwbs.temp_fw_coolant_out - fwoutleto = (f_nuc_fwo * fwbs_variables.temp_blkt_coolant_out) + ( + fwoutleto = (f_nuc_fwo * self.data.fwbs.temp_blkt_coolant_out) + ( 1 - f_nuc_fwo - ) * fwbs_variables.temp_fw_coolant_in + ) * self.data.fwbs.temp_fw_coolant_in inlet_tempo = fwoutleto elif ( - fwbs_variables.i_fw_blkt_shared_coolant + self.data.fwbs.i_fw_blkt_shared_coolant == FWBlktCoolantLoopTypes.SEPARATE_LOOPS ): - fwoutleti = fwbs_variables.temp_fw_coolant_out - inlet_tempi = fwbs_variables.temp_blkt_coolant_in - fwoutleto = fwbs_variables.temp_fw_coolant_out - inlet_tempo = fwbs_variables.temp_blkt_coolant_in + fwoutleti = self.data.fwbs.temp_fw_coolant_out + inlet_tempi = self.data.fwbs.temp_blkt_coolant_in + fwoutleto = self.data.fwbs.temp_fw_coolant_out + inlet_tempo = self.data.fwbs.temp_blkt_coolant_in # Maximum FW temperature. (27/11/2015) Issue #348 # First wall flow is just along the first wall, with no allowance for radial @@ -2190,10 +2197,10 @@ def thermo_hydraulic_model(self, output: bool): blanket_library.mflow_fw_inboard_coolant_channel, ) = self.fw.fw_temp( output, - fwbs_variables.radius_fw_channel, + self.data.fwbs.radius_fw_channel, build_variables.dr_fw_inboard, self.data.first_wall.a_fw_inboard, - fwbs_variables.psurffwi, + self.data.fwbs.psurffwi, blanket_library.p_fw_inboard_nuclear_heat_mw, "Inboard first wall", ) @@ -2204,84 +2211,84 @@ def thermo_hydraulic_model(self, output: bool): blanket_library.mflow_fw_outboard_coolant_channel, ) = self.fw.fw_temp( output, - fwbs_variables.radius_fw_channel, + self.data.fwbs.radius_fw_channel, build_variables.dr_fw_outboard, self.data.first_wall.a_fw_outboard, - fwbs_variables.psurffwo, + self.data.fwbs.psurffwo, blanket_library.p_fw_outboard_nuclear_heat_mw, "Outboard first wall", ) # Peak first wall temperature (K) - fwbs_variables.temp_fw_peak = max( + self.data.fwbs.temp_fw_peak = max( blanket_library.temp_fw_inboard_peak, blanket_library.temp_fw_outboard_peak ) # Total mass flow rate to remove inboard FW power (kg/s) blanket_library.mflow_fw_inboard_coolant_total = ( 1.0e6 - * (blanket_library.p_fw_inboard_nuclear_heat_mw + fwbs_variables.psurffwi) - / (fwbs_variables.cp_fw * (fwoutleti - fwbs_variables.temp_fw_coolant_in)) + * (blanket_library.p_fw_inboard_nuclear_heat_mw + self.data.fwbs.psurffwi) + / (self.data.fwbs.cp_fw * (fwoutleti - self.data.fwbs.temp_fw_coolant_in)) ) # Total mass flow rate to remove outboard FW power (kg/s) blanket_library.mflow_fw_outboard_coolant_total = ( 1.0e6 - * (blanket_library.p_fw_outboard_nuclear_heat_mw + fwbs_variables.psurffwo) - / (fwbs_variables.cp_fw * (fwoutleto - fwbs_variables.temp_fw_coolant_in)) + * (blanket_library.p_fw_outboard_nuclear_heat_mw + self.data.fwbs.psurffwo) + / (self.data.fwbs.cp_fw * (fwoutleto - self.data.fwbs.temp_fw_coolant_in)) ) # If the blanket is dual-coolant... - if fwbs_variables.i_blkt_dual_coolant == 2: + if self.data.fwbs.i_blkt_dual_coolant == 2: # Mass flow rates for outboard blanket coolants (kg/s) blanket_library.mflow_blkt_outboard_coolant = ( 1.0e6 * (pnucblkto_struct) / ( - fwbs_variables.cp_bl - * (fwbs_variables.temp_blkt_coolant_out - inlet_tempo) + self.data.fwbs.cp_bl + * (self.data.fwbs.temp_blkt_coolant_out - inlet_tempo) ) ) blanket_library.mfblkto_liq = ( 1.0e6 * (pnucblkto_liq) / ( - fwbs_variables.specific_heat_liq - * (fwbs_variables.outlet_temp_liq - fwbs_variables.inlet_temp_liq) + self.data.fwbs.specific_heat_liq + * (self.data.fwbs.outlet_temp_liq - self.data.fwbs.inlet_temp_liq) ) ) # If there is an IB blanket... - if fwbs_variables.i_blkt_inboard == 1: + if self.data.fwbs.i_blkt_inboard == 1: # Mass flow rates for inboard blanket coolants (kg/s) blanket_library.mflow_blkt_inboard_coolant = ( 1.0e6 * (pnucblkti_struct) / ( - fwbs_variables.cp_bl - * (fwbs_variables.temp_blkt_coolant_out - inlet_tempi) + self.data.fwbs.cp_bl + * (self.data.fwbs.temp_blkt_coolant_out - inlet_tempi) ) ) blanket_library.mfblkti_liq = ( 1.0e6 * (pnucblkti_liq) / ( - fwbs_variables.specific_heat_liq + self.data.fwbs.specific_heat_liq * ( - fwbs_variables.outlet_temp_liq - - fwbs_variables.inlet_temp_liq + self.data.fwbs.outlet_temp_liq + - self.data.fwbs.inlet_temp_liq ) ) ) # If the blanket is single-coolant with liquid metal breeder... - elif fwbs_variables.i_blkt_dual_coolant == 1: + elif self.data.fwbs.i_blkt_dual_coolant == 1: # Mass flow rate for outboard blanket coolant (kg/s) blanket_library.mflow_blkt_outboard_coolant = ( 1.0e6 * (blanket_library.p_blkt_nuclear_heat_outboard_mw) / ( - fwbs_variables.cp_bl - * (fwbs_variables.temp_blkt_coolant_out - inlet_tempo) + self.data.fwbs.cp_bl + * (self.data.fwbs.temp_blkt_coolant_out - inlet_tempo) ) ) @@ -2289,23 +2296,23 @@ def thermo_hydraulic_model(self, output: bool): # Use the number of desired recirculations ([Aub2013]=10) and mass from dcll_masses # N.B. wht_liq is BZ mass, does not include manifold. blanket_library.mfblkto_liq = ( - fwbs_variables.n_liq_recirc * fwbs_variables.wht_liq_ob + self.data.fwbs.n_liq_recirc * self.data.fwbs.wht_liq_ob ) / (24 * 3600) # If there is an IB blanket... - if fwbs_variables.i_blkt_inboard == 1: + if self.data.fwbs.i_blkt_inboard == 1: # Mass flow rate for inboard blanket coolant (kg/s) blanket_library.mflow_blkt_inboard_coolant = ( 1.0e6 * (blanket_library.p_blkt_nuclear_heat_inboard_mw) / ( - fwbs_variables.cp_bl - * (fwbs_variables.temp_blkt_coolant_out - inlet_tempi) + self.data.fwbs.cp_bl + * (self.data.fwbs.temp_blkt_coolant_out - inlet_tempi) ) ) # Mass flow rate for inboard breeder flow (kg/s) - fwbs_variables.mfblkti_liq = ( - fwbs_variables.n_liq_recirc * fwbs_variables.wht_liq_ib + self.data.fwbs.mfblkti_liq = ( + self.data.fwbs.n_liq_recirc * self.data.fwbs.wht_liq_ib ) / (24 * 3600) # If the blanket is single-coolant with solid breeder... @@ -2315,20 +2322,20 @@ def thermo_hydraulic_model(self, output: bool): 1.0e6 * (blanket_library.p_blkt_nuclear_heat_outboard_mw) / ( - fwbs_variables.cp_bl - * (fwbs_variables.temp_blkt_coolant_out - inlet_tempo) + self.data.fwbs.cp_bl + * (self.data.fwbs.temp_blkt_coolant_out - inlet_tempo) ) ) # If there is an IB blanket... # Mass flow rate for inboard blanket coolant (kg/s) - if fwbs_variables.i_blkt_inboard == 1: + if self.data.fwbs.i_blkt_inboard == 1: blanket_library.mflow_blkt_inboard_coolant = ( 1.0e6 * (blanket_library.p_blkt_nuclear_heat_inboard_mw) / ( - fwbs_variables.cp_bl - * (fwbs_variables.temp_blkt_coolant_out - inlet_tempi) + self.data.fwbs.cp_bl + * (self.data.fwbs.temp_blkt_coolant_out - inlet_tempi) ) ) @@ -2337,7 +2344,7 @@ def thermo_hydraulic_model(self, output: bool): ######################################################## # load in pressures if primary pumping == 2 - i_p_coolant_pumping = PumpingPowerModelTypes(fwbs_variables.i_p_coolant_pumping) + i_p_coolant_pumping = PumpingPowerModelTypes(self.data.fwbs.i_p_coolant_pumping) if i_p_coolant_pumping == PumpingPowerModelTypes.MECHANICAL: deltap = self.thermo_hydraulic_model_pressure_drop_calculations( output=output @@ -2345,24 +2352,24 @@ def thermo_hydraulic_model(self, output: bool): deltap_fwi = deltap[0] deltap_fwo = deltap[1] deltap_blo = deltap[2] - if fwbs_variables.i_blkt_dual_coolant > 0: - if fwbs_variables.i_blkt_inboard == 1: + if self.data.fwbs.i_blkt_dual_coolant > 0: + if self.data.fwbs.i_blkt_inboard == 1: deltap_bli = deltap[3] deltap_blo_liq = deltap[4] deltap_bli_liq = deltap[5] else: deltap_blo_liq = deltap[3] - elif fwbs_variables.i_blkt_inboard == 1: + elif self.data.fwbs.i_blkt_inboard == 1: deltap_bli = deltap[3] # Pumping Power # If FW and BB have the same coolant... - if fwbs_variables.i_fw_blkt_shared_coolant == FWBlktCoolantLoopTypes.SHARED_LOOP: + if self.data.fwbs.i_fw_blkt_shared_coolant == FWBlktCoolantLoopTypes.SHARED_LOOP: # Total pressure drop in the first wall/blanket (Pa) if i_p_coolant_pumping == PumpingPowerModelTypes.MECHANICAL: - if fwbs_variables.i_blkt_inboard == 1: + if self.data.fwbs.i_blkt_inboard == 1: deltap_fw_blkt = deltap_fwi + deltap_bli + deltap_fwo + deltap_blo - if fwbs_variables.i_blkt_inboard == 0: + if self.data.fwbs.i_blkt_inboard == 0: deltap_fw_blkt = deltap_fwi + deltap_fwo + deltap_blo elif ( i_p_coolant_pumping @@ -2380,20 +2387,20 @@ def thermo_hydraulic_model(self, output: bool): self.coolant_pumping_power( output=output, i_liquid_breeder=1, - temp_coolant_pump_outlet=fwbs_variables.temp_fw_coolant_in, - temp_coolant_pump_inlet=fwbs_variables.temp_blkt_coolant_out, - pres_coolant_pump_inlet=fwbs_variables.pres_fw_coolant, + temp_coolant_pump_outlet=self.data.fwbs.temp_fw_coolant_in, + temp_coolant_pump_inlet=self.data.fwbs.temp_blkt_coolant_out, + pres_coolant_pump_inlet=self.data.fwbs.pres_fw_coolant, dpres_coolant=deltap_fw_blkt, mflow_coolant_total=blanket_library.mftotal, - primary_coolant_switch=fwbs_variables.i_fw_coolant_type, - den_coolant=fwbs_variables.den_fw_coolant, + primary_coolant_switch=self.data.fwbs.i_fw_coolant_type, + den_coolant=self.data.fwbs.den_fw_coolant, label="First Wall and Blanket", ) ) # If FW and BB have different coolants... elif ( - fwbs_variables.i_fw_blkt_shared_coolant + self.data.fwbs.i_fw_blkt_shared_coolant == FWBlktCoolantLoopTypes.SEPARATE_LOOPS ): if i_p_coolant_pumping == PumpingPowerModelTypes.MECHANICAL: @@ -2401,9 +2408,9 @@ def thermo_hydraulic_model(self, output: bool): deltap_fw = deltap_fwi + deltap_fwo # Total pressure drop in the blanket (Pa) - if fwbs_variables.i_blkt_inboard == 1: + if self.data.fwbs.i_blkt_inboard == 1: deltap_blkt = deltap_bli + deltap_blo - if fwbs_variables.i_blkt_inboard == 0: + if self.data.fwbs.i_blkt_inboard == 0: deltap_blkt = deltap_blo elif ( i_p_coolant_pumping @@ -2427,13 +2434,13 @@ def thermo_hydraulic_model(self, output: bool): heat_transport_variables.p_fw_coolant_pump_mw = self.coolant_pumping_power( output=output, i_liquid_breeder=1, - temp_coolant_pump_outlet=fwbs_variables.temp_fw_coolant_in, - temp_coolant_pump_inlet=fwbs_variables.temp_fw_coolant_out, - pres_coolant_pump_inlet=fwbs_variables.pres_fw_coolant, + temp_coolant_pump_outlet=self.data.fwbs.temp_fw_coolant_in, + temp_coolant_pump_inlet=self.data.fwbs.temp_fw_coolant_out, + pres_coolant_pump_inlet=self.data.fwbs.pres_fw_coolant, dpres_coolant=deltap_fw, mflow_coolant_total=blanket_library.mflow_fw_coolant_total, - primary_coolant_switch=fwbs_variables.i_fw_coolant_type, - den_coolant=fwbs_variables.den_fw_coolant, + primary_coolant_switch=self.data.fwbs.i_fw_coolant_type, + den_coolant=self.data.fwbs.den_fw_coolant, label="First Wall", ) @@ -2441,15 +2448,15 @@ def thermo_hydraulic_model(self, output: bool): heat_transport_variables.p_blkt_coolant_pump_mw = self.coolant_pumping_power( output=output, i_liquid_breeder=1, - temp_coolant_pump_outlet=fwbs_variables.temp_blkt_coolant_in, - temp_coolant_pump_inlet=fwbs_variables.temp_blkt_coolant_out, - pres_coolant_pump_inlet=fwbs_variables.pres_blkt_coolant, + temp_coolant_pump_outlet=self.data.fwbs.temp_blkt_coolant_in, + temp_coolant_pump_inlet=self.data.fwbs.temp_blkt_coolant_out, + pres_coolant_pump_inlet=self.data.fwbs.pres_blkt_coolant, dpres_coolant=deltap_blkt, mflow_coolant_total=blanket_library.mflow_blkt_coolant_total, primary_coolant_switch=( - "Helium" if fwbs_variables.i_blkt_coolant_type == 1 else "Water" + "Helium" if self.data.fwbs.i_blkt_coolant_type == 1 else "Water" ), - den_coolant=fwbs_variables.den_blkt_coolant, + den_coolant=self.data.fwbs.den_blkt_coolant, label="Blanket", ) @@ -2460,12 +2467,12 @@ def thermo_hydraulic_model(self, output: bool): ) # If the blanket has a liquid metal breeder... - if fwbs_variables.i_blkt_dual_coolant > 0: + if self.data.fwbs.i_blkt_dual_coolant > 0: # Total pressure drop in the blanket (Pa) if i_p_coolant_pumping == PumpingPowerModelTypes.MECHANICAL: - if fwbs_variables.i_blkt_inboard == 1: + if self.data.fwbs.i_blkt_inboard == 1: deltap_bl_liq = deltap_bli_liq + deltap_blo_liq - if fwbs_variables.i_blkt_inboard == 0: + if self.data.fwbs.i_blkt_inboard == 0: deltap_bl_liq = deltap_blo_liq elif ( i_p_coolant_pumping @@ -2481,15 +2488,15 @@ def thermo_hydraulic_model(self, output: bool): heat_transport_variables.p_blkt_breeder_pump_mw = self.coolant_pumping_power( output=output, i_liquid_breeder=2, - temp_coolant_pump_outlet=fwbs_variables.inlet_temp_liq, - temp_coolant_pump_inlet=fwbs_variables.outlet_temp_liq, - pres_coolant_pump_inlet=fwbs_variables.blpressure_liq, + temp_coolant_pump_outlet=self.data.fwbs.inlet_temp_liq, + temp_coolant_pump_inlet=self.data.fwbs.outlet_temp_liq, + pres_coolant_pump_inlet=self.data.fwbs.blpressure_liq, dpres_coolant=deltap_bl_liq, mflow_coolant_total=blanket_library.mfblkt_liq, primary_coolant_switch=( - "Helium" if fwbs_variables.i_blkt_coolant_type == 1 else "Water" + "Helium" if self.data.fwbs.i_blkt_coolant_type == 1 else "Water" ), - den_coolant=fwbs_variables.den_liq, + den_coolant=self.data.fwbs.den_liq, label="Liquid Metal Breeder/Coolant", ) @@ -2508,52 +2515,52 @@ def thermo_hydraulic_model(self, output: bool): self.outfile, "First wall coolant type", "(i_fw_coolant_type)", - fwbs_variables.i_fw_coolant_type, + self.data.fwbs.i_fw_coolant_type, ) po.ovarre( self.outfile, "Wall thickness of first wall cooling channels (m)", "(dr_fw_wall)", - fwbs_variables.dr_fw_wall, + self.data.fwbs.dr_fw_wall, ) po.ovarre( self.outfile, "Radius of first wall cooling channels (m)", "(radius_fw_channel)", - fwbs_variables.radius_fw_channel, + self.data.fwbs.radius_fw_channel, ) po.ovarre( self.outfile, "Radius of blanket cooling channels (m)", "(radius_blkt_channel)", - fwbs_variables.radius_blkt_channel, + self.data.fwbs.radius_blkt_channel, ) po.ovarre( self.outfile, "Roughness of first wall cooling channels (m)", "(roughness_fw_channel)", - fwbs_variables.roughness_fw_channel, + self.data.fwbs.roughness_fw_channel, ) po.ovarrf( self.outfile, "Inlet temperature of first wall coolant (K)", "(temp_fw_coolant_in)", - fwbs_variables.temp_fw_coolant_in, + self.data.fwbs.temp_fw_coolant_in, ) po.ovarrf( self.outfile, "Outlet temperature of first wall coolant (K)", "(temp_fw_coolant_out)", - fwbs_variables.temp_fw_coolant_out, + self.data.fwbs.temp_fw_coolant_out, ) po.ovarre( self.outfile, "First wall coolant pressure (Pa)", "(pres_fw_coolant)", - fwbs_variables.pres_fw_coolant, + self.data.fwbs.pres_fw_coolant, ) if ( - fwbs_variables.i_fw_blkt_shared_coolant + self.data.fwbs.i_fw_blkt_shared_coolant == FWBlktCoolantLoopTypes.SEPARATE_LOOPS ): po.ovarre( @@ -2567,13 +2574,13 @@ def thermo_hydraulic_model(self, output: bool): self.outfile, "Allowable temperature of first wall material, excluding armour (K)", "(temp_fw_max)", - fwbs_variables.temp_fw_max, + self.data.fwbs.temp_fw_max, ) po.ovarrf( self.outfile, "Actual peak temperature of first wall material (K)", "(temp_fw_peak)", - fwbs_variables.temp_fw_peak, + self.data.fwbs.temp_fw_peak, "OP ", ) @@ -2589,28 +2596,28 @@ def thermo_hydraulic_model(self, output: bool): self.outfile, "Blanket coolant type (1=He, 2=H20)", "(i_blkt_coolant_type)", - fwbs_variables.i_blkt_coolant_type, + self.data.fwbs.i_blkt_coolant_type, ) po.ovarrf( self.outfile, "Inlet temperature of blanket coolant (K)", "(temp_blkt_coolant_in)", - fwbs_variables.temp_blkt_coolant_in, + self.data.fwbs.temp_blkt_coolant_in, ) po.ovarrf( self.outfile, "Outlet temperature of blanket coolant (K)", "(temp_blkt_coolant_out)", - fwbs_variables.temp_blkt_coolant_out, + self.data.fwbs.temp_blkt_coolant_out, ) po.ovarre( self.outfile, "Blanket (primary) coolant pressure (Pa)", "(pres_blkt_coolant)", - fwbs_variables.pres_blkt_coolant, + self.data.fwbs.pres_blkt_coolant, ) if ( - fwbs_variables.i_fw_blkt_shared_coolant + self.data.fwbs.i_fw_blkt_shared_coolant == FWBlktCoolantLoopTypes.SEPARATE_LOOPS ): po.ovarre( @@ -2623,7 +2630,7 @@ def thermo_hydraulic_model(self, output: bool): # Total primary coolant mass flow rate (if they are the same coolant) if ( - fwbs_variables.i_fw_blkt_shared_coolant + self.data.fwbs.i_fw_blkt_shared_coolant == FWBlktCoolantLoopTypes.SHARED_LOOP ): po.ovarre( @@ -2635,34 +2642,34 @@ def thermo_hydraulic_model(self, output: bool): ) # BB Liquid Metal Breeder ! - if fwbs_variables.i_blkt_dual_coolant > 0: + if self.data.fwbs.i_blkt_dual_coolant > 0: po.osubhd(self.outfile, "Breeding Blanket (breeder): ") po.ovarin( self.outfile, "Blanket liquid breeder type (0=PbLi, 1=Li)", "(i_blkt_liquid_breeder_type)", - fwbs_variables.i_blkt_liquid_breeder_type, + self.data.fwbs.i_blkt_liquid_breeder_type, ) - if fwbs_variables.i_blkt_dual_coolant == 2: + if self.data.fwbs.i_blkt_dual_coolant == 2: po.ocmmnt(self.outfile, "Dual-coolant BB, i.e. self-cooled breeder.") po.ovarrf( self.outfile, "Inlet temperature of blanket liquid breeder (K)", "(inlet_temp_liq)", - fwbs_variables.inlet_temp_liq, + self.data.fwbs.inlet_temp_liq, ) po.ovarrf( self.outfile, "Outlet temperature of blanket liquid breeder (K)", "(outlet_temp_liq)", - fwbs_variables.outlet_temp_liq, + self.data.fwbs.outlet_temp_liq, ) po.ovarre( self.outfile, "Blanket liquid breeder pressure (Pa)", "(blpressure_liq)", - fwbs_variables.blpressure_liq, + self.data.fwbs.blpressure_liq, ) else: po.ocmmnt( @@ -2682,7 +2689,7 @@ def thermo_hydraulic_model(self, output: bool): po.osubhd(self.outfile, "Mechanical pumping power: ") if ( - fwbs_variables.i_fw_blkt_shared_coolant + self.data.fwbs.i_fw_blkt_shared_coolant == FWBlktCoolantLoopTypes.SEPARATE_LOOPS ): po.ovarre( @@ -2699,7 +2706,7 @@ def thermo_hydraulic_model(self, output: bool): heat_transport_variables.p_blkt_coolant_pump_mw, "OP ", ) - if fwbs_variables.i_blkt_dual_coolant > 0: + if self.data.fwbs.i_blkt_dual_coolant > 0: po.ovarre( self.outfile, "Mechanical pumping power for blanket liquid breeder (MW)", @@ -2714,7 +2721,7 @@ def thermo_hydraulic_model(self, output: bool): primary_pumping_variables.p_fw_blkt_coolant_pump_mw, "OP ", ) - if fwbs_variables.i_blkt_dual_coolant > 0: + if self.data.fwbs.i_blkt_dual_coolant > 0: po.ovarre( self.outfile, "Total mechanical pumping power for FW, blanket and liquid metal breeder(MW)", @@ -2789,7 +2796,11 @@ def total_pressure_drop( Total pressure drop (Pa). """ radius_pipe_90_deg_bend, radius_pipe_180_deg_bend = ( - self.calculate_pipe_bend_radius(i_ps=icoolpump) + self.calculate_pipe_bend_radius( + i_ps=icoolpump, + radius_fw_channel=self.data.fwbs.radius_fw_channel, + b_bz_liq=self.data.fwbs.b_bz_liq, + ) ) # Friction - for all coolants @@ -2903,21 +2914,21 @@ def liquid_breeder_mhd_pressure_drop( """ # Magnetic feild strength in IB or OB blanket if label == "Inboard blanket breeder liquid": - b_mag = fwbs_variables.b_mag_blkt[0] # IB + b_mag = self.data.fwbs.b_mag_blkt[0] # IB if label == "Outboard blanket breeder liquid": - b_mag = fwbs_variables.b_mag_blkt[1] # OB + b_mag = self.data.fwbs.b_mag_blkt[1] # OB # Half-widths # N.B. a_bz_liq (width in the toroidal direction) is in B direction - half_wth_a = fwbs_variables.a_bz_liq * 0.5 - half_wth_b = fwbs_variables.b_bz_liq * 0.5 + half_wth_a = self.data.fwbs.a_bz_liq * 0.5 + half_wth_b = self.data.fwbs.b_bz_liq * 0.5 # If have thin conducting walls... - if fwbs_variables.i_blkt_liquid_breeder_channel_type != 1: + if self.data.fwbs.i_blkt_liquid_breeder_channel_type != 1: # Caculate resistances of fluid and walls r_i = half_wth_b / (conduct_liq * half_wth_a) r_w = half_wth_b / ( - fwbs_variables.bz_channel_conduct_liq * fwbs_variables.th_wall_secondary + self.data.fwbs.bz_channel_conduct_liq * self.data.fwbs.th_wall_secondary ) big_c = r_i / r_w # Calculate pressure drop for conducting wall [Miy1986] @@ -2940,7 +2951,7 @@ def liquid_breeder_mhd_pressure_drop( f"Liquid metal breeder/coolant MHD pressure drop for {label}", ) - if fwbs_variables.i_blkt_liquid_breeder_channel_type == 0: + if self.data.fwbs.i_blkt_liquid_breeder_channel_type == 0: po.ocmmnt( self.outfile, "Flow channels have thin conducting walls (i_blkt_liquid_breeder_channel_type==0)", @@ -2949,10 +2960,10 @@ def liquid_breeder_mhd_pressure_drop( self.outfile, "Wall conductance (A V-1 m-1)", "(bz_channel_conduct_liq)", - fwbs_variables.bz_channel_conduct_liq, + self.data.fwbs.bz_channel_conduct_liq, "OP ", ) - elif fwbs_variables.i_blkt_liquid_breeder_channel_type == 2: + elif self.data.fwbs.i_blkt_liquid_breeder_channel_type == 2: po.ocmmnt( self.outfile, "Flow Channel Inserts (FCIs) used (i_blkt_liquid_breeder_channel_type==2)", @@ -2961,7 +2972,7 @@ def liquid_breeder_mhd_pressure_drop( self.outfile, "FCI conductance (A V-1 m-1)", "(bz_channel_conduct_liq)", - fwbs_variables.bz_channel_conduct_liq, + self.data.fwbs.bz_channel_conduct_liq, "OP ", ) else: @@ -2994,22 +3005,23 @@ def liquid_breeder_mhd_pressure_drop( return liquid_breeder_pressure_drop_mhd - def calculate_pipe_bend_radius(self, i_ps: int): + @staticmethod + def calculate_pipe_bend_radius(i_ps: int, radius_fw_channel: float, b_bz_liq: float): """Set the pipe bend radius based on the coolant type. Parameters ---------- - i_ps : + i_ps : int switch for primary or secondary coolant - i_ps: int : + radius_fw_channel: float + radius of first wall cooling channels [m] + b_bz_liq: float + radial width of the rectangular cooling channel [m] + for long poloidal sections of blanket breeding zone """ # If primary coolant or secondary coolant (See DCLL) - radius_pipe_90_deg_bend = ( - (3 * fwbs_variables.radius_fw_channel) - if (i_ps == 1) - else fwbs_variables.b_bz_liq - ) + radius_pipe_90_deg_bend = (3 * radius_fw_channel) if (i_ps == 1) else b_bz_liq radius_pipe_180_deg_bend = radius_pipe_90_deg_bend / 2 return radius_pipe_90_deg_bend, radius_pipe_180_deg_bend @@ -3090,8 +3102,8 @@ def coolant_friction_pressure_drop( darcy_friction_factor = darcy_friction_haaland( reynolds=reynolds_number, - roughness_channel=fwbs_variables.roughness_fw_channel, - radius_channel=fwbs_variables.radius_fw_channel, + roughness_channel=self.data.fwbs.roughness_fw_channel, + radius_channel=self.data.fwbs.radius_fw_channel, ) # Pressure drop coefficient @@ -3204,15 +3216,15 @@ def pipe_hydraulic_diameter(self, i_channel_shape): """ # If primary coolant then circular channels assumed if i_channel_shape == 1: - return 2.0 * fwbs_variables.radius_fw_channel + return 2.0 * self.data.fwbs.radius_fw_channel # If secondary coolant then rectangular channels assumed if i_channel_shape == 2: return ( 2 - * fwbs_variables.a_bz_liq - * fwbs_variables.b_bz_liq - / (fwbs_variables.a_bz_liq + fwbs_variables.b_bz_liq) + * self.data.fwbs.a_bz_liq + * self.data.fwbs.b_bz_liq + / (self.data.fwbs.a_bz_liq + self.data.fwbs.b_bz_liq) ) raise ProcessValueError( @@ -3336,7 +3348,7 @@ def coolant_pumping_power( pres_coolant_pump_outlet = pres_coolant_pump_inlet + dpres_coolant # Adiabatic index for helium or water - gamma = (5 / 3) if fwbs_variables.i_blkt_coolant_type == 1 else (4 / 3) + gamma = (5 / 3) if self.data.fwbs.i_blkt_coolant_type == 1 else (4 / 3) # If calculating for primary coolant if i_liquid_breeder == 1: @@ -3369,7 +3381,7 @@ def coolant_pumping_power( ** -((gamma - 1) / gamma) ) / ( - fwbs_variables.etaiso + self.data.fwbs.etaiso * (temp_coolant_pump_inlet - temp_coolant_pump_outlet) ) ) @@ -3380,7 +3392,7 @@ def coolant_pumping_power( pump_outlet_fluid_properties.enthalpy - pump_inlet_fluid_properties.enthalpy ) - / fwbs_variables.etaiso + / self.data.fwbs.etaiso ) / (1 - fp) # If calculating for secondary coolant/breeder... @@ -3398,7 +3410,7 @@ def coolant_pumping_power( ** -((gamma - 1) / gamma) ) / ( - fwbs_variables.etaiso_liq + self.data.fwbs.etaiso_liq * (temp_coolant_pump_inlet - temp_coolant_pump_outlet) ) ) @@ -3407,7 +3419,7 @@ def coolant_pumping_power( * mflow_coolant_total * spec_vol * dpres_coolant - / fwbs_variables.etaiso_liq + / self.data.fwbs.etaiso_liq ) / (1 - fp) # Error for dpres_coolant too large @@ -3743,11 +3755,15 @@ def calculate_basic_geometry(self): self.component_volumes() dia_blkt_channel = self.pipe_hydraulic_diameter(i_channel_shape=1) - fwbs_variables.radius_blkt_channel = dia_blkt_channel / 2 + self.data.fwbs.radius_blkt_channel = dia_blkt_channel / 2 ( - fwbs_variables.radius_blkt_channel_90_bend, - fwbs_variables.radius_blkt_channel_180_bend, - ) = self.calculate_pipe_bend_radius(i_ps=1) + self.data.fwbs.radius_blkt_channel_90_bend, + self.data.fwbs.radius_blkt_channel_180_bend, + ) = self.calculate_pipe_bend_radius( + i_ps=1, + radius_fw_channel=self.data.fwbs.radius_fw_channel, + b_bz_liq=self.data.fwbs.b_bz_liq, + ) def calculate_blanket_outboard_module_geometry( self, @@ -3784,11 +3800,15 @@ def calculate_basic_geometry(self): self.component_volumes() dia_blkt_channel = self.pipe_hydraulic_diameter(i_channel_shape=1) - fwbs_variables.radius_blkt_channel = dia_blkt_channel / 2 + self.data.fwbs.radius_blkt_channel = dia_blkt_channel / 2 ( - fwbs_variables.radius_blkt_channel_90_bend, - fwbs_variables.radius_blkt_channel_180_bend, - ) = self.calculate_pipe_bend_radius(i_ps=1) + self.data.fwbs.radius_blkt_channel_90_bend, + self.data.fwbs.radius_blkt_channel_180_bend, + ) = self.calculate_pipe_bend_radius( + i_ps=1, + radius_fw_channel=self.data.fwbs.radius_fw_channel, + b_bz_liq=self.data.fwbs.b_bz_liq, + ) self.set_blanket_module_geometry() diff --git a/process/models/blankets/dcll.py b/process/models/blankets/dcll.py index 57efecd8b..48554cbfb 100644 --- a/process/models/blankets/dcll.py +++ b/process/models/blankets/dcll.py @@ -7,7 +7,6 @@ current_drive_variables, dcll_variables, divertor_variables, - fwbs_variables, heat_transport_variables, physics_variables, primary_pumping_variables, @@ -95,22 +94,26 @@ def output(self): def run(self, output: bool = False): self.component_volumes() dia_blkt_channel = self.pipe_hydraulic_diameter(i_channel_shape=1) - fwbs_variables.radius_blkt_channel = dia_blkt_channel / 2 + self.data.fwbs.radius_blkt_channel = dia_blkt_channel / 2 ( - fwbs_variables.radius_blkt_channel_90_bend, - fwbs_variables.radius_blkt_channel_180_bend, - ) = self.calculate_pipe_bend_radius(i_ps=1) + self.data.fwbs.radius_blkt_channel_90_bend, + self.data.fwbs.radius_blkt_channel_180_bend, + ) = self.calculate_pipe_bend_radius( + i_ps=1, + radius_fw_channel=self.data.fwbs.radius_fw_channel, + b_bz_liq=self.data.fwbs.b_bz_liq, + ) self.set_blanket_module_geometry() blanket_library.len_blkt_inboard_segment_toroidal = self.calculate_blanket_inboard_module_geometry( - n_blkt_inboard_modules_toroidal=fwbs_variables.n_blkt_inboard_modules_toroidal, + n_blkt_inboard_modules_toroidal=self.data.fwbs.n_blkt_inboard_modules_toroidal, rmajor=physics_variables.rmajor, rminor=physics_variables.rminor, dr_fw_plasma_gap_inboard=build_variables.dr_fw_plasma_gap_inboard, ) blanket_library.len_blkt_outboard_segment_toroidal = self.calculate_blanket_outboard_module_geometry( - n_blkt_outboard_modules_toroidal=fwbs_variables.n_blkt_outboard_modules_toroidal, + n_blkt_outboard_modules_toroidal=self.data.fwbs.n_blkt_outboard_modules_toroidal, rmajor=physics_variables.rmajor, rminor=physics_variables.rminor, dr_fw_plasma_gap_outboard=build_variables.dr_fw_plasma_gap_outboard, @@ -147,66 +150,66 @@ def dcll_neutronics_and_power(self, output: bool): # Double null configuration covf = ( 1 - - (2 * fwbs_variables.f_ster_div_single) - - fwbs_variables.f_a_fw_outboard_hcd + - (2 * self.data.fwbs.f_ster_div_single) + - self.data.fwbs.f_a_fw_outboard_hcd ) else: # Single null configuration covf = ( - 1 - fwbs_variables.f_ster_div_single - fwbs_variables.f_a_fw_outboard_hcd + 1 - self.data.fwbs.f_ster_div_single - self.data.fwbs.f_a_fw_outboard_hcd ) # Nuclear heating in the first wall (MW) - fwbs_variables.p_fw_nuclear_heat_total_mw = ( + self.data.fwbs.p_fw_nuclear_heat_total_mw = ( physics_variables.p_neutron_total_mw - * fwbs_variables.pnuc_fw_ratio_dcll + * self.data.fwbs.pnuc_fw_ratio_dcll * covf ) # Nuclear heating in the blanket with energy multiplication (MW) - fwbs_variables.pnuc_blkt_ratio_dcll = 1 - fwbs_variables.pnuc_fw_ratio_dcll - fwbs_variables.p_blkt_nuclear_heat_total_mw = ( + self.data.fwbs.pnuc_blkt_ratio_dcll = 1 - self.data.fwbs.pnuc_fw_ratio_dcll + self.data.fwbs.p_blkt_nuclear_heat_total_mw = ( physics_variables.p_neutron_total_mw - * fwbs_variables.pnuc_blkt_ratio_dcll - * fwbs_variables.f_p_blkt_multiplication + * self.data.fwbs.pnuc_blkt_ratio_dcll + * self.data.fwbs.f_p_blkt_multiplication * covf ) # Energy multiplication energy (MW) - fwbs_variables.p_blkt_multiplication_mw = ( - (physics_variables.p_neutron_total_mw * fwbs_variables.pnuc_blkt_ratio_dcll) - * (fwbs_variables.f_p_blkt_multiplication - 1) + self.data.fwbs.p_blkt_multiplication_mw = ( + (physics_variables.p_neutron_total_mw * self.data.fwbs.pnuc_blkt_ratio_dcll) + * (self.data.fwbs.f_p_blkt_multiplication - 1) * covf ) # HCD Apparatus # No nuclear heating of the H & CD - fwbs_variables.p_fw_hcd_nuclear_heat_mw = 0 + self.data.fwbs.p_fw_hcd_nuclear_heat_mw = 0 # Radiation power incident on HCD apparatus (MW) - fwbs_variables.p_fw_hcd_rad_total_mw = ( - physics_variables.p_plasma_rad_mw * fwbs_variables.f_a_fw_outboard_hcd + self.data.fwbs.p_fw_hcd_rad_total_mw = ( + physics_variables.p_plasma_rad_mw * self.data.fwbs.f_a_fw_outboard_hcd ) # FW # Radiation power incident on first wall (MW) - fwbs_variables.p_fw_rad_total_mw = ( + self.data.fwbs.p_fw_rad_total_mw = ( physics_variables.p_plasma_rad_mw - - fwbs_variables.p_div_rad_total_mw - - fwbs_variables.p_fw_hcd_rad_total_mw + - self.data.fwbs.p_div_rad_total_mw + - self.data.fwbs.p_fw_hcd_rad_total_mw ) # Surface heat flux on first wall (MW) # All of the fast particle losses go to the outer wall. - fwbs_variables.psurffwo = ( - fwbs_variables.p_fw_rad_total_mw + self.data.fwbs.psurffwo = ( + self.data.fwbs.p_fw_rad_total_mw * self.data.first_wall.a_fw_outboard / self.data.first_wall.a_fw_total + current_drive_variables.p_beam_orbit_loss_mw + physics_variables.p_fw_alpha_mw ) - fwbs_variables.psurffwi = fwbs_variables.p_fw_rad_total_mw * ( + self.data.fwbs.psurffwi = self.data.fwbs.p_fw_rad_total_mw * ( 1 - self.data.first_wall.a_fw_outboard / self.data.first_wall.a_fw_total ) @@ -221,13 +224,13 @@ def dcll_neutronics_and_power(self, output: bool): self.outfile, "Solid angle fraction taken by on divertor", "(f_ster_div_single)", - fwbs_variables.f_ster_div_single, + self.data.fwbs.f_ster_div_single, ) po.ovarre( self.outfile, "Fraction of outboard first wall area covered by HCD and diagnostics", "(f_a_fw_outboard_hcd)", - fwbs_variables.f_a_fw_outboard_hcd, + self.data.fwbs.f_a_fw_outboard_hcd, ) po.ovarre(self.outfile, "Blanket coverage factor", "(covf)", covf) @@ -237,14 +240,14 @@ def dcll_neutronics_and_power(self, output: bool): self.outfile, "Total nuclear heating in FW (MW)", "(p_fw_nuclear_heat_total_mw)", - fwbs_variables.p_fw_nuclear_heat_total_mw, + self.data.fwbs.p_fw_nuclear_heat_total_mw, "OP ", ) po.ovarre( self.outfile, "Energy multiplication in the blanket", "(f_p_blkt_multiplication)", - fwbs_variables.f_p_blkt_multiplication, + self.data.fwbs.f_p_blkt_multiplication, "OP ", ) po.ocmmnt( @@ -255,28 +258,28 @@ def dcll_neutronics_and_power(self, output: bool): self.outfile, "Total nuclear heating in the blanket (including f_p_blkt_multiplication) (MW)", "(p_blkt_nuclear_heat_total_mw)", - fwbs_variables.p_blkt_nuclear_heat_total_mw, + self.data.fwbs.p_blkt_nuclear_heat_total_mw, "OP ", ) po.ovarre( self.outfile, "Total nuclear heating in the shield (MW)", "(p_shld_nuclear_heat_mw)", - fwbs_variables.p_shld_nuclear_heat_mw, + self.data.fwbs.p_shld_nuclear_heat_mw, "OP ", ) po.ovarre( self.outfile, "Total nuclear heating in the divertor (MW)", "(p_div_nuclear_heat_total_mw)", - fwbs_variables.p_div_nuclear_heat_total_mw, + self.data.fwbs.p_div_nuclear_heat_total_mw, "OP ", ) po.ovarre( self.outfile, "Total nuclear heating in TF+PF coils (CS is negligible) (MW)", "(p_tf_nuclear_heat_mw)", - fwbs_variables.p_tf_nuclear_heat_mw, + self.data.fwbs.p_tf_nuclear_heat_mw, "OP ", ) @@ -286,14 +289,14 @@ def dcll_neutronics_and_power(self, output: bool): self.outfile, "Radiation heating power into the divertor (MW)", "(p_div_rad_total_mw)", - fwbs_variables.p_div_rad_total_mw, + self.data.fwbs.p_div_rad_total_mw, "OP ", ) po.ovarrf( self.outfile, "Radiation heating power into the first wall (MW)", "(p_fw_rad_total_mw)", - fwbs_variables.p_fw_rad_total_mw, + self.data.fwbs.p_fw_rad_total_mw, "OP ", ) @@ -303,7 +306,7 @@ def dcll_power_and_heating(self, output: bool): # For i_p_coolant_pumping == 0: # User sets mechanical pumping power directly (primary_pumping_power) # Values of p_blkt_coolant_pump_mw, p_div_coolant_pump_mw, p_fw_coolant_pump_mw, p_shld_coolant_pump_mw set in input file - i_p_coolant_pumping = PumpingPowerModelTypes(fwbs_variables.i_p_coolant_pumping) + i_p_coolant_pumping = PumpingPowerModelTypes(self.data.fwbs.i_p_coolant_pumping) if i_p_coolant_pumping == PumpingPowerModelTypes.FRACTION_OF_HEAT: # User sets mechanical pumping power directly ( @@ -316,15 +319,15 @@ def dcll_power_and_heating(self, output: bool): f_p_blkt_coolant_pump_total_heat=heat_transport_variables.f_p_blkt_coolant_pump_total_heat, f_p_shld_coolant_pump_total_heat=heat_transport_variables.f_p_shld_coolant_pump_total_heat, f_p_div_coolant_pump_total_heat=heat_transport_variables.f_p_div_coolant_pump_total_heat, - p_fw_nuclear_heat_total_mw=fwbs_variables.p_fw_nuclear_heat_total_mw, - psurffwi=fwbs_variables.psurffwi, - psurffwo=fwbs_variables.psurffwo, - p_blkt_nuclear_heat_total_mw=fwbs_variables.p_blkt_nuclear_heat_total_mw, - p_shld_nuclear_heat_mw=fwbs_variables.p_shld_nuclear_heat_mw, - p_cp_shield_nuclear_heat_mw=fwbs_variables.p_cp_shield_nuclear_heat_mw, + p_fw_nuclear_heat_total_mw=self.data.fwbs.p_fw_nuclear_heat_total_mw, + psurffwi=self.data.fwbs.psurffwi, + psurffwo=self.data.fwbs.psurffwo, + p_blkt_nuclear_heat_total_mw=self.data.fwbs.p_blkt_nuclear_heat_total_mw, + p_shld_nuclear_heat_mw=self.data.fwbs.p_shld_nuclear_heat_mw, + p_cp_shield_nuclear_heat_mw=self.data.fwbs.p_cp_shield_nuclear_heat_mw, p_plasma_separatrix_mw=physics_variables.p_plasma_separatrix_mw, - p_div_nuclear_heat_total_mw=fwbs_variables.p_div_nuclear_heat_total_mw, - p_div_rad_total_mw=fwbs_variables.p_div_rad_total_mw, + p_div_nuclear_heat_total_mw=self.data.fwbs.p_div_nuclear_heat_total_mw, + p_div_rad_total_mw=self.data.fwbs.p_div_rad_total_mw, ) elif i_p_coolant_pumping in { @@ -338,8 +341,8 @@ def dcll_power_and_heating(self, output: bool): heat_transport_variables.f_p_div_coolant_pump_total_heat * ( physics_variables.p_plasma_separatrix_mw - + fwbs_variables.p_div_nuclear_heat_total_mw - + fwbs_variables.p_div_rad_total_mw + + self.data.fwbs.p_div_nuclear_heat_total_mw + + self.data.fwbs.p_div_rad_total_mw ) ) @@ -351,7 +354,7 @@ def dcll_power_and_heating(self, output: bool): if output: po.osubhd(self.outfile, "DCLL model: Thermal-hydraulics Component Totals") - if fwbs_variables.i_p_coolant_pumping not in { + if self.data.fwbs.i_p_coolant_pumping not in { PumpingPowerModelTypes.MECHANICAL, PumpingPowerModelTypes.MECHANICAL_WITH_PRESSURE_DROP, }: @@ -378,7 +381,7 @@ def dcll_power_and_heating(self, output: bool): "OP ", ) - if fwbs_variables.i_blkt_dual_coolant > 0: + if self.data.fwbs.i_blkt_dual_coolant > 0: po.ovarre( self.outfile, "Mechanical pumping power for liquid metal breeder (MW)", @@ -406,32 +409,32 @@ def dcll_power_and_heating(self, output: bool): self.outfile, "Switch for plant secondary cycle ", "(i_thermal_electric_conversion)", - fwbs_variables.i_thermal_electric_conversion, + self.data.fwbs.i_thermal_electric_conversion, ) po.ovarin( self.outfile, "Switch for plant secondary cycle (liquid metal breeder) ", "(secondary_cycle_liq)", - fwbs_variables.secondary_cycle_liq, + self.data.fwbs.secondary_cycle_liq, ) po.ovarre( self.outfile, "First wall coolant pressure (Pa)", "(pres_fw_coolant)", - fwbs_variables.pres_fw_coolant, + self.data.fwbs.pres_fw_coolant, ) po.ovarre( self.outfile, "Blanket coolant pressure (Pa)", "(pres_blkt_coolant)", - fwbs_variables.pres_blkt_coolant, + self.data.fwbs.pres_blkt_coolant, ) - if fwbs_variables.i_blkt_dual_coolant > 0: + if self.data.fwbs.i_blkt_dual_coolant > 0: po.ovarre( self.outfile, "Blanket liquid metal breeder pressure (Pa)", "(blpressure_liq)", - fwbs_variables.blpressure_liq, + self.data.fwbs.blpressure_liq, ) def dcll_masses(self, output: bool): @@ -485,9 +488,9 @@ def dcll_masses(self, output: bool): """ # If there are FCIs then how much of the radial build is FCI? - if fwbs_variables.i_blkt_liquid_breeder_channel_type > 0: + if self.data.fwbs.i_blkt_liquid_breeder_channel_type > 0: dcll_variables.r_fci = ( - 2 * fwbs_variables.nopol * fwbs_variables.th_wall_secondary + 2 * self.data.fwbs.nopol * self.data.fwbs.th_wall_secondary ) else: dcll_variables.r_fci = 0.0 @@ -517,10 +520,10 @@ def dcll_masses(self, output: bool): dcll_variables.f_vol_stl_fw = 0.86 # Radial Fraction of BZ Liquid Breeder/Coolant (from DEMO) - fwbs_variables.r_f_liq_ib = 0.75 - fwbs_variables.r_f_liq_ib = 0.79 - fwbs_variables.w_f_liq_ib = fwbs_variables.r_f_liq_ib - fwbs_variables.w_f_liq_ob = fwbs_variables.r_f_liq_ib + self.data.fwbs.r_f_liq_ib = 0.75 + self.data.fwbs.r_f_liq_ib = 0.79 + self.data.fwbs.w_f_liq_ib = self.data.fwbs.r_f_liq_ib + self.data.fwbs.w_f_liq_ob = self.data.fwbs.r_f_liq_ib # Manifold/BSS Fractions dcll_variables.f_vol_mfbss_stl = 0.5129 @@ -528,79 +531,79 @@ def dcll_masses(self, output: bool): dcll_variables.f_vol_mfbss_pbli = 0.4436 # Calculate Volumes - if fwbs_variables.i_blkt_inboard == 1: + if self.data.fwbs.i_blkt_inboard == 1: # IB and OB blanket # BZ dcll_variables.vol_bz_struct = ( - fwbs_variables.vol_blkt_inboard + self.data.fwbs.vol_blkt_inboard * dcll_variables.bz_r_ib - * (1 - fwbs_variables.r_f_liq_ib) + * (1 - self.data.fwbs.r_f_liq_ib) / build_variables.dr_blkt_inboard ) + ( - fwbs_variables.vol_blkt_outboard - * (dcll_variables.bz_r_ob * (1 - fwbs_variables.r_f_liq_ob)) + self.data.fwbs.vol_blkt_outboard + * (dcll_variables.bz_r_ob * (1 - self.data.fwbs.r_f_liq_ob)) / build_variables.dr_blkt_outboard ) - if fwbs_variables.i_blkt_dual_coolant > 0: - fwbs_variables.f_a_blkt_cooling_channels = ( + if self.data.fwbs.i_blkt_dual_coolant > 0: + self.data.fwbs.f_a_blkt_cooling_channels = ( (1 - dcll_variables.f_vol_stl_bz_struct) * dcll_variables.vol_bz_struct - ) / fwbs_variables.vol_blkt_total + ) / self.data.fwbs.vol_blkt_total dcll_variables.vol_bz_liq = ( - fwbs_variables.vol_blkt_inboard + self.data.fwbs.vol_blkt_inboard * dcll_variables.bz_r_ib - * fwbs_variables.r_f_liq_ib + * self.data.fwbs.r_f_liq_ib / build_variables.dr_blkt_inboard ) + ( - fwbs_variables.vol_blkt_outboard + self.data.fwbs.vol_blkt_outboard * dcll_variables.bz_r_ob - * fwbs_variables.r_f_liq_ob + * self.data.fwbs.r_f_liq_ob / build_variables.dr_blkt_outboard ) dcll_variables.vol_bz_liq_ib = ( - fwbs_variables.vol_blkt_inboard + self.data.fwbs.vol_blkt_inboard * dcll_variables.bz_r_ib - * fwbs_variables.r_f_liq_ib + * self.data.fwbs.r_f_liq_ib / build_variables.dr_blkt_inboard ) dcll_variables.vol_bz_liq_ob = ( - fwbs_variables.vol_blkt_outboard + self.data.fwbs.vol_blkt_outboard * dcll_variables.bz_r_ob - * fwbs_variables.r_f_liq_ob + * self.data.fwbs.r_f_liq_ob / build_variables.dr_blkt_outboard ) - if fwbs_variables.i_blkt_liquid_breeder_channel_type > 0: + if self.data.fwbs.i_blkt_liquid_breeder_channel_type > 0: dcll_variables.vol_fci = ( - fwbs_variables.vol_blkt_inboard + self.data.fwbs.vol_blkt_inboard * dcll_variables.r_fci / build_variables.dr_blkt_inboard ) + ( - fwbs_variables.vol_blkt_outboard + self.data.fwbs.vol_blkt_outboard * dcll_variables.r_fci / build_variables.dr_blkt_outboard ) # Back Wall dcll_variables.vol_bw = ( - fwbs_variables.vol_blkt_inboard + self.data.fwbs.vol_blkt_inboard * dcll_variables.r_backwall / build_variables.dr_blkt_inboard ) + ( - fwbs_variables.vol_blkt_outboard + self.data.fwbs.vol_blkt_outboard * dcll_variables.r_backwall / build_variables.dr_blkt_outboard ) # Manifold/BSS dcll_variables.vol_bss = ( - fwbs_variables.vol_blkt_inboard + self.data.fwbs.vol_blkt_inboard * build_variables.blbmith / build_variables.dr_blkt_inboard ) + ( - fwbs_variables.vol_blkt_outboard + self.data.fwbs.vol_blkt_outboard * build_variables.blbmoth / build_variables.dr_blkt_outboard ) @@ -610,46 +613,46 @@ def dcll_masses(self, output: bool): # BZ dcll_variables.vol_bz_struct = ( - fwbs_variables.vol_blkt_outboard + self.data.fwbs.vol_blkt_outboard * dcll_variables.bz_r_ob - * (1 - fwbs_variables.r_f_liq_ob) + * (1 - self.data.fwbs.r_f_liq_ob) / build_variables.dr_blkt_outboard ) - if fwbs_variables.i_blkt_dual_coolant > 0: - fwbs_variables.f_a_blkt_cooling_channels = ( + if self.data.fwbs.i_blkt_dual_coolant > 0: + self.data.fwbs.f_a_blkt_cooling_channels = ( (1 - dcll_variables.f_vol_stl_bz_struct) * dcll_variables.vol_bz_struct - ) / fwbs_variables.vol_blkt_total + ) / self.data.fwbs.vol_blkt_total dcll_variables.vol_bz_liq = ( - fwbs_variables.vol_blkt_outboard + self.data.fwbs.vol_blkt_outboard * dcll_variables.bz_r_ob - * fwbs_variables.r_f_liq_ob + * self.data.fwbs.r_f_liq_ob / build_variables.dr_blkt_outboard ) dcll_variables.vol_bz_liq_ob = ( - fwbs_variables.vol_blkt_outboard + self.data.fwbs.vol_blkt_outboard * dcll_variables.bz_r_ob - * fwbs_variables.r_f_liq_ob + * self.data.fwbs.r_f_liq_ob / build_variables.dr_blkt_outboard ) - if fwbs_variables.i_blkt_liquid_breeder_channel_type > 0: + if self.data.fwbs.i_blkt_liquid_breeder_channel_type > 0: dcll_variables.vol_fci = ( - fwbs_variables.vol_blkt_outboard + self.data.fwbs.vol_blkt_outboard * dcll_variables.r_fci / build_variables.dr_blkt_outboard ) # Back Wall dcll_variables.vol_bw = ( - fwbs_variables.vol_blkt_outboard + self.data.fwbs.vol_blkt_outboard * dcll_variables.r_backwall / build_variables.dr_blkt_outboard ) # Manifold/BSS dcll_variables.vol_bss = ( - fwbs_variables.vol_blkt_outboard + self.data.fwbs.vol_blkt_outboard * build_variables.blbmoth / build_variables.dr_blkt_outboard ) @@ -657,82 +660,82 @@ def dcll_masses(self, output: bool): # Calculate masses # BZ dcll_variables.wht_stl_struct = ( - fwbs_variables.den_steel + self.data.fwbs.den_steel * dcll_variables.f_vol_stl_bz_struct * dcll_variables.vol_bz_struct ) dcll_variables.wht_cool_struct = ( - fwbs_variables.den_blkt_coolant + self.data.fwbs.den_blkt_coolant * (1 - dcll_variables.f_vol_stl_bz_struct) * dcll_variables.vol_bz_struct ) - fwbs_variables.wht_liq = fwbs_variables.den_liq * dcll_variables.vol_bz_liq - fwbs_variables.wht_liq_ib = fwbs_variables.den_liq * dcll_variables.vol_bz_liq_ib - fwbs_variables.wht_liq_ob = fwbs_variables.den_liq * dcll_variables.vol_bz_liq_ob - dcll_variables.wht_cer = fwbs_variables.den_ceramic * dcll_variables.vol_fci + self.data.fwbs.wht_liq = self.data.fwbs.den_liq * dcll_variables.vol_bz_liq + self.data.fwbs.wht_liq_ib = self.data.fwbs.den_liq * dcll_variables.vol_bz_liq_ib + self.data.fwbs.wht_liq_ob = self.data.fwbs.den_liq * dcll_variables.vol_bz_liq_ob + dcll_variables.wht_cer = self.data.fwbs.den_ceramic * dcll_variables.vol_fci # Back Wall dcll_variables.wht_bw_stl = ( - fwbs_variables.den_steel + self.data.fwbs.den_steel * dcll_variables.f_vol_stl_back_wall * dcll_variables.vol_bw ) dcll_variables.wht_bw_cool = ( - fwbs_variables.den_blkt_coolant + self.data.fwbs.den_blkt_coolant * (1 - dcll_variables.f_vol_stl_back_wall) * dcll_variables.vol_bw ) # Manifold/BSS dcll_variables.wht_mfbss_stl = ( - fwbs_variables.den_steel + self.data.fwbs.den_steel * dcll_variables.f_vol_mfbss_stl * dcll_variables.vol_bss ) dcll_variables.wht_mfbss_cool = ( - fwbs_variables.den_blkt_coolant + self.data.fwbs.den_blkt_coolant * dcll_variables.f_vol_mfbss_he * dcll_variables.vol_bss ) dcll_variables.wht_mfbss_pbli = ( - fwbs_variables.den_liq + self.data.fwbs.den_liq * dcll_variables.f_vol_mfbss_pbli * dcll_variables.vol_bss ) # FW # First wall volume (m^3) - fwbs_variables.vol_fw_total = ( + self.data.fwbs.vol_fw_total = ( self.data.first_wall.a_fw_inboard * build_variables.dr_fw_inboard + self.data.first_wall.a_fw_outboard * build_variables.dr_fw_outboard ) # First wall mass, excluding armour (kg) dcll_variables.fwmass_stl = ( - fwbs_variables.den_steel + self.data.fwbs.den_steel * dcll_variables.f_vol_stl_fw - * fwbs_variables.vol_fw_total + * self.data.fwbs.vol_fw_total ) dcll_variables.fwmass_cool = ( - fwbs_variables.den_fw_coolant + self.data.fwbs.den_fw_coolant * (1 - dcll_variables.f_vol_stl_fw) - * fwbs_variables.vol_fw_total + * self.data.fwbs.vol_fw_total ) - fwbs_variables.m_fw_total = ( + self.data.fwbs.m_fw_total = ( dcll_variables.fwmass_stl + dcll_variables.fwmass_cool ) # First wall armour volume (m^3) - fwbs_variables.fw_armour_vol = ( - physics_variables.a_plasma_surface * fwbs_variables.fw_armour_thickness + self.data.fwbs.fw_armour_vol = ( + physics_variables.a_plasma_surface * self.data.fwbs.fw_armour_thickness ) # First wall armour mass (kg) - fwbs_variables.fw_armour_mass = ( - fwbs_variables.fw_armour_vol * constants.DEN_TUNGSTEN + self.data.fwbs.fw_armour_mass = ( + self.data.fwbs.fw_armour_vol * constants.DEN_TUNGSTEN ) # Total mass of blanket - fwbs_variables.m_blkt_total = ( + self.data.fwbs.m_blkt_total = ( dcll_variables.wht_stl_struct + dcll_variables.wht_cool_struct - + fwbs_variables.wht_liq + + self.data.fwbs.wht_liq + dcll_variables.wht_bw_stl + dcll_variables.wht_bw_cool + dcll_variables.wht_mfbss_stl @@ -742,50 +745,50 @@ def dcll_masses(self, output: bool): ) # Total mass of first wall and blanket - fwbs_variables.armour_fw_bl_mass = ( - fwbs_variables.fw_armour_mass - + fwbs_variables.m_fw_total - + fwbs_variables.m_blkt_total + self.data.fwbs.armour_fw_bl_mass = ( + self.data.fwbs.fw_armour_mass + + self.data.fwbs.m_fw_total + + self.data.fwbs.m_blkt_total ) # Total mass of IB/OB segment - if fwbs_variables.i_blkt_inboard == 1: + if self.data.fwbs.i_blkt_inboard == 1: dcll_variables.mass_segm_ib = ( - fwbs_variables.m_blkt_total - * (fwbs_variables.vol_blkt_inboard / fwbs_variables.vol_blkt_total) - + fwbs_variables.m_fw_total + self.data.fwbs.m_blkt_total + * (self.data.fwbs.vol_blkt_inboard / self.data.fwbs.vol_blkt_total) + + self.data.fwbs.m_fw_total * ( self.data.first_wall.a_fw_inboard * build_variables.dr_fw_inboard - / fwbs_variables.vol_fw_total + / self.data.fwbs.vol_fw_total ) - + fwbs_variables.fw_armour_mass + + self.data.fwbs.fw_armour_mass * ( ( physics_variables.a_plasma_surface - physics_variables.a_plasma_surface_outboard ) - * fwbs_variables.fw_armour_thickness - / fwbs_variables.fw_armour_vol + * self.data.fwbs.fw_armour_thickness + / self.data.fwbs.fw_armour_vol ) - ) / fwbs_variables.n_blkt_inboard_modules_toroidal + ) / self.data.fwbs.n_blkt_inboard_modules_toroidal dcll_variables.mass_segm_ob = ( - fwbs_variables.m_blkt_total - * (fwbs_variables.vol_blkt_outboard / fwbs_variables.vol_blkt_total) - + fwbs_variables.m_fw_total + self.data.fwbs.m_blkt_total + * (self.data.fwbs.vol_blkt_outboard / self.data.fwbs.vol_blkt_total) + + self.data.fwbs.m_fw_total * ( self.data.first_wall.a_fw_outboard * build_variables.dr_fw_outboard - / fwbs_variables.vol_fw_total + / self.data.fwbs.vol_fw_total ) - + fwbs_variables.fw_armour_mass + + self.data.fwbs.fw_armour_mass * ( physics_variables.a_plasma_surface_outboard - * fwbs_variables.fw_armour_thickness - / fwbs_variables.fw_armour_vol + * self.data.fwbs.fw_armour_thickness + / self.data.fwbs.fw_armour_vol ) - ) / fwbs_variables.n_blkt_outboard_modules_toroidal + ) / self.data.fwbs.n_blkt_outboard_modules_toroidal # Total FW/Structure Coolant Mass dcll_variables.mass_cool_blanket = ( @@ -796,7 +799,7 @@ def dcll_masses(self, output: bool): ) # Total Liquid Breeder/Coolant Mass dcll_variables.mass_liq_blanket = ( - fwbs_variables.wht_liq + dcll_variables.wht_mfbss_pbli + self.data.fwbs.wht_liq + dcll_variables.wht_mfbss_pbli ) # Total Steel Mass dcll_variables.mass_stl_blanket = ( @@ -819,24 +822,24 @@ def dcll_masses(self, output: bool): self.outfile, "First Wall Armour Mass (kg)", "(fw_armour_mass)", - fwbs_variables.fw_armour_mass, + self.data.fwbs.fw_armour_mass, "OP ", ) po.ovarre( self.outfile, "First Wall Mass, excluding armour (kg)", "(m_fw_total)", - fwbs_variables.m_fw_total, + self.data.fwbs.m_fw_total, "OP ", ) po.ovarre( self.outfile, "Total Blanket Mass (kg)", "(m_blkt_total)", - fwbs_variables.m_blkt_total, + self.data.fwbs.m_blkt_total, "OP ", ) - if fwbs_variables.i_blkt_liquid_breeder_channel_type == 1: + if self.data.fwbs.i_blkt_liquid_breeder_channel_type == 1: po.ovarre( self.outfile, "Blanket FCI Mass (kg)", @@ -848,7 +851,7 @@ def dcll_masses(self, output: bool): self.outfile, "Total mass of armour, first wall and blanket (kg)", "(armour_fw_bl_mass)", - fwbs_variables.armour_fw_bl_mass, + self.data.fwbs.armour_fw_bl_mass, "OP ", ) @@ -894,7 +897,7 @@ def dcll_masses(self, output: bool): self.outfile, "Total W mass (kg)", "(fw_armour_mass)", - fwbs_variables.fw_armour_mass, + self.data.fwbs.fw_armour_mass, "OP ", ) @@ -935,34 +938,34 @@ def write_output(self): self.outfile, "First Wall Armour Volume (m3)", "(fw_armour_vol)", - fwbs_variables.fw_armour_vol, + self.data.fwbs.fw_armour_vol, "OP ", ) po.ovarrf( self.outfile, "First Wall Volume (m3)", "(vol_fw_total)", - fwbs_variables.vol_fw_total, + self.data.fwbs.vol_fw_total, "OP ", ) po.ovarrf( self.outfile, "Blanket Volume (m3)", "(vol_blkt_total)", - fwbs_variables.vol_blkt_total, + self.data.fwbs.vol_blkt_total, "OP ", ) po.ovarrf( self.outfile, "Shield Volume (m3)", "(vol_shld_total)", - fwbs_variables.vol_shld_total, + self.data.fwbs.vol_shld_total, "OP ", ) po.ovarrf( self.outfile, "Vacuum vessel volume (m3)", "(vol_vv)", - fwbs_variables.vol_vv, + self.data.fwbs.vol_vv, "OP ", ) diff --git a/process/models/blankets/hcpb.py b/process/models/blankets/hcpb.py index b9abb402f..c8c2228fe 100644 --- a/process/models/blankets/hcpb.py +++ b/process/models/blankets/hcpb.py @@ -14,7 +14,6 @@ ccfe_hcpb_module, current_drive_variables, divertor_variables, - fwbs_variables, heat_transport_variables, physics_variables, primary_pumping_variables, @@ -45,29 +44,33 @@ def output(self): def run(self, output: bool = False): # Coolant type - fwbs_variables.i_blkt_coolant_type = 1 + self.data.fwbs.i_blkt_coolant_type = 1 # Note that the first wall coolant is now input separately. # Calculate blanket, shield, vacuum vessel and cryostat volumes self.component_volumes() dia_blkt_channel = self.pipe_hydraulic_diameter(i_channel_shape=1) - fwbs_variables.radius_blkt_channel = dia_blkt_channel / 2 + self.data.fwbs.radius_blkt_channel = dia_blkt_channel / 2 ( - fwbs_variables.radius_blkt_channel_90_bend, - fwbs_variables.radius_blkt_channel_180_bend, - ) = self.calculate_pipe_bend_radius(i_ps=1) + self.data.fwbs.radius_blkt_channel_90_bend, + self.data.fwbs.radius_blkt_channel_180_bend, + ) = self.calculate_pipe_bend_radius( + i_ps=1, + radius_fw_channel=self.data.fwbs.radius_fw_channel, + b_bz_liq=self.data.fwbs.b_bz_liq, + ) self.set_blanket_module_geometry() - blanket_library.len_blkt_inboard_segment_toroidal = self.calculate_blanket_inboard_module_geometry( - n_blkt_inboard_modules_toroidal=fwbs_variables.n_blkt_inboard_modules_toroidal, + blanket_vars.len_blkt_inboard_segment_toroidal = self.calculate_blanket_inboard_module_geometry( + n_blkt_inboard_modules_toroidal=self.data.fwbs.n_blkt_inboard_modules_toroidal, rmajor=physics_variables.rmajor, rminor=physics_variables.rminor, dr_fw_plasma_gap_inboard=build_variables.dr_fw_plasma_gap_inboard, ) - blanket_library.len_blkt_outboard_segment_toroidal = self.calculate_blanket_outboard_module_geometry( - n_blkt_outboard_modules_toroidal=fwbs_variables.n_blkt_outboard_modules_toroidal, + blanket_vars.len_blkt_outboard_segment_toroidal = self.calculate_blanket_outboard_module_geometry( + n_blkt_outboard_modules_toroidal=self.data.fwbs.n_blkt_outboard_modules_toroidal, rmajor=physics_variables.rmajor, rminor=physics_variables.rminor, dr_fw_plasma_gap_outboard=build_variables.dr_fw_plasma_gap_outboard, @@ -99,7 +102,7 @@ def run(self, output: bool = False): ) # TF fast neutron flux (E > 0.1 MeV) [m^{-2}.s^{-1}] - fwbs_variables.neut_flux_cp = self.st_tf_centrepost_fast_neut_flux( + self.data.fwbs.neut_flux_cp = self.st_tf_centrepost_fast_neut_flux( physics_variables.p_neutron_total_mw, build_variables.dr_shld_inboard, physics_variables.rmajor, @@ -107,19 +110,19 @@ def run(self, output: bool = False): # TF, shield and total CP nuclear heating [MW] ( - fwbs_variables.pnuc_cp_tf, - fwbs_variables.p_cp_shield_nuclear_heat_mw, - fwbs_variables.pnuc_cp, + self.data.fwbs.pnuc_cp_tf, + self.data.fwbs.p_cp_shield_nuclear_heat_mw, + self.data.fwbs.pnuc_cp, ) = self.st_centrepost_nuclear_heating( physics_variables.p_neutron_total_mw, build_variables.dr_shld_inboard ) else: # No CP f_geom_cp = 0 - fwbs_variables.pnuc_cp_tf = 0 - fwbs_variables.p_cp_shield_nuclear_heat_mw = 0 - fwbs_variables.pnuc_cp = 0 - fwbs_variables.neut_flux_cp = 0 + self.data.fwbs.pnuc_cp_tf = 0 + self.data.fwbs.p_cp_shield_nuclear_heat_mw = 0 + self.data.fwbs.pnuc_cp = 0 + self.data.fwbs.neut_flux_cp = 0 self.component_masses() @@ -128,20 +131,20 @@ def run(self, output: bool = False): # the divertor and the centrepost (for itart == 1), self.nuclear_heating_magnets(output=output) - fwbs_variables.p_fw_nuclear_heat_total_mw = self.nuclear_heating_fw( - m_fw_total=fwbs_variables.m_fw_total, + self.data.fwbs.p_fw_nuclear_heat_total_mw = self.nuclear_heating_fw( + m_fw_total=self.data.fwbs.m_fw_total, fw_armour_u_nuc_heating=ccfe_hcpb_module.fw_armour_u_nuc_heating, p_fusion_total_mw=physics_variables.p_fusion_total_mw, ) - fwbs_variables.p_blkt_nuclear_heat_total_mw, ccfe_hcpb_module.exp_blanket = ( + self.data.fwbs.p_blkt_nuclear_heat_total_mw, ccfe_hcpb_module.exp_blanket = ( self.nuclear_heating_blanket( - m_blkt_total=fwbs_variables.m_blkt_total, + m_blkt_total=self.data.fwbs.m_blkt_total, p_fusion_total_mw=physics_variables.p_fusion_total_mw, ) ) ( - fwbs_variables.p_shld_nuclear_heat_mw, + self.data.fwbs.p_shld_nuclear_heat_mw, ccfe_hcpb_module.exp_shield1, ccfe_hcpb_module.exp_shield2, ccfe_hcpb_module.shld_u_nuc_heating, @@ -150,7 +153,7 @@ def run(self, output: bool = False): dr_shld_outboard=build_variables.dr_shld_outboard, dr_shld_inboard=build_variables.dr_shld_inboard, shield_density=ccfe_hcpb_module.shield_density, - whtshld=fwbs_variables.whtshld, + whtshld=self.data.fwbs.whtshld, x_blanket=ccfe_hcpb_module.x_blanket, p_fusion_total_mw=physics_variables.p_fusion_total_mw, ) @@ -166,10 +169,10 @@ def run(self, output: bool = False): # fractions as before. # Total nuclear power deposited in the blanket sector (MW) ccfe_hcpb_module.pnuc_tot_blk_sector = ( - fwbs_variables.p_fw_nuclear_heat_total_mw - + fwbs_variables.p_blkt_nuclear_heat_total_mw - + fwbs_variables.p_shld_nuclear_heat_mw - + fwbs_variables.p_tf_nuclear_heat_mw + self.data.fwbs.p_fw_nuclear_heat_total_mw + + self.data.fwbs.p_blkt_nuclear_heat_total_mw + + self.data.fwbs.p_shld_nuclear_heat_mw + + self.data.fwbs.p_tf_nuclear_heat_mw ) # Total nuclear power deposited in the @@ -182,57 +185,57 @@ def run(self, output: bool = False): # Solid angle fraction taken by the breeding blankets/shields f_geom_blanket = ( 1 - - divertor_variables.n_divertors * fwbs_variables.f_ster_div_single + - divertor_variables.n_divertors * self.data.fwbs.f_ster_div_single - f_geom_cp ) # Power to the first wall (MW) - fwbs_variables.p_fw_nuclear_heat_total_mw = ( + self.data.fwbs.p_fw_nuclear_heat_total_mw = ( ( - fwbs_variables.p_fw_nuclear_heat_total_mw + self.data.fwbs.p_fw_nuclear_heat_total_mw / ccfe_hcpb_module.pnuc_tot_blk_sector ) - * fwbs_variables.f_p_blkt_multiplication + * self.data.fwbs.f_p_blkt_multiplication * f_geom_blanket * physics_variables.p_neutron_total_mw ) # Power to the blanket (MW) - fwbs_variables.p_blkt_nuclear_heat_total_mw = ( + self.data.fwbs.p_blkt_nuclear_heat_total_mw = ( ( - fwbs_variables.p_blkt_nuclear_heat_total_mw + self.data.fwbs.p_blkt_nuclear_heat_total_mw / ccfe_hcpb_module.pnuc_tot_blk_sector ) - * fwbs_variables.f_p_blkt_multiplication + * self.data.fwbs.f_p_blkt_multiplication * f_geom_blanket * physics_variables.p_neutron_total_mw ) # Power to the shield(MW) # The power deposited in the CP shield is added back in powerflow_calc - fwbs_variables.p_shld_nuclear_heat_mw = ( + self.data.fwbs.p_shld_nuclear_heat_mw = ( ( - fwbs_variables.p_shld_nuclear_heat_mw + self.data.fwbs.p_shld_nuclear_heat_mw / ccfe_hcpb_module.pnuc_tot_blk_sector ) - * fwbs_variables.f_p_blkt_multiplication + * self.data.fwbs.f_p_blkt_multiplication * f_geom_blanket * physics_variables.p_neutron_total_mw ) # Power to the TF coils (MW) # The power deposited in the CP conductor is added back here - fwbs_variables.p_tf_nuclear_heat_mw = ( - (fwbs_variables.p_tf_nuclear_heat_mw / ccfe_hcpb_module.pnuc_tot_blk_sector) - * fwbs_variables.f_p_blkt_multiplication + self.data.fwbs.p_tf_nuclear_heat_mw = ( + (self.data.fwbs.p_tf_nuclear_heat_mw / ccfe_hcpb_module.pnuc_tot_blk_sector) + * self.data.fwbs.f_p_blkt_multiplication * f_geom_blanket * physics_variables.p_neutron_total_mw - + fwbs_variables.pnuc_cp_tf + + self.data.fwbs.pnuc_cp_tf ) # Power deposited in the CP - fwbs_variables.p_cp_shield_nuclear_heat_mw = ( - f_geom_cp * physics_variables.p_neutron_total_mw - fwbs_variables.pnuc_cp_tf + self.data.fwbs.p_cp_shield_nuclear_heat_mw = ( + f_geom_cp * physics_variables.p_neutron_total_mw - self.data.fwbs.pnuc_cp_tf ) # Old code kept for backward compatibility @@ -243,8 +246,8 @@ def run(self, output: bool = False): # --- # New code, a bit simpler - fwbs_variables.p_blkt_multiplication_mw = ( - (fwbs_variables.f_p_blkt_multiplication - 1) + self.data.fwbs.p_blkt_multiplication_mw = ( + (self.data.fwbs.f_p_blkt_multiplication - 1) * f_geom_blanket * physics_variables.p_neutron_total_mw ) @@ -277,34 +280,34 @@ def component_masses(self): # Blanket coolant volume (m3) coolvol += ( - fwbs_variables.vol_blkt_total * fwbs_variables.f_a_blkt_cooling_channels + self.data.fwbs.vol_blkt_total * self.data.fwbs.f_a_blkt_cooling_channels ) # Shield coolant volume (m3) - coolvol += fwbs_variables.vol_shld_total * fwbs_variables.vfshld + coolvol += self.data.fwbs.vol_shld_total * self.data.fwbs.vfshld # First wall coolant volume (m3) coolvol = ( coolvol + self.data.first_wall.a_fw_inboard * build_variables.dr_fw_inboard - * fwbs_variables.f_a_fw_coolant_inboard + * self.data.fwbs.f_a_fw_coolant_inboard + self.data.first_wall.a_fw_outboard * build_variables.dr_fw_outboard - * fwbs_variables.f_a_fw_coolant_outboard + * self.data.fwbs.f_a_fw_coolant_outboard ) # Mass of He coolant = volume * density at typical coolant temperatures and pressures (kg) - fwbs_variables.m_fw_blkt_div_coolant_total = coolvol * 1.517 + self.data.fwbs.m_fw_blkt_div_coolant_total = coolvol * 1.517 # Average first wall coolant fraction, only used by old routines in fispact.f90, safety.f90 - fwbs_variables.fwclfr = ( + self.data.fwbs.fwclfr = ( self.data.first_wall.a_fw_inboard * build_variables.dr_fw_inboard - * fwbs_variables.f_a_fw_coolant_inboard + * self.data.fwbs.f_a_fw_coolant_inboard + self.data.first_wall.a_fw_outboard * build_variables.dr_fw_outboard - * fwbs_variables.f_a_fw_coolant_outboard + * self.data.fwbs.f_a_fw_coolant_outboard ) / ( self.data.first_wall.a_fw_total * 0.5 @@ -337,97 +340,97 @@ def component_masses(self): ) # Shield mass (kg) - fwbs_variables.whtshld = ( - fwbs_variables.vol_shld_total - * fwbs_variables.den_steel - * (1.0 - fwbs_variables.vfshld) + self.data.fwbs.whtshld = ( + self.data.fwbs.vol_shld_total + * self.data.fwbs.den_steel + * (1.0 - self.data.fwbs.vfshld) ) # Penetration shield mass (set = internal shield) (kg) - fwbs_variables.wpenshld = fwbs_variables.whtshld + self.data.fwbs.wpenshld = self.data.fwbs.whtshld # First wall volume (m^3) - fwbs_variables.vol_fw_total = ( + self.data.fwbs.vol_fw_total = ( self.data.first_wall.a_fw_inboard * build_variables.dr_fw_inboard - * (1.0 - fwbs_variables.f_a_fw_coolant_inboard) + * (1.0 - self.data.fwbs.f_a_fw_coolant_inboard) + self.data.first_wall.a_fw_outboard * build_variables.dr_fw_outboard - * (1.0 - fwbs_variables.f_a_fw_coolant_outboard) + * (1.0 - self.data.fwbs.f_a_fw_coolant_outboard) ) # First wall mass, excluding armour (kg) - fwbs_variables.m_fw_total = ( - fwbs_variables.den_steel * fwbs_variables.vol_fw_total + self.data.fwbs.m_fw_total = ( + self.data.fwbs.den_steel * self.data.fwbs.vol_fw_total ) # First wall armour volume (m^3) - fwbs_variables.fw_armour_vol = ( - physics_variables.a_plasma_surface * fwbs_variables.fw_armour_thickness + self.data.fwbs.fw_armour_vol = ( + physics_variables.a_plasma_surface * self.data.fwbs.fw_armour_thickness ) # First wall armour mass (kg) - fwbs_variables.fw_armour_mass = ( - fwbs_variables.fw_armour_vol * constants.DEN_TUNGSTEN + self.data.fwbs.fw_armour_mass = ( + self.data.fwbs.fw_armour_vol * constants.DEN_TUNGSTEN ) - fwbs_variables.breeder_f = max(fwbs_variables.breeder_f, 1.0e-10) - fwbs_variables.breeder_f = min(fwbs_variables.breeder_f, 1.0) + self.data.fwbs.breeder_f = max(self.data.fwbs.breeder_f, 1.0e-10) + self.data.fwbs.breeder_f = min(self.data.fwbs.breeder_f, 1.0) # f_vol_blkt_tibe12 = f_vol_blkt_li4sio4 * (1 - breeder_f)/breeder_f # New combined variable breeder_multiplier # Lithium orthosilicate fraction: - fwbs_variables.f_vol_blkt_li4sio4 = ( - fwbs_variables.breeder_f * fwbs_variables.breeder_multiplier + self.data.fwbs.f_vol_blkt_li4sio4 = ( + self.data.fwbs.breeder_f * self.data.fwbs.breeder_multiplier ) # Titanium beryllide fraction, and mass (kg): - fwbs_variables.f_vol_blkt_tibe12 = ( - fwbs_variables.breeder_multiplier - fwbs_variables.f_vol_blkt_li4sio4 + self.data.fwbs.f_vol_blkt_tibe12 = ( + self.data.fwbs.breeder_multiplier - self.data.fwbs.f_vol_blkt_li4sio4 ) - fwbs_variables.m_blkt_tibe12 = ( - fwbs_variables.vol_blkt_total * fwbs_variables.f_vol_blkt_tibe12 * 2260.0 + self.data.fwbs.m_blkt_tibe12 = ( + self.data.fwbs.vol_blkt_total * self.data.fwbs.f_vol_blkt_tibe12 * 2260.0 ) # Blanket Lithium orthosilicate mass (kg) # Ref: www.rockwoodlithium.com... - fwbs_variables.m_blkt_li4sio4 = ( - fwbs_variables.vol_blkt_total * fwbs_variables.f_vol_blkt_li4sio4 * 2400.0 + self.data.fwbs.m_blkt_li4sio4 = ( + self.data.fwbs.vol_blkt_total * self.data.fwbs.f_vol_blkt_li4sio4 * 2400.0 ) # TODO sort this out so that costs model uses new variables. # #327 For backwards compatibility, set the old blanket masses the same: - fwbs_variables.m_blkt_beryllium = fwbs_variables.m_blkt_tibe12 - fwbs_variables.m_blkt_li2o = fwbs_variables.m_blkt_li4sio4 + self.data.fwbs.m_blkt_beryllium = self.data.fwbs.m_blkt_tibe12 + self.data.fwbs.m_blkt_li2o = self.data.fwbs.m_blkt_li4sio4 # Steel fraction by volume is the remainder: - fwbs_variables.f_vol_blkt_steel = ( + self.data.fwbs.f_vol_blkt_steel = ( 1.0 - - fwbs_variables.f_vol_blkt_li4sio4 - - fwbs_variables.f_vol_blkt_tibe12 - - fwbs_variables.vfcblkt - - fwbs_variables.vfpblkt + - self.data.fwbs.f_vol_blkt_li4sio4 + - self.data.fwbs.f_vol_blkt_tibe12 + - self.data.fwbs.vfcblkt + - self.data.fwbs.vfpblkt ) # Steel mass (kg) - fwbs_variables.m_blkt_steel_total = ( - fwbs_variables.vol_blkt_total - * fwbs_variables.f_vol_blkt_steel - * fwbs_variables.den_steel + self.data.fwbs.m_blkt_steel_total = ( + self.data.fwbs.vol_blkt_total + * self.data.fwbs.f_vol_blkt_steel + * self.data.fwbs.den_steel ) # Total blanket mass (kg) - fwbs_variables.m_blkt_total = ( - fwbs_variables.m_blkt_tibe12 - + fwbs_variables.m_blkt_li4sio4 - + fwbs_variables.m_blkt_steel_total + self.data.fwbs.m_blkt_total = ( + self.data.fwbs.m_blkt_tibe12 + + self.data.fwbs.m_blkt_li4sio4 + + self.data.fwbs.m_blkt_steel_total ) # Total mass of first wall and blanket - fwbs_variables.armour_fw_bl_mass = ( - fwbs_variables.fw_armour_mass - + fwbs_variables.m_fw_total - + fwbs_variables.m_blkt_total + self.data.fwbs.armour_fw_bl_mass = ( + self.data.fwbs.fw_armour_mass + + self.data.fwbs.m_fw_total + + self.data.fwbs.m_blkt_total ) def nuclear_heating_magnets(self, output: bool): @@ -450,34 +453,34 @@ def nuclear_heating_magnets(self, output: bool): # First wall void fractions # inboard FW coolant void fraction - fwbs_variables.f_a_fw_coolant_inboard = ( + self.data.fwbs.f_a_fw_coolant_inboard = ( np.pi - * fwbs_variables.radius_fw_channel**2 - / (fwbs_variables.dx_fw_module * build_variables.dr_fw_inboard) + * self.data.fwbs.radius_fw_channel**2 + / (self.data.fwbs.dx_fw_module * build_variables.dr_fw_inboard) ) # outboard FW coolant void fraction - fwbs_variables.f_a_fw_coolant_outboard = fwbs_variables.f_a_fw_coolant_inboard + self.data.fwbs.f_a_fw_coolant_outboard = self.data.fwbs.f_a_fw_coolant_inboard # mean FW coolant void fraction - vffwm = fwbs_variables.f_a_fw_coolant_inboard + vffwm = self.data.fwbs.f_a_fw_coolant_inboard # Calculate smeared densities of blanket sections # gaseous He coolant in armour, FW & blanket: He mass is neglected ccfe_hcpb_module.armour_density = constants.DEN_TUNGSTEN * (1.0 - vffwm) - ccfe_hcpb_module.fw_density = fwbs_variables.den_steel * (1.0 - vffwm) + ccfe_hcpb_module.fw_density = self.data.fwbs.den_steel * (1.0 - vffwm) ccfe_hcpb_module.blanket_density = ( - fwbs_variables.m_blkt_total / fwbs_variables.vol_blkt_total + self.data.fwbs.m_blkt_total / self.data.fwbs.vol_blkt_total ) ccfe_hcpb_module.shield_density = ( - fwbs_variables.whtshld / fwbs_variables.vol_shld_total + self.data.fwbs.whtshld / self.data.fwbs.vol_shld_total ) # Picking the largest value for VV thickness d_vv_all = build_variables.dr_vv_inboard d_vv_all = max(d_vv_all, build_variables.dr_vv_outboard) if d_vv_all > 1.0e-6: - ccfe_hcpb_module.vv_density = fwbs_variables.m_vv / fwbs_variables.vol_vv + ccfe_hcpb_module.vv_density = self.data.fwbs.m_vv / self.data.fwbs.vol_vv else: ccfe_hcpb_module.vv_density = 0.0 @@ -503,7 +506,7 @@ def nuclear_heating_magnets(self, output: bool): # Exponents (tonne/m2) # Blanket exponent (/1000 for kg -> tonnes) ccfe_hcpb_module.x_blanket = ( - ccfe_hcpb_module.armour_density * fwbs_variables.fw_armour_thickness + ccfe_hcpb_module.armour_density * self.data.fwbs.fw_armour_thickness + ccfe_hcpb_module.fw_density * (build_variables.dr_fw_inboard + build_variables.dr_fw_outboard) / 2.0 @@ -539,7 +542,7 @@ def nuclear_heating_magnets(self, output: bool): ) # Total heating (MW) - fwbs_variables.p_tf_nuclear_heat_mw = ( + self.data.fwbs.p_tf_nuclear_heat_mw = ( ccfe_hcpb_module.tfc_nuc_heating * (physics_variables.p_fusion_total_mw / 1000.0) / 1.0e6 @@ -569,7 +572,7 @@ def nuclear_heating_magnets(self, output: bool): self.outfile, "Total nuclear heating in TF coil (MW)", "(p_tf_nuclear_heat_mw.)", - fwbs_variables.p_tf_nuclear_heat_mw, + self.data.fwbs.p_tf_nuclear_heat_mw, ) po.ovarre( self.outfile, @@ -748,43 +751,43 @@ def powerflow_calc(self, output: bool): """ # Radiation power incident on HCD apparatus (MW) - fwbs_variables.p_fw_hcd_rad_total_mw = ( - physics_variables.p_plasma_rad_mw * fwbs_variables.f_a_fw_outboard_hcd + self.data.fwbs.p_fw_hcd_rad_total_mw = ( + physics_variables.p_plasma_rad_mw * self.data.fwbs.f_a_fw_outboard_hcd ) # Radiation power incident on first wall (MW) - fwbs_variables.p_fw_rad_total_mw = ( + self.data.fwbs.p_fw_rad_total_mw = ( physics_variables.p_plasma_rad_mw - - fwbs_variables.p_div_rad_total_mw - - fwbs_variables.p_fw_hcd_rad_total_mw + - self.data.fwbs.p_div_rad_total_mw + - self.data.fwbs.p_fw_hcd_rad_total_mw ) # If we have chosen pressurised water as the blanket coolant, set the # coolant outlet temperature as 20 deg C below the boiling point - if fwbs_variables.i_blkt_coolant_type == 2: + if self.data.fwbs.i_blkt_coolant_type == 2: outlet_saturated_fluid_properties = FluidProperties.of( "Water", - pressure=fwbs_variables.pres_blkt_coolant * 1.0e6, + pressure=self.data.fwbs.pres_blkt_coolant * 1.0e6, vapor_quality=0, ) - fwbs_variables.temp_blkt_coolant_out = ( + self.data.fwbs.temp_blkt_coolant_out = ( outlet_saturated_fluid_properties.temperature - 20.0 ) # in K # Surface heat flux on first wall (outboard and inboard) (MW) # All of the fast particle losses go to the outer wall. - fwbs_variables.psurffwo = ( - fwbs_variables.p_fw_rad_total_mw + self.data.fwbs.psurffwo = ( + self.data.fwbs.p_fw_rad_total_mw * self.data.first_wall.a_fw_outboard / self.data.first_wall.a_fw_total + current_drive_variables.p_beam_orbit_loss_mw + physics_variables.p_fw_alpha_mw ) - fwbs_variables.psurffwi = fwbs_variables.p_fw_rad_total_mw * ( + self.data.fwbs.psurffwi = self.data.fwbs.p_fw_rad_total_mw * ( 1 - self.data.first_wall.a_fw_outboard / self.data.first_wall.a_fw_total ) - i_p_coolant_pumping = PumpingPowerModelTypes(fwbs_variables.i_p_coolant_pumping) + i_p_coolant_pumping = PumpingPowerModelTypes(self.data.fwbs.i_p_coolant_pumping) if i_p_coolant_pumping == PumpingPowerModelTypes.FRACTION_OF_HEAT: # User sets mechanical pumping power directly ( @@ -797,15 +800,15 @@ def powerflow_calc(self, output: bool): f_p_blkt_coolant_pump_total_heat=heat_transport_variables.f_p_blkt_coolant_pump_total_heat, f_p_shld_coolant_pump_total_heat=heat_transport_variables.f_p_shld_coolant_pump_total_heat, f_p_div_coolant_pump_total_heat=heat_transport_variables.f_p_div_coolant_pump_total_heat, - p_fw_nuclear_heat_total_mw=fwbs_variables.p_fw_nuclear_heat_total_mw, - psurffwi=fwbs_variables.psurffwi, - psurffwo=fwbs_variables.psurffwo, - p_blkt_nuclear_heat_total_mw=fwbs_variables.p_blkt_nuclear_heat_total_mw, + p_fw_nuclear_heat_total_mw=self.data.fwbs.p_fw_nuclear_heat_total_mw, + psurffwi=self.data.fwbs.psurffwi, + psurffwo=self.data.fwbs.psurffwo, + p_blkt_nuclear_heat_total_mw=self.data.fwbs.p_blkt_nuclear_heat_total_mw, p_shld_nuclear_heat_mw=heat_transport_variables.p_shld_nuclear_heat_mw, - p_cp_shield_nuclear_heat_mw=fwbs_variables.p_cp_shield_nuclear_heat_mw, + p_cp_shield_nuclear_heat_mw=self.data.fwbs.p_cp_shield_nuclear_heat_mw, p_plasma_separatrix_mw=physics_variables.p_plasma_separatrix_mw, - p_div_nuclear_heat_total_mw=fwbs_variables.p_div_nuclear_heat_total_mw, - p_div_rad_total_mw=fwbs_variables.p_div_rad_total_mw, + p_div_nuclear_heat_total_mw=self.data.fwbs.p_div_nuclear_heat_total_mw, + p_div_rad_total_mw=self.data.fwbs.p_div_rad_total_mw, ) elif i_p_coolant_pumping == PumpingPowerModelTypes.MECHANICAL: @@ -819,16 +822,16 @@ def powerflow_calc(self, output: bool): heat_transport_variables.p_shld_coolant_pump_mw = ( heat_transport_variables.f_p_shld_coolant_pump_total_heat * ( - fwbs_variables.p_shld_nuclear_heat_mw - + fwbs_variables.p_cp_shield_nuclear_heat_mw + self.data.fwbs.p_shld_nuclear_heat_mw + + self.data.fwbs.p_cp_shield_nuclear_heat_mw ) ) heat_transport_variables.p_div_coolant_pump_mw = ( heat_transport_variables.f_p_div_coolant_pump_total_heat * ( physics_variables.p_plasma_separatrix_mw - + fwbs_variables.p_div_nuclear_heat_total_mw - + fwbs_variables.p_div_rad_total_mw + + self.data.fwbs.p_div_nuclear_heat_total_mw + + self.data.fwbs.p_div_rad_total_mw ) ) @@ -844,7 +847,7 @@ def powerflow_calc(self, output: bool): / primary_pumping_variables.gamma_he ) # N.B. Currenlty i_p_coolant_pumping==3 uses seperate variables found in - # primary_pumping_variables rather than fwbs_variables. + # primary_pumping_variables rather than self.data.fwbs. # The pressure (p_he) is assumed to be the pressure at the # blanket inlet/pump oulet. # The pressures (found in fwbs_variables) for coolants using @@ -855,12 +858,12 @@ def powerflow_calc(self, output: bool): dt_he = ( primary_pumping_variables.t_out_bb - primary_pumping_variables.t_in_bb ) - fpump = t_in_compressor / (fwbs_variables.etaiso * dt_he) * (pfactor - 1) + fpump = t_in_compressor / (self.data.fwbs.etaiso * dt_he) * (pfactor - 1) p_plasma = ( - fwbs_variables.p_fw_nuclear_heat_total_mw - + fwbs_variables.psurffwi - + fwbs_variables.psurffwo - + fwbs_variables.p_blkt_nuclear_heat_total_mw + self.data.fwbs.p_fw_nuclear_heat_total_mw + + self.data.fwbs.psurffwi + + self.data.fwbs.psurffwo + + self.data.fwbs.p_blkt_nuclear_heat_total_mw ) primary_pumping_variables.p_fw_blkt_coolant_pump_mw = ( primary_pumping_variables.f_p_fw_blkt_pump @@ -874,16 +877,16 @@ def powerflow_calc(self, output: bool): heat_transport_variables.p_shld_coolant_pump_mw = ( heat_transport_variables.f_p_shld_coolant_pump_total_heat * ( - fwbs_variables.p_shld_nuclear_heat_mw - + fwbs_variables.p_cp_shield_nuclear_heat_mw + self.data.fwbs.p_shld_nuclear_heat_mw + + self.data.fwbs.p_cp_shield_nuclear_heat_mw ) ) heat_transport_variables.p_div_coolant_pump_mw = ( heat_transport_variables.f_p_div_coolant_pump_total_heat * ( physics_variables.p_plasma_separatrix_mw - + fwbs_variables.p_div_nuclear_heat_total_mw - + fwbs_variables.p_div_rad_total_mw + + self.data.fwbs.p_div_nuclear_heat_total_mw + + self.data.fwbs.p_div_rad_total_mw ) ) if output: @@ -959,19 +962,19 @@ def powerflow_calc(self, output: bool): self.outfile, "Radius of blanket cooling channels (m)", "(radius_blkt_channel)", - fwbs_variables.radius_blkt_channel, + self.data.fwbs.radius_blkt_channel, ) po.ovarre( self.outfile, "Radius of 90 degree coolant channel bend (m)", "(radius_blkt_channel_90_bend)", - fwbs_variables.radius_blkt_channel_90_bend, + self.data.fwbs.radius_blkt_channel_90_bend, ) po.ovarre( self.outfile, "Radius of 180 degree coolant channel bend (m)", "(radius_blkt_channel_180_bend)", - fwbs_variables.radius_blkt_channel_180_bend, + self.data.fwbs.radius_blkt_channel_180_bend, ) def st_cp_angle_fraction(self, z_cp_top, r_cp_mid, r_cp_top, rmajor): @@ -1262,26 +1265,26 @@ def write_output(self): self.outfile, "Titanium beryllide fraction", "(f_vol_blkt_tibe12)", - fwbs_variables.f_vol_blkt_tibe12, + self.data.fwbs.f_vol_blkt_tibe12, "OP ", ) po.ovarrf( self.outfile, "Lithium orthosilicate fraction", "(f_vol_blkt_li4sio4)", - fwbs_variables.f_vol_blkt_li4sio4, + self.data.fwbs.f_vol_blkt_li4sio4, "OP ", ) po.ovarrf( self.outfile, "Steel fraction", "(f_vol_blkt_steel)", - fwbs_variables.f_vol_blkt_steel, + self.data.fwbs.f_vol_blkt_steel, "OP ", ) - po.ovarrf(self.outfile, "Coolant fraction", "(vfcblkt)", fwbs_variables.vfcblkt) + po.ovarrf(self.outfile, "Coolant fraction", "(vfcblkt)", self.data.fwbs.vfcblkt) po.ovarrf( - self.outfile, "Purge gas fraction", "(vfpblkt)", fwbs_variables.vfpblkt + self.outfile, "Purge gas fraction", "(vfpblkt)", self.data.fwbs.vfpblkt ) po.osubhd(self.outfile, "Component Volumes :") @@ -1290,35 +1293,35 @@ def write_output(self): self.outfile, "First Wall Armour Volume (m3)", "(fw_armour_vol)", - fwbs_variables.fw_armour_vol, + self.data.fwbs.fw_armour_vol, "OP ", ) po.ovarrf( self.outfile, "First Wall Volume (m3)", "(vol_fw_total)", - fwbs_variables.vol_fw_total, + self.data.fwbs.vol_fw_total, "OP ", ) po.ovarrf( self.outfile, "Blanket Volume (m3)", "(vol_blkt_total)", - fwbs_variables.vol_blkt_total, + self.data.fwbs.vol_blkt_total, "OP ", ) po.ovarrf( self.outfile, "Shield Volume (m3)", "(vol_shld_total)", - fwbs_variables.vol_shld_total, + self.data.fwbs.vol_shld_total, "OP ", ) po.ovarrf( self.outfile, "Vacuum vessel volume (m3)", "(vol_vv)", - fwbs_variables.vol_vv, + self.data.fwbs.vol_vv, "OP ", ) @@ -1328,59 +1331,59 @@ def write_output(self): self.outfile, "First Wall Armour Mass (kg)", "(fw_armour_mass)", - fwbs_variables.fw_armour_mass, + self.data.fwbs.fw_armour_mass, "OP ", ) po.ovarre( self.outfile, "First Wall Mass, excluding armour (kg)", "(m_fw_total)", - fwbs_variables.m_fw_total, + self.data.fwbs.m_fw_total, "OP ", ) po.ovarre( self.outfile, "Blanket Mass - Total(kg)", "(m_blkt_total)", - fwbs_variables.m_blkt_total, + self.data.fwbs.m_blkt_total, "OP ", ) po.ovarre( self.outfile, " Blanket Mass - TiBe12 (kg)", "(m_blkt_tibe12)", - fwbs_variables.m_blkt_tibe12, + self.data.fwbs.m_blkt_tibe12, "OP ", ) po.ovarre( self.outfile, " Blanket Mass - Li4SiO4 (kg)", "(m_blkt_li4sio4)", - fwbs_variables.m_blkt_li4sio4, + self.data.fwbs.m_blkt_li4sio4, "OP ", ) po.ovarre( self.outfile, " Blanket Mass - Steel (kg)", "(m_blkt_steel_total)", - fwbs_variables.m_blkt_steel_total, + self.data.fwbs.m_blkt_steel_total, "OP ", ) po.ovarre( self.outfile, "Total mass of armour, first wall and blanket (kg)", "(armour_fw_bl_mass)", - fwbs_variables.armour_fw_bl_mass, + self.data.fwbs.armour_fw_bl_mass, "OP ", ) po.ovarre( - self.outfile, "Shield Mass (kg)", "(whtshld)", fwbs_variables.whtshld, "OP " + self.outfile, "Shield Mass (kg)", "(whtshld)", self.data.fwbs.whtshld, "OP " ) po.ovarre( self.outfile, "Vacuum vessel mass (kg)", "(m_vv)", - fwbs_variables.m_vv, + self.data.fwbs.m_vv, "OP ", ) @@ -1397,7 +1400,7 @@ def write_output(self): self.outfile, "ST centrepost TF fast neutron fllux (E > 0.1 MeV) (m^(-2).s^(-1))", "(neut_flux_cp)", - fwbs_variables.neut_flux_cp, + self.data.fwbs.neut_flux_cp, "OP ", ) elif tfcoil_variables.i_tf_sup == TFConductorModel.HELIUM_COOLED_ALUMINIUM: @@ -1407,21 +1410,21 @@ def write_output(self): self.outfile, "ST centrepost TF heating (MW)", "(pnuc_cp_tf)", - fwbs_variables.pnuc_cp_tf, + self.data.fwbs.pnuc_cp_tf, "OP ", ) po.ovarre( self.outfile, "ST centrepost shield heating (MW)", "(p_cp_shield_nuclear_heat_mw)", - fwbs_variables.p_cp_shield_nuclear_heat_mw, + self.data.fwbs.p_cp_shield_nuclear_heat_mw, "OP ", ) po.ovarre( self.outfile, "ST centrepost total heating (MW)", "(pnuc_cp)", - fwbs_variables.pnuc_cp, + self.data.fwbs.pnuc_cp, "OP ", ) @@ -1429,21 +1432,21 @@ def write_output(self): self.outfile, "Total nuclear heating in TF+PF coils (CS is negligible) (MW)", "(p_tf_nuclear_heat_mw)", - fwbs_variables.p_tf_nuclear_heat_mw, + self.data.fwbs.p_tf_nuclear_heat_mw, "OP ", ) po.ovarre( self.outfile, "Total nuclear heating in FW (MW)", "(p_fw_nuclear_heat_total_mw)", - fwbs_variables.p_fw_nuclear_heat_total_mw, + self.data.fwbs.p_fw_nuclear_heat_total_mw, "OP ", ) po.ovarre( self.outfile, "Total nuclear heating in the blanket (including f_p_blkt_multiplication) (MW)", "(p_blkt_nuclear_heat_total_mw)", - fwbs_variables.p_blkt_nuclear_heat_total_mw, + self.data.fwbs.p_blkt_nuclear_heat_total_mw, "OP ", ) po.ocmmnt( @@ -1454,14 +1457,14 @@ def write_output(self): self.outfile, "Total nuclear heating in the shield (MW)", "(p_shld_nuclear_heat_mw)", - fwbs_variables.p_shld_nuclear_heat_mw, + self.data.fwbs.p_shld_nuclear_heat_mw, "OP ", ) po.ovarre( self.outfile, "Total nuclear heating in the divertor (MW)", "(p_div_nuclear_heat_total_mw)", - fwbs_variables.p_div_nuclear_heat_total_mw, + self.data.fwbs.p_div_nuclear_heat_total_mw, "OP ", ) po.osubhd(self.outfile, " Diagostic output for nuclear heating :") @@ -1490,35 +1493,35 @@ def write_output(self): self.outfile, "Solid angle fraction taken by on divertor", "(f_ster_div_single)", - fwbs_variables.f_ster_div_single, + self.data.fwbs.f_ster_div_single, ) po.ovarre( self.outfile, "Fraction of outboard first wall area covered by HCD and diagnostics", "(f_a_fw_outboard_hcd)", - fwbs_variables.f_a_fw_outboard_hcd, + self.data.fwbs.f_a_fw_outboard_hcd, ) po.ovarin( self.outfile, "Switch for plant secondary cycle ", "(i_thermal_electric_conversion)", - fwbs_variables.i_thermal_electric_conversion, + self.data.fwbs.i_thermal_electric_conversion, ) po.ovarre( self.outfile, "First wall coolant pressure (Pa)", "(pres_fw_coolant)", - fwbs_variables.pres_fw_coolant, + self.data.fwbs.pres_fw_coolant, ) po.ovarre( self.outfile, "Blanket coolant pressure (Pa)", "(pres_blkt_coolant)", - fwbs_variables.pres_blkt_coolant, + self.data.fwbs.pres_blkt_coolant, ) if ( - fwbs_variables.i_p_coolant_pumping + self.data.fwbs.i_p_coolant_pumping != PumpingPowerModelTypes.MECHANICAL_WITH_PRESSURE_DROP ): po.ovarre( @@ -1573,31 +1576,31 @@ def write_output(self): self.outfile, "No of inboard blanket modules poloidally", "(n_blkt_inboard_modules_poloidal)", - fwbs_variables.n_blkt_inboard_modules_poloidal, + self.data.fwbs.n_blkt_inboard_modules_poloidal, ) po.ovarre( self.outfile, "No of inboard blanket modules toroidally", "(n_blkt_inboard_modules_toroidal)", - fwbs_variables.n_blkt_inboard_modules_toroidal, + self.data.fwbs.n_blkt_inboard_modules_toroidal, ) po.ovarre( self.outfile, "No of outboard blanket modules poloidally", "(n_blkt_outboard_modules_poloidal)", - fwbs_variables.n_blkt_outboard_modules_poloidal, + self.data.fwbs.n_blkt_outboard_modules_poloidal, ) po.ovarre( self.outfile, "No of outboard blanket modules toroidally", "(n_blkt_outboard_modules_toroidal)", - fwbs_variables.n_blkt_outboard_modules_toroidal, + self.data.fwbs.n_blkt_outboard_modules_toroidal, ) po.ovarre( self.outfile, "Isentropic efficiency of first wall / blanket coolant pumps", "(etaiso)", - fwbs_variables.etaiso, + self.data.fwbs.etaiso, ) po.ovarre( self.outfile, diff --git a/process/models/build.py b/process/models/build.py index 36cd13769..c48219045 100644 --- a/process/models/build.py +++ b/process/models/build.py @@ -11,7 +11,6 @@ buildings_variables, current_drive_variables, divertor_variables, - fwbs_variables, numerics, pfcoil_variables, physics_variables, @@ -1671,7 +1670,7 @@ def calculate_radial_build(self, output: bool): output : bool Flag indicating whether to output the results """ - if fwbs_variables.blktmodel > 0: + if self.data.fwbs.blktmodel > 0: build_variables.dr_blkt_inboard = ( build_variables.blbuith + build_variables.blbmith diff --git a/process/models/buildings.py b/process/models/buildings.py index 1fef24f3a..f6b0124cb 100644 --- a/process/models/buildings.py +++ b/process/models/buildings.py @@ -10,7 +10,6 @@ buildings_variables, current_drive_variables, divertor_variables, - fwbs_variables, heat_transport_variables, pfcoil_variables, physics_variables, @@ -91,8 +90,8 @@ def run(self, output: bool = False): * (build_variables.z_tf_inside_half - build_variables.dz_shld_vv_gap) - build_variables.dz_vv_upper - build_variables.dz_vv_lower, - fwbs_variables.whtshld, - fwbs_variables.r_cryostat_inboard, + self.data.fwbs.whtshld, + self.data.fwbs.r_cryostat_inboard, heat_transport_variables.helpow, ) @@ -429,7 +428,7 @@ def bldgs_sizes(self, output, tf_radial_dim, tf_vertical_dim): # PF coil max radius, cryostat radius, TF coil outer radius width_reactor_piece = max( pfcoil_variables.r_pf_coil_outer_max, - fwbs_variables.r_cryostat_inboard, + self.data.fwbs.r_cryostat_inboard, tf_radial_dim, ) # Allow for biological shielding around reactor diff --git a/process/models/costs/costs.py b/process/models/costs/costs.py index d7d61525b..9353ea0e9 100644 --- a/process/models/costs/costs.py +++ b/process/models/costs/costs.py @@ -11,7 +11,6 @@ buildings_variables, current_drive_variables, divertor_variables, - fwbs_variables, heat_transport_variables, ife_variables, pf_power_variables, @@ -103,7 +102,7 @@ def output(self): self.outfile, "First wall / blanket life (years)", "(life_blkt)", - fwbs_variables.life_blkt, + self.data.fwbs.life_blkt, ) if ife_variables.ife != 1: @@ -1257,19 +1256,19 @@ def acc2212(self): if ife_variables.ife != 1: # Solid blanket (Li2O + Be) self.data.costs.c22121 = ( - 1.0e-6 * fwbs_variables.m_blkt_beryllium * self.data.costs.ucblbe + 1.0e-6 * self.data.fwbs.m_blkt_beryllium * self.data.costs.ucblbe ) # CCFE model self.data.costs.c22122 = ( - 1.0e-6 * fwbs_variables.m_blkt_li2o * self.data.costs.ucblli2o + 1.0e-6 * self.data.fwbs.m_blkt_li2o * self.data.costs.ucblli2o ) self.data.costs.c22123 = ( - 1.0e-6 * fwbs_variables.m_blkt_steel_total * self.data.costs.ucblss + 1.0e-6 * self.data.fwbs.m_blkt_steel_total * self.data.costs.ucblss ) self.data.costs.c22124 = ( - 1.0e-6 * fwbs_variables.m_blkt_vanadium * self.data.costs.ucblvd + 1.0e-6 * self.data.fwbs.m_blkt_vanadium * self.data.costs.ucblvd ) self.data.costs.c22125 = 0.0e0 self.data.costs.c22126 = 0.0e0 @@ -1281,10 +1280,10 @@ def acc2212(self): self.data.costs.c22121 = 0.0e0 self.data.costs.c22122 = ( - 1.0e-6 * fwbs_variables.m_blkt_li2o * self.data.costs.ucblli2o + 1.0e-6 * self.data.fwbs.m_blkt_li2o * self.data.costs.ucblli2o ) self.data.costs.c22123 = ( - 1.0e-6 * fwbs_variables.m_blkt_steel_total * self.data.costs.ucblss + 1.0e-6 * self.data.fwbs.m_blkt_steel_total * self.data.costs.ucblss ) self.data.costs.c22124 = 0.0e0 self.data.costs.c22125 = ( @@ -1307,7 +1306,7 @@ def acc2212(self): ) self.data.costs.c22127 = 1.0e-6 * ife_variables.ucflib * ife_variables.mflibe self.data.costs.c22128 = ( - 1.0e-6 * self.data.costs.ucblli * fwbs_variables.m_blkt_lithium + 1.0e-6 * self.data.costs.ucblli * self.data.fwbs.m_blkt_lithium ) self.data.costs.c22121 = ( @@ -1373,7 +1372,7 @@ def acc2213(self): if ife_variables.ife != 1: self.data.costs.c22131 = ( 1.0e-6 - * fwbs_variables.whtshld + * self.data.fwbs.whtshld * self.data.costs.ucshld * cmlsa[self.data.costs.lsa - 1] ) @@ -1415,7 +1414,7 @@ def acc2213(self): if ife_variables.ife != 1: self.data.costs.c22132 = ( 1.0e-6 - * fwbs_variables.wpenshld + * self.data.fwbs.wpenshld * self.data.costs.ucpens * cmlsa[self.data.costs.lsa - 1] ) @@ -1880,7 +1879,7 @@ def acc2223(self): """ cmlsa = [0.6900e0, 0.8450e0, 0.9225e0, 1.0000e0] - self.data.costs.c2223 = 1.0e-6 * fwbs_variables.m_vv * self.data.costs.uccryo + self.data.costs.c2223 = 1.0e-6 * self.data.fwbs.m_vv * self.data.costs.uccryo self.data.costs.c2223 = ( self.data.costs.fkind * self.data.costs.c2223 @@ -2261,11 +2260,11 @@ def acc2261(self): # inconsistency exists here... self.data.costs.cpp = ( 1.0e-6 - * self.data.costs.uchts[fwbs_variables.i_blkt_coolant_type - 1] + * self.data.costs.uchts[self.data.fwbs.i_blkt_coolant_type - 1] * ( (1.0e6 * heat_transport_variables.p_fw_div_heat_deposited_mw) ** exphts - + (1.0e6 * fwbs_variables.p_blkt_nuclear_heat_total_mw) ** exphts - + (1.0e6 * fwbs_variables.p_shld_nuclear_heat_mw) ** exphts + + (1.0e6 * self.data.fwbs.p_blkt_nuclear_heat_total_mw) ** exphts + + (1.0e6 * self.data.fwbs.p_shld_nuclear_heat_mw) ** exphts ) ) @@ -2471,7 +2470,7 @@ def acc23(self): if self.data.costs.ireactor == 1: self.data.costs.c23 = ( 1.0e-6 - * self.data.costs.ucturb[fwbs_variables.i_blkt_coolant_type - 1] + * self.data.costs.ucturb[self.data.fwbs.i_blkt_coolant_type - 1] * (heat_transport_variables.p_plant_electric_gross_mw / 1200.0e0) ** exptpe ) @@ -2784,7 +2783,7 @@ def coelc(self): # Compound interest factor - feffwbl = (1.0e0 + self.data.costs.discount_rate) ** fwbs_variables.life_blkt + feffwbl = (1.0e0 + self.data.costs.discount_rate) ** self.data.fwbs.life_blkt # Capital recovery factor @@ -2800,7 +2799,7 @@ def coelc(self): ) if self.data.costs.ifueltyp == 2: - annfwbl *= 1.0e0 - fwbs_variables.life_blkt_fpy / self.data.costs.life_plant + annfwbl *= 1.0e0 - self.data.fwbs.life_blkt_fpy / self.data.costs.life_plant # Cost of electricity due to first wall/blanket replacements @@ -3047,14 +3046,14 @@ def convert_fpy_to_calendar(self): Required for replacement component costs. """ # FW/Blanket and HCD - if fwbs_variables.life_blkt_fpy < self.data.costs.life_plant: - fwbs_variables.life_blkt = ( - fwbs_variables.life_blkt_fpy * self.data.costs.f_t_plant_available + if self.data.fwbs.life_blkt_fpy < self.data.costs.life_plant: + self.data.fwbs.life_blkt = ( + self.data.fwbs.life_blkt_fpy * self.data.costs.f_t_plant_available ) # Current drive system lifetime (assumed equal to first wall and blanket lifetime) - self.data.costs.cdrlife_cal = fwbs_variables.life_blkt + self.data.costs.cdrlife_cal = self.data.fwbs.life_blkt else: - fwbs_variables.life_blkt = fwbs_variables.life_blkt_fpy + self.data.fwbs.life_blkt = self.data.fwbs.life_blkt_fpy # Divertor if self.data.costs.life_div_fpy < self.data.costs.life_plant: diff --git a/process/models/costs/costs_2015.py b/process/models/costs/costs_2015.py index f5b21efca..2989e85c6 100644 --- a/process/models/costs/costs_2015.py +++ b/process/models/costs/costs_2015.py @@ -8,7 +8,6 @@ from process.data_structure import ( build_variables, current_drive_variables, - fwbs_variables, global_variables, heat_transport_variables, pf_power_variables, @@ -198,11 +197,11 @@ def calc_fwbs_costs(self): self.data.costs_2015.s_label[21] = "Lithium enrichment" # Zero cost for natural enrichment - if fwbs_variables.f_blkt_li6_enrichment <= 7.42e0: + if self.data.fwbs.f_blkt_li6_enrichment <= 7.42e0: self.data.costs_2015.s_cost[21] = 0.0e0 else: # Percentage of lithium 6 in the product - product_li6 = min(fwbs_variables.f_blkt_li6_enrichment, 99.99e0) / 100.0e0 + product_li6 = min(self.data.fwbs.f_blkt_li6_enrichment, 99.99e0) / 100.0e0 # SWU will be calculated for a unit mass of product (P=1) # Feed to product mass ratio @@ -222,7 +221,7 @@ def calc_fwbs_costs(self): ) # Mass of lithium (kg). Lithium orthosilicate is 22% lithium by mass. - mass_li = fwbs_variables.m_blkt_li2o * 0.22 + mass_li = self.data.fwbs.m_blkt_li2o * 0.22 # Total swu for lithium in blanket total_swu = swu * mass_li @@ -243,7 +242,7 @@ def calc_fwbs_costs(self): # Reference cost of lithium pebble manufacture (2014 $) self.data.costs_2015.s_cref[22] = 6.5e4 # Scale with mass of pebbles (kg) - self.data.costs_2015.s_k[22] = fwbs_variables.m_blkt_li2o + self.data.costs_2015.s_k[22] = self.data.fwbs.m_blkt_li2o self.data.costs_2015.s_kref[22] = 10.0e0 self.data.costs_2015.s_cost[22] = ( self.data.costs_2015.s_cost_factor[22] @@ -256,7 +255,7 @@ def calc_fwbs_costs(self): # Reference cost of titanium beryllide pebble manufacture (2014 $) self.data.costs_2015.s_cref[23] = 450.0e6 # Scale with mass of titanium beryllide pebbles (kg) - self.data.costs_2015.s_k[23] = fwbs_variables.m_blkt_beryllium + self.data.costs_2015.s_k[23] = self.data.fwbs.m_blkt_beryllium self.data.costs_2015.s_kref[23] = 1.0e5 self.data.costs_2015.s_cost[23] = ( self.data.costs_2015.s_cost_factor[23] @@ -271,7 +270,7 @@ def calc_fwbs_costs(self): # First wall W coating mass (kg) self.data.costs_2015.s_k[24] = ( self.data.first_wall.a_fw_total - * fwbs_variables.fw_armour_thickness + * self.data.fwbs.fw_armour_thickness * constants.DEN_TUNGSTEN ) self.data.costs_2015.s_kref[24] = 29000.0e0 @@ -291,7 +290,7 @@ def calc_fwbs_costs(self): self.data.costs_2015.s_cref[25] = 317.0e6 # Scale with steel mass in blanket + shield mass self.data.costs_2015.s_k[25] = ( - fwbs_variables.m_blkt_steel_total + fwbs_variables.whtshld + self.data.fwbs.m_blkt_steel_total + self.data.fwbs.whtshld ) self.data.costs_2015.s_kref[25] = 4.07e6 self.data.costs_2015.s_cost[25] = ( @@ -479,9 +478,9 @@ def calc_building_costs(self): ) # ITER cryostat volume (m^3) self.data.costs_2015.s_k[1] = ( - (np.pi * fwbs_variables.r_cryostat_inboard**2) + (np.pi * self.data.fwbs.r_cryostat_inboard**2) * 2.0e0 - * fwbs_variables.z_cryostat_half_inside + * self.data.fwbs.z_cryostat_half_inside ) self.data.costs_2015.s_kref[1] = 18712.0e0 self.data.costs_2015.s_cost[1] = ( @@ -604,7 +603,7 @@ def calc_land_costs(self): ITER_buffer_land_area = ITER_total_land_area - ITER_key_buildings_land_area # Scale with area of cryostat (m) - self.data.costs_2015.s_k[9] = np.pi * fwbs_variables.r_cryostat_inboard**2 + self.data.costs_2015.s_k[9] = np.pi * self.data.fwbs.r_cryostat_inboard**2 self.data.costs_2015.s_kref[9] = 638.0e0 # Cost of land per hectare (2014 $ / ha) self.data.costs_2015.s_cref[9] = 318000.0e0 @@ -625,7 +624,7 @@ def calc_land_costs(self): # Cost of clearing ITER land self.data.costs_2015.s_cref[10] = 214.0e6 # Scale with area of cryostat (m) - self.data.costs_2015.s_k[10] = np.pi * fwbs_variables.r_cryostat_inboard**2 + self.data.costs_2015.s_k[10] = np.pi * self.data.fwbs.r_cryostat_inboard**2 self.data.costs_2015.s_kref[10] = 638.0e0 self.data.costs_2015.s_cost[10] = ( self.data.costs_2015.s_cost_factor[10] @@ -782,7 +781,7 @@ def calc_remote_handling_costs(self): ) # Scale with total mass of armour, first wall and blanket (kg) self.data.costs_2015.s_kref[27] = 4.35e6 - self.data.costs_2015.s_k[27] = fwbs_variables.armour_fw_bl_mass + self.data.costs_2015.s_k[27] = self.data.fwbs.armour_fw_bl_mass self.data.costs_2015.s_cost[27] = ( self.data.costs_2015.s_cost_factor[27] * self.data.costs_2015.s_cref[27] @@ -798,7 +797,7 @@ def calc_remote_handling_costs(self): ) # Scale with total mass of armour, first wall and blanket (kg) self.data.costs_2015.s_kref[28] = 4.35e6 - self.data.costs_2015.s_k[28] = fwbs_variables.armour_fw_bl_mass + self.data.costs_2015.s_k[28] = self.data.fwbs.armour_fw_bl_mass self.data.costs_2015.s_cost[28] = ( self.data.costs_2015.s_cost_factor[28] * self.data.costs_2015.s_cref[28] @@ -908,7 +907,7 @@ def calc_remaining_subsystems(self): # Cost of ITER VV in-wall shielding, ports and in-vessel coils self.data.costs_2015.s_cref[36] = 211.0e6 # Scale with vacuum vessel mass (kg) - self.data.costs_2015.s_k[36] = fwbs_variables.m_vv + self.data.costs_2015.s_k[36] = self.data.fwbs.m_vv self.data.costs_2015.s_kref[36] = 5.2360e6 self.data.costs_2015.s_cost[36] = ( self.data.costs_2015.s_cost_factor[36] @@ -972,9 +971,9 @@ def calc_remaining_subsystems(self): self.data.costs_2015.s_cref[43] = 351.0e6 # Scale with cryostat external volume (m3) self.data.costs_2015.s_k[43] = ( - (np.pi * fwbs_variables.r_cryostat_inboard**2.0e0) + (np.pi * self.data.fwbs.r_cryostat_inboard**2.0e0) * 2.0e0 - * fwbs_variables.z_cryostat_half_inside + * self.data.fwbs.z_cryostat_half_inside ) self.data.costs_2015.s_kref[43] = 18700.0e0 self.data.costs_2015.s_cost[43] = ( @@ -1007,10 +1006,10 @@ def calc_remaining_subsystems(self): self.data.costs_2015.s_k[45] = ( 2.0e0 * np.pi - * fwbs_variables.r_cryostat_inboard + * self.data.fwbs.r_cryostat_inboard * 2.0e0 - * fwbs_variables.z_cryostat_half_inside - + 2 * (np.pi * fwbs_variables.r_cryostat_inboard**2) + * self.data.fwbs.z_cryostat_half_inside + + 2 * (np.pi * self.data.fwbs.r_cryostat_inboard**2) ) self.data.costs_2015.s_kref[45] = 3902.0e0 self.data.costs_2015.s_cost[45] = ( @@ -1141,7 +1140,7 @@ def calc_remaining_subsystems(self): self.data.costs_2015.s_label[55] = "Access control and security systems" # Cost of ITER access control and security systems # Scale with area of cryostat (m2) - self.data.costs_2015.s_k[55] = np.pi * fwbs_variables.r_cryostat_inboard**2 + self.data.costs_2015.s_k[55] = np.pi * self.data.fwbs.r_cryostat_inboard**2 self.data.costs_2015.s_kref[55] = 640.0e0 self.data.costs_2015.s_cref[55] = 42.0e6 self.data.costs_2015.s_cost[55] = ( @@ -1229,9 +1228,9 @@ def calc_remaining_subsystems(self): # Scale with cryostat external volume (m) self.data.costs_2015.s_k[59] = ( np.pi - * fwbs_variables.r_cryostat_inboard**2 + * self.data.fwbs.r_cryostat_inboard**2 * 2.0e0 - * fwbs_variables.z_cryostat_half_inside + * self.data.fwbs.z_cryostat_half_inside ) self.data.costs_2015.s_kref[59] = 18700.0e0 self.data.costs_2015.s_cost[59] = ( diff --git a/process/models/cryostat.py b/process/models/cryostat.py index 980b11023..72aa95d7b 100644 --- a/process/models/cryostat.py +++ b/process/models/cryostat.py @@ -7,7 +7,6 @@ blanket_library, build_variables, buildings_variables, - fwbs_variables, pfcoil_variables, ) @@ -24,8 +23,7 @@ def run(self): # Calculate cryostat geometry self.external_cryo_geometry() - @staticmethod - def external_cryo_geometry(): + def external_cryo_geometry(self): """Calculate cryostat geometry. This method calculates the geometry of the cryostat, including the inboard radius, @@ -35,52 +33,52 @@ def external_cryo_geometry(): """ # Cryostat radius [m] # Take radius of furthest PF coil and add clearance - fwbs_variables.r_cryostat_inboard = ( - np.max(pfcoil_variables.r_pf_coil_outer) + fwbs_variables.dr_pf_cryostat + self.data.fwbs.r_cryostat_inboard = ( + np.max(pfcoil_variables.r_pf_coil_outer) + self.data.fwbs.dr_pf_cryostat ) # Clearance between uppermost PF coil and cryostat lid [m]. # Scaling from ITER by M. Kovari blanket_library.dz_pf_cryostat = ( build_variables.f_z_cryostat - * (2.0 * fwbs_variables.r_cryostat_inboard) + * (2.0 * self.data.fwbs.r_cryostat_inboard) / 28.440 ) # Half-height of cryostat [m] # Take height of furthest PF coil and add clearance - fwbs_variables.z_cryostat_half_inside = ( + self.data.fwbs.z_cryostat_half_inside = ( np.max(pfcoil_variables.z_pf_coil_upper) + blanket_library.dz_pf_cryostat ) # Vertical clearance between TF coil and cryostat (m) - buildings_variables.dz_tf_cryostat = fwbs_variables.z_cryostat_half_inside - ( + buildings_variables.dz_tf_cryostat = self.data.fwbs.z_cryostat_half_inside - ( build_variables.z_tf_inside_half + build_variables.dr_tf_inboard ) # Internal cryostat space volume [m^3] - fwbs_variables.vol_cryostat_internal = ( + self.data.fwbs.vol_cryostat_internal = ( np.pi - * (fwbs_variables.r_cryostat_inboard) ** 2 + * (self.data.fwbs.r_cryostat_inboard) ** 2 * 2 - * fwbs_variables.z_cryostat_half_inside + * self.data.fwbs.z_cryostat_half_inside ) # Cryostat structure volume [m^3] # Calculate by taking the volume of the outer cryostat and subtracting the volume of the inner cryostat - fwbs_variables.vol_cryostat = ( + self.data.fwbs.vol_cryostat = ( ( np.pi - * (fwbs_variables.r_cryostat_inboard + build_variables.dr_cryostat) ** 2 + * (self.data.fwbs.r_cryostat_inboard + build_variables.dr_cryostat) ** 2 ) * 2 - * (build_variables.dr_cryostat + fwbs_variables.z_cryostat_half_inside) - ) - (fwbs_variables.vol_cryostat_internal) + * (build_variables.dr_cryostat + self.data.fwbs.z_cryostat_half_inside) + ) - (self.data.fwbs.vol_cryostat_internal) # Sum of internal vacuum vessel and cryostat masses (kg) - fwbs_variables.dewmkg = ( - fwbs_variables.vol_vv + fwbs_variables.vol_cryostat - ) * fwbs_variables.den_steel + self.data.fwbs.dewmkg = ( + self.data.fwbs.vol_vv + self.data.fwbs.vol_cryostat + ) * self.data.fwbs.den_steel def output(self): """Outputs the cryostat geometry details to the output file.""" @@ -97,14 +95,14 @@ def output(self): self.outfile, "Cryostat internal radius (m)", "(r_cryostat_inboard)", - fwbs_variables.r_cryostat_inboard, + self.data.fwbs.r_cryostat_inboard, "OP ", ) po.ovarrf( self.outfile, "Cryostat internal half height (m)", "(z_cryostat_half_inside)", - fwbs_variables.z_cryostat_half_inside, + self.data.fwbs.z_cryostat_half_inside, "OP ", ) po.ovarrf( @@ -118,13 +116,13 @@ def output(self): self.outfile, "Cryostat structure volume (m^3)", "(vol_cryostat)", - fwbs_variables.vol_cryostat, + self.data.fwbs.vol_cryostat, "OP ", ) po.ovarrf( self.outfile, "Cryostat internal volume (m^3)", "(vol_cryostat_internal)", - fwbs_variables.vol_cryostat_internal, + self.data.fwbs.vol_cryostat_internal, "OP ", ) diff --git a/process/models/divertor.py b/process/models/divertor.py index f1a30ddd1..30934c749 100644 --- a/process/models/divertor.py +++ b/process/models/divertor.py @@ -8,7 +8,6 @@ from process.core.model import Model from process.data_structure import build_variables as bv from process.data_structure import divertor_variables as dv -from process.data_structure import fwbs_variables as fwbs from process.data_structure import physics_variables as pv from process.data_structure import tfcoil_variables as tfv @@ -38,15 +37,15 @@ def run(self, output: bool = False): output : indicate whether output should be written to the output file, or not """ - fwbs.p_div_nuclear_heat_total_mw = self.incident_neutron_power( + self.data.fwbs.p_div_nuclear_heat_total_mw = self.incident_neutron_power( p_plasma_neutron_mw=pv.p_plasma_neutron_mw, - f_ster_div_single=fwbs.f_ster_div_single, + f_ster_div_single=self.data.fwbs.f_ster_div_single, n_divertors=dv.n_divertors, ) - fwbs.p_div_rad_total_mw = self.incident_radiation_power( + self.data.fwbs.p_div_rad_total_mw = self.incident_radiation_power( p_plasma_rad_mw=pv.p_plasma_rad_mw, - f_ster_div_single=fwbs.f_ster_div_single, + f_ster_div_single=self.data.fwbs.f_ster_div_single, n_divertors=dv.n_divertors, ) @@ -414,13 +413,13 @@ def run(self, output: bool): dv.p_div_lower_nuclear_heat_mw = self.incident_neutron_power( p_plasma_neutron_mw=pv.p_plasma_neutron_mw, - f_ster_div_single=fwbs.f_ster_div_single, + f_ster_div_single=self.data.fwbs.f_ster_div_single, n_divertors=1, ) dv.p_div_lower_rad_mw = self.incident_radiation_power( p_plasma_rad_mw=pv.p_plasma_rad_mw, - f_ster_div_single=fwbs.f_ster_div_single, + f_ster_div_single=self.data.fwbs.f_ster_div_single, n_divertors=1, ) @@ -433,12 +432,12 @@ def run(self, output: bool): dv.p_div_upper_nuclear_heat_mw = self.incident_neutron_power( p_plasma_neutron_mw=pv.p_plasma_neutron_mw, - f_ster_div_single=fwbs.f_ster_div_single, + f_ster_div_single=self.data.fwbs.f_ster_div_single, n_divertors=1, ) dv.p_div_upper_rad_mw = self.incident_radiation_power( p_plasma_rad_mw=pv.p_plasma_rad_mw, - f_ster_div_single=fwbs.f_ster_div_single, + f_ster_div_single=self.data.fwbs.f_ster_div_single, n_divertors=1, ) diff --git a/process/models/engineering/materials.py b/process/models/engineering/materials.py index 2dfacebc4..9b14107c1 100644 --- a/process/models/engineering/materials.py +++ b/process/models/engineering/materials.py @@ -2,20 +2,18 @@ import logging -from process.data_structure import ( - fwbs_variables, -) - logger = logging.getLogger(__name__) -def eurofer97_thermal_conductivity(temp: float) -> float: +def eurofer97_thermal_conductivity(temp: float, fw_th_conductivity: float) -> float: """Calculates the thermal conductivity of the first wall material (Eurofer97). Parameters ---------- temp: Property temperature in Kelvin (K). + fw_th_conductivity: + thermal conductivity of first wall material at 293 K (W/m/K) Returns ------- @@ -40,6 +38,6 @@ def eurofer97_thermal_conductivity(temp: float) -> float: # temp in Kelvin return ( (5.4308 + 0.13565 * temp - 0.00023862 * temp**2 + 1.3393e-7 * temp**3) - * fwbs_variables.fw_th_conductivity + * fw_th_conductivity / 28.34 ) diff --git a/process/models/fw.py b/process/models/fw.py index a628bd28d..8fba30544 100644 --- a/process/models/fw.py +++ b/process/models/fw.py @@ -12,7 +12,6 @@ build_variables, constraint_variables, divertor_variables, - fwbs_variables, physics_variables, ) from process.models.blankets.blanket_library import ( @@ -45,7 +44,7 @@ def output(self): self.output_fw_pumping() def run(self): - fwbs_variables.dz_fw_half = self.calculate_first_wall_half_height( + self.data.fwbs.dz_fw_half = self.calculate_first_wall_half_height( z_plasma_xpoint_lower=build_variables.z_plasma_xpoint_lower, dz_xpoint_divertor=build_variables.dz_xpoint_divertor, dz_divertor=divertor_variables.dz_divertor, @@ -59,7 +58,7 @@ def run(self): if ( physics_variables.itart == 1 - or fwbs_variables.i_fw_blkt_vv_shape == FwBlktVVShape.D_SHAPED + or self.data.fwbs.i_fw_blkt_vv_shape == FwBlktVVShape.D_SHAPED ): ( self.data.first_wall.a_fw_inboard_full_coverage, @@ -68,7 +67,7 @@ def run(self): ) = self.calculate_dshaped_first_wall_areas( rmajor=physics_variables.rmajor, rminor=physics_variables.rminor, - dz_fw_half=fwbs_variables.dz_fw_half, + dz_fw_half=self.data.fwbs.dz_fw_half, dr_fw_plasma_gap_inboard=build_variables.dr_fw_plasma_gap_inboard, dr_fw_plasma_gap_outboard=build_variables.dr_fw_plasma_gap_outboard, ) @@ -82,7 +81,7 @@ def run(self): rmajor=physics_variables.rmajor, rminor=physics_variables.rminor, triang=physics_variables.triang, - dz_fw_half=fwbs_variables.dz_fw_half, + dz_fw_half=self.data.fwbs.dz_fw_half, dr_fw_plasma_gap_inboard=build_variables.dr_fw_plasma_gap_inboard, dr_fw_plasma_gap_outboard=build_variables.dr_fw_plasma_gap_outboard, ) @@ -93,8 +92,8 @@ def run(self): self.data.first_wall.a_fw_total, ) = self.apply_first_wall_coverage_factors( n_divertors=divertor_variables.n_divertors, - f_ster_div_single=fwbs_variables.f_ster_div_single, - f_a_fw_outboard_hcd=fwbs_variables.f_a_fw_outboard_hcd, + f_ster_div_single=self.data.fwbs.f_ster_div_single, + f_a_fw_outboard_hcd=self.data.fwbs.f_a_fw_outboard_hcd, a_fw_inboard_full_coverage=self.data.first_wall.a_fw_inboard_full_coverage, a_fw_outboard_full_coverage=self.data.first_wall.a_fw_outboard_full_coverage, ) @@ -105,16 +104,20 @@ def run(self): ) = self.calculate_total_fw_channels( self.data.first_wall.a_fw_inboard, self.data.first_wall.a_fw_outboard, - fwbs_variables.len_fw_channel, - fwbs_variables.dx_fw_module, + self.data.fwbs.len_fw_channel, + self.data.fwbs.dx_fw_module, ) self.set_fw_geometry() ( - fwbs_variables.radius_fw_channel_90_bend, - fwbs_variables.radius_fw_channel_180_bend, - ) = self.blanket_library.calculate_pipe_bend_radius(i_ps=1) + self.data.fwbs.radius_fw_channel_90_bend, + self.data.fwbs.radius_fw_channel_180_bend, + ) = self.blanket_library.calculate_pipe_bend_radius( + i_ps=1, + radius_fw_channel=self.data.fwbs.radius_fw_channel, + b_bz_liq=self.data.fwbs.b_bz_liq, + ) if physics_variables.i_pflux_fw_neutron == 1: physics_variables.pflux_fw_neutron_mw = ( @@ -336,7 +339,7 @@ def apply_first_wall_coverage_factors( def set_fw_geometry(self): build_variables.dr_fw_inboard = ( - 2 * fwbs_variables.radius_fw_channel + 2 * fwbs_variables.dr_fw_wall + 2 * self.data.fwbs.radius_fw_channel + 2 * self.data.fwbs.dr_fw_wall ) build_variables.dr_fw_outboard = build_variables.dr_fw_inboard @@ -400,16 +403,16 @@ def fw_temp( # Calculate inlet coolant fluid properties (fixed pressure) inlet_coolant_properties = FluidProperties.of( - fwbs_variables.i_fw_coolant_type, - temperature=fwbs_variables.temp_fw_coolant_in, - pressure=fwbs_variables.pres_fw_coolant, + self.data.fwbs.i_fw_coolant_type, + temperature=self.data.fwbs.temp_fw_coolant_in, + pressure=self.data.fwbs.pres_fw_coolant, ) # Calculate outlet coolant fluid properties (fixed pressure) outlet_coolant_properties = FluidProperties.of( - fwbs_variables.i_fw_coolant_type, - temperature=fwbs_variables.temp_fw_coolant_out, - pressure=fwbs_variables.pres_fw_coolant, + self.data.fwbs.i_fw_coolant_type, + temperature=self.data.fwbs.temp_fw_coolant_out, + pressure=self.data.fwbs.pres_fw_coolant, ) # Mean properties (inlet + outlet)/2 @@ -427,14 +430,14 @@ def fw_temp( # Heat load per unit length of one first wall segment (W/m) # Nuclear particle and radiation heating - load = (nuclear_heat_per_area + pflux_fw_rad) * fwbs_variables.dx_fw_module + load = (nuclear_heat_per_area + pflux_fw_rad) * self.data.fwbs.dx_fw_module # Coolant mass flow rate (kg/s) (use mean properties) mflow_fw_coolant = ( - fwbs_variables.len_fw_channel + self.data.fwbs.len_fw_channel * load / heatcap_fw_coolant_average - / (fwbs_variables.temp_fw_coolant_out - fwbs_variables.temp_fw_coolant_in) + / (self.data.fwbs.temp_fw_coolant_out - self.data.fwbs.temp_fw_coolant_in) ) # Coolant mass flux in a single channel (kg/m2/s) @@ -449,7 +452,7 @@ def fw_temp( # Mean temperature of the wall material on the plasma side of the coolant 'temp_fw_peak' # is the estimate from the previous iteration of the wall surface temperature # (underneath the armour) - temp_k = (fwbs_variables.temp_fw_coolant_out + fwbs_variables.temp_fw_peak) / 2 + temp_k = (self.data.fwbs.temp_fw_coolant_out + self.data.fwbs.temp_fw_peak) / 2 # Print debug info if temperature too low/high or NaN/Inf if np.isnan(temp_k): @@ -460,7 +463,9 @@ def fw_temp( ) # Thermal conductivity of first wall material (W/m.K) - tkfw = eurofer97_thermal_conductivity(temp=temp_k) + tkfw = eurofer97_thermal_conductivity( + temp=temp_k, fw_th_conductivity=self.data.fwbs.fw_th_conductivity + ) # Heat transfer coefficient (W m^-2 K^-1) hcoeff = gnielinski_heat_transfer_coefficient( @@ -470,7 +475,7 @@ def fw_temp( heatcap_coolant=outlet_coolant_properties.specific_heat_const_p, visc_coolant=outlet_coolant_properties.viscosity, thermcond_coolant=outlet_coolant_properties.thermal_conductivity, - roughness_channel=fwbs_variables.roughness_fw_channel, + roughness_channel=self.data.fwbs.roughness_fw_channel, ) # Temperature drops between first-wall surface and bulk coolant ! @@ -495,9 +500,9 @@ def fw_temp( # ______________ # Worst case load (as above) per unit length in 1-D calculation (W/m) - onedload = fwbs_variables.f_fw_peak * ( - pden_fw_nuclear * fwbs_variables.dx_fw_module * dr_fw / 4 - + pflux_fw_rad * fwbs_variables.dx_fw_module + onedload = self.data.fwbs.f_fw_peak * ( + pden_fw_nuclear * self.data.fwbs.dx_fw_module * dr_fw / 4 + + pflux_fw_rad * self.data.fwbs.dx_fw_module ) # Effective area for heat transfer (m2) @@ -512,17 +517,17 @@ def fw_temp( # Calculate maximum distance travelled by surface heat load (m) # dr_fw_wall | Minimum distance travelled by surface heat load (m) diagonal = np.sqrt( - (fwbs_variables.dx_fw_module / 2 - radius_fw_channel) ** 2 + (self.data.fwbs.dx_fw_module / 2 - radius_fw_channel) ** 2 + (radius_fw_channel + dr_fw) ** 2 ) # Mean distance travelled by surface heat (m) - mean_distance = (fwbs_variables.dr_fw_wall + diagonal) / 2 + mean_distance = (self.data.fwbs.dr_fw_wall + diagonal) / 2 # This heat starts off spread over width = 'dx_fw_module'. # It ends up spread over one half the circumference. # Use the mean of these values. - mean_width = (fwbs_variables.dx_fw_module + np.pi * radius_fw_channel) / 2 # (m) + mean_width = (self.data.fwbs.dx_fw_module + np.pi * radius_fw_channel) / 2 # (m) # As before, use a combined load 'onedload' # Temperature drop in first-wall material (K) @@ -532,7 +537,7 @@ def fw_temp( deltat_coolant = load / (2 * np.pi * radius_fw_channel * hcoeff) # Peak first wall temperature (K) - tpeakfw = fwbs_variables.temp_fw_coolant_out + deltat_solid + deltat_coolant + tpeakfw = self.data.fwbs.temp_fw_coolant_out + deltat_solid + deltat_coolant if output: po.oheadr( @@ -562,19 +567,19 @@ def fw_temp( self.outfile, "Ratio of peak local heat load (surface and nuclear) to mean", "(f_fw_peak)", - fwbs_variables.f_fw_peak, + self.data.fwbs.f_fw_peak, ) po.ovarre( self.outfile, "Vertical length of a single coolant channel (all in parallel) (m)", "(len_fw_channel)", - fwbs_variables.len_fw_channel, + self.data.fwbs.len_fw_channel, ) po.ovarre( self.outfile, "Width of a FW module containing a cooling channel [m]", "(dx_fw_module)", - fwbs_variables.dx_fw_module, + self.data.fwbs.dx_fw_module, ) po.ovarre( self.outfile, @@ -608,7 +613,7 @@ def fw_temp( self.outfile, "Outlet temperature of first wall coolant (K)", "(temp_fw_coolant_out)", - fwbs_variables.temp_fw_coolant_out, + self.data.fwbs.temp_fw_coolant_out, ) po.ovarre( self.outfile, "Heat transfer coefficient", "(hcoeff)", hcoeff, "OP " @@ -686,40 +691,40 @@ def output_fw_geometry(self): self.outfile, "Radius of first wall cooling channels (m)", "(radius_fw_channel)", - fwbs_variables.radius_fw_channel, + self.data.fwbs.radius_fw_channel, "OP ", ) po.ovarre( self.outfile, "Radius of 90 degree coolant channel bend (m)", "(radius_fw_channel_90_bend)", - fwbs_variables.radius_fw_channel_90_bend, + self.data.fwbs.radius_fw_channel_90_bend, ) po.ovarre( self.outfile, "Radius of 180 degree coolant channel bend (m)", "(radius_fw_channel_180_bend)", - fwbs_variables.radius_fw_channel_180_bend, + self.data.fwbs.radius_fw_channel_180_bend, ) po.ovarrf( self.outfile, "Radial wall thickness surrounding first wall coolant channel (m)", "(dr_fw_wall)", - fwbs_variables.dr_fw_wall, + self.data.fwbs.dr_fw_wall, "OP ", ) po.ovarrf( self.outfile, "Toroidal width of each first wall module (m)", "(dx_fw_module)", - fwbs_variables.dx_fw_module, + self.data.fwbs.dx_fw_module, "OP ", ) po.ovarrf( self.outfile, "Length of each first wall channel (m)", "(len_fw_channel)", - fwbs_variables.len_fw_channel, + self.data.fwbs.len_fw_channel, "OP ", ) po.ovarrf( @@ -759,34 +764,34 @@ def output_fw_pumping(self): self.outfile, "First wall coolant type", "(i_fw_coolant_type)", - f"'{fwbs_variables.i_fw_coolant_type}'", + f"'{self.data.fwbs.i_fw_coolant_type}'", ) po.ovarrf( self.outfile, "Outlet temperature of first wall coolant [K]", "(temp_fw_coolant_out)", - fwbs_variables.temp_fw_coolant_out, + self.data.fwbs.temp_fw_coolant_out, "OP ", ) po.ovarrf( self.outfile, "Inlet temperature of first wall coolant [K]", "(temp_fw_coolant_in)", - fwbs_variables.temp_fw_coolant_in, + self.data.fwbs.temp_fw_coolant_in, "OP ", ) po.ovarrf( self.outfile, "Pressure of first wall coolant [Pa]", "(pres_fw_coolant)", - fwbs_variables.pres_fw_coolant, + self.data.fwbs.pres_fw_coolant, "OP ", ) po.ovarrf( self.outfile, "Peak temperature of first wall [K]", "(temp_fw_peak)", - fwbs_variables.temp_fw_peak, + self.data.fwbs.temp_fw_peak, "OP ", ) diff --git a/process/models/ife.py b/process/models/ife.py index 5e0e66b6c..cd00d143e 100644 --- a/process/models/ife.py +++ b/process/models/ife.py @@ -12,7 +12,6 @@ from process.core.model import Model from process.data_structure import ( buildings_variables, - fwbs_variables, heat_transport_variables, ife_variables, physics_variables, @@ -883,14 +882,14 @@ def bld2019(self): li_frac = 1.0 - 0.5 * sang # TBR - fwbs_variables.tbr = ( + self.data.fwbs.tbr = ( 3.7418 * (1.0 / (1.0 + np.exp(-2.6366 * ife_variables.bldrc)) - 0.5) * li_frac ) # Energy Multiplication - fwbs_variables.f_p_blkt_multiplication = ( + self.data.fwbs.f_p_blkt_multiplication = ( 2.2414 * (1.0 / (1.0 + np.exp(-3.0038 * ife_variables.bldrc)) - 0.5) * li_frac @@ -1696,7 +1695,7 @@ def ifefbs(self, output: bool = False): matden = [ 0.0, - fwbs_variables.den_steel, + self.data.fwbs.den_steel, 2300.0, 2020.0, 2010.0, @@ -1719,26 +1718,26 @@ def ifefbs(self, output: bool = False): ife_variables.v3matm[j, i] = ife_variables.v3matv[j, i] * den # Total masses of components (excluding coolant) - fwbs_variables.m_fw_total = 0.0 - fwbs_variables.m_blkt_total = 0.0 - fwbs_variables.whtshld = 0.0 + self.data.fwbs.m_fw_total = 0.0 + self.data.fwbs.m_blkt_total = 0.0 + self.data.fwbs.whtshld = 0.0 for i in range(5): for j in range(3): - fwbs_variables.m_fw_total += ife_variables.fwmatm[j, i] - fwbs_variables.m_blkt_total += ife_variables.blmatm[j, i] - fwbs_variables.whtshld += ife_variables.shmatm[j, i] + 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] # Other masses - fwbs_variables.m_blkt_beryllium = 0.0 - fwbs_variables.m_blkt_vanadium = 0.0 - fwbs_variables.m_blkt_steel_total = 0.0 - fwbs_variables.m_blkt_li2o = 0.0 - fwbs_variables.m_blkt_lithium = 0.0 + self.data.fwbs.m_blkt_beryllium = 0.0 + self.data.fwbs.m_blkt_vanadium = 0.0 + self.data.fwbs.m_blkt_steel_total = 0.0 + self.data.fwbs.m_blkt_li2o = 0.0 + self.data.fwbs.m_blkt_lithium = 0.0 for j in range(3): - fwbs_variables.m_blkt_steel_total += ife_variables.blmatm[j, 1] - fwbs_variables.m_blkt_li2o += ife_variables.blmatm[j, 4] - fwbs_variables.m_blkt_lithium += ife_variables.blmatm[j, 8] + 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] # Total mass of FLiBe ife_variables.mflibe = ife_variables.chmatm[3] @@ -1761,8 +1760,8 @@ def ifefbs(self, output: bool = False): # Following assumes that use of FLiBe and Li2O are # mutually exclusive ife_variables.mflibe /= 1.0 - ife_variables.fbreed - fwbs_variables.m_blkt_li2o /= 1.0 - ife_variables.fbreed - fwbs_variables.m_blkt_lithium /= 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 # Blanket and first wall lifetimes (HYLIFE-II: = plant life) if ife_variables.ifetyp in {3, 4}: @@ -1777,8 +1776,8 @@ def ifefbs(self, output: bool = False): ), ) - fwbs_variables.life_blkt_fpy = life - fwbs_variables.life_fw_fpy = life + self.data.fwbs.life_blkt_fpy = life + self.data.fwbs.life_fw_fpy = life if not output: return @@ -1794,19 +1793,19 @@ def ifefbs(self, output: bool = False): self.outfile, "First wall mass (kg)", "(m_fw_total)", - fwbs_variables.m_fw_total, + self.data.fwbs.m_fw_total, ) process_output.ovarre( self.outfile, "Blanket mass (kg)", "(m_blkt_total)", - fwbs_variables.m_blkt_total, + self.data.fwbs.m_blkt_total, ) process_output.ovarre( self.outfile, "Blanket lithium mass (kg)", "(m_blkt_lithium)", - fwbs_variables.m_blkt_lithium, + self.data.fwbs.m_blkt_lithium, ) process_output.ovarre( self.outfile, @@ -1815,7 +1814,7 @@ def ifefbs(self, output: bool = False): ife_variables.mflibe, ) process_output.ovarre( - self.outfile, "Shield mass (kg)", "(whtshld)", fwbs_variables.whtshld + self.outfile, "Shield mass (kg)", "(whtshld)", self.data.fwbs.whtshld ) def ifepw1(self): @@ -1834,13 +1833,13 @@ def ifepw1(self): # Total thermal power removed from fusion core heat_transport_variables.priheat = ( - fwbs_variables.f_p_blkt_multiplication * physics_variables.p_fusion_total_mw + self.data.fwbs.f_p_blkt_multiplication * physics_variables.p_fusion_total_mw ) # Useful (high-grade) thermal power (MW) heat_transport_variables.p_plant_primary_heat_mw = ( - heat_transport_variables.priheat * (1.0 - fwbs_variables.fhole) + heat_transport_variables.priheat * (1.0 - self.data.fwbs.fhole) ) # Assume 0.24 of thermal power is intercepted by the first wall @@ -1853,21 +1852,21 @@ def ifepw1(self): heat_transport_variables.p_fw_div_heat_deposited_mw = ( 0.24 * heat_transport_variables.p_plant_primary_heat_mw ) - fwbs_variables.p_blkt_nuclear_heat_total_mw = ( + self.data.fwbs.p_blkt_nuclear_heat_total_mw = ( heat_transport_variables.p_plant_primary_heat_mw - heat_transport_variables.p_fw_div_heat_deposited_mw ) else: heat_transport_variables.p_fw_div_heat_deposited_mw = 0.0 - fwbs_variables.p_blkt_nuclear_heat_total_mw = ( + self.data.fwbs.p_blkt_nuclear_heat_total_mw = ( heat_transport_variables.p_plant_primary_heat_mw ) - fwbs_variables.p_shld_nuclear_heat_mw = 0.0 + self.data.fwbs.p_shld_nuclear_heat_mw = 0.0 # Lost fusion power (MW) - fwbs_variables.pnucloss = ( + self.data.fwbs.pnucloss = ( heat_transport_variables.priheat - heat_transport_variables.p_plant_primary_heat_mw ) # = priheat*fhole @@ -1925,7 +1924,7 @@ def ifepw2(self, output: bool = False): # Total secondary heat heat_transport_variables.p_plant_secondary_heat_mw = ( heat_transport_variables.p_hcd_electric_loss_mw - + fwbs_variables.pnucloss + + self.data.fwbs.pnucloss + heat_transport_variables.fachtmw + heat_transport_variables.vachtmw + heat_transport_variables.p_tritium_plant_electric_mw @@ -1973,17 +1972,17 @@ def ifepw2(self, output: bool = False): self.outfile, "Fusion power escaping via holes (MW)", "(pnucloss)", - fwbs_variables.pnucloss, + self.data.fwbs.pnucloss, ) process_output.ovarre( self.outfile, "Power multiplication factor", "(f_p_blkt_multiplication)", - fwbs_variables.f_p_blkt_multiplication, + self.data.fwbs.f_p_blkt_multiplication, ) if ife_variables.ifetyp == 4: process_output.ovarre( - self.outfile, "Tritium Breeding Ratio", "(tbr)", fwbs_variables.tbr + self.outfile, "Tritium Breeding Ratio", "(tbr)", self.data.fwbs.tbr ) process_output.ovarre( self.outfile, @@ -2008,7 +2007,7 @@ def ifepw2(self, output: bool = False): self.outfile, "Blanket nuclear heating (MW)", "(p_blkt_nuclear_heat_total_mw)", - fwbs_variables.p_blkt_nuclear_heat_total_mw, + self.data.fwbs.p_blkt_nuclear_heat_total_mw, ) process_output.ovarre( self.outfile, @@ -2303,7 +2302,7 @@ def ifebdg(self, output: bool = False): if buildings_variables.wgt2 > 1.0: wgts = buildings_variables.wgt2 else: - wgts = fwbs_variables.whtshld + wgts = self.data.fwbs.whtshld cran = 9.41e-6 * wgts + 5.1 rmbh = ( diff --git a/process/models/pfcoil.py b/process/models/pfcoil.py index b1748b96a..d27022fab 100644 --- a/process/models/pfcoil.py +++ b/process/models/pfcoil.py @@ -13,7 +13,6 @@ from process.core.model import Model from process.data_structure import build_variables as bv from process.data_structure import constraint_variables as ctv -from process.data_structure import fwbs_variables as fwbsv from process.data_structure import ( pfcoil_variables, superconducting_tf_coil_variables, @@ -959,7 +958,7 @@ def pfcoil(self): * 2.0e0 * np.pi * pfcoil_variables.r_pf_coil_middle[i] - * fwbsv.den_steel + * self.data.fwbs.den_steel ) # Mass of heaviest PF coil (tonnes) @@ -3381,7 +3380,7 @@ def ohcalc(self): * 2.0e0 * np.pi * pfcoil_variables.r_pf_coil_middle[pfcoil_variables.n_cs_pf_coils - 1] - * fwbsv.den_steel + * self.data.fwbs.den_steel ) # Non-steel cross-sectional area diff --git a/process/models/power.py b/process/models/power.py index b6069d0b7..92676b7b3 100644 --- a/process/models/power.py +++ b/process/models/power.py @@ -13,7 +13,6 @@ build_variables, buildings_variables, current_drive_variables, - fwbs_variables, heat_transport_variables, numerics, pf_power_variables, @@ -779,7 +778,7 @@ def component_thermal_powers(self): and plant power balance constituents. None """ - i_p_coolant_pumping = PumpingPowerModelTypes(fwbs_variables.i_p_coolant_pumping) + i_p_coolant_pumping = PumpingPowerModelTypes(self.data.fwbs.i_p_coolant_pumping) if i_p_coolant_pumping not in { PumpingPowerModelTypes.MECHANICAL, PumpingPowerModelTypes.MECHANICAL_WITH_PRESSURE_DROP, @@ -795,21 +794,21 @@ def component_thermal_powers(self): power_variables.p_fw_blkt_coolant_pump_elec_mw = ( primary_pumping_variables.p_fw_blkt_coolant_pump_mw - / fwbs_variables.eta_coolant_pump_electric + / self.data.fwbs.eta_coolant_pump_electric ) power_variables.p_shld_coolant_pump_elec_mw = ( heat_transport_variables.p_shld_coolant_pump_mw - / fwbs_variables.eta_coolant_pump_electric + / self.data.fwbs.eta_coolant_pump_electric ) power_variables.p_div_coolant_pump_elec_mw = ( heat_transport_variables.p_div_coolant_pump_mw - / fwbs_variables.eta_coolant_pump_electric + / self.data.fwbs.eta_coolant_pump_electric ) # Secondary breeder coolant loop. Should return zero if not used. power_variables.p_blkt_breeder_pump_elec_mw = ( heat_transport_variables.p_blkt_breeder_pump_mw - / fwbs_variables.eta_coolant_pump_electric + / self.data.fwbs.eta_coolant_pump_electric ) # Total mechanical pump power needed (deposited in coolant) @@ -842,24 +841,24 @@ def component_thermal_powers(self): # Liquid metal breeder/coolant # Calculate fraction of blanket nuclear power deposited in liquid breeder / coolant - if fwbs_variables.i_blkt_dual_coolant == 2: + if self.data.fwbs.i_blkt_dual_coolant == 2: power_variables.p_blkt_liquid_breeder_heat_deposited_mw = ( - fwbs_variables.p_blkt_nuclear_heat_total_mw - * fwbs_variables.f_nuc_pow_bz_liq + self.data.fwbs.p_blkt_nuclear_heat_total_mw + * self.data.fwbs.f_nuc_pow_bz_liq ) + heat_transport_variables.p_blkt_breeder_pump_mw # Liquid breeder is circulated but does no cooling - elif fwbs_variables.i_blkt_dual_coolant == 1: + elif self.data.fwbs.i_blkt_dual_coolant == 1: power_variables.p_blkt_liquid_breeder_heat_deposited_mw = ( heat_transport_variables.p_blkt_breeder_pump_mw ) # Liquid breeder also acts a coolant - if int(fwbs_variables.i_blkt_dual_coolant) in {1, 2}: + if int(self.data.fwbs.i_blkt_dual_coolant) in {1, 2}: power_variables.p_fw_blkt_heat_deposited_mw = ( - fwbs_variables.p_fw_nuclear_heat_total_mw - + fwbs_variables.p_fw_rad_total_mw - + fwbs_variables.p_blkt_nuclear_heat_total_mw + self.data.fwbs.p_fw_nuclear_heat_total_mw + + self.data.fwbs.p_fw_rad_total_mw + + self.data.fwbs.p_blkt_nuclear_heat_total_mw + heat_transport_variables.p_blkt_breeder_pump_mw + primary_pumping_variables.p_fw_blkt_coolant_pump_mw + current_drive_variables.p_beam_orbit_loss_mw @@ -869,9 +868,9 @@ def component_thermal_powers(self): else: # No secondary liquid metal breeder/coolant power_variables.p_fw_blkt_heat_deposited_mw = ( - fwbs_variables.p_fw_nuclear_heat_total_mw - + fwbs_variables.p_fw_rad_total_mw - + fwbs_variables.p_blkt_nuclear_heat_total_mw + self.data.fwbs.p_fw_nuclear_heat_total_mw + + self.data.fwbs.p_fw_rad_total_mw + + self.data.fwbs.p_blkt_nuclear_heat_total_mw + primary_pumping_variables.p_fw_blkt_coolant_pump_mw + current_drive_variables.p_beam_orbit_loss_mw + physics_variables.p_fw_alpha_mw @@ -880,8 +879,8 @@ def component_thermal_powers(self): # Total power deposited in first wall coolant (MW) power_variables.p_fw_heat_deposited_mw = ( - fwbs_variables.p_fw_nuclear_heat_total_mw - + fwbs_variables.p_fw_rad_total_mw + self.data.fwbs.p_fw_nuclear_heat_total_mw + + self.data.fwbs.p_fw_rad_total_mw + heat_transport_variables.p_fw_coolant_pump_mw + current_drive_variables.p_beam_orbit_loss_mw + physics_variables.p_fw_alpha_mw @@ -890,14 +889,14 @@ def component_thermal_powers(self): # Total power deposited in blanket coolant (MW) power_variables.p_blkt_heat_deposited_mw = ( - fwbs_variables.p_blkt_nuclear_heat_total_mw + self.data.fwbs.p_blkt_nuclear_heat_total_mw + heat_transport_variables.p_blkt_coolant_pump_mw ) # Total power deposited in shield coolant (MW) power_variables.p_shld_heat_deposited_mw = ( - fwbs_variables.p_cp_shield_nuclear_heat_mw - + fwbs_variables.p_shld_nuclear_heat_mw + self.data.fwbs.p_cp_shield_nuclear_heat_mw + + self.data.fwbs.p_shld_nuclear_heat_mw + heat_transport_variables.p_shld_coolant_pump_mw ) @@ -905,14 +904,14 @@ def component_thermal_powers(self): power_variables.p_div_heat_deposited_mw = ( physics_variables.p_plasma_separatrix_mw + ( - fwbs_variables.p_div_nuclear_heat_total_mw - + fwbs_variables.p_div_rad_total_mw + self.data.fwbs.p_div_nuclear_heat_total_mw + + self.data.fwbs.p_div_rad_total_mw ) + heat_transport_variables.p_div_coolant_pump_mw ) # Heat removal from first wall and divertor (MW) (only used in costs.f90) - i_p_coolant_pumping = PumpingPowerModelTypes(fwbs_variables.i_p_coolant_pumping) + i_p_coolant_pumping = PumpingPowerModelTypes(self.data.fwbs.i_p_coolant_pumping) if i_p_coolant_pumping != PumpingPowerModelTypes.MECHANICAL_WITH_PRESSURE_DROP: heat_transport_variables.p_fw_div_heat_deposited_mw = ( power_variables.p_fw_heat_deposited_mw @@ -930,7 +929,7 @@ def component_thermal_powers(self): # Primary (high-grade) thermal power, available for electricity generation. Switch heat_transport_variables.i_shld_primary_heat # is 1 or 0, is user choice on whether the shield thermal power goes to primary or secondary heat i_thermal_electric_conversion = ElectricConversionModelTypes( - fwbs_variables.i_thermal_electric_conversion + self.data.fwbs.i_thermal_electric_conversion ) if i_thermal_electric_conversion == ElectricConversionModelTypes.CCFE_HCPB_VALUE: # Primary thermal power (MW) @@ -981,8 +980,8 @@ def component_thermal_powers(self): # Secondary thermal power lost to HCD apparatus and diagnostics heat_transport_variables.p_hcd_secondary_heat_mw = ( - fwbs_variables.p_fw_hcd_nuclear_heat_mw - + fwbs_variables.p_fw_hcd_rad_total_mw + self.data.fwbs.p_fw_hcd_nuclear_heat_mw + + self.data.fwbs.p_fw_hcd_rad_total_mw ) # Number of primary heat exchangers @@ -1013,7 +1012,7 @@ def calculate_cryo_loads(self): tfcoil_variables.i_tf_sup, tfcoil_variables.tfcryoarea, structure_variables.coldmass, - fwbs_variables.p_tf_nuclear_heat_mw, + self.data.fwbs.p_tf_nuclear_heat_mw, pf_power_variables.ensxpfm, times_variables.t_plant_pulse_plasma_present, tfcoil_variables.c_tf_turn, @@ -1042,7 +1041,7 @@ def calculate_cryo_loads(self): tfcoil_variables.p_cp_resistive + tfcoil_variables.p_tf_leg_resistive + tfcoil_variables.p_tf_joints_resistive - + fwbs_variables.pnuc_cp_tf * 1.0e6 + + self.data.fwbs.pnuc_cp_tf * 1.0e6 ) # Calculate electric power requirement for cryogenic plant at tfcoil_variables.temp_cp_coolant_inlet (MW) @@ -1075,13 +1074,13 @@ def output_plant_thermal_powers(self): self.outfile, "Neutronic nuclear heat deposited in FW [MW]", "(p_fw_nuclear_heat_total_mw)", - fwbs_variables.p_fw_nuclear_heat_total_mw, + self.data.fwbs.p_fw_nuclear_heat_total_mw, ) po.ovarre( self.outfile, "Radiation heat deposited in FW [MW]", "(p_fw_rad_total_mw)", - fwbs_variables.p_fw_rad_total_mw, + self.data.fwbs.p_fw_rad_total_mw, ) po.ovarre( self.outfile, @@ -1123,19 +1122,19 @@ def output_plant_thermal_powers(self): self.outfile, "Total neutronic nuclear heat deposited and created in Blanket(s) [MW]", "(p_blkt_nuclear_heat_total_mw)", - fwbs_variables.p_blkt_nuclear_heat_total_mw, + self.data.fwbs.p_blkt_nuclear_heat_total_mw, ) po.ovarre( self.outfile, "Total multiplication neutronic nuclear heat created in Blanket(s) [MW]", "(p_blkt_multiplication_mw)", - fwbs_variables.p_blkt_multiplication_mw, + self.data.fwbs.p_blkt_multiplication_mw, ) po.ovarre( self.outfile, "Neutron nuclear heat multiplication factor in Blanket(s)", "(f_p_blkt_multiplication)", - fwbs_variables.f_p_blkt_multiplication, + self.data.fwbs.f_p_blkt_multiplication, ) po.ovarre( @@ -1179,13 +1178,13 @@ def output_plant_thermal_powers(self): self.outfile, "Neutronic nuclear heat deposited in VV shield [MW]", "(p_shld_nuclear_heat_mw)", - fwbs_variables.p_shld_nuclear_heat_mw, + self.data.fwbs.p_shld_nuclear_heat_mw, ) po.ovarre( self.outfile, "Neutronic nuclear heat deposited in ST centrepost shield [MW]", "(p_cp_shield_nuclear_heat_mw)", - fwbs_variables.p_cp_shield_nuclear_heat_mw, + self.data.fwbs.p_cp_shield_nuclear_heat_mw, ) po.ovarre( @@ -1218,13 +1217,13 @@ def output_plant_thermal_powers(self): self.outfile, "Neutronic nuclear heat deposited in divertor [MW]", "(p_div_nuclear_heat_total_mw)", - fwbs_variables.p_div_nuclear_heat_total_mw, + self.data.fwbs.p_div_nuclear_heat_total_mw, ) po.ovarre( self.outfile, "Radiation heat deposited in divertor [MW]", "(p_div_rad_total_mw)", - fwbs_variables.p_div_rad_total_mw, + self.data.fwbs.p_div_rad_total_mw, ) po.ovarre( @@ -1293,20 +1292,20 @@ def output_plant_thermal_powers(self): self.outfile, "Neutronic nuclear heating in TF coils [MW]", "(p_tf_nuclear_heat_mw)", - fwbs_variables.p_tf_nuclear_heat_mw, + self.data.fwbs.p_tf_nuclear_heat_mw, ) po.oblnkl(self.outfile) po.ovarre( self.outfile, "Neutronic nuclear heating in H&CD systems and diagnostics [MW]", "(p_fw_hcd_nuclear_heat_mw)", - fwbs_variables.p_fw_hcd_nuclear_heat_mw, + self.data.fwbs.p_fw_hcd_nuclear_heat_mw, ) po.ovarre( self.outfile, "Radiation heat deposited in H&CD systems and diagnostics [MW]", "(p_fw_hcd_rad_total_mw)", - fwbs_variables.p_fw_hcd_rad_total_mw, + self.data.fwbs.p_fw_hcd_rad_total_mw, ) po.ovarre( self.outfile, @@ -1520,7 +1519,7 @@ def output_plant_electric_powers(self): self.outfile, "Electric wall plug efficiency of coolant pumps", "(eta_coolant_pump_electric)", - fwbs_variables.eta_coolant_pump_electric, + self.data.fwbs.eta_coolant_pump_electric, ) po.ovarre( self.outfile, @@ -1618,8 +1617,6 @@ def plant_electric_production(self): # Total secondary heat # (total low-grade heat rejected - does not contribute to power conversion cycle) - # Included fwbs_variables.p_tf_nuclear_heat_mw - # p_plant_secondary_heat_mw = power_variables.p_plant_core_systems_elec_mw + heat_transport_variables.p_hcd_electric_loss_mw + heat_transport_variables.p_coolant_pump_loss_total_mw + hthermmw + heat_transport_variables.p_div_secondary_heat_mw + heat_transport_variables.p_shld_secondary_heat_mw + heat_transport_variables.p_hcd_secondary_heat_mw + fwbs_variables.p_tf_nuclear_heat_mw heat_transport_variables.p_plant_secondary_heat_mw = ( power_variables.p_plant_core_systems_elec_mw + heat_transport_variables.p_hcd_electric_loss_mw @@ -1627,18 +1624,17 @@ def plant_electric_production(self): + heat_transport_variables.p_div_secondary_heat_mw + heat_transport_variables.p_shld_secondary_heat_mw + heat_transport_variables.p_hcd_secondary_heat_mw - + fwbs_variables.p_tf_nuclear_heat_mw + + self.data.fwbs.p_tf_nuclear_heat_mw ) # Calculate powers relevant to a power-producing plant if self.data.costs.ireactor == 1: # Gross electric power - # p_plant_electric_gross_mw = (heat_transport_variables.p_plant_primary_heat_mw-hthermmw) * heat_transport_variables.eta_turbine i_p_coolant_pumping = PumpingPowerModelTypes( - fwbs_variables.i_p_coolant_pumping + self.data.fwbs.i_p_coolant_pumping ) if ( - fwbs_variables.i_blkt_dual_coolant > 0 + self.data.fwbs.i_blkt_dual_coolant > 0 and i_p_coolant_pumping == PumpingPowerModelTypes.MECHANICAL ): heat_transport_variables.p_plant_electric_gross_mw = ( @@ -1767,9 +1763,9 @@ def cryo( power_variables.qss += 2.0e0 * tfcryoarea # Nuclear heating of TF coils (W) (zero if resistive) - if fwbs_variables.inuclear == 0 and i_tf_sup == 1: - fwbs_variables.qnuc = 1.0e6 * p_tf_nuclear_heat_mw - # Issue #511: if fwbs_variables.inuclear = 1 : fwbs_variables.qnuc is input. + if self.data.fwbs.inuclear == 0 and i_tf_sup == 1: + self.data.fwbs.qnuc = 1.0e6 * p_tf_nuclear_heat_mw + # Issue #511: if self.data.fwbs.inuclear = 1 : self.data.fwbs.qnuc is input. # AC losses power_variables.qac = 1.0e3 * ensxpfm / t_plant_pulse_plasma_present @@ -1783,7 +1779,7 @@ def cryo( # 45% extra miscellaneous, piping and reserves power_variables.qmisc = 0.45e0 * ( power_variables.qss - + fwbs_variables.qnuc + + self.data.fwbs.qnuc + power_variables.qac + power_variables.qcl ) @@ -1791,7 +1787,7 @@ def cryo( 0.0e0, power_variables.qmisc + power_variables.qss - + fwbs_variables.qnuc + + self.data.fwbs.qnuc + power_variables.qac + power_variables.qcl, ) @@ -1817,10 +1813,10 @@ def output_cryogenics(self): self.outfile, "Nuclear heating of cryogenic components (MW)", "(qnuc/1.0d6)", - fwbs_variables.qnuc / 1.0e6, + self.data.fwbs.qnuc / 1.0e6, "OP ", ) - if fwbs_variables.inuclear == 1: + if self.data.fwbs.inuclear == 1: po.ocmmnt( self.outfile, "Nuclear heating of cryogenic components is a user input." ) @@ -1897,11 +1893,11 @@ def plant_thermal_efficiency(self, eta_turbine): """ i_thermal_electric_conversion = ElectricConversionModelTypes( - fwbs_variables.i_thermal_electric_conversion + self.data.fwbs.i_thermal_electric_conversion ) if i_thermal_electric_conversion == ElectricConversionModelTypes.CCFE_HCPB_VALUE: # CCFE HCPB Model - if fwbs_variables.i_blanket_type == 1: + if self.data.fwbs.i_blanket_type == 1: # HCPB, efficiency taken from M. Kovari 2016 # "PROCESS": A systems code for fusion power plants - Part 2: Engineering # https://www.sciencedirect.com/science/article/pii/S0920379616300072 @@ -1916,7 +1912,7 @@ def plant_thermal_efficiency(self, eta_turbine): == ElectricConversionModelTypes.CCFE_HCPB_VALUE_WITH_DIVERTOR ): # CCFE HCPB Model - if fwbs_variables.i_blanket_type == 1: + if self.data.fwbs.i_blanket_type == 1: # HCPB, efficiency taken from M. Kovari 2016 # "PROCESS": A systems code for fusion power plants - Part 2: Engineering # https://www.sciencedirect.com/science/article/pii/S0920379616300072 @@ -1936,7 +1932,7 @@ def plant_thermal_efficiency(self, eta_turbine): == ElectricConversionModelTypes.STEAM_RANKINE_CYCLE ): # CCFE HCPB Model - if fwbs_variables.i_blanket_type == 1: + if self.data.fwbs.i_blanket_type == 1: # If coolant is helium, the steam cycle is assumed to be superheated # and a different correlation is used. The turbine inlet temperature # is assumed to be 20 degrees below the primary coolant outlet @@ -1948,7 +1944,7 @@ def plant_thermal_efficiency(self, eta_turbine): # Superheated steam Rankine cycle correlation (C. Harrington) # Range of validity: 657 K < heat_transport_variables.temp_turbine_coolant_in < 915 K heat_transport_variables.temp_turbine_coolant_in = ( - fwbs_variables.temp_blkt_coolant_out - 20.0e0 + self.data.fwbs.temp_blkt_coolant_out - 20.0e0 ) if (heat_transport_variables.temp_turbine_coolant_in < 657.0e0) or ( heat_transport_variables.temp_turbine_coolant_in > 915.0e0 @@ -1982,7 +1978,7 @@ def plant_thermal_efficiency(self, eta_turbine): # Supercritical CO2 cycle correlation (C. Harrington) # Range of validity: 408 K < heat_transport_variables.temp_turbine_coolant_in < 1023 K heat_transport_variables.temp_turbine_coolant_in = ( - fwbs_variables.temp_blkt_coolant_out - 20.0e0 + self.data.fwbs.temp_blkt_coolant_out - 20.0e0 ) if (heat_transport_variables.temp_turbine_coolant_in < 408.0e0) or ( heat_transport_variables.temp_turbine_coolant_in > 1023.0e0 @@ -2012,16 +2008,16 @@ def plant_thermal_efficiency_2(self, etath_liq): etath_liq : """ - if fwbs_variables.secondary_cycle_liq == 2: + if self.data.fwbs.secondary_cycle_liq == 2: # User input used, eta_turbine not changed return etath_liq - if fwbs_variables.secondary_cycle_liq == 4: + if self.data.fwbs.secondary_cycle_liq == 4: # Supercritical CO2 cycle to be used # Supercritical CO2 cycle correlation (C. Harrington) # Range of validity: 408 K < heat_transport_variables.temp_turbine_coolant_in < 1023 K heat_transport_variables.temp_turbine_coolant_in = ( - fwbs_variables.outlet_temp_liq - 20.0e0 + self.data.fwbs.outlet_temp_liq - 20.0e0 ) if (heat_transport_variables.temp_turbine_coolant_in < 408.0e0) or ( heat_transport_variables.temp_turbine_coolant_in > 1023.0e0 @@ -2037,7 +2033,7 @@ def plant_thermal_efficiency_2(self, etath_liq): ) raise ProcessValueError( - f"secondary_cycle_liq ={fwbs_variables.secondary_cycle_liq} is an invalid option." + f"secondary_cycle_liq ={self.data.fwbs.secondary_cycle_liq} is an invalid option." ) def tfpwr(self, output: bool): diff --git a/process/models/shield.py b/process/models/shield.py index d3a2f48ae..e18d7c8a7 100644 --- a/process/models/shield.py +++ b/process/models/shield.py @@ -7,7 +7,6 @@ blanket_library, build_variables, divertor_variables, - fwbs_variables, physics_variables, ) from process.models.blankets.blanket_library import ( @@ -44,7 +43,7 @@ def run(self): # D-shaped blanket and shield if ( physics_variables.itart == 1 - or fwbs_variables.i_fw_blkt_vv_shape == FwBlktVVShape.D_SHAPED + or self.data.fwbs.i_fw_blkt_vv_shape == FwBlktVVShape.D_SHAPED ): ( build_variables.a_shld_inboard_surface, @@ -66,7 +65,7 @@ def run(self): ( blanket_library.vol_shld_inboard, blanket_library.vol_shld_outboard, - fwbs_variables.vol_shld_total, + self.data.fwbs.vol_shld_total, ) = self.calculate_dshaped_shield_volumes( r_shld_inboard_inner=build_variables.r_shld_inboard_inner, dr_shld_inboard=build_variables.dr_shld_inboard, @@ -101,7 +100,7 @@ def run(self): ( blanket_library.vol_shld_inboard, blanket_library.vol_shld_outboard, - fwbs_variables.vol_shld_total, + self.data.fwbs.vol_shld_total, ) = self.calculate_elliptical_shield_volumes( r_shld_inboard_inner=build_variables.r_shld_inboard_inner, r_shld_outboard_outer=build_variables.r_shld_outboard_outer, @@ -116,10 +115,10 @@ def run(self): # Apply shield coverage factors build_variables.a_shld_inboard_surface = ( - fwbs_variables.fvolsi * build_variables.a_shld_inboard_surface + self.data.fwbs.fvolsi * build_variables.a_shld_inboard_surface ) build_variables.a_shld_outboard_surface = ( - fwbs_variables.fvolso * build_variables.a_shld_outboard_surface + self.data.fwbs.fvolso * build_variables.a_shld_outboard_surface ) build_variables.a_shld_total_surface = ( build_variables.a_shld_inboard_surface @@ -127,12 +126,12 @@ def run(self): ) blanket_library.vol_shld_inboard = ( - fwbs_variables.fvolsi * blanket_library.vol_shld_inboard + self.data.fwbs.fvolsi * blanket_library.vol_shld_inboard ) blanket_library.vol_shld_outboard = ( - fwbs_variables.fvolso * blanket_library.vol_shld_outboard + self.data.fwbs.fvolso * blanket_library.vol_shld_outboard ) - fwbs_variables.vol_shld_total = ( + self.data.fwbs.vol_shld_total = ( blanket_library.vol_shld_inboard + blanket_library.vol_shld_outboard ) @@ -474,6 +473,6 @@ def output_shld_areas_and_volumes(self): self.outfile, "Total volume of shield (m^3)", "(vol_shld_total)", - fwbs_variables.vol_shld_total, + self.data.fwbs.vol_shld_total, "OP ", ) diff --git a/process/models/stellarator/build.py b/process/models/stellarator/build.py index 097a3697d..bc34aa579 100644 --- a/process/models/stellarator/build.py +++ b/process/models/stellarator/build.py @@ -2,7 +2,6 @@ from process.core.model import DataStructure from process.data_structure import ( build_variables, - fwbs_variables, heat_transport_variables, physics_variables, stellarator_configuration, @@ -30,7 +29,7 @@ def st_build(stellarator, f_output: bool, data: DataStructure): data structure object to provide model data """ - if fwbs_variables.blktmodel > 0: + if data.fwbs.blktmodel > 0: build_variables.dr_blkt_inboard = ( build_variables.blbuith + build_variables.blbmith + build_variables.blbpith ) @@ -49,7 +48,7 @@ def st_build(stellarator, f_output: bool, data: DataStructure): # First Wall build_variables.dr_fw_inboard = ( - 2.0e0 * fwbs_variables.radius_fw_channel + 2.0e0 * fwbs_variables.dr_fw_wall + 2.0e0 * data.fwbs.radius_fw_channel + 2.0e0 * data.fwbs.dr_fw_wall ) build_variables.dr_fw_outboard = build_variables.dr_fw_inboard @@ -176,14 +175,14 @@ def st_build(stellarator, f_output: bool, data: DataStructure): if heat_transport_variables.ipowerflow == 0: data.first_wall.a_fw_total = ( - 1.0e0 - fwbs_variables.fhole + 1.0e0 - data.fwbs.fhole ) * data.first_wall.a_fw_total else: data.first_wall.a_fw_total = ( 1.0e0 - - fwbs_variables.fhole - - fwbs_variables.f_ster_div_single - - fwbs_variables.f_a_fw_outboard_hcd + - data.fwbs.fhole + - data.fwbs.f_ster_div_single + - data.fwbs.f_a_fw_outboard_hcd ) * data.first_wall.a_fw_total if f_output: diff --git a/process/models/stellarator/coils/calculate.py b/process/models/stellarator/coils/calculate.py index 42eced11f..5bc9e733d 100644 --- a/process/models/stellarator/coils/calculate.py +++ b/process/models/stellarator/coils/calculate.py @@ -2,6 +2,7 @@ import numpy as np +from process.core.model import DataStructure from process.data_structure import ( build_variables, constraint_variables, @@ -23,7 +24,7 @@ logger = logging.getLogger(__name__) -def st_coil(stellarator, output: bool): +def st_coil(stellarator, output: bool, data: DataStructure): """This routine calculates the properties of the coils for a stellarator device. @@ -38,6 +39,8 @@ def st_coil(stellarator, output: bool): output: + data: DataStructure + data structure object to provide model data """ r_coil_major = stellarator_variables.r_coil_major @@ -118,7 +121,7 @@ def st_coil(stellarator, output: bool): ####################################################################################### # Coil_mases calculations - calculate_coils_mass(a_tf_wp_with_insulation, a_tf_wp_no_insulation) + calculate_coils_mass(a_tf_wp_with_insulation, a_tf_wp_no_insulation, data) ####################################################################################### # Quench protection: diff --git a/process/models/stellarator/coils/mass.py b/process/models/stellarator/coils/mass.py index f43773abf..02c3bec34 100644 --- a/process/models/stellarator/coils/mass.py +++ b/process/models/stellarator/coils/mass.py @@ -1,10 +1,13 @@ """Module for coil mass calculations in stellarators.""" from process.core import constants -from process.data_structure import fwbs_variables, tfcoil_variables +from process.core.model import DataStructure +from process.data_structure import tfcoil_variables -def calculate_coils_mass(a_tf_wp_with_insulation: float, a_tf_wp_no_insulation: float): +def calculate_coils_mass( + a_tf_wp_with_insulation: float, a_tf_wp_no_insulation: float, data: DataStructure +): """Calculates the mass of stellarator coils by aggregating the masses of various coil components. This function computes the masses of conductor constituents (casing, ground insulation, superconductor, copper), @@ -16,7 +19,8 @@ def calculate_coils_mass(a_tf_wp_with_insulation: float, a_tf_wp_no_insulation: Area of the toroidal field coil winding pack with insulation. a_tf_wp_no_insulation: Area of the toroidal field coil winding pack without insulation. - + data: DataStructure + data structure object to provide model data """ # Masses of conductor constituents casing() @@ -25,7 +29,7 @@ def calculate_coils_mass(a_tf_wp_with_insulation: float, a_tf_wp_no_insulation: copper() # conduit masses - conduit_steel() + conduit_steel(data) conduit_insulation() # Total masses @@ -91,13 +95,13 @@ def copper(): ) * constants.den_copper -def conduit_steel(): +def conduit_steel(data): """[kg] mass of Steel conduit (sheath)""" tfcoil_variables.m_tf_wp_steel_conduit = ( tfcoil_variables.len_tf_coil * tfcoil_variables.n_tf_coil_turns * tfcoil_variables.a_tf_turn_steel - * fwbs_variables.den_steel + * data.fwbs.den_steel ) # if (i_tf_sc_mat==6) tfcoil_variables.m_tf_wp_steel_conduit = fcondsteel * a_tf_wp_no_insulation *tfcoil_variables.len_tf_coil* fwbs_variables.denstl diff --git a/process/models/stellarator/divertor.py b/process/models/stellarator/divertor.py index fc33352cb..34c846f9e 100644 --- a/process/models/stellarator/divertor.py +++ b/process/models/stellarator/divertor.py @@ -5,7 +5,6 @@ from process.core.model import DataStructure from process.data_structure import ( divertor_variables, - fwbs_variables, physics_variables, stellarator_variables, ) @@ -102,7 +101,7 @@ def st_div(stellarator, f_output: bool, data: DataStructure): divertor_variables.pflux_div_heat_load_mw = q_div divertor_variables.a_div_surface_total = darea - fwbs_variables.f_ster_div_single = darea / data.first_wall.a_fw_total + data.fwbs.f_ster_div_single = darea / data.first_wall.a_fw_total if f_output: output(stellarator, a_eff, l_d, l_w, f_x, l_q, w_r, Delta) diff --git a/process/models/stellarator/stellarator.py b/process/models/stellarator/stellarator.py index 9d7dfbcf7..494da63c1 100644 --- a/process/models/stellarator/stellarator.py +++ b/process/models/stellarator/stellarator.py @@ -18,7 +18,6 @@ constraint_variables, current_drive_variables, divertor_variables, - fwbs_variables, global_variables, heat_transport_variables, numerics, @@ -151,7 +150,7 @@ def run(self, output: bool = False): st_div(self, True, self.data) st_build(self, True, self.data) - st_coil(self, True) + st_coil(self, True, self.data) self.st_strc(True) self.st_fwbs(True) @@ -167,7 +166,7 @@ def run(self, output: bool = False): self.st_geom() self.st_phys(False) st_denisty_limits(self, False) - st_coil(self, False) + st_coil(self, False, self.data) st_build(self, False, self.data) self.st_strc(False) self.st_fwbs(False) @@ -372,7 +371,7 @@ def st_strc(self, output): 0.18e0 * (physics_variables.b_plasma_toroidal_on_axis / 5.6) ** 2 * intercoil_surface - * fwbs_variables.den_steel + * self.data.fwbs.den_steel ) structure_variables.clgsmass = ( @@ -384,7 +383,7 @@ def st_strc(self, output): structure_variables.coldmass = ( tfcoil_variables.m_tf_coils_total + structure_variables.aintmass - + fwbs_variables.dewmkg + + self.data.fwbs.dewmkg ) # Output section @@ -419,20 +418,20 @@ def st_strc(self, output): def blanket_neutronics(self): """Routine to calculate neutronic properties for a stellarator""" # heating of the blanket - if fwbs_variables.breedmat == 1: - fwbs_variables.breeder = "Orthosilicate" - fwbs_variables.densbreed = 1.50e3 - elif fwbs_variables.breedmat == 2: - fwbs_variables.breeder = "Metatitanate" - fwbs_variables.densbreed = 1.78e3 + if self.data.fwbs.breedmat == 1: + self.data.fwbs.breeder = "Orthosilicate" + self.data.fwbs.densbreed = 1.50e3 + elif self.data.fwbs.breedmat == 2: + self.data.fwbs.breeder = "Metatitanate" + self.data.fwbs.densbreed = 1.78e3 else: - fwbs_variables.breeder = ( + self.data.fwbs.breeder = ( "Zirconate" # (In reality, rarely used - activation problems) ) - fwbs_variables.densbreed = 2.12e3 + self.data.fwbs.densbreed = 2.12e3 - fwbs_variables.m_blkt_total = ( - fwbs_variables.vol_blkt_total * fwbs_variables.densbreed + self.data.fwbs.m_blkt_total = ( + self.data.fwbs.vol_blkt_total * self.data.fwbs.densbreed ) self.hcpb.nuclear_heating_blanket() @@ -449,13 +448,13 @@ def blanket_neutronics(self): * tfcoil_variables.n_tf_coils ) - fwbs_variables.ptfnucpm3 = fwbs_variables.p_tf_nuclear_heat_mw / tf_volume + self.data.fwbs.ptfnucpm3 = self.data.fwbs.p_tf_nuclear_heat_mw / tf_volume # heating of the shield self.hcpb.nuclear_heating_shield() # Energy multiplication factor - fwbs_variables.f_p_blkt_multiplication = 1.269 + self.data.fwbs.f_p_blkt_multiplication = 1.269 # Use older model to calculate neutron fluence since it # is not calculated in the CCFE blanket model @@ -463,7 +462,7 @@ def blanket_neutronics(self): _, _, _, - fwbs_variables.nflutf, + self.data.fwbs.nflutf, _, _, _, @@ -503,7 +502,7 @@ def st_fwbs(self, output: bool): """ - fwbs_variables.life_fw_fpy = min( + self.data.fwbs.life_fw_fpy = min( self.data.costs.abktflnc / physics_variables.pflux_fw_neutron_mw, self.data.costs.life_plant, ) @@ -514,7 +513,7 @@ def st_fwbs(self, output: bool): # Blanket volume; assume that its surface area is scaled directly from the # plasma surface area. - # Uses fwbs_variables.fhole etc. to take account of gaps due to ports etc. + # Uses self.data.fwbs.fhole etc. to take account of gaps due to ports etc. r1 = physics_variables.rminor + 0.5e0 * ( build_variables.dr_fw_plasma_gap_inboard @@ -527,7 +526,7 @@ def st_fwbs(self, output: bool): physics_variables.a_plasma_surface * r1 / physics_variables.rminor - * (1.0e0 - fwbs_variables.fhole) + * (1.0e0 - self.data.fwbs.fhole) ) else: build_variables.a_blkt_total_surface = ( @@ -536,9 +535,9 @@ def st_fwbs(self, output: bool): / physics_variables.rminor * ( 1.0e0 - - fwbs_variables.fhole - - fwbs_variables.f_ster_div_single - - fwbs_variables.f_a_fw_outboard_hcd + - self.data.fwbs.fhole + - self.data.fwbs.f_ster_div_single + - self.data.fwbs.f_a_fw_outboard_hcd ) ) @@ -549,18 +548,18 @@ def st_fwbs(self, output: bool): 0.5e0 * build_variables.a_blkt_total_surface ) - fwbs_variables.vol_blkt_inboard = ( + self.data.fwbs.vol_blkt_inboard = ( build_variables.a_blkt_inboard_surface * build_variables.dr_blkt_inboard ) - fwbs_variables.vol_blkt_outboard = ( + self.data.fwbs.vol_blkt_outboard = ( build_variables.a_blkt_outboard_surface * build_variables.dr_blkt_outboard ) - fwbs_variables.vol_blkt_total = ( - fwbs_variables.vol_blkt_inboard + fwbs_variables.vol_blkt_outboard + self.data.fwbs.vol_blkt_total = ( + self.data.fwbs.vol_blkt_inboard + self.data.fwbs.vol_blkt_outboard ) # Shield volume - # Uses fvolsi, fwbs_variables.fvolso as area coverage factors + # Uses fvolsi, self.data.fwbs.fvolso as area coverage factors r1 += 0.5e0 * ( build_variables.dr_blkt_inboard + build_variables.dr_blkt_outboard @@ -569,10 +568,10 @@ def st_fwbs(self, output: bool): physics_variables.a_plasma_surface * r1 / physics_variables.rminor ) build_variables.a_shld_inboard_surface = ( - 0.5e0 * build_variables.a_shld_total_surface * fwbs_variables.fvolsi + 0.5e0 * build_variables.a_shld_total_surface * self.data.fwbs.fvolsi ) build_variables.a_shld_outboard_surface = ( - 0.5e0 * build_variables.a_shld_total_surface * fwbs_variables.fvolso + 0.5e0 * build_variables.a_shld_total_surface * self.data.fwbs.fvolso ) vol_shld_inboard = ( @@ -581,127 +580,127 @@ def st_fwbs(self, output: bool): vol_shld_outboard = ( build_variables.a_shld_outboard_surface * build_variables.dr_shld_outboard ) - fwbs_variables.vol_shld_total = vol_shld_inboard + vol_shld_outboard + self.data.fwbs.vol_shld_total = vol_shld_inboard + vol_shld_outboard # Neutron power lost through holes in first wall (eventually absorbed by # shield) - fwbs_variables.pnucloss = ( - physics_variables.p_neutron_total_mw * fwbs_variables.fhole + self.data.fwbs.pnucloss = ( + physics_variables.p_neutron_total_mw * self.data.fwbs.fhole ) # The peaking factor, obtained as precalculated parameter - fwbs_variables.wallpf = ( + self.data.fwbs.wallpf = ( stellarator_configuration.stella_config_neutron_peakfactor ) # Blanket neutronics calculations - if fwbs_variables.blktmodel == 1: + if self.data.fwbs.blktmodel == 1: self.blanket_neutronics() if heat_transport_variables.ipowerflow == 1: - fwbs_variables.p_div_nuclear_heat_total_mw = ( + self.data.fwbs.p_div_nuclear_heat_total_mw = ( physics_variables.p_neutron_total_mw - * fwbs_variables.f_ster_div_single + * self.data.fwbs.f_ster_div_single ) - fwbs_variables.p_fw_hcd_nuclear_heat_mw = ( + self.data.fwbs.p_fw_hcd_nuclear_heat_mw = ( physics_variables.p_neutron_total_mw - * fwbs_variables.f_a_fw_outboard_hcd + * self.data.fwbs.f_a_fw_outboard_hcd ) - fwbs_variables.p_fw_nuclear_heat_total_mw = ( + self.data.fwbs.p_fw_nuclear_heat_total_mw = ( physics_variables.p_neutron_total_mw - - fwbs_variables.p_div_nuclear_heat_total_mw - - fwbs_variables.pnucloss - - fwbs_variables.p_fw_hcd_nuclear_heat_mw + - self.data.fwbs.p_div_nuclear_heat_total_mw + - self.data.fwbs.pnucloss + - self.data.fwbs.p_fw_hcd_nuclear_heat_mw ) - fwbs_variables.pradloss = ( - physics_variables.p_plasma_rad_mw * fwbs_variables.fhole + self.data.fwbs.pradloss = ( + physics_variables.p_plasma_rad_mw * self.data.fwbs.fhole ) - fwbs_variables.p_div_rad_total_mw = ( - physics_variables.p_plasma_rad_mw * fwbs_variables.f_ster_div_single + self.data.fwbs.p_div_rad_total_mw = ( + physics_variables.p_plasma_rad_mw * self.data.fwbs.f_ster_div_single ) - fwbs_variables.p_fw_hcd_rad_total_mw = ( + self.data.fwbs.p_fw_hcd_rad_total_mw = ( physics_variables.p_plasma_rad_mw - * fwbs_variables.f_a_fw_outboard_hcd + * self.data.fwbs.f_a_fw_outboard_hcd ) - fwbs_variables.p_fw_rad_total_mw = ( + self.data.fwbs.p_fw_rad_total_mw = ( physics_variables.p_plasma_rad_mw - - fwbs_variables.p_div_rad_total_mw - - fwbs_variables.pradloss - - fwbs_variables.p_fw_hcd_rad_total_mw + - self.data.fwbs.p_div_rad_total_mw + - self.data.fwbs.pradloss + - self.data.fwbs.p_fw_hcd_rad_total_mw ) heat_transport_variables.p_fw_coolant_pump_mw = ( heat_transport_variables.f_p_fw_coolant_pump_total_heat * ( - fwbs_variables.p_fw_nuclear_heat_total_mw - + fwbs_variables.p_fw_rad_total_mw + self.data.fwbs.p_fw_nuclear_heat_total_mw + + self.data.fwbs.p_fw_rad_total_mw + current_drive_variables.p_beam_orbit_loss_mw ) ) heat_transport_variables.p_blkt_coolant_pump_mw = ( heat_transport_variables.f_p_blkt_coolant_pump_total_heat - * fwbs_variables.p_blkt_nuclear_heat_total_mw + * self.data.fwbs.p_blkt_nuclear_heat_total_mw ) heat_transport_variables.p_shld_coolant_pump_mw = ( heat_transport_variables.f_p_shld_coolant_pump_total_heat - * fwbs_variables.p_shld_nuclear_heat_mw + * self.data.fwbs.p_shld_nuclear_heat_mw ) heat_transport_variables.p_div_coolant_pump_mw = ( heat_transport_variables.f_p_div_coolant_pump_total_heat * ( physics_variables.p_plasma_separatrix_mw - + fwbs_variables.p_div_nuclear_heat_total_mw - + fwbs_variables.p_div_rad_total_mw + + self.data.fwbs.p_div_nuclear_heat_total_mw + + self.data.fwbs.p_div_rad_total_mw ) ) # Void fraction in first wall / breeding zone, - # for use in fwbs_variables.m_fw_total and coolvol calculation below + # for use in self.data.fwbs.m_fw_total and coolvol calculation below f_a_fw_coolant_inboard = ( 1.0e0 - - fwbs_variables.fblbe - - fwbs_variables.fblbreed - - fwbs_variables.fblss + - self.data.fwbs.fblbe + - self.data.fwbs.fblbreed + - self.data.fwbs.fblss ) f_a_fw_coolant_outboard = f_a_fw_coolant_inboard else: - fwbs_variables.pnuc_cp = 0.0e0 + self.data.fwbs.pnuc_cp = 0.0e0 if heat_transport_variables.ipowerflow == 0: # Energy-multiplied neutron power pneut2 = ( physics_variables.p_neutron_total_mw - - fwbs_variables.pnucloss - - fwbs_variables.pnuc_cp - ) * fwbs_variables.f_p_blkt_multiplication + - self.data.fwbs.pnucloss + - self.data.fwbs.pnuc_cp + ) * self.data.fwbs.f_p_blkt_multiplication - fwbs_variables.p_blkt_multiplication_mw = pneut2 - ( + self.data.fwbs.p_blkt_multiplication_mw = pneut2 - ( physics_variables.p_neutron_total_mw - - fwbs_variables.pnucloss - - fwbs_variables.pnuc_cp + - self.data.fwbs.pnucloss + - self.data.fwbs.pnuc_cp ) # Nuclear heating in the blanket decaybl = 0.075e0 / ( 1.0e0 - - fwbs_variables.f_a_blkt_cooling_channels - - fwbs_variables.fblli2o - - fwbs_variables.fblbe + - self.data.fwbs.f_a_blkt_cooling_channels + - self.data.fwbs.fblli2o + - self.data.fwbs.fblbe ) - fwbs_variables.p_blkt_nuclear_heat_total_mw = pneut2 * ( + self.data.fwbs.p_blkt_nuclear_heat_total_mw = pneut2 * ( 1.0e0 - np.exp(-build_variables.dr_blkt_outboard / decaybl) ) # Nuclear heating in the shield - fwbs_variables.p_shld_nuclear_heat_mw = ( - pneut2 - fwbs_variables.p_blkt_nuclear_heat_total_mw + self.data.fwbs.p_shld_nuclear_heat_mw = ( + pneut2 - self.data.fwbs.p_blkt_nuclear_heat_total_mw ) # Superconducting coil shielding calculations @@ -709,38 +708,38 @@ def st_fwbs(self, output: bool): coilhtmx, dpacop, htheci, - fwbs_variables.nflutf, + self.data.fwbs.nflutf, pheci, pheco, ptfiwp, ptfowp, raddose, - fwbs_variables.p_tf_nuclear_heat_mw, + self.data.fwbs.p_tf_nuclear_heat_mw, ) = self.sc_tf_coil_nuclear_heating_iter90() else: # heat_transport_variables.ipowerflow == 1 # Neutron power incident on divertor (MW) - fwbs_variables.p_div_nuclear_heat_total_mw = ( + self.data.fwbs.p_div_nuclear_heat_total_mw = ( physics_variables.p_neutron_total_mw - * fwbs_variables.f_ster_div_single + * self.data.fwbs.f_ster_div_single ) # Neutron power incident on HCD apparatus (MW) - fwbs_variables.p_fw_hcd_nuclear_heat_mw = ( + self.data.fwbs.p_fw_hcd_nuclear_heat_mw = ( physics_variables.p_neutron_total_mw - * fwbs_variables.f_a_fw_outboard_hcd + * self.data.fwbs.f_a_fw_outboard_hcd ) # Neutron power deposited in first wall, blanket and shield (MW) pnucfwbs = ( physics_variables.p_neutron_total_mw - - fwbs_variables.p_div_nuclear_heat_total_mw - - fwbs_variables.pnucloss - - fwbs_variables.pnuc_cp - - fwbs_variables.p_fw_hcd_nuclear_heat_mw + - self.data.fwbs.p_div_nuclear_heat_total_mw + - self.data.fwbs.pnucloss + - self.data.fwbs.pnuc_cp + - self.data.fwbs.p_fw_hcd_nuclear_heat_mw ) # Split between inboard and outboard by first wall area fractions @@ -758,31 +757,31 @@ def st_fwbs(self, output: bool): # Radiation power incident on divertor (MW) - fwbs_variables.p_fw_hcd_rad_total_mw = ( + self.data.fwbs.p_fw_hcd_rad_total_mw = ( physics_variables.p_plasma_rad_mw - * fwbs_variables.f_a_fw_outboard_hcd + * self.data.fwbs.f_a_fw_outboard_hcd ) # Radiation power incident on HCD apparatus (MW) - fwbs_variables.p_fw_hcd_rad_total_mw = ( + self.data.fwbs.p_fw_hcd_rad_total_mw = ( physics_variables.p_plasma_rad_mw - * fwbs_variables.f_a_fw_outboard_hcd + * self.data.fwbs.f_a_fw_outboard_hcd ) # Radiation power lost through holes (eventually hits shield) (MW) - fwbs_variables.pradloss = ( - physics_variables.p_plasma_rad_mw * fwbs_variables.fhole + self.data.fwbs.pradloss = ( + physics_variables.p_plasma_rad_mw * self.data.fwbs.fhole ) # Radiation power incident on first wall (MW) - fwbs_variables.p_fw_rad_total_mw = ( + self.data.fwbs.p_fw_rad_total_mw = ( physics_variables.p_plasma_rad_mw - - fwbs_variables.p_div_rad_total_mw - - fwbs_variables.pradloss - - fwbs_variables.p_fw_hcd_rad_total_mw + - self.data.fwbs.p_div_rad_total_mw + - self.data.fwbs.pradloss + - self.data.fwbs.p_fw_hcd_rad_total_mw ) # Calculate the power deposited in the first wall, blanket and shield, @@ -791,61 +790,61 @@ def st_fwbs(self, output: bool): # If we have chosen pressurised water as the coolant, set the # coolant outlet temperature as 20 deg C below the boiling point - if fwbs_variables.i_blkt_coolant_type == 2: - if fwbs_variables.irefprop: - fwbs_variables.temp_blkt_coolant_out = ( + if self.data.fwbs.i_blkt_coolant_type == 2: + if self.data.fwbs.irefprop: + self.data.fwbs.temp_blkt_coolant_out = ( FluidProperties.of( "Water", - pressure=fwbs_variables.coolp, + pressure=self.data.fwbs.coolp, vapor_quality=0, ) - 20 ) else: - fwbs_variables.temp_blkt_coolant_out = ( + self.data.fwbs.temp_blkt_coolant_out = ( 273.15 + 168.396 - + 0.314653 / fwbs_variables.coolp - + -0.000728 / fwbs_variables.coolp**2 - + 31.588979 * np.log(fwbs_variables.coolp) - + 11.473141 * fwbs_variables.coolp - + -0.575335 * fwbs_variables.coolp**2 - + 0.013165 * fwbs_variables.coolp**3 + + 0.314653 / self.data.fwbs.coolp + + -0.000728 / self.data.fwbs.coolp**2 + + 31.588979 * np.log(self.data.fwbs.coolp) + + 11.473141 * self.data.fwbs.coolp + + -0.575335 * self.data.fwbs.coolp**2 + + 0.013165 * self.data.fwbs.coolp**3 ) - 20 bfwi = 0.5e0 * build_variables.dr_fw_inboard bfwo = 0.5e0 * build_variables.dr_fw_outboard f_a_fw_coolant_inboard = ( - fwbs_variables.radius_fw_channel - * fwbs_variables.radius_fw_channel + self.data.fwbs.radius_fw_channel + * self.data.fwbs.radius_fw_channel / (bfwi * bfwi) ) # inboard FW coolant void fraction f_a_fw_coolant_outboard = ( - fwbs_variables.radius_fw_channel - * fwbs_variables.radius_fw_channel + self.data.fwbs.radius_fw_channel + * self.data.fwbs.radius_fw_channel / (bfwo * bfwo) ) # outboard FW coolant void fraction # First wall decay length (m) - improved calculation required - decayfwi = fwbs_variables.declfw - decayfwo = fwbs_variables.declfw + decayfwi = self.data.fwbs.declfw + decayfwo = self.data.fwbs.declfw - # Surface heat flux on first wall (MW) (sum = fwbs_variables.p_fw_rad_total_mw) + # Surface heat flux on first wall (MW) (sum = self.data.fwbs.p_fw_rad_total_mw) psurffwi = ( - fwbs_variables.p_fw_rad_total_mw + self.data.fwbs.p_fw_rad_total_mw * self.data.first_wall.a_fw_inboard / self.data.first_wall.a_fw_total ) psurffwo = ( - fwbs_variables.p_fw_rad_total_mw + self.data.fwbs.p_fw_rad_total_mw * self.data.first_wall.a_fw_outboard / self.data.first_wall.a_fw_total ) - # Simple blanket model (fwbs_variables.i_p_coolant_pumping = 0 or 1) is assumed for stellarators + # Simple blanket model (self.data.fwbs.i_p_coolant_pumping = 0 or 1) is assumed for stellarators # The power deposited in the first wall, breeder zone and shield is # calculated according to their dimensions and materials assuming @@ -868,8 +867,8 @@ def st_fwbs(self, output: bool): # Blanket decay length (m) - improved calculation required - decaybzi = fwbs_variables.declblkt - decaybzo = fwbs_variables.declblkt + decaybzi = self.data.fwbs.declblkt + decaybzo = self.data.fwbs.declblkt # Neutron power deposited in breeder zone (MW) @@ -888,7 +887,7 @@ def st_fwbs(self, output: bool): # First wall and Blanket pumping power (MW) i_p_coolant_pumping = PumpingPowerModelTypes( - fwbs_variables.i_p_coolant_pumping + self.data.fwbs.i_p_coolant_pumping ) if i_p_coolant_pumping == PumpingPowerModelTypes.USER_INPUT: # Use input @@ -907,8 +906,8 @@ def st_fwbs(self, output: bool): heat_transport_variables.p_blkt_coolant_pump_mw = ( heat_transport_variables.f_p_blkt_coolant_pump_total_heat * ( - pnucbzi * fwbs_variables.f_p_blkt_multiplication - + pnucbzo * fwbs_variables.f_p_blkt_multiplication + pnucbzi * self.data.fwbs.f_p_blkt_multiplication + + pnucbzo * self.data.fwbs.f_p_blkt_multiplication ) ) else: @@ -916,56 +915,56 @@ def st_fwbs(self, output: bool): "i_p_coolant_pumping = 0 or 1 only for stellarator" ) - fwbs_variables.p_blkt_multiplication_mw = ( + self.data.fwbs.p_blkt_multiplication_mw = ( heat_transport_variables.f_p_blkt_coolant_pump_total_heat - * (pnucbzi * fwbs_variables.f_p_blkt_multiplication + pnucbzo) - * (fwbs_variables.f_p_blkt_multiplication - 1.0e0) + * (pnucbzi * self.data.fwbs.f_p_blkt_multiplication + pnucbzo) + * (self.data.fwbs.f_p_blkt_multiplication - 1.0e0) ) # Total nuclear heating of first wall (MW) - fwbs_variables.p_fw_nuclear_heat_total_mw = ( + self.data.fwbs.p_fw_nuclear_heat_total_mw = ( p_fw_inboard_nuclear_heat_mw + p_fw_outboard_nuclear_heat_mw ) # Total nuclear heating of blanket (MW) - fwbs_variables.p_blkt_nuclear_heat_total_mw = ( + self.data.fwbs.p_blkt_nuclear_heat_total_mw = ( pnucbzi + pnucbzo - ) * fwbs_variables.f_p_blkt_multiplication + ) * self.data.fwbs.f_p_blkt_multiplication - fwbs_variables.p_blkt_multiplication_mw += (pnucbzi + pnucbzo) * ( - fwbs_variables.f_p_blkt_multiplication - 1.0e0 + self.data.fwbs.p_blkt_multiplication_mw += (pnucbzi + pnucbzo) * ( + self.data.fwbs.f_p_blkt_multiplication - 1.0e0 ) # Calculation of shield and divertor powers # Shield and divertor powers and pumping powers are calculated using the same - # simplified method as the first wall and breeder zone when fwbs_variables.i_p_coolant_pumping = 1. + # simplified method as the first wall and breeder zone when self.data.fwbs.i_p_coolant_pumping = 1. # i.e. the pumping power is a fraction of the total thermal power deposited in the # coolant. # Neutron power reaching the shield (MW) - # The power lost from the fwbs_variables.fhole area fraction is assumed to be incident upon the shield + # The power lost from the self.data.fwbs.fhole area fraction is assumed to be incident upon the shield pnucsi = ( pnucbsi - pnucbzi - + (fwbs_variables.pnucloss + fwbs_variables.pradloss) + + (self.data.fwbs.pnucloss + self.data.fwbs.pradloss) * self.data.first_wall.a_fw_inboard / self.data.first_wall.a_fw_total ) pnucso = ( pnucbso - pnucbzo - + (fwbs_variables.pnucloss + fwbs_variables.pradloss) + + (self.data.fwbs.pnucloss + self.data.fwbs.pradloss) * self.data.first_wall.a_fw_outboard / self.data.first_wall.a_fw_total ) # Improved calculation of shield power decay lengths required - decayshldi = fwbs_variables.declshld - decayshldo = fwbs_variables.declshld + decayshldi = self.data.fwbs.declshld + decayshldo = self.data.fwbs.declshld # Neutron power deposited in the shield (MW) @@ -976,7 +975,7 @@ def st_fwbs(self, output: bool): 1.0e0 - np.exp(-build_variables.dr_shld_outboard / decayshldo) ) - fwbs_variables.p_shld_nuclear_heat_mw = pnucshldi + pnucshldo + self.data.fwbs.p_shld_nuclear_heat_mw = pnucshldi + pnucshldo # Calculate coolant pumping powers from input fraction. # The pumping power is assumed to be a fraction, fpump, of the incident @@ -996,8 +995,8 @@ def st_fwbs(self, output: bool): heat_transport_variables.f_p_div_coolant_pump_total_heat * ( physics_variables.p_plasma_separatrix_mw - + fwbs_variables.p_div_nuclear_heat_total_mw - + fwbs_variables.p_div_rad_total_mw + + self.data.fwbs.p_div_nuclear_heat_total_mw + + self.data.fwbs.p_div_rad_total_mw ) ) @@ -1008,11 +1007,11 @@ def st_fwbs(self, output: bool): if ( tfcoil_variables.i_tf_sup == TFConductorModel.SUPERCONDUCTING ): # superconducting coils - fwbs_variables.p_tf_nuclear_heat_mw = ( + self.data.fwbs.p_tf_nuclear_heat_mw = ( pnucsi + pnucso - pnucshldi - pnucshldo ) else: # resistive coils - fwbs_variables.p_tf_nuclear_heat_mw = 0.0e0 + self.data.fwbs.p_tf_nuclear_heat_mw = 0.0e0 # Divertor mass # N.B. divertor_variables.a_div_surface_total is calculated in stdiv after this point, so will @@ -1040,167 +1039,167 @@ def st_fwbs(self, output: bool): # Blanket mass, excluding coolant - if fwbs_variables.blktmodel == 0: - if fwbs_variables.blkttype in {1, 2}: # liquid breeder (WCLL or HCLL) - fwbs_variables.wtbllipb = ( - fwbs_variables.vol_blkt_total * fwbs_variables.fbllipb * 9400.0e0 + if self.data.fwbs.blktmodel == 0: + if self.data.fwbs.blkttype in {1, 2}: # liquid breeder (WCLL or HCLL) + self.data.fwbs.wtbllipb = ( + self.data.fwbs.vol_blkt_total * self.data.fwbs.fbllipb * 9400.0e0 ) - fwbs_variables.m_blkt_lithium = ( - fwbs_variables.vol_blkt_total * fwbs_variables.fblli * 534.0e0 + self.data.fwbs.m_blkt_lithium = ( + self.data.fwbs.vol_blkt_total * self.data.fwbs.fblli * 534.0e0 ) - fwbs_variables.m_blkt_total = ( - fwbs_variables.wtbllipb + fwbs_variables.m_blkt_lithium + self.data.fwbs.m_blkt_total = ( + self.data.fwbs.wtbllipb + self.data.fwbs.m_blkt_lithium ) else: # solid breeder (HCPB); always for ipowerflow=0 - fwbs_variables.m_blkt_li2o = ( - fwbs_variables.vol_blkt_total * fwbs_variables.fblli2o * 2010.0e0 + self.data.fwbs.m_blkt_li2o = ( + self.data.fwbs.vol_blkt_total * self.data.fwbs.fblli2o * 2010.0e0 ) - fwbs_variables.m_blkt_beryllium = ( - fwbs_variables.vol_blkt_total * fwbs_variables.fblbe * 1850.0e0 + self.data.fwbs.m_blkt_beryllium = ( + self.data.fwbs.vol_blkt_total * self.data.fwbs.fblbe * 1850.0e0 ) - fwbs_variables.m_blkt_total = ( - fwbs_variables.m_blkt_li2o + fwbs_variables.m_blkt_beryllium + self.data.fwbs.m_blkt_total = ( + self.data.fwbs.m_blkt_li2o + self.data.fwbs.m_blkt_beryllium ) - fwbs_variables.m_blkt_steel_total = ( - fwbs_variables.vol_blkt_total - * fwbs_variables.den_steel - * fwbs_variables.fblss + self.data.fwbs.m_blkt_steel_total = ( + self.data.fwbs.vol_blkt_total + * self.data.fwbs.den_steel + * self.data.fwbs.fblss ) - fwbs_variables.m_blkt_vanadium = ( - fwbs_variables.vol_blkt_total * 5870.0e0 * fwbs_variables.fblvd + self.data.fwbs.m_blkt_vanadium = ( + self.data.fwbs.vol_blkt_total * 5870.0e0 * self.data.fwbs.fblvd ) - fwbs_variables.m_blkt_total = ( - fwbs_variables.m_blkt_total - + fwbs_variables.m_blkt_steel_total - + fwbs_variables.m_blkt_vanadium + self.data.fwbs.m_blkt_total = ( + self.data.fwbs.m_blkt_total + + self.data.fwbs.m_blkt_steel_total + + self.data.fwbs.m_blkt_vanadium ) else: # volume fractions proportional to sub-assembly thicknesses - fwbs_variables.m_blkt_steel_total = fwbs_variables.den_steel * ( - fwbs_variables.vol_blkt_inboard + self.data.fwbs.m_blkt_steel_total = self.data.fwbs.den_steel * ( + self.data.fwbs.vol_blkt_inboard / build_variables.dr_blkt_inboard * ( - build_variables.blbuith * fwbs_variables.fblss - + build_variables.blbmith * (1.0e0 - fwbs_variables.fblhebmi) - + build_variables.blbpith * (1.0e0 - fwbs_variables.fblhebpi) + build_variables.blbuith * self.data.fwbs.fblss + + build_variables.blbmith * (1.0e0 - self.data.fwbs.fblhebmi) + + build_variables.blbpith * (1.0e0 - self.data.fwbs.fblhebpi) ) - + fwbs_variables.vol_blkt_outboard + + self.data.fwbs.vol_blkt_outboard / build_variables.dr_blkt_outboard * ( - build_variables.blbuoth * fwbs_variables.fblss - + build_variables.blbmoth * (1.0e0 - fwbs_variables.fblhebmo) - + build_variables.blbpoth * (1.0e0 - fwbs_variables.fblhebpo) + build_variables.blbuoth * self.data.fwbs.fblss + + build_variables.blbmoth * (1.0e0 - self.data.fwbs.fblhebmo) + + build_variables.blbpoth * (1.0e0 - self.data.fwbs.fblhebpo) ) ) - fwbs_variables.m_blkt_beryllium = ( + self.data.fwbs.m_blkt_beryllium = ( 1850.0e0 - * fwbs_variables.fblbe + * self.data.fwbs.fblbe * ( ( - fwbs_variables.vol_blkt_inboard + self.data.fwbs.vol_blkt_inboard * build_variables.blbuith / build_variables.dr_blkt_inboard ) + ( - fwbs_variables.vol_blkt_outboard + self.data.fwbs.vol_blkt_outboard * build_variables.blbuoth / build_variables.dr_blkt_outboard ) ) ) - fwbs_variables.whtblbreed = ( - fwbs_variables.densbreed - * fwbs_variables.fblbreed + self.data.fwbs.whtblbreed = ( + self.data.fwbs.densbreed + * self.data.fwbs.fblbreed * ( ( - fwbs_variables.vol_blkt_inboard + self.data.fwbs.vol_blkt_inboard * build_variables.blbuith / build_variables.dr_blkt_inboard ) + ( - fwbs_variables.vol_blkt_outboard + self.data.fwbs.vol_blkt_outboard * build_variables.blbuoth / build_variables.dr_blkt_outboard ) ) ) - fwbs_variables.m_blkt_total = ( - fwbs_variables.m_blkt_steel_total - + fwbs_variables.m_blkt_beryllium - + fwbs_variables.whtblbreed + self.data.fwbs.m_blkt_total = ( + self.data.fwbs.m_blkt_steel_total + + self.data.fwbs.m_blkt_beryllium + + self.data.fwbs.whtblbreed ) - fwbs_variables.f_a_blkt_cooling_channels = ( - fwbs_variables.vol_blkt_inboard - / fwbs_variables.vol_blkt_total + self.data.fwbs.f_a_blkt_cooling_channels = ( + self.data.fwbs.vol_blkt_inboard + / self.data.fwbs.vol_blkt_total * ( # inboard portion (build_variables.blbuith / build_variables.dr_blkt_inboard) * ( 1.0e0 - - fwbs_variables.fblbe - - fwbs_variables.fblbreed - - fwbs_variables.fblss + - self.data.fwbs.fblbe + - self.data.fwbs.fblbreed + - self.data.fwbs.fblss ) + (build_variables.blbmith / build_variables.dr_blkt_inboard) - * fwbs_variables.fblhebmi + * self.data.fwbs.fblhebmi + (build_variables.blbpith / build_variables.dr_blkt_inboard) - * fwbs_variables.fblhebpi + * self.data.fwbs.fblhebpi ) ) - fwbs_variables.f_a_blkt_cooling_channels += ( - fwbs_variables.vol_blkt_outboard - / fwbs_variables.vol_blkt_total + self.data.fwbs.f_a_blkt_cooling_channels += ( + self.data.fwbs.vol_blkt_outboard + / self.data.fwbs.vol_blkt_total * ( # outboard portion (build_variables.blbuoth / build_variables.dr_blkt_outboard) * ( 1.0e0 - - fwbs_variables.fblbe - - fwbs_variables.fblbreed - - fwbs_variables.fblss + - self.data.fwbs.fblbe + - self.data.fwbs.fblbreed + - self.data.fwbs.fblss ) + (build_variables.blbmoth / build_variables.dr_blkt_outboard) - * fwbs_variables.fblhebmo + * self.data.fwbs.fblhebmo + (build_variables.blbpoth / build_variables.dr_blkt_outboard) - * fwbs_variables.fblhebpo + * self.data.fwbs.fblhebpo ) ) - # When fwbs_variables.blktmodel > 0, although the blanket is by definition helium-cooled + # When self.data.fwbs.blktmodel > 0, although the blanket is by definition helium-cooled # in this case, the shield etc. are assumed to be water-cooled, and since - # water is heavier the calculation for fwbs_variables.m_fw_blkt_div_coolant_total is better done with - # i_blkt_coolant_type=2 if fwbs_variables.blktmodel > 0; thus we can ignore the helium coolant mass + # water is heavier the calculation for self.data.fwbs.m_fw_blkt_div_coolant_total is better done with + # i_blkt_coolant_type=2 if self.data.fwbs.blktmodel > 0; thus we can ignore the helium coolant mass # in the blanket. - if fwbs_variables.blktmodel == 0: + if self.data.fwbs.blktmodel == 0: coolvol += ( - fwbs_variables.vol_blkt_total * fwbs_variables.f_a_blkt_cooling_channels + self.data.fwbs.vol_blkt_total * self.data.fwbs.f_a_blkt_cooling_channels ) # Shield mass - fwbs_variables.whtshld = ( - fwbs_variables.vol_shld_total - * fwbs_variables.den_steel - * (1.0e0 - fwbs_variables.vfshld) + self.data.fwbs.whtshld = ( + self.data.fwbs.vol_shld_total + * self.data.fwbs.den_steel + * (1.0e0 - self.data.fwbs.vfshld) ) - coolvol += fwbs_variables.vol_shld_total * fwbs_variables.vfshld + coolvol += self.data.fwbs.vol_shld_total * self.data.fwbs.vfshld # Penetration shield (set = internal shield) - fwbs_variables.wpenshld = fwbs_variables.whtshld + self.data.fwbs.wpenshld = self.data.fwbs.whtshld if heat_transport_variables.ipowerflow == 0: # First wall mass # (first wall area is calculated else:where) - fwbs_variables.m_fw_total = ( + self.data.fwbs.m_fw_total = ( self.data.first_wall.a_fw_total * (build_variables.dr_fw_inboard + build_variables.dr_fw_outboard) / 2.0e0 - * fwbs_variables.den_steel - * (1.0e0 - fwbs_variables.fwclfr) + * self.data.fwbs.den_steel + * (1.0e0 - self.data.fwbs.fwclfr) ) # Surface areas adjacent to plasma @@ -1209,11 +1208,11 @@ def st_fwbs(self, output: bool): self.data.first_wall.a_fw_total * (build_variables.dr_fw_inboard + build_variables.dr_fw_outboard) / 2.0e0 - * fwbs_variables.fwclfr + * self.data.fwbs.fwclfr ) else: - fwbs_variables.m_fw_total = fwbs_variables.den_steel * ( + self.data.fwbs.m_fw_total = self.data.fwbs.den_steel * ( self.data.first_wall.a_fw_inboard * build_variables.dr_fw_inboard * (1.0e0 - f_a_fw_coolant_inboard) @@ -1234,7 +1233,7 @@ def st_fwbs(self, output: bool): # Average first wall coolant fraction, only used by old routines # in fispact.f90, safety.f90 - fwbs_variables.fwclfr = ( + self.data.fwbs.fwclfr = ( self.data.first_wall.a_fw_inboard * build_variables.dr_fw_inboard * f_a_fw_coolant_inboard @@ -1249,15 +1248,15 @@ def st_fwbs(self, output: bool): # Mass of coolant = volume * density at typical coolant # temperatures and pressures - # N.B. for fwbs_variables.blktmodel > 0, mass of *water* coolant in the non-blanket + # N.B. for self.data.fwbs.blktmodel > 0, mass of *water* coolant in the non-blanket # structures is used (see comment above) - if (fwbs_variables.blktmodel > 0) or ( - fwbs_variables.i_blkt_coolant_type == 2 + if (self.data.fwbs.blktmodel > 0) or ( + self.data.fwbs.i_blkt_coolant_type == 2 ): # pressurised water coolant - fwbs_variables.m_fw_blkt_div_coolant_total = coolvol * 806.719e0 + self.data.fwbs.m_fw_blkt_div_coolant_total = coolvol * 806.719e0 else: # gaseous helium coolant - fwbs_variables.m_fw_blkt_div_coolant_total = coolvol * 1.517e0 + self.data.fwbs.m_fw_blkt_div_coolant_total = coolvol * 1.517e0 # Assume external cryostat is a torus with circular cross-section, # centred on plasma major radius. @@ -1265,16 +1264,16 @@ def st_fwbs(self, output: bool): # External cryostat outboard major radius (m) - fwbs_variables.r_cryostat_inboard = ( + self.data.fwbs.r_cryostat_inboard = ( build_variables.r_tf_outboard_mid + 0.5e0 * build_variables.dr_tf_outboard - + fwbs_variables.dr_pf_cryostat + + self.data.fwbs.dr_pf_cryostat ) - adewex = fwbs_variables.r_cryostat_inboard - physics_variables.rmajor + adewex = self.data.fwbs.r_cryostat_inboard - physics_variables.rmajor # External cryostat volume - fwbs_variables.vol_cryostat = ( + self.data.fwbs.vol_cryostat = ( 4.0e0 * (np.pi**2) * physics_variables.rmajor @@ -1283,7 +1282,7 @@ def st_fwbs(self, output: bool): ) # Internal vacuum vessel volume - # fwbs_variables.fvoldw accounts for ports, support, etc. additions + # self.data.fwbs.fvoldw accounts for ports, support, etc. additions r1 = physics_variables.rminor + 0.5e0 * ( build_variables.dr_fw_plasma_gap_inboard @@ -1295,24 +1294,24 @@ def st_fwbs(self, output: bool): + build_variables.dr_blkt_outboard + build_variables.dr_shld_outboard ) - fwbs_variables.vol_vv = ( + self.data.fwbs.vol_vv = ( (build_variables.dr_vv_inboard + build_variables.dr_vv_outboard) / 2.0e0 * physics_variables.a_plasma_surface * r1 / physics_variables.rminor - * fwbs_variables.fvoldw + * self.data.fwbs.fvoldw ) # Vacuum vessel mass - fwbs_variables.m_vv = fwbs_variables.vol_vv * fwbs_variables.den_steel + self.data.fwbs.m_vv = self.data.fwbs.vol_vv * self.data.fwbs.den_steel # Sum of internal vacuum vessel and external cryostat masses - fwbs_variables.dewmkg = ( - fwbs_variables.vol_vv + fwbs_variables.vol_cryostat - ) * fwbs_variables.den_steel + self.data.fwbs.dewmkg = ( + self.data.fwbs.vol_vv + self.data.fwbs.vol_cryostat + ) * self.data.fwbs.den_steel if output: # Output section @@ -1324,19 +1323,19 @@ def st_fwbs(self, output: bool): "(pflux_fw_neutron_mw)", physics_variables.pflux_fw_neutron_mw, ) - if fwbs_variables.blktmodel > 0: + if self.data.fwbs.blktmodel > 0: po.ovarre( self.outfile, "Neutron wall load peaking factor", "(wallpf)", - fwbs_variables.wallpf, + self.data.fwbs.wallpf, ) po.ovarre( self.outfile, "First wall full-power lifetime (years)", "(life_fw_fpy)", - fwbs_variables.life_fw_fpy, + self.data.fwbs.life_fw_fpy, ) po.ovarre( @@ -1358,7 +1357,7 @@ def st_fwbs(self, output: bool): build_variables.dz_shld_upper, ) - if fwbs_variables.blktmodel > 0: + if self.data.fwbs.blktmodel > 0: po.ovarre( self.outfile, "Inboard breeding zone thickness (m)", @@ -1384,7 +1383,7 @@ def st_fwbs(self, output: bool): "(dr_blkt_inboard)", build_variables.dr_blkt_inboard, ) - if fwbs_variables.blktmodel > 0: + if self.data.fwbs.blktmodel > 0: po.ovarre( self.outfile, "Outboard breeding zone thickness (m)", @@ -1418,7 +1417,7 @@ def st_fwbs(self, output: bool): ) if (heat_transport_variables.ipowerflow == 0) and ( - fwbs_variables.blktmodel == 0 + self.data.fwbs.blktmodel == 0 ): po.osubhd(self.outfile, "Coil nuclear parameters :") po.ovarre( @@ -1450,7 +1449,7 @@ def st_fwbs(self, output: bool): self.outfile, "Maximum neutron fluence (n/m2)", "(nflutf)", - fwbs_variables.nflutf, + self.data.fwbs.nflutf, ) po.ovarre( self.outfile, @@ -1459,25 +1458,25 @@ def st_fwbs(self, output: bool): dpacop, ) - if fwbs_variables.blktmodel == 0: + if self.data.fwbs.blktmodel == 0: po.osubhd(self.outfile, "Nuclear heating :") po.ovarre( self.outfile, "Blanket heating (including energy multiplication) (MW)", "(p_blkt_nuclear_heat_total_mw)", - fwbs_variables.p_blkt_nuclear_heat_total_mw, + self.data.fwbs.p_blkt_nuclear_heat_total_mw, ) po.ovarre( self.outfile, "Shield nuclear heating (MW)", "(p_shld_nuclear_heat_mw)", - fwbs_variables.p_shld_nuclear_heat_mw, + self.data.fwbs.p_shld_nuclear_heat_mw, ) po.ovarre( self.outfile, "Coil nuclear heating (MW)", "(p_tf_nuclear_heat_mw)", - fwbs_variables.p_tf_nuclear_heat_mw, + self.data.fwbs.p_tf_nuclear_heat_mw, ) else: po.osubhd(self.outfile, "Blanket neutronics :") @@ -1485,39 +1484,39 @@ def st_fwbs(self, output: bool): self.outfile, "Blanket heating (including energy multiplication) (MW)", "(p_blkt_nuclear_heat_total_mw)", - fwbs_variables.p_blkt_nuclear_heat_total_mw, + self.data.fwbs.p_blkt_nuclear_heat_total_mw, ) po.ovarre( self.outfile, "Shield heating (MW)", "(p_shld_nuclear_heat_mw)", - fwbs_variables.p_shld_nuclear_heat_mw, + self.data.fwbs.p_shld_nuclear_heat_mw, ) po.ovarre( self.outfile, "Energy multiplication in blanket", "(f_p_blkt_multiplication)", - fwbs_variables.f_p_blkt_multiplication, + self.data.fwbs.f_p_blkt_multiplication, ) po.ovarin( self.outfile, "Number of divertor ports assumed", "(npdiv)", - fwbs_variables.npdiv, + self.data.fwbs.npdiv, ) po.ovarin( self.outfile, "Number of inboard H/CD ports assumed", "(nphcdin)", - fwbs_variables.nphcdin, + self.data.fwbs.nphcdin, ) po.ovarin( self.outfile, "Number of outboard H/CD ports assumed", "(nphcdout)", - fwbs_variables.nphcdout, + self.data.fwbs.nphcdout, ) - if fwbs_variables.hcdportsize == 1: + if self.data.fwbs.hcdportsize == 1: po.ocmmnt( self.outfile, " (small heating/current drive ports assumed)" ) @@ -1526,17 +1525,17 @@ def st_fwbs(self, output: bool): self.outfile, " (large heating/current drive ports assumed)" ) - if fwbs_variables.breedmat == 1: + if self.data.fwbs.breedmat == 1: po.ocmmnt( self.outfile, "Breeder material: Lithium orthosilicate (Li4Si04)", ) - elif fwbs_variables.breedmat == 2: + elif self.data.fwbs.breedmat == 2: po.ocmmnt( self.outfile, "Breeder material: Lithium methatitanate (Li2TiO3)", ) - elif fwbs_variables.breedmat == 3: + elif self.data.fwbs.breedmat == 3: po.ocmmnt( self.outfile, "Breeder material: Lithium zirconate (Li2ZrO3)" ) @@ -1547,92 +1546,92 @@ def st_fwbs(self, output: bool): self.outfile, "Lithium-6 enrichment (%)", "(f_blkt_li6_enrichment)", - fwbs_variables.f_blkt_li6_enrichment, + self.data.fwbs.f_blkt_li6_enrichment, ) po.ovarre( self.outfile, "Tritium production rate (g/day)", "(tritprate)", - fwbs_variables.tritprate, + self.data.fwbs.tritprate, ) po.ovarre( self.outfile, "Nuclear heating on i/b coil (MW/m3)", "(pnuctfi)", - fwbs_variables.pnuctfi, + self.data.fwbs.pnuctfi, ) po.ovarre( self.outfile, "Nuclear heating on o/b coil (MW/m3)", "(pnuctfo)", - fwbs_variables.pnuctfo, + self.data.fwbs.pnuctfo, ) po.ovarre( self.outfile, "Total nuclear heating on coil (MW)", "(p_tf_nuclear_heat_mw)", - fwbs_variables.p_tf_nuclear_heat_mw, + self.data.fwbs.p_tf_nuclear_heat_mw, ) po.ovarre( self.outfile, "Fast neut. fluence on i/b coil (n/m2)", "(nflutfi)", - fwbs_variables.nflutfi * 1.0e4, + self.data.fwbs.nflutfi * 1.0e4, ) po.ovarre( self.outfile, "Fast neut. fluence on o/b coil (n/m2)", "(nflutfo)", - fwbs_variables.nflutfo * 1.0e4, + self.data.fwbs.nflutfo * 1.0e4, ) po.ovarre( self.outfile, "Minimum final He conc. in IB VV (appm)", "(vvhemini)", - fwbs_variables.vvhemini, + self.data.fwbs.vvhemini, ) po.ovarre( self.outfile, "Minimum final He conc. in OB VV (appm)", "(vvhemino)", - fwbs_variables.vvhemino, + self.data.fwbs.vvhemino, ) po.ovarre( self.outfile, "Maximum final He conc. in IB VV (appm)", "(vvhemaxi)", - fwbs_variables.vvhemaxi, + self.data.fwbs.vvhemaxi, ) po.ovarre( self.outfile, "Maximum final He conc. in OB VV (appm)", "(vvhemaxo)", - fwbs_variables.vvhemaxo, + self.data.fwbs.vvhemaxo, ) po.ovarre( self.outfile, "Blanket lifetime (full power years)", "(life_blkt_fpy)", - fwbs_variables.life_blkt_fpy, + self.data.fwbs.life_blkt_fpy, ) po.ovarre( self.outfile, "Blanket lifetime (calendar years)", "(t_bl_y)", - fwbs_variables.t_bl_y, + self.data.fwbs.t_bl_y, ) if (heat_transport_variables.ipowerflow == 1) and ( - fwbs_variables.blktmodel == 0 + self.data.fwbs.blktmodel == 0 ): po.oblnkl(self.outfile) po.ovarin( self.outfile, "First wall / blanket thermodynamic model", "(i_thermal_electric_conversion)", - fwbs_variables.i_thermal_electric_conversion, + self.data.fwbs.i_thermal_electric_conversion, ) - if fwbs_variables.i_thermal_electric_conversion == 0: + if self.data.fwbs.i_thermal_electric_conversion == 0: po.ocmmnt(self.outfile, " (Simple calculation)") po.osubhd(self.outfile, "Blanket / shield volumes and weights :") @@ -1648,19 +1647,19 @@ def st_fwbs(self, output: bool): self.outfile, "First wall mass (kg)", "(m_fw_total)", - fwbs_variables.m_fw_total, + self.data.fwbs.m_fw_total, ) po.ovarre( self.outfile, "External cryostat inner radius (m)", "", - fwbs_variables.r_cryostat_inboard - 2.0e0 * adewex, + self.data.fwbs.r_cryostat_inboard - 2.0e0 * adewex, ) po.ovarre( self.outfile, "External cryostat outer radius (m)", "(r_cryostat_inboard)", - fwbs_variables.r_cryostat_inboard, + self.data.fwbs.r_cryostat_inboard, ) po.ovarre( self.outfile, "External cryostat minor radius (m)", "(adewex)", adewex @@ -1669,37 +1668,37 @@ def st_fwbs(self, output: bool): self.outfile, "External cryostat shell volume (m^3)", "(vol_cryostat)", - fwbs_variables.vol_cryostat, + self.data.fwbs.vol_cryostat, ) po.ovarre( self.outfile, "Internal volume of the cryostat structure (m^3)", "(vol_cryostat_internal)", - fwbs_variables.vol_cryostat_internal, + self.data.fwbs.vol_cryostat_internal, ) po.ovarre( self.outfile, "External cryostat mass (kg)", "", - fwbs_variables.dewmkg - fwbs_variables.m_vv, + self.data.fwbs.dewmkg - self.data.fwbs.m_vv, ) po.ovarre( self.outfile, "Internal vacuum vessel shell volume (m3)", "(vol_vv)", - fwbs_variables.vol_vv, + self.data.fwbs.vol_vv, ) po.ovarre( self.outfile, "Vacuum vessel mass (kg)", "(m_vv)", - fwbs_variables.m_vv, + self.data.fwbs.m_vv, ) po.ovarre( self.outfile, "Total cryostat + vacuum vessel mass (kg)", "(dewmkg)", - fwbs_variables.dewmkg, + self.data.fwbs.dewmkg, ) po.ovarre( self.outfile, @@ -2123,7 +2122,7 @@ def st_phys(self, output): ) elif heat_transport_variables.ipowerflow == 0: physics_variables.pflux_fw_neutron_mw = ( - (1.0e0 - fwbs_variables.fhole) + (1.0e0 - self.data.fwbs.fhole) * physics_variables.p_neutron_total_mw / self.data.first_wall.a_fw_total ) @@ -2131,9 +2130,9 @@ def st_phys(self, output): physics_variables.pflux_fw_neutron_mw = ( ( 1.0e0 - - fwbs_variables.fhole - - fwbs_variables.f_a_fw_outboard_hcd - - fwbs_variables.f_ster_div_single + - self.data.fwbs.fhole + - self.data.fwbs.f_a_fw_outboard_hcd + - self.data.fwbs.f_ster_div_single ) * physics_variables.p_neutron_total_mw / self.data.first_wall.a_fw_total @@ -2244,7 +2243,7 @@ def st_phys(self, output): ) elif heat_transport_variables.ipowerflow == 0: physics_variables.pflux_fw_rad_mw = ( - (1.0e0 - fwbs_variables.fhole) + (1.0e0 - self.data.fwbs.fhole) * physics_variables.p_plasma_rad_mw / self.data.first_wall.a_fw_total ) @@ -2252,9 +2251,9 @@ def st_phys(self, output): physics_variables.pflux_fw_rad_mw = ( ( 1.0e0 - - fwbs_variables.fhole - - fwbs_variables.f_a_fw_outboard_hcd - - fwbs_variables.f_ster_div_single + - self.data.fwbs.fhole + - self.data.fwbs.f_a_fw_outboard_hcd + - self.data.fwbs.f_ster_div_single ) * physics_variables.p_plasma_rad_mw / self.data.first_wall.a_fw_total diff --git a/process/models/structure.py b/process/models/structure.py index 71cfc0133..c0beb67dc 100644 --- a/process/models/structure.py +++ b/process/models/structure.py @@ -8,7 +8,6 @@ from process.core.model import Model from process.data_structure import build_variables as bv from process.data_structure import divertor_variables as divv -from process.data_structure import fwbs_variables as fwbsv from process.data_structure import pfcoil_variables as pfv from process.data_structure import physics_variables as pv from process.data_structure import structure_variables as stv @@ -60,14 +59,14 @@ def run(self, output: bool = False): pfv.i_pf_conductor, bv.dr_tf_inner_bore + bv.dr_tf_outboard + bv.dr_tf_inboard, bv.z_tf_inside_half, - fwbsv.whtshld, + self.data.fwbs.whtshld, divv.m_div_plate, total_weight_pf, tfv.m_tf_coils_total, - fwbsv.m_fw_total, - fwbsv.m_blkt_total, - fwbsv.m_fw_blkt_div_coolant_total, - fwbsv.dewmkg, + self.data.fwbs.m_fw_total, + self.data.fwbs.m_blkt_total, + self.data.fwbs.m_fw_blkt_div_coolant_total, + self.data.fwbs.dewmkg, output=output, ) diff --git a/process/models/tfcoil/base.py b/process/models/tfcoil/base.py index 8e481b078..3ba830f0d 100644 --- a/process/models/tfcoil/base.py +++ b/process/models/tfcoil/base.py @@ -17,7 +17,6 @@ from process.core.model import Model from process.data_structure import ( build_variables, - fwbs_variables, global_variables, numerics, physics_variables, @@ -2311,7 +2310,7 @@ def cntrpst(self, output: bool = False): ro = (acpav / (np.pi * tfcoil_variables.n_cp_coolant_channels_total)) ** 0.5 # Inner legs total heating power (to be removed by coolant) - ptot = tfcoil_variables.p_cp_resistive + fwbs_variables.pnuc_cp_tf * 1.0e6 + ptot = tfcoil_variables.p_cp_resistive + self.data.fwbs.pnuc_cp_tf * 1.0e6 # Temperature calculations # ------------------------- @@ -2538,7 +2537,7 @@ def cntrpst(self, output: bool = False): # Saturation pressure # Ref : Keenan, Keyes, Hill, Moore, steam tables, Wiley & Sons, 1969 # Rem 1 : ONLY VALID FOR WATER ! - # Rem 2 : Not used anywhere else in the code ... + # Rem 2 : Not used anywhere else in the code . tclmx = tcoolmx + tmarg tclmxs = min(tclmx, 374.0e0) fc = 0.65e0 - 0.01e0 * tclmxs @@ -2613,7 +2612,7 @@ def cntrpst(self, output: bool = False): self.outfile, "Nuclear heating (MW)", "(pnuc_cp_tf)", - fwbs_variables.pnuc_cp_tf, + self.data.fwbs.pnuc_cp_tf, ) po.ovarre(self.outfile, "Total heating (MW)", "(ptot/1.0e6)", ptot / 1.0e6) @@ -2654,7 +2653,7 @@ def cntrpst(self, output: bool = False): po.ovarre(self.outfile, "Coolant pressure drop (Pa)", "(dpres)", dpres) if ( tfcoil_variables.i_tf_sup == TFConductorModel.WATER_COOLED_COPPER - ): # Saturation pressure calculated with Water data ... + ): # Saturation pressure calculated with Water data . po.ovarre( self.outfile, "Coolant inlet pressure (Pa)", "(presin)", presin ) @@ -2818,7 +2817,7 @@ def tf_field_and_force( ) # Case of a centrepost (physics_variables.itart == 1) with sliding joints (the CP vertical are separated from the leg ones) - # Rem SK : casing/insulation thickness not subtracted as part of the CP is genuinely connected to the legs.. + # Rem SK : casing/insulation thickness not subtracted as part of the CP is genuinely connected to the legs. if itart == 1 and i_cp_joints == 1: # CP vertical tension [N] vforce = ( @@ -4651,7 +4650,7 @@ def table_format_arrays(a, mult=1, delim="\t\t"): tfcoil_variables.i_tf_stress_model == 1 and tfcoil_variables.i_tf_sup == TFConductorModel.SUPERCONDUCTING ): - # Other quantities (displacement strain, etc..) + # Other quantities (displacement strain, etc.) po.ovarre( self.outfile, "Maximum radial deflection at midplane (m)", @@ -4708,7 +4707,7 @@ def eyoung_parallel( call eyoung_parallel(triplet1, triplet2, tripletOUT) call eyoung_parallel(triplet3, tripletOUT, tripletOUT) call eyoung_parallel(triplet4, tripletOUT, tripletOUT) - ... etc. + . etc. So that tripletOUT would eventually have the smeared properties of the total composite member. @@ -5541,7 +5540,7 @@ def eyoung_parallel_array(n, eyoung_j_in, a_in, poisson_j_perp_in): call eyoung_parallel(triplet1, triplet2, tripletOUT) call eyoung_parallel(triplet3, tripletOUT, tripletOUT) call eyoung_parallel(triplet4, tripletOUT, tripletOUT) - ... etc. + . etc. So that tripletOUT would eventually have the smeared properties of the total composite member. @@ -5687,7 +5686,7 @@ def eyoung_series(eyoung_j_1, l_1, poisson_j_perp_1, eyoung_j_2, l_2, poisson_j_ call eyoung_series(triplet1, triplet2, tripletOUT) call eyoung_series(triplet3, tripletOUT, tripletOUT) call eyoung_series(triplet4, tripletOUT, tripletOUT) - ... etc. + . etc. So that tripletOUT would eventually have the smeared properties of the total composite member. diff --git a/process/models/tfcoil/resistive.py b/process/models/tfcoil/resistive.py index 443158a75..a4feaf697 100644 --- a/process/models/tfcoil/resistive.py +++ b/process/models/tfcoil/resistive.py @@ -6,7 +6,6 @@ from process.core import constants from process.data_structure import ( build_variables, - fwbs_variables, pfcoil_variables, physics_variables, superconducting_tf_coil_variables, @@ -745,7 +744,7 @@ def resistive_tf_coil_areas_and_masses(self): # Copper magnets casing/conductor weights per coil [kg] if tfcoil_variables.i_tf_sup == TFConductorModel.WATER_COOLED_COPPER: tfcoil_variables.m_tf_coil_case = ( - fwbs_variables.den_steel * vol_case / tfcoil_variables.n_tf_coils + self.data.fwbs.den_steel * vol_case / tfcoil_variables.n_tf_coils ) # Per TF leg, no casing for outer leg tfcoil_variables.m_tf_coil_copper = ( constants.den_copper * vol_cond / tfcoil_variables.n_tf_coils @@ -770,7 +769,7 @@ def resistive_tf_coil_areas_and_masses(self): + superconducting_tf_coil_variables.vol_gr_ins_cp ) + superconducting_tf_coil_variables.vol_case_cp - * fwbs_variables.den_steel + * self.data.fwbs.den_steel ) # Cryo-aluminium conductor weights @@ -803,7 +802,7 @@ def resistive_tf_coil_areas_and_masses(self): + superconducting_tf_coil_variables.vol_gr_ins_cp ) + superconducting_tf_coil_variables.vol_case_cp - * fwbs_variables.den_steel + * self.data.fwbs.den_steel ) # Turn insulation mass [kg] diff --git a/process/models/tfcoil/superconducting.py b/process/models/tfcoil/superconducting.py index 7eb09416b..331503c13 100644 --- a/process/models/tfcoil/superconducting.py +++ b/process/models/tfcoil/superconducting.py @@ -14,7 +14,6 @@ build_variables, constraint_variables, divertor_variables, - fwbs_variables, global_variables, pfcoil_variables, physics_variables, @@ -1444,7 +1443,7 @@ def superconducting_tf_coil_areas_and_masses(self): tfcoil_variables.len_tf_coil * tfcoil_variables.n_tf_coil_turns * tfcoil_variables.a_tf_turn_steel - * fwbs_variables.den_steel + * self.data.fwbs.den_steel ) # Conduit insulation mass [kg] diff --git a/process/models/vacuum.py b/process/models/vacuum.py index f03c4c828..f7ffa8b8b 100644 --- a/process/models/vacuum.py +++ b/process/models/vacuum.py @@ -10,7 +10,6 @@ blanket_library, build_variables, divertor_variables, - fwbs_variables, physics_variables, tfcoil_variables, times_variables, @@ -741,12 +740,12 @@ def run(self): # D-shaped blanket and shield if ( physics_variables.itart == 1 - or fwbs_variables.i_fw_blkt_vv_shape == FwBlktVVShape.D_SHAPED + or self.data.fwbs.i_fw_blkt_vv_shape == FwBlktVVShape.D_SHAPED ): ( blanket_library.vol_vv_inboard, blanket_library.vol_vv_outboard, - fwbs_variables.vol_vv, + self.data.fwbs.vol_vv, ) = self.calculate_dshaped_vessel_volumes( r_shld_inboard_inner=build_variables.r_shld_inboard_inner, r_shld_outboard_outer=build_variables.r_shld_outboard_outer, @@ -760,7 +759,7 @@ def run(self): ( blanket_library.vol_vv_inboard, blanket_library.vol_vv_outboard, - fwbs_variables.vol_vv, + self.data.fwbs.vol_vv, ) = self.calculate_elliptical_vessel_volumes( rmajor=physics_variables.rmajor, rminor=physics_variables.rminor, @@ -777,10 +776,10 @@ def run(self): # Apply vacuum vessel coverage factor # moved from dshaped_* and elliptical_* to keep coverage factor # changes in the same location. - fwbs_variables.vol_vv = fwbs_variables.fvoldw * fwbs_variables.vol_vv + self.data.fwbs.vol_vv = self.data.fwbs.fvoldw * self.data.fwbs.vol_vv # Vacuum vessel mass (kg) - fwbs_variables.m_vv = fwbs_variables.vol_vv * fwbs_variables.den_steel + self.data.fwbs.m_vv = self.data.fwbs.vol_vv * self.data.fwbs.den_steel @staticmethod def calculate_vessel_half_height( @@ -973,6 +972,6 @@ def output(self): self.outfile, "Total volume of vacuum vessel (m^3)", "(vol_vv)", - fwbs_variables.vol_vv, + self.data.fwbs.vol_vv, "OP ", ) diff --git a/tests/unit/core/test_mfile.py b/tests/unit/core/test_mfile.py index b0d851bb0..8426e187a 100644 --- a/tests/unit/core/test_mfile.py +++ b/tests/unit/core/test_mfile.py @@ -6,6 +6,7 @@ import pytest from process.core.io.mfile import MFile, get_mfile_initial_ixc_values +from process.core.model import DataStructure def test_get_mfile_initial_ixc_values(input_file, tmp_path): @@ -13,7 +14,7 @@ def test_get_mfile_initial_ixc_values(input_file, tmp_path): shutil.copy(input_file, tmp_input_file) iteration_variable_names, iteration_variable_values = get_mfile_initial_ixc_values( - Path(tmp_input_file) + Path(tmp_input_file), DataStructure() ) assert iteration_variable_names[0] == "b_plasma_toroidal_on_axis" diff --git a/tests/unit/models/blankets/test_blanket_library.py b/tests/unit/models/blankets/test_blanket_library.py index 802081873..c009e6472 100644 --- a/tests/unit/models/blankets/test_blanket_library.py +++ b/tests/unit/models/blankets/test_blanket_library.py @@ -6,24 +6,18 @@ from process.data_structure import ( build_variables, divertor_variables, - fwbs_variables, physics_variables, ) -from process.data_structure import build_variables as bv -from process.data_structure import fwbs_variables as fwbs -from process.data_structure import physics_variables as pv -from process.models.blankets.blanket_library import BlanketLibrary -from process.models.fw import FirstWall @pytest.fixture -def blanket_library_fixture(): +def blanket_library_fixture(process_models): """Provides BlanketLibrary object for testing. :returns: initialised BlanketLibrary object :rtype: process.blanket_library.BlanketLibrary """ - return BlanketLibrary(FirstWall()) + return process_models.blanket_library class PrimaryCoolantPropertiesParam(NamedTuple): @@ -159,127 +153,141 @@ def test_primary_coolant_properties( # monkeypatch doesnt work for strings # but helium is the default # monkeypatch.setattr( - # fwbs_variables, "i_fw_coolant_type", primarycoolantpropertiesparam.i_fw_coolant_type + # blanket_library_fixture.data.fwbs, "i_fw_coolant_type", primarycoolantpropertiesparam.i_fw_coolant_type # ) monkeypatch.setattr( - fwbs_variables, + blanket_library_fixture.data.fwbs, "temp_fw_coolant_in", primarycoolantpropertiesparam.temp_fw_coolant_in, ) monkeypatch.setattr( - fwbs_variables, + blanket_library_fixture.data.fwbs, "temp_fw_coolant_out", primarycoolantpropertiesparam.temp_fw_coolant_out, ) monkeypatch.setattr( - fwbs_variables, "pres_fw_coolant", primarycoolantpropertiesparam.pres_fw_coolant + blanket_library_fixture.data.fwbs, + "pres_fw_coolant", + primarycoolantpropertiesparam.pres_fw_coolant, ) monkeypatch.setattr( - fwbs_variables, "den_fw_coolant", primarycoolantpropertiesparam.den_fw_coolant + blanket_library_fixture.data.fwbs, + "den_fw_coolant", + primarycoolantpropertiesparam.den_fw_coolant, ) - monkeypatch.setattr(fwbs_variables, "cp_fw", primarycoolantpropertiesparam.cp_fw) + monkeypatch.setattr( + blanket_library_fixture.data.fwbs, "cp_fw", primarycoolantpropertiesparam.cp_fw + ) - monkeypatch.setattr(fwbs_variables, "cv_fw", primarycoolantpropertiesparam.cv_fw) + monkeypatch.setattr( + blanket_library_fixture.data.fwbs, "cv_fw", primarycoolantpropertiesparam.cv_fw + ) monkeypatch.setattr( - fwbs_variables, + blanket_library_fixture.data.fwbs, "i_blkt_coolant_type", primarycoolantpropertiesparam.i_blkt_coolant_type, ) monkeypatch.setattr( - fwbs_variables, + blanket_library_fixture.data.fwbs, "temp_blkt_coolant_in", primarycoolantpropertiesparam.temp_blkt_coolant_in, ) monkeypatch.setattr( - fwbs_variables, + blanket_library_fixture.data.fwbs, "temp_blkt_coolant_out", primarycoolantpropertiesparam.temp_blkt_coolant_out, ) monkeypatch.setattr( - fwbs_variables, + blanket_library_fixture.data.fwbs, "pres_blkt_coolant", primarycoolantpropertiesparam.pres_blkt_coolant, ) monkeypatch.setattr( - fwbs_variables, + blanket_library_fixture.data.fwbs, "den_blkt_coolant", primarycoolantpropertiesparam.den_blkt_coolant, ) monkeypatch.setattr( - fwbs_variables, + blanket_library_fixture.data.fwbs, "i_blkt_dual_coolant", primarycoolantpropertiesparam.i_blkt_dual_coolant, ) monkeypatch.setattr( - fwbs_variables, + blanket_library_fixture.data.fwbs, "visc_blkt_coolant", primarycoolantpropertiesparam.visc_blkt_coolant, ) - monkeypatch.setattr(fwbs_variables, "cp_bl", primarycoolantpropertiesparam.cp_bl) + monkeypatch.setattr( + blanket_library_fixture.data.fwbs, "cp_bl", primarycoolantpropertiesparam.cp_bl + ) - monkeypatch.setattr(fwbs_variables, "cv_bl", primarycoolantpropertiesparam.cv_bl) + monkeypatch.setattr( + blanket_library_fixture.data.fwbs, "cv_bl", primarycoolantpropertiesparam.cv_bl + ) monkeypatch.setattr( - fwbs_variables, "visc_fw_coolant", primarycoolantpropertiesparam.visc_fw_coolant + blanket_library_fixture.data.fwbs, + "visc_fw_coolant", + primarycoolantpropertiesparam.visc_fw_coolant, ) monkeypatch.setattr( - fwbs_variables, + blanket_library_fixture.data.fwbs, "i_fw_blkt_shared_coolant", primarycoolantpropertiesparam.i_fw_blkt_shared_coolant, ) blanket_library_fixture.primary_coolant_properties(output=False) - assert fwbs_variables.den_fw_coolant == pytest.approx( + assert blanket_library_fixture.data.fwbs.den_fw_coolant == pytest.approx( primarycoolantpropertiesparam.expected_den_fw_coolant, rel=1e-4 ) - assert fwbs_variables.cp_fw == pytest.approx( + assert blanket_library_fixture.data.fwbs.cp_fw == pytest.approx( primarycoolantpropertiesparam.expected_cp_fw, rel=1e-4 ) - assert fwbs_variables.cv_fw == pytest.approx( + assert blanket_library_fixture.data.fwbs.cv_fw == pytest.approx( primarycoolantpropertiesparam.expected_cv_fw, rel=1e-4 ) - assert fwbs_variables.den_blkt_coolant == pytest.approx( + assert blanket_library_fixture.data.fwbs.den_blkt_coolant == pytest.approx( primarycoolantpropertiesparam.expected_den_blkt_coolant, rel=1e-4 ) - assert fwbs_variables.visc_blkt_coolant == pytest.approx( + assert blanket_library_fixture.data.fwbs.visc_blkt_coolant == pytest.approx( primarycoolantpropertiesparam.expected_visc_blkt_coolant, rel=1e-4 ) - assert fwbs_variables.cp_bl == pytest.approx( + assert blanket_library_fixture.data.fwbs.cp_bl == pytest.approx( primarycoolantpropertiesparam.expected_cp_bl, rel=1e-4 ) - assert fwbs_variables.cv_bl == pytest.approx( + assert blanket_library_fixture.data.fwbs.cv_bl == pytest.approx( primarycoolantpropertiesparam.expected_cv_bl, rel=1e-4 ) - assert fwbs_variables.visc_fw_coolant == pytest.approx( + assert blanket_library_fixture.data.fwbs.visc_fw_coolant == pytest.approx( primarycoolantpropertiesparam.expected_visc_fw_coolant, rel=1e-4 ) def test_deltap_tot_inboard_first_wall(monkeypatch, blanket_library_fixture): - monkeypatch.setattr(fwbs_variables, "radius_fw_channel", 0.006) - monkeypatch.setattr(fwbs_variables, "a_bz_liq", 0.22481) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "radius_fw_channel", 0.006) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "a_bz_liq", 0.22481) data = { "icoolpump": 1, @@ -304,13 +312,17 @@ def test_deltap_tot_inboard_first_wall(monkeypatch, blanket_library_fixture): def test_deltap_tot_outboard_blanket_breeder_liquid( monkeypatch, blanket_library_fixture ): - monkeypatch.setattr(fwbs_variables, "radius_fw_channel", 0.006) - monkeypatch.setattr(fwbs_variables, "a_bz_liq", 0.22481) - monkeypatch.setattr(fwbs_variables, "i_blkt_liquid_breeder_channel_type", 1) - monkeypatch.setattr(fwbs_variables, "b_bz_liq", 0.11625) - monkeypatch.setattr(fwbs_variables, "b_mag_blkt", [8.393, 3.868]) - monkeypatch.setattr(fwbs_variables, "bz_channel_conduct_liq", 833000) - monkeypatch.setattr(fwbs_variables, "th_wall_secondary", 0.0125) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "radius_fw_channel", 0.006) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "a_bz_liq", 0.22481) + monkeypatch.setattr( + blanket_library_fixture.data.fwbs, "i_blkt_liquid_breeder_channel_type", 1 + ) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "b_bz_liq", 0.11625) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "b_mag_blkt", [8.393, 3.868]) + monkeypatch.setattr( + blanket_library_fixture.data.fwbs, "bz_channel_conduct_liq", 833000 + ) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "th_wall_secondary", 0.0125) data = { "icoolpump": 2, @@ -333,8 +345,8 @@ def test_deltap_tot_outboard_blanket_breeder_liquid( def test_pumppower_primary_helium(monkeypatch, blanket_library_fixture): - monkeypatch.setattr(fwbs_variables, "etaiso", 0.9) - monkeypatch.setattr(fwbs_variables, "etaiso_liq", 0.85) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "etaiso", 0.9) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "etaiso_liq", 0.85) data = { "i_liquid_breeder": 2, @@ -355,8 +367,8 @@ def test_pumppower_primary_helium(monkeypatch, blanket_library_fixture): def test_pumppower_secondary_pb_li(monkeypatch, blanket_library_fixture): - monkeypatch.setattr(fwbs_variables, "etaiso", 0.9) - monkeypatch.setattr(fwbs_variables, "etaiso_liq", 0.85) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "etaiso", 0.9) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "etaiso_liq", 0.85) data = { "i_liquid_breeder": 1, @@ -546,34 +558,46 @@ def test_apply_coverage_factors( applycoveragefactorsparam.a_blkt_inboard_surface_full_coverage, ) monkeypatch.setattr( - fwbs_variables, "f_ster_div_single", applycoveragefactorsparam.f_ster_div_single + blanket_library_fixture.data.fwbs, + "f_ster_div_single", + applycoveragefactorsparam.f_ster_div_single, ) monkeypatch.setattr( - fwbs_variables, + blanket_library_fixture.data.fwbs, "f_a_fw_outboard_hcd", applycoveragefactorsparam.f_a_fw_outboard_hcd, ) monkeypatch.setattr( - fwbs_variables, "vol_blkt_outboard", applycoveragefactorsparam.vol_blkt_outboard + blanket_library_fixture.data.fwbs, + "vol_blkt_outboard", + applycoveragefactorsparam.vol_blkt_outboard, ) monkeypatch.setattr( - fwbs_variables, "vol_blkt_inboard", applycoveragefactorsparam.vol_blkt_inboard + blanket_library_fixture.data.fwbs, + "vol_blkt_inboard", + applycoveragefactorsparam.vol_blkt_inboard, ) monkeypatch.setattr( - fwbs_variables, + blanket_library_fixture.data.fwbs, "vol_blkt_inboard_full_coverage", applycoveragefactorsparam.vol_blkt_inboard_full_coverage, ) monkeypatch.setattr( - fwbs_variables, "vol_blkt_total", applycoveragefactorsparam.vol_blkt_total + blanket_library_fixture.data.fwbs, + "vol_blkt_total", + applycoveragefactorsparam.vol_blkt_total, ) monkeypatch.setattr( - fwbs_variables, + blanket_library_fixture.data.fwbs, "vol_blkt_total_full_coverage", applycoveragefactorsparam.vol_blkt_total_full_coverage, ) - monkeypatch.setattr(fwbs_variables, "fvolsi", applycoveragefactorsparam.fvolsi) - monkeypatch.setattr(fwbs_variables, "fvolso", applycoveragefactorsparam.fvolso) + monkeypatch.setattr( + blanket_library_fixture.data.fwbs, "fvolsi", applycoveragefactorsparam.fvolsi + ) + monkeypatch.setattr( + blanket_library_fixture.data.fwbs, "fvolso", applycoveragefactorsparam.fvolso + ) monkeypatch.setattr( divertor_variables, "n_divertors", applycoveragefactorsparam.n_divertors ) @@ -586,10 +610,10 @@ def test_apply_coverage_factors( assert build_variables.a_blkt_total_surface == pytest.approx( applycoveragefactorsparam.expected_a_blkt_total_surface ) - assert fwbs_variables.vol_blkt_outboard == pytest.approx( + assert blanket_library_fixture.data.fwbs.vol_blkt_outboard == pytest.approx( applycoveragefactorsparam.expected_vol_blkt_outboard ) - assert fwbs_variables.vol_blkt_total == pytest.approx( + assert blanket_library_fixture.data.fwbs.vol_blkt_total == pytest.approx( applycoveragefactorsparam.expected_volblkt ) @@ -885,54 +909,72 @@ def test_liquid_breeder_properties( :type monkeypatch: _pytest.monkeypatch.monkeypatch """ monkeypatch.setattr( - fwbs_variables, "inlet_temp_liq", liquidbreederpropertiesparam.inlet_temp_liq + blanket_library_fixture.data.fwbs, + "inlet_temp_liq", + liquidbreederpropertiesparam.inlet_temp_liq, + ) + monkeypatch.setattr( + blanket_library_fixture.data.fwbs, + "outlet_temp_liq", + liquidbreederpropertiesparam.outlet_temp_liq, ) monkeypatch.setattr( - fwbs_variables, "outlet_temp_liq", liquidbreederpropertiesparam.outlet_temp_liq + blanket_library_fixture.data.fwbs, + "a_bz_liq", + liquidbreederpropertiesparam.a_bz_liq, ) monkeypatch.setattr( - fwbs_variables, "a_bz_liq", liquidbreederpropertiesparam.a_bz_liq + blanket_library_fixture.data.fwbs, + "b_bz_liq", + liquidbreederpropertiesparam.b_bz_liq, ) monkeypatch.setattr( - fwbs_variables, "b_bz_liq", liquidbreederpropertiesparam.b_bz_liq + blanket_library_fixture.data.fwbs, + "den_liq", + liquidbreederpropertiesparam.den_liq, ) - monkeypatch.setattr(fwbs_variables, "den_liq", liquidbreederpropertiesparam.den_liq) monkeypatch.setattr( - fwbs_variables, + blanket_library_fixture.data.fwbs, "specific_heat_liq", liquidbreederpropertiesparam.specific_heat_liq, ) monkeypatch.setattr( - fwbs_variables, + blanket_library_fixture.data.fwbs, "thermal_conductivity_liq", liquidbreederpropertiesparam.thermal_conductivity_liq, ) monkeypatch.setattr( - fwbs_variables, + blanket_library_fixture.data.fwbs, "dynamic_viscosity_liq", liquidbreederpropertiesparam.dynamic_viscosity_liq, ) monkeypatch.setattr( - fwbs_variables, + blanket_library_fixture.data.fwbs, "electrical_conductivity_liq", liquidbreederpropertiesparam.electrical_conductivity_liq, ) monkeypatch.setattr( - fwbs_variables, + blanket_library_fixture.data.fwbs, "i_blkt_liquid_breeder_type", liquidbreederpropertiesparam.i_blkt_liquid_breeder_type, ) monkeypatch.setattr( - fwbs_variables, "hartmann_liq", liquidbreederpropertiesparam.hartmann_liq + blanket_library_fixture.data.fwbs, + "hartmann_liq", + liquidbreederpropertiesparam.hartmann_liq, ) monkeypatch.setattr( - fwbs_variables, "b_mag_blkt", liquidbreederpropertiesparam.b_mag_blkt + blanket_library_fixture.data.fwbs, + "b_mag_blkt", + liquidbreederpropertiesparam.b_mag_blkt, ) monkeypatch.setattr( - fwbs_variables, "i_blkt_inboard", liquidbreederpropertiesparam.i_blkt_inboard + blanket_library_fixture.data.fwbs, + "i_blkt_inboard", + liquidbreederpropertiesparam.i_blkt_inboard, ) monkeypatch.setattr( - fwbs_variables, + blanket_library_fixture.data.fwbs, "i_blkt_dual_coolant", liquidbreederpropertiesparam.i_blkt_dual_coolant, ) @@ -954,25 +996,28 @@ def test_liquid_breeder_properties( blanket_library_fixture.liquid_breeder_properties() - assert fwbs_variables.den_liq == pytest.approx( + assert blanket_library_fixture.data.fwbs.den_liq == pytest.approx( liquidbreederpropertiesparam.expected_den_liq ) - assert fwbs_variables.specific_heat_liq == pytest.approx( + assert blanket_library_fixture.data.fwbs.specific_heat_liq == pytest.approx( liquidbreederpropertiesparam.expected_specific_heat_liq ) - assert fwbs_variables.thermal_conductivity_liq == pytest.approx( + assert blanket_library_fixture.data.fwbs.thermal_conductivity_liq == pytest.approx( liquidbreederpropertiesparam.expected_thermal_conductivity_liq ) - assert fwbs_variables.dynamic_viscosity_liq == pytest.approx( + assert blanket_library_fixture.data.fwbs.dynamic_viscosity_liq == pytest.approx( liquidbreederpropertiesparam.expected_dynamic_viscosity_liq ) - assert fwbs_variables.electrical_conductivity_liq == pytest.approx( - liquidbreederpropertiesparam.expected_electrical_conductivity_liq + assert ( + blanket_library_fixture.data.fwbs.electrical_conductivity_liq + == pytest.approx( + liquidbreederpropertiesparam.expected_electrical_conductivity_liq + ) ) - assert fwbs_variables.hartmann_liq == pytest.approx( + assert blanket_library_fixture.data.fwbs.hartmann_liq == pytest.approx( liquidbreederpropertiesparam.expected_hartmann_liq ) - assert fwbs_variables.b_mag_blkt == pytest.approx( + assert blanket_library_fixture.data.fwbs.b_mag_blkt == pytest.approx( liquidbreederpropertiesparam.expected_b_mag_blkt ) @@ -1050,12 +1095,20 @@ def test_pressure_drop(pressuredropparam, monkeypatch, blanket_library_fixture): :type monkeypatch: _pytest.monkeypatch.monkeypatch """ monkeypatch.setattr( - fwbs_variables, "radius_fw_channel", pressuredropparam.radius_fw_channel + blanket_library_fixture.data.fwbs, + "radius_fw_channel", + pressuredropparam.radius_fw_channel, + ) + monkeypatch.setattr( + blanket_library_fixture.data.fwbs, "a_bz_liq", pressuredropparam.a_bz_liq ) - monkeypatch.setattr(fwbs_variables, "a_bz_liq", pressuredropparam.a_bz_liq) - monkeypatch.setattr(fwbs_variables, "b_bz_liq", pressuredropparam.b_bz_liq) monkeypatch.setattr( - fwbs_variables, "roughness_fw_channel", pressuredropparam.roughness_fw_channel + blanket_library_fixture.data.fwbs, "b_bz_liq", pressuredropparam.b_bz_liq + ) + monkeypatch.setattr( + blanket_library_fixture.data.fwbs, + "roughness_fw_channel", + pressuredropparam.roughness_fw_channel, ) pressure_drop_out = blanket_library_fixture.coolant_friction_pressure_drop( @@ -1189,26 +1242,32 @@ def test_liquid_breeder_pressure_drop_mhd( :type monkeypatch: _pytest.monkeypatch.monkeypatch """ monkeypatch.setattr( - fwbs_variables, + blanket_library_fixture.data.fwbs, "i_blkt_liquid_breeder_channel_type", liquidbreederpressuredropmhdparam.i_blkt_liquid_breeder_channel_type, ) monkeypatch.setattr( - fwbs_variables, "a_bz_liq", liquidbreederpressuredropmhdparam.a_bz_liq + blanket_library_fixture.data.fwbs, + "a_bz_liq", + liquidbreederpressuredropmhdparam.a_bz_liq, ) monkeypatch.setattr( - fwbs_variables, "b_bz_liq", liquidbreederpressuredropmhdparam.b_bz_liq + blanket_library_fixture.data.fwbs, + "b_bz_liq", + liquidbreederpressuredropmhdparam.b_bz_liq, ) monkeypatch.setattr( - fwbs_variables, "b_mag_blkt", liquidbreederpressuredropmhdparam.b_mag_blkt + blanket_library_fixture.data.fwbs, + "b_mag_blkt", + liquidbreederpressuredropmhdparam.b_mag_blkt, ) monkeypatch.setattr( - fwbs_variables, + blanket_library_fixture.data.fwbs, "bz_channel_conduct_liq", liquidbreederpressuredropmhdparam.bz_channel_conduct_liq, ) monkeypatch.setattr( - fwbs_variables, + blanket_library_fixture.data.fwbs, "th_wall_secondary", liquidbreederpressuredropmhdparam.th_wall_secondary, ) @@ -1537,9 +1596,9 @@ def test_hydraulic_diameter(monkeypatch, blanket_library_fixture): Test for hydraulic_diameter function. """ # Set var values - monkeypatch.setattr(fwbs, "radius_fw_channel", 1.0) - monkeypatch.setattr(fwbs, "a_bz_liq", 1.0) - monkeypatch.setattr(fwbs, "b_bz_liq", 1.0) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "radius_fw_channel", 1.0) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "a_bz_liq", 1.0) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "b_bz_liq", 1.0) # hydraulic_diameter input = i_channel_shape: 1 = circle, 2 = rectangle # 2.0D0*radius_fw_channel @@ -1578,9 +1637,9 @@ def test_flow_velocity(monkeypatch, blanket_library_fixture): Test for flow_velocity function. """ # Set var values - monkeypatch.setattr(fwbs, "radius_fw_channel", 1.0) - monkeypatch.setattr(fwbs, "a_bz_liq", 1.0) - monkeypatch.setattr(fwbs, "b_bz_liq", 1.0) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "radius_fw_channel", 1.0) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "a_bz_liq", 1.0) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "b_bz_liq", 1.0) # input = i_channel_shape, mass_flow_rate, flow_density assert blanket_library_fixture.flow_velocity(1, 1, 1) == pytest.approx( @@ -1597,41 +1656,84 @@ def test_liquid_breeder_properties_part_1(monkeypatch, blanket_library_fixture): PbLi or Li, with inboard blanket, no inlet/outlet temp difference. """ # Set var values - monkeypatch.setattr(fwbs, "a_bz_liq", 0.2) - monkeypatch.setattr(pv, "b_plasma_toroidal_on_axis", 6.0) - monkeypatch.setattr(pv, "rmajor", 8.0) - monkeypatch.setattr(pv, "aspect", 3.0) - monkeypatch.setattr(bv, "dr_blkt_inboard", 0.1) - monkeypatch.setattr(bv, "dr_blkt_outboard", 0.2) - monkeypatch.setattr(fwbs, "i_blkt_inboard", 1) - monkeypatch.setattr(fwbs, "inlet_temp_liq", 1.0) - monkeypatch.setattr(fwbs, "outlet_temp_liq", 1.0) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "a_bz_liq", 0.2) + monkeypatch.setattr(physics_variables, "b_plasma_toroidal_on_axis", 6.0) + monkeypatch.setattr(physics_variables, "rmajor", 8.0) + monkeypatch.setattr(physics_variables, "aspect", 3.0) + monkeypatch.setattr(build_variables, "dr_blkt_inboard", 0.1) + monkeypatch.setattr(build_variables, "dr_blkt_outboard", 0.2) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "i_blkt_inboard", 1) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "inlet_temp_liq", 1.0) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "outlet_temp_liq", 1.0) # PbLi - see [Fer2020] for relavent equations - monkeypatch.setattr(fwbs, "i_blkt_liquid_breeder_type", 0) + monkeypatch.setattr( + blanket_library_fixture.data.fwbs, "i_blkt_liquid_breeder_type", 0 + ) blanket_library_fixture.liquid_breeder_properties() - assert pytest.approx(fwbs.den_liq, rel=1e-3) == 1.052e4 - assert pytest.approx(fwbs.specific_heat_liq, rel=1e-3) == 195.0 - assert pytest.approx(fwbs.thermal_conductivity_liq, rel=1e-3) == -3.384 - assert pytest.approx(fwbs.dynamic_viscosity_liq, rel=1e-3) == 0.0155 - assert pytest.approx(fwbs.electrical_conductivity_liq, rel=1e-3) == 9.71e5 + assert pytest.approx(blanket_library_fixture.data.fwbs.den_liq, rel=1e-3) == 1.052e4 + assert ( + pytest.approx(blanket_library_fixture.data.fwbs.specific_heat_liq, rel=1e-3) + == 195.0 + ) + assert ( + pytest.approx( + blanket_library_fixture.data.fwbs.thermal_conductivity_liq, rel=1e-3 + ) + == -3.384 + ) + assert ( + pytest.approx(blanket_library_fixture.data.fwbs.dynamic_viscosity_liq, rel=1e-3) + == 0.0155 + ) + assert ( + pytest.approx( + blanket_library_fixture.data.fwbs.electrical_conductivity_liq, rel=1e-3 + ) + == 9.71e5 + ) - assert pytest.approx(fwbs.b_mag_blkt, rel=1e-3) == (9.085, 4.458) - assert pytest.approx(fwbs.hartmann_liq, rel=1e-3) == (7.189e3, 3.528e3) + assert pytest.approx(blanket_library_fixture.data.fwbs.b_mag_blkt, rel=1e-3) == ( + 9.085, + 4.458, + ) + assert pytest.approx(blanket_library_fixture.data.fwbs.hartmann_liq, rel=1e-3) == ( + 7.189e3, + 3.528e3, + ) # Li - see [Lyublinski et al., 2009] for relavent equations - monkeypatch.setattr(fwbs, "i_blkt_liquid_breeder_type", 1) + monkeypatch.setattr( + blanket_library_fixture.data.fwbs, "i_blkt_liquid_breeder_type", 1 + ) blanket_library_fixture.liquid_breeder_properties() - assert pytest.approx(fwbs.den_liq, rel=1e-3) == 504.0 - assert pytest.approx(fwbs.specific_heat_liq, rel=1e-3) == 2.833e6 - assert pytest.approx(fwbs.dynamic_viscosity_liq, rel=1e-3) == 1.051e112 - assert pytest.approx(fwbs.electrical_conductivity_liq, rel=1e-3) == 9.27e8 - assert pytest.approx(fwbs.b_mag_blkt, rel=1e-3) == (9.085, 4.458) - assert pytest.approx(fwbs.hartmann_liq, rel=1e-3) == (2.7e-53, 1.3e-53) + assert pytest.approx(blanket_library_fixture.data.fwbs.den_liq, rel=1e-3) == 504.0 + assert ( + pytest.approx(blanket_library_fixture.data.fwbs.specific_heat_liq, rel=1e-3) + == 2.833e6 + ) + assert ( + pytest.approx(blanket_library_fixture.data.fwbs.dynamic_viscosity_liq, rel=1e-3) + == 1.051e112 + ) + assert ( + pytest.approx( + blanket_library_fixture.data.fwbs.electrical_conductivity_liq, rel=1e-3 + ) + == 9.27e8 + ) + assert pytest.approx(blanket_library_fixture.data.fwbs.b_mag_blkt, rel=1e-3) == ( + 9.085, + 4.458, + ) + assert pytest.approx(blanket_library_fixture.data.fwbs.hartmann_liq, rel=1e-3) == ( + 2.7e-53, + 1.3e-53, + ) # con_vsc_rat = electrical_conductivity_liq/dynamic_viscosity_liq # hartmann_liq = b_mag_blkt * a_bz_liq/2.0D0 * sqrt(con_vsc_rat) @@ -1642,20 +1744,25 @@ def test_liquid_breeder_properties_part_2(monkeypatch, blanket_library_fixture): Test for liquid_breeder_properties procedure. No inboard blanket. """ # Set var values - monkeypatch.setattr(fwbs, "a_bz_liq", 0.2) - monkeypatch.setattr(pv, "b_plasma_toroidal_on_axis", 6.0) - monkeypatch.setattr(pv, "rmajor", 8.0) - monkeypatch.setattr(pv, "aspect", 3.0) - monkeypatch.setattr(bv, "dr_blkt_inboard", 0.0) - monkeypatch.setattr(bv, "dr_blkt_outboard", 0.2) - monkeypatch.setattr(fwbs, "i_blkt_inboard", 0) - monkeypatch.setattr(fwbs, "i_blkt_liquid_breeder_type", 0) - monkeypatch.setattr(fwbs, "inlet_temp_liq", 0.0) - monkeypatch.setattr(fwbs, "outlet_temp_liq", 0.0) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "a_bz_liq", 0.2) + monkeypatch.setattr(physics_variables, "b_plasma_toroidal_on_axis", 6.0) + monkeypatch.setattr(physics_variables, "rmajor", 8.0) + monkeypatch.setattr(physics_variables, "aspect", 3.0) + monkeypatch.setattr(build_variables, "dr_blkt_inboard", 0.0) + monkeypatch.setattr(build_variables, "dr_blkt_outboard", 0.2) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "i_blkt_inboard", 0) + monkeypatch.setattr( + blanket_library_fixture.data.fwbs, "i_blkt_liquid_breeder_type", 0 + ) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "inlet_temp_liq", 0.0) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "outlet_temp_liq", 0.0) blanket_library_fixture.liquid_breeder_properties() - assert pytest.approx(fwbs.b_mag_blkt, rel=1e-3) == (8.999, 4.458) + assert pytest.approx(blanket_library_fixture.data.fwbs.b_mag_blkt, rel=1e-3) == ( + 8.999, + 4.458, + ) def test_liquid_breeder_properties_part_3(monkeypatch, blanket_library_fixture): @@ -1664,23 +1771,27 @@ def test_liquid_breeder_properties_part_3(monkeypatch, blanket_library_fixture): With inlet/outlet temp difference. """ # Set var values - monkeypatch.setattr(fwbs, "a_bz_liq", 0.2) - monkeypatch.setattr(pv, "b_plasma_toroidal_on_axis", 6.0) - monkeypatch.setattr(pv, "rmajor", 8.0) - monkeypatch.setattr(pv, "aspect", 3.0) - monkeypatch.setattr(bv, "dr_blkt_inboard", 0.1) - monkeypatch.setattr(bv, "dr_blkt_outboard", 0.2) - monkeypatch.setattr(fwbs, "i_blkt_inboard", 1) - monkeypatch.setattr(fwbs, "inlet_temp_liq", 0.0) - monkeypatch.setattr(fwbs, "outlet_temp_liq", 1.0) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "a_bz_liq", 0.2) + monkeypatch.setattr(physics_variables, "b_plasma_toroidal_on_axis", 6.0) + monkeypatch.setattr(physics_variables, "rmajor", 8.0) + monkeypatch.setattr(physics_variables, "aspect", 3.0) + monkeypatch.setattr(build_variables, "dr_blkt_inboard", 0.1) + monkeypatch.setattr(build_variables, "dr_blkt_outboard", 0.2) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "i_blkt_inboard", 1) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "inlet_temp_liq", 0.0) + monkeypatch.setattr(blanket_library_fixture.data.fwbs, "outlet_temp_liq", 1.0) # PbLi - see [Fer2020] for relavent equations - monkeypatch.setattr(fwbs, "i_blkt_liquid_breeder_type", 0) + monkeypatch.setattr( + blanket_library_fixture.data.fwbs, "i_blkt_liquid_breeder_type", 0 + ) blanket_library_fixture.liquid_breeder_properties() - assert pytest.approx(fwbs.den_liq, rel=1e-3) == 1.052e4 + assert pytest.approx(blanket_library_fixture.data.fwbs.den_liq, rel=1e-3) == 1.052e4 # Li - see [Lyublinski et al., 2009] for relavent equations - monkeypatch.setattr(fwbs, "i_blkt_liquid_breeder_type", 1) + monkeypatch.setattr( + blanket_library_fixture.data.fwbs, "i_blkt_liquid_breeder_type", 1 + ) blanket_library_fixture.liquid_breeder_properties() - assert pytest.approx(fwbs.den_liq, rel=1e-3) == 504.0 + assert pytest.approx(blanket_library_fixture.data.fwbs.den_liq, rel=1e-3) == 504.0 diff --git a/tests/unit/models/blankets/test_ccfe_hcpb.py b/tests/unit/models/blankets/test_ccfe_hcpb.py index 84914a497..7b71c4e11 100644 --- a/tests/unit/models/blankets/test_ccfe_hcpb.py +++ b/tests/unit/models/blankets/test_ccfe_hcpb.py @@ -7,7 +7,6 @@ ccfe_hcpb_module, current_drive_variables, divertor_variables, - fwbs_variables, global_variables, heat_transport_variables, physics_variables, @@ -263,57 +262,59 @@ def test_nuclear_heating_magnets(nuclearheatingmagnetsparam, monkeypatch, ccfe_h ) monkeypatch.setattr( - fwbs_variables, + ccfe_hcpb.data.fwbs, "radius_fw_channel", nuclearheatingmagnetsparam.radius_fw_channel, ) monkeypatch.setattr( - fwbs_variables, "dx_fw_module", nuclearheatingmagnetsparam.dx_fw_module + ccfe_hcpb.data.fwbs, "dx_fw_module", nuclearheatingmagnetsparam.dx_fw_module ) monkeypatch.setattr( - fwbs_variables, "den_steel", nuclearheatingmagnetsparam.den_steel + ccfe_hcpb.data.fwbs, "den_steel", nuclearheatingmagnetsparam.den_steel ) monkeypatch.setattr( - fwbs_variables, "m_blkt_total", nuclearheatingmagnetsparam.m_blkt_total + ccfe_hcpb.data.fwbs, "m_blkt_total", nuclearheatingmagnetsparam.m_blkt_total ) monkeypatch.setattr( - fwbs_variables, "vol_blkt_total", nuclearheatingmagnetsparam.vol_blkt_total + ccfe_hcpb.data.fwbs, "vol_blkt_total", nuclearheatingmagnetsparam.vol_blkt_total ) - monkeypatch.setattr(fwbs_variables, "whtshld", nuclearheatingmagnetsparam.whtshld) + monkeypatch.setattr( + ccfe_hcpb.data.fwbs, "whtshld", nuclearheatingmagnetsparam.whtshld + ) monkeypatch.setattr( - fwbs_variables, "vol_shld_total", nuclearheatingmagnetsparam.vol_shld_total + ccfe_hcpb.data.fwbs, "vol_shld_total", nuclearheatingmagnetsparam.vol_shld_total ) - monkeypatch.setattr(fwbs_variables, "m_vv", nuclearheatingmagnetsparam.m_vv) + monkeypatch.setattr(ccfe_hcpb.data.fwbs, "m_vv", nuclearheatingmagnetsparam.m_vv) - monkeypatch.setattr(fwbs_variables, "vol_vv", nuclearheatingmagnetsparam.vol_vv) + monkeypatch.setattr(ccfe_hcpb.data.fwbs, "vol_vv", nuclearheatingmagnetsparam.vol_vv) monkeypatch.setattr( - fwbs_variables, + ccfe_hcpb.data.fwbs, "fw_armour_thickness", nuclearheatingmagnetsparam.fw_armour_thickness, ) monkeypatch.setattr( - fwbs_variables, + ccfe_hcpb.data.fwbs, "p_tf_nuclear_heat_mw", nuclearheatingmagnetsparam.p_tf_nuclear_heat_mw, ) monkeypatch.setattr( - fwbs_variables, + ccfe_hcpb.data.fwbs, "f_a_fw_coolant_inboard", nuclearheatingmagnetsparam.f_a_fw_coolant_inboard, ) monkeypatch.setattr( - fwbs_variables, + ccfe_hcpb.data.fwbs, "f_a_fw_coolant_outboard", nuclearheatingmagnetsparam.f_a_fw_coolant_outboard, ) @@ -372,15 +373,15 @@ def test_nuclear_heating_magnets(nuclearheatingmagnetsparam, monkeypatch, ccfe_h ccfe_hcpb.nuclear_heating_magnets(False) - assert fwbs_variables.p_tf_nuclear_heat_mw == pytest.approx( + assert ccfe_hcpb.data.fwbs.p_tf_nuclear_heat_mw == pytest.approx( nuclearheatingmagnetsparam.expected_p_tf_nuclear_heat_mw ) - assert fwbs_variables.f_a_fw_coolant_inboard == pytest.approx( + assert ccfe_hcpb.data.fwbs.f_a_fw_coolant_inboard == pytest.approx( nuclearheatingmagnetsparam.expected_f_a_fw_coolant_inboard ) - assert fwbs_variables.f_a_fw_coolant_outboard == pytest.approx( + assert ccfe_hcpb.data.fwbs.f_a_fw_coolant_outboard == pytest.approx( nuclearheatingmagnetsparam.expected_f_a_fw_coolant_outboard ) @@ -464,12 +465,14 @@ def test_nuclear_heating_fw(nuclearheatingfwparam, monkeypatch, ccfe_hcpb): """ monkeypatch.setattr( - fwbs_variables, + ccfe_hcpb.data.fwbs, "p_fw_nuclear_heat_total_mw", nuclearheatingfwparam.p_fw_nuclear_heat_total_mw, ) - monkeypatch.setattr(fwbs_variables, "m_fw_total", nuclearheatingfwparam.m_fw_total) + monkeypatch.setattr( + ccfe_hcpb.data.fwbs, "m_fw_total", nuclearheatingfwparam.m_fw_total + ) monkeypatch.setattr( physics_variables, "p_fusion_total_mw", nuclearheatingfwparam.p_fusion_total_mw @@ -872,80 +875,86 @@ def test_powerflow_calc(powerflowcalcparam, monkeypatch, ccfe_hcpb): ) monkeypatch.setattr( - fwbs_variables, "f_ster_div_single", powerflowcalcparam.f_ster_div_single + ccfe_hcpb.data.fwbs, "f_ster_div_single", powerflowcalcparam.f_ster_div_single ) monkeypatch.setattr( - fwbs_variables, "p_div_rad_total_mw", powerflowcalcparam.p_div_rad_total_mw + ccfe_hcpb.data.fwbs, "p_div_rad_total_mw", powerflowcalcparam.p_div_rad_total_mw ) monkeypatch.setattr( - fwbs_variables, + ccfe_hcpb.data.fwbs, "p_fw_hcd_rad_total_mw", powerflowcalcparam.p_fw_hcd_rad_total_mw, ) monkeypatch.setattr( - fwbs_variables, "f_a_fw_outboard_hcd", powerflowcalcparam.f_a_fw_outboard_hcd + ccfe_hcpb.data.fwbs, + "f_a_fw_outboard_hcd", + powerflowcalcparam.f_a_fw_outboard_hcd, ) monkeypatch.setattr( - fwbs_variables, "p_fw_rad_total_mw", powerflowcalcparam.p_fw_rad_total_mw + ccfe_hcpb.data.fwbs, "p_fw_rad_total_mw", powerflowcalcparam.p_fw_rad_total_mw ) monkeypatch.setattr( - fwbs_variables, "i_blkt_coolant_type", powerflowcalcparam.i_blkt_coolant_type + ccfe_hcpb.data.fwbs, + "i_blkt_coolant_type", + powerflowcalcparam.i_blkt_coolant_type, ) monkeypatch.setattr( - fwbs_variables, + ccfe_hcpb.data.fwbs, "temp_blkt_coolant_out", powerflowcalcparam.temp_blkt_coolant_out, ) monkeypatch.setattr( - fwbs_variables, "pres_blkt_coolant", powerflowcalcparam.pres_blkt_coolant + ccfe_hcpb.data.fwbs, "pres_blkt_coolant", powerflowcalcparam.pres_blkt_coolant ) monkeypatch.setattr( - fwbs_variables, "i_p_coolant_pumping", powerflowcalcparam.i_p_coolant_pumping + ccfe_hcpb.data.fwbs, + "i_p_coolant_pumping", + powerflowcalcparam.i_p_coolant_pumping, ) monkeypatch.setattr( - fwbs_variables, + ccfe_hcpb.data.fwbs, "p_fw_nuclear_heat_total_mw", powerflowcalcparam.p_fw_nuclear_heat_total_mw, ) monkeypatch.setattr( - fwbs_variables, + ccfe_hcpb.data.fwbs, "p_blkt_nuclear_heat_total_mw", powerflowcalcparam.p_blkt_nuclear_heat_total_mw, ) monkeypatch.setattr( - fwbs_variables, + ccfe_hcpb.data.fwbs, "p_div_nuclear_heat_total_mw", powerflowcalcparam.p_div_nuclear_heat_total_mw, ) monkeypatch.setattr( - fwbs_variables, + ccfe_hcpb.data.fwbs, "p_shld_nuclear_heat_mw", powerflowcalcparam.p_shld_nuclear_heat_mw, ) - monkeypatch.setattr(fwbs_variables, "etaiso", powerflowcalcparam.etaiso) + monkeypatch.setattr(ccfe_hcpb.data.fwbs, "etaiso", powerflowcalcparam.etaiso) monkeypatch.setattr( - fwbs_variables, + ccfe_hcpb.data.fwbs, "p_cp_shield_nuclear_heat_mw", powerflowcalcparam.p_cp_shield_nuclear_heat_mw, ) - monkeypatch.setattr(fwbs_variables, "psurffwi", powerflowcalcparam.psurffwi) + monkeypatch.setattr(ccfe_hcpb.data.fwbs, "psurffwi", powerflowcalcparam.psurffwi) - monkeypatch.setattr(fwbs_variables, "psurffwo", powerflowcalcparam.psurffwo) + monkeypatch.setattr(ccfe_hcpb.data.fwbs, "psurffwo", powerflowcalcparam.psurffwo) monkeypatch.setattr( heat_transport_variables, @@ -1035,13 +1044,17 @@ def test_powerflow_calc(powerflowcalcparam, monkeypatch, ccfe_hcpb): ccfe_hcpb.powerflow_calc(False) - assert fwbs_variables.p_fw_rad_total_mw == pytest.approx( + assert ccfe_hcpb.data.fwbs.p_fw_rad_total_mw == pytest.approx( powerflowcalcparam.expected_p_fw_rad_total_mw ) - assert fwbs_variables.psurffwi == pytest.approx(powerflowcalcparam.expected_psurffwi) + assert ccfe_hcpb.data.fwbs.psurffwi == pytest.approx( + powerflowcalcparam.expected_psurffwi + ) - assert fwbs_variables.psurffwo == pytest.approx(powerflowcalcparam.expected_psurffwo) + assert ccfe_hcpb.data.fwbs.psurffwo == pytest.approx( + powerflowcalcparam.expected_psurffwo + ) assert heat_transport_variables.p_shld_coolant_pump_mw == pytest.approx( powerflowcalcparam.expected_p_shld_coolant_pump_mw @@ -1487,103 +1500,117 @@ def test_component_masses(componentmassesparam, monkeypatch, ccfe_hcpb): ccfe_hcpb.data.first_wall, "a_fw_total", componentmassesparam.a_fw_total ) monkeypatch.setattr( - fwbs_variables, "vol_blkt_total", componentmassesparam.vol_blkt_total + ccfe_hcpb.data.fwbs, "vol_blkt_total", componentmassesparam.vol_blkt_total ) monkeypatch.setattr( - fwbs_variables, + ccfe_hcpb.data.fwbs, "f_a_blkt_cooling_channels", componentmassesparam.f_a_blkt_cooling_channels, ) monkeypatch.setattr( - fwbs_variables, "m_blkt_beryllium", componentmassesparam.m_blkt_beryllium + ccfe_hcpb.data.fwbs, "m_blkt_beryllium", componentmassesparam.m_blkt_beryllium ) monkeypatch.setattr( - fwbs_variables, "m_blkt_steel_total", componentmassesparam.m_blkt_steel_total + ccfe_hcpb.data.fwbs, + "m_blkt_steel_total", + componentmassesparam.m_blkt_steel_total, ) - monkeypatch.setattr(fwbs_variables, "den_steel", componentmassesparam.den_steel) + monkeypatch.setattr(ccfe_hcpb.data.fwbs, "den_steel", componentmassesparam.den_steel) monkeypatch.setattr( - fwbs_variables, "m_blkt_total", componentmassesparam.m_blkt_total + ccfe_hcpb.data.fwbs, "m_blkt_total", componentmassesparam.m_blkt_total ) monkeypatch.setattr( - fwbs_variables, "vol_shld_total", componentmassesparam.vol_shld_total + ccfe_hcpb.data.fwbs, "vol_shld_total", componentmassesparam.vol_shld_total ) - monkeypatch.setattr(fwbs_variables, "vfshld", componentmassesparam.vfshld) + monkeypatch.setattr(ccfe_hcpb.data.fwbs, "vfshld", componentmassesparam.vfshld) monkeypatch.setattr( - fwbs_variables, + ccfe_hcpb.data.fwbs, "m_fw_blkt_div_coolant_total", componentmassesparam.m_fw_blkt_div_coolant_total, ) - monkeypatch.setattr(fwbs_variables, "fwclfr", componentmassesparam.fwclfr) - monkeypatch.setattr(fwbs_variables, "breeder_f", componentmassesparam.breeder_f) + monkeypatch.setattr(ccfe_hcpb.data.fwbs, "fwclfr", componentmassesparam.fwclfr) + monkeypatch.setattr(ccfe_hcpb.data.fwbs, "breeder_f", componentmassesparam.breeder_f) monkeypatch.setattr( - fwbs_variables, "breeder_multiplier", componentmassesparam.breeder_multiplier + ccfe_hcpb.data.fwbs, + "breeder_multiplier", + componentmassesparam.breeder_multiplier, ) monkeypatch.setattr( - fwbs_variables, "m_blkt_tibe12", componentmassesparam.m_blkt_tibe12 + ccfe_hcpb.data.fwbs, "m_blkt_tibe12", componentmassesparam.m_blkt_tibe12 ) monkeypatch.setattr( - fwbs_variables, "m_blkt_li4sio4", componentmassesparam.m_blkt_li4sio4 + ccfe_hcpb.data.fwbs, "m_blkt_li4sio4", componentmassesparam.m_blkt_li4sio4 ) - monkeypatch.setattr(fwbs_variables, "m_blkt_li2o", componentmassesparam.m_blkt_li2o) - monkeypatch.setattr(fwbs_variables, "vfcblkt", componentmassesparam.vfcblkt) - monkeypatch.setattr(fwbs_variables, "vfpblkt", componentmassesparam.vfpblkt) - monkeypatch.setattr(fwbs_variables, "whtshld", componentmassesparam.whtshld) - monkeypatch.setattr(fwbs_variables, "wpenshld", componentmassesparam.wpenshld) - monkeypatch.setattr(fwbs_variables, "m_fw_total", componentmassesparam.m_fw_total) monkeypatch.setattr( - fwbs_variables, "fw_armour_vol", componentmassesparam.fw_armour_vol + ccfe_hcpb.data.fwbs, "m_blkt_li2o", componentmassesparam.m_blkt_li2o ) + monkeypatch.setattr(ccfe_hcpb.data.fwbs, "vfcblkt", componentmassesparam.vfcblkt) + monkeypatch.setattr(ccfe_hcpb.data.fwbs, "vfpblkt", componentmassesparam.vfpblkt) + monkeypatch.setattr(ccfe_hcpb.data.fwbs, "whtshld", componentmassesparam.whtshld) + monkeypatch.setattr(ccfe_hcpb.data.fwbs, "wpenshld", componentmassesparam.wpenshld) monkeypatch.setattr( - fwbs_variables, "fw_armour_thickness", componentmassesparam.fw_armour_thickness + ccfe_hcpb.data.fwbs, "m_fw_total", componentmassesparam.m_fw_total ) monkeypatch.setattr( - fwbs_variables, "fw_armour_mass", componentmassesparam.fw_armour_mass + ccfe_hcpb.data.fwbs, "fw_armour_vol", componentmassesparam.fw_armour_vol ) monkeypatch.setattr( - fwbs_variables, "armour_fw_bl_mass", componentmassesparam.armour_fw_bl_mass + ccfe_hcpb.data.fwbs, + "fw_armour_thickness", + componentmassesparam.fw_armour_thickness, ) monkeypatch.setattr( - fwbs_variables, "vol_blkt_inboard", componentmassesparam.vol_blkt_inboard + ccfe_hcpb.data.fwbs, "fw_armour_mass", componentmassesparam.fw_armour_mass ) monkeypatch.setattr( - fwbs_variables, "vol_blkt_outboard", componentmassesparam.vol_blkt_outboard + ccfe_hcpb.data.fwbs, "armour_fw_bl_mass", componentmassesparam.armour_fw_bl_mass ) monkeypatch.setattr( - fwbs_variables, "i_blkt_inboard", componentmassesparam.i_blkt_inboard + ccfe_hcpb.data.fwbs, "vol_blkt_inboard", componentmassesparam.vol_blkt_inboard ) - monkeypatch.setattr(fwbs_variables, "fblhebmi", componentmassesparam.fblhebmi) - monkeypatch.setattr(fwbs_variables, "fblhebpi", componentmassesparam.fblhebpi) - monkeypatch.setattr(fwbs_variables, "fblhebmo", componentmassesparam.fblhebmo) - monkeypatch.setattr(fwbs_variables, "fblhebpo", componentmassesparam.fblhebpo) - monkeypatch.setattr(fwbs_variables, "fblss", componentmassesparam.fblss) - monkeypatch.setattr(fwbs_variables, "fblbe", componentmassesparam.fblbe) - monkeypatch.setattr(fwbs_variables, "whtblbreed", componentmassesparam.whtblbreed) - monkeypatch.setattr(fwbs_variables, "densbreed", componentmassesparam.densbreed) - monkeypatch.setattr(fwbs_variables, "fblbreed", componentmassesparam.fblbreed) monkeypatch.setattr( - fwbs_variables, "i_blanket_type", componentmassesparam.i_blanket_type + ccfe_hcpb.data.fwbs, "vol_blkt_outboard", componentmassesparam.vol_blkt_outboard ) monkeypatch.setattr( - fwbs_variables, + ccfe_hcpb.data.fwbs, "i_blkt_inboard", componentmassesparam.i_blkt_inboard + ) + monkeypatch.setattr(ccfe_hcpb.data.fwbs, "fblhebmi", componentmassesparam.fblhebmi) + monkeypatch.setattr(ccfe_hcpb.data.fwbs, "fblhebpi", componentmassesparam.fblhebpi) + monkeypatch.setattr(ccfe_hcpb.data.fwbs, "fblhebmo", componentmassesparam.fblhebmo) + monkeypatch.setattr(ccfe_hcpb.data.fwbs, "fblhebpo", componentmassesparam.fblhebpo) + monkeypatch.setattr(ccfe_hcpb.data.fwbs, "fblss", componentmassesparam.fblss) + monkeypatch.setattr(ccfe_hcpb.data.fwbs, "fblbe", componentmassesparam.fblbe) + monkeypatch.setattr( + ccfe_hcpb.data.fwbs, "whtblbreed", componentmassesparam.whtblbreed + ) + monkeypatch.setattr(ccfe_hcpb.data.fwbs, "densbreed", componentmassesparam.densbreed) + monkeypatch.setattr(ccfe_hcpb.data.fwbs, "fblbreed", componentmassesparam.fblbreed) + monkeypatch.setattr( + ccfe_hcpb.data.fwbs, "i_blanket_type", componentmassesparam.i_blanket_type + ) + monkeypatch.setattr( + ccfe_hcpb.data.fwbs, "f_a_fw_coolant_inboard", componentmassesparam.f_a_fw_coolant_inboard, ) monkeypatch.setattr( - fwbs_variables, + ccfe_hcpb.data.fwbs, "f_a_fw_coolant_outboard", componentmassesparam.f_a_fw_coolant_outboard, ) monkeypatch.setattr( - fwbs_variables, "vol_fw_total", componentmassesparam.vol_fw_total + ccfe_hcpb.data.fwbs, "vol_fw_total", componentmassesparam.vol_fw_total ) monkeypatch.setattr( - fwbs_variables, "f_vol_blkt_steel", componentmassesparam.f_vol_blkt_steel + ccfe_hcpb.data.fwbs, "f_vol_blkt_steel", componentmassesparam.f_vol_blkt_steel ) monkeypatch.setattr( - fwbs_variables, "f_vol_blkt_li4sio4", componentmassesparam.f_vol_blkt_li4sio4 + ccfe_hcpb.data.fwbs, + "f_vol_blkt_li4sio4", + componentmassesparam.f_vol_blkt_li4sio4, ) monkeypatch.setattr( - fwbs_variables, "f_vol_blkt_tibe12", componentmassesparam.f_vol_blkt_tibe12 + ccfe_hcpb.data.fwbs, "f_vol_blkt_tibe12", componentmassesparam.f_vol_blkt_tibe12 ) ccfe_hcpb.component_masses() @@ -1594,50 +1621,54 @@ def test_component_masses(componentmassesparam, monkeypatch, ccfe_hcpb): assert divertor_variables.m_div_plate == pytest.approx( componentmassesparam.expected_m_div_plate ) - assert fwbs_variables.m_blkt_beryllium == pytest.approx( + assert ccfe_hcpb.data.fwbs.m_blkt_beryllium == pytest.approx( componentmassesparam.expected_m_blkt_beryllium ) - assert fwbs_variables.m_blkt_steel_total == pytest.approx( + assert ccfe_hcpb.data.fwbs.m_blkt_steel_total == pytest.approx( componentmassesparam.expected_m_blkt_steel_total ) - assert fwbs_variables.m_blkt_total == pytest.approx( + assert ccfe_hcpb.data.fwbs.m_blkt_total == pytest.approx( componentmassesparam.expected_m_blkt_total ) - assert fwbs_variables.m_fw_blkt_div_coolant_total == pytest.approx( + assert ccfe_hcpb.data.fwbs.m_fw_blkt_div_coolant_total == pytest.approx( componentmassesparam.expected_m_fw_blkt_div_coolant_total ) - assert fwbs_variables.fwclfr == pytest.approx(componentmassesparam.expected_fwclfr) - assert fwbs_variables.m_blkt_tibe12 == pytest.approx( + assert ccfe_hcpb.data.fwbs.fwclfr == pytest.approx( + componentmassesparam.expected_fwclfr + ) + assert ccfe_hcpb.data.fwbs.m_blkt_tibe12 == pytest.approx( componentmassesparam.expected_m_blkt_tibe12 ) - assert fwbs_variables.m_blkt_li4sio4 == pytest.approx( + assert ccfe_hcpb.data.fwbs.m_blkt_li4sio4 == pytest.approx( componentmassesparam.expected_whtblli4sio4 ) - assert fwbs_variables.m_blkt_li2o == pytest.approx( + assert ccfe_hcpb.data.fwbs.m_blkt_li2o == pytest.approx( componentmassesparam.expected_m_blkt_li2o ) - assert fwbs_variables.whtshld == pytest.approx(componentmassesparam.expected_whtshld) - assert fwbs_variables.wpenshld == pytest.approx( + assert ccfe_hcpb.data.fwbs.whtshld == pytest.approx( + componentmassesparam.expected_whtshld + ) + assert ccfe_hcpb.data.fwbs.wpenshld == pytest.approx( componentmassesparam.expected_wpenshld ) - assert fwbs_variables.m_fw_total == pytest.approx( + assert ccfe_hcpb.data.fwbs.m_fw_total == pytest.approx( componentmassesparam.expected_m_fw_total ) - assert fwbs_variables.fw_armour_vol == pytest.approx( + assert ccfe_hcpb.data.fwbs.fw_armour_vol == pytest.approx( componentmassesparam.expected_fw_armour_vol ) - assert fwbs_variables.fw_armour_mass == pytest.approx( + assert ccfe_hcpb.data.fwbs.fw_armour_mass == pytest.approx( componentmassesparam.expected_fw_armour_mass ) - assert fwbs_variables.armour_fw_bl_mass == pytest.approx( + assert ccfe_hcpb.data.fwbs.armour_fw_bl_mass == pytest.approx( componentmassesparam.expected_armour_fw_bl_mass ) - assert fwbs_variables.f_vol_blkt_steel == pytest.approx( + assert ccfe_hcpb.data.fwbs.f_vol_blkt_steel == pytest.approx( componentmassesparam.expected_fblss_ccfe ) - assert fwbs_variables.f_vol_blkt_li4sio4 == pytest.approx( + assert ccfe_hcpb.data.fwbs.f_vol_blkt_li4sio4 == pytest.approx( componentmassesparam.expected_f_vol_blkt_li4sio4 ) - assert fwbs_variables.f_vol_blkt_tibe12 == pytest.approx( + assert ccfe_hcpb.data.fwbs.f_vol_blkt_tibe12 == pytest.approx( componentmassesparam.expected_f_vol_blkt_tibe12 ) diff --git a/tests/unit/models/engineering/test_materials.py b/tests/unit/models/engineering/test_materials.py index e56867059..6b05f7865 100644 --- a/tests/unit/models/engineering/test_materials.py +++ b/tests/unit/models/engineering/test_materials.py @@ -1,10 +1,11 @@ import pytest -from process.data_structure import fwbs_variables from process.models.engineering.materials import eurofer97_thermal_conductivity -def test_eurofer97_thermal_conductivity(monkeypatch): - monkeypatch.setattr(fwbs_variables, "fw_th_conductivity", 28.9) +def test_eurofer97_thermal_conductivity(monkeypatch, process_models): + monkeypatch.setattr(process_models.data.fwbs, "fw_th_conductivity", 28.9) - assert eurofer97_thermal_conductivity(1900.0) == pytest.approx(326.70406785462256) + assert eurofer97_thermal_conductivity( + 1900.0, process_models.data.fwbs.fw_th_conductivity + ) == pytest.approx(326.70406785462256) diff --git a/tests/unit/models/stellarator/test_stellarator.py b/tests/unit/models/stellarator/test_stellarator.py index 2a033ccdb..37d28d19b 100644 --- a/tests/unit/models/stellarator/test_stellarator.py +++ b/tests/unit/models/stellarator/test_stellarator.py @@ -5,7 +5,6 @@ from process.data_structure import ( build_variables, - fwbs_variables, heat_transport_variables, impurity_radiation_module, physics_variables, @@ -578,22 +577,22 @@ def test_stbild(stbildparam, monkeypatch, stellarator): ) monkeypatch.setattr( - fwbs_variables, "radius_fw_channel", stbildparam.radius_fw_channel + stellarator.data.fwbs, "radius_fw_channel", stbildparam.radius_fw_channel ) - monkeypatch.setattr(fwbs_variables, "blktmodel", stbildparam.blktmodel) + monkeypatch.setattr(stellarator.data.fwbs, "blktmodel", stbildparam.blktmodel) monkeypatch.setattr( - fwbs_variables, "f_ster_div_single", stbildparam.f_ster_div_single + stellarator.data.fwbs, "f_ster_div_single", stbildparam.f_ster_div_single ) monkeypatch.setattr( - fwbs_variables, "f_a_fw_outboard_hcd", stbildparam.f_a_fw_outboard_hcd + stellarator.data.fwbs, "f_a_fw_outboard_hcd", stbildparam.f_a_fw_outboard_hcd ) - monkeypatch.setattr(fwbs_variables, "fhole", stbildparam.fhole) + monkeypatch.setattr(stellarator.data.fwbs, "fhole", stbildparam.fhole) - monkeypatch.setattr(fwbs_variables, "dr_fw_wall", stbildparam.dr_fw_wall) + monkeypatch.setattr(stellarator.data.fwbs, "dr_fw_wall", stbildparam.dr_fw_wall) monkeypatch.setattr(heat_transport_variables, "ipowerflow", stbildparam.ipowerflow) @@ -804,9 +803,9 @@ def test_ststrc(ststrcparam, monkeypatch, stellarator): :type monkeypatch: _pytest.monkeypatch.monkeypatch """ - monkeypatch.setattr(fwbs_variables, "dewmkg", ststrcparam.dewmkg) + monkeypatch.setattr(stellarator.data.fwbs, "dewmkg", ststrcparam.dewmkg) - monkeypatch.setattr(fwbs_variables, "den_steel", ststrcparam.den_steel) + monkeypatch.setattr(stellarator.data.fwbs, "den_steel", ststrcparam.den_steel) monkeypatch.setattr(structure_variables, "aintmass", ststrcparam.aintmass) diff --git a/tests/unit/models/test_availability.py b/tests/unit/models/test_availability.py index dea932b83..be2e0f794 100644 --- a/tests/unit/models/test_availability.py +++ b/tests/unit/models/test_availability.py @@ -2,11 +2,9 @@ import pytest -from process import data_structure from process.core.init import init_all_module_vars from process.data_structure import constraint_variables as ctv from process.data_structure import divertor_variables as dv -from process.data_structure import fwbs_variables as fwbsv 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 @@ -39,7 +37,7 @@ def test_avail_0(monkeypatch, availability, life_fw_fpy, ibkt_life, bktlife_exp_ # Mock module vars monkeypatch.setattr(ifev, "ife", 0) monkeypatch.setattr(pv, "p_fusion_total_mw", 4.0e3) - monkeypatch.setattr(fwbsv, "life_fw_fpy", life_fw_fpy) + monkeypatch.setattr(availability.data.fwbs, "life_fw_fpy", life_fw_fpy) monkeypatch.setattr(availability.data.costs, "ibkt_life", ibkt_life) monkeypatch.setattr(availability.data.costs, "abktflnc", 4.0) monkeypatch.setattr(pv, "pflux_fw_neutron_mw", 10.0) @@ -58,7 +56,7 @@ def test_avail_0(monkeypatch, availability, life_fw_fpy, ibkt_life, bktlife_exp_ cpfact_exp = 80.0 assert pytest.approx(cpfact_obs) == cpfact_exp - bktlife_obs = fwbsv.life_blkt_fpy + bktlife_obs = availability.data.fwbs.life_blkt_fpy bktlife_exp = bktlife_exp_param assert pytest.approx(bktlife_obs) == bktlife_exp @@ -85,7 +83,7 @@ def test_avail_1(monkeypatch, availability): # Mock module vars monkeypatch.setattr(availability.data.costs, "i_plant_availability", 1) monkeypatch.setattr(availability.data.costs, "life_div_fpy", 1.0) - monkeypatch.setattr(fwbsv, "life_blkt_fpy", 7.0) + monkeypatch.setattr(availability.data.fwbs, "life_blkt_fpy", 7.0) monkeypatch.setattr(availability.data.costs, "t_div_replace_yrs", 0.1) monkeypatch.setattr(availability.data.costs, "t_blkt_replace_yrs", 0.2) monkeypatch.setattr(availability.data.costs, "tcomrepl", 0.3) @@ -208,7 +206,7 @@ def calc_u_planned_fix(availability, request, monkeypatch): "pflux_div_heat_load_mw", param["pflux_div_heat_load_mw"], ) - monkeypatch.setattr(data_structure.fwbs_variables, "life_blkt_fpy", 0.0) + monkeypatch.setattr(availability.data.fwbs, "life_blkt_fpy", 0.0) monkeypatch.setattr(pv, "pflux_fw_neutron_mw", param["pflux_fw_neutron_mw"]) monkeypatch.setattr(pv, "itart", param["itart"]) monkeypatch.setattr(availability.data.costs, "life_plant", param["life_plant"]) @@ -221,7 +219,7 @@ def calc_u_planned_fix(availability, request, monkeypatch): monkeypatch.setattr( availability.data.costs, "num_rh_systems", param["num_rh_systems"] ) - monkeypatch.setattr(fwbsv, "neut_flux_cp", 1e18) + monkeypatch.setattr(availability.data.fwbs, "neut_flux_cp", 1e18) # Return the expected result for the given parameter list return param["expected"] @@ -464,7 +462,7 @@ def calc_u_unplanned_fwbs_params(): @pytest.fixture( params=calc_u_unplanned_fwbs_params(), ids=["below_nref", "above_nu", "between"] ) -def calc_u_unplanned_fwbs_fix(request, monkeypatch): +def calc_u_unplanned_fwbs_fix(request, monkeypatch, availability): """Fixture for the calc_u_unplanned_fwbs() variables. :param request: Request object for accessing parameters @@ -479,9 +477,7 @@ def calc_u_unplanned_fwbs_fix(request, monkeypatch): # Mock variables used by calc_u_unplanned_fwbs() # Some may be parameterised monkeypatch.setattr(tv, "t_plant_pulse_total", param["t_plant_pulse_total"]) - monkeypatch.setattr( - data_structure.fwbs_variables, "life_blkt_fpy", param["life_blkt_fpy"] - ) + monkeypatch.setattr(availability.data.fwbs, "life_blkt_fpy", param["life_blkt_fpy"]) # Return the expected result for the given parameter list return param["expected"] @@ -557,7 +553,7 @@ def mock_calc_u_unplanned_vacuum(*args, **kwargs): monkeypatch.setattr(tv, "t_plant_pulse_total", 50.0) monkeypatch.setattr(ifev, "ife", 0) monkeypatch.setattr(pv, "itart", 1) - monkeypatch.setattr(fwbsv, "life_blkt_fpy", 5.0) + monkeypatch.setattr(availability.data.fwbs, "life_blkt_fpy", 5.0) monkeypatch.setattr(availability.data.costs, "life_div_fpy", 10.0) monkeypatch.setattr(availability.data.costs, "cplife", 15.0) @@ -571,7 +567,7 @@ def mock_calc_u_unplanned_vacuum(*args, **kwargs): cpfact_exp = 0.07173 assert pytest.approx(cpfact_obs) == cpfact_exp - bktlife_obs = fwbsv.life_blkt_fpy + bktlife_obs = availability.data.fwbs.life_blkt_fpy bktlife_exp = 6.97058413 assert pytest.approx(bktlife_obs) == bktlife_exp @@ -628,7 +624,7 @@ def test_cp_lifetime(monkeypatch, availability, i_tf_sup, exp): monkeypatch.setattr(tfv, "i_tf_sup", i_tf_sup) monkeypatch.setattr(ctv, "nflutfmax", 1.0e23) - monkeypatch.setattr(fwbsv, "neut_flux_cp", 5.0e14) + monkeypatch.setattr(availability.data.fwbs, "neut_flux_cp", 5.0e14) monkeypatch.setattr(availability.data.costs, "cpstflnc", 20.0) monkeypatch.setattr(pv, "pflux_fw_neutron_mw", 5.0) monkeypatch.setattr(availability.data.costs, "life_plant", 30.0) diff --git a/tests/unit/models/test_buildings.py b/tests/unit/models/test_buildings.py index ae2d3df63..a2fb182e9 100644 --- a/tests/unit/models/test_buildings.py +++ b/tests/unit/models/test_buildings.py @@ -7,7 +7,6 @@ buildings_variables, current_drive_variables, divertor_variables, - fwbs_variables, pfcoil_variables, physics_variables, tfcoil_variables, @@ -687,9 +686,11 @@ def test_bldgs_sizes(buildings, bldgssizesparam, monkeypatch): buildings.data.costs, "life_div_fpy", bldgssizesparam.life_div_fpy ) monkeypatch.setattr( - fwbs_variables, "r_cryostat_inboard", bldgssizesparam.r_cryostat_inboard + buildings.data.fwbs, "r_cryostat_inboard", bldgssizesparam.r_cryostat_inboard + ) + monkeypatch.setattr( + buildings.data.fwbs, "life_blkt_fpy", bldgssizesparam.life_blkt_fpy ) - monkeypatch.setattr(fwbs_variables, "life_blkt_fpy", bldgssizesparam.life_blkt_fpy) monkeypatch.setattr( build_variables, "z_tf_inside_half", bldgssizesparam.z_tf_inside_half ) diff --git a/tests/unit/models/test_costs_1990.py b/tests/unit/models/test_costs_1990.py index 1875a9b8e..5d9291751 100644 --- a/tests/unit/models/test_costs_1990.py +++ b/tests/unit/models/test_costs_1990.py @@ -11,7 +11,6 @@ buildings_variables, current_drive_variables, divertor_variables, - fwbs_variables, heat_transport_variables, ife_variables, pf_power_variables, @@ -79,15 +78,15 @@ def acc2261_fix(costs, request, monkeypatch): monkeypatch.setattr(costs.data.costs, "fkind", 1) monkeypatch.setattr(costs.data.costs, "lsa", 1) monkeypatch.setattr(heat_transport_variables, "p_fw_div_heat_deposited_mw", 0.0) - monkeypatch.setattr(fwbs_variables, "p_blkt_nuclear_heat_total_mw", 1558.0) - monkeypatch.setattr(fwbs_variables, "p_shld_nuclear_heat_mw", 1.478) + monkeypatch.setattr(costs.data.fwbs, "p_blkt_nuclear_heat_total_mw", 1558.0) + monkeypatch.setattr(costs.data.fwbs, "p_shld_nuclear_heat_mw", 1.478) monkeypatch.setattr(heat_transport_variables, "p_plant_primary_heat_mw", 2647.0) monkeypatch.setattr(heat_transport_variables, "n_primary_heat_exchangers", 3) monkeypatch.setattr(costs.data.costs, "c2261", 0) # Parameterised mocks monkeypatch.setattr( - fwbs_variables, "i_blkt_coolant_type", param["i_blkt_coolant_type"] + costs.data.fwbs, "i_blkt_coolant_type", param["i_blkt_coolant_type"] ) # Return the expected result for the given parameter list @@ -430,7 +429,7 @@ def acc23_fix(request, monkeypatch, costs): # Mock variables used by acc23() # Some may be parameterised monkeypatch.setattr( - fwbs_variables, "i_blkt_coolant_type", param["i_blkt_coolant_type"] + costs.data.fwbs, "i_blkt_coolant_type", param["i_blkt_coolant_type"] ) monkeypatch.setattr(heat_transport_variables, "p_plant_electric_gross_mw", 1200.0) monkeypatch.setattr(costs.data.costs, "c23", 0) @@ -1345,25 +1344,25 @@ def test_acc2212(acc2212param, monkeypatch, costs): monkeypatch.setattr(costs.data.costs, "fkind", acc2212param.fkind) - monkeypatch.setattr(fwbs_variables, "i_blanket_type", acc2212param.i_blanket_type) + monkeypatch.setattr(costs.data.fwbs, "i_blanket_type", acc2212param.i_blanket_type) - monkeypatch.setattr(fwbs_variables, "m_blkt_lithium", acc2212param.m_blkt_lithium) + monkeypatch.setattr(costs.data.fwbs, "m_blkt_lithium", acc2212param.m_blkt_lithium) - monkeypatch.setattr(fwbs_variables, "m_blkt_li2o", acc2212param.m_blkt_li2o) + monkeypatch.setattr(costs.data.fwbs, "m_blkt_li2o", acc2212param.m_blkt_li2o) - monkeypatch.setattr(fwbs_variables, "whtblbreed", acc2212param.whtblbreed) + monkeypatch.setattr(costs.data.fwbs, "whtblbreed", acc2212param.whtblbreed) - monkeypatch.setattr(fwbs_variables, "m_blkt_vanadium", acc2212param.m_blkt_vanadium) + monkeypatch.setattr(costs.data.fwbs, "m_blkt_vanadium", acc2212param.m_blkt_vanadium) monkeypatch.setattr( - fwbs_variables, "m_blkt_beryllium", acc2212param.m_blkt_beryllium + costs.data.fwbs, "m_blkt_beryllium", acc2212param.m_blkt_beryllium ) monkeypatch.setattr( - fwbs_variables, "m_blkt_steel_total", acc2212param.m_blkt_steel_total + costs.data.fwbs, "m_blkt_steel_total", acc2212param.m_blkt_steel_total ) - monkeypatch.setattr(fwbs_variables, "wtbllipb", acc2212param.wtbllipb) + monkeypatch.setattr(costs.data.fwbs, "wtbllipb", acc2212param.wtbllipb) monkeypatch.setattr(ife_variables, "ucflib", acc2212param.ucflib) @@ -1540,9 +1539,9 @@ def test_acc2213(acc2213param, monkeypatch, costs): monkeypatch.setattr(costs.data.costs, "lsa", acc2213param.lsa) - monkeypatch.setattr(fwbs_variables, "wpenshld", acc2213param.wpenshld) + monkeypatch.setattr(costs.data.fwbs, "wpenshld", acc2213param.wpenshld) - monkeypatch.setattr(fwbs_variables, "whtshld", acc2213param.whtshld) + monkeypatch.setattr(costs.data.fwbs, "whtshld", acc2213param.whtshld) monkeypatch.setattr(ife_variables, "shmatm", acc2213param.shmatm) @@ -2864,7 +2863,7 @@ def test_acc2223(acc2223param, monkeypatch, costs): monkeypatch.setattr(costs.data.costs, "fkind", acc2223param.fkind) - monkeypatch.setattr(fwbs_variables, "m_vv", acc2223param.m_vv) + monkeypatch.setattr(costs.data.fwbs, "m_vv", acc2223param.m_vv) monkeypatch.setattr(costs.data.costs, "c22", acc2223param.c22) @@ -3976,15 +3975,15 @@ def test_acc2261_rut(acc2261param, monkeypatch, costs): monkeypatch.setattr(costs.data.costs, "fkind", acc2261param.fkind) monkeypatch.setattr( - fwbs_variables, "i_blkt_coolant_type", acc2261param.i_blkt_coolant_type + costs.data.fwbs, "i_blkt_coolant_type", acc2261param.i_blkt_coolant_type ) monkeypatch.setattr( - fwbs_variables, "p_shld_nuclear_heat_mw", acc2261param.p_shld_nuclear_heat_mw + costs.data.fwbs, "p_shld_nuclear_heat_mw", acc2261param.p_shld_nuclear_heat_mw ) monkeypatch.setattr( - fwbs_variables, + costs.data.fwbs, "p_blkt_nuclear_heat_total_mw", acc2261param.p_blkt_nuclear_heat_total_mw, ) @@ -4808,7 +4807,7 @@ def test_acc23_rut(acc23param, monkeypatch, costs): monkeypatch.setattr(costs.data.costs, "ireactor", acc23param.ireactor) monkeypatch.setattr( - fwbs_variables, "i_blkt_coolant_type", acc23param.i_blkt_coolant_type + costs.data.fwbs, "i_blkt_coolant_type", acc23param.i_blkt_coolant_type ) monkeypatch.setattr( @@ -5912,9 +5911,9 @@ def test_coelc(coelcparam, monkeypatch, costs): monkeypatch.setattr(costs.data.costs, "cfind", coelcparam.cfind) - monkeypatch.setattr(fwbs_variables, "life_blkt_fpy", coelcparam.life_blkt_fpy) + monkeypatch.setattr(costs.data.fwbs, "life_blkt_fpy", coelcparam.life_blkt_fpy) - monkeypatch.setattr(fwbs_variables, "life_blkt", coelcparam.life_blkt) + monkeypatch.setattr(costs.data.fwbs, "life_blkt", coelcparam.life_blkt) monkeypatch.setattr(ife_variables, "uctarg", coelcparam.uctarg) diff --git a/tests/unit/models/test_costs_2015.py b/tests/unit/models/test_costs_2015.py index 766bbac04..aa19edcb8 100644 --- a/tests/unit/models/test_costs_2015.py +++ b/tests/unit/models/test_costs_2015.py @@ -8,7 +8,6 @@ from process.data_structure import ( build_variables, current_drive_variables, - fwbs_variables, heat_transport_variables, pf_power_variables, pfcoil_variables, @@ -2306,11 +2305,13 @@ def test_calc_building_costs(calcbuildingcostsparam, monkeypatch, costs2015): ) monkeypatch.setattr( - fwbs_variables, "r_cryostat_inboard", calcbuildingcostsparam.r_cryostat_inboard + costs2015.data.fwbs, + "r_cryostat_inboard", + calcbuildingcostsparam.r_cryostat_inboard, ) monkeypatch.setattr( - fwbs_variables, + costs2015.data.fwbs, "z_cryostat_half_inside", calcbuildingcostsparam.z_cryostat_half_inside, ) @@ -4587,7 +4588,7 @@ def test_calc_land_costs(calclandcostsparam, monkeypatch, costs2015): ) monkeypatch.setattr( - fwbs_variables, "r_cryostat_inboard", calclandcostsparam.r_cryostat_inboard + costs2015.data.fwbs, "r_cryostat_inboard", calclandcostsparam.r_cryostat_inboard ) monkeypatch.setattr( @@ -9109,7 +9110,7 @@ def test_calc_remote_handling_costs( """ monkeypatch.setattr( - fwbs_variables, + costs2015.data.fwbs, "armour_fw_bl_mass", calcremotehandlingcostsparam.armour_fw_bl_mass, ) @@ -15966,16 +15967,16 @@ def test_calc_remaining_subsystems(calcremainingsubsystemsparam, monkeypatch, co heat_transport_variables, "helpow", calcremainingsubsystemsparam.helpow ) - monkeypatch.setattr(fwbs_variables, "m_vv", calcremainingsubsystemsparam.m_vv) + monkeypatch.setattr(costs2015.data.fwbs, "m_vv", calcremainingsubsystemsparam.m_vv) monkeypatch.setattr( - fwbs_variables, + costs2015.data.fwbs, "r_cryostat_inboard", calcremainingsubsystemsparam.r_cryostat_inboard, ) monkeypatch.setattr( - fwbs_variables, + costs2015.data.fwbs, "z_cryostat_half_inside", calcremainingsubsystemsparam.z_cryostat_half_inside, ) diff --git a/tests/unit/models/test_cryostat.py b/tests/unit/models/test_cryostat.py index 3a1f6d15e..2ac6ddc2a 100644 --- a/tests/unit/models/test_cryostat.py +++ b/tests/unit/models/test_cryostat.py @@ -7,20 +7,18 @@ blanket_library, build_variables, buildings_variables, - fwbs_variables, pfcoil_variables, ) -from process.models.cryostat import Cryostat @pytest.fixture -def cryostat_fixture(): - """Provides BlanketLibrary object for testing. +def cryostat_fixture(process_models): + """Fixture to get the Cryostat instance from process_models. - :returns: initialised BlanketLibrary object - :rtype: process.blanket_library.BlanketLibrary + :returns: initialised Cryostat object + :rtype: process.models.cryostat.Cryostat """ - return Cryostat() + return process_models.cryostat class ExternalCryoGeometryParam(NamedTuple): @@ -162,25 +160,37 @@ def test_external_cryo_geometry( build_variables, "dr_cryostat", externalcryogeometryparam.dr_cryostat ) monkeypatch.setattr( - fwbs_variables, + cryostat_fixture.data.fwbs, "r_cryostat_inboard", externalcryogeometryparam.r_cryostat_inboard, ) monkeypatch.setattr( - fwbs_variables, "dr_pf_cryostat", externalcryogeometryparam.dr_pf_cryostat + cryostat_fixture.data.fwbs, + "dr_pf_cryostat", + externalcryogeometryparam.dr_pf_cryostat, ) monkeypatch.setattr( - fwbs_variables, + cryostat_fixture.data.fwbs, "z_cryostat_half_inside", externalcryogeometryparam.z_cryostat_half_inside, ) monkeypatch.setattr( - fwbs_variables, "vol_cryostat", externalcryogeometryparam.vol_cryostat + cryostat_fixture.data.fwbs, + "vol_cryostat", + externalcryogeometryparam.vol_cryostat, + ) + monkeypatch.setattr( + cryostat_fixture.data.fwbs, "m_vv", externalcryogeometryparam.m_vv + ) + monkeypatch.setattr( + cryostat_fixture.data.fwbs, "vol_vv", externalcryogeometryparam.vol_vv + ) + monkeypatch.setattr( + cryostat_fixture.data.fwbs, "den_steel", externalcryogeometryparam.den_steel + ) + monkeypatch.setattr( + cryostat_fixture.data.fwbs, "dewmkg", externalcryogeometryparam.dewmkg ) - monkeypatch.setattr(fwbs_variables, "m_vv", externalcryogeometryparam.m_vv) - monkeypatch.setattr(fwbs_variables, "vol_vv", externalcryogeometryparam.vol_vv) - monkeypatch.setattr(fwbs_variables, "den_steel", externalcryogeometryparam.den_steel) - monkeypatch.setattr(fwbs_variables, "dewmkg", externalcryogeometryparam.dewmkg) monkeypatch.setattr( pfcoil_variables, "r_pf_coil_outer", externalcryogeometryparam.r_pf_coil_outer ) @@ -196,16 +206,16 @@ def test_external_cryo_geometry( cryostat_fixture.external_cryo_geometry() - assert fwbs_variables.r_cryostat_inboard == pytest.approx( + assert cryostat_fixture.data.fwbs.r_cryostat_inboard == pytest.approx( externalcryogeometryparam.expected_r_cryostat_inboard ) - assert fwbs_variables.z_cryostat_half_inside == pytest.approx( + assert cryostat_fixture.data.fwbs.z_cryostat_half_inside == pytest.approx( externalcryogeometryparam.expected_z_cryostat_half_inside ) - assert fwbs_variables.vol_cryostat == pytest.approx( + assert cryostat_fixture.data.fwbs.vol_cryostat == pytest.approx( externalcryogeometryparam.expected_vol_cryostat ) - assert fwbs_variables.dewmkg == pytest.approx( + assert cryostat_fixture.data.fwbs.dewmkg == pytest.approx( externalcryogeometryparam.expected_dewmkg ) assert buildings_variables.dz_tf_cryostat == pytest.approx( diff --git a/tests/unit/models/test_dcll.py b/tests/unit/models/test_dcll.py index 95b6e1199..78c6a7f20 100644 --- a/tests/unit/models/test_dcll.py +++ b/tests/unit/models/test_dcll.py @@ -7,7 +7,6 @@ current_drive_variables, dcll_variables, divertor_variables, - fwbs_variables, physics_variables, ) @@ -173,95 +172,95 @@ def test_dcll_neutronics_and_power(dcllneutronicsandpowerparam, monkeypatch, dcl ) monkeypatch.setattr( - fwbs_variables, + dcll.data.fwbs, "f_ster_div_single", dcllneutronicsandpowerparam.f_ster_div_single, ) monkeypatch.setattr( - fwbs_variables, + dcll.data.fwbs, "p_div_rad_total_mw", dcllneutronicsandpowerparam.p_div_rad_total_mw, ) monkeypatch.setattr( - fwbs_variables, + dcll.data.fwbs, "p_div_nuclear_heat_total_mw", dcllneutronicsandpowerparam.p_div_nuclear_heat_total_mw, ) monkeypatch.setattr( - fwbs_variables, + dcll.data.fwbs, "f_a_fw_outboard_hcd", dcllneutronicsandpowerparam.f_a_fw_outboard_hcd, ) monkeypatch.setattr( - fwbs_variables, + dcll.data.fwbs, "p_fw_hcd_rad_total_mw", dcllneutronicsandpowerparam.p_fw_hcd_rad_total_mw, ) monkeypatch.setattr( - fwbs_variables, + dcll.data.fwbs, "p_fw_hcd_nuclear_heat_mw", dcllneutronicsandpowerparam.p_fw_hcd_nuclear_heat_mw, ) monkeypatch.setattr( - fwbs_variables, + dcll.data.fwbs, "p_shld_nuclear_heat_mw", dcllneutronicsandpowerparam.p_shld_nuclear_heat_mw, ) monkeypatch.setattr( - fwbs_variables, + dcll.data.fwbs, "p_fw_rad_total_mw", dcllneutronicsandpowerparam.p_fw_rad_total_mw, ) monkeypatch.setattr( - fwbs_variables, + dcll.data.fwbs, "p_fw_nuclear_heat_total_mw", dcllneutronicsandpowerparam.p_fw_nuclear_heat_total_mw, ) - monkeypatch.setattr(fwbs_variables, "psurffwi", dcllneutronicsandpowerparam.psurffwi) + monkeypatch.setattr(dcll.data.fwbs, "psurffwi", dcllneutronicsandpowerparam.psurffwi) - monkeypatch.setattr(fwbs_variables, "psurffwo", dcllneutronicsandpowerparam.psurffwo) + monkeypatch.setattr(dcll.data.fwbs, "psurffwo", dcllneutronicsandpowerparam.psurffwo) monkeypatch.setattr( - fwbs_variables, + dcll.data.fwbs, "p_blkt_nuclear_heat_total_mw", dcllneutronicsandpowerparam.p_blkt_nuclear_heat_total_mw, ) monkeypatch.setattr( - fwbs_variables, + dcll.data.fwbs, "pnuc_fw_ratio_dcll", dcllneutronicsandpowerparam.pnuc_fw_ratio_dcll, ) monkeypatch.setattr( - fwbs_variables, + dcll.data.fwbs, "pnuc_blkt_ratio_dcll", dcllneutronicsandpowerparam.pnuc_blkt_ratio_dcll, ) monkeypatch.setattr( - fwbs_variables, + dcll.data.fwbs, "f_p_blkt_multiplication", dcllneutronicsandpowerparam.f_p_blkt_multiplication, ) monkeypatch.setattr( - fwbs_variables, + dcll.data.fwbs, "p_blkt_multiplication_mw", dcllneutronicsandpowerparam.p_blkt_multiplication_mw, ) monkeypatch.setattr( - fwbs_variables, + dcll.data.fwbs, "p_tf_nuclear_heat_mw", dcllneutronicsandpowerparam.p_tf_nuclear_heat_mw, ) @@ -288,19 +287,19 @@ def test_dcll_neutronics_and_power(dcllneutronicsandpowerparam, monkeypatch, dcl dcll.dcll_neutronics_and_power(False) - assert fwbs_variables.p_fw_rad_total_mw == pytest.approx( + assert dcll.data.fwbs.p_fw_rad_total_mw == pytest.approx( dcllneutronicsandpowerparam.expected_p_fw_rad_total_mw ) - assert fwbs_variables.p_fw_nuclear_heat_total_mw == pytest.approx( + assert dcll.data.fwbs.p_fw_nuclear_heat_total_mw == pytest.approx( dcllneutronicsandpowerparam.expected_p_fw_nuclear_heat_total_mw ) - assert fwbs_variables.p_blkt_nuclear_heat_total_mw == pytest.approx( + assert dcll.data.fwbs.p_blkt_nuclear_heat_total_mw == pytest.approx( dcllneutronicsandpowerparam.expected_p_blkt_nuclear_heat_total_mw ) - assert fwbs_variables.p_blkt_multiplication_mw == pytest.approx( + assert dcll.data.fwbs.p_blkt_multiplication_mw == pytest.approx( dcllneutronicsandpowerparam.expected_p_blkt_multiplication_mw ) @@ -837,86 +836,86 @@ def test_dcll_masses(dcllmassesparam, monkeypatch, dcll): dcllmassesparam.a_plasma_surface_outboard, ) - monkeypatch.setattr(fwbs_variables, "i_blkt_inboard", dcllmassesparam.i_blkt_inboard) + monkeypatch.setattr(dcll.data.fwbs, "i_blkt_inboard", dcllmassesparam.i_blkt_inboard) - monkeypatch.setattr(fwbs_variables, "vol_blkt_total", dcllmassesparam.vol_blkt_total) + monkeypatch.setattr(dcll.data.fwbs, "vol_blkt_total", dcllmassesparam.vol_blkt_total) monkeypatch.setattr( - fwbs_variables, "vol_blkt_inboard", dcllmassesparam.vol_blkt_inboard + dcll.data.fwbs, "vol_blkt_inboard", dcllmassesparam.vol_blkt_inboard ) monkeypatch.setattr( - fwbs_variables, "vol_blkt_outboard", dcllmassesparam.vol_blkt_outboard + dcll.data.fwbs, "vol_blkt_outboard", dcllmassesparam.vol_blkt_outboard ) - monkeypatch.setattr(fwbs_variables, "m_blkt_total", dcllmassesparam.m_blkt_total) + monkeypatch.setattr(dcll.data.fwbs, "m_blkt_total", dcllmassesparam.m_blkt_total) - monkeypatch.setattr(fwbs_variables, "m_fw_total", dcllmassesparam.m_fw_total) + monkeypatch.setattr(dcll.data.fwbs, "m_fw_total", dcllmassesparam.m_fw_total) - monkeypatch.setattr(fwbs_variables, "fw_armour_vol", dcllmassesparam.fw_armour_vol) + monkeypatch.setattr(dcll.data.fwbs, "fw_armour_vol", dcllmassesparam.fw_armour_vol) monkeypatch.setattr( - fwbs_variables, "fw_armour_thickness", dcllmassesparam.fw_armour_thickness + dcll.data.fwbs, "fw_armour_thickness", dcllmassesparam.fw_armour_thickness ) - monkeypatch.setattr(fwbs_variables, "fw_armour_mass", dcllmassesparam.fw_armour_mass) + monkeypatch.setattr(dcll.data.fwbs, "fw_armour_mass", dcllmassesparam.fw_armour_mass) - monkeypatch.setattr(fwbs_variables, "vol_fw_total", dcllmassesparam.vol_fw_total) + monkeypatch.setattr(dcll.data.fwbs, "vol_fw_total", dcllmassesparam.vol_fw_total) monkeypatch.setattr( - fwbs_variables, "armour_fw_bl_mass", dcllmassesparam.armour_fw_bl_mass + dcll.data.fwbs, "armour_fw_bl_mass", dcllmassesparam.armour_fw_bl_mass ) - monkeypatch.setattr(fwbs_variables, "den_steel", dcllmassesparam.den_steel) + monkeypatch.setattr(dcll.data.fwbs, "den_steel", dcllmassesparam.den_steel) - monkeypatch.setattr(fwbs_variables, "den_liq", dcllmassesparam.den_liq) + monkeypatch.setattr(dcll.data.fwbs, "den_liq", dcllmassesparam.den_liq) monkeypatch.setattr( - fwbs_variables, + dcll.data.fwbs, "i_blkt_liquid_breeder_channel_type", dcllmassesparam.i_blkt_liquid_breeder_channel_type, ) - monkeypatch.setattr(fwbs_variables, "den_ceramic", dcllmassesparam.den_ceramic) + monkeypatch.setattr(dcll.data.fwbs, "den_ceramic", dcllmassesparam.den_ceramic) monkeypatch.setattr( - fwbs_variables, "th_wall_secondary", dcllmassesparam.th_wall_secondary + dcll.data.fwbs, "th_wall_secondary", dcllmassesparam.th_wall_secondary ) - monkeypatch.setattr(fwbs_variables, "nopol", dcllmassesparam.nopol) + monkeypatch.setattr(dcll.data.fwbs, "nopol", dcllmassesparam.nopol) - monkeypatch.setattr(fwbs_variables, "r_f_liq_ib", dcllmassesparam.r_f_liq_ib) + monkeypatch.setattr(dcll.data.fwbs, "r_f_liq_ib", dcllmassesparam.r_f_liq_ib) - monkeypatch.setattr(fwbs_variables, "r_f_liq_ob", dcllmassesparam.r_f_liq_ob) + monkeypatch.setattr(dcll.data.fwbs, "r_f_liq_ob", dcllmassesparam.r_f_liq_ob) - monkeypatch.setattr(fwbs_variables, "w_f_liq_ib", dcllmassesparam.w_f_liq_ib) + monkeypatch.setattr(dcll.data.fwbs, "w_f_liq_ib", dcllmassesparam.w_f_liq_ib) - monkeypatch.setattr(fwbs_variables, "w_f_liq_ob", dcllmassesparam.w_f_liq_ob) + monkeypatch.setattr(dcll.data.fwbs, "w_f_liq_ob", dcllmassesparam.w_f_liq_ob) monkeypatch.setattr( - fwbs_variables, + dcll.data.fwbs, "f_a_blkt_cooling_channels", dcllmassesparam.f_a_blkt_cooling_channels, ) monkeypatch.setattr( - fwbs_variables, "i_blkt_dual_coolant", dcllmassesparam.i_blkt_dual_coolant + dcll.data.fwbs, "i_blkt_dual_coolant", dcllmassesparam.i_blkt_dual_coolant ) - monkeypatch.setattr(fwbs_variables, "den_fw_coolant", dcllmassesparam.den_fw_coolant) + monkeypatch.setattr(dcll.data.fwbs, "den_fw_coolant", dcllmassesparam.den_fw_coolant) monkeypatch.setattr( - fwbs_variables, "den_blkt_coolant", dcllmassesparam.den_blkt_coolant + dcll.data.fwbs, "den_blkt_coolant", dcllmassesparam.den_blkt_coolant ) monkeypatch.setattr( - fwbs_variables, + dcll.data.fwbs, "n_blkt_inboard_modules_toroidal", dcllmassesparam.n_blkt_inboard_modules_toroidal, ) monkeypatch.setattr( - fwbs_variables, + dcll.data.fwbs, "n_blkt_outboard_modules_toroidal", dcllmassesparam.n_blkt_outboard_modules_toroidal, ) @@ -1011,43 +1010,43 @@ def test_dcll_masses(dcllmassesparam, monkeypatch, dcll): assert build_variables.blbmoth == pytest.approx(dcllmassesparam.expected_blbmoth) - assert fwbs_variables.m_blkt_total == pytest.approx( + assert dcll.data.fwbs.m_blkt_total == pytest.approx( dcllmassesparam.expected_m_blkt_total ) - assert fwbs_variables.m_fw_total == pytest.approx( + assert dcll.data.fwbs.m_fw_total == pytest.approx( dcllmassesparam.expected_m_fw_total ) - assert fwbs_variables.fw_armour_vol == pytest.approx( + assert dcll.data.fwbs.fw_armour_vol == pytest.approx( dcllmassesparam.expected_fw_armour_vol ) - assert fwbs_variables.fw_armour_mass == pytest.approx( + assert dcll.data.fwbs.fw_armour_mass == pytest.approx( dcllmassesparam.expected_fw_armour_mass ) - assert fwbs_variables.vol_fw_total == pytest.approx( + assert dcll.data.fwbs.vol_fw_total == pytest.approx( dcllmassesparam.expected_vol_fw_total ) - assert fwbs_variables.armour_fw_bl_mass == pytest.approx( + assert dcll.data.fwbs.armour_fw_bl_mass == pytest.approx( dcllmassesparam.expected_armour_fw_bl_mass ) - assert fwbs_variables.r_f_liq_ib == pytest.approx( + assert dcll.data.fwbs.r_f_liq_ib == pytest.approx( dcllmassesparam.expected_r_f_liq_ib ) - assert fwbs_variables.w_f_liq_ib == pytest.approx( + assert dcll.data.fwbs.w_f_liq_ib == pytest.approx( dcllmassesparam.expected_w_f_liq_ib ) - assert fwbs_variables.w_f_liq_ob == pytest.approx( + assert dcll.data.fwbs.w_f_liq_ob == pytest.approx( dcllmassesparam.expected_w_f_liq_ob ) - assert fwbs_variables.f_a_blkt_cooling_channels == pytest.approx( + assert dcll.data.fwbs.f_a_blkt_cooling_channels == pytest.approx( dcllmassesparam.expected_f_a_blkt_cooling_channels ) diff --git a/tests/unit/models/test_fw.py b/tests/unit/models/test_fw.py index dc7867b2f..0d609f00a 100644 --- a/tests/unit/models/test_fw.py +++ b/tests/unit/models/test_fw.py @@ -2,18 +2,15 @@ import pytest -from process.data_structure import fwbs_variables -from process.models.fw import FirstWall - @pytest.fixture -def fw(): - """Provides FirstWall object for testing. +def fw(process_models): + """Fixture to get the FirstWall instance from process_models. :returns: initialised FirstWall object :rtype: process.fw.FirstWall """ - return FirstWall() + return process_models.fw class FwTempParam(NamedTuple): @@ -120,32 +117,32 @@ def test_fw_temp(fwtempparam, monkeypatch, fw): :type monkeypatch: _pytest.monkeypatch.monkeypatch """ monkeypatch.setattr( - fwbs_variables, "fw_th_conductivity", fwtempparam.fw_th_conductivity + fw.data.fwbs, "fw_th_conductivity", fwtempparam.fw_th_conductivity ) # monkeypatch doesnt work for strings # but helium is the default - # monkeypatch.setattr(fwbs_variables, "i_fw_coolant_type", fwtempparam.i_fw_coolant_type) + # monkeypatch.setattr(fw.data.fwbs, "i_fw_coolant_type", fwtempparam.i_fw_coolant_type) monkeypatch.setattr( - fwbs_variables, "temp_fw_coolant_in", fwtempparam.temp_fw_coolant_in + fw.data.fwbs, "temp_fw_coolant_in", fwtempparam.temp_fw_coolant_in ) - monkeypatch.setattr(fwbs_variables, "pres_fw_coolant", fwtempparam.pres_fw_coolant) + monkeypatch.setattr(fw.data.fwbs, "pres_fw_coolant", fwtempparam.pres_fw_coolant) monkeypatch.setattr( - fwbs_variables, "temp_fw_coolant_out", fwtempparam.temp_fw_coolant_out + fw.data.fwbs, "temp_fw_coolant_out", fwtempparam.temp_fw_coolant_out ) - monkeypatch.setattr(fwbs_variables, "dx_fw_module", fwtempparam.dx_fw_module) + monkeypatch.setattr(fw.data.fwbs, "dx_fw_module", fwtempparam.dx_fw_module) - monkeypatch.setattr(fwbs_variables, "len_fw_channel", fwtempparam.len_fw_channel) + monkeypatch.setattr(fw.data.fwbs, "len_fw_channel", fwtempparam.len_fw_channel) - monkeypatch.setattr(fwbs_variables, "temp_fw_peak", fwtempparam.temp_fw_peak) + monkeypatch.setattr(fw.data.fwbs, "temp_fw_peak", fwtempparam.temp_fw_peak) - monkeypatch.setattr(fwbs_variables, "f_fw_peak", fwtempparam.f_fw_peak) + monkeypatch.setattr(fw.data.fwbs, "f_fw_peak", fwtempparam.f_fw_peak) - monkeypatch.setattr(fwbs_variables, "dr_fw_wall", fwtempparam.dr_fw_wall) + monkeypatch.setattr(fw.data.fwbs, "dr_fw_wall", fwtempparam.dr_fw_wall) tpeakfw, cfmean, rhofmean, massrate = fw.fw_temp( False, diff --git a/tests/unit/models/test_ife.py b/tests/unit/models/test_ife.py index 24217bb58..55933f0af 100644 --- a/tests/unit/models/test_ife.py +++ b/tests/unit/models/test_ife.py @@ -7,7 +7,6 @@ from process.data_structure import ( buildings_variables, - fwbs_variables, heat_transport_variables, ife_variables, physics_variables, @@ -1584,19 +1583,19 @@ def test_ifefbs(ifefbsparam, monkeypatch, ife): "f_t_plant_available", ifefbsparam.f_t_plant_available, ) - monkeypatch.setattr(fwbs_variables, "den_steel", ifefbsparam.den_steel) - monkeypatch.setattr(fwbs_variables, "m_fw_total", ifefbsparam.m_fw_total) - monkeypatch.setattr(fwbs_variables, "m_blkt_total", ifefbsparam.m_blkt_total) - monkeypatch.setattr(fwbs_variables, "whtshld", ifefbsparam.whtshld) - monkeypatch.setattr(fwbs_variables, "m_blkt_beryllium", ifefbsparam.m_blkt_beryllium) - monkeypatch.setattr(fwbs_variables, "m_blkt_vanadium", ifefbsparam.m_blkt_vanadium) + monkeypatch.setattr(ife.data.fwbs, "den_steel", ifefbsparam.den_steel) + monkeypatch.setattr(ife.data.fwbs, "m_fw_total", ifefbsparam.m_fw_total) + monkeypatch.setattr(ife.data.fwbs, "m_blkt_total", ifefbsparam.m_blkt_total) + monkeypatch.setattr(ife.data.fwbs, "whtshld", ifefbsparam.whtshld) + monkeypatch.setattr(ife.data.fwbs, "m_blkt_beryllium", ifefbsparam.m_blkt_beryllium) + monkeypatch.setattr(ife.data.fwbs, "m_blkt_vanadium", ifefbsparam.m_blkt_vanadium) monkeypatch.setattr( - fwbs_variables, "m_blkt_steel_total", ifefbsparam.m_blkt_steel_total + ife.data.fwbs, "m_blkt_steel_total", ifefbsparam.m_blkt_steel_total ) - monkeypatch.setattr(fwbs_variables, "m_blkt_li2o", ifefbsparam.m_blkt_li2o) - monkeypatch.setattr(fwbs_variables, "m_blkt_lithium", ifefbsparam.m_blkt_lithium) - monkeypatch.setattr(fwbs_variables, "life_blkt_fpy", ifefbsparam.life_blkt_fpy) - monkeypatch.setattr(fwbs_variables, "life_fw_fpy", ifefbsparam.life_fw_fpy) + monkeypatch.setattr(ife.data.fwbs, "m_blkt_li2o", ifefbsparam.m_blkt_li2o) + 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) @@ -1620,15 +1619,13 @@ def test_ifefbs(ifefbsparam, monkeypatch, ife): ife.ifefbs(output=False) - assert fwbs_variables.m_fw_total == pytest.approx(ifefbsparam.expected_m_fw_total) - assert fwbs_variables.m_blkt_total == pytest.approx( - ifefbsparam.expected_m_blkt_total - ) - assert fwbs_variables.whtshld == pytest.approx(ifefbsparam.expected_whtshld) - assert fwbs_variables.life_blkt_fpy == pytest.approx( + assert ife.data.fwbs.m_fw_total == pytest.approx(ifefbsparam.expected_m_fw_total) + assert ife.data.fwbs.m_blkt_total == pytest.approx(ifefbsparam.expected_m_blkt_total) + assert ife.data.fwbs.whtshld == pytest.approx(ifefbsparam.expected_whtshld) + assert ife.data.fwbs.life_blkt_fpy == pytest.approx( ifefbsparam.expected_life_blkt_fpy ) - assert fwbs_variables.life_fw_fpy == pytest.approx(ifefbsparam.expected_life_fw_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) @@ -2196,18 +2193,18 @@ def test_ifepw1(ifepw1param, monkeypatch, ife): :type monkeypatch: _pytest.monkeypatch.monkeypatch """ monkeypatch.setattr( - fwbs_variables, "f_p_blkt_multiplication", ifepw1param.f_p_blkt_multiplication + ife.data.fwbs, "f_p_blkt_multiplication", ifepw1param.f_p_blkt_multiplication ) - monkeypatch.setattr(fwbs_variables, "fhole", ifepw1param.fhole) + monkeypatch.setattr(ife.data.fwbs, "fhole", ifepw1param.fhole) monkeypatch.setattr( - fwbs_variables, + ife.data.fwbs, "p_blkt_nuclear_heat_total_mw", ifepw1param.p_blkt_nuclear_heat_total_mw, ) monkeypatch.setattr( - fwbs_variables, "p_shld_nuclear_heat_mw", ifepw1param.p_shld_nuclear_heat_mw + ife.data.fwbs, "p_shld_nuclear_heat_mw", ifepw1param.p_shld_nuclear_heat_mw ) - monkeypatch.setattr(fwbs_variables, "pnucloss", ifepw1param.pnucloss) + monkeypatch.setattr(ife.data.fwbs, "pnucloss", ifepw1param.pnucloss) monkeypatch.setattr(heat_transport_variables, "priheat", ifepw1param.priheat) monkeypatch.setattr( heat_transport_variables, @@ -2250,7 +2247,7 @@ def test_ifepw1(ifepw1param, monkeypatch, ife): ife.ifepw1() - assert fwbs_variables.p_blkt_nuclear_heat_total_mw == pytest.approx( + assert ife.data.fwbs.p_blkt_nuclear_heat_total_mw == pytest.approx( ifepw1param.expected_p_blkt_nuclear_heat_total_mw ) assert heat_transport_variables.priheat == pytest.approx( @@ -2654,9 +2651,9 @@ def test_bld2019(bld2019param, monkeypatch, ife): monkeypatch.setattr(ife.data.first_wall, "a_fw_total", bld2019param.a_fw_total) monkeypatch.setattr(buildings_variables, "trcl", bld2019param.trcl) monkeypatch.setattr(buildings_variables, "stcl", bld2019param.stcl) - monkeypatch.setattr(fwbs_variables, "tbr", bld2019param.tbr) + monkeypatch.setattr(ife.data.fwbs, "tbr", bld2019param.tbr) monkeypatch.setattr( - fwbs_variables, "f_p_blkt_multiplication", bld2019param.f_p_blkt_multiplication + ife.data.fwbs, "f_p_blkt_multiplication", bld2019param.f_p_blkt_multiplication ) for name, val in ( ("ifetyp", bld2019param.ifetyp), @@ -2717,8 +2714,8 @@ def test_bld2019(bld2019param, monkeypatch, ife): assert ife.data.first_wall.a_fw_total == pytest.approx( bld2019param.expected_a_fw_total ) - assert fwbs_variables.tbr == pytest.approx(bld2019param.expected_tbr) - assert fwbs_variables.f_p_blkt_multiplication == pytest.approx( + assert ife.data.fwbs.tbr == pytest.approx(bld2019param.expected_tbr) + assert ife.data.fwbs.f_p_blkt_multiplication == pytest.approx( bld2019param.expected_emult ) assert ife_variables.r1 == pytest.approx(bld2019param.expected_r1) @@ -3001,7 +2998,7 @@ def test_ifebdg(ifebdgparam, monkeypatch, ife): monkeypatch.setattr(buildings_variables, "volrci", ifebdgparam.volrci) monkeypatch.setattr(buildings_variables, "wsvol", ifebdgparam.wsvol) monkeypatch.setattr(buildings_variables, "volnucb", ifebdgparam.volnucb) - monkeypatch.setattr(fwbs_variables, "whtshld", ifebdgparam.whtshld) + monkeypatch.setattr(ife.data.fwbs, "whtshld", ifebdgparam.whtshld) monkeypatch.setattr(heat_transport_variables, "helpow", ifebdgparam.helpow) monkeypatch.setattr(ife_variables, "zl7", ifebdgparam.zl7) monkeypatch.setattr(ife_variables, "zu7", ifebdgparam.zu7) @@ -3116,13 +3113,13 @@ def test_ifepw2(ifepw2param, monkeypatch, ife): :type monkeypatch: _pytest.monkeypatch.monkeypatch """ monkeypatch.setattr(ife.data.costs, "ireactor", ifepw2param.ireactor) - monkeypatch.setattr(fwbs_variables, "pnucloss", ifepw2param.pnucloss) + monkeypatch.setattr(ife.data.fwbs, "pnucloss", ifepw2param.pnucloss) monkeypatch.setattr( - fwbs_variables, "f_p_blkt_multiplication", ifepw2param.f_p_blkt_multiplication + ife.data.fwbs, "f_p_blkt_multiplication", ifepw2param.f_p_blkt_multiplication ) - monkeypatch.setattr(fwbs_variables, "tbr", ifepw2param.tbr) + monkeypatch.setattr(ife.data.fwbs, "tbr", ifepw2param.tbr) monkeypatch.setattr( - fwbs_variables, + ife.data.fwbs, "p_blkt_nuclear_heat_total_mw", ifepw2param.p_blkt_nuclear_heat_total_mw, ) diff --git a/tests/unit/models/test_pfcoil.py b/tests/unit/models/test_pfcoil.py index 114bc3d66..55b5e25bd 100644 --- a/tests/unit/models/test_pfcoil.py +++ b/tests/unit/models/test_pfcoil.py @@ -17,7 +17,6 @@ from process.core import constants from process.data_structure import build_variables as bv -from process.data_structure import fwbs_variables as fwbsv 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 tfcoil_variables as tfv @@ -2454,7 +2453,7 @@ def test_pfcoil(monkeypatch, pfcoil): monkeypatch.setattr(bv, "dr_tf_inboard", 1.4) monkeypatch.setattr(bv, "r_tf_outboard_mid", 1.66e1) monkeypatch.setattr(bv, "dr_bore", 2.15) - monkeypatch.setattr(fwbsv, "den_steel", 7.8e3) + 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)) @@ -2586,7 +2585,7 @@ def test_ohcalc(monkeypatch, reinitialise_error_module, cs_coil): # Mocks for ohcalc() monkeypatch.setattr(bv, "z_tf_inside_half", 8.864) monkeypatch.setattr(bv, "dr_cs", 6.510e-1) - monkeypatch.setattr(fwbsv, "den_steel", 7.8e3) + monkeypatch.setattr(cs_coil.data.fwbs, "den_steel", 7.8e3) monkeypatch.setattr(bv, "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) diff --git a/tests/unit/models/test_power.py b/tests/unit/models/test_power.py index aaa247f9e..c4582606a 100644 --- a/tests/unit/models/test_power.py +++ b/tests/unit/models/test_power.py @@ -9,7 +9,6 @@ constraint_variables, current_drive_variables, divertor_variables, - fwbs_variables, heat_transport_variables, numerics, pf_power_variables, @@ -132,9 +131,9 @@ def test_cryo(cryoparam, monkeypatch, power): :type monkeypatch: _pytest.monkeypatch.monkeypatch """ - monkeypatch.setattr(fwbs_variables, "qnuc", cryoparam.qnuc) + monkeypatch.setattr(power.data.fwbs, "qnuc", cryoparam.qnuc) - monkeypatch.setattr(fwbs_variables, "inuclear", cryoparam.inuclear) + monkeypatch.setattr(power.data.fwbs, "inuclear", cryoparam.inuclear) monkeypatch.setattr(power_variables, "qss", cryoparam.qss) @@ -2519,81 +2518,81 @@ def test_power2(power2param, monkeypatch, power): ) monkeypatch.setattr( - fwbs_variables, "p_blkt_multiplication_mw", power2param.p_blkt_multiplication_mw + power.data.fwbs, "p_blkt_multiplication_mw", power2param.p_blkt_multiplication_mw ) - monkeypatch.setattr(fwbs_variables, "inuclear", power2param.inuclear) + monkeypatch.setattr(power.data.fwbs, "inuclear", power2param.inuclear) monkeypatch.setattr( - fwbs_variables, + power.data.fwbs, "p_blkt_nuclear_heat_total_mw", power2param.p_blkt_nuclear_heat_total_mw, ) monkeypatch.setattr( - fwbs_variables, "p_fw_rad_total_mw", power2param.p_fw_rad_total_mw + power.data.fwbs, "p_fw_rad_total_mw", power2param.p_fw_rad_total_mw ) - monkeypatch.setattr(fwbs_variables, "qnuc", power2param.qnuc) + monkeypatch.setattr(power.data.fwbs, "qnuc", power2param.qnuc) monkeypatch.setattr( - fwbs_variables, + power.data.fwbs, "eta_coolant_pump_electric", power2param.eta_coolant_pump_electric, ) monkeypatch.setattr( - fwbs_variables, "f_p_blkt_multiplication", power2param.f_p_blkt_multiplication + power.data.fwbs, "f_p_blkt_multiplication", power2param.f_p_blkt_multiplication ) monkeypatch.setattr( - fwbs_variables, "p_div_rad_total_mw", power2param.p_div_rad_total_mw + power.data.fwbs, "p_div_rad_total_mw", power2param.p_div_rad_total_mw ) monkeypatch.setattr( - fwbs_variables, "f_ster_div_single", power2param.f_ster_div_single + power.data.fwbs, "f_ster_div_single", power2param.f_ster_div_single ) monkeypatch.setattr( - fwbs_variables, "f_a_fw_outboard_hcd", power2param.f_a_fw_outboard_hcd + power.data.fwbs, "f_a_fw_outboard_hcd", power2param.f_a_fw_outboard_hcd ) monkeypatch.setattr( - fwbs_variables, + power.data.fwbs, "i_thermal_electric_conversion", power2param.i_thermal_electric_conversion, ) - monkeypatch.setattr(fwbs_variables, "pnuc_cp", power2param.pnuc_cp) + monkeypatch.setattr(power.data.fwbs, "pnuc_cp", power2param.pnuc_cp) monkeypatch.setattr( - fwbs_variables, + power.data.fwbs, "p_div_nuclear_heat_total_mw", power2param.p_div_nuclear_heat_total_mw, ) monkeypatch.setattr( - fwbs_variables, "i_p_coolant_pumping", power2param.i_p_coolant_pumping + power.data.fwbs, "i_p_coolant_pumping", power2param.i_p_coolant_pumping ) monkeypatch.setattr( - fwbs_variables, "p_tf_nuclear_heat_mw", power2param.p_tf_nuclear_heat_mw + power.data.fwbs, "p_tf_nuclear_heat_mw", power2param.p_tf_nuclear_heat_mw ) monkeypatch.setattr( - fwbs_variables, "p_fw_hcd_nuclear_heat_mw", power2param.p_fw_hcd_nuclear_heat_mw + power.data.fwbs, "p_fw_hcd_nuclear_heat_mw", power2param.p_fw_hcd_nuclear_heat_mw ) monkeypatch.setattr( - fwbs_variables, "p_shld_nuclear_heat_mw", power2param.p_shld_nuclear_heat_mw + power.data.fwbs, "p_shld_nuclear_heat_mw", power2param.p_shld_nuclear_heat_mw ) monkeypatch.setattr( - fwbs_variables, "p_fw_hcd_rad_total_mw", power2param.p_fw_hcd_rad_total_mw + power.data.fwbs, "p_fw_hcd_rad_total_mw", power2param.p_fw_hcd_rad_total_mw ) monkeypatch.setattr( - fwbs_variables, + power.data.fwbs, "p_fw_nuclear_heat_total_mw", power2param.p_fw_nuclear_heat_total_mw, ) diff --git a/tests/unit/models/tfcoil/test_sctfcoil.py b/tests/unit/models/tfcoil/test_sctfcoil.py index 896b80fd5..9ede84a49 100644 --- a/tests/unit/models/tfcoil/test_sctfcoil.py +++ b/tests/unit/models/tfcoil/test_sctfcoil.py @@ -7,7 +7,6 @@ build_variables, constraint_variables, divertor_variables, - fwbs_variables, global_variables, physics_variables, superconducting_tf_coil_variables, @@ -17,40 +16,38 @@ from process.models.tfcoil.superconducting import ( CICCAveragedTurnGeometry, CICCIntegerTurnGeometry, - CICCSuperconductingTFCoil, - CROCOSuperconductingTFCoil, SuperconductingTFCoil, ) @pytest.fixture -def sctfcoil(): - """Provides SuperconductingTFCoil object for testing. +def sctfcoil(process_models): + """Fixture to get the SuperconductingTFCoil instance from process_models. :returns: initialised SuperconductingTFCoil object :rtype: process.sctfcoil.SuperconductingTFCoil """ - return SuperconductingTFCoil() + return process_models.sctfcoil @pytest.fixture -def cicc_sctfcoil(): - """Provides CICCSuperconductingTFCoil object for testing. +def cicc_sctfcoil(process_models): + """Fixture to get the CICCSuperconductingTFCoil instance from process_models. :returns: initialised CICCSuperconductingTFCoil object :rtype: process.sctfcoil.CICCSuperconductingTFCoil """ - return CICCSuperconductingTFCoil() + return process_models.cicc_sctfcoil @pytest.fixture -def croco_sctfcoil(): +def croco_sctfcoil(process_models): """Provides CROCOSuperconductingTFCoil object for testing. :returns: initialised CROCOSuperconductingTFCoil object :rtype: process.sctfcoil.CROCOSuperconductingTFCoil """ - return CROCOSuperconductingTFCoil() + return process_models.croco_sctfcoil class ProtectParam(NamedTuple): @@ -1932,7 +1929,9 @@ def test_superconducting_tf_coil_area_and_masses( :type monkeypatch: _pytest.monkeypatch.monkeypatch """ - monkeypatch.setattr(fwbs_variables, "den_steel", tfcoilareaandmassesparam.den_steel) + monkeypatch.setattr( + sctfcoil.data.fwbs, "den_steel", tfcoilareaandmassesparam.den_steel + ) monkeypatch.setattr(physics_variables, "itart", tfcoilareaandmassesparam.itart) for name, val in ( diff --git a/tests/unit/models/tfcoil/test_tfcoil.py b/tests/unit/models/tfcoil/test_tfcoil.py index e07f75a42..3a99160b2 100644 --- a/tests/unit/models/tfcoil/test_tfcoil.py +++ b/tests/unit/models/tfcoil/test_tfcoil.py @@ -12,25 +12,20 @@ import process.models.tfcoil.base as tfcoil_module from process.data_structure import ( build_variables, - fwbs_variables, superconducting_tf_coil_variables, tfcoil_variables, ) -from process.models.build import Build from process.models.tfcoil.base import TFCoil @pytest.fixture -def tfcoil(): - """Provides TFCoil object for testing. - - :param monkeypatch: pytest mocking fixture - :type monkeypatch: MonkeyPatch +def tfcoil(process_models): + """Fixture to get the TFCoil instance from process_models. :return tfcoil: initialised TFCoil object :type tfcoil: process.tfcoil.TFCoil """ - return TFCoil(build=Build()) + return process_models.tfcoil @pytest.mark.parametrize( @@ -159,7 +154,7 @@ def test_cntrpst(cntrpst_asset, monkeypatch, reinitialise_error_module, tfcoil): monkeypatch.setattr( tfcoil_variables, "temp_cp_coolant_inlet", cntrpst_asset.temp_cp_coolant_inlet ) - monkeypatch.setattr(fwbs_variables, "pnuc_cp_tf", 1) + monkeypatch.setattr(tfcoil.data.fwbs, "pnuc_cp_tf", 1) monkeypatch.setattr(build_variables, "z_tf_inside_half", 1) monkeypatch.setattr(build_variables, "dr_tf_outboard", 0.5)