There are a few things to consider about your code:
You are declaring a variable, ZM, with intent INOUT, that is, it is supposed to enter (INTENT(IN)) MARUTI, be used in it, and return to tomawac (INTENT(OUT)).
First problem here is that you created this variable, so it does not exist in tomawac, therefore it should be INTENT(OUT) only.
Then there is another problem: the variables passed from tomawac to MARUTI and back to tomawac must be on the call of the subroutine:
SUBROUTINE MARUTI! VV
&(X,Y,NPOIN,NMAR,BINMAR,NBOR,NPTFR,AT,DDC,TV1,TV2,Z1,Z2,ZM)
But this brings up one more problem: You would have to modify every line that calls MARUTI and add this variable; then you would need to declare ZM in each of the subroutines that call MARUTI. This would make a big mess in your code. Definitely not recommended.
Your options:
- Modify your code so that you assign the values of Z1 and Z2 an the times TV1 and TV2, respectively, so that TOMAWAC will interpolate in between.
- Move your code to ANAMAR, as Mrs. Claire did. There the array ZM already exists and it is a single value in time, so I think it will be easier to implement.
I, particularly, would go with the second option mainly because I did not find out where and how the times TV1 and TV2 are calculated, so ANAMAR would be a more certain approach.
TL;DR: Move your code to ANAMAR that it will probably work better than in MARUTI.
P.S.: Another problem in your code is that in the loop (DO IP= 1,NPOIN), you are assigning "ZM(NPOIN)=-ZF+Z1". But here NPOIN is constant, not the loop iterator. You would have to change to IP.
Regards,
Phelype