Skip to content
gmsh-meshing logo

GMSH Meshing Skill

gmsh-meshing

Specialized AI agent for finite element mesh generation and manipulation

SKILL.md

Full skill instructions

GMSH Meshing Skill

Specialized expertise for finite element mesh generation and manipulation using GMSH with quality assessment and engineering tool integration.

Version Metadata

version: 1.0.0
python_min_version: '3.10'
compatibility:
  tested_python:
  - '3.10'
  - '3.11'
  - '3.12'
  - '3.13'
  os:
  - Windows
  - Linux
  - macOS

Changelog

[1.0.0] - 2026-01-07

Added:

  • Initial version metadata and dependency management
  • Semantic versioning support
  • Compatibility information for Python 3.10-3.13

Changed:

  • Enhanced skill documentation structure

When to Use

  • 1D/​2D/​3D mesh generation for analysis
  • Geometry import and healing (STEP, IGES, STL)
  • Mesh quality assessment and optimization
  • Panel mesh generation for hydrodynamics
  • Structural mesh for FEM analysis
  • Mooring line discretization
  • Batch mesh processing
  • Integration with OrcaFlex, ANSYS, OpenFOAM

Agent Capabilities

This skill integrates agent capabilities from /​agents/​gmsh/:

Mesh Generation

DimensionElement Types
1DBeam, line, curve
2DTriangle, quadrilateral, mixed
3DTetrahedron, hexahedron, prism, pyramid, mixed

Geometry Formats

ImportExport
STEP, IGES, STL, BREP, GEOMSH, VTK, CGNS, MED, INP, CDB, STL

Quality Metrics

MetricDescriptionGood RangeCritical
JacobianElement distortion> 0.3< 0.1
Aspect RatioElement shape< 5.0> 10.0
SkewnessElement skew< 0.7> 0.9
OrthogonalityAngle quality> 0.3< 0.1

Optimization Methods

  • Laplacian smoothing
  • Adaptive refinement
  • Remeshing
  • Parallel optimization (up to 100 iterations)

Prerequisites

  • Python 3.10+
  • GMSH Python bindings (pip install gmsh)
  • NumPy, SciPy, PyVista

Configuration

Default Settings

{
  "configuration": {
    "default_algorithm": "frontal-delaunay",
    "default_element_size": 1.0,
    "quality_thresholds": {
      "min_jacobian": 0.3,
      "max_aspect_ratio": 5.0,
      "max_skewness": 0.7
    },
    "performance": {
      "parallel_workers": 4,
      "chunk_size": 1000,
      "memory_limit_gb": 4
    }
  }
}

Python API

Basic Mesh Generation

from digitalmodel.agents.gmsh import GMSHAgent

# Initialize agent
agent = GMSHAgent(config="agent_config.json")

# Generate mesh from geometry
mesh = agent.generate_mesh(
    geometry="platform.step",
    config={
        "algorithm": "frontal-delaunay",
        "element_size": 0.5,
        "element_type": "tetrahedron"
    }
)

# Save mesh
agent.save_mesh(mesh, "platform.msh")

Quality Assessment

# Assess mesh quality
quality = agent.assess_quality(mesh)

print(f"Elements: {quality['element_count']}")
print(f"Min Jacobian: {quality['min_jacobian']:.3f}")
print(f"Avg Aspect Ratio: {quality['avg_aspect_ratio']:.2f}")
print(f"Max Skewness: {quality['max_skewness']:.3f}")

# Check if optimization needed
if quality['min_jacobian'] < 0.3:
    print("Mesh requires optimization")

Mesh Optimization

# Optimize poor quality mesh
optimized = agent.optimize_mesh(
    mesh,
    method="laplacian_smoothing",
    iterations=10,
    quality_targets={
        "min_jacobian": 0.4,
        "max_aspect_ratio": 3.0
    }
)

# Verify improvement
quality_after = agent.assess_quality(optimized)
print(f"Jacobian improved: {quality['min_jacobian']:.3f} -> {quality_after['min_jacobian']:.3f}")

