From 955b59c839c49eae9261fd2e8337941823e8e990 Mon Sep 17 00:00:00 2001 From: Jukka Aho Date: Sat, 9 May 2026 18:34:41 +0300 Subject: [PATCH] feat(materials): add element-wise scalar diffusion coefficient cache MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Support piecewise-constant per-element κ fields for nonlinear diffusion assembly. - Implement `ElementWiseScalarDiffusion` behavior trait and evaluation hooks. --- .../element_wise_scalar_diffusion.jl | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/materials/element_wise_scalar_diffusion.jl diff --git a/src/materials/element_wise_scalar_diffusion.jl b/src/materials/element_wise_scalar_diffusion.jl new file mode 100644 index 0000000..5dc01cb --- /dev/null +++ b/src/materials/element_wise_scalar_diffusion.jl @@ -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) = ()