Hi everyone!
I’m trying to create a mixed element from two functions. I tried this:
from fenics import *
from mshr import *
import numpy as np
from dolfin import *
import math
channel = Rectangle(Point(-40.0, -y_h), Point(50.0, y_h))
cylinder = Circle(Point(0.0, 0.0), 0.5,320)
domain = channel - cylinder
mesh = generate_mesh(domain, 30)
# Define function spaces
#Product of Function Spaces
P2 = VectorElement("CG", mesh.ufl_cell(), 1)
P1 = FiniteElement("CG", mesh.ufl_cell(), 1)
TH = MixedElement([P2, P1])
W = FunctionSpace(mesh, TH)
Q = FunctionSpace(mesh, 'CG', 1)
V = VectorFunctionSpace(mesh, 'CG', 1)
w = Function(W)
um,pm = split(w)
umean = Function(V)
pmean = Function(Q)
p_vector=np.load("p_numpy.npy")
u_vector=np.load("u_numpy.npy")
pmean.vector()[:]=p_vector[:]
umean.vector()[:]=u_vector[:]
w_vector=np.concatenate((u_vector, p_vector))
w.vector()[:]=w_vector[:]
when I plot pmean, obtain
but if I plot pm, obtain
Does anyone know how to solve it or a better way to join two functions?
Thank you very much