Skip to content

Commit

Permalink
Merge pull request #241 from fusion-energy/develop
Browse files Browse the repository at this point in the history
Develop to main merge
  • Loading branch information
shimwell authored Apr 21, 2022
2 parents dd6aa1b + 4764c20 commit 96a8c37
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ def create_reactor_renders(
# assigns colours to each stl file
stl_files_with_colors = {
"blanket.stl": (255, 255, 0),
"vacuum_vessel.stl": (128, 128, 128),
"vessel.stl": (128, 128, 128),
"upper_blanket.stl": (255, 255, 0),
"lower_blanket.stl": (255, 255, 0),
"lower_vacuum_vessel.stl": (128, 128, 128),
"upper_vacuum_vessel.stl": (128, 128, 128),
"lower_vessel.stl": (128, 128, 128),
"upper_vessel.stl": (128, 128, 128),
}

scene = pyrender.Scene()
Expand Down
5 changes: 4 additions & 1 deletion paramak/parametric_components/constant_thickness_dome.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ def find_points(self):
# far side

if self.chord_height * 2 >= self.chord_width:
msg = "ConstantThicknessDome requires that the self.chord_width is at least 2 times as large as the chord height"
msg = (
"ConstantThicknessDome requires that the self.chord_width "
"is at least 2 times as large as the chord height"
)
raise ValueError(msg)

radius_of_sphere = ((math.pow(self.chord_width, 2)) + (4.0 * math.pow(self.chord_height, 2))) / (
Expand Down
2 changes: 1 addition & 1 deletion paramak/parametric_components/dished_vacuum_vessel.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(
dish_height: float = 50,
cylinder_height: float = 400,
thickness: float = 15,
name: str = "dished_vacuum_vessel",
name: str = "dished_vessel",
**kwargs,
):
self.radius = radius
Expand Down
6 changes: 3 additions & 3 deletions paramak/parametric_reactors/flf_system_code_reactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def create_solids(self):
],
rotation_angle=self.rotation_angle,
color=(0.5, 0.5, 0.5),
name="lower_vacuum_vessel",
name="lower_vessel",
)

lower_blanket = paramak.RotateStraightShape(
Expand Down Expand Up @@ -137,7 +137,7 @@ def create_solids(self):
],
rotation_angle=self.rotation_angle,
color=(0.5, 0.5, 0.5),
name="upper_vacuum_vessel",
name="upper_vessel",
)

upper_blanket = paramak.RotateStraightShape(
Expand Down Expand Up @@ -201,7 +201,7 @@ def create_solids(self):
],
rotation_angle=self.rotation_angle,
color=(0.5, 0.5, 0.5),
name="vacuum_vessel",
name="vessel",
)

self.shapes_and_components = [
Expand Down
4 changes: 2 additions & 2 deletions paramak/parametric_reactors/negative_triangularity_reactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ def _make_vacuum_vessel_inner_wall(self):
inner_radius=self._vacuum_vessel_inwall_start_rad,
outer_radius=self._vacuum_vessel_inwall_end_rad,
rotation_angle=self._rotation_angle,
name="vacuum_vessel_inner_wall",
name="vessel_inner_wall",
color=(0.5, 0.5, 0.5),
cut=[self._pf_coils, self._pf_casing],
)
Expand Down Expand Up @@ -896,7 +896,7 @@ def _make_vacuum_vessel(self):
inner_radius=self._vacuum_vessel_inwall_start_rad,
outer_radius=self._vacuum_vessel_body_end_rad,
rotation_angle=self._rotation_angle,
name="vacuum_vessel_body",
name="vessel_body",
cut=cutting_list,
color=(0.5, 0.5, 0.5),
)
Expand Down
1 change: 0 additions & 1 deletion paramak/reactor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from collections.abc import Iterable
from logging import warning
from pathlib import Path
from typing import List, Optional, Tuple, Union

Expand Down
6 changes: 5 additions & 1 deletion paramak/shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,11 @@ def rotation_axis(self, value):
raise ValueError(msg)
for val in point:
if not isinstance(val, (int, float)):
msg = f"Shape.rotation_axis should be an iterable of iterables where the nested iterables are numerical, not {type(val)}"
msg = (
"Shape.rotation_axis should be an iterable of "
"iterables where the nested iterables are "
f"numerical, not {type(val)}"
)
raise ValueError(msg)

if value[0] == value[1]:
Expand Down
12 changes: 6 additions & 6 deletions tests/test_parametric_reactors/test_flf_system_code_reactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ def test_multiple_stp_file_creation(self):

os.system("rm *.stp")
self.test_reactor.export_stp()
assert Path("lower_vacuum_vessel.stp").is_file()
assert Path("lower_vessel.stp").is_file()
assert Path("lower_blanket.stp").is_file()
assert Path("blanket.stp").is_file()
assert Path("upper_blanket.stp").is_file()
assert Path("upper_vacuum_vessel.stp").is_file()
assert Path("vacuum_vessel.stp").is_file()
assert Path("upper_vessel.stp").is_file()
assert Path("vessel.stp").is_file()

def test_graveyard_volume_in_brep_export(self):
"""Exports the reactor as a brep file and checks the number of volumes
Expand Down Expand Up @@ -79,11 +79,11 @@ def test_order_of_names_in_reactor(self):

assert self.test_reactor.name == [
"blanket",
"vacuum_vessel",
"vessel",
"upper_blanket",
"lower_blanket",
"lower_vacuum_vessel",
"upper_vacuum_vessel",
"lower_vessel",
"upper_vessel",
]

def test_blanket_volume_against_analytical_volume(self):
Expand Down
3 changes: 2 additions & 1 deletion tests/test_parametric_shapes/test_extrude_mixed_shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ def test_convert_all_circle_points_change_to_splines(self):
assert self.test_shape_2.processed_points[-4] == (150, 100, "straight")
assert self.test_shape_2.processed_points[-5] == (200, 100, "straight")

for point in self.test_shape_2.processed_points[1 : len(self.test_shape_2.points) - 5]:
spline_points = len(self.test_shape_2.points) - 5
for point in self.test_shape_2.processed_points[1:spline_points]:
assert point[2] == "spline"

def test_convert_circles_to_splines_volume(self):
Expand Down

0 comments on commit 96a8c37

Please sign in to comment.