This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

norm(u, inf) without project()

+2 votes

I'd like to compute the maximum of $\|u\|$ across a domain for a Function from a VectorFunctionSpace. Up until now, what I do is projecting the $\|u\|$ into an appropriate space Q,

unorm = project(norm(u_1), Q)
unorm = norm(unorm.vector(), 'linf')

The project()ion step takes quite some time though, and I thought one can be better.
The easiest thing to do would be to add the vectors associated with u[0], u[1], u[2],

vec = u0.vector() * u0.vector()
    + u1.vector() * u1.vector()
    + u2.vector() * u2.vector()

and then compute

sqrt(norm(vec, 'linf'))

It doesn't seem to be possible to extract the vectors belonging to the individual components of u though. Any other suggestions?

asked Jul 24, 2013 by nschloe FEniCS User (7,120 points)

Vote to this enhancement. It is called subfunction assignment but I guess it enables also subfunction vector access. Maybe I'm wrong.

1 Answer

+3 votes
 
Best answer

You can get a deep copy of sub-Functions, and each will have it's own vector, e.g.

# Tuple of subfunctions
u = U.split(deepcopy=True)

# Print norm of second subfunction
print u[1].vector().norm("linf")
answered Jul 25, 2013 by Garth N. Wells FEniCS Expert (35,930 points)
selected Jul 25, 2013 by nschloe
...