I can do it using the following numpy arrays:
v1 = Function(V)
v2 = Function(V)
a1 = 1.0 - numpy.dot(v1.vector().array(), v2.vector().array())
The above code works in series. However, when I run it in parallel solver (mpirun -np 2), it does not work as expected. That is, it produces two values rather than a single one.
The problem is: How can I calculate the dot product of two vectors with fenics (in parallel solver) without invoking numpy?
Related question: https://fenicsproject.org/qa/10976/mpirun-wrong-results?show=10976#q10976
Thank you!
jywu
Thanks a lot!