I have a code that solves for u and p. Suppose I want to average u*p over all elements, what I do currently is
import numpy as np
...
u, p = u_.split(deepcopy=True)[:] # get u and p from a mixed function space
u_array = u.vector().array()
p_array = p.vector().array()
avgUP = np.average(u_array*p_array)
I wish to run this code in parallel.
Is there some way to compute avgUP with fenics (without invoking numpy)?