Skip to content
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

moved reactor to start from floor level #231

Merged
merged 3 commits into from
Apr 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/auto_format_pep8.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: black
name: auto_format_pep8

on:
push:
Expand All @@ -23,7 +23,7 @@ jobs:
- name: Install black
run: |
python -m pip install --upgrade pip
pip install black==22.1.0
pip install black==22.3.0
- name: Run black
run: |
black .
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/auto_lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: black
name: auto_lint

on:
push:
Expand Down
8 changes: 2 additions & 6 deletions paramak/parametric_components/constant_thickness_dome.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,25 +132,21 @@ def find_points(self):
center_point = (chord_center[0], chord_center[1] + self.chord_height - radius_of_sphere)
inner_tri_angle = math.atan((center_point[1] - chord_center[1]) / (self.chord_width / 2))
outer_tri_adj = math.cos(inner_tri_angle) * self.thickness
# original ending type
# point_2 = (point_1[0] + outer_tri_adj, point_1[1], "straight")
point_2 = (point_1[0] + self.thickness, point_1[1], "straight")
outer_tri_opp = math.sqrt(math.pow(self.thickness, 2) - math.pow(outer_tri_adj, 2))
point_7 = (chord_center[0], chord_center[1] + radius_of_sphere, "straight")
point_6 = (chord_center[0], chord_center[1] + radius_of_sphere + self.thickness, "straight")
far_side = (center_point[0], center_point[1] - (radius_of_sphere + self.thickness))
self.far_side = (center_point[0], center_point[1] - (radius_of_sphere + self.thickness))
point_3 = (point_2[0], point_2[1] + outer_tri_opp, "straight")
elif self.upper_or_lower == "lower":
center_point = (chord_center[0], chord_center[1] - self.chord_height + radius_of_sphere)
inner_tri_angle = math.atan((center_point[1] - chord_center[1]) / (self.chord_width / 2))
outer_tri_adj = math.cos(inner_tri_angle) * self.thickness
# original ending type
# point_2 = (point_1[0] + outer_tri_adj, point_1[1], "straight")
point_2 = (point_1[0] + self.thickness, point_1[1], "straight")
outer_tri_opp = math.sqrt(math.pow(self.thickness, 2) - math.pow(outer_tri_adj, 2))
point_7 = (chord_center[0], chord_center[1] - radius_of_sphere, "straight")
point_6 = (chord_center[0], chord_center[1] - (radius_of_sphere + self.thickness), "straight")
far_side = (center_point[0], center_point[1] + radius_of_sphere + self.thickness)
self.far_side = (center_point[0], center_point[1] + radius_of_sphere + self.thickness)
point_3 = (point_2[0], point_2[1] - outer_tri_opp, "straight")
else:
msg = f'upper_or_lower should be either "upper" or "lower". Not {self.upper_or_lower}'
Expand Down
16 changes: 7 additions & 9 deletions paramak/parametric_components/dished_vacuum_vessel.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

from paramak import RotateMixedShape, CenterColumnShieldCylinder, ConstantThicknessDome


Expand All @@ -19,12 +18,12 @@ class DishedVacuumVessel(RotateMixedShape):

def __init__(
self,
radius: float=300,
center_point: float=0,
dish_height: float=50,
cylinder_height: float=400,
thickness: float=15,
name: str='dished_vacuum_vessel',
radius: float = 300,
center_point: float = 0,
dish_height: float = 50,
cylinder_height: float = 400,
thickness: float = 15,
name: str = "dished_vacuum_vessel",
**kwargs,
):
self.radius = radius
Expand Down Expand Up @@ -63,7 +62,6 @@ def thickness(self, value):
raise ValueError(msg)
self._thickness = value


