Hello,
Given the mixed space defined as follows
P_z = FiniteElement('P', triangle, 1)
P_omega = VectorElement('P', triangle, 1)
element = MixedElement([P_z, P_omega])
Q_z_omega = FunctionSpace(mesh, element)
and the function
z_omega = Function(Q_z_omega)
z, omega = split(z_omega)
I want to assign to the z
part of z_omega
a given function profile, derived from the analytical expression x^2/2\, y^2/2. I tried
class z_Expression(UserExpression):
def eval(self, values, x):
values[0] = ((x[0])**2)/2.0 * ((x[1])**2)/2.0
def value_shape(self):
return (1,)
z = interpolate(z_Expression(element=Q_z.ufl_element()), Q_z)
But the assignement z = interpolate ...
seems to have no effect. How may I assign to the z
part of z_omega
the function x^2/2\, y^2/2 ?
(please not that I am not using dolfinx)
Thanks