gmsh
- Repo stars 11
- License MIT
- Author updated Live
- Author repo digitalmodel
- Domain
- Engineering
- Compatible agents
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- Trust score
- 98 / 100 · audit passed
- Author / version / license
- @vamseeachanta · v1.0.0 · MIT
- Token usage
- Lean
- Setup complexity
- Guided setup
- External API key
- Not required
- Operating systems
- Unspecified (assume cross-platform)
- Runtime requirements
- Python >=3.10
- Permissions
-
- Read-only
- Write / modify
- Network behavior
- Local-only
- Install commands
- 26 variants
Profile is derived at build time from SKILL.md and install vectors. Subject to drift from author intent.
Heads up: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: gmsh
description: The GMSH Agent is a specialized AI module for finite element mesh generation and manipulation. I…
category: engineering
runtime: Python
---
# gmsh output preview
## PART A: Task fit
- Use case: The GMSH Agent is a specialized AI module for finite element mesh generation and manipulation. It provides automated mesh generation, quality assessment, optimization, and integration with engineer....
- Inputs: target material, constraints, expected output, and acceptance criteria.
- Evidence boundary: follow “Overview / Features / Core Capabilities” and do not present inference as author intent.
## PART B: Execution result
- **01** The card summarizes the use case; runtime output centers on “The GMSH Agent is a specialized AI module for finite element mesh generation and manipulation. It provides automated mesh generation, quality assessment, optimization, and integration with engineer...”.
- **02** When the source has headings, the agent prioritizes “Overview / Features / Core Capabilities” so the result follows the author’s structure.
- **03** Typical output includes task judgment, concrete steps, required commands or file edits, validation, and follow-up options.
- **04** Risk context follows the fingerprint: read files, write/modify files; mostly runs locally; usually needs no extra API key.
## Running Rules
- read files, write/modify files; mostly runs locally; usually needs no extra API key.
- Validate with a small sample before expanding scope.
- Return the result, validation criteria, and next iteration options. The source does not require a stable slash command. After installation, invoke the skill by name and describe the task.
Name target files or source material, expected output, forbidden changes, and whether network or shell access is allowed. Permission fingerprint: read files, write/modify files.
Start with a small task and check whether the result follows “Overview / Features / Core Capabilities”. Inspect diffs, logs, previews, or tests before expanding scope.
Confirm the final output includes a concrete result, evidence, and next action. If it stays generic, tighten inputs, boundaries, and acceptance criteria.
---
name: gmsh
description: The GMSH Agent is a specialized AI module for finite element mesh generation and manipulation. I…
category: engineering
source: vamseeachanta/digitalmodel
---
# gmsh
## When to use
- The GMSH Agent is a specialized AI module for finite element mesh generation and manipulation. It provides automated m…
- Use it when the task has clear inputs, repeatable steps, and validation criteria.
## What to provide
- Target material, scope, expected result, and forbidden changes.
- Whether network, commands, file writes, or external services are allowed.
## Execution rules
- Organize steps around “Overview / Features / Core Capabilities” and keep inference separate from source facts.
- read files, write/modify files; mostly runs locally; usually needs no extra API key.
- Validate with a small sample before expanding the task.
## Output requirements
- Return the deliverable, key evidence, validation method, and next action.
- Mark missing information as unknown; do not invent commands, platforms, or dependencies. The author source anchors workflow facts; repository files anchor sources and commands; Fluxly only adds fit, limitations, and quality judgment.
skill "gmsh" {
input -> user goal + target files + boundaries + acceptance criteria
context -> Overview / Features / Core Capabilities
rules -> SKILL.md triggers / order / output contract
runtime -> Python | read files, write/modify files | mostly runs locally
guardrails -> usually needs no extra API key + small-sample validation + diff/log review
output -> copyable result + checklist + next iteration
} Gmsh
GMSH Agent
Overview
The GMSH Agent is a specialized AI module for finite element mesh generation and manipulation. It provides automated mesh generation, quality assessment, optimization, and integration with engineering analysis tools.
Features
Core Capabilities
- 1D/2D/3D Mesh Generation: Create meshes for beams, surfaces, and volumes
- Geometry Processing: Import and heal CAD geometries (STEP, IGES, STL)
- Quality Assessment: Evaluate mesh quality with industry-standard metrics
- Mesh Optimization: Improve mesh quality through smoothing and refinement
- Batch Processing: Process multiple geometries in parallel
- Tool Integration: Export to OrcaFlex, ANSYS, and other analysis tools
Supported Formats
- Import: STEP, IGES, STL, BREP, GEO
- Export: MSH, VTK, CGNS, MED, INP, CDB, STL
Installation
Prerequisites
# Ensure Python 3.10+ is installed
python --version
# Install GMSH Python bindings
uv pip install gmsh numpy scipy pyvista pyyaml click
Setup
# Navigate to agent directory
cd agents/gmsh
# Verify installation
python run_gmsh_agent.py --version
Usage
Command Line Interface
Basic Mesh Generation
# Generate mesh from geometry
python run_gmsh_agent.py generate \
--input geometry.step \
--output mesh.msh \
--element-size 0.5
Batch Processing
# Process multiple files
python run_gmsh_agent.py batch \
--input-directory ./geometries \
--output-directory ./meshes \
--config batch_config.yml \
--parallel 4
Quality Assessment
# Assess mesh quality
python run_gmsh_agent.py assess \
--mesh mesh.msh \
--report quality_report.html
Mesh Optimization
# Optimize mesh quality
python run_gmsh_agent.py optimize \
--input mesh.msh \
--output optimized.msh \
--method laplacian \
--iterations 10
Python API
from agents.gmsh import GMSHAgent
# Initialize agent
agent = GMSHAgent(config="agent_config.json")
# Generate mesh
mesh = agent.generate_mesh(
geometry="platform.step",
config={
"algorithm": "frontal-delaunay",
"element_size": 0.5,
"element_type": "tetrahedron"
}
)
# Assess quality
quality = agent.assess_quality(mesh)
print(f"Minimum Jacobian: {quality['min_jacobian']}")
print(f"Average Aspect Ratio: {quality['avg_aspect_ratio']}")
# Optimize if needed
if quality['min_jacobian'] < 0.3:
optimized = agent.optimize_mesh(
mesh,
method="laplacian_smoothing",
iterations=10
)
# Export to ANSYS
agent.export_to_ansys(mesh, "model.cdb")
Integration Examples
OrcaFlex Integration
# Generate panel mesh for hydrodynamics
panel_mesh = agent.generate_panel_mesh(
geometry="hull.step",
panel_size=2.0,
refinement_zones=["waterline", "appendages"]
)
# Export to OrcaFlex
agent.export_to_orcaflex(panel_mesh, "hull_panels.dat")
ANSYS Integration
# Generate structural mesh
struct_mesh = agent.generate_mesh(
geometry="structure.step",
element_type="hexahedron",
boundary_layers={
"walls": {"layers": 5, "growth_rate": 1.2}
}
)
# Export with boundary conditions
agent.export_to_ansys(
struct_mesh,
output="model.cdb",
named_selections=["inlet", "outlet", "walls"]
)
Configuration
Agent Configuration (agent_config.json)
{
"configuration": {
"default_algorithm": "frontal-delaunay",
"default_element_size": 1.0,
"quality_thresholds": {
"min_jacobian": 0.3,
"max_aspect_ratio": 5.0
},
"performance": {
"parallel_workers": 4,
"memory_limit_gb": 4
}
}
}
Batch Configuration (batch_config.yml)
mesh_generation:
algorithm: frontal-delaunay
element_size:
min: 0.1
max: 1.0
quality_targets:
min_jacobian: 0.4
max_aspect_ratio: 4.0
optimization:
enabled: true
method: laplacian_smoothing
iterations: 10
export:
formats: [msh, vtk]
directory: ./output
Workflows
Standard Meshing Workflow
- Import geometry
- Heal geometry defects
- Generate mesh
- Assess quality
- Optimize if needed
- Export to desired format
Batch Processing Workflow
- Configure batch settings
- Process files in parallel
- Generate quality reports
- Optimize poor meshes
- Export all results
Quality Metrics
| Metric | Description | Good Range | Critical |
|---|---|---|---|
| Jacobian | Element distortion | > 0.3 | < 0.1 |
| Aspect Ratio | Element shape | < 5.0 | > 10.0 |
| Skewness | Element skew | < 0.7 | > 0.9 |
| Orthogonality | Angle quality | > 0.3 | < 0.1 |
Performance
- Mesh Generation: >100K elements/second
- Quality Assessment: <1 second for 1M elements
- Optimization: ~10 seconds per iteration for 100K elements
- Batch Processing: Linear scaling with CPU cores
Troubleshooting
Common Issues
GMSH Not Found
# Install GMSH Python bindings
pip install gmsh
# Verify installation
python -c "import gmsh; print(gmsh.version())"
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
}
)
Development
Running Tests
# Run unit tests
pytest tests/unit/
# Run integration tests
pytest tests/integration/
# Run with coverage
pytest --cov=agents.gmsh tests/
Contributing
- Follow repository coding standards
- Add tests for new features
- Update documentation
- Submit PR with detailed description
Support
Documentation
Contact
- GitHub Issues: Create Issue
- Email: support@digitalmodel.com
License
This agent is part of the DigitalModel repository and follows the same licensing terms.
Changelog
Version 1.0.0 (2024-12-24)
- Initial release
- Core mesh generation functionality
- Quality assessment and optimization
- OrcaFlex and ANSYS integration
- Batch processing support
GMSH Agent - Automated Finite Element Mesh Generation
Source: templates/README.md
GMSH Agent Geometry Templates
This directory contains parametric geometry templates for common offshore engineering structures and features.
Available Templates
1. Offshore Platform (offshore_platform.geo)
Parametric model for typical offshore platform structures including:
- Configurable deck dimensions and elevation
- Variable number of jacket legs (4, 6, 8)
- Automatic bracing generation with X-bracing
- Helideck with configurable radius
- Pile foundations with mudline penetration
- Adaptive mesh refinement near structural members
Key Parameters:
- Platform dimensions (length, width, height)
- Water depth and mudline penetration
- Number of legs and spacing
- Helideck configuration
- Mesh density control
2. Mooring Line (mooring_line.geo)
Parametric catenary mooring line model featuring:
- Chain-wire-chain configuration
- Catenary shape calculation
- Touchdown point modeling
- Seabed interaction zone
- Optional buoyancy modules
- Detailed chain link geometry (for small models)
Key Parameters:
- Total line length and segment lengths
- Fairlead and anchor positions
- Line properties (diameter, weight)
- Pretension and catenary parameters
- Number of discretization segments
3. Seabed Terrain (seabed_terrain.geo)
Parametric seabed terrain with multiple features:
- General slope with configurable gradient
- Valley features with adjustable dimensions
- Mounds and hills
- Scour pits around structures
- Sand ridges and ripples
- Multiple sediment layers
Key Parameters:
- Domain dimensions
- Terrain feature toggles (slope, valley, mound, etc.)
- Feature dimensions and positions
- Grid resolution
- Sediment layer configuration
Usage
Direct GMSH Usage
# Open template in GMSH GUI
gmsh offshore_platform.geo
# Generate mesh from command line
gmsh offshore_platform.geo -3 -o platform.msh
Python API Usage
from agents.gmsh.utilities.template_manager import TemplateManager
# Initialize manager
manager = TemplateManager()
# List available templates
templates = manager.list_templates()
# Generate geometry with custom parameters
params = {
'deck_length': 50.0,
'water_depth': 150.0,
'num_legs': 6
}
geo_file = manager.generate_geometry('offshore_platform', params)
# Create parameter study
param_ranges = {
'water_depth': [100, 150, 200],
'num_legs': [4, 6, 8]
}
files = manager.create_parameter_study('offshore_platform', param_ranges)
CLI Usage
# Generate geometry from template
python -m agents.gmsh generate --template offshore_platform --param water_depth=150
# Run parameter study
python -m agents.gmsh parameter-study --template mooring_line \
--vary total_length=1000,1500,2000 --vary pretension=300,500,700
Parameter Customization
All templates use GMSH's DefineNumber syntax for parameters, allowing:
- Interactive modification in GMSH GUI
- Command-line parameter override
- Programmatic control via API
- Parameter constraints (min/max values)
Example Parameter Definition
water_depth = DefineNumber[100.0, Name "Environment/Water Depth (m)"];
This creates a parameter that:
- Has default value of 100.0
- Appears in GUI under "Environment" category
- Shows units in meters
- Can be modified at runtime
Template Development
Creating New Templates
- Start with a .geo file in this directory
- Use DefineNumber for all configurable parameters
- Add descriptive comments at the top of the file
- Group parameters by category (e.g., Platform/, Environment/)
- Define physical groups for boundary conditions
- Include mesh refinement fields where appropriate
Template Structure
// Template Name and Description
// Author: Your Name
// Version: 1.0
// ============================================================================
// PARAMETERS
// ============================================================================
param1 = DefineNumber[default, Name "Category/Parameter Name (unit)"];
// ============================================================================
// GEOMETRY CREATION
// ============================================================================
// Geometry construction code
// ============================================================================
// PHYSICAL GROUPS
// ============================================================================
Physical Surface("Surface_Name") = {surface_ids[]};
// ============================================================================
// MESH FIELDS
// ============================================================================
// Mesh refinement configuration
Best Practices
- Parameter Naming: Use descriptive names with units
- Default Values: Choose reasonable defaults for typical use cases
- Validation: Include parameter constraints where applicable
- Documentation: Comment complex geometry operations
- Modularity: Break complex geometries into logical sections
- Physical Groups: Define groups for all important features
- Mesh Control: Provide appropriate mesh refinement controls
Integration with Workflows
Templates can be used in batch processing workflows:
# workflow.yml
input:
template: offshore_platform
parameter_file: platform_params.json
stages:
- name: geometry_generation
template_params:
water_depth: 150
num_legs: 6
- name: mesh_generation
mesh_size: adaptive
- name: quality_check
min_quality: 0.7
Template Validation
Validate templates before use:
# Validate template syntax and parameters
results = manager.validate_template('offshore_platform')
print(f"Valid: {results['valid']}")
print(f"Warnings: {results['warnings']}")
Export and Documentation
Generate documentation for all templates:
# Export as Markdown
manager.export_template_docs('templates.md', format='markdown')
# Export as HTML
manager.export_template_docs('templates.html', format='html')
# Export as JSON
manager.export_template_docs('templates.json', format='json')
Contributing
To contribute new templates:
- Create a .geo file following the structure above
- Test with various parameter combinations
- Add documentation to this README
- Submit with example use cases
License
These templates are part of the GMSH Agent module and follow the repository's licensing terms.
Decide Fit First
Design Intent
How To Use It
Boundaries And Review