How to scale deformation solution by axial directions

Hi all,

Im trying to scale the deformation after solving the equation in hyperelasticity demo. I know how to scale it if the scale factor is a scalar, but what I now need is scale by a constant 3d array, i.e. each Cartesian direction gets a scalar, sth like [1.1, 0.9, 2.3]. I searched both the old and current forum but didn’t find a solution. Do we have a way to do it through dolfin?

Thanks very much for your help!
Victor

[Edit]

If you simply want to scale the components of your vector field individually, a naive solution would be something like

# assuming `u` in R^3 is your solution from the demo
u1, u2, u3 = u.split()
u1 *= 1.1
u2 *= 0.9
u3 *= 2.3
u = project(as_vector([u1, u2, u3]), V) # get back the vector on the `VectorFunctionSpace`: V

I wasn’t on my computer