Files
JuliaFEM.jl/src/materials/api.jl
T
Jukka Aho a6d77d4705 refactor(materials): streamline API documentation by removing verbose sections
Removed extensive documentation from material API docstrings:
- Removed detailed interface requirements sections
- Removed type hierarchy explanations
- Removed design philosophy sections
- Removed usage examples and 'See Also' references
- Kept only essential type and function descriptions

This simplifies the API documentation while maintaining core information
about material types and their behavior traits.
2025-12-15 03:17:44 +02:00

135 lines
3.5 KiB
Julia
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
"""
Material model API definitions.
This file defines material-specific abstract types and interfaces.
Must be included after core api.jl.
"""
# ============================================================================
# MATERIAL MODEL ABSTRACTIONS
# ============================================================================
"""
AbstractMaterial
Abstract type for all material models.
All material models must implement `compute_stress(material, ε, state_old, Δt)`.
"""
abstract type AbstractMaterial end
"""
AbstractElasticMaterial <: AbstractMaterial
Stateless elastic materials (no history variables).
"""
abstract type AbstractElasticMaterial <: AbstractMaterial end
"""
AbstractPlasticMaterial <: AbstractMaterial
Stateful plastic materials (history-dependent).
"""
abstract type AbstractPlasticMaterial <: AbstractMaterial end
"""
AbstractMaterialState
Abstract type for material internal state at integration points.
Concrete types must be immutable for thread safety.
"""
abstract type AbstractMaterialState end
"""
EmptyState <: AbstractMaterialState
Empty material state for stateless materials.
"""
struct EmptyState <: AbstractMaterialState end
# Zero constructor for Base.zero compatibility
Base.zero(::Type{EmptyState}) = EmptyState()
# ============================================================================
# MATERIAL BEHAVIOR TRAITS
# ============================================================================
"""
MaterialBehavior
Abstract type for material behavior traits.
"""
abstract type MaterialBehavior end
"""
StatelessConstantTangent <: MaterialBehavior
Material with constant tangent modulus (independent of strain).
"""
struct StatelessConstantTangent <: MaterialBehavior end
"""
StatelessStrainDependent <: MaterialBehavior
Material with strain-dependent tangent modulus (no internal state).
"""
struct StatelessStrainDependent <: MaterialBehavior end
"""
StatefulStrainDependent <: MaterialBehavior
Material with strain-dependent tangent and internal state variables.
"""
struct StatefulStrainDependent <: MaterialBehavior end
"""
material_behavior(material::AbstractMaterial) -> MaterialBehavior
Trait function declaring what computational requirements a material has.
"""
function material_behavior end
"""
needs_deformation(material::AbstractMaterial) -> Bool
Query whether material needs displacement field for tangent computation.
"""
needs_deformation(mat::AbstractMaterial) = !(material_behavior(mat) isa StatelessConstantTangent)
"""
needs_state(material::AbstractMaterial) -> Bool
Query whether material has internal state variables.
"""
needs_state(mat::AbstractMaterial) = material_behavior(mat) isa StatefulStrainDependent
"""
state_type(::Type{<:AbstractMaterial}) -> Type{<:AbstractMaterialState}
Return the concrete state type for a given material type.
"""
state_type(::Type{<:AbstractMaterial}) = EmptyState
# ============================================================================
# MATERIAL MODEL FUNCTIONS
# ============================================================================
"""
compute_stress(material::AbstractMaterial, ε, state_old, Δt)
-> (σ, 𝔻, state_new)
Compute stress, tangent, and updated state for a material model.
"""
function compute_stress end
"""
elasticity_tensor(material::AbstractElasticMaterial) -> Tensor{4,3}
Compute 4th-order elasticity tensor for an elastic material.
"""
function elasticity_tensor end