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.

| cite | improve this answer | |
  • $\begingroup$ Isn't only for linear elements? $\endgroup$ – Nico Schlömer May 10 '13 at 20:58
  • $\begingroup$ 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. $\endgroup$ – Jan Blechta May 11 '13 at 23:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.