Convert a Gmsh Laminate Bundle to VABS#

Problem Description#

Convert an external Gmsh section mesh of a thin composite ply into a VABS input file.

This is the orthotropic counterpart of Convert a Gmsh Bundle to VABS. That example carries a single isotropic material, so its mesh needs neither a per-element local coordinate system nor a fiber rotation. A real composite layer needs both:

  • element_local_csys — the local material frame on each element, used by VABS to compute the per-element theta_1 (layer plane angle).

  • additional_rotation_2 — a per-element scalar that, for a Gmsh section in the xy plane, maps to the layer-level VABS theta_3 (fiber direction angle).

Solution#

The bundle consists of:

  • laminate_simple.msh — a single curved ply meshed in the Gmsh xy plane, carrying $ElementData "element_local_csys" (the per-element material frame) and $ElementData "additional_rotation_2" (30° fiber rotation on every element).

  • sections.json — one orthotropic carbon-fiber material mat_1, bound to the ply physical group by its label / id.

  • config.json — Euler-Bernoulli homogenization setup (model = 1).

import logging
from pathlib import Path

import sgio

logging.basicConfig(level=logging.INFO)
cwd = Path(__file__).resolve().parent

main_msh = cwd / 'laminate_simple.msh'
sections_json = cwd / 'sections.json'
config_json = cwd / 'config.json'
output_file = cwd / 'laminate_simple.sg'

sg = sgio.read_sg_from_gmsh_bundle(
    main_msh=main_msh,
    sections_json=sections_json,
    config_json=config_json,
    model_type='BM1',
)

print(sg)

# Gmsh section lives in the xy plane, so the writer projects:
#   gmsh x -> VABS x2
#   gmsh y -> VABS x3
# With model_space='xy', the writer also picks ``additional_rotation_2`` from
# the mesh cell data as the per-layer VABS ``theta_3`` (fiber angle).
sgio.write(
    sg=sg,
    filename=str(output_file),
    file_format='vabs',
    model_type='BM1',
    model_space='xy',
)

sgio.read_sg_from_gmsh_bundle() reads the bundle, and sgio.write() emits VABS input with model_space='xy'. The writer then:

  1. Projects nodes from the Gmsh xy plane onto the VABS yz plane (gmsh_x x2, gmsh_y x3, VABS x1 = 0).

  2. Picks additional_rotation_2 from cell_data as the per-layer theta_3. The mapping depends on model_space: xy rotation_2, yz rotation_3, zx rotation_1. All elements sharing one property_id must carry the same rotation value, since VABS allows only one theta_3 per layer.

  3. Translates element_local_csys into the per-element theta_1 column of the VABS property block.

Result#

laminate_simple.sg is written, ready for VABS. Its single layer points at material mat_1 with theta_3 = 30°.

uv run python examples/convert_gmsh_laminate_to_vabs/run.py

File List#