Problem about usr_drag.f

In usr_drag.f, Phase index M is changed as M_NP
But i define another M in the function.
I use the tfm model. When i compile the function, the error is:
“At line 1344 of file /mnt/e/tfm/usr_drag.f
Fortran runtime error: Index ‘0’ of dimension 2 of array ‘f_gs’ below lower bound of 1”
the line 1344 is"F_gs(IJK, M) = (ONE - UR_F_gs) * F_gs(IJK, M) + UR_F_gs * F_gstmp"
if i change the line 1344 as"F_gs(IJK, M_NP) = (ONE - UR_F_gs) * F_gs(IJK, M_NP) + UR_F_gs * F_gstmp", the error is:
“ERROR usr_drag.f:1360
ERROR 9999: The user-defined drag routine was invoked but this
generic error message exits. Either choose a different drag law
or correct mfix/model/usr_drag.f”
So i confused that how to change the function?

It doesn’t look like you are deleting the default code in /usr_drag.f which is marked “REMOVE THE FOLLOWING”

!- REMOVE THE FOLLOWING ---------------------------------------------->>

      lDgA = 0.0

      WRITE(ERR_MSG,9999)
      CALL LOG_ERROR()

 9999 FORMAT('ERROR 9999: The user-defined drag routine was invoked ', &
         'but this',/'generic error message exits. Either choose a ',  &
         'different drag law',/'or correct mfix/model/usr_drag.f')

!- END REMOVE --------------------------------------------------------<<
2 Likes

Yes! The problem is solved! Thank u!