feat(materials): add element-wise scalar diffusion coefficient cache

Support piecewise-constant per-element κ fields for nonlinear diffusion assembly.

- Implement `ElementWiseScalarDiffusion` behavior trait and evaluation hooks.
This commit is contained in:
Jukka Aho
2026-05-09 18:34:41 +03:00
parent cd60d89407
commit 955b59c839
@@ -0,0 +1,32 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md
"""
ElementWiseScalarDiffusion <: AbstractMaterial
Piecewise **constant** isotropic scalar conductivity on each volume element
(index matches `mesh.connectivity` order): at quadrature points of element `e`
the tensor is `λ_by_elem[e] · I`.
Used with [`HeatKernel`](@ref) and either [`Temperature`](@ref) (thermal
conductivity values in ``k``) or [`PressurePotential`](@ref) (hydraulic
conductivity ``K``). For a spatially smooth ``λ(x)``, refine the mesh or use
per-region assembly; truly pointwise ``λ`` at quadrature nodes is not covered
here.
# Example
```julia
# Two bricks along x with different K; λ_by_elem[i] is conductivity of element i.
mat = ElementWiseScalarDiffusion([1.0, 4.0])
kernel = HeatKernel(ContinuumFormulation{FullThreeD}(), mat, PressurePotential())
```
"""
struct ElementWiseScalarDiffusion <: AbstractMaterial
λ_by_elem::Vector{Float64}
end
material_behavior(::ElementWiseScalarDiffusion) = StatelessConstantTangent()
supported_physics(::ElementWiseScalarDiffusion) = (Thermal{3}(),)
required_state_variables(::ElementWiseScalarDiffusion) = ()