|
| 1 | +.. _ref_index_IGA: |
| 2 | + |
| 3 | +********************* |
| 4 | +Isogeometric analysis |
| 5 | +********************* |
| 6 | + |
| 7 | + *This is a Beta feature. API Behavior and Implementation may change in future.* |
| 8 | + |
| 9 | +Isogeometric Analysis (IGA) is a new approach using NURBS to capture the CAD geometry accurately than the FE analysis. |
| 10 | +The FE analysis discretize the CAD geometry approximately into smaller elements to capture the features. |
| 11 | +This approximation may affect the accuracy of the result and increase the computational cost. |
| 12 | +IGA uses spline to exactly represent the CAD geometry to analyse the geometry and solver solves on the splines. |
| 13 | + |
| 14 | +In PyPrimeMesh, IGA-Quad to Spline allows you to extract control points and splines based on the input quadrilateral surface mesh and export it as LS-DYNA IGA K file for the IGA solver. |
| 15 | + |
| 16 | +The prerequisites required for preparing Input CAD Model for Quad to Spline conversion: |
| 17 | + |
| 18 | +* Clean up the input geometry in PyPrimeMesh. |
| 19 | + |
| 20 | +* Generates full quad mesh on the input geometry. |
| 21 | + |
| 22 | +* Perform mesh edit operations to reduce the triangles. |
| 23 | + |
| 24 | +IGA Quad to Spline performs the following: |
| 25 | + |
| 26 | +1. Execute quad to spline operation using any of the following options: |
| 27 | + |
| 28 | + - When you provide Ignore Features, ignores all the features while converting the input geometry to spline. |
| 29 | + - When you provide Use Angle, captures the provided angle while creating the spline for the input geometry. |
| 30 | + - When you provide Use Edges, uses the provided edges while creating spline for the input geometry. |
| 31 | + |
| 32 | +2. Checks if any Negative Jacobian values are present while creating splines. |
| 33 | + |
| 34 | +3. Export Splines as LS-DYNA IGA K file if no Negative Jacobian values are present in the input geometry. |
| 35 | + |
| 36 | +4. Provides the file to the LS-DYNA IGA solver. |
| 37 | + |
| 38 | + |
| 39 | +The below example shows IGA Quad to spline conversion: |
| 40 | + |
| 41 | +1. Import the geometry. |
| 42 | + |
| 43 | +.. code-block:: python |
| 44 | +
|
| 45 | + file_io = prime.FileIO(model) |
| 46 | + res = file_io.read_pmdat(r"pillar.pmdat", prime.FileReadParams(model=model)) |
| 47 | + g = Graphics(model) |
| 48 | + g() |
| 49 | +
|
| 50 | +.. figure:: ../images/model_iga.png |
| 51 | + |
| 52 | +2. Check whether the model is a topology or mesh part. |
| 53 | + |
| 54 | +.. code-block:: python |
| 55 | +
|
| 56 | + cad_mesh_part = model.parts |
| 57 | + for part in cad_mesh_part: |
| 58 | + if part.get_topo_faces(): |
| 59 | + geom_part_name = part.name |
| 60 | + print(geom_part_name) |
| 61 | + summary_res = part.get_summary( |
| 62 | + prime.PartSummaryParams( |
| 63 | + model=model, |
| 64 | + print_id=False, |
| 65 | + print_mesh=True, |
| 66 | + ) |
| 67 | + ) |
| 68 | + print("Geometry Part") |
| 69 | + else: |
| 70 | + mesh_part_name = part.name |
| 71 | + print(mesh_part_name) |
| 72 | + summary_res = part.get_summary( |
| 73 | + prime.PartSummaryParams( |
| 74 | + model=model, |
| 75 | + print_id=False, |
| 76 | + print_mesh=True, |
| 77 | + ) |
| 78 | + ) |
| 79 | + print("Mesh Part") |
| 80 | +
|
| 81 | +**Output:** |
| 82 | + |
| 83 | +.. code-block:: pycon |
| 84 | + |
| 85 | + Geometry Part |
| 86 | +
|
| 87 | +3. Define the input scope for the geometry or mesh part. |
| 88 | + |
| 89 | +.. code-block:: python |
| 90 | +
|
| 91 | + input_scope = prime.ScopeDefinition(model, part_expression=mesh_part.name) |
| 92 | + geom_topofaces = geom_part.get_topo_faces() |
| 93 | + geom_topoedges = geom_part.get_topo_edges() |
| 94 | +
|
| 95 | +4. Initialize QuadToSpline and provide the required parameters in QuadToSplineParams to perform the quad to spline conversion. |
| 96 | + |
| 97 | +.. code-block:: python |
| 98 | +
|
| 99 | + zone_name_1 = "zone1_thk_0.8" |
| 100 | + zone_name_2 = "zone2_thk_1.0" |
| 101 | + zone_name_3 = "zone3_thk_1.2" |
| 102 | + shell_thickness_zone_1 = 0.8 |
| 103 | + shell_thickness_zone_2 = 1.0 |
| 104 | + shell_thickness_zone_3 = 1.2 |
| 105 | + QuadToSpline = prime.QuadToSpline(model) |
| 106 | + quad_to_spline_params = prime.QuadToSplineParams(model) |
| 107 | + quad_to_spline_params.feature_capture_type = prime.SplineFeatureCaptureType.BYANGLE |
| 108 | + quad_to_spline_params.corner_angle = 40 |
| 109 | + quad_to_spline_params.project_on_geometry = False |
| 110 | + quad_to_spline_params.separate_by_zone = True |
| 111 | + quad_to_spline_params.zone_name_shell_thickness_pairs = { |
| 112 | + zone_name_1: shell_thickness_zone_1, |
| 113 | + zone_name_2: shell_thickness_zone_2, |
| 114 | + zone_name_3: shell_thickness_zone_3, |
| 115 | + } |
| 116 | + unstructured_spline_fitting = QuadToSpline.convert_quad_to_spline( |
| 117 | + input_scope, quad_to_spline_params |
| 118 | + ) |
| 119 | + print("Quad to Spline fitting status: ", unstructured_spline_fitting) |
| 120 | +
|
| 121 | +**Output:** |
| 122 | + |
| 123 | +.. code-block:: pycon |
| 124 | +
|
| 125 | + This API convert_quad_to_spline is a Beta. API Behavior and implementation may change in future. |
| 126 | + Quad to Spline fitting status: error_code : ErrorCode.NOERROR |
| 127 | + warning_code : WarningCode.NOWARNING |
| 128 | + spline_ids : [] |
| 129 | +
|
| 130 | +5. Get the unstructured spline created. |
| 131 | + |
| 132 | +.. code-block:: python |
| 133 | +
|
| 134 | + spline1 = unstructured_spline_fitting.spline_ids |
| 135 | + unstructured_spline_surface = mesh_part.get_unstructured_spline_surface() |
| 136 | + print(unstructured_spline_surface) |
| 137 | +
|
| 138 | +**Output:** |
| 139 | + |
| 140 | +.. code-block:: pycon |
| 141 | +
|
| 142 | + This API get_unstructured_spline_surface is a Beta. API Behavior and implementation may change in future. |
| 143 | + id : 2 |
| 144 | + spline_refinement_level : 5 |
| 145 | + control_points : [-60.7216 -0.598581 428.905 ... -47.2185 87.6738 23.852 ] |
| 146 | + spline_points : [-60.6697 -0.566523 428.971 ... -47.0478 9.97661 58.3805 ] |
| 147 | + bad_spline_points_indices : [] |
| 148 | + deviation_array : [0.00214125 0.0150002 0.017894 ... 0.00113307 0.0106386 0.0104887 ] |
| 149 | + invalid_jacobian_elements_count : 0 |
| 150 | + average_mesh_size : 4.21427 |
| 151 | + elements_count : 2194 |
| 152 | + shell_thickness : 0.0001 |
| 153 | +
|
| 154 | +6. Check the quality of the created spline. |
| 155 | + |
| 156 | +.. code-block:: python |
| 157 | +
|
| 158 | + negative_jacobian = unstructured_spline_surface.invalid_jacobian_elements_count |
| 159 | + deviation_array = unstructured_spline_surface.deviation_array |
| 160 | + max_abs_deviation = max(deviation_array) |
| 161 | + control_points_count = len(unstructured_spline_surface.control_points) / 3 |
| 162 | + spline_points_count = len(unstructured_spline_surface.spline_points) / 3 |
| 163 | + print("Invalid/Negative Jacobian count: ", negative_jacobian) |
| 164 | + print("Control points count: ", control_points_count) |
| 165 | + print("Spline points count: ", spline_points_count) |
| 166 | + print("Max Deviation: ", max_abs_deviation) |
| 167 | +
|
| 168 | +**Output:** |
| 169 | + |
| 170 | +.. code-block:: pycon |
| 171 | +
|
| 172 | + Invalid/Negative Jacobian count: 0 |
| 173 | + Control points count: 5585.0 |
| 174 | + Spline points count: 78984.0 |
| 175 | + Max Deviation: 1.27418 |
| 176 | +
|
| 177 | +7. Write the created .k file to the specified location and export to LS-DYNA. |
| 178 | + |
| 179 | +.. code-block:: python |
| 180 | +
|
| 181 | + lsdyna_iga_export_result = prime.FileIO(model).export_lsdyna_iga_keyword_file( |
| 182 | + r"E:\Test\newspline.k", prime.ExportLSDynaIgaKeywordFileParams(model) |
| 183 | + ) |
0 commit comments