As stated already in the comments, your program has many code style problems (wrong intentation, …) as well as not using best Fortran practises (e.g. implicit none
). Your problem can be solved by trivial usage of a debugger.
An obvious problem is that you are using uninitialized variables in the functions:
subroutine f(x,y,fx,fy)
:rho, mu, R
in calculation of fx and fy, which produces NaNfunction H()
:ome, rho, mu
, …
and similarly on other places
solved fortran code do not cycle