Mmmm. `procjeted_func.vector().get_local()`

doesn’t work for me. If I try these and works, I can do

procjeted_func.vector().get_local()=adjoint(procjeted_func.vector().get_local()) and

dot(projected_fun,u)=(\nabla u)^{\dagger}\cdot u if project_fun = \nabla u?

This is the code :

#Solution of LNS, velocity and pressure

P2 = VectorElement(“P”, mesh.ufl_cell(), 2)

P1 = FiniteElement(“P”, mesh.ufl_cell(), 1)

TH = MixedElement([P2, P1])

W = FunctionSpace(mesh, TH)

wauxa=Function(W)

waux=Function(W)

r,c,rx,cx = eigensolver.get_eigenpair(indexea)

ra,ca,rax,cax = Aeigensolver.get_eigenpair(indexea)

waux.vector()[:]=rx

wauxa.vector()[:]=rax

uaux,paux= waux.split(deepcopy=True)

uauxa,pauxa= wauxa.split(deepcopy=True)

Q = FunctionSpace(mesh, ‘P’, 2)

V = VectorFunctionSpace(mesh, ‘P’, 2)

uv=project(uaux,V)

auv=project(uauxa,V)

T = TensorFunctionSpace(mesh, “P”, 2)

grad_u=project(grad(uv),T)

auxiliary=grad_u.vector().get_local()

and I have another question, but I think it would be appropriate to put it in another post.

It’s about how obtain the norm of Vector Function in each element.

This is my way:

uvx,uvy=split(uv)

auvx,auvy=split(auv)

p_uvx=project(uvx,Q)

p_uvy=project(uvy,Q)

np_uvx=p_uvx.vector()[:]

np_uvy=p_uvy.vector()[:]

p_auvx=project(auvx,Q)

p_auvy=project(auvy,Q)

np_auvx=p_auvx.vector()[:]

np_auvy=p_auvy.vector()[:]

np_norm=np_uvx*np_uvx + np_uvy*np_uvy

np_norm=np.sqrt(np.array(np_norm))

np_anorm=np_auvx*np_auvx + np_auvy*np_auvy

np_anorm=np.sqrt(np.array(np_anorm))

norm_uv=Function(Q)

norm_uv.vector()[:]=np_norm

norm_auv=Function(Q)

norm_auv.vector()[:]=np_anorm

I think this works, but there is another quicker way?

Thank you!