New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
trcnam.F90 in branches/2015/dev_r5204_CNRS_PISCES_dcy/NEMOGCM/NEMO/TOP_SRC – NEMO

source: branches/2015/dev_r5204_CNRS_PISCES_dcy/NEMOGCM/NEMO/TOP_SRC/trcnam.F90 @ 5367

Last change on this file since 5367 was 5367, checked in by cetlod, 9 years ago

NEMOGCM_dev_r5204_CNRS_PISCES_dcy : merge in dev_r5171_CNRS_LIM3_seaicebgc

  • Property svn:keywords set to Id
File size: 18.0 KB
Line 
1MODULE 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_my_trc     ! MY_TRC SMS namelist
27   USE trd_oce       
28   USE trdtrc_oce
29   USE iom               ! I/O manager
30
31   IMPLICIT NONE
32   PRIVATE
33
34   PUBLIC trc_nam_run  ! called in trcini
35   PUBLIC trc_nam      ! called in trcini
36
37   !! * Substitutions
38#  include "top_substitute.h90"
39   !!----------------------------------------------------------------------
40   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
41   !! $Id$
42   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
43   !!----------------------------------------------------------------------
44
45CONTAINS
46
47
48   SUBROUTINE trc_nam
49      !!---------------------------------------------------------------------
50      !!                     ***  ROUTINE trc_nam  ***
51      !!
52      !! ** Purpose :   READ and PRINT options for the passive tracer run (namelist)
53      !!
54      !! ** Method  : - read passive tracer namelist
55      !!              - read namelist of each defined SMS model
56      !!                ( (PISCES, CFC, MY_TRC )
57      !!---------------------------------------------------------------------
58      INTEGER  ::   jn                  ! dummy loop indice
59      !                                        !   Parameters of the run
60      IF( .NOT. lk_offline ) CALL trc_nam_run
61     
62      !                                        !  passive tracer informations
63      CALL trc_nam_trc
64     
65      !                                        !   Parameters of additional diagnostics
66      CALL trc_nam_dia
67
68      !                                        !   namelist of transport
69      CALL trc_nam_trp
70
71
72      IF( ln_rsttr )                      ln_trcdta = .FALSE.   ! restart : no need of clim data
73      !
74      IF( ln_trcdmp .OR. ln_trcdmp_clo )  ln_trcdta = .TRUE.   ! damping : need to have clim data
75      !
76      IF( .NOT.ln_trcdta ) THEN
77         ln_trc_ini(:) = .FALSE.
78      ENDIF
79
80     IF(lwp) THEN                   ! control print
81         WRITE(numout,*)
82         WRITE(numout,*) ' Namelist : namtrc'
83         WRITE(numout,*) '   Read inputs data from file (y/n)             ln_trcdta     = ', ln_trcdta
84         WRITE(numout,*) '   Damping of passive tracer (y/n)              ln_trcdmp     = ', ln_trcdmp
85         WRITE(numout,*) '   Restoring of tracer on closed seas           ln_trcdmp_clo = ', ln_trcdmp_clo
86         WRITE(numout,*) ' '
87         DO jn = 1, jptra
88            WRITE(numout,*) '  tracer nb : ', jn, '    short name : ', ctrcnm(jn)
89         END DO
90         WRITE(numout,*) ' '
91      ENDIF
92
93      IF(lwp) THEN                   ! control print
94         IF( ln_rsttr ) THEN
95            WRITE(numout,*)
96            WRITE(numout,*) '  Read a restart file for passive tracer : ', TRIM( cn_trcrst_in )
97            WRITE(numout,*)
98         ENDIF
99         IF( ln_trcdta .AND. .NOT.ln_rsttr ) THEN
100            WRITE(numout,*)
101            WRITE(numout,*) '  Some of the passive tracers are initialised from climatologies '
102            WRITE(numout,*)
103         ENDIF
104         IF( .NOT.ln_trcdta ) THEN
105            WRITE(numout,*)
106            WRITE(numout,*) '  All the passive tracers are initialised with constant values '
107            WRITE(numout,*)
108         ENDIF
109      ENDIF
110
111     
112      rdttrc(:) = rdttra(:) * FLOAT( nn_dttrc )   ! vertical profile of passive tracer time-step
113 
114      IF(lwp) THEN                   ! control print
115        WRITE(numout,*) 
116        WRITE(numout,*) '    Passive Tracer  time step    rdttrc  = ', rdttrc(1)
117        WRITE(numout,*) 
118      ENDIF
119
120
121#if defined key_trdmxl_trc || defined key_trdtrc
122
123         REWIND( numnat_ref )              ! Namelist namtrc_trd in reference namelist : Passive tracer trends
124         READ  ( numnat_ref, namtrc_trd, IOSTAT = ios, ERR = 905)
125905      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_trd in reference namelist', lwp )
126
127         REWIND( numnat_cfg )              ! Namelist namtrc_trd in configuration namelist : Passive tracer trends
128         READ  ( numnat_cfg, namtrc_trd, IOSTAT = ios, ERR = 906 )
129906      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_trd in configuration namelist', lwp )
130         IF(lwm) WRITE ( numont, namtrc_trd )
131
132         IF(lwp) THEN
133            WRITE(numout,*)
134            WRITE(numout,*) ' trd_mxl_trc_init : read namelist namtrc_trd                    '
135            WRITE(numout,*) ' ~~~~~~~~~~~~~~~~                                               '
136            WRITE(numout,*) '   * frequency of trends diagnostics   nn_trd_trc             = ', nn_trd_trc
137            WRITE(numout,*) '   * control surface type              nn_ctls_trc            = ', nn_ctls_trc
138            WRITE(numout,*) '   * restart for ML diagnostics        ln_trdmxl_trc_restart  = ', ln_trdmxl_trc_restart
139            WRITE(numout,*) '   * flag to diagnose trends of                                 '
140            WRITE(numout,*) '     instantantaneous or mean ML T/S   ln_trdmxl_trc_instant  = ', ln_trdmxl_trc_instant
141            WRITE(numout,*) '   * unit conversion factor            rn_ucf_trc             = ', rn_ucf_trc
142            DO jn = 1, jptra
143               IF( ln_trdtrc(jn) ) WRITE(numout,*) '    compute ML trends for tracer number :', jn
144            END DO
145         ENDIF
146#endif
147
148
149      ! Call the ice module for tracers
150      ! -------------------------------
151      CALL trc_nam_ice
152
153      ! namelist of SMS
154      ! ---------------     
155      IF( lk_pisces  ) THEN   ;   CALL trc_nam_pisces      ! PISCES  bio-model
156      ELSE                    ;   IF(lwp) WRITE(numout,*) '          PISCES not used'
157      ENDIF
158
159      IF( lk_cfc     ) THEN   ;   CALL trc_nam_cfc         ! CFC     tracers
160      ELSE                    ;   IF(lwp) WRITE(numout,*) '          CFC not used'
161      ENDIF
162
163      IF( lk_c14b     ) THEN   ;   CALL trc_nam_c14b         ! C14 bomb     tracers
164      ELSE                    ;   IF(lwp) WRITE(numout,*) '          C14 not used'
165      ENDIF
166
167      IF( lk_my_trc  ) THEN   ;   CALL trc_nam_my_trc      ! MY_TRC  tracers
168      ELSE                    ;   IF(lwp) WRITE(numout,*) '          MY_TRC not used'
169      ENDIF
170      !
171   END SUBROUTINE trc_nam
172
173   SUBROUTINE trc_nam_run
174      !!---------------------------------------------------------------------
175      !!                     ***  ROUTINE trc_nam  ***
176      !!
177      !! ** Purpose :   read options for the passive tracer run (namelist)
178      !!
179      !!---------------------------------------------------------------------
180      NAMELIST/namtrc_run/ nn_dttrc, nn_writetrc, ln_rsttr, nn_rsttr, ln_top_euler, &
181        &                  cn_trcrst_in, cn_trcrst_out
182
183      INTEGER  ::   ios                 ! Local integer output status for namelist read
184
185      !!---------------------------------------------------------------------
186
187
188      IF(lwp) WRITE(numout,*) 'trc_nam : read the passive tracer namelists'
189      IF(lwp) WRITE(numout,*) '~~~~~~~'
190
191      CALL ctl_opn( numnat_ref, 'namelist_top_ref'   , 'OLD'    , 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
192      CALL ctl_opn( numnat_cfg, 'namelist_top_cfg'   , 'OLD'    , 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
193      IF(lwm) CALL ctl_opn( numont, 'output.namelist.top', 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE., 1 )
194
195      REWIND( numnat_ref )              ! Namelist namtrc in reference namelist : Passive tracer variables
196      READ  ( numnat_ref, namtrc_run, IOSTAT = ios, ERR = 901)
197901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in reference namelist', lwp )
198
199      REWIND( numnat_cfg )              ! Namelist namtrc in configuration namelist : Passive tracer variables
200      READ  ( numnat_cfg, namtrc_run, IOSTAT = ios, ERR = 902 )
201902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in configuration namelist', lwp )
202      IF(lwm) WRITE ( numont, namtrc_run )
203
204      !  computes the first time step of tracer model
205      nittrc000 = nit000 + nn_dttrc - 1
206
207      IF(lwp) THEN                   ! control print
208         WRITE(numout,*)
209         WRITE(numout,*) ' Namelist : namtrc_run'
210         WRITE(numout,*) '   time step freq. for passive tracer           nn_dttrc      = ', nn_dttrc
211         WRITE(numout,*) '   restart  for passive tracer                  ln_rsttr      = ', ln_rsttr
212         WRITE(numout,*) '   control of time step for passive tracer      nn_rsttr      = ', nn_rsttr
213         WRITE(numout,*) '   first time step for pass. trac.              nittrc000     = ', nittrc000
214         WRITE(numout,*) '   frequency of outputs for passive tracers     nn_writetrc   = ', nn_writetrc 
215         WRITE(numout,*) '   Use euler integration for TRC (y/n)          ln_top_euler  = ', ln_top_euler
216         WRITE(numout,*) ' '
217      ENDIF
218      !
219    END SUBROUTINE trc_nam_run
220
221   SUBROUTINE trc_nam_ice
222      !!---------------------------------------------------------------------
223      !!                     ***  ROUTINE trc_nam_ice ***
224      !!
225      !! ** Purpose :   Read the namelist for the ice effect on tracers
226      !!
227      !! ** Method  : -
228      !!
229      !!---------------------------------------------------------------------
230      ! --- Variable declarations --- !
231      INTEGER :: jn      ! dummy loop indices
232      INTEGER :: ios     ! Local integer output status for namelist read
233
234      ! --- Namelist declarations --- !
235      TYPE(TRC_I_NML), DIMENSION(jptra) :: sn_tri_tracer
236      NAMELIST/namtrc_ice/ nn_ice_tr, sn_tri_tracer
237
238      IF(lwp) THEN
239         WRITE(numout,*)
240         WRITE(numout,*) 'trc_nam_ice : Read the namelist for trc_ice'
241         WRITE(numout,*) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
242      ENDIF
243
244      IF( nn_timing == 1 )  CALL timing_start('trc_nam_ice')
245
246      !
247      REWIND( numnat_ref )              ! Namelist namtrc_ice in reference namelist : Passive tracer input data
248      READ  ( numnat_ref, namtrc_ice, IOSTAT = ios, ERR = 901)
249 901  IF( ios /= 0 ) CALL ctl_nam ( ios , ' namtrc_ice in reference namelist ', lwp )
250
251      REWIND( numnat_cfg )              ! Namelist namtrc_ice in configuration namelist : Pisces external sources of nutrients
252      READ  ( numnat_cfg, namtrc_ice, IOSTAT = ios, ERR = 902 )
253 902  IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_ice in configuration namelist', lwp )
254
255      WRITE(numout,*) ' '
256      WRITE(numout,*) ' Sea ice tracers option (nn_ice_tr) : ', nn_ice_tr
257      WRITE(numout,*) ' '
258
259      ! Assign namelist stuff
260      DO jn = 1, jptra
261         trc_ice_ratio(jn)  = sn_tri_tracer(jn)%trc_ratio
262         trc_ice_prescr(jn) = sn_tri_tracer(jn)%trc_prescr
263         cn_trc_o      (jn) = sn_tri_tracer(jn)%ctrc_o
264      END DO
265
266      IF( nn_timing == 1 )   CALL timing_stop('trc_nam_ice')
267      !
268   END SUBROUTINE trc_nam_ice
269
270   SUBROUTINE trc_nam_trc
271      !!---------------------------------------------------------------------
272      !!                     ***  ROUTINE trc_nam  ***
273      !!
274      !! ** Purpose :   read options for the passive tracer run (namelist)
275      !!
276      !!---------------------------------------------------------------------
277      TYPE(PTRACER), DIMENSION(jptra) :: sn_tracer  ! type of tracer for saving if not key_iomput
278      !!
279      NAMELIST/namtrc/ sn_tracer, ln_trcdta,ln_trcdmp, ln_trcdmp_clo
280 
281      INTEGER  ::   ios                 ! Local integer output status for namelist read
282      INTEGER  ::   jn                  ! dummy loop indice
283      !!---------------------------------------------------------------------
284      IF(lwp) WRITE(numout,*)
285      IF(lwp) WRITE(numout,*) 'trc_nam : read the passive tracer namelists'
286      IF(lwp) WRITE(numout,*) '~~~~~~~'
287
288
289      REWIND( numnat_ref )              ! Namelist namtrc in reference namelist : Passive tracer variables
290      READ  ( numnat_ref, namtrc, IOSTAT = ios, ERR = 901)
291901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in reference namelist', lwp )
292
293      REWIND( numnat_cfg )              ! Namelist namtrc in configuration namelist : Passive tracer variables
294      READ  ( numnat_cfg, namtrc, IOSTAT = ios, ERR = 902 )
295902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in configuration namelist', lwp )
296      IF(lwm) WRITE ( numont, namtrc )
297
298      DO jn = 1, jptra
299         ctrcnm    (jn) = TRIM( sn_tracer(jn)%clsname )
300         ctrcln    (jn) = TRIM( sn_tracer(jn)%cllname )
301         ctrcun    (jn) = TRIM( sn_tracer(jn)%clunit  )
302         ln_trc_ini(jn) =       sn_tracer(jn)%llinit
303         ln_trc_wri(jn) =       sn_tracer(jn)%llsave
304      END DO
305     
306    END SUBROUTINE trc_nam_trc
307
308
309   SUBROUTINE trc_nam_dia
310      !!---------------------------------------------------------------------
311      !!                     ***  ROUTINE trc_nam_dia  ***
312      !!
313      !! ** Purpose :   read options for the passive tracer diagnostics
314      !!
315      !! ** Method  : - read passive tracer namelist
316      !!              - read namelist of each defined SMS model
317      !!                ( (PISCES, CFC, MY_TRC )
318      !!---------------------------------------------------------------------
319      INTEGER ::  ierr
320#if defined key_trdmxl_trc  || defined key_trdtrc
321      NAMELIST/namtrc_trd/ nn_trd_trc, nn_ctls_trc, rn_ucf_trc, &
322         &                ln_trdmxl_trc_restart, ln_trdmxl_trc_instant, &
323         &                cn_trdrst_trc_in, cn_trdrst_trc_out, ln_trdtrc
324#endif
325      NAMELIST/namtrc_dia/ ln_diatrc, ln_diabio, nn_writedia, nn_writebio
326
327      INTEGER  ::   ios                 ! Local integer output status for namelist read
328      !!---------------------------------------------------------------------
329
330      IF(lwp) WRITE(numout,*) 
331      IF(lwp) WRITE(numout,*) 'trc_nam_dia : read the passive tracer diagnostics options'
332      IF(lwp) WRITE(numout,*) '~~~~~~~'
333
334      IF(lwp) WRITE(numout,*)
335      IF(lwp) WRITE(numout,*) 'trc_nam_dia : read the passive tracer diagnostics options'
336      IF(lwp) WRITE(numout,*) '~~~~~~~'
337
338      REWIND( numnat_ref )              ! Namelist namtrc_dia in reference namelist : Passive tracer diagnostics
339      READ  ( numnat_ref, namtrc_dia, IOSTAT = ios, ERR = 903)
340903   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dia in reference namelist', lwp )
341
342      REWIND( numnat_cfg )              ! Namelist namtrc_dia in configuration namelist : Passive tracer diagnostics
343      READ  ( numnat_cfg, namtrc_dia, IOSTAT = ios, ERR = 904 )
344904   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dia in configuration namelist', lwp )
345      IF(lwm) WRITE ( numont, namtrc_dia )
346
347      IF(lwp) THEN
348         WRITE(numout,*)
349         WRITE(numout,*)
350         WRITE(numout,*) ' Namelist : namtrc_dia'
351         WRITE(numout,*) '    save additionnal diagnostics arrays         ln_diatrc   = ', ln_diatrc
352         WRITE(numout,*) '    save additionnal biology diagnostics arrays ln_diabio   = ', ln_diabio
353         WRITE(numout,*) '    frequency of outputs for additional arrays  nn_writedia = ', nn_writedia
354         WRITE(numout,*) '    frequency of outputs for biological trends  nn_writebio = ', nn_writebio
355         WRITE(numout,*) ' '
356      ENDIF
357
358      IF( ln_diatrc .AND. .NOT. lk_iomput ) THEN
359         ALLOCATE( trc2d(jpi,jpj,jpdia2d), trc3d(jpi,jpj,jpk,jpdia3d),  &
360           &       ctrc2d(jpdia2d), ctrc2l(jpdia2d), ctrc2u(jpdia2d) ,  & 
361           &       ctrc3d(jpdia3d), ctrc3l(jpdia3d), ctrc3u(jpdia3d) ,  STAT = ierr ) 
362         IF( ierr > 0 )   CALL ctl_stop( 'STOP', 'trcnam: unable to allocate add. diag. array' )
363         !
364         trc2d(:,:,:  ) = 0._wp  ;   ctrc2d(:) = ' '   ;   ctrc2l(:) = ' '    ;    ctrc2u(:) = ' ' 
365         trc3d(:,:,:,:) = 0._wp  ;   ctrc3d(:) = ' '   ;   ctrc3l(:) = ' '    ;    ctrc3u(:) = ' ' 
366         !
367      ENDIF
368
369      IF( ( ln_diabio .AND. .NOT. lk_iomput ) .OR. l_trdtrc ) THEN
370         ALLOCATE( trbio (jpi,jpj,jpk,jpdiabio) , &
371           &       ctrbio(jpdiabio), ctrbil(jpdiabio), ctrbiu(jpdiabio), STAT = ierr ) 
372         IF( ierr > 0 )   CALL ctl_stop( 'STOP', 'trcnam: unable to allocate bio. diag. array' )
373         !
374         trbio(:,:,:,:) = 0._wp  ;   ctrbio(:) = ' '   ;   ctrbil(:) = ' '    ;    ctrbiu(:) = ' ' 
375         !
376      ENDIF
377      !
378   END SUBROUTINE trc_nam_dia
379
380#else
381   !!----------------------------------------------------------------------
382   !!  Dummy module :                                     No passive tracer
383   !!----------------------------------------------------------------------
384CONTAINS
385   SUBROUTINE trc_nam                      ! Empty routine   
386   END SUBROUTINE trc_nam
387   SUBROUTINE trc_nam_run                      ! Empty routine   
388   END SUBROUTINE trc_nam_run
389#endif
390
391   !!----------------------------------------------------------------------
392   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
393   !! $Id$
394   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
395   !!======================================================================
396END MODULE  trcnam
Note: See TracBrowser for help on using the repository browser.