Creating StructureGene from Custom Mesh Data#
This guide explains how to create a StructureGene object from your own mesh data when your format is not directly supported by sgio.
Note
If you just want to get started quickly, skip to Quick Start: Simple Triangle Mesh.
Overview#
When you have mesh data from custom software or proprietary formats that you want to analyze with VABS or SwiftComp, you need to:
Create a StructureGene object with basic configuration (name, dimensions)
Build the mesh with nodes, elements, and connectivity
Define materials and their properties
Assign materials to elements using property IDs and mocombos
Write to VABS/SwiftComp format
What You Need#
- Required Data:
Nodal coordinates (x, y, z for each node)
Element connectivity (which nodes form each element)
Element types (triangle, quad, tetrahedron, etc.)
Material properties (elastic moduli, density, etc.)
- Optional Data:
Original node/element IDs (to preserve your numbering)
Material orientations (for composites)
Node/element sets (for boundary conditions)
Guide Contents#
Quick Links#
New to sgio? Start with Quick Start: Simple Triangle Mesh
Need data structure details? See Data Structure Reference
Converting from existing format? See Converting from Custom Format
Having problems? Check Troubleshooting Common Issues
Key Concepts#
- StructureGene
The main container for your mesh and material data. Think of it as your complete finite element model ready for homogenization analysis.
- Mesh (using meshio format)
Contains nodes (points), elements (cells), and associated data. Uses 0-based indexing for connectivity.
- Materials
Stored by name in a dictionary. Can be isotropic, transversely isotropic, or orthotropic.
- Mocombos (Material-Orientation Combinations)
Maps property IDs to (material_name, orientation_angle) pairs. This allows using the same material at different angles.
- Property IDs
Integer IDs assigned to each element that reference a mocombo, which then references a material and orientation.
Workflow Diagram#
Your Mesh Data
|
v
Parse nodes, elements, materials
|
v
Create StructureGene
|
+-- Set dimensions (sgdim, smdim)
+-- Add materials to sg.materials{}
+-- Create mocombos mapping
+-- Build mesh with 0-based connectivity
|
v
Write to VABS/SwiftComp
|
v
Run homogenization analysis
Next Steps#
Quickstart: Quick Start: Simple Triangle Mesh - Simple working example
Details: Data Structure Reference - Complete data structure reference
Advanced: Converting from Custom Format - Full conversion example with validation