Differences between revisions 26 and 27
Revision 26 as of 2018-05-18 19:30:42
Size: 14579
Comment:
Revision 27 as of 2018-05-22 14:05:43
Size: 5780
Comment:
Deletions are marked like this. Additions are marked like this.
Line 124: Line 124:



EVERYTHING FROM HERE DOWN CAN BE MOVED TO A DISCUSSION PAGE, IT IS NO LONGER RELEVANT TO THE CURRENT WORKFLOW


=== QUADRILATERAL MESHING ===

'''''Model components:''''' rigid bodies, shell (i.e. bone: femur, tibia, patella)

==== IA-FEMesh + rounded STL: ====

'''''Software:''''' IA-FEMesh, Version 1.0

'''''Method:''''' Quadrilateral Surface Meshing

'''''Input:''''' rounded STL triangulated surface geometry (i.e. no sharp edges in STL surface geometry)

'''''Example Files:'''''

!OpenKnee, Gen. 1 model, femoral geometry (w/o holes): [[attachment:femur.stl]],

IA-FEMesh block: [[attachment:femur_IA-FEMesh_Block.vtk]]

'''''NOTES:''''' block edges should be tangential to and circumscribed about surface geometry

'''''LIMITATION:''''' not able to control projection of block edge elements nodes to geometric edges!

 1. Run IA-FEMesh.
 1. Load surface geometry:
  * Surface tab: select "Load" from drop-down menu (e.g. femur.stl).
 1. Change surface geometry opacity:
  * Click on name of loaded surface geometry in Object Manager.
  * e.g. set Opacity to 0.5 (out of 1.0 = opaque).
 1. Create a basic block:
  * Block(s) tab: select "Create" from drop-down menu.
  * Select "Create block from surface bounds".
  * Click "Apply".
 1. Move basic block nodes to project to desire locations on surface:
  * Block(s) tab: select "Build/Edit" from drop-down menu.
  * Click hand button.
  * Iteratively refine node positions:
   * Rotate view (left mouse button outside of block geometry).
   * Move node in planes perpendicular to view.
   * Rotate view orthogonal to first view.
   * Move node to final desired location.
   * Click "Cancel" to finish.
 1. Partition block to refine block geometry to match surface geometry:
  * Block(s) tab: select "Build/Edit" from drop-down menu.
  * Iteratively partition block and edit/move newly created nodes:
   * Click "Split" button.
   * Select an edge perpendicular to desired block partitioning dimension (turns green when selected).
   * Click "Apply".
   * Iteratively move nodes (as in prior step).
  * Click "Cancel" to finish.
 1. Save block IF desired:
  * Block(s) tab: select "Save" from drop-down menu.
  * Select desired "Building Block" in drop-down menu.
  * Click "Apply".
  * Name "File name" as desired.
  * Click "Save".
 1. Assign Mesh Seeds:
  * Mesh tab: select "Assign/Edit Mesh Seeds" from drop-down menu.
  * Select "Element Length" from drop-down menu.
  * Click "Apply".
  * Iteratively refine seed sizes:
   * Select a block edge in the 3D view to refine seeding for a particular partition of the block (vectors showing partition dimension will appear, i.e. Rx (red), Ry (green), Rz (blue)).
   * Make desired partition dimension seeding either smaller or larger to decrease or increase the seed size respectively.
   * Click "Cancel" to finish.
 1. Create mesh:
  * Mesh tab: select "Create" from drop-down menu.
  * Select "Surface Mesh", select "quad" (square).
  * Specify "Node" and "Element" Label names.
  * Click "Apply".
 1. Inspect mesh quality:
  * Quality tab: select "Evaluate/Display Mesh Quality" from drop-down menu.
  * Select Metric from drop-down menu: e.g. "Jacobian"
  * Click "Cancel" to finish.
 1. Iteratively smooth mesh IF needed:
  * Quality tab: select "Mesh Improvement" from drop-down menu.
  * Set "Smoothing Iterations": e.g. 5.
  * Click "Apply".
 1. Export mesh:
  * Mesh tab: select "Export ABAQUS File" from drop-down menu.
  * Select desired "Mesh" in drop-down menu.
  * Click "Apply".
  * Name "File name" as desired.
  * Click "Save".

