Skip to main content

carapace_core/model/
mod.rs

1mod constraint;
2pub mod continuum;
3mod dof_table;
4mod domain;
5mod elements;
6mod error;
7mod fiber_section;
8mod integration;
9mod load_pattern;
10mod materials;
11mod node;
12mod transform;
13
14pub use domain::{Domain, Domain3};
15pub use elements::{
16    two_node_dofs, DispBeamColumn, DispBeamColumn3, DofMask, DofRef, ElasticBeamColumn,
17    ElasticBeamColumn3, Element, Element3, Element3Id, ElementForce, ElementId, ElementOps,
18    ForceBeamColumn, ForceBeamColumn3, Friction, Friction3, GaussResponse, NodeList, NodeView,
19    Orientation, OrientationError, Quad4, Quad4Formulation, Shell3, Shell4, ShellResponse,
20    SpatialElementMatrix, SpatialElementVector, TangentSink, Tri3, Truss, Truss3, VectorSink,
21    ZeroLength, ZeroLength3, ZeroLengthSection, ZeroLengthSection3, MAX_ELEMENT_NODES,
22};
23pub use error::ModelError;
24pub use fiber_section::{Fiber, Fiber3, FiberSection, FiberSection3};
25pub use integration::BeamIntegration;
26pub use load_pattern::{
27    ElementLoad, ElementLoad3, ElementLoadComponents, LoadPatternId, LoadSeries,
28};
29pub use materials::{
30    Material, Pinching4DmgCyc, Pinching4State, PlaneMaterial, PlaneMaterialError, PlaneMatrix,
31    PlaneVector, ShellMatrix, ShellSection, ShellSectionError, ShellVector,
32};
33pub use node::{
34    Axis3, Node, Node2, Node3, Node3Id, NodeId, SpatialDof, PLANAR_NDIM, SPATIAL_ELEMENT_DOF,
35    SPATIAL_NDF, SPATIAL_NDIM,
36};
37pub use transform::{GeomTransf, GeomTransf3};
38
39/// Degrees of freedom per node: 2D translation (x, y) plus in-plane
40/// rotation (z). The third DOF carries `ElasticBeamColumn`'s
41/// bending. A node's DOF becomes an equation only if something uses it
42/// (an element stiffens it, a constraint ties to it, it carries a mass, or
43/// it is fixed), so a node connected only to trusses has no rotation
44/// unknown and needs none fixed by hand (see `Domain::is_active`).
45pub const NDF: usize = 3;
46
47/// `2 * NDF` — the size of a 2-node element's local/global stiffness and
48/// force vectors. A named constant instead of a `const` expression because
49/// stable Rust's const generics can't yet compute `2 * NDF` inline at each
50/// `SMatrix`/`SVector` use site.
51pub const ELEMENT_DOF: usize = 2 * NDF;
52
53/// The global tangent stiffness matrix's representation: sparse, not a
54/// dense `nalgebra::DMatrix`. `faer` over `nalgebra-sparse`: a built-in sparse LU with
55/// COLAMD/AMD fill-reducing ordering (so no separate `DOF_Numberer`
56/// abstraction is needed), pure Rust (no C
57/// dependency to fight through `wasm32-unknown-unknown`), and confirmed to
58/// build and solve correctly under wasm32 + Node with a minimal feature set
59/// (`std` + `sparse-linalg`, dropping `rand`/`rayon`/`npy`, which otherwise
60/// pull in a `getrandom` wasm build failure).
61pub(crate) type SparseMatrix = faer::sparse::SparseColMat<usize, f64>;