Panel Mesh for Hydrodynamics

# Generate panel mesh for OrcaFlex/​OrcaWave
panel_mesh = agent.generate_panel_mesh(
    geometry="hull.step",
    panel_size=2.0,
    refinement_zones=["waterline", "appendages"]
)

# Export to OrcaFlex format
agent.export_to_orcaflex(panel_mesh, "hull_panels.dat")

Structural Mesh for ANSYS

# Generate structural mesh with boundary layers
struct_mesh = agent.generate_mesh(
    geometry="structure.step",
    element_type="hexahedron",
    boundary_layers={
        "walls": {"layers": 5, "growth_rate": 1.2}
    }
)

# Export to ANSYS with named selections
agent.export_to_ansys(
    struct_mesh,
    output="model.cdb",
    named_selections=["inlet", "outlet", "walls"]
)

Batch Processing

from digitalmodel.agents.gmsh.batch import GMSHBatch

# Initialize batch processor
batch = GMSHBatch(parallel=True, max_workers=4)

# Process multiple geometries
results = batch.process_directory(
    input_directory="./​geometries",
    output_directory="./​meshes",
    config={
        "algorithm": "frontal-delaunay",
        "element_size": {
            "min": 0.1,
            "max": 1.0
        },
        "quality_targets": {
            "min_jacobian": 0.4,
            "max_aspect_ratio": 4.0
        }
    }
)

# Generate quality report
batch.generate_report(results, "mesh_quality_report.html")

Command Line Interface

# Generate mesh from geometry
python run_gmsh_agent.py generate \
    --input geometry.step \
    --output mesh.msh \
    --element-size 0.5

# Batch processing
python run_gmsh_agent.py batch \
    --input-directory ./​geometries \
    --output-directory ./​meshes \
    --config batch_config.yml \
    --parallel 4

# Quality assessment
python run_gmsh_agent.py assess \
    --mesh mesh.msh \
    --report quality_report.html

# Mesh optimization
python run_gmsh_agent.py optimize \
    --input mesh.msh \
    --output optimized.msh \
    --method laplacian \
    --iterations 10

Integration Examples

OrcaFlex Integration

# Panel mesh for hydrodynamic analysis
panel_mesh = agent.generate_panel_mesh(
    geometry="hull.step",
    panel_size=2.0,
    refinement_zones=["waterline", "appendages"]
)

# Mooring line discretization
mooring_mesh = agent.discretize_mooring(
    length=800.0,
    segments=50,
    target_element_length=16.0
)

# Export to OrcaFlex
agent.export_to_orcaflex(panel_mesh, "hull_panels.dat")

ANSYS Integration

# Structural mesh with named selections
agent.export_to_ansys(
    mesh,
    output="model.cdb",
    format="CDB",
    boundary_conditions=True,
    named_selections=["fixed", "load", "contact"]
)

# Alternative INP format
agent.export_to_ansys(mesh, output="model.inp", format="INP")

Templates

Pre-configured mesh templates:

  • offshore_platform.geo - Platform mesh template
  • mooring_line.geo - Mooring discretization
  • seabed_terrain.geo - Seabed mesh

MCP Tool Integration

Swarm Coordination

// Initialize meshing swarm
mcp__claude-flow__swarm_init { topology: "ring", maxAgents: 4 }

// Spawn specialized agents
mcp__claude-flow__agent_spawn { type: "code-analyzer", name: "mesh-generator" }
mcp__claude-flow__agent_spawn { type: "reviewer", name: "quality-checker" }

Memory Coordination

// Store mesh configuration
mcp__claude-flow__memory_usage {
  action: "store",
  key: "gmsh/​mesh/​config",
  namespace: "meshing",
  value: JSON.stringify({
    geometry: "hull.step",
    elements: 50000,
    quality: "verified"
  })
}

// Share mesh status with analysis agents
mcp__claude-flow__memory_usage {
  action: "store",
  key: "gmsh/​mesh/​ready",
  namespace: "shared",
  value: JSON.stringify({
    file: "hull_panels.dat",
    for_tool: "orcaflex",
    panels: 5000
  })
}

