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

Element-wise norm of a VectorConstant in UFL

0 votes

In a UFL file, what's the best way to normalise a vector, i.e.,

h = VectorConstant("tetrahedron")
h0, h1, h2 = h.split()

normh = sqrt(h0**2 + h1**2 + h2**2)

unit_h = h/normh

Is this the best way?

asked Jun 10, 2014 by Theodore FEniCS Novice (780 points)
...