Skip to content

Commit

Permalink
Add curving of blades
Browse files Browse the repository at this point in the history
  • Loading branch information
markriegler committed Nov 14, 2024
1 parent 07691d2 commit 4c3a15f
Showing 1 changed file with 80 additions and 5 deletions.
85 changes: 80 additions & 5 deletions splinepy/microstructure/tiles/sulzersmx.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,32 @@ class SulzerSMX(_TileBase):
- just one curve
- maybe multiple curves (wave-like)
- If just one curve parameter, may set _n_info_per_eval_point to 2
TODO: curved blades combined with different widths has self intersections
"""

_dim = 3
_para_dim = 3
_evaluation_points = _np.array(
[[0.25, 0.5, 0.5], [0.75, 0.5, 0.5], [0.5, 0.5, 0.0], [0.5, 0.5, 1.0]]
[
[0.25, 0.5, 0.5],
[0.75, 0.5, 0.5],
[0.5, 0.5, 0.0],
[0.5, 0.5, 1.0],
[0.5, 0.5, 0.5],
[0.5, 0.5, 0.5],
]
)
_n_info_per_eval_point = 1
_parameter_bounds = [[0.0, 1.0], [0.0, 1.0], [0.0, 1.0], [0.0, 1.0]]
_parameters_shape = (4, 1)
_parameter_bounds = [
[0.0, 1.0],
[0.0, 1.0],
[0.0, 1.0],
[0.0, 1.0],
[-0.5, 0.5],
[-0.5, 0.5],
]
_parameters_shape = (6, 1)

def create_tile(
self,
Expand All @@ -43,6 +59,8 @@ def create_tile(
2. Thickness of back crossbar
3. Width (x-direction) of front crossbar at inlet
4. Width of front crossbar at outlet
5. Front middle point shift ("radial" direction)
6. Back middle point shift ("radial" direction)
parameter_sensitivities: np.ndarray
The sensitivities of the parameters
closure: str(optional)
Expand All @@ -67,7 +85,7 @@ def create_tile(
self._logd(
"Setting cross bar thickness to default 0.2 and widths to 0.5"
)
parameters = _np.array([[0.2], [0.2], [0.5], [0.5]])
parameters = _np.array([[0.2], [0.2], [0.5], [0.5], [0.0], [0.0]])

# Check if parameters are in allowed range
if _np.sum(
Expand Down Expand Up @@ -101,15 +119,24 @@ def create_tile(
thickness_back,
width_inlet,
width_outlet,
r_front,
r_back,
] = parameters.flatten()

v_zero = 0.0
v_one_half = 0.5
v_one = 1.0

width_shift = width_outlet - width_inlet

shift_front = thickness_front * width_shift
shift_back = thickness_back * width_shift

# Auxiliary values
# Bar thickness
bt_front = thickness_front / 2
bt_back = thickness_back / 2
width_middle = (width_inlet + width_outlet) / 2
else:
raise NotImplementedError("Derivatives not yet implemented")
[thickness_front, thickness_back] = (
Expand All @@ -125,10 +152,22 @@ def create_tile(
[
[v_zero, v_zero, v_zero],
[width_inlet, v_zero, v_zero],
[v_zero, v_one_half + r_front, v_one_half - r_front],
[width_middle, v_one_half + r_front, v_one_half - r_front],
[v_zero, v_one, v_one],
[width_outlet, v_one, v_one],
[v_zero, v_zero + thickness_front, v_zero],
[width_inlet, v_zero + thickness_front, v_zero],
[
v_zero,
v_one_half + bt_front + r_front,
v_one_half - bt_front - r_front,
],
[
width_middle,
v_one_half + bt_front + r_front,
v_one_half - bt_front - r_front,
],
[v_zero, v_one, v_one - thickness_front],
[
width_outlet - shift_front,
Expand All @@ -146,10 +185,22 @@ def create_tile(
v_zero,
v_zero + thickness_front,
],
[
v_zero,
v_one_half - bt_front + r_front,
v_one_half + bt_front - r_front,
],
[
width_middle,
v_one_half - bt_front + r_front,
v_one_half + bt_front - r_front,
],
[v_zero, v_one - thickness_front, v_one],
[width_outlet, v_one - thickness_front, v_one],
[v_zero, v_zero, v_zero],
[width_inlet, v_zero, v_zero],
[v_zero, v_one_half + r_front, v_one_half - r_front],
[width_middle, v_one_half + r_front, v_one_half - r_front],
[v_zero, v_one, v_one],
[width_outlet, v_one, v_one],
]
Expand All @@ -159,10 +210,22 @@ def create_tile(
[
[width_inlet, v_one, v_zero],
[v_one, v_one, v_zero],
[width_middle, v_one_half + r_back, v_one_half + r_back],
[v_one, v_one_half + r_back, v_one_half + r_back],
[width_outlet, v_zero, v_one],
[v_one, v_zero, v_one],
[width_inlet + shift_back, v_one, v_zero + thickness_back],
[v_one, v_one, v_zero + thickness_back],
[
width_middle,
v_one_half + bt_back + r_back,
v_one_half + bt_back + r_back,
],
[
v_one,
v_one_half + bt_back + r_back,
v_one_half + bt_back + r_back,
],
[width_outlet, v_zero + thickness_back, v_one],
[v_one, v_zero + thickness_back, v_one],
]
Expand All @@ -172,6 +235,16 @@ def create_tile(
[
[width_inlet, v_one - thickness_back, v_zero],
[v_one, v_one - thickness_back, v_zero],
[
width_middle,
v_one_half - bt_back + r_back,
v_one_half - bt_back + r_back,
],
[
v_one,
v_one_half - bt_back + r_back,
v_one_half - bt_back + r_back,
],
[
width_outlet - shift_back,
v_zero,
Expand All @@ -180,6 +253,8 @@ def create_tile(
[v_one, v_zero, v_one - thickness_front],
[width_inlet, v_one, v_zero],
[v_one, v_one, v_zero],
[width_middle, v_one_half + r_back, v_one_half + r_back],
[v_one, v_one_half + r_back, v_one_half + r_back],
[width_outlet, v_zero, v_one],
[v_one, v_zero, v_one],
]
Expand All @@ -193,7 +268,7 @@ def create_tile(
back_bar_bottom,
]:
spline_list.append(
_Bezier(degrees=[1, 1, 1], control_points=control_points)
_Bezier(degrees=[1, 2, 1], control_points=control_points)
)

if i_derivative == 0:
Expand Down

0 comments on commit 4c3a15f

Please sign in to comment.