trcnam.F90 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  1. MODULE trcnam
  2. !!======================================================================
  3. !! *** MODULE trcnam ***
  4. !! TOP : Read and print options for the passive tracer run (namelist)
  5. !!======================================================================
  6. !! History : - ! 1996-11 (M.A. Foujols, M. Levy) original code
  7. !! - ! 1998-04 (M.A Foujols, L. Bopp) ahtrb0 for isopycnal mixing
  8. !! - ! 1999-10 (M.A. Foujols, M. Levy) separation of sms
  9. !! - ! 2000-07 (A. Estublier) add TVD and MUSCL : Tests on ndttrc
  10. !! - ! 2000-11 (M.A Foujols, E Kestenare) trcrat, ahtrc0 and aeivtr0
  11. !! - ! 2001-01 (E Kestenare) suppress ndttrc=1 for CEN2 and TVD schemes
  12. !! 1.0 ! 2005-03 (O. Aumont, A. El Moussaoui) F90
  13. !!----------------------------------------------------------------------
  14. #if defined key_top
  15. !!----------------------------------------------------------------------
  16. !! 'key_top' TOP models
  17. !!----------------------------------------------------------------------
  18. !! trc_nam : Read and print options for the passive tracer run (namelist)
  19. !!----------------------------------------------------------------------
  20. USE oce_trc ! shared variables between ocean and passive tracers
  21. USE trc ! passive tracers common variables
  22. USE trcnam_trp ! Transport namelist
  23. USE trcnam_pisces ! PISCES namelist
  24. USE trcnam_cfc ! CFC SMS namelist
  25. USE trcnam_c14b ! C14 SMS namelist
  26. USE trcnam_age ! AGE SMS namelist
  27. USE trcnam_my_trc ! MY_TRC SMS namelist
  28. USE trd_oce
  29. USE trdtrc_oce
  30. USE iom ! I/O manager
  31. IMPLICIT NONE
  32. PRIVATE
  33. PUBLIC trc_nam_run ! called in trcini
  34. PUBLIC trc_nam ! called in trcini
  35. !! * Substitutions
  36. # include "top_substitute.h90"
  37. !!----------------------------------------------------------------------
  38. !! NEMO/TOP 3.3 , NEMO Consortium (2010)
  39. !! $Id$
  40. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  41. !!----------------------------------------------------------------------
  42. CONTAINS
  43. SUBROUTINE trc_nam
  44. !!---------------------------------------------------------------------
  45. !! *** ROUTINE trc_nam ***
  46. !!
  47. !! ** Purpose : READ and PRINT options for the passive tracer run (namelist)
  48. !!
  49. !! ** Method : - read passive tracer namelist
  50. !! - read namelist of each defined SMS model
  51. !! ( (PISCES, CFC, MY_TRC )
  52. !!---------------------------------------------------------------------
  53. INTEGER :: jn ! dummy loop indice
  54. ! ! Parameters of the run
  55. IF( .NOT. lk_offline ) CALL trc_nam_run
  56. ! ! passive tracer informations
  57. CALL trc_nam_trc
  58. ! ! Parameters of additional diagnostics
  59. IF( .NOT. lk_iomput) CALL trc_nam_dia
  60. ! ! namelist of transport
  61. CALL trc_nam_trp
  62. IF( ln_rsttr ) ln_trcdta = .FALSE. ! restart : no need of clim data
  63. !
  64. IF( ln_trcdmp .OR. ln_trcdmp_clo ) ln_trcdta = .TRUE. ! damping : need to have clim data
  65. !
  66. IF( .NOT.ln_trcdta ) THEN
  67. ln_trc_ini(:) = .FALSE.
  68. ENDIF
  69. ! Call the ice module for tracers
  70. ! -------------------------------
  71. CALL trc_nam_ice
  72. ! namelist of SMS
  73. ! ---------------
  74. IF( lk_pisces ) THEN ; CALL trc_nam_pisces ! PISCES bio-model
  75. ELSE ; IF(lwp) WRITE(numout,*) ' PISCES not used'
  76. ENDIF
  77. IF( lk_my_trc ) THEN ; CALL trc_nam_my_trc ! MY_TRC tracers
  78. ELSE ; IF(lwp) WRITE(numout,*) ' MY_TRC not used'
  79. ENDIF
  80. IF( lk_cfc ) THEN ; CALL trc_nam_cfc ! CFC tracers
  81. ELSE ; IF(lwp) WRITE(numout,*) ' CFC not used'
  82. ENDIF
  83. IF( lk_c14b ) THEN ; CALL trc_nam_c14b ! C14 bomb tracers
  84. ELSE ; IF(lwp) WRITE(numout,*) ' C14 not used'
  85. ENDIF
  86. IF( lk_age ) THEN ; CALL trc_nam_age ! AGE tracer
  87. ELSE ; IF(lwp) WRITE(numout,*) ' AGE not used'
  88. ENDIF
  89. IF(lwp) THEN ! control print
  90. WRITE(numout,*)
  91. WRITE(numout,*) ' Namelist : namtrc'
  92. WRITE(numout,*) ' Read inputs data from file (y/n) ln_trcdta = ', ln_trcdta
  93. WRITE(numout,*) ' Damping of passive tracer (y/n) ln_trcdmp = ', ln_trcdmp
  94. WRITE(numout,*) ' Restoring of tracer on closed seas ln_trcdmp_clo = ', ln_trcdmp_clo
  95. WRITE(numout,*) ' '
  96. DO jn = 1, jptra
  97. WRITE(numout,*) ' tracer nb : ', jn, ' short name : ', ctrcnm(jn)
  98. END DO
  99. WRITE(numout,*) ' '
  100. ENDIF
  101. IF(lwp) THEN ! control print
  102. IF( ln_rsttr ) THEN
  103. WRITE(numout,*)
  104. WRITE(numout,*) ' Read a restart file for passive tracer : ', TRIM( cn_trcrst_in )
  105. WRITE(numout,*)
  106. ENDIF
  107. IF( ln_trcdta .AND. .NOT.ln_rsttr ) THEN
  108. WRITE(numout,*)
  109. WRITE(numout,*) ' Some of the passive tracers are initialised from climatologies '
  110. WRITE(numout,*)
  111. ENDIF
  112. IF( .NOT.ln_trcdta ) THEN
  113. WRITE(numout,*)
  114. WRITE(numout,*) ' All the passive tracers are initialised with constant values '
  115. WRITE(numout,*)
  116. ENDIF
  117. ENDIF
  118. rdttrc(:) = rdttra(:) * FLOAT( nn_dttrc ) ! vertical profile of passive tracer time-step
  119. IF(lwp) THEN ! control print
  120. WRITE(numout,*)
  121. WRITE(numout,*) ' Passive Tracer time step rdttrc = ', rdttrc(1)
  122. WRITE(numout,*)
  123. ENDIF
  124. !
  125. END SUBROUTINE trc_nam
  126. SUBROUTINE trc_nam_run
  127. !!---------------------------------------------------------------------
  128. !! *** ROUTINE trc_nam ***
  129. !!
  130. !! ** Purpose : read options for the passive tracer run (namelist)
  131. !!
  132. !!---------------------------------------------------------------------
  133. NAMELIST/namtrc_run/ nn_dttrc, nn_writetrc, ln_rsttr, nn_rsttr, ln_top_euler, &
  134. & cn_trcrst_indir, cn_trcrst_outdir, cn_trcrst_in, cn_trcrst_out
  135. INTEGER :: ios ! Local integer output status for namelist read
  136. !!---------------------------------------------------------------------
  137. IF(lwp) WRITE(numout,*) 'trc_nam : read the passive tracer namelists'
  138. IF(lwp) WRITE(numout,*) '~~~~~~~'
  139. CALL ctl_opn( numnat_ref, 'namelist_top_ref' , 'OLD' , 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
  140. CALL ctl_opn( numnat_cfg, 'namelist_top_cfg' , 'OLD' , 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
  141. IF(lwm) CALL ctl_opn( numont, 'output.namelist.top', 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE., 1 )
  142. REWIND( numnat_ref ) ! Namelist namtrc in reference namelist : Passive tracer variables
  143. READ ( numnat_ref, namtrc_run, IOSTAT = ios, ERR = 901)
  144. 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in reference namelist', lwp )
  145. REWIND( numnat_cfg ) ! Namelist namtrc in configuration namelist : Passive tracer variables
  146. READ ( numnat_cfg, namtrc_run, IOSTAT = ios, ERR = 902 )
  147. 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in configuration namelist', lwp )
  148. IF(lwm) WRITE ( numont, namtrc_run )
  149. ! computes the first time step of tracer model
  150. nittrc000 = nit000 + nn_dttrc - 1
  151. IF(lwp) THEN ! control print
  152. WRITE(numout,*)
  153. WRITE(numout,*) ' Namelist : namtrc_run'
  154. WRITE(numout,*) ' time step freq. for passive tracer nn_dttrc = ', nn_dttrc
  155. WRITE(numout,*) ' restart for passive tracer ln_rsttr = ', ln_rsttr
  156. WRITE(numout,*) ' control of time step for passive tracer nn_rsttr = ', nn_rsttr
  157. WRITE(numout,*) ' first time step for pass. trac. nittrc000 = ', nittrc000
  158. WRITE(numout,*) ' frequency of outputs for passive tracers nn_writetrc = ', nn_writetrc
  159. WRITE(numout,*) ' Use euler integration for TRC (y/n) ln_top_euler = ', ln_top_euler
  160. WRITE(numout,*) ' '
  161. ENDIF
  162. !
  163. END SUBROUTINE trc_nam_run
  164. SUBROUTINE trc_nam_ice
  165. !!---------------------------------------------------------------------
  166. !! *** ROUTINE trc_nam_ice ***
  167. !!
  168. !! ** Purpose : Read the namelist for the ice effect on tracers
  169. !!
  170. !! ** Method : -
  171. !!
  172. !!---------------------------------------------------------------------
  173. ! --- Variable declarations --- !
  174. INTEGER :: jn ! dummy loop indices
  175. INTEGER :: ios ! Local integer output status for namelist read
  176. ! --- Namelist declarations --- !
  177. TYPE(TRC_I_NML), DIMENSION(jptra) :: sn_tri_tracer
  178. NAMELIST/namtrc_ice/ nn_ice_tr, sn_tri_tracer
  179. IF(lwp) THEN
  180. WRITE(numout,*)
  181. WRITE(numout,*) 'trc_nam_ice : Read the namelist for trc_ice'
  182. WRITE(numout,*) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
  183. ENDIF
  184. IF( nn_timing == 1 ) CALL timing_start('trc_nam_ice')
  185. !
  186. REWIND( numnat_ref ) ! Namelist namtrc_ice in reference namelist : Passive tracer input data
  187. READ ( numnat_ref, namtrc_ice, IOSTAT = ios, ERR = 901)
  188. 901 IF( ios /= 0 ) CALL ctl_nam ( ios , ' namtrc_ice in reference namelist ', lwp )
  189. REWIND( numnat_cfg ) ! Namelist namtrc_ice in configuration namelist : Pisces external sources of nutrients
  190. READ ( numnat_cfg, namtrc_ice, IOSTAT = ios, ERR = 902 )
  191. 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_ice in configuration namelist', lwp )
  192. IF( lwp ) THEN
  193. WRITE(numout,*) ' '
  194. WRITE(numout,*) ' Sea ice tracers option (nn_ice_tr) : ', nn_ice_tr
  195. WRITE(numout,*) ' '
  196. ENDIF
  197. ! Assign namelist stuff
  198. DO jn = 1, jptra
  199. trc_ice_ratio(jn) = sn_tri_tracer(jn)%trc_ratio
  200. trc_ice_prescr(jn) = sn_tri_tracer(jn)%trc_prescr
  201. cn_trc_o (jn) = sn_tri_tracer(jn)%ctrc_o
  202. END DO
  203. IF( nn_timing == 1 ) CALL timing_stop('trc_nam_ice')
  204. !
  205. END SUBROUTINE trc_nam_ice
  206. SUBROUTINE trc_nam_trc
  207. !!---------------------------------------------------------------------
  208. !! *** ROUTINE trc_nam ***
  209. !!
  210. !! ** Purpose : read options for the passive tracer run (namelist)
  211. !!
  212. !!---------------------------------------------------------------------
  213. TYPE(PTRACER), DIMENSION(jptra) :: sn_tracer ! type of tracer for saving if not key_iomput
  214. !!
  215. NAMELIST/namtrc/ sn_tracer, ln_trcdta,ln_trcdmp, ln_trcdmp_clo
  216. INTEGER :: ios ! Local integer output status for namelist read
  217. INTEGER :: jn ! dummy loop indice
  218. !!---------------------------------------------------------------------
  219. IF(lwp) WRITE(numout,*)
  220. IF(lwp) WRITE(numout,*) 'trc_nam : read the passive tracer namelists'
  221. IF(lwp) WRITE(numout,*) '~~~~~~~'
  222. REWIND( numnat_ref ) ! Namelist namtrc in reference namelist : Passive tracer variables
  223. READ ( numnat_ref, namtrc, IOSTAT = ios, ERR = 901)
  224. 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in reference namelist', lwp )
  225. REWIND( numnat_cfg ) ! Namelist namtrc in configuration namelist : Passive tracer variables
  226. READ ( numnat_cfg, namtrc, IOSTAT = ios, ERR = 902 )
  227. 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in configuration namelist', lwp )
  228. IF(lwm) WRITE ( numont, namtrc )
  229. DO jn = 1, jptra
  230. ctrcnm (jn) = TRIM( sn_tracer(jn)%clsname )
  231. ctrcln (jn) = TRIM( sn_tracer(jn)%cllname )
  232. ctrcun (jn) = TRIM( sn_tracer(jn)%clunit )
  233. ln_trc_ini(jn) = sn_tracer(jn)%llinit
  234. ln_trc_wri(jn) = sn_tracer(jn)%llsave
  235. END DO
  236. END SUBROUTINE trc_nam_trc
  237. SUBROUTINE trc_nam_dia
  238. !!---------------------------------------------------------------------
  239. !! *** ROUTINE trc_nam_dia ***
  240. !!
  241. !! ** Purpose : read options for the passive tracer diagnostics
  242. !!
  243. !! ** Method : - read passive tracer namelist
  244. !! - read namelist of each defined SMS model
  245. !! ( (PISCES, CFC, MY_TRC )
  246. !!---------------------------------------------------------------------
  247. INTEGER :: ierr
  248. #if defined key_trdmxl_trc || defined key_trdtrc
  249. NAMELIST/namtrc_trd/ nn_trd_trc, nn_ctls_trc, rn_ucf_trc, &
  250. & ln_trdmxl_trc_restart, ln_trdmxl_trc_instant, &
  251. & cn_trdrst_trc_in, cn_trdrst_trc_out, ln_trdtrc
  252. #endif
  253. NAMELIST/namtrc_dia/ ln_diatrc, ln_diabio, nn_writedia, nn_writebio
  254. INTEGER :: jn
  255. INTEGER :: ios ! Local integer output status for namelist read
  256. !!---------------------------------------------------------------------
  257. IF(lwp) WRITE(numout,*)
  258. IF(lwp) WRITE(numout,*) 'trc_nam_dia : read the passive tracer diagnostics options'
  259. IF(lwp) WRITE(numout,*) '~~~~~~~'
  260. IF(lwp) WRITE(numout,*)
  261. IF(lwp) WRITE(numout,*) 'trc_nam_dia : read the passive tracer diagnostics options'
  262. IF(lwp) WRITE(numout,*) '~~~~~~~'
  263. REWIND( numnat_ref ) ! Namelist namtrc_dia in reference namelist : Passive tracer diagnostics
  264. READ ( numnat_ref, namtrc_dia, IOSTAT = ios, ERR = 903)
  265. 903 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dia in reference namelist', lwp )
  266. REWIND( numnat_cfg ) ! Namelist namtrc_dia in configuration namelist : Passive tracer diagnostics
  267. READ ( numnat_cfg, namtrc_dia, IOSTAT = ios, ERR = 904 )
  268. 904 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dia in configuration namelist', lwp )
  269. IF(lwm) WRITE ( numont, namtrc_dia )
  270. IF(lwp) THEN
  271. WRITE(numout,*)
  272. WRITE(numout,*)
  273. WRITE(numout,*) ' Namelist : namtrc_dia'
  274. WRITE(numout,*) ' save additionnal diagnostics arrays ln_diatrc = ', ln_diatrc
  275. WRITE(numout,*) ' save additionnal biology diagnostics arrays ln_diabio = ', ln_diabio
  276. WRITE(numout,*) ' frequency of outputs for additional arrays nn_writedia = ', nn_writedia
  277. WRITE(numout,*) ' frequency of outputs for biological trends nn_writebio = ', nn_writebio
  278. WRITE(numout,*) ' '
  279. ENDIF
  280. IF( ln_diatrc ) THEN
  281. ALLOCATE( trc2d(jpi,jpj,jpdia2d), trc3d(jpi,jpj,jpk,jpdia3d), &
  282. & ctrc2d(jpdia2d), ctrc2l(jpdia2d), ctrc2u(jpdia2d) , &
  283. & ctrc3d(jpdia3d), ctrc3l(jpdia3d), ctrc3u(jpdia3d) , STAT = ierr )
  284. IF( ierr > 0 ) CALL ctl_stop( 'STOP', 'trcnam: unable to allocate add. diag. array' )
  285. !
  286. trc2d(:,:,: ) = 0._wp ; ctrc2d(:) = ' ' ; ctrc2l(:) = ' ' ; ctrc2u(:) = ' '
  287. trc3d(:,:,:,:) = 0._wp ; ctrc3d(:) = ' ' ; ctrc3l(:) = ' ' ; ctrc3u(:) = ' '
  288. !
  289. ENDIF
  290. IF( ln_diabio .OR. l_trdtrc ) THEN
  291. ALLOCATE( trbio (jpi,jpj,jpk,jpdiabio) , &
  292. & ctrbio(jpdiabio), ctrbil(jpdiabio), ctrbiu(jpdiabio), STAT = ierr )
  293. IF( ierr > 0 ) CALL ctl_stop( 'STOP', 'trcnam: unable to allocate bio. diag. array' )
  294. !
  295. trbio(:,:,:,:) = 0._wp ; ctrbio(:) = ' ' ; ctrbil(:) = ' ' ; ctrbiu(:) = ' '
  296. !
  297. ENDIF
  298. #if defined key_trdmxl_trc || defined key_trdtrc
  299. REWIND( numnat_ref ) ! Namelist namtrc_trd in reference namelist : Passive tracer trends
  300. READ ( numnat_ref, namtrc_trd, IOSTAT = ios, ERR = 905)
  301. 905 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_trd in reference namelist', lwp )
  302. REWIND( numnat_cfg ) ! Namelist namtrc_trd in configuration namelist : Passive tracer trends
  303. READ ( numnat_cfg, namtrc_trd, IOSTAT = ios, ERR = 906 )
  304. 906 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_trd in configuration namelist', lwp )
  305. IF(lwm) WRITE ( numont, namtrc_trd )
  306. IF(lwp) THEN
  307. WRITE(numout,*)
  308. WRITE(numout,*) ' trd_mxl_trc_init : read namelist namtrc_trd '
  309. WRITE(numout,*) ' ~~~~~~~~~~~~~~~~ '
  310. WRITE(numout,*) ' * frequency of trends diagnostics nn_trd_trc = ', nn_trd_trc
  311. WRITE(numout,*) ' * control surface type nn_ctls_trc = ', nn_ctls_trc
  312. WRITE(numout,*) ' * restart for ML diagnostics ln_trdmxl_trc_restart = ', ln_trdmxl_trc_restart
  313. WRITE(numout,*) ' * flag to diagnose trends of '
  314. WRITE(numout,*) ' instantantaneous or mean ML T/S ln_trdmxl_trc_instant = ', ln_trdmxl_trc_instant
  315. WRITE(numout,*) ' * unit conversion factor rn_ucf_trc = ', rn_ucf_trc
  316. DO jn = 1, jptra
  317. IF( ln_trdtrc(jn) ) WRITE(numout,*) ' compute ML trends for tracer number :', jn
  318. END DO
  319. ENDIF
  320. #endif
  321. !
  322. END SUBROUTINE trc_nam_dia
  323. #else
  324. !!----------------------------------------------------------------------
  325. !! Dummy module : No passive tracer
  326. !!----------------------------------------------------------------------
  327. CONTAINS
  328. SUBROUTINE trc_nam ! Empty routine
  329. END SUBROUTINE trc_nam
  330. SUBROUTINE trc_nam_run ! Empty routine
  331. END SUBROUTINE trc_nam_run
  332. #endif
  333. !!----------------------------------------------------------------------
  334. !! NEMO/TOP 3.3 , NEMO Consortium (2010)
  335. !! $Id$
  336. !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
  337. !!======================================================================
  338. END MODULE trcnam