Model definition: sets by geometry name, materials, sections, couplings, BCs, loads, steps, check (#16)

* model: split nodes and elements into a mesh module (no behaviour change)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NmAttHhUZTokgPeEJia8sm

* model: sets by geometry name, materials and units, sections, couplings, BCs, loads, steps and the check

Sets bind to persistent geometry names through the mesh's geometry tags
(element, element face/edge and node classification) and resolve against
the current mesh, so they survive a remesh. Steps list their active loads
and boundary conditions explicitly. Model::check names every missing or
bad item; Model::resolve gives the writers' view.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NmAttHhUZTokgPeEJia8sm

* engine: model definition commands (sets, materials, sections, RPs, couplings, BCs, loads, steps, tags, check)

Each definition has create/edit/delete with its model JSON form as
parameters; model.step.activate and model.activity drive the explicit step
table; mesh.tag records where the mesh lies on the geometry; model.check
and model.set.resolve report against the current mesh. Hostile params run
against an empty and a fully defined session.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NmAttHhUZTokgPeEJia8sm

* docs: model definition in architecture and roadmap

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NmAttHhUZTokgPeEJia8sm

* model, engine: review cleanups

Validated deserialization (a file replays through the checked methods),
interned geometry tags by index, set resolution with tag bitsets and sorted
vectors, one delete policy (a load or BC listed by a step is in use),
shared helpers (context, remove_existing, step_mut, opt/req/name/listed),
dead code removed, Resolved without a per-element section map.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NmAttHhUZTokgPeEJia8sm

* model: mesh-independent force distribution, tractions, stable reference point labels

Force and moment on a set default to a total, split by consistent nodal
weights over the set's faces (or equally over a node set); per_node is an
explicit opt-in. Traction is force per area. resolve() expands them to
nodal values for every writer and the solver. Reference points keep a
stored node label taken from the top of the label range.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NmAttHhUZTokgPeEJia8sm

---------

Co-authored-by: jyviko <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
This commit is contained in:
authored and GitHub committed 2026-10-13 16:19:54 -04:00
1 parent 6c36f5b2ad
commit 57b4b2f4d2
23 files changed
+4296 -268

No files matched your search

+43 -1
View File
@@ -18,7 +18,7 @@ crates in strictly lower layers.
| Layer | Crate | Role | Status |
|---|---|---|---|
| L0 | `modelcraft-model` | Solver-neutral FE model: nodes, elements by label; materials, sections, sets, BCs, loads and steps as they land. Knows no file format. | started |
| L0 | `modelcraft-model` | Solver-neutral FE model: nodes and elements by label, their geometry tags, sets, materials, sections, couplings, BCs, loads and steps, the model check and the resolved view the writers read. Knows no file format and no geometry type. | started |
| L1 | `modelcraft-geometry` | The only door to SolidCraft: opens `.solidcraft` designs (rebuilt from their timeline, bodies with persistent face names), B-rep bodies, measures, tessellation into a face-tagged `SurfaceMesh`; face-tagged 3MF files read into the same type without the kernel (docs/formats/tagged-mesh.md). No SolidCraft type in its API. | started |
| L1 | `modelcraft-mesh` | Surface preparation (weld, watertightness, feature edges), robust predicates, Delaunay tetrahedralization and refinement, Voronoi-based optimization, hex meshing, quality metrics. | started |
| L1 | `modelcraft-solver` | Element formulations, assembly, sparse linear static and modal solution. | planned |
@@ -78,6 +78,48 @@ Rules beyond the layer order:
6. **Quality.** Scaled Jacobian, aspect ratio, dihedral angles; every generated mesh is checked
for positive Jacobians and conserved volume before it reaches the model.
## Model definition
`modelcraft-model` holds the analysis model in no solver's vocabulary (the writers map it to
element names, cards and keywords):
- **Geometry tags.** Geometry is referred to by name only: a body and, inside it, the persistent
name of a face, edge or vertex (`{"body": "Body1", "face": "F2:top"}`). A mesher tags what it
makes: each element with the body (solids), face (shells) or edge (beams) it fills, each
boundary element face with its geometry face, element edges with geometry edges, nodes with
vertices (`Model::geometry_tag`, `tag_element`, `tag_element_face`, …; `mesh.tag` by hand).
Replacing or removing an element drops its tags; a remesh clears them and writes new ones.
- **Sets** are defined by geometry names, explicit labels or both, and resolve against the
current mesh into sorted nodes, elements and element faces. A face name also selects the pieces
a kernel splits it into (`name#0`, `name#1`). Because the definition names geometry, a remesh,
or an edit of the design followed by a remesh, keeps every set, section and load in place.
- **Element faces** are numbered per kind (`ElementKind::faces`): solids' faces are oriented with
the right-hand normal pointing out; shells have a positive and a negative side.
- **Definitions** (materials, sections with their element formulation, reference points,
couplings, boundary conditions, loads, steps) refer to each other by name. A reference must
exist when it is made, and a definition still referred to (a load listed by a step included)
cannot be deleted; what depends on
the mesh is checked when the model is resolved.
- **Steps** list the boundary conditions and loads active in them. Nothing propagates from one
step to the next.
- **Units** are a label (`mm-t-s-N-MPa`, …); numbers are never converted, and the check warns
when a modulus, density or gravity is implausible for the chosen system.
- **Check and resolve.** `Model::check` lists errors and warnings, each naming its item (a set
member not on the mesh, an element with no section or in two, a moment on solid nodes, a
missing density for a frequency step, …). `Model::resolve` returns what writers and the solver
read besides the definitions: every set resolved (each element then lies in exactly one
section's set), the node label of every reference point, and every force, moment and traction
as nodal values. It fails when the check finds an error.
- **Loads that keep their meaning on any mesh.** A force or moment on a set is a total by
default: split by the consistent nodal weights `∫ N_i dA` of the set's faces (Gauss quadrature
on each face's own linear or quadratic geometry), or equally over a set of nodes only. Applying
it at every node is an explicit, mesh-dependent opt-in (`per_node`). A traction is force per
area on faces. The expansion lives in `resolve`, so the deck writers and the solver share it.
- **Reference point labels** are stored with the point: chosen from the top of the label range
when it is created, so remeshing or adding nodes and points never renumbers them.
- **Files.** A model deserializes by replaying its contents through the same checked methods the
commands use, so a file cannot hold what commands would refuse.
## Commands
Every user-visible action is a `CommandSpec` in `crates/engine/src/cmd/<area>.rs` with a JSON
+8 -8
View File
@@ -42,16 +42,16 @@ products are run, no documentation text is copied). Status: **done**, **started*
| Mesh | Hex-dominant by recombination; polycube | M6 | yes | planned |
| Mesh | Smoothing, untangling, boundary padding, layers through thin walls | M6 | yes | planned |
| Mesh | Mesh editing (move, merge, split, collapse, remesh region), imported orphan meshes | M6 | yes | started (node/element add/remove) |
| Model | Sets and surfaces bound to geometry names | M3 | yes | planned |
| Model | Materials: elastic (isotropic, orthotropic), density, unit-system check | M3 | | planned |
| Model | Sets and surfaces bound to geometry names | M3 | yes | done |
| Model | Materials: elastic (isotropic, orthotropic), density, unit-system check | M3 | | done |
| Model | Materials: plasticity, hyperelasticity, damage, thermal | M8 | | planned |
| Model | Sections: solid, shell, beam profiles; assignment by set | M3 | | planned |
| Model | Sections: solid, shell, beam profiles; assignment by set | M3 | | done |
| Model | Composite layups, material orientations, continuum shells | M8 | yes | planned |
| Model | Element formulation per region (integration, incompatible modes, hybrid) mapped per solver | M3 | yes | planned |
| Model | Boundary conditions: fixed, displacement, symmetry | M3 | | planned |
| Model | Loads: force and moment, pressure, gravity, body force | M3 | | planned |
| Model | Reference points, kinematic and distributing coupling | M3 | | planned |
| Model | Steps: linear static, frequency; output presets | M3 | | planned |
| Model | Element formulation per region (integration, incompatible modes, hybrid) mapped per solver | M3 | yes | done (model; per-solver mapping with the deck writers) |
| Model | Boundary conditions: fixed, displacement, symmetry | M3 | | done |
| Model | Loads: force and moment, pressure, gravity, body force | M3 | | done |
| Model | Reference points, kinematic and distributing coupling | M3 | | done |
| Model | Steps: linear static, frequency; output presets | M3 | | done |
| Model | Steps: nonlinear static, explicit dynamics, heat transfer; amplitudes | M7–M8 | | planned |
| Interaction | Tie between non-matching meshes | M7 | | planned |
| Interaction | Contact (general and pairs), friction, automatic pair detection | M7 | | planned |