'''''Example file results:'''''

IA-FEMesh quad surface mesh: [[attachment:femur_IA-FEMesh_SurfMesh.vtk]]

{{attachment:femur_IA-FEMesh_Surf.png}}

{{attachment:femur_IA-FEMesh_Block.png}}

{{attachment:femur_IA-FEMesh_SurfMesh.png}}

=== HEXAHEDRAL MESHING ===

'''''Model components:''''' deformable bodies, volumetric (i.e. cartilage, ligaments, menisci)

==== IA-FEMesh + rounded STL: ====

Follow the corresponding procedure from the '''Quadrilateral Meshing''' section above, besides the following step:

 9. Create mesh:
  * Mesh tab: select "Create" from drop-down menu.
  * Select "Volumetric Mesh", select "hex" (cube).
  * Specify "Node" and "Element" Label names.
  * Click "Apply".

==== Salome Sub-Meshing + Hex-topology IGES: ====

'''''Software:''''' Salome 7.5.1

'''''Method:''''' Hexahedral Sub-Meshing (NOTE: tried Salome HEXABLOCK meshing, but face elements were twisted due to edge curvature)

'''''Input:''''' IGES parametric surface/volume geometry with hexahedral topology (i.e. 8 nodes, 12 edges, 6 faces)

'''''Example Files:'''''

!OpenKnee, Gen. 1 model, lateral tibia cartilage geometry: [[attachment:lat_tibial_cartilage.igs]],

Salome meshing script: [[attachment:lat_tibial_cartilage_Salome_HEX.py]]

 1. Run Salome.
 1. Activate "New" Geometry Module.
 1. Load IGES file:
  * File -> Import -> IGES (e.g. lat_tibial_cartilage.igs)
  * If warned to "take units in account", select "Yes".
 1. If geometry is not visible in OCC 3D scene viewer:
  * click 'Global Panning" button in OCC viewer.
 1. If 3D view manipulation shortcut + mouse button control is not working:
  * click "Rotation" button in OCC viewer and rotate view a little, then shorcut + mouse will work.
 1. To volumetrically render the geometry, select:
  * View -> Display Mode -> Shading With Edges
 1. Check geometry information:
  * Measures -> What is
  * Need to REPAIR the geometry IF:
   a. faces are not watertight
   a. it is NOT a solid.
   a. it does NOT have: 8 vertices, 12 edges, 6 wires, 6 faces.
 1. IF geometry REPAIR is needed:
  a. IF edges of faces are not watertight, SEW the geometry:
   * Repair -> Sewing
   * Select shape: loaded geometry (e.g. lat_tibial_cartilage_1)
   * Iteratively reduce the tolerance (from 1e-7) one order of magnitude at a time until geometry is valid:
    * Check "What is" geometry until the result has: 6 wires, 6 faces, 1 shell.
    * e.g. 1e-5 works with example geometry (lat_tibial_cartilage_1)
   * OUTPUT GEOMETRY NAME: Sewing_#
  a. IF geometry is NOT SOLID:
   * New Entity -> Build -> Solid
   * Select sewing: Sewing_#
   * Check "What is" geometry: 6 wires, 6 faces, 1 shell, 1 solid.
   * OUTPUT GEOMETRY NAME: Solid_1
  a. IF geometry has MORE THAN 8 vertices OR 6 edges:
   * Repair -> Remove Extra Edges
   * Select: Solid_1
   * Check "What is" geometry: 8 vertices, 12 edges, 6 wires, 6 faces, 1 shell, 1 solid.
   * OUTPUT GEOMETRY NAME: !NoExtraEdges_1
 1. Explode edges from solid geometry:
  * New Entity -> Explode
  * Select Sub-shape Types: Edge
 1. Activate the Mesh module.
 1. Create a new mesh:
  * Mesh -> Create Mesh
  * Geometry: !NoExtraEdges_1
  * Mesh type: Hexahedral
  * 3D tab:
   * Algorithm: Hexahedron (i,j,k)
  * 2D tab:
   * Algorithm: Quadrangle (Mapping)
   * Hypothesis:
    * Transition: Standard
 1. Create 3 sub-meshes for each set of 4 matching hex-mesh block dimension edges:
  * Mesh -> Create Sub-mesh
  * Name: !SubMesh_<dim> (e.g. !SubMesh_z -or- !SubMesh_3)
  * Mesh: Mesh_1
  * Geometry: interactively select 4 corresponding edges in Geometry hierarchy window
   * use Shift or Ctrl to select multiple edges at once
   * e.g. for !SubMesh_z, select: Edge_1, Edge_2, Edge_9, Edge_10
   * e.g. for !SubMesh_x, select: Edge_3, Edge_4, Edge_11, Edge_12
   * e.g. for !SubMesh_y, select: Edge_5, Edge_6, Edge_7, Edge_8
  * 1D tab:
   * Algorithm: Wire Discretisation
   * Hypothesis: Nb. Segments
    * Name: Nb. Segments_<dim> (e.g. Nb. Segments_z)
    * Number of Segments: <desired #> (e.g. z = 3, x = 50, y = 50)
    * Type of distribution: Equidistant distribution
    * NOTE: create new Hypothesis for each block dimension: x,y,z
 1. Calculate mesh:
  * Mesh -> Compute
 1. Export mesh:
  * Select mesh name in Geometry hierarchy window.
  * File -> Export -> UNV file.
  * Name "File name" as desired.
  * Click "Save".

