matlab/matlab-agentic-toolkit / skills-catalog/math-and-optimization/matlab-solve-pde
matlab-solve-pde
VerifiedEnd-to-end finite element analysis in MATLAB PDE Toolbox — geometry creation, model setup, solve, and post-processing in one skill. Use when building geometry from primitives or file import, setting up femodel with BCs/loads/materials, solving thermal/structural/EM problems, and extracting or visualizing results. Covers fegeometry, multicuboid, multicylinder, multisphere, decsg, boolean ops, mesh generation, femodel, all AnalysisTypes (thermalSteady, thermalTransient, structuralStatic, structuralTransient, structuralModal, structuralFrequency, electrostatic, magnetostatic, dcConduction, harmonic EM), materialProperties, faceBC, faceLoad, cellLoad, vertexLoad, solve, interpolation, von Mises stress, principal stress, reaction forces, heat flux, pdeplot3D visualization. Triggers on: PDE Toolbox, finite element, FEA, thermal analysis, structural analysis, electromagnetic analysis, femodel, mesh, boundary conditions, stress, displacement, heat transfer, post-processing.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 25.1 KB |
| manifest.yaml | config | 496 B |
| references/bc-load-reference.md | markdown | 4.9 KB |
| references/boolean-and-cell-ops.md | markdown | 4.5 KB |
| references/damping-reference.md | markdown | 2.1 KB |
| references/decsg-and-2d-geometry.md | markdown | 2.3 KB |
| references/electromagnetic-setup.md | markdown | 4.8 KB |
| references/em-postprocessing.md | markdown | 4.1 KB |
| references/modal-and-reduced-order.md | markdown | 3.0 KB |
| references/nonconstant-parameters.md | markdown | 4.3 KB |
| references/primitives-and-import.md | markdown | 4.8 KB |
| references/time-dependent-loads.md | markdown | 2.7 KB |
| references/visualization-reference.md | markdown | 6.0 KB |
references/primitives-and-import.md
View on GitHub# Primitives and Geometry Import
## 3-D Primitive Options
### multicuboid
```matlab
gm = multicuboid(W, D, H)
gm = multicuboid(W, D, H, ZOffset=offsets)
gm = multicuboid(W, D, H, Void=flags)
```
| Argument | Type | Description |
|----------|------|-------------|
| `W` | scalar or vector | Width(s) along x |
| `D` | scalar or vector | Depth(s) along y |
| `H` | scalar or vector | Height(s) along z |
| `ZOffset` | vector | Z-position of each cuboid's base (default: all 0) |
| `Void` | logical vector | Mark cells as empty (hollow geometry) |
**Origin:** Centered in x and y. Base at z=0 (or z=ZOffset).
```matlab
gm = fegeometry(multicuboid(1, 0.5, 0.2)); % Single cuboid
gm = fegeometry(multicuboid([0.5, 1], [0.5, 1], [1, 1])); % Nested (2 cells)
gm = fegeometry(multicuboid([1,1], [1,1], [0.3, 0.7], ZOffset=[0, 0.3])); % Stacked
gm = fegeometry(multicuboid([0.4, 0.5], [0.4, 0.5], [1, 1], Void=[true, false])); % Hollow
```
### multicylinder
```matlab
gm = multicylinder(R, H)
gm = multicylinder(R, H, ZOffset=offsets)
gm = multicylinder(R, H, Void=flags)
```
**Origin:** Axis aligned with z. Centered in x-y. Base at z=0.
```matlab
gm = fegeometry(multicylinder(0.5, 1)); % Single cylinder
gm = fegeometry(multicylinder([0.3, 0.5], 1)); % Concentric (pipe)
gm = fegeometry(multicylinder([0.3, 0.5], 1, Void=[true, false])); % Hollow pipe
```
### multisphere
```matlab
gm = multisphere(R)
gm = multisphere(R, Void=flags)
```
**Origin:** Centered at origin (all axes).
```matlab
gm = fegeometry(multisphere(0.1)); % Single sphere
gm = fegeometry(multisphere([0.08, 0.1], Void=[true, false])); % Hollow shell
```
### Origin Summary
| Primitive | x-y | z |
|-----------|-----|---|
| `multicuboid` | Centered | Base at z=0 |
| `multicylinder` | Centered (axis = z) | Base at z=0 |
| `multisphere` | Centered | Centered (z=0 is equator) |
### Capsule Pattern (cylinder + hemispherical ends)
Union full hollow spheres at cylinder ends — overlap absorbed by union:
```matlab
gmCyl = fegeometry(multicylinder([Ri, Ro], L, Void=[true, false]));
gmSph = fegeometry(multisphere([Ri, Ro], Void=[true, false]));
gmCapTop = translate(gmSph, [0, 0, L]);
gmCapsule = union(union(gmCyl, gmSph), gmCapTop);
```
## File Import (STL / STEP)
```matlab
gm = fegeometry("model.stl");
gm = fegeometry("assembly.step");
```
### Import Options
| Option | Default | Purpose |
|--------|---------|---------|
| `FeatureAngle` | 44 | Dihedral angle threshold (degrees) for edge detection. Lower = more faces. |
| `MaxRelativeDeviation` | 1 | Tessellation accuracy for STEP (0.1–10). Lower = finer. |
| `AllowSelfIntersections` | true | Permit self-intersecting geometry. |
```matlab
gm = fegeometry("part.step", FeatureAngle=30, MaxRelativeDeviation=0.5);
```
## Mesh Data Import
```matlab
gm = fegeometry(nodes, elements); % nodes N×3, elements M×4
gm = fegeometry(nodes, elements, elementIDToRegionID); % Multidomain
gm = fegeometry(meshObj); % From FEMesh object
```
Supported element types: M×3 (triangles), M×6 (quadratic triangles), M×4 (tetrahedra), M×10 (quadratic tetrahedra).
## Custom Geometry from Computational Geometry Tools
`fegeometry` accepts triangulations (nodes + connectivity). Design shape with any tool, extract boundary:
| Tool | Extract Triangulation |
|------|----------------------|
| `convhull(pts)` | `K = convhull(pts); gm = fegeometry(pts, K);` |
| `alphaShape(pts, alpha)` | `[tri, pts] = boundaryFacets(shp); gm = fegeometry(pts, tri);` |
| `delaunayTriangulation(pts)` | `[tri, pts] = freeBoundary(dt); gm = fegeometry(pts, tri);` |
| `polyshape(x, y)` | `[F, V] = triangulation(pg); gm = fegeometry(V, F);` |
| `isosurface(V, isovalue)` | `fv = isosurface(X,Y,Z,V,val); gm = fegeometry(fv.vertices, fv.faces);` |
| `stlread(file)` | `TR = stlread("file.stl"); gm = fegeometry(TR.Points, TR.ConnectivityList);` |
| `boundary(pts, shrinkFactor)` | `K = boundary(pts, s); gm = fegeometry(pts, K);` |
| `surf2patch` / patch data | `gm = fegeometry(vertices, faces);` |
**Note:** `fegeometry` does NOT accept `polyshape` directly — extract triangulation first.
## Diagnostic Checklist (Before Meshing)
| Check | Expected | How |
|-------|----------|-----|
| Cell count | Matches design | `gm.NumCells` |
| Void exists | Interior is hollow | `findCell(model.Geometry, interiorPoint)` returns NaN |
| Materials assignable | Cells correspond to materials | `findCell(model.Geometry, pt)` at known material locations |
| No fragments | No unexpected extra cells | Compare `NumCells` to expected |
If `generateMesh` fails with "invalid boundary / gaps / self-intersections":
- Degenerate boolean condition (coincident surfaces)
- Gap between parts that weren't properly unioned
- Cutting plane exactly at tangent/equator
----
Copyright 2026 The MathWorks, Inc.
----
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |