Ah, yes that slipped me by!
Using Pilou's code (example given below) I've noticed that:
If the argument is PRIVE%ADR(1)%P%R(I)
.GT.0.1D0 or similar:
then the case runs and applies drag to all nodes at the prescribed layers, ignoring the distribution of node values in the private array (most of the nodes values = 0 so drag shouldn't be applied at all nodes).
If the argument is PRIVE%ADR(1)%P%R(I)
.EQ.1D0 or similar (including the cleaner test mentioned earlier):
then the case runs and doesn't apply any drag, and the results are like a run without the code.
This suggests: the array has values >0.1 but don't match exactly with 1. The distribution of drag is what I would expect if the array had a uniform distribution of node values >0.1D0, not the more scattered distribution of node values actually in the variable where most of the nodes have values of 0.
The only variables in my current .slf file are the BOTTOM geometry file and the variable ROUGH which contains the specific nodes where I want the drag terms to be applied with values >0
It's like the code is using the node values in the array as a benchmark for applying the code, rather than using the node values in the array to find the places where the code should be applied. i.e. it applies the fortran code to all nodes if the array has node values >0.01, rather than applying the code only to the selected nodes which have values >0.01 (as an example).
Questions:
1) I had assumed that PRIVE%ADR(1)%P%R(I) extracts the node values from the private variables that match the test (e.g. (I).EQ.2D0) and the line I3D=I+NPOIN2*(IPLAN-1) finds the 3D node IDs for those matching values. After the code should apply the drag only to those specific nodes. Is this correct?
2) If not, are there alternative codes for applying the fortran codes to only the specific nodes? Reading the forum, I had assumed that my code was doing that anyway...
3) What is the test for finding out what values Telemac is reading from the private array? I've used some different print* arguments but I've not had any luck e.g.
print *,'PRIVE2D READ VALUES ',PRIVE%ADR(1)%P%R(I)
Thanks for your continued patience and advice!
DO I=1,NPOIN2
! IF (PRIVE%ADR(1)%P%R(I).GT.2.1) THEN
DO IPLAN=5,NPLAN
I3D = I+NPOIN2*(IPLAN-1)
NORM=SQRT(UN3%R(I3D)**2+VN3%R(I3D)**2+WN3%R(I3D)**2)
S1U%R(I3D)= 0.5D0 * AREA * NORM * CD
S1V%R(I3D)= 0.5D0 * AREA * NORM * CD
! S1W%R(I3D)= 0.5D0 *AREA * NORM * CD
ENDDO
! ENDIF
ENDDO