Skip to content

Commit

Permalink
black formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
brookeslawski committed Oct 11, 2024
1 parent fb12cef commit 34643c0
Showing 1 changed file with 58 additions and 21 deletions.
79 changes: 58 additions & 21 deletions pvade/structure/ElasticityManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,12 @@ def _north_east_corner(x):
x2 = 0.2
corner = [x1, x2]

east_edge = np.logical_and(corner[0] - eps < x[0], x[0] < corner[0] + eps)
north_edge = np.logical_and(corner[1] - eps < x[1], x[1] < corner[1] + eps)
east_edge = np.logical_and(
corner[0] - eps < x[0], x[0] < corner[0] + eps
)
north_edge = np.logical_and(
corner[1] - eps < x[1], x[1] < corner[1] + eps
)

north_east_corner = np.logical_and(east_edge, north_edge)

Expand All @@ -127,11 +131,19 @@ def _north_east_corner(x):
if not new_method:
tracker_angle_rad = np.radians(params.pv_array.tracker_angle)
x1 = 0.5 * params.pv_array.panel_chord * np.cos(tracker_angle_rad)
x2 = 0.5 * params.pv_array.panel_thickness * np.sin(tracker_angle_rad)
x2 = (
0.5
* params.pv_array.panel_thickness
* np.sin(tracker_angle_rad)
)
corner = [x1 - x2, 0.5 * params.pv_array.panel_span]

east_edge = np.logical_and(corner[0] - eps < x[0], x[0] < corner[0] + eps)
north_edge = np.logical_and(corner[1] - eps < x[1], x[1] < corner[1] + eps)
east_edge = np.logical_and(
corner[0] - eps < x[0], x[0] < corner[0] + eps
)
north_edge = np.logical_and(
corner[1] - eps < x[1], x[1] < corner[1] + eps
)

north_east_corner = np.logical_and(east_edge, north_edge)

Expand All @@ -142,7 +154,11 @@ def _north_east_corner(x):
[
[np.cos(tracker_angle_rad), 0.0, np.sin(tracker_angle_rad)],
[0.0, 1.0, 0.0],
[-np.sin(tracker_angle_rad), 0.0, np.cos(tracker_angle_rad)],
[
-np.sin(tracker_angle_rad),
0.0,
np.cos(tracker_angle_rad),
],
]
)

Expand All @@ -151,36 +167,57 @@ def _north_east_corner(x):

Rz = np.array(
[
[np.cos(array_rotation_rad), -np.sin(array_rotation_rad), 0.0],
[np.sin(array_rotation_rad), np.cos(array_rotation_rad), 0.0],
[
np.cos(array_rotation_rad),
-np.sin(array_rotation_rad),
0.0,
],
[
np.sin(array_rotation_rad),
np.cos(array_rotation_rad),
0.0,
],
[0.0, 0.0, 1.0],
]
)

reference_position = np.array([
0.5 * params.pv_array.panel_chord,
0.5 * params.pv_array.panel_span,
-0.5 * params.pv_array.panel_thickness,
])

reference_position = np.array(
[
0.5 * params.pv_array.panel_chord,
0.5 * params.pv_array.panel_span,
-0.5 * params.pv_array.panel_thickness,
]
)

rotated_position = np.dot(reference_position, Ry.T)
rotated_position = np.dot(rotated_position, Rz.T)

final_position = rotated_position + np.array([0.0, 0.0, params.pv_array.elevation])
final_position = rotated_position + np.array(
[0.0, 0.0, params.pv_array.elevation]
)

if params.rank == 0:
print(f"Measuring panel deformation at (x, y, z) position {final_position}")
print(
f"Measuring panel deformation at (x, y, z) position {final_position}"
)

eps = 1.0e-4
near_x = np.logical_and(final_position[0] - eps < x[0], x[0] < final_position[0] + eps)
near_y = np.logical_and(final_position[1] - eps < x[1], x[1] < final_position[1] + eps)
near_z = np.logical_and(final_position[2] - eps < x[2], x[2] < final_position[2] + eps)
near_x = np.logical_and(
final_position[0] - eps < x[0], x[0] < final_position[0] + eps
)
near_y = np.logical_and(
final_position[1] - eps < x[1], x[1] < final_position[1] + eps
)
near_z = np.logical_and(
final_position[2] - eps < x[2], x[2] < final_position[2] + eps
)

north_east_corner = np.logical_and(near_x, np.logical_and(near_y, near_z))
north_east_corner = np.logical_and(
near_x, np.logical_and(near_y, near_z)
)

return north_east_corner

north_east_corner_facets = dolfinx.mesh.locate_entities_boundary(
domain.structure.msh, 0, _north_east_corner
)
Expand Down

0 comments on commit 34643c0

Please # to comment.