# compute max(||u||) for vector field

Given a vector-valued Dolfin function u from the function space V*V with V=FunctionSpace(mesh, 'CG', 2), how do I extract $$\max_{x\in\Omega} \|u(x)\|$$ ? An approximation works, too.

u1, u2 = u.split()
unorm = project((u1**2 + u2**2)**0.5, V, form_compiler_parameters={'quadrature_degree': 4})
unorm = norm(unorm.vector(), 'linf')


Note that quadrature degree is set explicitly to twice the degree of V because UFL does not handle well degree estimation of power with non-integer exponent.

Last line is aproximative unless u is piecewise linear.

• Isn't only for linear elements? – Nico Schlömer May 10 '13 at 20:58
• Actually projection part is approximative too as square root of polynomial can't be exactly integrated with none degree. But ommiting square root in projection part and taking square root from final number could make it exact for piecewise linear u. – Jan Blechta May 11 '13 at 23:55