Hello,
Suppose that the scalar implementation is :
my_var=0.D0
DO I=1,NPOIN
my_var=my_var+F(I)
ENDDO
NPOIN is here the number of points in the mesh.
The parallel implementation would be:
DOUBLE PRECISION P_DSUM
EXTERNAL P_DSUM
IF(NCSIZE.GT.1) THEN
my_var=0.D0
! here NPOIN is the number of points in the subdomain (and it is also the dimension of F, you must not dimension F in a subdomain with the original number of points)
DO I=1,NPOIN
my_var=my_var+F(I)*MESH%FAC%R(I)
ENDDO
my_var=P_DSUM(my_var)
ELSE
my_var=0.D0
DO I=1,N
my_var=my_var+F(I)
ENDDO
ENDIF
array MESH%FAC%R(I) accounts for the points that belong to several subdomains, P_DSUM sums over all subdomains.
For more information, see the "guide for programming in the Telemac system" (click on "manuals" on bottom of home page).
With best regards,
Jean-Michel Hervouet