Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

mesh-generation

БесплатноЗапускает вложенные скриптыНе проверен

Plan and evaluate mesh generation for numerical simulations — estimate grid resolution from physics scales (interface width, boundary layers, wavelengths)…

HeshamFSот HeshamFS★ 95 звёзд на GitHub11 установок в других каталогах

Об этом скилле

Mesh Generation

Goal

Provide a consistent workflow for selecting mesh resolution and checking mesh quality for PDE simulations.

Requirements

  • Python 3.10+
  • No external dependencies (uses stdlib)

Inputs to Gather

Input Description Example
Domain size Physical dimensions 1.0 × 1.0 m
Feature size Smallest feature to resolve 0.01 m
Points per feature Resolution requirement 10 points
Aspect ratio limit Maximum dx/dy ratio 5:1
Quality threshold Skewness limit < 0.8

Decision Guidance

Resolution Selection

What is the smallest feature size?
├── Interface width → dx ≤ width / 5
├── Boundary layer → dx ≤ layer_thickness / 10
├── Wave length → dx ≤ lambda / 20
└── Diffusion length → dx ≤ sqrt(D × dt) / 2

Mesh Type Selection

Problem Recommended Mesh
Simple geometry, uniform Structured Cartesian
Complex geometry Unstructured triangular/tetrahedral
Boundary layers Hybrid (structured near walls)
Adaptive refinement Quadtree/Octree or AMR

Script Outputs (JSON Fields)

All scripts emit a top-level object with inputs (the echoed CLI values) and results (the computed fields below). Index as result["results"]["..."].

Script results Fields
scripts/grid_sizing.py dx, counts (list of per-dimension cell counts, length == dims), notes
scripts/mesh_quality.py aspect_ratio, skewness, size_anisotropy, quality_flags, dims, notes

mesh_quality.py describes axis-aligned (orthogonal Cartesian) cells defined purely by edge spacings. For such cells every interior angle is 90°, so the true angular skewness is always 0.0 and high_skewness is never flagged. Cell elongation is reported separately via aspect_ratio and the redundant convenience field size_anisotropy (= 1 - 1/aspect_ratio).

Workflow

  1. Estimate resolution - From physics scales
  2. Compute grid sizing - Run scripts/grid_sizing.py
  3. Check quality metrics - Run scripts/mesh_quality.py
  4. Adjust if needed - Fix aspect ratios, reduce skewness
  5. Validate - Mesh convergence study

Conversational Workflow Example

User: I need to mesh a 1mm × 1mm domain for a phase-field simulation with interface width of 10 μm.

Agent workflow:

  1. Compute grid sizing:
    python3 scripts/grid_sizing.py --length 0.001 --resolution 200 --json
    
  2. Verify interface is resolved: dx = 5 μm, interface width = 10 μm → 2 points per interface width.
  3. Recommend: Increase to 500 points (dx = 2 μm) for 5 points across interface.

Pre-Mesh Checklist

  • Define target resolution per feature/interface
  • Ensure dx meets stability constraints (see numerical-stability)
  • Check aspect ratio < limit (typically 5:1)
  • Check skewness < threshold (typically 0.8)
  • Validate mesh convergence with refinement study

CLI Examples

# Compute grid sizing for 1D domain
python3 scripts/grid_sizing.py --length 1.0 --resolution 200 --json

# Check mesh quality (3D cell)
python3 scripts/mesh_quality.py --dx 1.0 --dy 0.5 --dz 0.5 --json

# High aspect ratio check (2D cell; --dz omitted is treated as 2D)
python3 scripts/mesh_quality.py --dx 1.0 --dy 0.1 --json

Error Handling

All validation errors are written to stderr and the script exits with code 2.

Error message Cause Resolution
length must be positive, got ... Non-positive domain size Use a positive value
resolution must be positive, got ... Non-positive resolution (resolution=1 is a valid single-cell mesh) Use a positive integer
dims must be one of (1, 2, 3), got ... Unsupported dimension count Use 1, 2, or 3
<name> must be a finite positive number, got ... dx/dy/dz not finite or not positive Use a finite positive value
<name> exceeds maximum (...), got ... Input above the resource-exhaustion bound Use a smaller value

Interpretation Guidance

Aspect Ratio

Aspect Ratio Quality Impact
1:1 Excellent Optimal accuracy
1:1 - 3:1 Good Acceptable
3:1 - 5:1 Fair May affect accuracy
> 5:1 Poor Solver issues likely

Skewness

Skewness is the angular deviation from the ideal cell shape (max(|90° - θ_i|) / 90° for quads/hexes — see references/quality_metrics.md). mesh_quality.py works from axis-aligned edge spacings, which describe orthogonal Cartesian cells whose interior angles are all exactly 90°; it therefore always reports skewness = 0.0 for these cells. The thresholds below apply when a genuine skewness value is obtained from real cell-corner geometry (e.g. from an unstructured mesh), not from dx/dy/dz spacings.

Skewness Quality Impact
0 - 0.25 Excellen
Полный SKILL.md на GitHub

Установить mesh-generation в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Write
Grep
Glob

Вложенные файлы

CHANGELOG.mdevals/evals.jsonreferences/mesh_types.mdreferences/quality_metrics.mdscripts/grid_sizing.pyscripts/mesh_quality.py

FAQ

Что делает скилл mesh-generation?

Plan and evaluate mesh generation for numerical simulations — estimate grid resolution from physics scales (interface width, boundary layers, wavelengths), check aspect ratios and skewness against quality thresholds, choose between structured, unstructured, and adaptive mesh refinement strategies, and compute grid sizing for 1D/2D/3D domains. Use when setting up a new mesh, diagnosing poor solver convergence caused by mesh quality, deciding how many points to place across a phase-field interface or boundary layer, or preparing a mesh convergence study, even if the user only asks "what resolution do I need" or "why is my solver failing."

Как установить скилл mesh-generation?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл mesh-generation запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить mesh-generation с