How to compute norm of a solution component

Hi

I am solving a multi-component system. I wanted to examine the norms of components individually. Say, u and v are the components, I did the following:

u, v = solution.split()
print('u norm: ', u.vector().norm('l2'))
print('v norm: ', v.vector().norm('l2'))
print('solution norm: ', solution.vector().norm('l2'))

It turned out that all printed the same value, which apparently is not correct as u and v are nonzero solution components. Is there a correct way to do this?

Thanks,
Victor

Just use

u, v = solution.split(True)

which creates a deepcopy of the split.

1 Like