Problem with Projection

The code you provided isn’t complete. The error is probably in how you define V when calling your normalizeAndProj_vec function, but we can only guess since you didn’t post the full code. See Read before posting: How do I get my question answered?

Say that V is a FE space for a scalar field, and hence u is a scalar field. When you ask grad(u), you are getting a vector field, and so you must be passing a FE space which is not V (scalar field), but the equivalent FE space of V for a vector field.

1 Like