Mapping (push forward/pull back) a scalar field

Dear community,

I am searching for a clever and easy way to map a scalar field between reference and current configuration (Lagrangean and Euler description) in a displacement-based FE formulation. In the end, I want to have a term in the bilinear form that contains terms with phi_t(u)-phi_0. I import a reference and a spatial field via VoxelCoefficient, getting, say, CF_phi_0 and CF_phi_t. Is it possible to map a coefficient function directly using the displacement/trial function u? In order to be able to write something like CF_phi_t.pullback(u)-CF_phi_0 or CF_phi_t-CF_phi_0.pushforward(u) in the bilinear form?


Best, Chris

Hi Chris,

I think it is not possible now, but maybe we can get it. Since you want to put it into the bilinear-form, as a function of the trialfunction, you want to take variations with respect to u, right ?

A CoefficientFunction is a function defined on the mesh, its argument includes the coordinate, the element-number, the material-index. Composing CoefficientFunctions is (in a limited way) now possible by a CoordinateTrafo coefficientfunction. This is expensive, since a point-in-element search is involved. And (currently) we cannot differentiate it.

But, it looks like your phi_t function is a pure function, just a function mapping from R3 to R. Then it it should be possible to use phi_t(X+u) in a bilinear-form, together with automatic differentiation. A the moment, we cannot use a VoxelCF as a pure function, but this is only a missing feature, not a missing concept :slight_smile:


Hi Joachim,

Thanks for your helpful and informative response. And, at this point, thanks in general for the wonderful NGSolve software!

Yes, exactly, I want to take variations with respect to u. It would be very convenient if I could make use of those NGSolve skills. The CoordinateTrafo coefficient function looks interesting and could potentially be the thing I searched for, thanks for that hint. However, it does not directly take the trial function u as argument, but rather some CoeffcientFunction, right?

So…sorry if I did not fully get it: To use something like phi_t(X+u) (with CoordinateTrafo?) in the bilinear form, VoxelCF has to be modified to use it as a pure function?