run_fem
Runs linear-static finite element analysis on one solid to compute maximum von Mises stress, displacement, and yield safety factor, returning a stress plot PNG for validation.
Instructions
Linear-static FEM (Gmsh 2nd-order tetrahedra + CalculiX) on ONE solid. Returns max von Mises (MPa), max displacement
(mm), yield safety factor, mesh size, and a colour plot of von Mises (returned as an image and saved as PNG).
fixed_faces: fully fixed faces (several fixtures allowed): 1-based indices from list_faces, a selector string such as
'normal:-Z z:min' (see list_faces), or a list mixing selectors and index lists, which are united. loads: list of dicts, each with faces (indices or selector) and either
force_n (total force in newtons, spread over those faces) + direction [x,y,z], or pressure_mpa (acts normal into
the face). Example: loads=[{"faces": "normal:+X x:max", "force_n": 500, "direction": [0,0,-1]}].
material defaults to the object's material. mesh_size is the max element edge in mm: smaller is more accurate and
slower (keep >= thickness/2; 3-5 mm is fine for hand-sized parts, runtime seconds to a minute).
Stress at the edge of a fixed/loaded face is a numerical singularity, so max_von_mises_mpa (and the safety factor)
ignore nodes within exclude_mm (default = mesh_size) of those edges; *_raw values include them. Fillet sharp
corners and refine the mesh before trusting stress concentrations.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| doc | Yes | ||
| name | Yes | ||
| loads | Yes | ||
| material | No | ||
| mesh_size | No | ||
| plot_view | No | iso | |
| exclude_mm | No | ||
| fixed_faces | Yes |