diff --git a/process/blanket_library.py b/process/blanket_library.py index f90c0f992..4ebbc9994 100644 --- a/process/blanket_library.py +++ b/process/blanket_library.py @@ -14,6 +14,7 @@ blanket_library, build_variables, divertor_variables, + first_wall_variables, fwbs_variables, heat_transport_variables, physics_variables, @@ -1611,13 +1612,13 @@ 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 - * build_variables.a_fw_inboard - / build_variables.a_fw_total + * first_wall_variables.a_fw_inboard + / first_wall_variables.a_fw_total ) blanket_library.p_fw_outboard_nuclear_heat_mw = ( fwbs_variables.p_fw_nuclear_heat_total_mw - * build_variables.a_fw_outboard - / build_variables.a_fw_total + * first_wall_variables.a_fw_outboard + / first_wall_variables.a_fw_total ) # IB/OB Blanket (MW) @@ -1747,7 +1748,7 @@ def thermo_hydraulic_model(self, output: bool): output, fwbs_variables.radius_fw_channel, build_variables.dr_fw_inboard, - build_variables.a_fw_inboard, + first_wall_variables.a_fw_inboard, fwbs_variables.psurffwi, blanket_library.p_fw_inboard_nuclear_heat_mw, "Inboard first wall", @@ -1761,7 +1762,7 @@ def thermo_hydraulic_model(self, output: bool): output, fwbs_variables.radius_fw_channel, build_variables.dr_fw_outboard, - build_variables.a_fw_outboard, + first_wall_variables.a_fw_outboard, fwbs_variables.psurffwo, blanket_library.p_fw_outboard_nuclear_heat_mw, "Outboard first wall", diff --git a/process/build.py b/process/build.py index 860cf48c7..20609b8ff 100644 --- a/process/build.py +++ b/process/build.py @@ -4,7 +4,6 @@ from process import constants from process import process_output as po -from process.blanket_library import dshellarea, eshellarea from process.data_structure import ( build_variables, buildings_variables, @@ -17,7 +16,6 @@ superconducting_tf_coil_variables, tfcoil_variables, ) -from process.exceptions import ProcessValueError logger = logging.getLogger(__name__) @@ -2010,124 +2008,6 @@ def calculate_radial_build(self, output: bool) -> None: dx_tf_wp_insertion_gap=tfcoil_variables.dx_tf_wp_insertion_gap, ) - # Half-height of first wall (internal surface) - hbot = ( - build_variables.z_plasma_xpoint_lower - + build_variables.dz_xpoint_divertor - + divertor_variables.dz_divertor - - build_variables.dz_blkt_upper - - 0.5e0 * (build_variables.dr_fw_inboard + build_variables.dr_fw_outboard) - ) - if ( - divertor_variables.n_divertors == 2 - ): # (i.e. physics_variables.i_single_null=0) - htop = hbot - else: - htop = ( - build_variables.z_plasma_xpoint_upper + build_variables.dz_fw_plasma_gap - ) - - hfw = 0.5e0 * (htop + hbot) - - if (physics_variables.itart == 1) or ( - fwbs_variables.i_fw_blkt_vv_shape == 1 - ): # D-shaped - # Major radius to outer edge of inboard section - r1 = ( - physics_variables.rmajor - - physics_variables.rminor - - build_variables.dr_fw_plasma_gap_inboard - ) - - # Horizontal distance between inside edges, - # i.e. outer radius of inboard part to inner radius of outboard part - - r2 = ( - physics_variables.rmajor - + physics_variables.rminor - + build_variables.dr_fw_plasma_gap_outboard - ) - r1 - # Calculate surface area, assuming 100% coverage - - ( - build_variables.a_fw_inboard_full_coverage, - build_variables.a_fw_outboard_full_coverage, - build_variables.a_fw_total_full_coverage, - ) = dshellarea(r1, r2, hfw) - - else: # Cross-section is assumed to be defined by two ellipses - # Major radius to centre of inboard and outboard ellipses - # (coincident in radius with top of plasma) - - r1 = ( - physics_variables.rmajor - - physics_variables.rminor * physics_variables.triang - ) - - # Distance between r1 and outer edge of inboard section - - r2 = r1 - ( - physics_variables.rmajor - - physics_variables.rminor - - build_variables.dr_fw_plasma_gap_inboard - ) - - # Distance between r1 and inner edge of outboard section - - r3 = ( - physics_variables.rmajor - + physics_variables.rminor - + build_variables.dr_fw_plasma_gap_outboard - ) - r1 - - # Calculate surface area, assuming 100% coverage - - ( - build_variables.a_fw_inboard_full_coverage, - build_variables.a_fw_outboard_full_coverage, - build_variables.a_fw_total_full_coverage, - ) = eshellarea(r1, r2, r3, hfw) - - # Apply area coverage factor - - if divertor_variables.n_divertors == 2: - # Double null configuration - build_variables.a_fw_outboard = ( - build_variables.a_fw_outboard_full_coverage - * ( - 1.0e0 - - 2.0e0 * fwbs_variables.f_ster_div_single - - fwbs_variables.f_a_fw_outboard_hcd - ) - ) - build_variables.a_fw_inboard = build_variables.a_fw_inboard_full_coverage * ( - 1.0e0 - 2.0e0 * fwbs_variables.f_ster_div_single - ) - else: - # Single null configuration - build_variables.a_fw_outboard = ( - build_variables.a_fw_outboard_full_coverage - * ( - 1.0e0 - - fwbs_variables.f_ster_div_single - - fwbs_variables.f_a_fw_outboard_hcd - ) - ) - build_variables.a_fw_inboard = build_variables.a_fw_inboard_full_coverage * ( - 1.0e0 - fwbs_variables.f_ster_div_single - ) - - build_variables.a_fw_total = ( - build_variables.a_fw_inboard + build_variables.a_fw_outboard - ) - - if build_variables.a_fw_outboard <= 0.0e0: - raise ProcessValueError( - "fhole+f_ster_div_single+f_a_fw_outboard_hcd is too high for a credible outboard wall area", - f_ster_div_single=fwbs_variables.f_ster_div_single, - f_a_fw_outboard_hcd=fwbs_variables.f_a_fw_outboard_hcd, - ) - # if output: diff --git a/process/costs.py b/process/costs.py index f1aa09dc7..723633f93 100644 --- a/process/costs.py +++ b/process/costs.py @@ -8,6 +8,7 @@ cost_variables, current_drive_variables, divertor_variables, + first_wall_variables, fwbs_variables, heat_transport_variables, ife_variables, @@ -1220,7 +1221,7 @@ def acc2211(self): * cmlsa[cost_variables.lsa - 1] * ( (cost_variables.UCFWA + cost_variables.UCFWS) - * build_variables.a_fw_total + * first_wall_variables.a_fw_total + cost_variables.UCFWPS ) ) diff --git a/process/costs_2015.py b/process/costs_2015.py index 559d66a5e..77f33b2af 100644 --- a/process/costs_2015.py +++ b/process/costs_2015.py @@ -9,6 +9,7 @@ cost_2015_variables, cost_variables, current_drive_variables, + first_wall_variables, fwbs_variables, global_variables, heat_transport_variables, @@ -278,7 +279,7 @@ def calc_fwbs_costs(self): cost_2015_variables.s_cref[24] = 25.0e6 # First wall W coating mass (kg) cost_2015_variables.s_k[24] = ( - build_variables.a_fw_total + first_wall_variables.a_fw_total * fwbs_variables.fw_armour_thickness * constants.DEN_TUNGSTEN ) diff --git a/process/data_structure/build_variables.py b/process/data_structure/build_variables.py index 1ac8259bd..1c6c0e256 100644 --- a/process/data_structure/build_variables.py +++ b/process/data_structure/build_variables.py @@ -107,29 +107,6 @@ """Separation force in CS coil pre-compression structure""" -a_fw_total_full_coverage: float = None -"""First wall total surface area with no holes or ports [m^2]""" - - -a_fw_inboard_full_coverage: float = None -"""Inboard first wall surface area with no holes or ports [m^2]""" - - -a_fw_outboard_full_coverage: float = None -"""Outboard first wall surface area with no holes or ports [m^2]""" - -a_fw_total: float = None -"""First wall total surface area [m^2]""" - - -a_fw_inboard: float = None -"""Inboard first wall surface area [m^2]""" - - -a_fw_outboard: float = None -"""Outboard first wall surface area [m^2]""" - - dr_fw_inboard: float = None """inboard first wall thickness, initial estimate as calculated (m)""" @@ -438,12 +415,6 @@ def init_build_variables(): dr_vv_shells, \ fcspc, \ fseppc, \ - a_fw_total_full_coverage, \ - a_fw_inboard_full_coverage, \ - a_fw_outboard_full_coverage, \ - a_fw_total, \ - a_fw_inboard, \ - a_fw_outboard, \ dr_fw_inboard, \ dr_fw_outboard, \ dr_shld_vv_gap_inboard, \ @@ -535,12 +506,6 @@ def init_build_variables(): dr_vv_shells = 0.12 fcspc = 0.6 fseppc = 3.5e8 - a_fw_total_full_coverage = 0.0 - a_fw_inboard_full_coverage = 0.0 - a_fw_outboard_full_coverage = 0.0 - a_fw_total = 0.0 - a_fw_inboard = 0.0 - a_fw_outboard = 0.0 dr_fw_inboard = 0.0 dr_fw_outboard = 0.0 dr_shld_vv_gap_inboard = 0.155 diff --git a/process/data_structure/first_wall_variables.py b/process/data_structure/first_wall_variables.py new file mode 100644 index 000000000..ff50d35ab --- /dev/null +++ b/process/data_structure/first_wall_variables.py @@ -0,0 +1,38 @@ +a_fw_total_full_coverage: float = None +"""First wall total surface area with no holes or ports [m^2]""" + + +a_fw_inboard_full_coverage: float = None +"""Inboard first wall surface area with no holes or ports [m^2]""" + + +a_fw_outboard_full_coverage: float = None +"""Outboard first wall surface area with no holes or ports [m^2]""" + + +a_fw_total: float = None +"""First wall total surface area [m^2]""" + +a_fw_inboard: float = None +"""Inboard first wall surface area [m^2]""" + +a_fw_outboard: float = None +"""Outboard first wall surface area [m^2]""" + + +def init_first_wall_variables() -> None: + """Initializes first wall variables to None""" + global \ + a_fw_total_full_coverage, \ + a_fw_inboard_full_coverage, \ + a_fw_outboard_full_coverage, \ + a_fw_total, \ + a_fw_inboard, \ + a_fw_outboard + + a_fw_total_full_coverage = 0.0 + a_fw_inboard_full_coverage = 0.0 + a_fw_outboard_full_coverage = 0.0 + a_fw_total = 0.0 + a_fw_inboard = 0.0 + a_fw_outboard = 0.0 diff --git a/process/data_structure/fwbs_variables.py b/process/data_structure/fwbs_variables.py index 5decc9c3d..37361a5d6 100644 --- a/process/data_structure/fwbs_variables.py +++ b/process/data_structure/fwbs_variables.py @@ -907,6 +907,9 @@ 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""" @@ -1108,7 +1111,8 @@ def init_fwbs_variables(): radius_fw_channel_90_bend, \ radius_fw_channel_180_bend, \ radius_blkt_channel_90_bend, \ - radius_blkt_channel_180_bend + radius_blkt_channel_180_bend, \ + dz_fw_half life_blkt_fpy = 0.0 life_blkt = 0.0 @@ -1308,3 +1312,4 @@ def init_fwbs_variables(): 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 diff --git a/process/dcll.py b/process/dcll.py index 2b368ac7f..5a85b3b66 100644 --- a/process/dcll.py +++ b/process/dcll.py @@ -9,6 +9,7 @@ current_drive_variables, dcll_variables, divertor_variables, + first_wall_variables, fwbs_variables, heat_transport_variables, physics_variables, @@ -193,13 +194,13 @@ def dcll_neutronics_and_power(self, output: bool): # All of the fast particle losses go to the outer wall. fwbs_variables.psurffwo = ( fwbs_variables.p_fw_rad_total_mw - * build_variables.a_fw_outboard - / build_variables.a_fw_total + * first_wall_variables.a_fw_outboard + / first_wall_variables.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 * ( - 1 - build_variables.a_fw_outboard / build_variables.a_fw_total + 1 - first_wall_variables.a_fw_outboard / first_wall_variables.a_fw_total ) if output: @@ -685,8 +686,8 @@ def dcll_masses(self, output: bool): # FW # First wall volume (m^3) fwbs_variables.vol_fw_total = ( - build_variables.a_fw_inboard * build_variables.dr_fw_inboard - + build_variables.a_fw_outboard * build_variables.dr_fw_outboard + first_wall_variables.a_fw_inboard * build_variables.dr_fw_inboard + + first_wall_variables.a_fw_outboard * build_variables.dr_fw_outboard ) # First wall mass, excluding armour (kg) dcll_variables.fwmass_stl = ( @@ -738,7 +739,7 @@ def dcll_masses(self, output: bool): * (fwbs_variables.vol_blkt_inboard / fwbs_variables.vol_blkt_total) + fwbs_variables.m_fw_total * ( - build_variables.a_fw_inboard + first_wall_variables.a_fw_inboard * build_variables.dr_fw_inboard / fwbs_variables.vol_fw_total ) @@ -758,7 +759,7 @@ def dcll_masses(self, output: bool): * (fwbs_variables.vol_blkt_outboard / fwbs_variables.vol_blkt_total) + fwbs_variables.m_fw_total * ( - build_variables.a_fw_outboard + first_wall_variables.a_fw_outboard * build_variables.dr_fw_outboard / fwbs_variables.vol_fw_total ) diff --git a/process/fw.py b/process/fw.py index ceaed7068..028dd47c2 100644 --- a/process/fw.py +++ b/process/fw.py @@ -4,25 +4,84 @@ from process import constants from process import process_output as po -from process.blanket_library import BlanketLibrary +from process.blanket_library import BlanketLibrary, dshellarea, eshellarea from process.coolprop_interface import FluidProperties -from process.data_structure import blanket_library, build_variables, fwbs_variables +from process.data_structure import ( + blanket_library, + build_variables, + divertor_variables, + first_wall_variables, + fwbs_variables, + physics_variables, +) +from process.exceptions import ProcessValueError logger = logging.getLogger(__name__) -class Fw: +class FirstWall: def __init__(self) -> None: self.outfile = constants.NOUT self.blanket_library = BlanketLibrary(fw=self) def run(self): + fwbs_variables.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, + dz_blkt_upper=build_variables.dz_blkt_upper, + z_plasma_xpoint_upper=build_variables.z_plasma_xpoint_upper, + dz_fw_plasma_gap=build_variables.dz_fw_plasma_gap, + n_divertors=divertor_variables.n_divertors, + dr_fw_inboard=build_variables.dr_fw_inboard, + dr_fw_outboard=build_variables.dr_fw_outboard, + ) + + if physics_variables.itart == 1 or fwbs_variables.i_fw_blkt_vv_shape == 1: + ( + first_wall_variables.a_fw_inboard_full_coverage, + first_wall_variables.a_fw_outboard_full_coverage, + first_wall_variables.a_fw_total_full_coverage, + ) = self.calculate_dshaped_first_wall_areas( + rmajor=physics_variables.rmajor, + rminor=physics_variables.rminor, + dz_fw_half=fwbs_variables.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, + ) + + else: + ( + first_wall_variables.a_fw_inboard_full_coverage, + first_wall_variables.a_fw_outboard_full_coverage, + first_wall_variables.a_fw_total_full_coverage, + ) = self.calculate_elliptical_first_wall_areas( + rmajor=physics_variables.rmajor, + rminor=physics_variables.rminor, + triang=physics_variables.triang, + dz_fw_half=fwbs_variables.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, + ) + + ( + first_wall_variables.a_fw_inboard, + first_wall_variables.a_fw_outboard, + first_wall_variables.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, + a_fw_inboard_full_coverage=first_wall_variables.a_fw_inboard_full_coverage, + a_fw_outboard_full_coverage=first_wall_variables.a_fw_outboard_full_coverage, + ) + ( blanket_library.n_fw_inboard_channels, blanket_library.n_fw_outboard_channels, ) = self.calculate_total_fw_channels( - build_variables.a_fw_inboard, - build_variables.a_fw_outboard, + first_wall_variables.a_fw_inboard, + first_wall_variables.a_fw_outboard, fwbs_variables.len_fw_channel, fwbs_variables.dx_fw_module, ) @@ -34,6 +93,155 @@ def run(self): fwbs_variables.radius_fw_channel_180_bend, ) = self.blanket_library.calculate_pipe_bend_radius(i_ps=1) + @staticmethod + def calculate_first_wall_half_height( + z_plasma_xpoint_lower: float, + dz_xpoint_divertor: float, + dz_divertor: float, + dz_blkt_upper: float, + z_plasma_xpoint_upper: float, + dz_fw_plasma_gap: float, + n_divertors: int, + dr_fw_inboard: float, + dr_fw_outboard: float, + ) -> float: + """Calculate the half-height of the first wall.""" + + # Half-height of first wall (internal surface) + z_bottom = ( + z_plasma_xpoint_lower + + dz_xpoint_divertor + + dz_divertor + - dz_blkt_upper + - 0.5e0 * (dr_fw_inboard + dr_fw_outboard) + ) + if n_divertors == 2: + z_top = z_bottom + else: + z_top = z_plasma_xpoint_upper + dz_fw_plasma_gap + + return 0.5e0 * (z_top + z_bottom) + + @staticmethod + def calculate_dshaped_first_wall_areas( + rmajor: float, + rminor: float, + dz_fw_half: float, + dr_fw_plasma_gap_inboard: float, + dr_fw_plasma_gap_outboard: float, + ) -> tuple[float, float, float]: + # D-shaped + # Major radius to outer edge of inboard section + r1 = rmajor - rminor - dr_fw_plasma_gap_inboard + + # Horizontal distance between inside edges, + # i.e. outer radius of inboard part to inner radius of outboard part + + r2 = (rmajor + rminor + dr_fw_plasma_gap_outboard) - r1 + # Calculate surface area, assuming 100% coverage + + ( + a_fw_inboard_full_coverage, + a_fw_outboard_full_coverage, + a_fw_total_full_coverage, + ) = dshellarea(rmajor=r1, rminor=r2, zminor=dz_fw_half) + + return ( + a_fw_inboard_full_coverage, + a_fw_outboard_full_coverage, + a_fw_total_full_coverage, + ) + + @staticmethod + def calculate_elliptical_first_wall_areas( + rmajor: float, + rminor: float, + triang: float, + dz_fw_half: float, + dr_fw_plasma_gap_inboard: float, + dr_fw_plasma_gap_outboard: float, + ) -> tuple[float, float, float]: + """Calculate the first wall areas for an elliptical cross-section.""" + + # Cross-section is assumed to be defined by two ellipses + # Major radius to centre of inboard and outboard ellipses + # (coincident in radius with top of plasma) + + r1 = rmajor - rminor * triang + + # Distance between r1 and outer edge of inboard section + + r2 = r1 - (rmajor - rminor - dr_fw_plasma_gap_inboard) + + # Distance between r1 and inner edge of outboard section + + r3 = (rmajor + rminor + dr_fw_plasma_gap_outboard) - r1 + + # Calculate surface area, assuming 100% coverage + + ( + a_fw_inboard_full_coverage, + a_fw_outboard_full_coverage, + a_fw_total_full_coverage, + ) = eshellarea(rshell=r1, rmini=r2, rmino=r3, zminor=dz_fw_half) + + return ( + a_fw_inboard_full_coverage, + a_fw_outboard_full_coverage, + a_fw_total_full_coverage, + ) + + @staticmethod + def apply_first_wall_coverage_factors( + n_divertors: int, + f_ster_div_single: float, + f_a_fw_outboard_hcd: float, + a_fw_inboard_full_coverage: float, + a_fw_outboard_full_coverage: float, + ) -> tuple[float, float, float]: + """Apply first wall coverage factors to calculate actual first wall areas. + + :param n_divertors: Number of divertors (1 or 2). + :type n_divertors: int + :param f_ster_div_single: Fractional area of first wall sterically blocked by single divertor. + :type f_ster_div_single: float + :param f_a_fw_outboard_hcd: Fractional area of outboard first wall covered by high heat flux components. + :type f_a_fw_outboard_hcd: float + :param a_fw_inboard_full_coverage: First wall inboard area assuming 100% coverage (m^2). + :type a_fw_inboard_full_coverage: float + :param a_fw_outboard_full_coverage: First wall outboard area assuming 100% coverage (m^2). + :type a_fw_outboard_full_coverage: float + + :returns: Contains first wall inboard area, outboard area, and total area (m^2). + :rtype: tuple[float, float, float] + + """ + if n_divertors == 2: + # Double null configuration + a_fw_outboard = a_fw_outboard_full_coverage * ( + 1.0e0 - 2.0e0 * f_ster_div_single - f_a_fw_outboard_hcd + ) + a_fw_inboard = a_fw_inboard_full_coverage * ( + 1.0e0 - 2.0e0 * f_ster_div_single + ) + else: + # Single null configuration + a_fw_outboard = a_fw_outboard_full_coverage * ( + 1.0e0 - f_ster_div_single - f_a_fw_outboard_hcd + ) + a_fw_inboard = a_fw_inboard_full_coverage * (1.0e0 - f_ster_div_single) + + a_fw_total = a_fw_inboard + a_fw_outboard + + if a_fw_outboard <= 0.0e0: + raise ProcessValueError( + "fhole+f_ster_div_single+f_a_fw_outboard_hcd is too high for a credible outboard wall area", + f_ster_div_single=f_ster_div_single, + f_a_fw_outboard_hcd=f_a_fw_outboard_hcd, + ) + + return a_fw_inboard, a_fw_outboard, a_fw_total + def set_fw_geometry(self): build_variables.dr_fw_inboard = ( 2 * fwbs_variables.radius_fw_channel + 2 * fwbs_variables.dr_fw_wall diff --git a/process/hcpb.py b/process/hcpb.py index 288beb7a5..855fb1ae6 100644 --- a/process/hcpb.py +++ b/process/hcpb.py @@ -16,6 +16,7 @@ cost_variables, current_drive_variables, divertor_variables, + first_wall_variables, fwbs_variables, heat_transport_variables, physics_variables, @@ -282,10 +283,10 @@ def component_masses(self): # First wall coolant volume (m3) coolvol = ( coolvol - + build_variables.a_fw_inboard + + first_wall_variables.a_fw_inboard * build_variables.dr_fw_inboard * fwbs_variables.f_a_fw_coolant_inboard - + build_variables.a_fw_outboard + + first_wall_variables.a_fw_outboard * build_variables.dr_fw_outboard * fwbs_variables.f_a_fw_coolant_outboard ) @@ -295,14 +296,14 @@ def component_masses(self): # Average first wall coolant fraction, only used by old routines in fispact.f90, safety.f90 fwbs_variables.fwclfr = ( - build_variables.a_fw_inboard + first_wall_variables.a_fw_inboard * build_variables.dr_fw_inboard * fwbs_variables.f_a_fw_coolant_inboard - + build_variables.a_fw_outboard + + first_wall_variables.a_fw_outboard * build_variables.dr_fw_outboard * fwbs_variables.f_a_fw_coolant_outboard ) / ( - build_variables.a_fw_total + first_wall_variables.a_fw_total * 0.5 * (build_variables.dr_fw_inboard + build_variables.dr_fw_outboard) ) @@ -346,10 +347,10 @@ def component_masses(self): # First wall volume (m^3) fwbs_variables.vol_fw_total = ( - build_variables.a_fw_inboard + first_wall_variables.a_fw_inboard * build_variables.dr_fw_inboard * (1.0 - fwbs_variables.f_a_fw_coolant_inboard) - + build_variables.a_fw_outboard + + first_wall_variables.a_fw_outboard * build_variables.dr_fw_outboard * (1.0 - fwbs_variables.f_a_fw_coolant_outboard) ) @@ -761,13 +762,13 @@ def powerflow_calc(self, output: bool): # All of the fast particle losses go to the outer wall. fwbs_variables.psurffwo = ( fwbs_variables.p_fw_rad_total_mw - * build_variables.a_fw_outboard - / build_variables.a_fw_total + * first_wall_variables.a_fw_outboard + / first_wall_variables.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 * ( - 1 - build_variables.a_fw_outboard / build_variables.a_fw_total + 1 - first_wall_variables.a_fw_outboard / first_wall_variables.a_fw_total ) if fwbs_variables.i_p_coolant_pumping == 1: @@ -1565,13 +1566,13 @@ def write_output(self): self.outfile, "First wall area (m^2)", "(a_fw_total)", - build_variables.a_fw_total, + first_wall_variables.a_fw_total, ) po.ovarre( self.outfile, "First wall area, no holes (m^2)", "(a_fw_total_full_coverage)", - build_variables.a_fw_total_full_coverage, + first_wall_variables.a_fw_total_full_coverage, ) po.ovarre( self.outfile, diff --git a/process/ife.py b/process/ife.py index ee3d1fe0f..d9e1d6ff7 100644 --- a/process/ife.py +++ b/process/ife.py @@ -9,9 +9,9 @@ from process import constants, process_output from process.data_structure import ( - build_variables, buildings_variables, cost_variables, + first_wall_variables, fwbs_variables, heat_transport_variables, ife_variables, @@ -270,7 +270,7 @@ def osibld(self): self.genbld() # First wall area: no true first wall at bottom of chamber - build_variables.a_fw_total = ( + first_wall_variables.a_fw_total = ( 2.0 * np.pi * ife_variables.r1 * (ife_variables.zu1 + ife_variables.zl1) + np.pi * ife_variables.r1 * ife_variables.r1 ) @@ -580,7 +580,7 @@ def sombld(self): ) # First wall area - build_variables.a_fw_total = ( + first_wall_variables.a_fw_total = ( 2.0 * np.pi * ife_variables.r1 @@ -790,15 +790,15 @@ def hylbld(self): ) # First wall area - build_variables.a_fw_total = ( + first_wall_variables.a_fw_total = ( 2.0 * np.pi * ife_variables.r1 * (ife_variables.zu1 + ife_variables.zl5) ) - build_variables.a_fw_total = build_variables.a_fw_total + np.pi * ( + first_wall_variables.a_fw_total = first_wall_variables.a_fw_total + np.pi * ( ife_variables.r1 * ife_variables.r1 - ife_variables.flirad * ife_variables.flirad ) - build_variables.a_fw_total = ( - build_variables.a_fw_total + first_wall_variables.a_fw_total = ( + first_wall_variables.a_fw_total + np.pi * ife_variables.r1 * np.sqrt( @@ -1119,7 +1119,7 @@ def bld2019(self): # with only the top being solid. This is considered part # of the shield. There is a target injector tube at the # centre of this area. - build_variables.a_fw_total = np.pi * ( + first_wall_variables.a_fw_total = np.pi * ( ife_variables.r1 * ife_variables.r1 - ife_variables.flirad * ife_variables.flirad ) @@ -1326,7 +1326,7 @@ def genbld(self): # First wall area - build_variables.a_fw_total = ( + first_wall_variables.a_fw_total = ( 2.0 * np.pi * ife_variables.r1 @@ -1395,7 +1395,7 @@ def ifephy(self, output: bool = False): physics_variables.p_fusion_total_mw * 0.5 * sang - / build_variables.a_fw_total + / first_wall_variables.a_fw_total ) elif ife_variables.ifetyp == 4: @@ -1410,12 +1410,12 @@ def ifephy(self, output: bool = False): physics_variables.p_fusion_total_mw * 0.5 * sang - / build_variables.a_fw_total + / first_wall_variables.a_fw_total ) else: physics_variables.pflux_fw_neutron_mw = ( - physics_variables.p_fusion_total_mw / build_variables.a_fw_total + physics_variables.p_fusion_total_mw / first_wall_variables.a_fw_total ) if not output: @@ -1770,7 +1770,7 @@ def ifefbs(self, output: bool = False): self.outfile, "First wall area (m2)", "(a_fw_total)", - build_variables.a_fw_total, + first_wall_variables.a_fw_total, ) process_output.ovarre( self.outfile, diff --git a/process/main.py b/process/main.py index 367fe51a7..630f93891 100644 --- a/process/main.py +++ b/process/main.py @@ -69,7 +69,7 @@ ) from process.dcll import DCLL from process.divertor import Divertor -from process.fw import Fw +from process.fw import FirstWall from process.hcpb import CCFE_HCPB from process.ife import IFE from process.impurity_radiation import initialise_imprad @@ -668,7 +668,7 @@ def __init__(self): self.pulse = Pulse() self.ife = IFE(availability=self.availability, costs=self.costs) self.plasma_profile = PlasmaProfile() - self.fw = Fw() + self.fw = FirstWall() self.blanket_library = BlanketLibrary(fw=self.fw) self.ccfe_hcpb = CCFE_HCPB(fw=self.fw) self.current_drive = CurrentDrive( diff --git a/process/stellarator.py b/process/stellarator.py index eb955acb7..97ee7a9c9 100644 --- a/process/stellarator.py +++ b/process/stellarator.py @@ -16,6 +16,7 @@ cost_variables, current_drive_variables, divertor_variables, + first_wall_variables, fwbs_variables, global_variables, heat_transport_variables, @@ -459,21 +460,21 @@ def stbild(self, output: bool): build_variables.dr_fw_plasma_gap_inboard + build_variables.dr_fw_plasma_gap_outboard ) - build_variables.a_fw_total = ( + first_wall_variables.a_fw_total = ( physics_variables.a_plasma_surface * awall / physics_variables.rminor ) if heat_transport_variables.ipowerflow == 0: - build_variables.a_fw_total = ( + first_wall_variables.a_fw_total = ( 1.0e0 - fwbs_variables.fhole - ) * build_variables.a_fw_total + ) * first_wall_variables.a_fw_total else: - build_variables.a_fw_total = ( + first_wall_variables.a_fw_total = ( 1.0e0 - fwbs_variables.fhole - fwbs_variables.f_ster_div_single - fwbs_variables.f_a_fw_outboard_hcd - ) * build_variables.a_fw_total + ) * first_wall_variables.a_fw_total if output: # Print out device build @@ -915,7 +916,7 @@ def stdiv(self, output: bool): divertor_variables.pflux_div_heat_load_mw = q_div divertor_variables.a_div_surface_total = darea - fwbs_variables.f_ster_div_single = darea / build_variables.a_fw_total + fwbs_variables.f_ster_div_single = darea / first_wall_variables.a_fw_total if output: po.oheadr(self.outfile, "Divertor") @@ -1105,8 +1106,8 @@ def stfwbs(self, output: bool): ) # First wall inboard, outboard areas (assume 50% of total each) - build_variables.a_fw_inboard = 0.5e0 * build_variables.a_fw_total - build_variables.a_fw_outboard = 0.5e0 * build_variables.a_fw_total + first_wall_variables.a_fw_inboard = 0.5e0 * first_wall_variables.a_fw_total + first_wall_variables.a_fw_outboard = 0.5e0 * first_wall_variables.a_fw_total # Blanket volume; assume that its surface area is scaled directly from the # plasma surface area. @@ -1342,10 +1343,14 @@ def stfwbs(self, output: bool): # Split between inboard and outboard by first wall area fractions pnucfwbsi = ( - pnucfwbs * build_variables.a_fw_inboard / build_variables.a_fw_total + pnucfwbs + * first_wall_variables.a_fw_inboard + / first_wall_variables.a_fw_total ) pnucfwbso = ( - pnucfwbs * build_variables.a_fw_outboard / build_variables.a_fw_total + pnucfwbs + * first_wall_variables.a_fw_outboard + / first_wall_variables.a_fw_total ) # Radiation power incident on divertor (MW) @@ -1427,13 +1432,13 @@ def stfwbs(self, output: bool): psurffwi = ( fwbs_variables.p_fw_rad_total_mw - * build_variables.a_fw_inboard - / build_variables.a_fw_total + * first_wall_variables.a_fw_inboard + / first_wall_variables.a_fw_total ) psurffwo = ( fwbs_variables.p_fw_rad_total_mw - * build_variables.a_fw_outboard - / build_variables.a_fw_total + * first_wall_variables.a_fw_outboard + / first_wall_variables.a_fw_total ) # Simple blanket model (fwbs_variables.i_p_coolant_pumping = 0 or 1) is assumed for stellarators @@ -1542,15 +1547,15 @@ def stfwbs(self, output: bool): pnucbsi - pnucbzi + (fwbs_variables.pnucloss + fwbs_variables.pradloss) - * build_variables.a_fw_inboard - / build_variables.a_fw_total + * first_wall_variables.a_fw_inboard + / first_wall_variables.a_fw_total ) pnucso = ( pnucbso - pnucbzo + (fwbs_variables.pnucloss + fwbs_variables.pradloss) - * build_variables.a_fw_outboard - / build_variables.a_fw_total + * first_wall_variables.a_fw_outboard + / first_wall_variables.a_fw_total ) # Improved calculation of shield power decay lengths required @@ -1794,7 +1799,7 @@ def stfwbs(self, output: bool): # (first wall area is calculated else:where) fwbs_variables.m_fw_total = ( - build_variables.a_fw_total + first_wall_variables.a_fw_total * (build_variables.dr_fw_inboard + build_variables.dr_fw_outboard) / 2.0e0 * fwbs_variables.den_steel @@ -1805,7 +1810,7 @@ def stfwbs(self, output: bool): coolvol = ( coolvol - + build_variables.a_fw_total + + first_wall_variables.a_fw_total * (build_variables.dr_fw_inboard + build_variables.dr_fw_outboard) / 2.0e0 * fwbs_variables.fwclfr @@ -1813,19 +1818,19 @@ def stfwbs(self, output: bool): else: fwbs_variables.m_fw_total = fwbs_variables.den_steel * ( - build_variables.a_fw_inboard + first_wall_variables.a_fw_inboard * build_variables.dr_fw_inboard * (1.0e0 - f_a_fw_coolant_inboard) - + build_variables.a_fw_outboard + + first_wall_variables.a_fw_outboard * build_variables.dr_fw_outboard * (1.0e0 - f_a_fw_coolant_outboard) ) coolvol = ( coolvol - + build_variables.a_fw_inboard + + first_wall_variables.a_fw_inboard * build_variables.dr_fw_inboard * f_a_fw_coolant_inboard - + build_variables.a_fw_outboard + + first_wall_variables.a_fw_outboard * build_variables.dr_fw_outboard * f_a_fw_coolant_outboard ) @@ -1834,14 +1839,14 @@ def stfwbs(self, output: bool): # in fispact.f90, safety.f90 fwbs_variables.fwclfr = ( - build_variables.a_fw_inboard + first_wall_variables.a_fw_inboard * build_variables.dr_fw_inboard * f_a_fw_coolant_inboard - + build_variables.a_fw_outboard + + first_wall_variables.a_fw_outboard * build_variables.dr_fw_outboard * f_a_fw_coolant_outboard ) / ( - build_variables.a_fw_total + first_wall_variables.a_fw_total * 0.5e0 * (build_variables.dr_fw_inboard + build_variables.dr_fw_outboard) ) @@ -2256,7 +2261,7 @@ def stfwbs(self, output: bool): self.outfile, "First wall area (m2)", "(a_fw_total)", - build_variables.a_fw_total, + first_wall_variables.a_fw_total, ) po.ovarre( self.outfile, @@ -4405,7 +4410,7 @@ def stphys(self, output): physics_variables.pflux_fw_neutron_mw = ( (1.0e0 - fwbs_variables.fhole) * physics_variables.p_neutron_total_mw - / build_variables.a_fw_total + / first_wall_variables.a_fw_total ) else: physics_variables.pflux_fw_neutron_mw = ( @@ -4416,7 +4421,7 @@ def stphys(self, output): - fwbs_variables.f_ster_div_single ) * physics_variables.p_neutron_total_mw - / build_variables.a_fw_total + / first_wall_variables.a_fw_total ) # Calculate ion/electron equilibration power @@ -4531,7 +4536,7 @@ def stphys(self, output): physics_variables.pflux_fw_rad_mw = ( (1.0e0 - fwbs_variables.fhole) * physics_variables.p_plasma_rad_mw - / build_variables.a_fw_total + / first_wall_variables.a_fw_total ) else: physics_variables.pflux_fw_rad_mw = ( @@ -4542,7 +4547,7 @@ def stphys(self, output): - fwbs_variables.f_ster_div_single ) * physics_variables.p_plasma_rad_mw - / build_variables.a_fw_total + / first_wall_variables.a_fw_total ) constraint_variables.pflux_fw_rad_max_mw = ( diff --git a/tests/integration/test_blanket_library_int.py b/tests/integration/test_blanket_library_int.py index 9ae37897e..7266b3ff2 100644 --- a/tests/integration/test_blanket_library_int.py +++ b/tests/integration/test_blanket_library_int.py @@ -4,7 +4,7 @@ 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.fw import Fw +from process.fw import FirstWall from process.init import init_all_module_vars init_all_module_vars() @@ -17,7 +17,7 @@ def blanket_library_fixture(): :returns: initialised BlanketLibrary object :rtype: process.blanket_library.BlanketLibrary """ - return BlanketLibrary(Fw()) + return BlanketLibrary(FirstWall()) def test_hydraulic_diameter(monkeypatch, blanket_library_fixture): diff --git a/tests/unit/test_blanket_library.py b/tests/unit/test_blanket_library.py index 2ec8f4998..b62e52158 100644 --- a/tests/unit/test_blanket_library.py +++ b/tests/unit/test_blanket_library.py @@ -11,7 +11,7 @@ fwbs_variables, physics_variables, ) -from process.fw import Fw +from process.fw import FirstWall @pytest.fixture @@ -21,7 +21,7 @@ def blanket_library_fixture(): :returns: initialised BlanketLibrary object :rtype: process.blanket_library.BlanketLibrary """ - return BlanketLibrary(Fw()) + return BlanketLibrary(FirstWall()) class PrimaryCoolantPropertiesParam(NamedTuple): diff --git a/tests/unit/test_ccfe_hcpb.py b/tests/unit/test_ccfe_hcpb.py index 6cca0e96b..bbcd299a6 100644 --- a/tests/unit/test_ccfe_hcpb.py +++ b/tests/unit/test_ccfe_hcpb.py @@ -7,6 +7,7 @@ ccfe_hcpb_module, current_drive_variables, divertor_variables, + first_wall_variables, fwbs_variables, global_variables, heat_transport_variables, @@ -14,7 +15,7 @@ primary_pumping_variables, tfcoil_variables, ) -from process.fw import Fw +from process.fw import FirstWall from process.hcpb import CCFE_HCPB @@ -25,7 +26,7 @@ def ccfe_hcpb(): :returns: initialised CCFE_HCPB object :rtype: process.hcpb.CCFE_HCPB """ - return CCFE_HCPB(Fw()) + return CCFE_HCPB(FirstWall()) class NuclearHeatingMagnetsParam(NamedTuple): @@ -862,10 +863,12 @@ def test_powerflow_calc(powerflowcalcparam, monkeypatch, ccfe_hcpb): """ monkeypatch.setattr( - build_variables, "a_fw_outboard", powerflowcalcparam.a_fw_outboard + first_wall_variables, "a_fw_outboard", powerflowcalcparam.a_fw_outboard ) - monkeypatch.setattr(build_variables, "a_fw_total", powerflowcalcparam.a_fw_total) + monkeypatch.setattr( + first_wall_variables, "a_fw_total", powerflowcalcparam.a_fw_total + ) monkeypatch.setattr( current_drive_variables, @@ -1481,18 +1484,20 @@ def test_component_masses(componentmassesparam, monkeypatch, ccfe_hcpb): monkeypatch.setattr(build_variables, "blbmoth", componentmassesparam.blbmoth) monkeypatch.setattr(build_variables, "blbpoth", componentmassesparam.blbpoth) monkeypatch.setattr( - build_variables, "a_fw_inboard", componentmassesparam.a_fw_inboard + first_wall_variables, "a_fw_inboard", componentmassesparam.a_fw_inboard ) monkeypatch.setattr( build_variables, "dr_fw_inboard", componentmassesparam.dr_fw_inboard ) monkeypatch.setattr( - build_variables, "a_fw_outboard", componentmassesparam.a_fw_outboard + first_wall_variables, "a_fw_outboard", componentmassesparam.a_fw_outboard ) monkeypatch.setattr( build_variables, "dr_fw_outboard", componentmassesparam.dr_fw_outboard ) - monkeypatch.setattr(build_variables, "a_fw_total", componentmassesparam.a_fw_total) + monkeypatch.setattr( + first_wall_variables, "a_fw_total", componentmassesparam.a_fw_total + ) monkeypatch.setattr( fwbs_variables, "vol_blkt_total", componentmassesparam.vol_blkt_total ) diff --git a/tests/unit/test_costs_1990.py b/tests/unit/test_costs_1990.py index 8cece7e1f..cd6614923 100644 --- a/tests/unit/test_costs_1990.py +++ b/tests/unit/test_costs_1990.py @@ -14,6 +14,7 @@ cost_variables, current_drive_variables, divertor_variables, + first_wall_variables, fwbs_variables, heat_transport_variables, ife_variables, @@ -1084,7 +1085,7 @@ def test_acc2211(acc2211param, monkeypatch, costs): :type monkeypatch: _pytest.monkeypatch.monkeypatch """ - monkeypatch.setattr(build_variables, "a_fw_total", acc2211param.a_fw_total) + monkeypatch.setattr(first_wall_variables, "a_fw_total", acc2211param.a_fw_total) monkeypatch.setattr(cost_variables, "ucblss", acc2211param.ucblss) diff --git a/tests/unit/test_dcll.py b/tests/unit/test_dcll.py index ec20657a9..7ab1d71e0 100644 --- a/tests/unit/test_dcll.py +++ b/tests/unit/test_dcll.py @@ -7,11 +7,12 @@ current_drive_variables, dcll_variables, divertor_variables, + first_wall_variables, fwbs_variables, physics_variables, ) from process.dcll import DCLL -from process.fw import Fw +from process.fw import FirstWall @pytest.fixture @@ -21,7 +22,7 @@ def dcll(): :returns: initialised DCLL object :rtype: process.dcll.DCLL """ - return DCLL(Fw()) + return DCLL(FirstWall()) class DcllNeutronicsAndPowerParam(NamedTuple): @@ -161,11 +162,11 @@ def test_dcll_neutronics_and_power(dcllneutronicsandpowerparam, monkeypatch, dcl """ monkeypatch.setattr( - build_variables, "a_fw_outboard", dcllneutronicsandpowerparam.a_fw_outboard + first_wall_variables, "a_fw_outboard", dcllneutronicsandpowerparam.a_fw_outboard ) monkeypatch.setattr( - build_variables, "a_fw_total", dcllneutronicsandpowerparam.a_fw_total + first_wall_variables, "a_fw_total", dcllneutronicsandpowerparam.a_fw_total ) monkeypatch.setattr( @@ -799,11 +800,15 @@ def test_dcll_masses(dcllmassesparam, monkeypatch, dcll): :type monkeypatch: _pytest.monkeypatch.monkeypatch """ - monkeypatch.setattr(build_variables, "a_fw_inboard", dcllmassesparam.a_fw_inboard) + monkeypatch.setattr( + first_wall_variables, "a_fw_inboard", dcllmassesparam.a_fw_inboard + ) monkeypatch.setattr(build_variables, "dr_fw_inboard", dcllmassesparam.dr_fw_inboard) - monkeypatch.setattr(build_variables, "a_fw_outboard", dcllmassesparam.a_fw_outboard) + monkeypatch.setattr( + first_wall_variables, "a_fw_outboard", dcllmassesparam.a_fw_outboard + ) monkeypatch.setattr( build_variables, "dr_fw_outboard", dcllmassesparam.dr_fw_outboard diff --git a/tests/unit/test_fw.py b/tests/unit/test_fw.py index 340aaabf5..5cbb23143 100644 --- a/tests/unit/test_fw.py +++ b/tests/unit/test_fw.py @@ -3,17 +3,17 @@ import pytest from process.data_structure import fwbs_variables -from process.fw import Fw +from process.fw import FirstWall @pytest.fixture def fw(): - """Provides Fw object for testing. + """Provides FirstWall object for testing. - :returns: initialised Fw object - :rtype: process.fw.Fw + :returns: initialised FirstWall object + :rtype: process.fw.FirstWall """ - return Fw() + return FirstWall() class FwTempParam(NamedTuple): diff --git a/tests/unit/test_ife.py b/tests/unit/test_ife.py index 19633850e..4c8d9f245 100644 --- a/tests/unit/test_ife.py +++ b/tests/unit/test_ife.py @@ -8,9 +8,9 @@ from process.availability import Availability from process.costs import Costs from process.data_structure import ( - build_variables, buildings_variables, cost_variables, + first_wall_variables, fwbs_variables, heat_transport_variables, ife_variables, @@ -550,7 +550,7 @@ def test_sombld(sombldparam, monkeypatch, ife): :param monkeypatch: pytest fixture used to mock module/class variables :type monkeypatch: _pytest.monkeypatch.monkeypatch """ - monkeypatch.setattr(build_variables, "a_fw_total", sombldparam.a_fw_total) + monkeypatch.setattr(first_wall_variables, "a_fw_total", sombldparam.a_fw_total) monkeypatch.setattr(ife_variables, "ifetyp", sombldparam.ifetyp) monkeypatch.setattr(ife_variables, "chrad", sombldparam.chrad) monkeypatch.setattr(ife_variables, "r1", sombldparam.r1) @@ -620,7 +620,9 @@ def test_sombld(sombldparam, monkeypatch, ife): ife.sombld() - assert build_variables.a_fw_total == pytest.approx(sombldparam.expected_a_fw_total) + assert first_wall_variables.a_fw_total == pytest.approx( + sombldparam.expected_a_fw_total + ) assert ife_variables.r1 == pytest.approx(sombldparam.expected_r1) assert ife_variables.r2 == pytest.approx(sombldparam.expected_r2) assert ife_variables.r3 == pytest.approx(sombldparam.expected_r3) @@ -1135,7 +1137,7 @@ def test_hylbld(hylbldparam, monkeypatch, ife): :param monkeypatch: pytest fixture used to mock module/class variables :type monkeypatch: _pytest.monkeypatch.monkeypatch """ - monkeypatch.setattr(build_variables, "a_fw_total", hylbldparam.a_fw_total) + monkeypatch.setattr(first_wall_variables, "a_fw_total", hylbldparam.a_fw_total) monkeypatch.setattr(ife_variables, "ifetyp", hylbldparam.ifetyp) monkeypatch.setattr(ife_variables, "chrad", hylbldparam.chrad) monkeypatch.setattr(ife_variables, "r1", hylbldparam.r1) @@ -1189,7 +1191,9 @@ def test_hylbld(hylbldparam, monkeypatch, ife): ife.hylbld() - assert build_variables.a_fw_total == pytest.approx(hylbldparam.expected_a_fw_total) + assert first_wall_variables.a_fw_total == pytest.approx( + hylbldparam.expected_a_fw_total + ) assert ife_variables.r1 == pytest.approx(hylbldparam.expected_r1) assert ife_variables.r2 == pytest.approx(hylbldparam.expected_r2) assert ife_variables.r3 == pytest.approx(hylbldparam.expected_r3) @@ -1570,7 +1574,7 @@ def test_ifefbs(ifefbsparam, monkeypatch, ife): :param monkeypatch: pytest fixture used to mock module/class variables :type monkeypatch: _pytest.monkeypatch.monkeypatch """ - monkeypatch.setattr(build_variables, "a_fw_total", ifefbsparam.a_fw_total) + monkeypatch.setattr(first_wall_variables, "a_fw_total", ifefbsparam.a_fw_total) monkeypatch.setattr(cost_variables, "life_plant", ifefbsparam.life_plant) monkeypatch.setattr(cost_variables, "abktflnc", ifefbsparam.abktflnc) monkeypatch.setattr( @@ -2021,7 +2025,7 @@ def test_genbld(genbldparam, monkeypatch, ife): :param monkeypatch: pytest fixture used to mock module/class variables :type monkeypatch: _pytest.monkeypatch.monkeypatch """ - monkeypatch.setattr(build_variables, "a_fw_total", genbldparam.a_fw_total) + monkeypatch.setattr(first_wall_variables, "a_fw_total", genbldparam.a_fw_total) monkeypatch.setattr(ife_variables, "ifetyp", genbldparam.ifetyp) monkeypatch.setattr(ife_variables, "chrad", genbldparam.chrad) monkeypatch.setattr(ife_variables, "r1", genbldparam.r1) @@ -2075,7 +2079,9 @@ def test_genbld(genbldparam, monkeypatch, ife): ife.genbld() - assert build_variables.a_fw_total == pytest.approx(genbldparam.expected_a_fw_total) + assert first_wall_variables.a_fw_total == pytest.approx( + genbldparam.expected_a_fw_total + ) assert ife_variables.r1 == pytest.approx(genbldparam.expected_r1) assert ife_variables.r2 == pytest.approx(genbldparam.expected_r2) assert ife_variables.r3 == pytest.approx(genbldparam.expected_r3) @@ -2638,7 +2644,7 @@ def test_bld2019(bld2019param, monkeypatch, ife): :param monkeypatch: pytest fixture used to mock module/class variables :type monkeypatch: _pytest.monkeypatch.monkeypatch """ - monkeypatch.setattr(build_variables, "a_fw_total", bld2019param.a_fw_total) + monkeypatch.setattr(first_wall_variables, "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) @@ -2698,7 +2704,9 @@ def test_bld2019(bld2019param, monkeypatch, ife): ife.bld2019() - assert build_variables.a_fw_total == pytest.approx(bld2019param.expected_a_fw_total) + assert first_wall_variables.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( bld2019param.expected_emult diff --git a/tests/unit/test_stellarator.py b/tests/unit/test_stellarator.py index d325577c2..cc3524ce3 100644 --- a/tests/unit/test_stellarator.py +++ b/tests/unit/test_stellarator.py @@ -17,6 +17,7 @@ from process.data_structure import ( build_variables, cost_variables, + first_wall_variables, fwbs_variables, heat_transport_variables, impurity_radiation_module, @@ -26,7 +27,7 @@ structure_variables, tfcoil_variables, ) -from process.fw import Fw +from process.fw import FirstWall from process.hcpb import CCFE_HCPB from process.physics import Physics from process.plasma_profiles import PlasmaProfile @@ -49,7 +50,7 @@ def stellarator(): Costs(), Power(), PlasmaProfile(), - CCFE_HCPB(Fw()), + CCFE_HCPB(FirstWall()), CurrentDrive( PlasmaProfile(), ElectronCyclotron(plasma_profile=PlasmaProfile()), @@ -540,7 +541,7 @@ def test_stbild(stbildparam, monkeypatch, stellarator): monkeypatch.setattr(build_variables, "dr_vv_outboard", stbildparam.dr_vv_outboard) - monkeypatch.setattr(build_variables, "a_fw_total", stbildparam.a_fw_total) + monkeypatch.setattr(first_wall_variables, "a_fw_total", stbildparam.a_fw_total) monkeypatch.setattr(build_variables, "dr_fw_inboard", stbildparam.dr_fw_inboard) @@ -671,7 +672,9 @@ def test_stbild(stbildparam, monkeypatch, stellarator): assert build_variables.dr_bore == pytest.approx(stbildparam.expected_bore) - assert build_variables.a_fw_total == pytest.approx(stbildparam.expected_a_fw_total) + assert first_wall_variables.a_fw_total == pytest.approx( + stbildparam.expected_a_fw_total + ) assert build_variables.dr_fw_inboard == pytest.approx( stbildparam.expected_dr_fw_inboard