-
Notifications
You must be signed in to change notification settings - Fork 17
♻️ Create shield class #4064
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
♻️ Create shield class #4064
Changes from all commits
35fdee8
9f93384
4cc97f6
d21a956
e14ef5b
6c25149
58da462
91f8eab
167cfd8
c8aee24
850fefc
d8d731e
f0926a8
a0be748
1d3de65
f25f0ac
1ce2713
4dd9e13
5fbd620
aacb272
8181f19
eb35413
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,27 +55,17 @@ def component_volumes(self): | |
| # Calculate half-height | ||
| # Blanket | ||
| blanket_library.dz_blkt_half = self.component_half_height(icomponent=0) | ||
| # Shield | ||
| blanket_library.dz_shld_half = self.component_half_height(icomponent=1) | ||
| # Vacuum Vessel | ||
| blanket_library.dz_vv_half = self.component_half_height(icomponent=2) | ||
|
|
||
| # D-shaped blanket and shield | ||
| if physics_variables.itart == 1 or fwbs_variables.i_fw_blkt_vv_shape == 1: | ||
| for icomponent in range(3): | ||
| for icomponent in range(1): | ||
| self.dshaped_component(icomponent) | ||
|
|
||
| # Elliptical blanket and shield | ||
| else: | ||
| for icomponent in range(3): | ||
| for icomponent in range(1): | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For loop now no longer needed |
||
| self.elliptical_component(icomponent) | ||
|
|
||
| # This will fail the hts_REBCO and 2D_scan regression tests, | ||
| # the number of VMCON iterations (nviter) is different. | ||
| # Seems to be because in the blanket calculations (icomponent=0): | ||
| # r2 = 1.3836567143743970 rather than old value of r2 = 1.3836567143743972, | ||
| # r3 = 3.7009701431231936 rather than r3 = 3.7009701431231923. | ||
|
|
||
| # Apply coverage factors to volumes and surface areas | ||
| self.apply_coverage_factors() | ||
|
|
||
|
|
@@ -94,22 +84,10 @@ def component_half_height(self, icomponent: int): | |
| + divertor_variables.dz_divertor | ||
| - build_variables.dz_blkt_upper | ||
| ) | ||
| # Sheild | ||
| elif icomponent == 1: | ||
| hbot = ( | ||
| build_variables.z_plasma_xpoint_lower | ||
| + build_variables.dz_xpoint_divertor | ||
| + divertor_variables.dz_divertor | ||
| ) | ||
| # Vacuum vessel | ||
| elif icomponent == 2: | ||
| hbot = ( | ||
| build_variables.z_tf_inside_half | ||
| - build_variables.dz_shld_vv_gap | ||
| - build_variables.dz_vv_lower | ||
| ) | ||
| else: | ||
| raise ProcessValueError(f"{icomponent=} is invalid, it must be either 0,1,2") | ||
| raise ProcessValueError( | ||
| f"{icomponent=} is invalid, it must be 0 for blanket." | ||
| ) | ||
|
|
||
| # Calculate component internal upper half-height (m) | ||
| # If a double null machine then symmetric | ||
|
|
@@ -123,14 +101,6 @@ def component_half_height(self, icomponent: int): | |
| + build_variables.dr_fw_inboard | ||
| + build_variables.dr_fw_outboard | ||
| ) | ||
| # Shield | ||
| if icomponent == 1: | ||
| htop = htop + build_variables.dz_blkt_upper | ||
| # Vacuum Vessel | ||
| if icomponent == 2: | ||
| htop = ( | ||
| htop + build_variables.dz_blkt_upper + build_variables.dz_shld_upper | ||
| ) | ||
|
|
||
| # Average of top and bottom (m) | ||
| return 0.5 * (htop + hbot) | ||
|
|
@@ -144,12 +114,10 @@ def dshaped_component(self, icomponent: int): | |
| # Calculate major radius to outer edge of inboard ... | ||
| # ... section (m) | ||
| r1 = build_variables.rsldi | ||
| # ... shield (m) | ||
| if icomponent == 1: | ||
| r1 = r1 + build_variables.dr_shld_inboard | ||
|
|
||
| # ... blanket (m) | ||
| elif icomponent == 0: | ||
| r1 = r1 + build_variables.dr_shld_inboard + build_variables.dr_blkt_inboard | ||
|
|
||
| r1 = r1 + build_variables.dr_shld_inboard + build_variables.dr_blkt_inboard | ||
|
|
||
| # Horizontal distance between inside edges (m) | ||
| # i.e. outer radius of inboard part to inner radius of outboard part | ||
|
|
@@ -161,12 +129,6 @@ def dshaped_component(self, icomponent: int): | |
| + build_variables.dr_fw_plasma_gap_outboard | ||
| + build_variables.dr_fw_outboard | ||
| ) | ||
| # Sheild | ||
| if icomponent == 1: | ||
| r2 = build_variables.dr_blkt_inboard + r2 + build_variables.dr_blkt_outboard | ||
| # Vaccum Vessel | ||
| if icomponent == 2: | ||
| r2 = build_variables.rsldo - r1 | ||
|
|
||
| # Calculate surface area, assuming 100% coverage | ||
| if icomponent == 0: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, lets move this |
||
|
|
@@ -175,12 +137,6 @@ def dshaped_component(self, icomponent: int): | |
| build_variables.a_blkt_outboard_surface, | ||
| build_variables.a_blkt_total_surface, | ||
| ) = dshellarea(r1, r2, blanket_library.dz_blkt_half) | ||
| if icomponent == 1: | ||
| ( | ||
| build_variables.a_shld_inboard_surface, | ||
| build_variables.a_shld_outboard_surface, | ||
| build_variables.a_shld_total_surface, | ||
| ) = dshellarea(r1, r2, blanket_library.dz_shld_half) | ||
|
|
||
| # Calculate volumes, assuming 100% coverage | ||
| if icomponent == 0: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, lets get rid of the |
||
|
|
@@ -196,32 +152,6 @@ def dshaped_component(self, icomponent: int): | |
| build_variables.dr_blkt_outboard, | ||
| build_variables.dz_blkt_upper, | ||
| ) | ||
| elif icomponent == 1: | ||
| ( | ||
| blanket_library.vol_shld_inboard, | ||
| blanket_library.vol_shld_outboard, | ||
| fwbs_variables.vol_shld_total, | ||
| ) = dshellvol( | ||
| r1, | ||
| r2, | ||
| blanket_library.dz_shld_half, | ||
| build_variables.dr_shld_inboard, | ||
| build_variables.dr_shld_outboard, | ||
| build_variables.dz_shld_upper, | ||
| ) | ||
| elif icomponent == 2: | ||
| ( | ||
| blanket_library.vol_vv_inboard, | ||
| blanket_library.vol_vv_outboard, | ||
| fwbs_variables.vol_vv, | ||
| ) = dshellvol( | ||
| r1, | ||
| r2, | ||
| blanket_library.dz_vv_half, | ||
| build_variables.dr_vv_inboard, | ||
| build_variables.dr_vv_outboard, | ||
| (build_variables.dz_vv_upper + build_variables.dz_vv_lower) / 2, | ||
| ) | ||
|
|
||
| def elliptical_component(self, icomponent: int): | ||
| """Calculate component surface area and volume using elliptical scheme | ||
|
|
@@ -239,19 +169,15 @@ def elliptical_component(self, icomponent: int): | |
| # Calculate distance between r1 and outer edge of inboard ... | ||
| # ... section (m) | ||
| r2 = r1 - build_variables.rsldi | ||
| # ... shield (m) | ||
| if icomponent == 1: | ||
| r2 = r2 - build_variables.dr_shld_inboard | ||
|
|
||
| # ... blanket (m) | ||
| if icomponent == 0: | ||
| r2 = r2 - build_variables.dr_shld_inboard - build_variables.dr_blkt_inboard | ||
|
|
||
| # Calculate distance between r1 and inner edge of outboard ... | ||
| # ... section (m) | ||
| r3 = build_variables.rsldo - r1 | ||
| # ... shield (m) | ||
| if icomponent == 1: | ||
| r3 = r3 - build_variables.dr_shld_outboard | ||
|
|
||
| # ... blanket (m) | ||
| if icomponent == 0: | ||
|
Comment on lines
174
to
182
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same with the if statements here |
||
| r3 = r3 - build_variables.dr_shld_outboard - build_variables.dr_blkt_outboard | ||
|
|
@@ -263,12 +189,6 @@ def elliptical_component(self, icomponent: int): | |
| build_variables.a_blkt_outboard_surface, | ||
| build_variables.a_blkt_total_surface, | ||
| ) = eshellarea(r1, r2, r3, blanket_library.dz_blkt_half) | ||
| if icomponent == 1: | ||
| ( | ||
| build_variables.a_shld_inboard_surface, | ||
| build_variables.a_shld_outboard_surface, | ||
| build_variables.a_shld_total_surface, | ||
| ) = eshellarea(r1, r2, r3, blanket_library.dz_shld_half) | ||
|
|
||
| # Calculate volumes, assuming 100% coverage | ||
| if icomponent == 0: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same with this if statement |
||
|
|
@@ -285,34 +205,6 @@ def elliptical_component(self, icomponent: int): | |
| build_variables.dr_blkt_outboard, | ||
| build_variables.dz_blkt_upper, | ||
| ) | ||
| if icomponent == 1: | ||
| ( | ||
| blanket_library.vol_shld_inboard, | ||
| blanket_library.vol_shld_outboard, | ||
| fwbs_variables.vol_shld_total, | ||
| ) = eshellvol( | ||
| r1, | ||
| r2, | ||
| r3, | ||
| blanket_library.dz_shld_half, | ||
| build_variables.dr_shld_inboard, | ||
| build_variables.dr_shld_outboard, | ||
| build_variables.dz_shld_upper, | ||
| ) | ||
| if icomponent == 2: | ||
| ( | ||
| blanket_library.vol_vv_inboard, | ||
| blanket_library.vol_vv_outboard, | ||
| fwbs_variables.vol_vv, | ||
| ) = eshellvol( | ||
| r1, | ||
| r2, | ||
| r3, | ||
| blanket_library.dz_vv_half, | ||
| build_variables.dr_vv_inboard, | ||
| build_variables.dr_vv_outboard, | ||
| (build_variables.dz_vv_upper + build_variables.dz_vv_lower) / 2, | ||
| ) | ||
|
|
||
| def apply_coverage_factors(self): | ||
| """Apply coverage factors to volumes | ||
|
|
@@ -361,33 +253,6 @@ def apply_coverage_factors(self): | |
| fwbs_variables.vol_blkt_inboard + fwbs_variables.vol_blkt_outboard | ||
| ) | ||
|
|
||
| # Apply shield coverage factors | ||
| build_variables.a_shld_inboard_surface = ( | ||
| fwbs_variables.fvolsi * build_variables.a_shld_inboard_surface | ||
| ) | ||
| build_variables.a_shld_outboard_surface = ( | ||
| fwbs_variables.fvolso * build_variables.a_shld_outboard_surface | ||
| ) | ||
| build_variables.a_shld_total_surface = ( | ||
| build_variables.a_shld_inboard_surface | ||
| + build_variables.a_shld_outboard_surface | ||
| ) | ||
|
|
||
| blanket_library.vol_shld_inboard = ( | ||
| fwbs_variables.fvolsi * blanket_library.vol_shld_inboard | ||
| ) | ||
| blanket_library.vol_shld_outboard = ( | ||
| fwbs_variables.fvolso * blanket_library.vol_shld_outboard | ||
| ) | ||
| fwbs_variables.vol_shld_total = ( | ||
| blanket_library.vol_shld_inboard + blanket_library.vol_shld_outboard | ||
| ) | ||
|
|
||
| # 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 | ||
|
|
||
| def primary_coolant_properties(self, output: bool): | ||
| """Calculates the fluid properties of the Primary Coolant in the FW and BZ. | ||
| Uses middle value of input and output temperatures of coolant. | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These also need to be added to |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -276,6 +276,10 @@ def _call_models_once(self, xc: np.ndarray) -> None: | |
| # First wall model | ||
| self.models.fw.run() | ||
|
|
||
| self.models.shield.run() | ||
|
|
||
| self.models.vacuum_vessel.run() | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This fixes my concerns in #4002 (comment) This call order looks correct because VV and shield don't use anything from each other or blanket library |
||
|
|
||
| # Blanket model | ||
| """Blanket switch values | ||
| No. | model | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For loop now no longer needed