trdini.F90 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. MODULE trdini
  2. !!======================================================================
  3. !! *** MODULE trdini ***
  4. !! Ocean diagnostics: ocean tracers and dynamic trends
  5. !!=====================================================================
  6. !! History : 3.5 ! 2012-02 (G. Madec) add 3D trends output for T, S, U, V, PE and KE
  7. !!----------------------------------------------------------------------
  8. !!----------------------------------------------------------------------
  9. !! trd_init : initialization step
  10. !!----------------------------------------------------------------------
  11. USE dom_oce ! ocean domain
  12. USE trd_oce ! trends: ocean variables
  13. USE trdken ! trends: 3D kinetic energy
  14. USE trdpen ! trends: 3D potential energy
  15. USE trdglo ! trends: global domain averaged tracers and dynamics
  16. USE trdmxl ! trends: mixed layer averaged trends (tracer only)
  17. USE trdvor ! trends: vertical averaged vorticity
  18. USE in_out_manager ! I/O manager
  19. USE lib_mpp ! MPP library
  20. IMPLICIT NONE
  21. PRIVATE
  22. PUBLIC trd_init ! called by nemogcm.F90 module
  23. !! * Substitutions
  24. # include "domzgr_substitute.h90"
  25. # include "vectopt_loop_substitute.h90"
  26. !!----------------------------------------------------------------------
  27. !! NEMO/OPA 3.3 , NEMO Consortium (2010)
  28. !! $Id: trdini.F90 3977 2017-02-20 14:03:23Z ufla $
  29. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  30. !!----------------------------------------------------------------------
  31. CONTAINS
  32. SUBROUTINE trd_init
  33. !!----------------------------------------------------------------------
  34. !! *** ROUTINE trd_init ***
  35. !!
  36. !! ** Purpose : Initialization of trend diagnostics
  37. !!----------------------------------------------------------------------
  38. INTEGER :: ios ! local integer
  39. !!
  40. NAMELIST/namtrd/ ln_dyn_trd, ln_KE_trd, ln_vor_trd, ln_dyn_mxl, &
  41. & ln_tra_trd, ln_PE_trd, ln_glo_trd, ln_tra_mxl, nn_trd
  42. !!----------------------------------------------------------------------
  43. !
  44. REWIND( numnam_ref ) ! Namelist namtrd in reference namelist : trends diagnostic
  45. READ ( numnam_ref, namtrd, IOSTAT = ios, ERR = 901 )
  46. 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrd in reference namelist', lwp )
  47. !
  48. REWIND( numnam_cfg ) ! Namelist namtrd in configuration namelist : trends diagnostic
  49. READ ( numnam_cfg, namtrd, IOSTAT = ios, ERR = 902 )
  50. 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrd in configuration namelist', lwp )
  51. IF(lwm) WRITE( numond, namtrd )
  52. !
  53. IF(lwp) THEN ! control print
  54. WRITE(numout,*)
  55. WRITE(numout,*) ' trd_init : Momentum/Tracers trends'
  56. WRITE(numout,*) ' ~~~~~~~~~~'
  57. WRITE(numout,*) ' Namelist namtrd : set trends parameters'
  58. WRITE(numout,*) ' global domain averaged dyn & tra trends ln_glo_trd = ', ln_glo_trd
  59. WRITE(numout,*) ' U & V trends: 3D output ln_dyn_trd = ', ln_dyn_trd
  60. WRITE(numout,*) ' U & V trends: Mixed Layer averaged ln_dyn_mxl = ', ln_dyn_mxl
  61. WRITE(numout,*) ' T & S trends: 3D output ln_tra_trd = ', ln_tra_trd
  62. WRITE(numout,*) ' T & S trends: Mixed Layer averaged ln_tra_mxl = ', ln_tra_mxl
  63. WRITE(numout,*) ' Kinetic Energy trends ln_KE_trd = ', ln_KE_trd
  64. WRITE(numout,*) ' Potential Energy trends ln_PE_trd = ', ln_PE_trd
  65. WRITE(numout,*) ' Barotropic vorticity trends ln_vor_trd = ', ln_vor_trd
  66. !
  67. WRITE(numout,*) ' frequency of trends diagnostics (glo) nn_trd = ', nn_trd
  68. ENDIF
  69. !
  70. ! ! trend extraction flags
  71. l_trdtra = .FALSE. ! tracers
  72. IF ( ln_tra_trd .OR. ln_PE_trd .OR. ln_tra_mxl .OR. &
  73. & ln_glo_trd ) l_trdtra = .TRUE.
  74. !
  75. l_trddyn = .FALSE. ! momentum
  76. IF ( ln_dyn_trd .OR. ln_KE_trd .OR. ln_dyn_mxl .OR. &
  77. & ln_vor_trd .OR. ln_glo_trd ) l_trddyn = .TRUE.
  78. !
  79. !!gm check the stop below
  80. IF( ln_dyn_mxl ) CALL ctl_stop( 'ML diag on momentum are not yet coded we stop' )
  81. !
  82. !!gm end
  83. IF( ln_tra_mxl .OR. ln_vor_trd ) CALL ctl_stop( 'ML tracer and Barotropic vorticity diags are still using old IOIPSL' )
  84. !!gm end
  85. !
  86. ! IF( lk_vvl .AND. ( l_trdtra .OR. l_trddyn ) ) CALL ctl_stop( 'trend diagnostics with variable volume not validated' )
  87. !!gm : Potential BUG : 3D output only for vector invariant form! add a ctl_stop or code the flux form case
  88. !!gm : bug/pb for vertical advection of tracer in vvl case: add T.dt[eta] in the output...
  89. ! ! diagnostic initialization
  90. IF( ln_glo_trd ) CALL trd_glo_init ! global domain averaged trends
  91. IF( ln_tra_mxl ) CALL trd_mxl_init ! mixed-layer trends
  92. IF( ln_vor_trd ) CALL trd_vor_init ! barotropic vorticity trends
  93. IF( ln_KE_trd ) CALL trd_ken_init ! 3D Kinetic energy trends
  94. IF( ln_PE_trd ) CALL trd_pen_init ! 3D Potential energy trends
  95. !
  96. END SUBROUTINE trd_init
  97. !!======================================================================
  98. END MODULE trdini