From b83b2cac74eddb04d8bba9da59d20f05bf698482 Mon Sep 17 00:00:00 2001 From: David Rudlstorfer Date: Mon, 22 Apr 2024 11:13:31 +0200 Subject: [PATCH 1/8] Add helical beam basic geometry function --- meshpy/mesh_creation_functions/__init__.py | 2 + .../beam_basic_geometry.py | 169 ++++++++++++++++++ 2 files changed, 171 insertions(+) diff --git a/meshpy/mesh_creation_functions/__init__.py b/meshpy/mesh_creation_functions/__init__.py index 9e9a2fb2..656e6c11 100644 --- a/meshpy/mesh_creation_functions/__init__.py +++ b/meshpy/mesh_creation_functions/__init__.py @@ -41,6 +41,7 @@ create_beam_mesh_arc_segment_2d, create_beam_mesh_line_at_node, create_beam_mesh_arc_at_node, + create_beam_mesh_helix, ) # Parametric curve. @@ -82,6 +83,7 @@ "create_beam_mesh_arc_segment_2d", "create_beam_mesh_line_at_node", "create_beam_mesh_arc_at_node", + "create_beam_mesh_helix", # Parametric curve. "create_beam_mesh_curve", # Honeycomb. diff --git a/meshpy/mesh_creation_functions/beam_basic_geometry.py b/meshpy/mesh_creation_functions/beam_basic_geometry.py index 123f89b7..026baddf 100644 --- a/meshpy/mesh_creation_functions/beam_basic_geometry.py +++ b/meshpy/mesh_creation_functions/beam_basic_geometry.py @@ -34,6 +34,7 @@ # Python packages. import numpy as np +import warnings # Meshpy modules. from ..conf import mpy @@ -476,3 +477,171 @@ def create_beam_mesh_arc_at_node( start_node=start_node, **kwargs, ) + + +def create_beam_mesh_helix( + mesh, + beam_object, + material, + axis, + axis_point, + start_point, + twist_angle, + *, + height_helix=None, + turns=None, + **kwargs +): + """ + Generate a helical segment starting at a given start point around a + predefined axis. + + Args + ---- + mesh: Mesh + Mesh that the helical segment will be added to. + beam_object: Beam + Class of beam that will be used for this line. + material: Material + Material for this segment. + axis: np.array, list + Rotation axis of the helix. + axis_point: np.array, list + Point lying on the rotation axis. Does not need to align with + bottom plane of helix. + start_point: np.array, list + Start point of the helix. Defines the radius. + twist_angle: float + Twist angle / Pitch of helix between 0 and 2pi. + height_helix: float + Height of helix. Mutually exclusive with number of turns. + turns: float + Number of turns. Mutually exclusive with height of helix. + + **kwargs (for all of them look into create_beam_mesh_function) + ---- + n_el: int + Number of equally spaced beam elements along the line. Defaults to 1. + Mutually exclusive with l_el. + l_el: float + Desired length of beam elements. This requires the option interval_length + to be set. Mutually exclusive with n_el. Be aware, that this length + might not be achieved, if the elements are warped after they are + created. + + Return + ---- + return_set: GeometryName + Set with the 'start' and 'end' node of the line. Also a 'line' set + with all nodes of the line. + """ + + if not 0 < twist_angle < 2 * np.pi: + raise ValueError("Twist angle of helix must be between 0 and 2pi!") + + if height_helix is None and turns is None: + raise ValueError("Either provide height_helix or turns!") + elif height_helix is not None and turns is not None: + raise ValueError("Only provide height_helix OR turns!") + + # determine radius of helix + axis = np.array(axis) / np.linalg.norm(np.array(axis)) + origin = axis_point + np.dot( + np.dot((np.array(start_point) - np.array(axis_point)), axis), axis + ) + start_point_origin_vec = start_point - origin + radius = np.linalg.norm(start_point_origin_vec) + + # return line if radius of helix is 0 or twist angle is np.pi/2 + if np.isclose(radius, 0) or np.isclose(twist_angle, np.pi / 2): + if turns: + raise ValueError( + "Radius of helix is 0 or twist angle is 90 degrees! " + + "Height of helix can not be determined through turns! " + + "Either switch to height of helix or change radius!" + ) + + warnings.warn( + "Radius of helix is 0 or twist angle is 90 degrees! " + + "Simple line geometry is returned!" + ) + + return create_beam_mesh_line( + mesh, + beam_object, + material, + start_point=start_point, + end_point=start_point + height_helix * axis, + **kwargs, + ) + + # generate simple helix + if height_helix: + end_point = np.array([radius, height_helix / np.tan(twist_angle), height_helix]) + elif turns: + end_point = np.array( + [ + radius, + 2 * np.pi * radius * turns, + 2 * np.pi * radius * turns * np.tan(twist_angle), + ] + ) + + helix = create_beam_mesh_line( + mesh, + beam_object, + material, + start_point=[radius, 0, 0], + end_point=end_point, + **kwargs, + ) + + mesh.wrap_around_cylinder() + + # transform simple helix to align with neccessary axis and starting point + axis_simple = np.array([0, 0, 1]) + start_point_origin_vec_simple = np.array([1, 0, 0]) + + start_point_origin_vec /= np.linalg.norm(start_point_origin_vec) + + # 1 - get rotation matrix to align axes + if np.isclose(np.dot(axis, axis_simple), 1): + # axis point in same direction + R_axis = np.eye(3) + elif np.isclose(np.dot(axis, axis_simple), -1): + # axis point in opposite direction + R_axis = np.asarray([[1, 0, 0], [0, -1, 0], [0, 0, -1]]) + else: + v = np.cross(axis, axis_simple) + c = np.dot(axis, axis_simple) + v_x = np.asarray([[0, -v[2], v[1]], [v[2], 0, -v[0]], [-v[1], v[0], 0]]) + R_axis = np.eye(3) + v_x + np.matmul(v_x, v_x) / (1 + c) + + start_point_origin_vec_simple_rot = np.dot(R_axis, start_point_origin_vec_simple) + start_point_origin_vec_simple_rot /= np.linalg.norm( + start_point_origin_vec_simple_rot + ) + + # 2 - get rotation matrix to align start_point_origin_vec's + if np.isclose(np.dot(start_point_origin_vec, start_point_origin_vec_simple_rot), 1): + # vectors point in same direction + R_start_vec = np.eye(3) + elif np.isclose( + np.dot(start_point_origin_vec, start_point_origin_vec_simple_rot), -1 + ): + # vectors point in opposite direction + R_start_vec = np.asarray([[-1, 0, 0], [0, 1, 0], [0, 0, -1]]) + else: + v = np.cross(start_point_origin_vec, start_point_origin_vec_simple_rot) + c = np.dot(start_point_origin_vec, start_point_origin_vec_simple_rot) + v_x = np.asarray([[0, -v[2], v[1]], [v[2], 0, -v[0]], [-v[1], v[0], 0]]) + R_start_vec = np.eye(3) + v_x + np.matmul(v_x, v_x) / (1 + c) + + # 3 - rotate mesh + rotation = Rotation.from_rotation_matrix(np.matmul(R_start_vec, R_axis)) + mesh.rotate(rotation) + + # 4 - translate simple helix to align with start point + mesh.translate(-mesh.nodes[0].coordinates+start_point) + + return helix From 88bdca5ae2622da46a377ce51269c3542cefd402 Mon Sep 17 00:00:00 2001 From: David Rudlstorfer Date: Mon, 22 Apr 2024 16:56:10 +0200 Subject: [PATCH 2/8] Add tests for helix basic beam geometry --- ..._functions_helix_no_rotation_reference.dat | 84 +++++++++++++ ..._functions_helix_radius_zero_reference.dat | 45 +++++++ ...ctions_helix_rotation_offset_reference.dat | 111 ++++++++++++++++++ tests/testing_mesh_creation_functions.py | 94 +++++++++++++++ 4 files changed, 334 insertions(+) create mode 100644 tests/reference-files/test_mesh_creation_functions_helix_no_rotation_reference.dat create mode 100644 tests/reference-files/test_mesh_creation_functions_helix_radius_zero_reference.dat create mode 100644 tests/reference-files/test_mesh_creation_functions_helix_rotation_offset_reference.dat diff --git a/tests/reference-files/test_mesh_creation_functions_helix_no_rotation_reference.dat b/tests/reference-files/test_mesh_creation_functions_helix_no_rotation_reference.dat new file mode 100644 index 00000000..0f3de80c --- /dev/null +++ b/tests/reference-files/test_mesh_creation_functions_helix_no_rotation_reference.dat @@ -0,0 +1,84 @@ +// ----------------------------------------------------------------------------- +// This input file was created with MeshPy. +// Copyright (c) 2018-2024 +// Ivo Steinbrecher +// Institute for Mathematics and Computer-Based Simulation +// Universitaet der Bundeswehr Muenchen +// https://www.unibw.de/imcs-en +// ----------------------------------------------------------------------------- +-----------------------------------------------------------------------MATERIALS +MAT 1 MAT_BeamReissnerElastHyper YOUNG 100000.0 POISSONRATIO 0.0 DENS 0.0 CROSSAREA 0.7853981633974483 SHEARCORR 1.0 MOMINPOL 0.09817477042468103 MOMIN2 0.04908738521234052 MOMIN3 0.04908738521234052 +---------------------------------------------------------------------NODE COORDS +NODE 1 COORD 2 0 0 +NODE 2 COORD 1.29031760642 1.52809701085 1.73913043478 +NODE 3 COORD -0.335080474557 1.97173047742 3.47826086957 +NODE 4 COORD -1.72267784231 1.01606153928 5.21739130435 +NODE 5 COORD -1.88772107557 -0.660688384072 6.95652173913 +NODE 6 COORD -0.713081897511 -1.86855939361 8.69565217391 +NODE 7 COORD 0.967618948392 -1.75034670015 10.4347826087 +NODE 8 COORD 1.96161766293 -0.389943770933 12.1739130435 +NODE 9 COORD 1.56349085915 1.247195387 13.9130434783 +NODE 10 COORD 0.0557821201163 1.99922193742 15.652173913 +NODE 11 COORD -1.49151420744 1.33243587801 17.3913043478 +NODE 12 COORD -1.98030916221 -0.279956464605 19.1304347826 +NODE 13 COORD -1.06371357071 -1.69366863332 20.8695652174 +NODE 14 COORD 0.607780813727 -1.90541399241 22.6086956522 +NODE 15 COORD 1.84794385551 -0.764920588611 24.347826087 +NODE 16 COORD 1.77665367872 0.918423489409 26.0869565217 +NODE 17 COORD 0.444503666653 1.94997858715 27.8260869565 +NODE 18 COORD -1.20310277152 1.59766821373 29.5652173913 +NODE 19 COORD -1.99688835508 0.111520838252 31.3043478261 +NODE 20 COORD -1.3735174311 -1.45377091265 33.0434782609 +NODE 21 COORD 0.224614631004 -1.98734704255 34.7826086957 +NODE 22 COORD 1.66334164414 -1.11053796642 36.5217391304 +NODE 23 COORD 1.92162437793 0.554400351876 38.2608695652 +NODE 24 COORD 0.816164123627 1.82589050146 40 +NODE 25 COORD -0.86851343948 1.80157830955 41.7391304348 +NODE 26 COORD -1.936822306 0.498717710705 43.4782608696 +NODE 27 COORD -1.63060248247 -1.15807406679 45.2173913043 +NODE 28 COORD -0.167172786198 -1.99300106863 46.9565217391 +NODE 29 COORD 1.41489649312 -1.41353030168 48.6956521739 +NODE 30 COORD 1.99283864253 0.169098033164 50.4347826087 +NODE 31 COORD 1.1564982941 1.63172047108 52.1739130435 +NODE 32 COORD -0.500588531859 1.93633961943 53.9130434783 +NODE 33 COORD -1.80241649033 0.866772631882 55.652173913 +NODE 34 COORD -1.82510119972 -0.817927631747 57.3913043478 +NODE 35 COORD -0.552543721171 -1.9221590559 59.1304347826 +NODE 36 COORD 1.11214430798 -1.66226804043 60.8695652174 +NODE 37 COORD 1.98756310264 -0.222694663255 62.6086956522 +NODE 38 COORD 1.45244335723 1.37492119558 64.347826087 +NODE 39 COORD -0.113449866473 1.99677968935 66.0869565217 +NODE 40 COORD -1.59882971739 1.20155879374 67.8260869565 +NODE 41 COORD -1.94954826754 -0.446387222639 69.5652173913 +NODE 42 COORD -0.91670673679 -1.77754008639 71.3043478261 +NODE 43 COORD 0.766705425133 -1.84720404695 73.0434782609 +NODE 44 COORD 1.90600024578 -0.605939818044 74.7826086957 +NODE 45 COORD 1.69264024984 1.0653492313 76.5217391304 +NODE 46 COORD 0.278043269928 1.98057868817 78.2608695652 +NODE 47 COORD -1.3338761233 1.49022632096 80 +--------------------------------------------------------------STRUCTURE ELEMENTS +1 BEAM3R HERM2LINE3 1 3 2 MAT 1 TRIADS 1.75998840379 0.729011066468 1.75998840379 -0.563096707478 -1.76680148356 -1.64748681036 -1.47549841571 -1.60522261285 -2.17839873024 +2 BEAM3R HERM2LINE3 3 5 4 MAT 1 TRIADS -0.563096707478 -1.76680148356 -1.64748681036 0.841531446705 -1.33918705776 -0.35189565727 0.209954140218 -1.65415042404 -1.02120098565 +3 BEAM3R HERM2LINE3 5 7 6 MAT 1 TRIADS 0.841531446705 -1.33918705776 -0.35189565727 1.64691762575 -0.232419192658 1.00020143402 1.32621949133 -0.859413898109 0.330081400459 +4 BEAM3R HERM2LINE3 7 9 8 MAT 1 TRIADS 1.64691762575 -0.232419192658 1.00020143402 1.61580017099 1.44416786448 2.1637241481 1.76693682215 0.536110927807 1.62850068139 +5 BEAM3R HERM2LINE3 9 11 10 MAT 1 TRIADS 1.61580017099 1.44416786448 2.1637241481 0.0478196347767 -1.6991290691 -1.16765209885 -0.757011356003 -1.75783471143 -1.77826470792 +6 BEAM3R HERM2LINE3 11 13 12 MAT 1 TRIADS 0.0478196347767 -1.6991290691 -1.16765209885 1.23031781423 -0.980937404397 0.176338578891 0.711508352243 -1.42561326901 -0.504948429124 +7 BEAM3R HERM2LINE3 13 15 14 MAT 1 TRIADS 1.23031781423 -0.980937404397 0.176338578891 1.76031043681 0.350368499077 1.49247538847 1.59036767235 -0.386345923512 0.851371943298 +8 BEAM3R HERM2LINE3 15 17 16 MAT 1 TRIADS 1.76031043681 0.350368499077 1.49247538847 -0.95802472739 -1.73398041219 -1.90353508919 1.67907698206 1.22746478785 2.05523539531 +9 BEAM3R HERM2LINE3 17 19 18 MAT 1 TRIADS -0.95802472739 -1.73398041219 -1.90353508919 0.574148965511 -1.50340951546 -0.657086436354 -0.121492943693 -1.73331918065 -1.31155023095 +10 BEAM3R HERM2LINE3 19 21 20 MAT 1 TRIADS 0.574148965511 -1.50340951546 -0.657086436354 1.52425058891 -0.533063226651 0.700875305282 1.12639923094 -1.09487972284 0.0222876579204 +11 BEAM3R HERM2LINE3 21 23 22 MAT 1 TRIADS 1.52425058891 -0.533063226651 0.700875305282 1.724120335 1.0174736729 1.93859971425 1.741097671 0.171801588394 1.35262403805 +12 BEAM3R HERM2LINE3 23 25 24 MAT 1 TRIADS 1.724120335 1.0174736729 1.93859971425 -0.297983604933 -1.75600703484 -1.45239070988 -1.16602654934 -1.69390475199 -2.0222768169 +13 BEAM3R HERM2LINE3 25 27 26 MAT 1 TRIADS -0.297983604933 -1.75600703484 -1.45239070988 1.01467892939 -1.20107512455 -0.131802013582 0.429523540766 -1.57220678695 -0.807999072126 +14 BEAM3R HERM2LINE3 27 29 28 MAT 1 TRIADS 1.01467892939 -1.20107512455 -0.131802013582 1.71015643903 0.000413021288212 1.20955526508 1.44901659997 -0.67253029768 0.549058729848 +15 BEAM3R HERM2LINE3 29 31 30 MAT 1 TRIADS 1.71015643903 0.000413021288212 1.20955526508 -1.38081944254 -1.63607793051 -2.13326859063 1.75252102966 0.814424523253 1.8151046074 +16 BEAM3R HERM2LINE3 31 33 32 MAT 1 TRIADS -1.38081944254 -1.63607793051 -2.13326859063 0.277678964081 -1.63157420484 -0.957348505761 -0.481651567931 -1.76636928669 -1.58959079055 +17 BEAM3R HERM2LINE3 33 35 34 MAT 1 TRIADS 0.277678964081 -1.63157420484 -0.957348505761 1.36505185107 -0.804684001959 0.396239906063 0.895333162693 -1.29932010508 -0.285661906475 +18 BEAM3R HERM2LINE3 35 37 36 MAT 1 TRIADS 1.36505185107 -0.804684001959 0.396239906063 1.76566720269 0.618449136654 1.68582483069 1.66823066538 -0.163797889378 1.06379461775 +19 BEAM3R HERM2LINE3 37 39 38 MAT 1 TRIADS 1.76566720269 0.618449136654 1.68582483069 -0.672484754997 -1.76345708941 -1.72247099676 1.58242824868 1.53963510603 2.20763216941 +20 BEAM3R HERM2LINE3 39 41 40 MAT 1 TRIADS -0.672484754997 -1.76345708941 -1.72247099676 0.768503105955 -1.38936919451 -0.439018621427 0.118642500972 -1.68101092931 -1.10476131039 +21 BEAM3R HERM2LINE3 41 43 42 MAT 1 TRIADS 0.768503105955 -1.38936919451 -0.439018621427 1.61596464464 -0.320826825091 0.915800734772 1.27268564142 -0.929435389595 0.242714580706 +22 BEAM3R HERM2LINE3 43 45 44 MAT 1 TRIADS 1.61596464464 -0.320826825091 0.915800734772 1.65411746398 1.32014197254 2.10311901657 1.76476727298 0.42961542058 1.55166288314 +23 BEAM3R HERM2LINE3 45 47 46 MAT 1 TRIADS 1.65411746398 1.32014197254 2.10311901657 -0.0475738227814 -1.71993668072 -1.24981866284 -0.870445494973 -1.74617798224 -1.85023220455 +------------------------------------------------------------------FLUID ELEMENTS +-----------------------------------------------------------------------------END diff --git a/tests/reference-files/test_mesh_creation_functions_helix_radius_zero_reference.dat b/tests/reference-files/test_mesh_creation_functions_helix_radius_zero_reference.dat new file mode 100644 index 00000000..8d8f64f5 --- /dev/null +++ b/tests/reference-files/test_mesh_creation_functions_helix_radius_zero_reference.dat @@ -0,0 +1,45 @@ +// ----------------------------------------------------------------------------- +// This input file was created with MeshPy. +// Copyright (c) 2018-2024 +// Ivo Steinbrecher +// Institute for Mathematics and Computer-Based Simulation +// Universitaet der Bundeswehr Muenchen +// https://www.unibw.de/imcs-en +// ----------------------------------------------------------------------------- +-----------------------------------------------------------------------MATERIALS +MAT 1 MAT_BeamReissnerElastHyper YOUNG 100000.0 POISSONRATIO 0.0 DENS 0.0 CROSSAREA 0.7853981633974483 SHEARCORR 1.0 MOMINPOL 0.09817477042468103 MOMIN2 0.04908738521234052 MOMIN3 0.04908738521234052 +---------------------------------------------------------------------NODE COORDS +NODE 1 COORD 1 1 1 +NODE 2 COORD 3.30940107676 3.30940107676 3.30940107676 +NODE 3 COORD 5.61880215352 5.61880215352 5.61880215352 +NODE 4 COORD 7.92820323028 7.92820323028 7.92820323028 +NODE 5 COORD 10.237604307 10.237604307 10.237604307 +NODE 6 COORD 12.5470053838 12.5470053838 12.5470053838 +NODE 7 COORD 14.8564064606 14.8564064606 14.8564064606 +NODE 8 COORD 17.1658075373 17.1658075373 17.1658075373 +NODE 9 COORD 19.4752086141 19.4752086141 19.4752086141 +NODE 10 COORD 21.7846096908 21.7846096908 21.7846096908 +NODE 11 COORD 24.0940107676 24.0940107676 24.0940107676 +NODE 12 COORD 26.4034118443 26.4034118443 26.4034118443 +NODE 13 COORD 28.7128129211 28.7128129211 28.7128129211 +NODE 14 COORD 31.0222139979 31.0222139979 31.0222139979 +NODE 15 COORD 33.3316150746 33.3316150746 33.3316150746 +NODE 16 COORD 35.6410161514 35.6410161514 35.6410161514 +NODE 17 COORD 37.9504172281 37.9504172281 37.9504172281 +NODE 18 COORD 40.2598183049 40.2598183049 40.2598183049 +NODE 19 COORD 42.5692193817 42.5692193817 42.5692193817 +NODE 20 COORD 44.8786204584 44.8786204584 44.8786204584 +NODE 21 COORD 47.1880215352 47.1880215352 47.1880215352 +--------------------------------------------------------------STRUCTURE ELEMENTS +1 BEAM3R HERM2LINE3 1 3 2 MAT 1 TRIADS -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 +2 BEAM3R HERM2LINE3 3 5 4 MAT 1 TRIADS -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 +3 BEAM3R HERM2LINE3 5 7 6 MAT 1 TRIADS -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 +4 BEAM3R HERM2LINE3 7 9 8 MAT 1 TRIADS -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 +5 BEAM3R HERM2LINE3 9 11 10 MAT 1 TRIADS -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 +6 BEAM3R HERM2LINE3 11 13 12 MAT 1 TRIADS -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 +7 BEAM3R HERM2LINE3 13 15 14 MAT 1 TRIADS -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 +8 BEAM3R HERM2LINE3 15 17 16 MAT 1 TRIADS -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 +9 BEAM3R HERM2LINE3 17 19 18 MAT 1 TRIADS -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 +10 BEAM3R HERM2LINE3 19 21 20 MAT 1 TRIADS -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 +------------------------------------------------------------------FLUID ELEMENTS +-----------------------------------------------------------------------------END diff --git a/tests/reference-files/test_mesh_creation_functions_helix_rotation_offset_reference.dat b/tests/reference-files/test_mesh_creation_functions_helix_rotation_offset_reference.dat new file mode 100644 index 00000000..c17ca070 --- /dev/null +++ b/tests/reference-files/test_mesh_creation_functions_helix_rotation_offset_reference.dat @@ -0,0 +1,111 @@ +// ----------------------------------------------------------------------------- +// This input file was created with MeshPy. +// Copyright (c) 2018-2024 +// Ivo Steinbrecher +// Institute for Mathematics and Computer-Based Simulation +// Universitaet der Bundeswehr Muenchen +// https://www.unibw.de/imcs-en +// ----------------------------------------------------------------------------- +-----------------------------------------------------------------------MATERIALS +MAT 1 MAT_BeamReissnerElastHyper YOUNG 100000.0 POISSONRATIO 0.0 DENS 0.0 CROSSAREA 0.7853981633974483 SHEARCORR 1.0 MOMINPOL 0.09817477042468103 MOMIN2 0.04908738521234052 MOMIN3 0.04908738521234052 +---------------------------------------------------------------------NODE COORDS +NODE 1 COORD 3 0 0 +NODE 2 COORD 0.918076435378 0.609437912993 -1.11662047761 +NODE 3 COORD -0.320224788882 -0.108704968912 -3.09235893928 +NODE 4 COORD -0.553906634489 -2.15353581209 -4.40259601994 +NODE 5 COORD -0.357045631234 -4.55343269473 -4.00965545468 +NODE 6 COORD -0.618743755208 -6.07697414697 -2.12206515883 +NODE 7 COORD -1.89257820467 -6.13396235721 -0.0419786873161 +NODE 8 COORD -3.99155250793 -5.20726713255 0.787602185541 +NODE 9 COORD -6.12492064457 -4.49951315218 -0.161337373435 +NODE 10 COORD -7.47677084647 -5.05312718842 -2.11548018302 +NODE 11 COORD -7.80302301531 -6.98760111076 -3.56600827853 +NODE 12 COORD -7.61002056798 -9.41206044988 -3.37259535758 +NODE 13 COORD -7.7840421999 -11.0771115438 -1.59777623549 +NODE 14 COORD -8.94281743729 -11.2890148819 0.538809478735 +NODE 15 COORD -10.9835378973 -10.4172898641 1.55281987657 +NODE 16 COORD -13.1580815238 -9.62433982099 0.781294222078 +NODE 17 COORD -14.6204087062 -10.0149289387 -1.13226292167 +NODE 18 COORD -15.0456040469 -11.8278333759 -2.70872986187 +NODE 19 COORD -14.8676148773 -14.2611302773 -2.7156316497 +NODE 20 COORD -14.9617347736 -16.0589595932 -1.06893411043 +NODE 21 COORD -16.0041568505 -16.430428838 1.10546888891 +NODE 22 COORD -17.9772075879 -15.628304059 2.29556477434 +NODE 23 COORD -20.1822784323 -14.7640625379 1.70955218592 +NODE 24 COORD -21.7509932035 -14.9946319786 -0.144803036132 +NODE 25 COORD -22.2805933859 -16.6758739133 -1.83169686612 +NODE 26 COORD -22.1286339569 -19.1022020968 -2.03785570689 +NODE 27 COORD -22.1513626979 -21.0228554456 -0.533450273652 +NODE 28 COORD -23.0772091751 -21.5570719157 1.65973978962 +NODE 29 COORD -24.9737974882 -20.8385364514 3.01595553456 +NODE 30 COORD -27.1984661503 -19.9175645679 2.62184676345 +NODE 31 COORD -28.8684993832 -19.9925932122 0.844764521911 +NODE 32 COORD -29.5070046018 -21.5332921214 -0.936027309533 +NODE 33 COORD -29.3918516653 -23.9369094824 -1.33855056716 +NODE 34 COORD -29.3523572806 -25.9693015751 0.0107026205558 +NODE 35 COORD -30.1624792762 -26.6679478319 2.20347651445 +NODE 36 COORD -31.9745166145 -26.0462209749 3.71431667463 +NODE 37 COORD -34.2076732154 -25.0836022809 3.51673520861 +NODE 38 COORD -35.9730227303 -25.0090014018 1.83428539098 +NODE 39 COORD -36.7239302607 -26.4015710388 -0.0230108364964 +NODE 40 COORD -36.6560216139 -28.7669446192 -0.61719753328 +NODE 41 COORD -36.5640451523 -30.8989611523 0.565472083615 +NODE 42 COORD -37.2603595044 -31.7622055052 2.73863040738 +NODE 43 COORD -38.9805359565 -31.2496150267 4.3911755852 +NODE 44 COORD -41.210992451 -30.2608166043 4.39293507034 +NODE 45 COORD -43.0647782898 -30.0438754294 2.82160563956 +NODE 46 COORD -43.9305502824 -31.2820936865 0.905903158914 +NODE 47 COORD -43.9198886444 -33.5940427194 0.126519050488 +NODE 48 COORD -43.7856544684 -35.8126519369 1.13270785779 +NODE 49 COORD -44.3711260818 -36.8391468931 3.2672318526 +NODE 50 COORD -45.9929776935 -36.4470155157 5.04725767329 +NODE 51 COORD -48.209570902 -35.4477455388 5.24933600282 +NODE 52 COORD -50.1440986869 -35.0970641234 3.80459160189 +NODE 53 COORD -51.1261394925 -36.1761303317 1.84911888059 +NODE 54 COORD -51.1822003884 -38.4199660428 0.892708891475 +NODE 55 COORD -51.0163220162 -40.711338747 1.71414488169 +NODE 56 COORD -51.4949365591 -41.898233421 3.79137157656 +NODE 57 COORD -53.0129048604 -41.6367745458 5.683479682 +NODE 58 COORD -55.2045992718 -40.6428376222 6.08500999075 +NODE 59 COORD -57.2114310634 -40.1682476502 4.78114952715 +NODE 60 COORD -58.3100743006 -41.0848267897 2.80490882623 +NODE 61 COORD -58.4417188003 -43.2464876678 1.6812747383 +NODE 62 COORD -58.255101165 -45.596124574 2.31138731308 +NODE 63 COORD -58.6318283641 -46.9390909415 4.31318139417 +NODE 64 COORD -60.0413115579 -46.8173145922 6.30094124809 +NODE 65 COORD -62.1973009569 -45.844466217 6.89921989556 +--------------------------------------------------------------STRUCTURE ELEMENTS +1 BEAM3R HERM2LINE3 1 3 2 MAT 1 TRIADS -0.108618942944 0.261360938214 2.70333485579 -1.77284298166 1.7180707555 1.65205209133 -0.999520540041 1.05719856207 2.40766774032 +2 BEAM3R HERM2LINE3 3 5 4 MAT 1 TRIADS -1.77284298166 1.7180707555 1.65205209133 2.11167411324 -1.88063609587 0.796012242688 2.26295918663 -2.09603528171 -0.491647732442 +3 BEAM3R HERM2LINE3 5 7 6 MAT 1 TRIADS 2.11167411324 -1.88063609587 0.796012242688 0.866344176248 -0.642060766402 2.48525894638 1.61035648878 -1.36099282884 1.82684383387 +4 BEAM3R HERM2LINE3 7 9 8 MAT 1 TRIADS 0.866344176248 -0.642060766402 2.48525894638 -0.90610071262 0.975178601686 2.46253366883 -0.0101633675427 0.171675250201 2.70707346093 +5 BEAM3R HERM2LINE3 9 11 10 MAT 1 TRIADS -0.90610071262 0.975178601686 2.46253366883 -2.25006371787 2.093066903 0.638471971814 -1.69867736959 1.6565260914 1.75513173935 +6 BEAM3R HERM2LINE3 11 13 12 MAT 1 TRIADS -2.25006371787 2.093066903 0.638471971814 1.67852096327 -1.42896856626 1.73136413906 2.14688785814 -1.9205996795 0.665883347016 +7 BEAM3R HERM2LINE3 13 15 14 MAT 1 TRIADS 1.67852096327 -1.42896856626 1.73136413906 0.0880534304067 0.0818757918455 2.70528065294 0.955544482991 -0.726590146756 2.43406002991 +8 BEAM3R HERM2LINE3 15 17 16 MAT 1 TRIADS 0.0880534304067 0.0818757918455 2.70528065294 -1.62167729776 1.59209849992 1.85330231577 -0.811477730509 0.891729594891 2.51189320904 +9 BEAM3R HERM2LINE3 17 19 18 MAT 1 TRIADS -1.62167729776 1.59209849992 1.85330231577 2.17782390038 -1.95683153795 0.532842452221 -2.20633103179 2.06139645822 0.776270930481 +10 BEAM3R HERM2LINE3 19 21 20 MAT 1 TRIADS 2.17782390038 -1.95683153795 0.532842452221 1.04303861771 -0.809868736978 2.37773862369 1.74368063424 -1.4944601008 1.63155373758 +11 BEAM3R HERM2LINE3 21 23 22 MAT 1 TRIADS 1.04303861771 -0.809868736978 2.37773862369 -0.715816692811 0.807000814978 2.55572142691 0.185883603988 -0.00790114767113 2.69797768381 +12 BEAM3R HERM2LINE3 23 25 24 MAT 1 TRIADS -0.715816692811 0.807000814978 2.55572142691 -2.15820598418 2.02550152703 0.910513105456 -1.54202900855 1.52495183462 1.94646007452 +13 BEAM3R HERM2LINE3 25 27 26 MAT 1 TRIADS -2.15820598418 2.02550152703 0.910513105456 1.80569443899 -1.55733152327 1.52753082269 2.20435189871 -1.98920027825 0.3970956786 +14 BEAM3R HERM2LINE3 27 29 28 MAT 1 TRIADS 1.80569443899 -1.55733152327 1.52753082269 0.283180545842 -0.0975201639472 2.68518992607 1.12868554292 -0.891763906257 2.31635865495 +15 BEAM3R HERM2LINE3 29 31 30 MAT 1 TRIADS 0.283180545842 -0.0975201639472 2.68518992607 -1.45991682651 1.45524885232 2.03451218189 -0.619280397573 0.721139801863 2.59399952213 +16 BEAM3R HERM2LINE3 31 33 32 MAT 1 TRIADS -1.45991682651 1.45524885232 2.03451218189 2.22634455929 -2.0175765715 0.258861129255 -2.10587644627 1.98554051084 1.04097906892 +17 BEAM3R HERM2LINE3 33 35 34 MAT 1 TRIADS 2.22634455929 -2.0175765715 0.258861129255 1.212344311 -0.972142819565 2.24998882294 1.86442152461 -1.61744665626 1.41942125224 +18 BEAM3R HERM2LINE3 35 37 36 MAT 1 TRIADS 1.212344311 -0.972142819565 2.24998882294 -0.52202942138 0.63429241373 2.62671447739 0.379798754095 -0.186846618714 2.66694680973 +19 BEAM3R HERM2LINE3 37 39 38 MAT 1 TRIADS -0.52202942138 0.63429241373 2.62671447739 -2.04953209802 1.94167445759 1.16746597535 -1.37552297658 1.38315100848 2.11737607287 +20 BEAM3R HERM2LINE3 39 41 40 MAT 1 TRIADS -2.04953209802 1.94167445759 1.16746597535 1.91972138842 -1.67466915672 1.30735897671 2.24367819813 -2.0418336394 0.118369341612 +21 BEAM3R HERM2LINE3 41 43 42 MAT 1 TRIADS 1.91972138842 -1.67466915672 1.30735897671 0.475593699751 -0.275746520808 2.64328178769 1.29387400081 -1.050872367 2.17870281208 +22 BEAM3R HERM2LINE3 43 45 44 MAT 1 TRIADS 0.475593699751 -0.275746520808 2.64328178769 -1.28902744575 1.30881829381 2.19497883387 -0.424222212237 0.54660289282 2.65385874112 +23 BEAM3R HERM2LINE3 45 47 46 MAT 1 TRIADS -1.28902744575 1.30881829381 2.19497883387 2.25623336334 -2.06184779703 -0.0241362877982 -1.98936371539 1.8940663713 1.28978690263 +24 BEAM3R HERM2LINE3 47 49 48 MAT 1 TRIADS 2.25623336334 -2.06184779703 -0.0241362877982 1.3731336686 -1.12781910464 2.10257953071 1.97145405228 -1.72886264843 1.19148648474 +25 BEAM3R HERM2LINE3 49 51 50 MAT 1 TRIADS 1.3731336686 -1.12781910464 2.10257953071 -0.326015193586 0.458213943364 2.67542994319 0.570421696708 -0.364086407854 2.61423232932 +26 BEAM3R HERM2LINE3 51 53 52 MAT 1 TRIADS -0.326015193586 0.458213943364 2.67542994319 -1.92556253846 1.84288059386 1.40777016564 -1.20060788397 1.23240910853 2.26725661423 +27 BEAM3R HERM2LINE3 53 55 54 MAT 1 TRIADS -1.92556253846 1.84288059386 1.40777016564 2.01948027371 -1.77989088713 1.07195526377 2.26389551913 -2.07749905411 -0.168399114181 +28 BEAM3R HERM2LINE3 55 57 56 MAT 1 TRIADS 2.01948027371 -1.77989088713 1.07195526377 0.664139775563 -0.451733229756 2.57983994173 1.44998231483 -1.2028492084 2.02170337533 +29 BEAM3R HERM2LINE3 57 59 58 MAT 1 TRIADS 0.664139775563 -0.451733229756 2.57983994173 -1.11043954027 1.15408017053 2.33415406832 -0.227562877473 0.369266819821 2.69143064303 +30 BEAM3R HERM2LINE3 59 61 60 MAT 1 TRIADS -1.11043954027 1.15408017053 2.33415406832 2.26655579294 -2.08867177669 -0.314148900795 -1.85831971635 1.78828225596 1.52125861283 +31 BEAM3R HERM2LINE3 61 63 62 MAT 1 TRIADS 2.26655579294 -2.08867177669 -0.314148900795 1.52427886866 -1.27582844248 1.93616451982 2.06366179655 -1.82761796108 0.948926273095 +32 BEAM3R HERM2LINE3 63 65 64 MAT 1 TRIADS 1.52427886866 -1.27582844248 1.93616451982 -0.129017985049 0.27990142372 2.70186810969 0.756605562353 -0.538554235032 2.54015021839 +------------------------------------------------------------------FLUID ELEMENTS +-----------------------------------------------------------------------------END diff --git a/tests/testing_mesh_creation_functions.py b/tests/testing_mesh_creation_functions.py index e0688bef..f2cc27d8 100644 --- a/tests/testing_mesh_creation_functions.py +++ b/tests/testing_mesh_creation_functions.py @@ -66,6 +66,7 @@ create_fibers_in_rectangle, create_wire_fibers, create_beam_mesh_from_nurbs, + create_beam_mesh_helix, ) # Testing imports. @@ -737,6 +738,99 @@ def line(t): # Check the output. compare_test_result(self, input_file.get_string(header=False)) + def test_mesh_creation_functions_helix_no_rotation(self): + """Create a helix and compare it with the reference file.""" + + # Create mesh. + mesh = Mesh() + + # Create input file. + input_file = InputFile() + + # Add material and function. + mat = MaterialReissner(youngs_modulus=1e5, radius=0.5, shear_correction=1.0) + + # Create helix. + create_beam_mesh_helix( + mesh, + Beam3rHerm2Line3, + mat, + [0.0, 0.0, 1.0], + [0.0, 0.0, 0.0], + [2.0, 0.0, 0.0], + np.pi / 4, + height_helix=80.0, + l_el=5.0, + ) + + # Add mesh. + input_file.add_mesh(mesh) + + # Check the output. + compare_test_result(self, input_file.get_string(header=False)) + + def test_mesh_creation_functions_helix_rotation_offset(self): + """Create a helix and compare it with the reference file.""" + + # Create mesh. + mesh = Mesh() + + # Create input file. + input_file = InputFile() + + # Add material and function. + mat = MaterialReissner(youngs_modulus=1e5, radius=0.5, shear_correction=1.0) + + # Create helix. + create_beam_mesh_helix( + mesh, + Beam3rHerm2Line3, + mat, + [1.0, 1.0, 1.0], + [-1.0, -1.0, -1.0], + [3.0, 0.0, 0.0], + np.pi / 6, + height_helix=80.0, + l_el=5.0, + ) + + # Add mesh. + input_file.add_mesh(mesh) + + # Check the output. + compare_test_result(self, input_file.get_string(header=False)) + + def test_mesh_creation_functions_helix_radius_zero(self): + """Create a helix and compare it with the reference file.""" + + # Create mesh. + mesh = Mesh() + + # Create input file. + input_file = InputFile() + + # Add material and function. + mat = MaterialReissner(youngs_modulus=1e5, radius=0.5, shear_correction=1.0) + + # Create helix. + create_beam_mesh_helix( + mesh, + Beam3rHerm2Line3, + mat, + [1.0, 1.0, 1.0], + [-1.0, -1.0, -1.0], + [1.0, 1.0, 1.0], + np.pi / 6, + height_helix=80.0, + n_el=10, + ) + + # Add mesh. + input_file.add_mesh(mesh) + + # Check the output. + compare_test_result(self, input_file.get_string(header=False)) + if __name__ == "__main__": # Execution part of script. From 169f157d1bedc5fd391be78cce3eb9cf8fb34722 Mon Sep 17 00:00:00 2001 From: David Rudlstorfer Date: Tue, 23 Apr 2024 09:56:06 +0200 Subject: [PATCH 3/8] Review suggestions --- .../beam_basic_geometry.py | 63 ++------- ..._functions_helix_no_rotation_reference.dat | 89 +++---------- ..._functions_helix_radius_zero_reference.dat | 47 +++---- ...ctions_helix_rotation_offset_reference.dat | 121 ++++-------------- ...elix_twist_angle_right_angle_reference.dat | 30 +++++ tests/testing_mesh_creation_functions.py | 63 +++++---- 6 files changed, 143 insertions(+), 270 deletions(-) create mode 100644 tests/reference-files/test_mesh_creation_functions_helix_twist_angle_right_angle_reference.dat diff --git a/meshpy/mesh_creation_functions/beam_basic_geometry.py b/meshpy/mesh_creation_functions/beam_basic_geometry.py index 026baddf..701375d7 100644 --- a/meshpy/mesh_creation_functions/beam_basic_geometry.py +++ b/meshpy/mesh_creation_functions/beam_basic_geometry.py @@ -524,10 +524,9 @@ def create_beam_mesh_helix( Number of equally spaced beam elements along the line. Defaults to 1. Mutually exclusive with l_el. l_el: float - Desired length of beam elements. This requires the option interval_length - to be set. Mutually exclusive with n_el. Be aware, that this length - might not be achieved, if the elements are warped after they are - created. + Desired length of beam elements. Mutually exclusive with n_el. + Be aware, that this length might not be achieved, if the elements are + warped after they are created. Return ---- @@ -536,9 +535,6 @@ def create_beam_mesh_helix( with all nodes of the line. """ - if not 0 < twist_angle < 2 * np.pi: - raise ValueError("Twist angle of helix must be between 0 and 2pi!") - if height_helix is None and turns is None: raise ValueError("Either provide height_helix or turns!") elif height_helix is not None and turns is not None: @@ -553,7 +549,7 @@ def create_beam_mesh_helix( radius = np.linalg.norm(start_point_origin_vec) # return line if radius of helix is 0 or twist angle is np.pi/2 - if np.isclose(radius, 0) or np.isclose(twist_angle, np.pi / 2): + if np.isclose(radius, 0) or np.isclose(np.cos(twist_angle), 0.0): if turns: raise ValueError( "Radius of helix is 0 or twist angle is 90 degrees! " @@ -571,7 +567,7 @@ def create_beam_mesh_helix( beam_object, material, start_point=start_point, - end_point=start_point + height_helix * axis, + end_point=start_point + height_helix * axis * np.sign(np.sin(twist_angle)), **kwargs, ) @@ -598,50 +594,11 @@ def create_beam_mesh_helix( mesh.wrap_around_cylinder() - # transform simple helix to align with neccessary axis and starting point - axis_simple = np.array([0, 0, 1]) - start_point_origin_vec_simple = np.array([1, 0, 0]) - - start_point_origin_vec /= np.linalg.norm(start_point_origin_vec) - - # 1 - get rotation matrix to align axes - if np.isclose(np.dot(axis, axis_simple), 1): - # axis point in same direction - R_axis = np.eye(3) - elif np.isclose(np.dot(axis, axis_simple), -1): - # axis point in opposite direction - R_axis = np.asarray([[1, 0, 0], [0, -1, 0], [0, 0, -1]]) - else: - v = np.cross(axis, axis_simple) - c = np.dot(axis, axis_simple) - v_x = np.asarray([[0, -v[2], v[1]], [v[2], 0, -v[0]], [-v[1], v[0], 0]]) - R_axis = np.eye(3) + v_x + np.matmul(v_x, v_x) / (1 + c) - - start_point_origin_vec_simple_rot = np.dot(R_axis, start_point_origin_vec_simple) - start_point_origin_vec_simple_rot /= np.linalg.norm( - start_point_origin_vec_simple_rot + # rotate and translate simple helix to align with neccessary axis and starting point + mesh.rotate( + Rotation.from_basis(start_point_origin_vec, axis) + * Rotation([1, 0, 0], -np.pi * 0.5) ) - - # 2 - get rotation matrix to align start_point_origin_vec's - if np.isclose(np.dot(start_point_origin_vec, start_point_origin_vec_simple_rot), 1): - # vectors point in same direction - R_start_vec = np.eye(3) - elif np.isclose( - np.dot(start_point_origin_vec, start_point_origin_vec_simple_rot), -1 - ): - # vectors point in opposite direction - R_start_vec = np.asarray([[-1, 0, 0], [0, 1, 0], [0, 0, -1]]) - else: - v = np.cross(start_point_origin_vec, start_point_origin_vec_simple_rot) - c = np.dot(start_point_origin_vec, start_point_origin_vec_simple_rot) - v_x = np.asarray([[0, -v[2], v[1]], [v[2], 0, -v[0]], [-v[1], v[0], 0]]) - R_start_vec = np.eye(3) + v_x + np.matmul(v_x, v_x) / (1 + c) - - # 3 - rotate mesh - rotation = Rotation.from_rotation_matrix(np.matmul(R_start_vec, R_axis)) - mesh.rotate(rotation) - - # 4 - translate simple helix to align with start point - mesh.translate(-mesh.nodes[0].coordinates+start_point) + mesh.translate(-mesh.nodes[0].coordinates + start_point) return helix diff --git a/tests/reference-files/test_mesh_creation_functions_helix_no_rotation_reference.dat b/tests/reference-files/test_mesh_creation_functions_helix_no_rotation_reference.dat index 0f3de80c..4306efc2 100644 --- a/tests/reference-files/test_mesh_creation_functions_helix_no_rotation_reference.dat +++ b/tests/reference-files/test_mesh_creation_functions_helix_no_rotation_reference.dat @@ -8,77 +8,28 @@ // ----------------------------------------------------------------------------- -----------------------------------------------------------------------MATERIALS MAT 1 MAT_BeamReissnerElastHyper YOUNG 100000.0 POISSONRATIO 0.0 DENS 0.0 CROSSAREA 0.7853981633974483 SHEARCORR 1.0 MOMINPOL 0.09817477042468103 MOMIN2 0.04908738521234052 MOMIN3 0.04908738521234052 +-------------------------------------------------------------DNODE-NODE TOPOLOGY +NODE 1 DNODE 1 +NODE 7 DNODE 2 +-------------------------------------------------------------DLINE-NODE TOPOLOGY +NODE 1 DLINE 1 +NODE 2 DLINE 1 +NODE 3 DLINE 1 +NODE 4 DLINE 1 +NODE 5 DLINE 1 +NODE 6 DLINE 1 +NODE 7 DLINE 1 ---------------------------------------------------------------------NODE COORDS NODE 1 COORD 2 0 0 -NODE 2 COORD 1.29031760642 1.52809701085 1.73913043478 -NODE 3 COORD -0.335080474557 1.97173047742 3.47826086957 -NODE 4 COORD -1.72267784231 1.01606153928 5.21739130435 -NODE 5 COORD -1.88772107557 -0.660688384072 6.95652173913 -NODE 6 COORD -0.713081897511 -1.86855939361 8.69565217391 -NODE 7 COORD 0.967618948392 -1.75034670015 10.4347826087 -NODE 8 COORD 1.96161766293 -0.389943770933 12.1739130435 -NODE 9 COORD 1.56349085915 1.247195387 13.9130434783 -NODE 10 COORD 0.0557821201163 1.99922193742 15.652173913 -NODE 11 COORD -1.49151420744 1.33243587801 17.3913043478 -NODE 12 COORD -1.98030916221 -0.279956464605 19.1304347826 -NODE 13 COORD -1.06371357071 -1.69366863332 20.8695652174 -NODE 14 COORD 0.607780813727 -1.90541399241 22.6086956522 -NODE 15 COORD 1.84794385551 -0.764920588611 24.347826087 -NODE 16 COORD 1.77665367872 0.918423489409 26.0869565217 -NODE 17 COORD 0.444503666653 1.94997858715 27.8260869565 -NODE 18 COORD -1.20310277152 1.59766821373 29.5652173913 -NODE 19 COORD -1.99688835508 0.111520838252 31.3043478261 -NODE 20 COORD -1.3735174311 -1.45377091265 33.0434782609 -NODE 21 COORD 0.224614631004 -1.98734704255 34.7826086957 -NODE 22 COORD 1.66334164414 -1.11053796642 36.5217391304 -NODE 23 COORD 1.92162437793 0.554400351876 38.2608695652 -NODE 24 COORD 0.816164123627 1.82589050146 40 -NODE 25 COORD -0.86851343948 1.80157830955 41.7391304348 -NODE 26 COORD -1.936822306 0.498717710705 43.4782608696 -NODE 27 COORD -1.63060248247 -1.15807406679 45.2173913043 -NODE 28 COORD -0.167172786198 -1.99300106863 46.9565217391 -NODE 29 COORD 1.41489649312 -1.41353030168 48.6956521739 -NODE 30 COORD 1.99283864253 0.169098033164 50.4347826087 -NODE 31 COORD 1.1564982941 1.63172047108 52.1739130435 -NODE 32 COORD -0.500588531859 1.93633961943 53.9130434783 -NODE 33 COORD -1.80241649033 0.866772631882 55.652173913 -NODE 34 COORD -1.82510119972 -0.817927631747 57.3913043478 -NODE 35 COORD -0.552543721171 -1.9221590559 59.1304347826 -NODE 36 COORD 1.11214430798 -1.66226804043 60.8695652174 -NODE 37 COORD 1.98756310264 -0.222694663255 62.6086956522 -NODE 38 COORD 1.45244335723 1.37492119558 64.347826087 -NODE 39 COORD -0.113449866473 1.99677968935 66.0869565217 -NODE 40 COORD -1.59882971739 1.20155879374 67.8260869565 -NODE 41 COORD -1.94954826754 -0.446387222639 69.5652173913 -NODE 42 COORD -0.91670673679 -1.77754008639 71.3043478261 -NODE 43 COORD 0.766705425133 -1.84720404695 73.0434782609 -NODE 44 COORD 1.90600024578 -0.605939818044 74.7826086957 -NODE 45 COORD 1.69264024984 1.0653492313 76.5217391304 -NODE 46 COORD 0.278043269928 1.98057868817 78.2608695652 -NODE 47 COORD -1.3338761233 1.49022632096 80 +NODE 2 COORD 1.34482448817 1.48035370639 1.66666666667 +NODE 3 COORD -0.191447096029 1.9908159155 3.33333333333 +NODE 4 COORD -1.60228723109 1.19694428821 5 +NODE 5 COORD -1.96334800942 -0.381135925751 6.66666666667 +NODE 6 COORD -1.03807125077 -1.70950521448 8.33333333333 +NODE 7 COORD 0.567324370926 -1.91784854933 10 --------------------------------------------------------------STRUCTURE ELEMENTS -1 BEAM3R HERM2LINE3 1 3 2 MAT 1 TRIADS 1.75998840379 0.729011066468 1.75998840379 -0.563096707478 -1.76680148356 -1.64748681036 -1.47549841571 -1.60522261285 -2.17839873024 -2 BEAM3R HERM2LINE3 3 5 4 MAT 1 TRIADS -0.563096707478 -1.76680148356 -1.64748681036 0.841531446705 -1.33918705776 -0.35189565727 0.209954140218 -1.65415042404 -1.02120098565 -3 BEAM3R HERM2LINE3 5 7 6 MAT 1 TRIADS 0.841531446705 -1.33918705776 -0.35189565727 1.64691762575 -0.232419192658 1.00020143402 1.32621949133 -0.859413898109 0.330081400459 -4 BEAM3R HERM2LINE3 7 9 8 MAT 1 TRIADS 1.64691762575 -0.232419192658 1.00020143402 1.61580017099 1.44416786448 2.1637241481 1.76693682215 0.536110927807 1.62850068139 -5 BEAM3R HERM2LINE3 9 11 10 MAT 1 TRIADS 1.61580017099 1.44416786448 2.1637241481 0.0478196347767 -1.6991290691 -1.16765209885 -0.757011356003 -1.75783471143 -1.77826470792 -6 BEAM3R HERM2LINE3 11 13 12 MAT 1 TRIADS 0.0478196347767 -1.6991290691 -1.16765209885 1.23031781423 -0.980937404397 0.176338578891 0.711508352243 -1.42561326901 -0.504948429124 -7 BEAM3R HERM2LINE3 13 15 14 MAT 1 TRIADS 1.23031781423 -0.980937404397 0.176338578891 1.76031043681 0.350368499077 1.49247538847 1.59036767235 -0.386345923512 0.851371943298 -8 BEAM3R HERM2LINE3 15 17 16 MAT 1 TRIADS 1.76031043681 0.350368499077 1.49247538847 -0.95802472739 -1.73398041219 -1.90353508919 1.67907698206 1.22746478785 2.05523539531 -9 BEAM3R HERM2LINE3 17 19 18 MAT 1 TRIADS -0.95802472739 -1.73398041219 -1.90353508919 0.574148965511 -1.50340951546 -0.657086436354 -0.121492943693 -1.73331918065 -1.31155023095 -10 BEAM3R HERM2LINE3 19 21 20 MAT 1 TRIADS 0.574148965511 -1.50340951546 -0.657086436354 1.52425058891 -0.533063226651 0.700875305282 1.12639923094 -1.09487972284 0.0222876579204 -11 BEAM3R HERM2LINE3 21 23 22 MAT 1 TRIADS 1.52425058891 -0.533063226651 0.700875305282 1.724120335 1.0174736729 1.93859971425 1.741097671 0.171801588394 1.35262403805 -12 BEAM3R HERM2LINE3 23 25 24 MAT 1 TRIADS 1.724120335 1.0174736729 1.93859971425 -0.297983604933 -1.75600703484 -1.45239070988 -1.16602654934 -1.69390475199 -2.0222768169 -13 BEAM3R HERM2LINE3 25 27 26 MAT 1 TRIADS -0.297983604933 -1.75600703484 -1.45239070988 1.01467892939 -1.20107512455 -0.131802013582 0.429523540766 -1.57220678695 -0.807999072126 -14 BEAM3R HERM2LINE3 27 29 28 MAT 1 TRIADS 1.01467892939 -1.20107512455 -0.131802013582 1.71015643903 0.000413021288212 1.20955526508 1.44901659997 -0.67253029768 0.549058729848 -15 BEAM3R HERM2LINE3 29 31 30 MAT 1 TRIADS 1.71015643903 0.000413021288212 1.20955526508 -1.38081944254 -1.63607793051 -2.13326859063 1.75252102966 0.814424523253 1.8151046074 -16 BEAM3R HERM2LINE3 31 33 32 MAT 1 TRIADS -1.38081944254 -1.63607793051 -2.13326859063 0.277678964081 -1.63157420484 -0.957348505761 -0.481651567931 -1.76636928669 -1.58959079055 -17 BEAM3R HERM2LINE3 33 35 34 MAT 1 TRIADS 0.277678964081 -1.63157420484 -0.957348505761 1.36505185107 -0.804684001959 0.396239906063 0.895333162693 -1.29932010508 -0.285661906475 -18 BEAM3R HERM2LINE3 35 37 36 MAT 1 TRIADS 1.36505185107 -0.804684001959 0.396239906063 1.76566720269 0.618449136654 1.68582483069 1.66823066538 -0.163797889378 1.06379461775 -19 BEAM3R HERM2LINE3 37 39 38 MAT 1 TRIADS 1.76566720269 0.618449136654 1.68582483069 -0.672484754997 -1.76345708941 -1.72247099676 1.58242824868 1.53963510603 2.20763216941 -20 BEAM3R HERM2LINE3 39 41 40 MAT 1 TRIADS -0.672484754997 -1.76345708941 -1.72247099676 0.768503105955 -1.38936919451 -0.439018621427 0.118642500972 -1.68101092931 -1.10476131039 -21 BEAM3R HERM2LINE3 41 43 42 MAT 1 TRIADS 0.768503105955 -1.38936919451 -0.439018621427 1.61596464464 -0.320826825091 0.915800734772 1.27268564142 -0.929435389595 0.242714580706 -22 BEAM3R HERM2LINE3 43 45 44 MAT 1 TRIADS 1.61596464464 -0.320826825091 0.915800734772 1.65411746398 1.32014197254 2.10311901657 1.76476727298 0.42961542058 1.55166288314 -23 BEAM3R HERM2LINE3 45 47 46 MAT 1 TRIADS 1.65411746398 1.32014197254 2.10311901657 -0.0475738227814 -1.71993668072 -1.24981866284 -0.870445494973 -1.74617798224 -1.85023220455 +1 BEAM3R HERM2LINE3 1 3 2 MAT 1 TRIADS 1.75998840379 0.729011066468 1.75998840379 -0.633874850223 -1.76514699225 -1.69636461303 -1.51638250626 -1.59087011094 -2.19715939648 +2 BEAM3R HERM2LINE3 3 5 4 MAT 1 TRIADS -0.633874850223 -1.76514699225 -1.69636461303 0.746212769126 -1.40383785444 -0.465011157306 0.121031100845 -1.68035914483 -1.10261143399 +3 BEAM3R HERM2LINE3 5 7 6 MAT 1 TRIADS 0.746212769126 -1.40383785444 -0.465011157306 1.58368887616 -0.402516203743 0.835215206421 1.23796977269 -0.971871890386 0.188159617035 ------------------------------------------------------------------FLUID ELEMENTS -----------------------------------------------------------------------------END diff --git a/tests/reference-files/test_mesh_creation_functions_helix_radius_zero_reference.dat b/tests/reference-files/test_mesh_creation_functions_helix_radius_zero_reference.dat index 8d8f64f5..5dace1cc 100644 --- a/tests/reference-files/test_mesh_creation_functions_helix_radius_zero_reference.dat +++ b/tests/reference-files/test_mesh_creation_functions_helix_radius_zero_reference.dat @@ -8,38 +8,33 @@ // ----------------------------------------------------------------------------- -----------------------------------------------------------------------MATERIALS MAT 1 MAT_BeamReissnerElastHyper YOUNG 100000.0 POISSONRATIO 0.0 DENS 0.0 CROSSAREA 0.7853981633974483 SHEARCORR 1.0 MOMINPOL 0.09817477042468103 MOMIN2 0.04908738521234052 MOMIN3 0.04908738521234052 +-------------------------------------------------------------DNODE-NODE TOPOLOGY +NODE 1 DNODE 1 +NODE 9 DNODE 2 +-------------------------------------------------------------DLINE-NODE TOPOLOGY +NODE 1 DLINE 1 +NODE 2 DLINE 1 +NODE 3 DLINE 1 +NODE 4 DLINE 1 +NODE 5 DLINE 1 +NODE 6 DLINE 1 +NODE 7 DLINE 1 +NODE 8 DLINE 1 +NODE 9 DLINE 1 ---------------------------------------------------------------------NODE COORDS NODE 1 COORD 1 1 1 -NODE 2 COORD 3.30940107676 3.30940107676 3.30940107676 -NODE 3 COORD 5.61880215352 5.61880215352 5.61880215352 -NODE 4 COORD 7.92820323028 7.92820323028 7.92820323028 -NODE 5 COORD 10.237604307 10.237604307 10.237604307 -NODE 6 COORD 12.5470053838 12.5470053838 12.5470053838 -NODE 7 COORD 14.8564064606 14.8564064606 14.8564064606 -NODE 8 COORD 17.1658075373 17.1658075373 17.1658075373 -NODE 9 COORD 19.4752086141 19.4752086141 19.4752086141 -NODE 10 COORD 21.7846096908 21.7846096908 21.7846096908 -NODE 11 COORD 24.0940107676 24.0940107676 24.0940107676 -NODE 12 COORD 26.4034118443 26.4034118443 26.4034118443 -NODE 13 COORD 28.7128129211 28.7128129211 28.7128129211 -NODE 14 COORD 31.0222139979 31.0222139979 31.0222139979 -NODE 15 COORD 33.3316150746 33.3316150746 33.3316150746 -NODE 16 COORD 35.6410161514 35.6410161514 35.6410161514 -NODE 17 COORD 37.9504172281 37.9504172281 37.9504172281 -NODE 18 COORD 40.2598183049 40.2598183049 40.2598183049 -NODE 19 COORD 42.5692193817 42.5692193817 42.5692193817 -NODE 20 COORD 44.8786204584 44.8786204584 44.8786204584 -NODE 21 COORD 47.1880215352 47.1880215352 47.1880215352 +NODE 2 COORD 3.88675134595 3.88675134595 3.88675134595 +NODE 3 COORD 6.7735026919 6.7735026919 6.7735026919 +NODE 4 COORD 9.66025403784 9.66025403784 9.66025403784 +NODE 5 COORD 12.5470053838 12.5470053838 12.5470053838 +NODE 6 COORD 15.4337567297 15.4337567297 15.4337567297 +NODE 7 COORD 18.3205080757 18.3205080757 18.3205080757 +NODE 8 COORD 21.2072594216 21.2072594216 21.2072594216 +NODE 9 COORD 24.0940107676 24.0940107676 24.0940107676 --------------------------------------------------------------STRUCTURE ELEMENTS 1 BEAM3R HERM2LINE3 1 3 2 MAT 1 TRIADS -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 2 BEAM3R HERM2LINE3 3 5 4 MAT 1 TRIADS -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 3 BEAM3R HERM2LINE3 5 7 6 MAT 1 TRIADS -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 4 BEAM3R HERM2LINE3 7 9 8 MAT 1 TRIADS -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -5 BEAM3R HERM2LINE3 9 11 10 MAT 1 TRIADS -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -6 BEAM3R HERM2LINE3 11 13 12 MAT 1 TRIADS -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -7 BEAM3R HERM2LINE3 13 15 14 MAT 1 TRIADS -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -8 BEAM3R HERM2LINE3 15 17 16 MAT 1 TRIADS -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -9 BEAM3R HERM2LINE3 17 19 18 MAT 1 TRIADS -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -10 BEAM3R HERM2LINE3 19 21 20 MAT 1 TRIADS -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 ------------------------------------------------------------------FLUID ELEMENTS -----------------------------------------------------------------------------END diff --git a/tests/reference-files/test_mesh_creation_functions_helix_rotation_offset_reference.dat b/tests/reference-files/test_mesh_creation_functions_helix_rotation_offset_reference.dat index c17ca070..37c2437c 100644 --- a/tests/reference-files/test_mesh_creation_functions_helix_rotation_offset_reference.dat +++ b/tests/reference-files/test_mesh_creation_functions_helix_rotation_offset_reference.dat @@ -8,104 +8,33 @@ // ----------------------------------------------------------------------------- -----------------------------------------------------------------------MATERIALS MAT 1 MAT_BeamReissnerElastHyper YOUNG 100000.0 POISSONRATIO 0.0 DENS 0.0 CROSSAREA 0.7853981633974483 SHEARCORR 1.0 MOMINPOL 0.09817477042468103 MOMIN2 0.04908738521234052 MOMIN3 0.04908738521234052 +-------------------------------------------------------------DNODE-NODE TOPOLOGY +NODE 1 DNODE 1 +NODE 9 DNODE 2 +-------------------------------------------------------------DLINE-NODE TOPOLOGY +NODE 1 DLINE 1 +NODE 2 DLINE 1 +NODE 3 DLINE 1 +NODE 4 DLINE 1 +NODE 5 DLINE 1 +NODE 6 DLINE 1 +NODE 7 DLINE 1 +NODE 8 DLINE 1 +NODE 9 DLINE 1 ---------------------------------------------------------------------NODE COORDS NODE 1 COORD 3 0 0 -NODE 2 COORD 0.918076435378 0.609437912993 -1.11662047761 -NODE 3 COORD -0.320224788882 -0.108704968912 -3.09235893928 -NODE 4 COORD -0.553906634489 -2.15353581209 -4.40259601994 -NODE 5 COORD -0.357045631234 -4.55343269473 -4.00965545468 -NODE 6 COORD -0.618743755208 -6.07697414697 -2.12206515883 -NODE 7 COORD -1.89257820467 -6.13396235721 -0.0419786873161 -NODE 8 COORD -3.99155250793 -5.20726713255 0.787602185541 -NODE 9 COORD -6.12492064457 -4.49951315218 -0.161337373435 -NODE 10 COORD -7.47677084647 -5.05312718842 -2.11548018302 -NODE 11 COORD -7.80302301531 -6.98760111076 -3.56600827853 -NODE 12 COORD -7.61002056798 -9.41206044988 -3.37259535758 -NODE 13 COORD -7.7840421999 -11.0771115438 -1.59777623549 -NODE 14 COORD -8.94281743729 -11.2890148819 0.538809478735 -NODE 15 COORD -10.9835378973 -10.4172898641 1.55281987657 -NODE 16 COORD -13.1580815238 -9.62433982099 0.781294222078 -NODE 17 COORD -14.6204087062 -10.0149289387 -1.13226292167 -NODE 18 COORD -15.0456040469 -11.8278333759 -2.70872986187 -NODE 19 COORD -14.8676148773 -14.2611302773 -2.7156316497 -NODE 20 COORD -14.9617347736 -16.0589595932 -1.06893411043 -NODE 21 COORD -16.0041568505 -16.430428838 1.10546888891 -NODE 22 COORD -17.9772075879 -15.628304059 2.29556477434 -NODE 23 COORD -20.1822784323 -14.7640625379 1.70955218592 -NODE 24 COORD -21.7509932035 -14.9946319786 -0.144803036132 -NODE 25 COORD -22.2805933859 -16.6758739133 -1.83169686612 -NODE 26 COORD -22.1286339569 -19.1022020968 -2.03785570689 -NODE 27 COORD -22.1513626979 -21.0228554456 -0.533450273652 -NODE 28 COORD -23.0772091751 -21.5570719157 1.65973978962 -NODE 29 COORD -24.9737974882 -20.8385364514 3.01595553456 -NODE 30 COORD -27.1984661503 -19.9175645679 2.62184676345 -NODE 31 COORD -28.8684993832 -19.9925932122 0.844764521911 -NODE 32 COORD -29.5070046018 -21.5332921214 -0.936027309533 -NODE 33 COORD -29.3918516653 -23.9369094824 -1.33855056716 -NODE 34 COORD -29.3523572806 -25.9693015751 0.0107026205558 -NODE 35 COORD -30.1624792762 -26.6679478319 2.20347651445 -NODE 36 COORD -31.9745166145 -26.0462209749 3.71431667463 -NODE 37 COORD -34.2076732154 -25.0836022809 3.51673520861 -NODE 38 COORD -35.9730227303 -25.0090014018 1.83428539098 -NODE 39 COORD -36.7239302607 -26.4015710388 -0.0230108364964 -NODE 40 COORD -36.6560216139 -28.7669446192 -0.61719753328 -NODE 41 COORD -36.5640451523 -30.8989611523 0.565472083615 -NODE 42 COORD -37.2603595044 -31.7622055052 2.73863040738 -NODE 43 COORD -38.9805359565 -31.2496150267 4.3911755852 -NODE 44 COORD -41.210992451 -30.2608166043 4.39293507034 -NODE 45 COORD -43.0647782898 -30.0438754294 2.82160563956 -NODE 46 COORD -43.9305502824 -31.2820936865 0.905903158914 -NODE 47 COORD -43.9198886444 -33.5940427194 0.126519050488 -NODE 48 COORD -43.7856544684 -35.8126519369 1.13270785779 -NODE 49 COORD -44.3711260818 -36.8391468931 3.2672318526 -NODE 50 COORD -45.9929776935 -36.4470155157 5.04725767329 -NODE 51 COORD -48.209570902 -35.4477455388 5.24933600282 -NODE 52 COORD -50.1440986869 -35.0970641234 3.80459160189 -NODE 53 COORD -51.1261394925 -36.1761303317 1.84911888059 -NODE 54 COORD -51.1822003884 -38.4199660428 0.892708891475 -NODE 55 COORD -51.0163220162 -40.711338747 1.71414488169 -NODE 56 COORD -51.4949365591 -41.898233421 3.79137157656 -NODE 57 COORD -53.0129048604 -41.6367745458 5.683479682 -NODE 58 COORD -55.2045992718 -40.6428376222 6.08500999075 -NODE 59 COORD -57.2114310634 -40.1682476502 4.78114952715 -NODE 60 COORD -58.3100743006 -41.0848267897 2.80490882623 -NODE 61 COORD -58.4417188003 -43.2464876678 1.6812747383 -NODE 62 COORD -58.255101165 -45.596124574 2.31138731308 -NODE 63 COORD -58.6318283641 -46.9390909415 4.31318139417 -NODE 64 COORD -60.0413115579 -46.8173145922 6.30094124809 -NODE 65 COORD -62.1973009569 -45.844466217 6.89921989556 +NODE 2 COORD 2.9899942382 2.42676917578 -0.25169990452 +NODE 3 COORD 2.05197680159 4.33763484933 0.940515367999 +NODE 4 COORD 1.40034341356 4.86248321003 3.23236390479 +NODE 5 COORD 2.03994442247 4.14534044222 5.47496917316 +NODE 6 COORD 4.03084223457 3.23898968807 6.55548562467 +NODE 7 COORD 6.44436403582 3.33465636213 6.21136065882 +NODE 8 COORD 8.04260574482 4.89039614134 5.22244268006 +NODE 9 COORD 8.18419850451 7.29593855857 4.84037101261 --------------------------------------------------------------STRUCTURE ELEMENTS -1 BEAM3R HERM2LINE3 1 3 2 MAT 1 TRIADS -0.108618942944 0.261360938214 2.70333485579 -1.77284298166 1.7180707555 1.65205209133 -0.999520540041 1.05719856207 2.40766774032 -2 BEAM3R HERM2LINE3 3 5 4 MAT 1 TRIADS -1.77284298166 1.7180707555 1.65205209133 2.11167411324 -1.88063609587 0.796012242688 2.26295918663 -2.09603528171 -0.491647732442 -3 BEAM3R HERM2LINE3 5 7 6 MAT 1 TRIADS 2.11167411324 -1.88063609587 0.796012242688 0.866344176248 -0.642060766402 2.48525894638 1.61035648878 -1.36099282884 1.82684383387 -4 BEAM3R HERM2LINE3 7 9 8 MAT 1 TRIADS 0.866344176248 -0.642060766402 2.48525894638 -0.90610071262 0.975178601686 2.46253366883 -0.0101633675427 0.171675250201 2.70707346093 -5 BEAM3R HERM2LINE3 9 11 10 MAT 1 TRIADS -0.90610071262 0.975178601686 2.46253366883 -2.25006371787 2.093066903 0.638471971814 -1.69867736959 1.6565260914 1.75513173935 -6 BEAM3R HERM2LINE3 11 13 12 MAT 1 TRIADS -2.25006371787 2.093066903 0.638471971814 1.67852096327 -1.42896856626 1.73136413906 2.14688785814 -1.9205996795 0.665883347016 -7 BEAM3R HERM2LINE3 13 15 14 MAT 1 TRIADS 1.67852096327 -1.42896856626 1.73136413906 0.0880534304067 0.0818757918455 2.70528065294 0.955544482991 -0.726590146756 2.43406002991 -8 BEAM3R HERM2LINE3 15 17 16 MAT 1 TRIADS 0.0880534304067 0.0818757918455 2.70528065294 -1.62167729776 1.59209849992 1.85330231577 -0.811477730509 0.891729594891 2.51189320904 -9 BEAM3R HERM2LINE3 17 19 18 MAT 1 TRIADS -1.62167729776 1.59209849992 1.85330231577 2.17782390038 -1.95683153795 0.532842452221 -2.20633103179 2.06139645822 0.776270930481 -10 BEAM3R HERM2LINE3 19 21 20 MAT 1 TRIADS 2.17782390038 -1.95683153795 0.532842452221 1.04303861771 -0.809868736978 2.37773862369 1.74368063424 -1.4944601008 1.63155373758 -11 BEAM3R HERM2LINE3 21 23 22 MAT 1 TRIADS 1.04303861771 -0.809868736978 2.37773862369 -0.715816692811 0.807000814978 2.55572142691 0.185883603988 -0.00790114767113 2.69797768381 -12 BEAM3R HERM2LINE3 23 25 24 MAT 1 TRIADS -0.715816692811 0.807000814978 2.55572142691 -2.15820598418 2.02550152703 0.910513105456 -1.54202900855 1.52495183462 1.94646007452 -13 BEAM3R HERM2LINE3 25 27 26 MAT 1 TRIADS -2.15820598418 2.02550152703 0.910513105456 1.80569443899 -1.55733152327 1.52753082269 2.20435189871 -1.98920027825 0.3970956786 -14 BEAM3R HERM2LINE3 27 29 28 MAT 1 TRIADS 1.80569443899 -1.55733152327 1.52753082269 0.283180545842 -0.0975201639472 2.68518992607 1.12868554292 -0.891763906257 2.31635865495 -15 BEAM3R HERM2LINE3 29 31 30 MAT 1 TRIADS 0.283180545842 -0.0975201639472 2.68518992607 -1.45991682651 1.45524885232 2.03451218189 -0.619280397573 0.721139801863 2.59399952213 -16 BEAM3R HERM2LINE3 31 33 32 MAT 1 TRIADS -1.45991682651 1.45524885232 2.03451218189 2.22634455929 -2.0175765715 0.258861129255 -2.10587644627 1.98554051084 1.04097906892 -17 BEAM3R HERM2LINE3 33 35 34 MAT 1 TRIADS 2.22634455929 -2.0175765715 0.258861129255 1.212344311 -0.972142819565 2.24998882294 1.86442152461 -1.61744665626 1.41942125224 -18 BEAM3R HERM2LINE3 35 37 36 MAT 1 TRIADS 1.212344311 -0.972142819565 2.24998882294 -0.52202942138 0.63429241373 2.62671447739 0.379798754095 -0.186846618714 2.66694680973 -19 BEAM3R HERM2LINE3 37 39 38 MAT 1 TRIADS -0.52202942138 0.63429241373 2.62671447739 -2.04953209802 1.94167445759 1.16746597535 -1.37552297658 1.38315100848 2.11737607287 -20 BEAM3R HERM2LINE3 39 41 40 MAT 1 TRIADS -2.04953209802 1.94167445759 1.16746597535 1.91972138842 -1.67466915672 1.30735897671 2.24367819813 -2.0418336394 0.118369341612 -21 BEAM3R HERM2LINE3 41 43 42 MAT 1 TRIADS 1.91972138842 -1.67466915672 1.30735897671 0.475593699751 -0.275746520808 2.64328178769 1.29387400081 -1.050872367 2.17870281208 -22 BEAM3R HERM2LINE3 43 45 44 MAT 1 TRIADS 0.475593699751 -0.275746520808 2.64328178769 -1.28902744575 1.30881829381 2.19497883387 -0.424222212237 0.54660289282 2.65385874112 -23 BEAM3R HERM2LINE3 45 47 46 MAT 1 TRIADS -1.28902744575 1.30881829381 2.19497883387 2.25623336334 -2.06184779703 -0.0241362877982 -1.98936371539 1.8940663713 1.28978690263 -24 BEAM3R HERM2LINE3 47 49 48 MAT 1 TRIADS 2.25623336334 -2.06184779703 -0.0241362877982 1.3731336686 -1.12781910464 2.10257953071 1.97145405228 -1.72886264843 1.19148648474 -25 BEAM3R HERM2LINE3 49 51 50 MAT 1 TRIADS 1.3731336686 -1.12781910464 2.10257953071 -0.326015193586 0.458213943364 2.67542994319 0.570421696708 -0.364086407854 2.61423232932 -26 BEAM3R HERM2LINE3 51 53 52 MAT 1 TRIADS -0.326015193586 0.458213943364 2.67542994319 -1.92556253846 1.84288059386 1.40777016564 -1.20060788397 1.23240910853 2.26725661423 -27 BEAM3R HERM2LINE3 53 55 54 MAT 1 TRIADS -1.92556253846 1.84288059386 1.40777016564 2.01948027371 -1.77989088713 1.07195526377 2.26389551913 -2.07749905411 -0.168399114181 -28 BEAM3R HERM2LINE3 55 57 56 MAT 1 TRIADS 2.01948027371 -1.77989088713 1.07195526377 0.664139775563 -0.451733229756 2.57983994173 1.44998231483 -1.2028492084 2.02170337533 -29 BEAM3R HERM2LINE3 57 59 58 MAT 1 TRIADS 0.664139775563 -0.451733229756 2.57983994173 -1.11043954027 1.15408017053 2.33415406832 -0.227562877473 0.369266819821 2.69143064303 -30 BEAM3R HERM2LINE3 59 61 60 MAT 1 TRIADS -1.11043954027 1.15408017053 2.33415406832 2.26655579294 -2.08867177669 -0.314148900795 -1.85831971635 1.78828225596 1.52125861283 -31 BEAM3R HERM2LINE3 61 63 62 MAT 1 TRIADS 2.26655579294 -2.08867177669 -0.314148900795 1.52427886866 -1.27582844248 1.93616451982 2.06366179655 -1.82761796108 0.948926273095 -32 BEAM3R HERM2LINE3 63 65 64 MAT 1 TRIADS 1.52427886866 -1.27582844248 1.93616451982 -0.129017985049 0.27990142372 2.70186810969 0.756605562353 -0.538554235032 2.54015021839 +1 BEAM3R HERM2LINE3 1 3 2 MAT 1 TRIADS 1.50130718108 1.35661672402 0.477171338627 -1.21863105979 -2.05469395851 -0.864081375082 1.75047263615 2.16242430293 0.846693286851 +2 BEAM3R HERM2LINE3 3 5 4 MAT 1 TRIADS -1.21863105979 -2.05469395851 -0.864081375082 0.0863366257001 -0.868861065578 -0.445997447356 -0.52331096555 -1.49406240657 -0.676920827978 +3 BEAM3R HERM2LINE3 5 7 6 MAT 1 TRIADS 0.0863366257001 -0.868861065578 -0.445997447356 1.08651489404 0.517671463843 0.11327033771 0.622783907829 -0.196088893105 -0.181481669134 +4 BEAM3R HERM2LINE3 7 9 8 MAT 1 TRIADS 1.08651489404 0.517671463843 0.11327033771 1.73107566054 2.07231804729 0.804238861004 1.46615833297 1.27206928616 0.439606672431 ------------------------------------------------------------------FLUID ELEMENTS -----------------------------------------------------------------------------END diff --git a/tests/reference-files/test_mesh_creation_functions_helix_twist_angle_right_angle_reference.dat b/tests/reference-files/test_mesh_creation_functions_helix_twist_angle_right_angle_reference.dat new file mode 100644 index 00000000..2ecea87b --- /dev/null +++ b/tests/reference-files/test_mesh_creation_functions_helix_twist_angle_right_angle_reference.dat @@ -0,0 +1,30 @@ +// ----------------------------------------------------------------------------- +// This input file was created with MeshPy. +// Copyright (c) 2018-2024 +// Ivo Steinbrecher +// Institute for Mathematics and Computer-Based Simulation +// Universitaet der Bundeswehr Muenchen +// https://www.unibw.de/imcs-en +// ----------------------------------------------------------------------------- +-----------------------------------------------------------------------MATERIALS +MAT 1 MAT_BeamReissnerElastHyper YOUNG 100000.0 POISSONRATIO 0.0 DENS 0.0 CROSSAREA 0.7853981633974483 SHEARCORR 1.0 MOMINPOL 0.09817477042468103 MOMIN2 0.04908738521234052 MOMIN3 0.04908738521234052 +-------------------------------------------------------------DNODE-NODE TOPOLOGY +NODE 1 DNODE 1 +NODE 5 DNODE 2 +-------------------------------------------------------------DLINE-NODE TOPOLOGY +NODE 1 DLINE 1 +NODE 2 DLINE 1 +NODE 3 DLINE 1 +NODE 4 DLINE 1 +NODE 5 DLINE 1 +---------------------------------------------------------------------NODE COORDS +NODE 1 COORD 2 2 1 +NODE 2 COORD 3.44337567297 3.44337567297 2.44337567297 +NODE 3 COORD 4.88675134595 4.88675134595 3.88675134595 +NODE 4 COORD 6.33012701892 6.33012701892 5.33012701892 +NODE 5 COORD 7.7735026919 7.7735026919 6.7735026919 +--------------------------------------------------------------STRUCTURE ELEMENTS +1 BEAM3R HERM2LINE3 1 3 2 MAT 1 TRIADS -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 +2 BEAM3R HERM2LINE3 3 5 4 MAT 1 TRIADS -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 +------------------------------------------------------------------FLUID ELEMENTS +-----------------------------------------------------------------------------END diff --git a/tests/testing_mesh_creation_functions.py b/tests/testing_mesh_creation_functions.py index f2cc27d8..87437507 100644 --- a/tests/testing_mesh_creation_functions.py +++ b/tests/testing_mesh_creation_functions.py @@ -741,9 +741,6 @@ def line(t): def test_mesh_creation_functions_helix_no_rotation(self): """Create a helix and compare it with the reference file.""" - # Create mesh. - mesh = Mesh() - # Create input file. input_file = InputFile() @@ -751,20 +748,18 @@ def test_mesh_creation_functions_helix_no_rotation(self): mat = MaterialReissner(youngs_modulus=1e5, radius=0.5, shear_correction=1.0) # Create helix. - create_beam_mesh_helix( - mesh, + helix_set = create_beam_mesh_helix( + input_file, Beam3rHerm2Line3, mat, [0.0, 0.0, 1.0], [0.0, 0.0, 0.0], [2.0, 0.0, 0.0], np.pi / 4, - height_helix=80.0, + height_helix=10.0, l_el=5.0, ) - - # Add mesh. - input_file.add_mesh(mesh) + input_file.add(helix_set) # Check the output. compare_test_result(self, input_file.get_string(header=False)) @@ -772,9 +767,6 @@ def test_mesh_creation_functions_helix_no_rotation(self): def test_mesh_creation_functions_helix_rotation_offset(self): """Create a helix and compare it with the reference file.""" - # Create mesh. - mesh = Mesh() - # Create input file. input_file = InputFile() @@ -782,20 +774,18 @@ def test_mesh_creation_functions_helix_rotation_offset(self): mat = MaterialReissner(youngs_modulus=1e5, radius=0.5, shear_correction=1.0) # Create helix. - create_beam_mesh_helix( - mesh, + helix_set = create_beam_mesh_helix( + input_file, Beam3rHerm2Line3, mat, [1.0, 1.0, 1.0], [-1.0, -1.0, -1.0], [3.0, 0.0, 0.0], np.pi / 6, - height_helix=80.0, + height_helix=10.0, l_el=5.0, ) - - # Add mesh. - input_file.add_mesh(mesh) + input_file.add(helix_set) # Check the output. compare_test_result(self, input_file.get_string(header=False)) @@ -803,9 +793,6 @@ def test_mesh_creation_functions_helix_rotation_offset(self): def test_mesh_creation_functions_helix_radius_zero(self): """Create a helix and compare it with the reference file.""" - # Create mesh. - mesh = Mesh() - # Create input file. input_file = InputFile() @@ -813,8 +800,8 @@ def test_mesh_creation_functions_helix_radius_zero(self): mat = MaterialReissner(youngs_modulus=1e5, radius=0.5, shear_correction=1.0) # Create helix. - create_beam_mesh_helix( - mesh, + helix_set = create_beam_mesh_helix( + input_file, Beam3rHerm2Line3, mat, [1.0, 1.0, 1.0], @@ -822,11 +809,35 @@ def test_mesh_creation_functions_helix_radius_zero(self): [1.0, 1.0, 1.0], np.pi / 6, height_helix=80.0, - n_el=10, + n_el=4, ) + input_file.add(helix_set) + + # Check the output. + compare_test_result(self, input_file.get_string(header=False)) + + def test_mesh_creation_functions_helix_twist_angle_right_angle(self): + """Create a helix and compare it with the reference file.""" - # Add mesh. - input_file.add_mesh(mesh) + # Create input file. + input_file = InputFile() + + # Add material and function. + mat = MaterialReissner(youngs_modulus=1e5, radius=0.5, shear_correction=1.0) + + # Create helix. + helix_set = create_beam_mesh_helix( + input_file, + Beam3rHerm2Line3, + mat, + [1.0, 1.0, 1.0], + [-1.0, -1.0, -1.0], + [2.0, 2.0, 1.0], + np.pi / 2, + height_helix=10.0, + l_el=5.0, + ) + input_file.add(helix_set) # Check the output. compare_test_result(self, input_file.get_string(header=False)) From 38b07314b0a9ccd9b4a002cb51d802cd37e88cb9 Mon Sep 17 00:00:00 2001 From: David Rudlstorfer Date: Wed, 24 Apr 2024 13:30:06 +0200 Subject: [PATCH 4/8] Fix helix calculation Fix bug to enable helix calculation for all angles and fix bug for straight line fallback within helix calculation --- .../beam_basic_geometry.py | 23 ++++++++++++++++--- ..._functions_helix_radius_zero_reference.dat | 16 ++++++------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/meshpy/mesh_creation_functions/beam_basic_geometry.py b/meshpy/mesh_creation_functions/beam_basic_geometry.py index 701375d7..239262e9 100644 --- a/meshpy/mesh_creation_functions/beam_basic_geometry.py +++ b/meshpy/mesh_creation_functions/beam_basic_geometry.py @@ -540,6 +540,12 @@ def create_beam_mesh_helix( elif height_helix is not None and turns is not None: raise ValueError("Only provide height_helix OR turns!") + if np.isclose(np.sin(twist_angle), 0.0): + raise ValueError( + "Twist angle of helix is 0 degrees! " + + "Change angle for feasible helix geometry!" + ) + # determine radius of helix axis = np.array(axis) / np.linalg.norm(np.array(axis)) origin = axis_point + np.dot( @@ -573,13 +579,24 @@ def create_beam_mesh_helix( # generate simple helix if height_helix: - end_point = np.array([radius, height_helix / np.tan(twist_angle), height_helix]) + end_point = np.array( + [ + radius, + np.sign(np.sin(twist_angle)) * height_helix / np.tan(twist_angle), + np.sign(np.sin(twist_angle)) * height_helix, + ] + ) elif turns: end_point = np.array( [ radius, - 2 * np.pi * radius * turns, - 2 * np.pi * radius * turns * np.tan(twist_angle), + np.sign(np.cos(twist_angle)) * 2 * np.pi * radius * turns, + np.sign(np.cos(twist_angle)) + * 2 + * np.pi + * radius + * turns + * np.tan(twist_angle), ] ) diff --git a/tests/reference-files/test_mesh_creation_functions_helix_radius_zero_reference.dat b/tests/reference-files/test_mesh_creation_functions_helix_radius_zero_reference.dat index 5dace1cc..bee685e7 100644 --- a/tests/reference-files/test_mesh_creation_functions_helix_radius_zero_reference.dat +++ b/tests/reference-files/test_mesh_creation_functions_helix_radius_zero_reference.dat @@ -23,14 +23,14 @@ NODE 8 DLINE 1 NODE 9 DLINE 1 ---------------------------------------------------------------------NODE COORDS NODE 1 COORD 1 1 1 -NODE 2 COORD 3.88675134595 3.88675134595 3.88675134595 -NODE 3 COORD 6.7735026919 6.7735026919 6.7735026919 -NODE 4 COORD 9.66025403784 9.66025403784 9.66025403784 -NODE 5 COORD 12.5470053838 12.5470053838 12.5470053838 -NODE 6 COORD 15.4337567297 15.4337567297 15.4337567297 -NODE 7 COORD 18.3205080757 18.3205080757 18.3205080757 -NODE 8 COORD 21.2072594216 21.2072594216 21.2072594216 -NODE 9 COORD 24.0940107676 24.0940107676 24.0940107676 +NODE 2 COORD 6.7735026919 6.7735026919 6.7735026919 +NODE 3 COORD 12.5470053838 12.5470053838 12.5470053838 +NODE 4 COORD 18.3205080757 18.3205080757 18.3205080757 +NODE 5 COORD 24.0940107676 24.0940107676 24.0940107676 +NODE 6 COORD 29.8675134595 29.8675134595 29.8675134595 +NODE 7 COORD 35.6410161514 35.6410161514 35.6410161514 +NODE 8 COORD 41.4145188433 41.4145188433 41.4145188433 +NODE 9 COORD 47.1880215352 47.1880215352 47.1880215352 --------------------------------------------------------------STRUCTURE ELEMENTS 1 BEAM3R HERM2LINE3 1 3 2 MAT 1 TRIADS -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 2 BEAM3R HERM2LINE3 3 5 4 MAT 1 TRIADS -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 -0.241535826833 -0.75993556603 0.58311906894 From 7c19916b378c57faaa3e2aab77ab8b7a7b3d721c Mon Sep 17 00:00:00 2001 From: David Rudlstorfer Date: Wed, 24 Apr 2024 13:39:15 +0200 Subject: [PATCH 5/8] Optional warning for simple line return in helix --- .../mesh_creation_functions/beam_basic_geometry.py | 13 +++++++++---- tests/testing_mesh_creation_functions.py | 2 ++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/meshpy/mesh_creation_functions/beam_basic_geometry.py b/meshpy/mesh_creation_functions/beam_basic_geometry.py index 239262e9..29a5c11d 100644 --- a/meshpy/mesh_creation_functions/beam_basic_geometry.py +++ b/meshpy/mesh_creation_functions/beam_basic_geometry.py @@ -490,6 +490,7 @@ def create_beam_mesh_helix( *, height_helix=None, turns=None, + warning_straight_line=True, **kwargs ): """ @@ -517,6 +518,9 @@ def create_beam_mesh_helix( Height of helix. Mutually exclusive with number of turns. turns: float Number of turns. Mutually exclusive with height of helix. + warning_straight_line: bool + Warn if radius of helix is zero or twist angle is 90 degrees and + simple line is returned. **kwargs (for all of them look into create_beam_mesh_function) ---- @@ -563,10 +567,11 @@ def create_beam_mesh_helix( + "Either switch to height of helix or change radius!" ) - warnings.warn( - "Radius of helix is 0 or twist angle is 90 degrees! " - + "Simple line geometry is returned!" - ) + if warning_straight_line: + warnings.warn( + "Radius of helix is 0 or twist angle is 90 degrees! " + + "Simple line geometry is returned!" + ) return create_beam_mesh_line( mesh, diff --git a/tests/testing_mesh_creation_functions.py b/tests/testing_mesh_creation_functions.py index 87437507..60e0855e 100644 --- a/tests/testing_mesh_creation_functions.py +++ b/tests/testing_mesh_creation_functions.py @@ -810,6 +810,7 @@ def test_mesh_creation_functions_helix_radius_zero(self): np.pi / 6, height_helix=80.0, n_el=4, + warning_straight_line=False, ) input_file.add(helix_set) @@ -836,6 +837,7 @@ def test_mesh_creation_functions_helix_twist_angle_right_angle(self): np.pi / 2, height_helix=10.0, l_el=5.0, + warning_straight_line=False, ) input_file.add(helix_set) From 0cdfafe3d19ba2b3791a5947c4fc280b2bc2a637 Mon Sep 17 00:00:00 2001 From: David Rudlstorfer Date: Wed, 24 Apr 2024 13:42:21 +0200 Subject: [PATCH 6/8] Add myself to contributors --- CONTRIBUTORS | 1 + website/index.md | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index f596e509..dc027216 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -8,3 +8,4 @@ Dao Viet Anh Nora Hagmeyer (@NoraHagmeyer) Matthias Mayr (@mayrmt) Gabriela Loera (@eulovi) +David Rudlstorfer (@davidrudlstorfer) \ No newline at end of file diff --git a/website/index.md b/website/index.md index 49bd14c1..92ef34d4 100644 --- a/website/index.md +++ b/website/index.md @@ -59,6 +59,8 @@ Nora Hagmeyer Matthias Mayr +David Rudlstorfer + ## Publications [comment]: <> (ASME style in JabRef) From d924efef2acef8f5030bb89cee22617c0940804a Mon Sep 17 00:00:00 2001 From: David Rudlstorfer Date: Wed, 24 Apr 2024 13:50:57 +0200 Subject: [PATCH 7/8] Update reference files for helical geometry --- ...st_mesh_creation_functions_helix_no_rotation_reference.dat | 4 ++-- ...st_mesh_creation_functions_helix_radius_zero_reference.dat | 4 ++-- ...esh_creation_functions_helix_rotation_offset_reference.dat | 4 ++-- ...tion_functions_helix_twist_angle_right_angle_reference.dat | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/reference-files/test_mesh_creation_functions_helix_no_rotation_reference.dat b/tests/reference-files/test_mesh_creation_functions_helix_no_rotation_reference.dat index 4306efc2..9d50b889 100644 --- a/tests/reference-files/test_mesh_creation_functions_helix_no_rotation_reference.dat +++ b/tests/reference-files/test_mesh_creation_functions_helix_no_rotation_reference.dat @@ -9,8 +9,8 @@ -----------------------------------------------------------------------MATERIALS MAT 1 MAT_BeamReissnerElastHyper YOUNG 100000.0 POISSONRATIO 0.0 DENS 0.0 CROSSAREA 0.7853981633974483 SHEARCORR 1.0 MOMINPOL 0.09817477042468103 MOMIN2 0.04908738521234052 MOMIN3 0.04908738521234052 -------------------------------------------------------------DNODE-NODE TOPOLOGY -NODE 1 DNODE 1 -NODE 7 DNODE 2 +NODE 7 DNODE 1 +NODE 1 DNODE 2 -------------------------------------------------------------DLINE-NODE TOPOLOGY NODE 1 DLINE 1 NODE 2 DLINE 1 diff --git a/tests/reference-files/test_mesh_creation_functions_helix_radius_zero_reference.dat b/tests/reference-files/test_mesh_creation_functions_helix_radius_zero_reference.dat index bee685e7..2a951d27 100644 --- a/tests/reference-files/test_mesh_creation_functions_helix_radius_zero_reference.dat +++ b/tests/reference-files/test_mesh_creation_functions_helix_radius_zero_reference.dat @@ -9,8 +9,8 @@ -----------------------------------------------------------------------MATERIALS MAT 1 MAT_BeamReissnerElastHyper YOUNG 100000.0 POISSONRATIO 0.0 DENS 0.0 CROSSAREA 0.7853981633974483 SHEARCORR 1.0 MOMINPOL 0.09817477042468103 MOMIN2 0.04908738521234052 MOMIN3 0.04908738521234052 -------------------------------------------------------------DNODE-NODE TOPOLOGY -NODE 1 DNODE 1 -NODE 9 DNODE 2 +NODE 9 DNODE 1 +NODE 1 DNODE 2 -------------------------------------------------------------DLINE-NODE TOPOLOGY NODE 1 DLINE 1 NODE 2 DLINE 1 diff --git a/tests/reference-files/test_mesh_creation_functions_helix_rotation_offset_reference.dat b/tests/reference-files/test_mesh_creation_functions_helix_rotation_offset_reference.dat index 37c2437c..b99654d3 100644 --- a/tests/reference-files/test_mesh_creation_functions_helix_rotation_offset_reference.dat +++ b/tests/reference-files/test_mesh_creation_functions_helix_rotation_offset_reference.dat @@ -9,8 +9,8 @@ -----------------------------------------------------------------------MATERIALS MAT 1 MAT_BeamReissnerElastHyper YOUNG 100000.0 POISSONRATIO 0.0 DENS 0.0 CROSSAREA 0.7853981633974483 SHEARCORR 1.0 MOMINPOL 0.09817477042468103 MOMIN2 0.04908738521234052 MOMIN3 0.04908738521234052 -------------------------------------------------------------DNODE-NODE TOPOLOGY -NODE 1 DNODE 1 -NODE 9 DNODE 2 +NODE 9 DNODE 1 +NODE 1 DNODE 2 -------------------------------------------------------------DLINE-NODE TOPOLOGY NODE 1 DLINE 1 NODE 2 DLINE 1 diff --git a/tests/reference-files/test_mesh_creation_functions_helix_twist_angle_right_angle_reference.dat b/tests/reference-files/test_mesh_creation_functions_helix_twist_angle_right_angle_reference.dat index 2ecea87b..35520592 100644 --- a/tests/reference-files/test_mesh_creation_functions_helix_twist_angle_right_angle_reference.dat +++ b/tests/reference-files/test_mesh_creation_functions_helix_twist_angle_right_angle_reference.dat @@ -9,8 +9,8 @@ -----------------------------------------------------------------------MATERIALS MAT 1 MAT_BeamReissnerElastHyper YOUNG 100000.0 POISSONRATIO 0.0 DENS 0.0 CROSSAREA 0.7853981633974483 SHEARCORR 1.0 MOMINPOL 0.09817477042468103 MOMIN2 0.04908738521234052 MOMIN3 0.04908738521234052 -------------------------------------------------------------DNODE-NODE TOPOLOGY -NODE 1 DNODE 1 -NODE 5 DNODE 2 +NODE 5 DNODE 1 +NODE 1 DNODE 2 -------------------------------------------------------------DLINE-NODE TOPOLOGY NODE 1 DLINE 1 NODE 2 DLINE 1 From 3243610c42814b552d0a18b014bf3358beb18062 Mon Sep 17 00:00:00 2001 From: Ivo Steinbrecher Date: Wed, 24 Apr 2024 15:53:20 +0200 Subject: [PATCH 8/8] Improve roboustness in automatic orientation detection in create_beam_mesh_line --- meshpy/mesh_creation_functions/beam_basic_geometry.py | 5 ++++- ..._mesh_creation_functions_helix_no_rotation_reference.dat | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/meshpy/mesh_creation_functions/beam_basic_geometry.py b/meshpy/mesh_creation_functions/beam_basic_geometry.py index 29a5c11d..8a1ac7fb 100644 --- a/meshpy/mesh_creation_functions/beam_basic_geometry.py +++ b/meshpy/mesh_creation_functions/beam_basic_geometry.py @@ -92,7 +92,10 @@ def create_beam_mesh_line( t1 = direction / line_length # Check if the z or y axis are larger projected onto the direction. - if abs(np.dot(t1, [0, 0, 1])) < abs(np.dot(t1, [0, 1, 0])): + # The tolerance is used here to ensure that round-off changes in the last digits of + # the floating point values don't switch the case. This increases the robustness in + # testing. + if abs(np.dot(t1, [0, 0, 1])) < abs(np.dot(t1, [0, 1, 0])) - mpy.eps_quaternion: t2 = [0, 0, 1] else: t2 = [0, 1, 0] diff --git a/tests/reference-files/test_mesh_creation_functions_helix_no_rotation_reference.dat b/tests/reference-files/test_mesh_creation_functions_helix_no_rotation_reference.dat index 9d50b889..0596b197 100644 --- a/tests/reference-files/test_mesh_creation_functions_helix_no_rotation_reference.dat +++ b/tests/reference-files/test_mesh_creation_functions_helix_no_rotation_reference.dat @@ -28,8 +28,8 @@ NODE 5 COORD -1.96334800942 -0.381135925751 6.66666666667 NODE 6 COORD -1.03807125077 -1.70950521448 8.33333333333 NODE 7 COORD 0.567324370926 -1.91784854933 10 --------------------------------------------------------------STRUCTURE ELEMENTS -1 BEAM3R HERM2LINE3 1 3 2 MAT 1 TRIADS 1.75998840379 0.729011066468 1.75998840379 -0.633874850223 -1.76514699225 -1.69636461303 -1.51638250626 -1.59087011094 -2.19715939648 -2 BEAM3R HERM2LINE3 3 5 4 MAT 1 TRIADS -0.633874850223 -1.76514699225 -1.69636461303 0.746212769126 -1.40383785444 -0.465011157306 0.121031100845 -1.68035914483 -1.10261143399 -3 BEAM3R HERM2LINE3 5 7 6 MAT 1 TRIADS 0.746212769126 -1.40383785444 -0.465011157306 1.58368887616 -0.402516203743 0.835215206421 1.23796977269 -0.971871890386 0.188159617035 +1 BEAM3R HERM2LINE3 1 3 2 MAT 1 TRIADS -0.613943125569 -1.48218982027 0.613943125569 0.825845001377 -1.75132059139 1.82233126689 0.0412003090647 -1.71867210284 1.24441771648 +2 BEAM3R HERM2LINE3 3 5 4 MAT 1 TRIADS 0.825845001377 -1.75132059139 1.82233126689 -1.76693362712 0.540443031687 -1.63156168219 -1.62734522345 1.40867035905 -2.14678720617 +3 BEAM3R HERM2LINE3 5 7 6 MAT 1 TRIADS -1.76693362712 0.540443031687 -1.63156168219 -1.36158461459 -0.809718268376 -0.390228435716 -1.6574070681 -0.199576520935 -1.03084186572 ------------------------------------------------------------------FLUID ELEMENTS -----------------------------------------------------------------------------END