def create_solid(self):
"""Creates a rotated 3d solid using points with circular edges.

Expand Down Expand Up @@ -93,7 +91,7 @@ def create_solid(self):
# - -
#

cylinder_section =CenterColumnShieldCylinder(
cylinder_section = CenterColumnShieldCylinder(
height=self.cylinder_height,
inner_radius=self.radius - self.thickness,
outer_radius=self.radius,
Expand Down
103 changes: 66 additions & 37 deletions paramak/parametric_reactors/flf_system_code_reactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,16 @@ def create_solids(self):
inner_wall = self.inner_blanket_radius + self.blanket_thickness + self.blanket_vv_gap
lower_vv = paramak.RotateStraightShape(
points=[
(inner_wall, 0),
(
inner_wall,
(-self.blanket_height / 2.0) - self.lower_blanket_thickness,
),
(
inner_wall,
(-self.blanket_height / 2.0) - (self.lower_blanket_thickness + self.lower_vv_thickness),
self.lower_vv_thickness,
),
(
0,
(-self.blanket_height / 2.0) - (self.lower_blanket_thickness + self.lower_vv_thickness),
self.lower_vv_thickness,
),
(0, (-self.blanket_height / 2.0) - self.lower_blanket_thickness),
(0, 0),
],
rotation_angle=self.rotation_angle,
color=(0.5, 0.5, 0.5),
Expand All @@ -98,13 +95,10 @@ def create_solids(self):

lower_blanket = paramak.RotateStraightShape(
points=[
(inner_wall, -self.blanket_height / 2.0),
(
inner_wall,
(-self.blanket_height / 2.0) - self.lower_blanket_thickness,
),
(0, (-self.blanket_height / 2.0) - self.lower_blanket_thickness),
(0, -self.blanket_height / 2.0),
(inner_wall, self.lower_vv_thickness),
(inner_wall, self.lower_vv_thickness + self.lower_blanket_thickness),
(0, self.lower_vv_thickness + self.lower_blanket_thickness),
(0, self.lower_vv_thickness),
],
rotation_angle=self.rotation_angle,
color=(0.0, 1.0, 0.498),
Expand All @@ -113,6 +107,7 @@ def create_solids(self):

blanket = paramak.CenterColumnShieldCylinder(
height=self.blanket_height,
center_height=self.lower_vv_thickness + self.lower_blanket_thickness + 0.5 * self.blanket_height,
inner_radius=self.inner_blanket_radius,
outer_radius=self.blanket_thickness + self.inner_blanket_radius,
rotation_angle=self.rotation_angle,
Expand All @@ -121,54 +116,88 @@ def create_solids(self):
name="blanket",
)

upper_blanket = paramak.RotateStraightShape(
upper_vv = paramak.RotateStraightShape(
points=[
(inner_wall, (self.blanket_height / 2.0) + self.upper_vv_thickness),
(inner_wall, self.lower_vv_thickness + self.lower_blanket_thickness + self.blanket_height),
(
inner_wall,
(self.blanket_height / 2.0) + self.upper_vv_thickness + self.upper_blanket_thickness,
self.lower_vv_thickness
+ self.lower_blanket_thickness
+ self.blanket_height
+ self.upper_vv_thickness,
),
(
0,
(self.blanket_height / 2.0) + self.upper_vv_thickness + self.upper_blanket_thickness,
self.lower_vv_thickness
+ self.lower_blanket_thickness
+ self.blanket_height
+ self.upper_vv_thickness,
),
(0, (self.blanket_height / 2.0) + self.upper_vv_thickness),
],
rotation_angle=self.rotation_angle,
color=(0.0, 1.0, 0.498),
name="upper_blanket",
)

upper_vv = paramak.RotateStraightShape(
points=[
(inner_wall, self.blanket_height / 2.0),
(inner_wall, (self.blanket_height / 2.0) + self.upper_vv_thickness),
(0, (self.blanket_height / 2.0) + self.upper_vv_thickness),
(0, self.blanket_height / 2.0),
(0, self.lower_vv_thickness + self.lower_blanket_thickness + self.blanket_height),
],
rotation_angle=self.rotation_angle,
color=(0.5, 0.5, 0.5),
name="upper_vacuum_vessel",
)

vac_ves = paramak.RotateStraightShape(
upper_blanket = paramak.RotateStraightShape(
points=[
(
inner_wall + self.vv_thickness,
(self.blanket_height / 2.0) + self.upper_vv_thickness + self.upper_blanket_thickness,
inner_wall,
self.lower_vv_thickness
+ self.lower_blanket_thickness
+ self.blanket_height
+ self.upper_vv_thickness,
),
(
inner_wall,
(self.blanket_height / 2.0) + self.upper_vv_thickness + self.upper_blanket_thickness,
self.lower_vv_thickness
+ self.lower_blanket_thickness
+ self.blanket_height
+ self.upper_vv_thickness
+ self.upper_blanket_thickness,
),
(
0,
self.lower_vv_thickness
+ self.lower_blanket_thickness
+ self.blanket_height
+ self.upper_vv_thickness
+ self.upper_blanket_thickness,
),
(
0,
self.lower_vv_thickness
+ self.lower_blanket_thickness
+ self.blanket_height
+ self.upper_vv_thickness,
),
],
rotation_angle=self.rotation_angle,
color=(0.0, 1.0, 0.498),
name="upper_blanket",
)

vac_ves = paramak.RotateStraightShape(
points=[
(inner_wall, 0),
(
inner_wall,
-(self.blanket_height / 2.0) - self.lower_blanket_thickness - self.lower_vv_thickness,
self.lower_vv_thickness
+ self.lower_blanket_thickness
+ self.blanket_height
+ self.upper_vv_thickness
+ self.upper_blanket_thickness,
),
(
inner_wall + self.vv_thickness,
-(self.blanket_height / 2.0) - self.lower_blanket_thickness - self.lower_vv_thickness,
self.lower_vv_thickness
+ self.lower_blanket_thickness
+ self.blanket_height
+ self.upper_vv_thickness
+ self.upper_blanket_thickness,
),
(inner_wall + self.vv_thickness, 0),
],
rotation_angle=self.rotation_angle,
color=(0.5, 0.5, 0.5),
Expand Down
4 changes: 2 additions & 2 deletions paramak/reactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ def largest_dimension(self, value):
@property
def bounding_box(self):
"""Calculates a bounding box for the Shape and returns the coordinates of
the corners lower-left and upper-right. This function is useful when
creating OpenMC mesh tallies as the bounding box is required in this form"""
the corners lower-left and upper-right. This function is useful when
creating OpenMC mesh tallies as the bounding box is required in this form"""

