tracer.F90 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. !#################################################################
  2. !
  3. !**** Global Atmospheric Tracer Model TM5-MP
  4. !
  5. ! purpose
  6. ! -------
  7. ! Solves the tracer continuitiy equation on an eulerian grid for
  8. ! an arbitrary no. of tracers.
  9. ! Perform advection, vertical transport, emissions, chemistry, deposition, ....
  10. !
  11. ! interface
  12. ! ---------
  13. ! main program for stand alone application.
  14. !
  15. ! method
  16. ! ------
  17. ! Initialize the model and then cycle continuously through
  18. ! the main model time loop.
  19. !
  20. ! reference
  21. ! ---------
  22. ! See the main website : www.phys.uu.nl/~tm5/
  23. !
  24. !### macro's #####################################################
  25. !
  26. #define TRACEBACK write (gol,'("in ",a," (",a,", line",i5,")")') rname, __FILE__, __LINE__; call goErr
  27. #define IF_NOTOK_RETURN(action) if (status/=0) then; TRACEBACK; action; return; end if
  28. #define IF_ERROR_RETURN(action) if (status> 0) then; TRACEBACK; action; return; end if
  29. !
  30. #include "tm5.inc"
  31. !
  32. !#################################################################
  33. program Tracer
  34. use GO, only : gol, goPr, goErr
  35. use GO, only : goExit
  36. use TM5, only : TM5_Comm_Init, TM5_Comm_Done, TM5_Comm_Abort
  37. use TM5, only : TM5_Model_Init, TM5_Model_Run, TM5_Model_Done
  38. implicit none
  39. ! --- const ---------------------------------------
  40. character(len=*), parameter :: rname = 'tracer'
  41. ! --- local ---------------------------------------
  42. integer :: status
  43. ! --- begin ---------------------------------------
  44. ! setup communication:
  45. call TM5_Comm_Init( status )
  46. if (status==0) then
  47. ! setup model:
  48. call TM5_Model_Init( status )
  49. if (status==0) then
  50. ! run model:
  51. call TM5_Model_Run( status )
  52. if (status==0) then
  53. ! done with model:
  54. call TM5_Model_Done( status )
  55. if (status==0) then
  56. ! done with communication:
  57. call TM5_Comm_Done( status )
  58. if (status==0) then
  59. ! clean exit with zero return code:
  60. call goExit(0)
  61. end if ! comm done ok
  62. end if ! model done ok
  63. end if ! model run ok
  64. end if ! model init ok
  65. ! emergency break with return code 1 :
  66. call TM5_Comm_Abort( 1, status )
  67. if (status/=0) then
  68. write (*,'("ERROR from communication abort")')
  69. ! try again to exit:
  70. call goExit(1)
  71. end if
  72. end if ! comm init ok
  73. end program Tracer