'''''Example file results:'''''

Salome hex mesh: [[attachment:lat_tibial_cartilage_Salome_HEX.unv]]

{{attachment:lat_tibial_cartilage_Salome_HEX.png}}

==== Salome + STL: ====



----

== Output ==

 * Finite element mesh of tissue of interest; in human readable format, e.g., Abaqus input (INP) file, XML file, or as open format binary files, e.g., MED file, including
  * node definitions (numbering and coordinates)
  * element definitions (numbering, element-specific node numbers and connectivity)
  * node set definitions (set name(s) and relevant node numbers)
  * element set definitions (set name(s) and relevant element numbers)
  * face definitions (numbering, face-specific node numbers and connectivity)
  * surface set definitions (set name(s) and relevant face numbers)
more information can be found in the [[Specifications/MeshGeneration/Discussion|Discussion]] page

Target Outcome

Finite element mesh of a tissue of interest ready for model development:

  • node definitions
  • element definitions
  • node set definitions
  • element set definitions
  • surface set definitions


Prerequisites

Infrastructure

  • SALOME. SALOME is an open-source software that provides a generic platform for pre- (cad, meshing) and post-processing for numerical simulation (LGPL license, see http://www.salome-platform.org/).

  • FreeCAD. FreeCAD is an open-source three-dimensional computer aided design software (GPL and LGPL licenses, see http://www.freecadweb.org/).

  • MeshLab. MeshLab is an open-source, portable, and extensible system for the processing and editing of unstructured 3D triangular meshes (GPL license, see http://meshlab.sourceforge.net/).

  • OpenFlipper. OpenFlipper is an open-source, multi-platform application and programming framework designed for processing, modeling and rendering of geometric data (LGPL license, see http://www.openflipper.org/).

  • PyGTS. PyGTS is a Python binding for the GNU Triangulated Surface (GTS) Library to construct, manipulate, and perform computations on 3D triangulated surfaces, including boolean operations (GPL license, see http://pygts.sourceforge.net/).

  • pyFormex. pyFormex provides a wide range of operations on surface meshes, such as STLs; the software can also be used as a pre- and post-processor for Finite Element analysis programs (GPL license, see http://www.nongnu.org/pyformex).

  • IA-FEMesh. IA-FEMesh is freely available, interactive, structured hexahedral mesh generation software relying on surface projection method (BSD style license, see http://www.ccad.uiowa.edu/MIMX/projects/IA-FEMesh).

  • Blender. Blender is the free and open source 3D creation suite, which supports the entirety of the 3D pipeline, including: modeling, rigging, animation, simulation, rendering, compositing, motion tracking, video editing, and game creation. (GPL license, see https://www.blender.org/).

Previous Protocols

For more details, see Specifications/GeometryGeneration.


Protocols

Input

  • Explicit surface representation of tissue of interest; in STL format in MRI coordinate system (processed with volume preserving smoothing)


Overview

There is a script which performs the following tasks:

  1. Import surface into mesh module of SALOME
  2. Define mesh generation parameters, e.g. NETGEN 3D Parameters. (this will dictate internal mesh density)
  3. Compute the mesh.
  4. Define groups, e.g. element, node, face sets.
  5. Export mesh using the .med extention

In order to run the script:

  1. Create an xml file with connectivity between components according to these directions
  2. Run the script StlToMed.py for tetrahedral meshing of the tissues of interest in Salome.

== Creating the Connectivity File

To create the connectivity file the user should have the STLs for all the tissues that were created in the Geometry Generation step. Each part is referenced as an XML element. Within this element several child elements are needed: file, material, Tie, and Contact.

File

The path to the stl file

Material

The pre-defined materials are elastic, rigid

Tie and Contact

The Tie and Contact elements contain the parts that they are paired with as sub-elements

Definition of Tie and Contact Constraints:

  • Tie- there is no “slip” between the parts, they are “tied together”
  • Contact- the parts are touching, but they can slip/move with respect to one another.

The Tie and Contact constraints which will be used to create the node groups are defined by geometric principles relating the two tissues. The currently defined principles are:

  • Proximity – find all nodes on the paired surface within a distance related to the element size. This is the default for Tie constraints.
  • Normals – select faces that have normal vectors that point toward the barycenter of the other tissue. This can also be limited by the proximity if desired.
  • Contains – one mesh contains the other, select faces that have normal vectors that point inward or outward.
  • All – all the surfaces. This is the default for contact.

Here is an excerpt from connectivity xml file for the knee model. It includes the Femur and Fibula elements.

<Assembly>

  • <Femur>

    • <file>/path/to/file/Femur.stl</file> <material>rigid</material> <Contact>

      • <MCL/> <LCL type="normals" multiplier="5"/> <QT type="normals" multiplier = "15"/>

      </Contact> <Tie>

      • <FC/> <LCL multiplier="2"/> <ACL multiplier="0.8"/> <PCL multiplier="1"/>

      </Tie>

    </Femur> <Fibula>

    • <file>/path/to/file/Fibula.stl</file> <material>rigid</material> <Contact type="proximity"></Contact> <Tie>

      • <LCL/>

      </Tie>

    </Fibula>

</Assembly>

Scripted Procedure for Tetrahedral Meshing

This python script will read the xml file with the connectivity of several stl files in the same coordinate system. It will then mesh them in 3D, and create groups of elements and nodes for applying boundary conditions. Currently it makes groups of all, outer surface, and a proximity based tie condition. The 3D meshes are saved in MED format.

Directions for running the script

  1. Save the script (StlToMed.py) in a Folder on your computer.

  2. Link the external python packages to Salome. Add a new text file with the extension .pth to Salome's python site-packages directory. The .pth file should contain the path to the site-packages of the other python installation you wish to use.
    • There are two possible locations for Salome's python site-packages directory depending on the Salome installation method:
      1. ROOT/appli_V7_7_1/lib/python2.7/site-packages/salome.
      2. ROOT/PREREQUISITES/INSTALL/Python-2.7.10/FROM_nothing/lib/python2.7/site-packages.
    • Example: If the path to the folder containing the python script StlToMed.py is: home/user/Documents/FolderContainingScript, you will type that in a text file, and save it in Salome's Python site-packages folder with .pth extension.

  3. Save the connectivity file (NameOfConnectivityFile.xml), and tissues surfaces (Tibia.stl, Femur.stl, etc.) all in the same folder on your computer

  4. Call the script from the terminal, giving the xml file as the argument. Be sure to include the paths to the script and xml file, if you are not already in the directory containing them (or if one is in a different directory). To do this, type in the terminal:

salome /path/to/script/StlToMed.py args:/path/to/xml/NameOfConnectivityFile.xml

  • IMPORTANT NOTES: everything is case sensitive, and can be sensitive to extra spaces. For example, the script will not run properly if you type args: NameofConnectivityFile.xml instead of args:NameofConnectivityFile.xml due to the improper space after args:

Output

Template finite element mesh of all tissues of interest in MED format, including:

  • node, and node set definitions
  • element, and element set definitions
  • surface set definitions

more information can be found in the Discussion page

Specifications/MeshGeneration (last edited 2019-06-25 17:20:14 by klonowe)