return get_bounding_box(self.solid)

Expand Down
4 changes: 2 additions & 2 deletions paramak/shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ def largest_dimension(self, value):
@property
def bounding_box(self):
"""Calculates a bounding box for the Shape and returns the coordinates of
the corners lower-left and upper-right. This function is useful when
creating OpenMC mesh tallies as the bounding box is required in this form"""
the corners lower-left and upper-right. This function is useful when
creating OpenMC mesh tallies as the bounding box is required in this form"""

return get_bounding_box(self.solid)

Expand Down
2 changes: 1 addition & 1 deletion paramak/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def get_bounding_box(solid) -> Tuple[Tuple[float, float, float], Tuple[float, fl

def get_largest_dimension(solid):
"""Calculates the distance from (0, 0, 0) to the furthest part of
the geometry. This distance is returned as an positive value."""
the geometry. This distance is returned as an positive value."""

bounding_box = get_bounding_box(solid)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@

import unittest
import pytest

import paramak


class TestConstantThicknessDome(unittest.TestCase):
"""tests for the ConstantThicknessDome class"""

def test_volume_increases_with_rotation_angle(self):
"""Tests that the volume doubles when rotation angle doubles"""

test_shape_1 = paramak.ConstantThicknessDome(rotation_angle=180)
test_shape_2 = paramak.ConstantThicknessDome(rotation_angle=360)
assert test_shape_1.volume() *2 == pytest.approx(test_shape_2.volume())

assert test_shape_1.volume() * 2 == pytest.approx(test_shape_2.volume())

def test_upper_lower_flips_points(self):
"""Checks that the coords of the flips version are the same for p1 and p2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import pytest

import paramak
Expand All @@ -7,4 +6,4 @@
def test_volume_increases_with_rotation_angle():
test_shape_1 = paramak.DishedVacuumVessel(rotation_angle=180)
test_shape_2 = paramak.DishedVacuumVessel(rotation_angle=360)
assert test_shape_1.volume() *2 == pytest.approx(test_shape_2.volume())
assert test_shape_1.volume() * 2 == pytest.approx(test_shape_2.volume())
2 changes: 1 addition & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


class TestUtilityFunctions(unittest.TestCase):
""""tests the utility functions"""
""" "tests the utility functions"""

def test_bounding_box_with_single_shape_at_origin(self):
"""checks the type and values of the bounding box returned"""
Expand Down