Hi Christoph
Apparently, I still can't figure out what went wrong with my model. As a little reminder, the problem always occurs at this line in my dragfo subroutine:
IF(IPID.EQ.DDPID(I,IANGLE))THEN
which IANGLE comes from the following equation:
IANGLE=INT(ALPHA+0.5D0)
This is where it gets interesting. Because ALPHA is NaN. ALPHA, comes from the following equation:
ALPHA=-ATAN2(UTECY,UTECX)*RTD
When I traced It back, UTECY and UTECX are also NaNs. Tracing back, UTECs equations are:
UTECX=U%R(N1)*DET1*SURDET+U%R(N2)*DET2*SURDET+U%R(N3)*DET3*SURDET
UTECY=V%R(N1)*DET1*SURDET+V%R(N2)*DET2*SURDET+V%R(N3)*DET3*SURDET
I checked DET1, DET2, DET3, and SURDET, they all have valid numbers.
However, when I run the command "P U%R(N1)""P U%R(N2)""P U%R(N3)" and their V%R counterparts in gdb, the result for each variable is 0. This is the last tracing of NaN which no longer shows NaN. Thus I figure there is something wrong with the UTECX and UTECY equation.
But I don't know what this implies. Does -ATAN2 not work when both values of the variables are zero? Does the angle or the speed of velocity at this particular time step not calculatable?
Also, the value of IANGLE is exaggeratingly big with -2147483648.
I need your guidance and insights on this one.
Thank you.