From 7ed78e9f5e59c33c85577ee99583d7320ed58c32 Mon Sep 17 00:00:00 2001 From: Jukka Aho Date: Sat, 9 May 2026 16:59:58 +0300 Subject: [PATCH] feat(geometry): add Piola push-forward helpers for curl/div fields Implement covariant and contravariant Piola maps using Tensors.jl Jacobians. --- src/geometry/piola.jl | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/geometry/piola.jl diff --git a/src/geometry/piola.jl b/src/geometry/piola.jl new file mode 100644 index 0000000..4438f57 --- /dev/null +++ b/src/geometry/piola.jl @@ -0,0 +1,30 @@ +# This file is a part of JuliaFEM. +# License is MIT: see https://github.com/JuliaFEM/JuliaFEM.jl/blob/master/LICENSE.md + +using Tensors + +""" + piola_covariant(J::Tensor{2,3}, u_ref::Vec{3}) -> Vec{3} + +Covariant Piola transform (push-forward for `H(curl)`-type fields): + +``u^{\\mathrm{phys}} = J^{-T} u^{\\mathrm{ref}}``, + +with `J = ∂x/∂ξ` the Jacobian of the reference-to-physical map. + +See also [`piola_contravariant`](@ref) for `H(\\mathrm{div})`. +""" +@inline function piola_covariant(J::Tensor{2, 3}, u_ref::Vec{3}) + return inv(J)' ⋅ u_ref +end + +""" + piola_contravariant(J::Tensor{2,3}, u_ref::Vec{3}) -> Vec{3} + +Contravariant Piola transform (push-forward for `H(\\mathrm{div})`-type fields): + +``u^{\\mathrm{phys}} = (\\det J)^{-1} J \\, u^{\\mathrm{ref}}``. +""" +@inline function piola_contravariant(J::Tensor{2, 3}, u_ref::Vec{3}) + return (J ⋅ u_ref) / det(J) +end