Drop a duplicated example line and remove the commented-out Fluid placeholder
that suggested unfinished velocity dispatch.
- Clarify `Thermal{Dim}` wording; delete stale `Fluid{Dim}` sketch.
Replace the long `Physics{...}` narrative with short placeholders that explain
how `assemble!`/`solve!`/BC hooks are extended by assemblers or Legacy only.
- Document the kernel + assembler workflow as the active surface.
- Point Dirichlet/Neumann reservations at matrix-free BC and load value types.
- Keep generic function declarations for Legacy method attachment.
Replace stale `Physics{...}` API docs with the actual 0.x role: a lightweight
trait root for `Elasticity`/`Thermal` tags and material dispatch, with legacy
`Physics` confined to `JuliaFEM.Legacy`.
- Shorten `AbstractPhysics` docstring and drop obsolete interface/examples.
New 88-line formulation utilities:
- field_type_for_dispatch(): extract field type from Element's S parameter
- Helper functions for multi-field Element{K,P,S} system
- Works with NamedTuple-based field specifications
- Supports thermoelasticity and other multi-physics couplings
- Already integrated in JuliaFEM.jl (line 500)
Provides utilities for multi-field microkernel assembly with Element{K,P,S} system.
New 83-line microkernel interface:
- evaluate(): compute single scalar contribution to K[i,j] at integration point
- Matrix-free assembly support for DOF-based assemblers
- Multi-physics coupling via type dispatch
- Zero-allocation assembly with precomputed caches
- Default implementation returns 0.0 (no coupling)
- Already integrated in JuliaFEM.jl (line 499)
Provides microkernel architecture for efficient matrix-free assembly.
Replace monolithic Physics struct and boundary condition types with
simpler physics category types used for trait-based dispatch.
- Remove Physics struct (Formulation, Field, Mesh, Material coupling)
- Remove DirichletBC and NeumannBC boundary condition storage types
- Remove Constraint type
- Add Elasticity{Dim} and Thermal{Dim} physics category types
- Add required_field_type trait function for physics-to-field mapping
- Simplify to type tags for material trait dispatch
- Support compile-time field type inference from physics
- Align with new architecture: physics types are dispatch tags, not problem containers
- Implement add_dirichlet! for essential BCs (prescribed values)
- Implement add_neumann! for natural BCs (forces/tractions)
- Support multiple nodes and DOF components in single call
- Store BCs in physics.bc_dirichlet and physics.bc_neumann
- Add usage examples for common BC patterns
- 86 lines with complete method implementations
- Define AbstractPhysics abstract type in dedicated file
- Consolidate documentation from previous duplicate definitions
- Document type as coupling of Mesh, Material, Field, and Formulation
- Add comprehensive examples for 3D solid, heat, and beam physics
- Include multiphysics pattern documentation
- Remove duplicate AbstractPhysics definitions across codebase
- 109 lines of documentation and abstract type definition
- Replace language-tagged code fences and add proper blank lines to satisfy Markdown lint rules
- Escape `$` in example error string to avoid accidental interpolation (`error("No assembly method for formulation \$Fm with field \$F")`)
Formatting-only changes to improve generated documentation and prevent lint failures; no runtime behavior altered.
Create src/physics/api.jl defining physics problem abstractions:
- AbstractPhysics base type for all physics problems
- assemble!() interface for building global system (K, f)
- solve!() interface for solving physics problems
- add_dirichlet!() for essential BCs (prescribed displacements/temperatures)
- add_neumann!() for natural BCs (surface tractions/heat flux)
Physics couples four components: Mesh (where), Material (constitutive law),
Field (what we solve), Formulation (how we discretize). Physics references
Mesh (does not own it) enabling multiphysics: multiple Physics can share
one Mesh for memory efficiency and coupling.
Dispatch specialization via formulation × field type parameters:
assemble!(::Physics{ContinuumFormulation{FullThreeD}, Displacement{3}, M, Mat})
assemble!(::Physics{BeamFormulation{Timoshenko}, DisplacementRotation{3}, M, Mat})
Comprehensive documentation with multiphysics examples, dispatch patterns,
and interface contracts. Assembly implementations in src/assembly/.
Part of systematic modular API architecture.
New file src/physics/deformation_gradient.jl:
- compute_deformation_gradient() computes F = I + ∇u at integration points
- StrainFormulation types: FiniteStrain() and SmallStrain()
- Uses Tensors.jl for all tensor operations (Vec, Tensor)
- Zero-allocation design with @inline functions
- GPU-ready immutable operations
- Comprehensive mathematical documentation with references
- 243 lines including commented high-level API for future integration
New file src/physics/assembly_helpers.jl with FEM assembly utilities:
- shape_function_gradients() computes ∇N in current configuration
- compute_strain_from_gradients() small strain ε = sym(∇u)
- compute_green_lagrange_strain() finite strain E = ½(C-I)
- accumulate_stiffness!() adds element stiffness contributions
- accumulate_internal_forces!() computes f_int = ∫σ·∇N dV
- accumulate_external_forces!() computes f_ext = ∫N·b dV
- Zero-allocation design with Tensors.jl Vec and SymmetricTensor
- 331 lines with comprehensive performance documentation
New file src/physics/abstract.jl defining physics system architecture:
- AbstractPhysics base type for all physics implementations
- get_unknown_field_name() returns primary field (displacement, temperature, etc.)
- get_formulation_type() returns :incremental, :total, or :rate
- get_unknown_field_dimension() returns DOFs per node
- assemble!() dispatch point for physics-specific assembly
- Comprehensive docstrings covering multi-physics coupling and GPU compatibility
- 138 lines documenting design philosophy and future extension