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/UKMO/dev_r5107_xios_initialize_toyoce/NEMOGCM/NEMO/TOP_SRC – NEMO

source: branches/UKMO/dev_r5107_xios_initialize_toyoce/NEMOGCM/NEMO/TOP_SRC/trcnam.F90 @ 5580

Last change on this file since 5580 was 5580, checked in by davestorkey, 9 years ago

Finish upgrade of UKMO/dev_r5107_xios_initialize_toyoce branch to trunk revision 5518. (Previous commit only upgraded part of the repository).

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_indir, cn_trcrst_outdir, cn_trcrst_in, cn_trcrst_out
182
183
184      INTEGER  ::   ios                 ! Local integer output status for namelist read
185
186      !!---------------------------------------------------------------------
187
188
189      IF(lwp) WRITE(numout,*) 'trc_nam : read the passive tracer namelists'
190      IF(lwp) WRITE(numout,*) '~~~~~~~'
191
192      CALL ctl_opn( numnat_ref, 'namelist_top_ref'   , 'OLD'    , 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
193      CALL ctl_opn( numnat_cfg, 'namelist_top_cfg'   , 'OLD'    , 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
194      IF(lwm) CALL ctl_opn( numont, 'output.namelist.top', 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE., 1 )
195
196      REWIND( numnat_ref )              ! Namelist namtrc in reference namelist : Passive tracer variables
197      READ  ( numnat_ref, namtrc_run, IOSTAT = ios, ERR = 901)
198901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in reference namelist', lwp )
199
200      REWIND( numnat_cfg )              ! Namelist namtrc in configuration namelist : Passive tracer variables
201      READ  ( numnat_cfg, namtrc_run, IOSTAT = ios, ERR = 902 )
202902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in configuration namelist', lwp )
203      IF(lwm) WRITE ( numont, namtrc_run )
204
205      !  computes the first time step of tracer model
206      nittrc000 = nit000 + nn_dttrc - 1
207
208      IF(lwp) THEN                   ! control print
209         WRITE(numout,*)
210         WRITE(numout,*) ' Namelist : namtrc_run'
211         WRITE(numout,*) '   time step freq. for passive tracer           nn_dttrc      = ', nn_dttrc
212         WRITE(numout,*) '   restart  for passive tracer                  ln_rsttr      = ', ln_rsttr
213         WRITE(numout,*) '   control of time step for passive tracer      nn_rsttr      = ', nn_rsttr
214         WRITE(numout,*) '   first time step for pass. trac.              nittrc000     = ', nittrc000
215         WRITE(numout,*) '   frequency of outputs for passive tracers     nn_writetrc   = ', nn_writetrc 
216         WRITE(numout,*) '   Use euler integration for TRC (y/n)          ln_top_euler  = ', ln_top_euler
217         WRITE(numout,*) ' '
218      ENDIF
219      !
220    END SUBROUTINE trc_nam_run
221
222   SUBROUTINE trc_nam_ice
223      !!---------------------------------------------------------------------
224      !!                     ***  ROUTINE trc_nam_ice ***
225      !!
226      !! ** Purpose :   Read the namelist for the ice effect on tracers
227      !!
228      !! ** Method  : -
229      !!
230      !!---------------------------------------------------------------------
231      ! --- Variable declarations --- !
232      INTEGER :: jn      ! dummy loop indices
233      INTEGER :: ios     ! Local integer output status for namelist read
234
235      ! --- Namelist declarations --- !
236      TYPE(TRC_I_NML), DIMENSION(jptra) :: sn_tri_tracer
237      NAMELIST/namtrc_ice/ nn_ice_tr, sn_tri_tracer
238
239      IF(lwp) THEN
240         WRITE(numout,*)
241         WRITE(numout,*) 'trc_nam_ice : Read the namelist for trc_ice'
242         WRITE(numout,*) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
243      ENDIF
244
245      IF( nn_timing == 1 )  CALL timing_start('trc_nam_ice')
246
247      !
248      REWIND( numnat_ref )              ! Namelist namtrc_ice in reference namelist : Passive tracer input data
249      READ  ( numnat_ref, namtrc_ice, IOSTAT = ios, ERR = 901)
250 901  IF( ios /= 0 ) CALL ctl_nam ( ios , ' namtrc_ice in reference namelist ', lwp )
251
252      REWIND( numnat_cfg )              ! Namelist namtrc_ice in configuration namelist : Pisces external sources of nutrients
253      READ  ( numnat_cfg, namtrc_ice, IOSTAT = ios, ERR = 902 )
254 902  IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_ice in configuration namelist', lwp )
255
256      IF( lwp ) THEN
257         WRITE(numout,*) ' '
258         WRITE(numout,*) ' Sea ice tracers option (nn_ice_tr) : ', nn_ice_tr
259         WRITE(numout,*) ' '
260      ENDIF
261
262      ! Assign namelist stuff
263      DO jn = 1, jptra
264         trc_ice_ratio(jn)  = sn_tri_tracer(jn)%trc_ratio
265         trc_ice_prescr(jn) = sn_tri_tracer(jn)%trc_prescr
266         cn_trc_o      (jn) = sn_tri_tracer(jn)%ctrc_o
267      END DO
268
269      IF( nn_timing == 1 )   CALL timing_stop('trc_nam_ice')
270      !
271   END SUBROUTINE trc_nam_ice
272
273   SUBROUTINE trc_nam_trc
274      !!---------------------------------------------------------------------
275      !!                     ***  ROUTINE trc_nam  ***
276      !!
277      !! ** Purpose :   read options for the passive tracer run (namelist)
278      !!
279      !!---------------------------------------------------------------------
280      TYPE(PTRACER), DIMENSION(jptra) :: sn_tracer  ! type of tracer for saving if not key_iomput
281      !!
282      NAMELIST/namtrc/ sn_tracer, ln_trcdta,ln_trcdmp, ln_trcdmp_clo
283 
284      INTEGER  ::   ios                 ! Local integer output status for namelist read
285      INTEGER  ::   jn                  ! dummy loop indice
286      !!---------------------------------------------------------------------
287      IF(lwp) WRITE(numout,*)
288      IF(lwp) WRITE(numout,*) 'trc_nam : read the passive tracer namelists'
289      IF(lwp) WRITE(numout,*) '~~~~~~~'
290
291
292      REWIND( numnat_ref )              ! Namelist namtrc in reference namelist : Passive tracer variables
293      READ  ( numnat_ref, namtrc, IOSTAT = ios, ERR = 901)
294901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in reference namelist', lwp )
295
296      REWIND( numnat_cfg )              ! Namelist namtrc in configuration namelist : Passive tracer variables
297      READ  ( numnat_cfg, namtrc, IOSTAT = ios, ERR = 902 )
298902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in configuration namelist', lwp )
299      IF(lwm) WRITE ( numont, namtrc )
300
301      DO jn = 1, jptra
302         ctrcnm    (jn) = TRIM( sn_tracer(jn)%clsname )
303         ctrcln    (jn) = TRIM( sn_tracer(jn)%cllname )
304         ctrcun    (jn) = TRIM( sn_tracer(jn)%clunit  )
305         ln_trc_ini(jn) =       sn_tracer(jn)%llinit
306         ln_trc_wri(jn) =       sn_tracer(jn)%llsave
307      END DO
308     
309    END SUBROUTINE trc_nam_trc
310
311
312   SUBROUTINE trc_nam_dia
313      !!---------------------------------------------------------------------
314      !!                     ***  ROUTINE trc_nam_dia  ***
315      !!
316      !! ** Purpose :   read options for the passive tracer diagnostics
317      !!
318      !! ** Method  : - read passive tracer namelist
319      !!              - read namelist of each defined SMS model
320      !!                ( (PISCES, CFC, MY_TRC )
321      !!---------------------------------------------------------------------
322      INTEGER ::  ierr
323#if defined key_trdmxl_trc  || defined key_trdtrc
324      NAMELIST/namtrc_trd/ nn_trd_trc, nn_ctls_trc, rn_ucf_trc, &
325         &                ln_trdmxl_trc_restart, ln_trdmxl_trc_instant, &
326         &                cn_trdrst_trc_in, cn_trdrst_trc_out, ln_trdtrc
327#endif
328      NAMELIST/namtrc_dia/ ln_diatrc, ln_diabio, nn_writedia, nn_writebio
329
330      INTEGER  ::   ios                 ! Local integer output status for namelist read
331      !!---------------------------------------------------------------------
332
333      IF(lwp) WRITE(numout,*) 
334      IF(lwp) WRITE(numout,*) 'trc_nam_dia : read the passive tracer diagnostics options'
335      IF(lwp) WRITE(numout,*) '~~~~~~~'
336
337      IF(lwp) WRITE(numout,*)
338      IF(lwp) WRITE(numout,*) 'trc_nam_dia : read the passive tracer diagnostics options'
339      IF(lwp) WRITE(numout,*) '~~~~~~~'
340
341      REWIND( numnat_ref )              ! Namelist namtrc_dia in reference namelist : Passive tracer diagnostics
342      READ  ( numnat_ref, namtrc_dia, IOSTAT = ios, ERR = 903)
343903   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dia in reference namelist', lwp )
344
345      REWIND( numnat_cfg )              ! Namelist namtrc_dia in configuration namelist : Passive tracer diagnostics
346      READ  ( numnat_cfg, namtrc_dia, IOSTAT = ios, ERR = 904 )
347904   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dia in configuration namelist', lwp )
348      IF(lwm) WRITE ( numont, namtrc_dia )
349
350      IF(lwp) THEN
351         WRITE(numout,*)
352         WRITE(numout,*)
353         WRITE(numout,*) ' Namelist : namtrc_dia'
354         WRITE(numout,*) '    save additionnal diagnostics arrays         ln_diatrc   = ', ln_diatrc
355         WRITE(numout,*) '    save additionnal biology diagnostics arrays ln_diabio   = ', ln_diabio
356         WRITE(numout,*) '    frequency of outputs for additional arrays  nn_writedia = ', nn_writedia
357         WRITE(numout,*) '    frequency of outputs for biological trends  nn_writebio = ', nn_writebio
358         WRITE(numout,*) ' '
359      ENDIF
360
361      IF( ln_diatrc .AND. .NOT. lk_iomput ) THEN
362         ALLOCATE( trc2d(jpi,jpj,jpdia2d), trc3d(jpi,jpj,jpk,jpdia3d),  &
363           &       ctrc2d(jpdia2d), ctrc2l(jpdia2d), ctrc2u(jpdia2d) ,  & 
364           &       ctrc3d(jpdia3d), ctrc3l(jpdia3d), ctrc3u(jpdia3d) ,  STAT = ierr ) 
365         IF( ierr > 0 )   CALL ctl_stop( 'STOP', 'trcnam: unable to allocate add. diag. array' )
366         !
367         trc2d(:,:,:  ) = 0._wp  ;   ctrc2d(:) = ' '   ;   ctrc2l(:) = ' '    ;    ctrc2u(:) = ' ' 
368         trc3d(:,:,:,:) = 0._wp  ;   ctrc3d(:) = ' '   ;   ctrc3l(:) = ' '    ;    ctrc3u(:) = ' ' 
369         !
370      ENDIF
371
372      IF( ( ln_diabio .AND. .NOT. lk_iomput ) .OR. l_trdtrc ) THEN
373         ALLOCATE( trbio (jpi,jpj,jpk,jpdiabio) , &
374           &       ctrbio(jpdiabio), ctrbil(jpdiabio), ctrbiu(jpdiabio), STAT = ierr ) 
375         IF( ierr > 0 )   CALL ctl_stop( 'STOP', 'trcnam: unable to allocate bio. diag. array' )
376         !
377         trbio(:,:,:,:) = 0._wp  ;   ctrbio(:) = ' '   ;   ctrbil(:) = ' '    ;    ctrbiu(:) = ' ' 
378         !
379      ENDIF
380      !
381   END SUBROUTINE trc_nam_dia
382
383#else
384   !!----------------------------------------------------------------------
385   !!  Dummy module :                                     No passive tracer
386   !!----------------------------------------------------------------------
387CONTAINS
388   SUBROUTINE trc_nam                      ! Empty routine   
389   END SUBROUTINE trc_nam
390   SUBROUTINE trc_nam_run                      ! Empty routine   
391   END SUBROUTINE trc_nam_run
392#endif
393
394   !!----------------------------------------------------------------------
395   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
396   !! $Id$
397   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
398   !!======================================================================
399END MODULE  trcnam
Note: See TracBrowser for help on using the repository browser.