Hello,
What you really want is something like:
IF(I.EQ.2) THEN
IF(ISCE(1).GT.0) THEN
! CASE WHERE SOURCE-SINK 1 IS IN SUBDOMAIN
! ADR(1) IS FOR TRACER 1, IT WOULD BE ADR(2) FOR TRACER 2.
! TA IS THE BLOCK OF TRACERS (WHAT IS A BLOCK IS EXPLAINED IN THE GUIDE FOR
! PROGRAMMING IN THE TELEMAC SYSTEM)
! ((KSCE(1)-1)*NPOIN2+ISCE(1)) IS THE GLOBAL ADDRESS OF SOURCE-SINK POINT 1
! AS ISCE(1) IS ITS 2D ADDRESS AND KSCE(1) ITS PLANE NUMBER
T3D_TRSCE=TA%ADR(1)%P%R((KSCE(1)-1)*NPOIN2+ISCE(1))
ELSE
! CASE WHERE SOURCE-SINK 1 IS NOT IN SUBDOMAIN
T3D_TRSCE=0.D0
ENDIF
! TAKING THE NON ZERO VALUE IN THE SUB-DOMAIN(S) THAT HAVE IT
! P_DMIN TAKES THE MINIMUM AMONG ALL PROCESSORS
! P_DMIN WILL GIVE IT IF NEGATIVE, OR WILL RETURN 0
! P_DMAX WILL GIVE IT IF POSITIVE, OR WILL RETURN 0
IF(NCSIZE.GT.1) T3D_TRSCE=P_DMIN(T3D_TRSCE)+P_DMAX(T3D_TRSCE)
ELSE
T3D_TRSCE = TASCE(I,ITRAC)
ENDIF
You will have to add KSCE, ISCE and NPOIN2 in the ONLY list of
USE DECLARATIONS_TELEMAC3D at the beginning of the function. If P_DMIN and P_DMAX not recognised, add also USE INTERFACE_PARALLEL.
I hope it works, not tested, but if you understand the explanations you will be able to correct and to adapt the implementation to other cases.
With best regards,
Jean-Michel Hervouet