Hi,
I cannot share the fortran file but here comes some guidance!
First, you need to make some TELEMAC-3D variables available in source.f, add:
USE DECLARATIONS_TELEMAC3D, ONLY : PRIVE2D,NPLAN
PRIVE2D is the new private variables (2D) array available for reading data stored as extra variables in the geometry file. In my case I had a dummy variable DRAG whose value was 0 everywhere in the mesh expect at the nodes where the boom was located where it had another value (the value itself is not important in my case since it is only used to identifiy on which mesh nodes do I need to add the head losses).
See information here on PRIVATE VARIABLES:
www.opentelemac.org/index.php/feature-lo...ogrammes-version-7-1
You then need to set the type for S1U, S1V and S1W to 'Q', for particular treatment:
!************PLLI********
CALL OS ( 'X=0 ' , X=S1U )
CALL OS ( 'X=0 ' , X=S1V )
!
S1U%TYPR='Q'
S1V%TYPR='Q'
IF(NONHYD) THEN
S0W%TYPR='0'
S1W%TYPR='Q'
! CALL OS ( 'X=0 ' , X=S0W )
CALL OS ( 'X=0 ' , X=S1W )
!************PLLI********
You then need to loop on the 2D nodes to identify the nodes where you boom is and read the Uref value:
DO I=1,NPOIN2
IF(PRIVE2D%ADR(1)%P%R(I).GT.0.1D0) THEN ! looking for the points at the debris boom
VREF = PRIVE2D%ADR(2)%P%R(I) ! Vref without boom, taken from T1 so approximative
DO IPLAN=NPLAN-2,NPLAN ! looking at the three highest planes, debris boom
I3D = I+NPOIN2*(IPLAN-1) ! 3D node ID on three highest planes
NORM=SQRT(UN3%R(I3D)**2+VN3%R(I3D)**2+WN3%R(I3D)**2) !Velocity
KOEFF = VREF/MAX(NORM,1.D-3)
S1U%R(I3D)= 0.5D0 * CD * VREF * KOEFF / DX
S1V%R(I3D)= 0.5D0 * CD * VREF * KOEFF / DX
S1W%R(I3D)= 0.5D0 * CD * VREF * KOEFF / DX
ENDDO
ENDIF
ENDDO
Here, I stored Uref in the second PRIVATE VARIABLE, hence VREF = PRIVE2D%ADR(2)%P%R(I).
My DRAG variable to locate the boom corresponds to PRIVE2D%ADR(1)%P%R(I).
Beware that S1U, S1V and S1W are equal and computed using the norm of the velocity vector. The actual source terms are computed in another routine by multiplying S1 with the velocity components. Beware also to define properly DX which should be the length of application of the force in the 2D plane. I did not figure out how to get the exact value at each node so my trick is to use a constant value for the whole boom which is OK if your mesh is regular at its location.
Good luck!
Best regards
PL