Thankyou Leballeur.
I had looped through the conversion, but the zeroes seemed to be the problem.
I had another crack at it today and discovered that the code was working but when using the logical IF(ID.NE.0) the output "non-zero" array only contained one repeated value.
However, comparing the values in the converted array against the non-zero array using a write command, the value in the non-zero array doesn't match any value in the converted array!
i.e. the nodes are converted successfully. An array is produced with converted node IDs and zeroes. When a logical test is applied to index the on-zero values I get a value not-related to the converted values.
For example, sample of values from:
Converted array:
12176 Conversion
12173 Conversion
12181 Conversion
12184 Conversion
12183 Conversion
12191 Conversion
12196 Conversion
Non-zero array:
12187 Node
12187 Node
12187 Node
12187 Node
12187 Node
12187 Node
12187 Node
12187 Node
12187 Node
12187 Node
12187 Node
12187 Node
12187 Node
I tried other approaches to removing zeroes such as IDSR1 = PACK(IDSR,IDSR /= 0) and using the logical test in its separate loop,but the result was the same.
Is there an obvious error in my code that might result in such an issue?
My code:
OPEN(12,FILE='../0.1_SER.txt')
DO I=1,8189
READ(12,*) SEID(I), SEA(I)
! write(*,*)I, SEID(I), SEA(I)
END DO
CLOSE(12)
DO I = 1,8189
IDSE = GLOBAL_TO_LOCAL_POINT(SEID(I),MESH2D) !Convert global to local
write(*,*)IDSE(I),'Conversion'
ENDDO
DO I = 1, 8189
IF (IDSE(I).NE.0) THEN !index non-zero values
I1=IDSE(I)
write(*,*)I1,'Node'
A = 24.3816D0
DO IPLAN = NPLAN-29,NPLAN !for layers at that node
I3D = I11+NPOIN2*(IPLAN-1) !get the 3D node IDs
...