I have a 2D velocity field and a pressure field combined in a mixed element function:
velocity_element = VectorElement("Lagrange", self.mesh.ufl_cell(), 2)
pressure_element = FiniteElement("Lagrange", self.mesh.ufl_cell(), 1)
# mixed function space and mixed function
W = FunctionSpace(self.mesh, MixedElement([velocity_element, pressure_element]))
w = Function(W)
How could I compute the vorticity field (scalar field, hence on pressure_element I suppose) from the velocity field ? I have seen a topic about it but it was in FEniCS, not FEniCSx and the syntax seemed to have changed.
Ok thanks a lot again. Now I have a little and not important problem, but I would like to solve it.
With a Function that is not defined on a mixed function space, I am able to set its name:
vort = Function(V, name="vorticity")
And when written to an xdmf file, I can see in paraview my function is well named.
But when it comes to my mixed-element function w, naming each sub function seems not to work, for example I have this strange result:
w = Function(W, name="mixed_function") # creating my mixed element function (first element correspond to velocity, and second to pressure)
w.sub(0).name = "velocity" # renaming the first sub function
print(w.sub(0).name) # returns "f_0", but I would like "velocity"