Performance

OperationMetric
Mesh Generation>100K elements/​second
Quality Assessment<1 second for 1M elements
Optimization~10 seconds per iteration for 100K elements
Batch ProcessingLinear scaling with CPU cores

Standard Workflows

Standard Meshing Workflow

  1. Import geometry
  2. Heal geometry defects
  3. Generate mesh
  4. Assess quality
  5. Optimize if needed
  6. Export to desired format

Batch Processing Workflow

  1. Configure batch settings
  2. Process files in parallel
  3. Generate quality reports
  4. Optimize poor meshes
  5. Export all results

Error Handling

Memory Issues with Large Meshes

# Use chunked processing
agent = GMSHAgent(config={
    "performance": {
        "chunk_size": 10000,
        "memory_limit_gb": 2
    }
})

Poor Quality Meshes

# Increase optimization iterations
optimized = agent.optimize_mesh(
    mesh,
    method="remeshing",
    iterations=20,
    quality_targets={
        "min_jacobian": 0.4,
        "max_aspect_ratio": 3.0
    }
)

Related Skills

References


Version History

  • 1.0.0 (2025-01-02): Initial release from agents/​gmsh/ configuration

More Productivity & Planning skills

brainstorming logo
Productivity & Planning

brainstorming

Structured design dialogue that validates ideas before implementation begins.

295.4K 385.7K
View
ui-ux-pro-max logo
Productivity & Planning

ui-ux-pro-max

Comprehensive design intelligence for web and mobile UI/UX across 10 technology stacks.

133.1K 383.9K
View
writing-plans logo
Productivity & Planning

writing-plans

Comprehensive implementation plans for multi-step tasks, breaking down specs into bite-sized, testable steps.

295.4K 268K
View
using-superpowers logo
Productivity & Planning

using-superpowers

Introduction to the obra skills system with mandatory skill invocation rules and best practices.

295.4K 259.8K
View
executing-plans logo
Productivity & Planning

executing-plans

Execute a written implementation plan with critical review and task checkpoints.

295.4K 229.1K
View
dispatching-parallel-agents logo
Productivity & Planning

dispatching-parallel-agents

Delegate independent tasks to specialized agents working concurrently with isolated context.

295.4K 206.3K
View
using-git-worktrees logo
Productivity & Planning

using-git-worktrees

Isolated git worktrees with smart directory selection and safety verification.

295.4K 205.2K
View
webapp-testing logo
Productivity & Planning

webapp-testing

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

179.7K 170.6K
View
content-strategy logo
Productivity & Planning

content-strategy

Plan searchable and shareable content that drives traffic, builds authority, and generates leads.

53.3K 150.9K
View
repo-intake-and-plan logo
Productivity & Planning

repo-intake-and-plan

README-first repository scanner that extracts commands and classifies reproduction candidates without executing them.

497 139.6K
View
marketing-ideas logo
Productivity & Planning

marketing-ideas

Brainstorm and prioritize marketing strategies tailored to your SaaS stage, budget, and goals.

53.3K 137.2K
View
site-architecture logo
Productivity & Planning

site-architecture

Plan and optimize your website's page hierarchy, navigation, URL structure, and internal linking.

53.3K 112.8K
View

Productivity AI tools

Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View
SaveDay logo
Productivity

SaveDay

Capture, organize, and utilize your knowledge effortlessly.

Free
View
Any Summary logo
Productivity

Any Summary

Instant Summaries of Audio & Video Interviews with AnySummary

Freemium
View
M
Productivity

Map This

Transform PDFs into engaging mind maps.

Freemium
View
ChatPDF logo
Productivity

ChatPDF

Chat with any PDF instantly

Free
View
I
Productivity

intellisay

Create an optimal daily plan using your voice

Paid
View
A
Productivity

Aurora AI

A productivity platform to centralize organizational knowledge and workflows with contextual AI assistance.

Paid
View
AskYourPDF logo
Productivity

AskYourPDF

AskYourPDF Pricing Plans: Tailored to Your Needs

Free
View