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

source: branches/2015/dev_r5056_CMCC4_simplification/NEMOGCM/NEMO/TOP_SRC/trcnam.F90 @ 5282

Last change on this file since 5282 was 5282, checked in by diovino, 9 years ago

Dev. branch CMCC4_simplification ticket #1456

  • Property svn:keywords set to Id
File size: 15.9 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      rdttrc = rdt * FLOAT( nn_dttrc )   !  passive tracer time-step
112 
113      IF(lwp) THEN                   ! control print
114        WRITE(numout,*) 
115        WRITE(numout,*) '    Passive Tracer  time step    rdttrc  = ', rdttrc
116        WRITE(numout,*) 
117      ENDIF
118
119
120#if defined key_trdmxl_trc || defined key_trdtrc
121
122         REWIND( numnat_ref )              ! Namelist namtrc_trd in reference namelist : Passive tracer trends
123         READ  ( numnat_ref, namtrc_trd, IOSTAT = ios, ERR = 905)
124905      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_trd in reference namelist', lwp )
125
126         REWIND( numnat_cfg )              ! Namelist namtrc_trd in configuration namelist : Passive tracer trends
127         READ  ( numnat_cfg, namtrc_trd, IOSTAT = ios, ERR = 906 )
128906      IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_trd in configuration namelist', lwp )
129         IF(lwm) WRITE ( numont, namtrc_trd )
130
131         IF(lwp) THEN
132            WRITE(numout,*)
133            WRITE(numout,*) ' trd_mxl_trc_init : read namelist namtrc_trd                    '
134            WRITE(numout,*) ' ~~~~~~~~~~~~~~~~                                               '
135            WRITE(numout,*) '   * frequency of trends diagnostics   nn_trd_trc             = ', nn_trd_trc
136            WRITE(numout,*) '   * control surface type              nn_ctls_trc            = ', nn_ctls_trc
137            WRITE(numout,*) '   * restart for ML diagnostics        ln_trdmxl_trc_restart  = ', ln_trdmxl_trc_restart
138            WRITE(numout,*) '   * flag to diagnose trends of                                 '
139            WRITE(numout,*) '     instantantaneous or mean ML T/S   ln_trdmxl_trc_instant  = ', ln_trdmxl_trc_instant
140            WRITE(numout,*) '   * unit conversion factor            rn_ucf_trc             = ', rn_ucf_trc
141            DO jn = 1, jptra
142               IF( ln_trdtrc(jn) ) WRITE(numout,*) '    compute ML trends for tracer number :', jn
143            END DO
144         ENDIF
145#endif
146
147
148      ! namelist of SMS
149      ! ---------------     
150      IF( lk_pisces  ) THEN   ;   CALL trc_nam_pisces      ! PISCES  bio-model
151      ELSE                    ;   IF(lwp) WRITE(numout,*) '          PISCES not used'
152      ENDIF
153
154      IF( lk_cfc     ) THEN   ;   CALL trc_nam_cfc         ! CFC     tracers
155      ELSE                    ;   IF(lwp) WRITE(numout,*) '          CFC not used'
156      ENDIF
157
158      IF( lk_c14b     ) THEN   ;   CALL trc_nam_c14b         ! C14 bomb     tracers
159      ELSE                    ;   IF(lwp) WRITE(numout,*) '          C14 not used'
160      ENDIF
161
162      IF( lk_my_trc  ) THEN   ;   CALL trc_nam_my_trc      ! MY_TRC  tracers
163      ELSE                    ;   IF(lwp) WRITE(numout,*) '          MY_TRC not used'
164      ENDIF
165      !
166   END SUBROUTINE trc_nam
167
168   SUBROUTINE trc_nam_run
169      !!---------------------------------------------------------------------
170      !!                     ***  ROUTINE trc_nam  ***
171      !!
172      !! ** Purpose :   read options for the passive tracer run (namelist)
173      !!
174      !!---------------------------------------------------------------------
175      NAMELIST/namtrc_run/ nn_dttrc, nn_writetrc, ln_rsttr, nn_rsttr, ln_top_euler, &
176        &                  cn_trcrst_in, cn_trcrst_out
177
178      INTEGER  ::   ios                 ! Local integer output status for namelist read
179
180      !!---------------------------------------------------------------------
181
182
183      IF(lwp) WRITE(numout,*) 'trc_nam : read the passive tracer namelists'
184      IF(lwp) WRITE(numout,*) '~~~~~~~'
185
186      CALL ctl_opn( numnat_ref, 'namelist_top_ref'   , 'OLD'    , 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
187      CALL ctl_opn( numnat_cfg, 'namelist_top_cfg'   , 'OLD'    , 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
188      IF(lwm) CALL ctl_opn( numont, 'output.namelist.top', 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE., 1 )
189
190      REWIND( numnat_ref )              ! Namelist namtrc in reference namelist : Passive tracer variables
191      READ  ( numnat_ref, namtrc_run, IOSTAT = ios, ERR = 901)
192901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in reference namelist', lwp )
193
194      REWIND( numnat_cfg )              ! Namelist namtrc in configuration namelist : Passive tracer variables
195      READ  ( numnat_cfg, namtrc_run, IOSTAT = ios, ERR = 902 )
196902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in configuration namelist', lwp )
197      IF(lwm) WRITE ( numont, namtrc_run )
198
199      !  computes the first time step of tracer model
200      nittrc000 = nit000 + nn_dttrc - 1
201
202      IF(lwp) THEN                   ! control print
203         WRITE(numout,*)
204         WRITE(numout,*) ' Namelist : namtrc_run'
205         WRITE(numout,*) '   time step freq. for passive tracer           nn_dttrc      = ', nn_dttrc
206         WRITE(numout,*) '   restart  for passive tracer                  ln_rsttr      = ', ln_rsttr
207         WRITE(numout,*) '   control of time step for passive tracer      nn_rsttr      = ', nn_rsttr
208         WRITE(numout,*) '   first time step for pass. trac.              nittrc000     = ', nittrc000
209         WRITE(numout,*) '   frequency of outputs for passive tracers     nn_writetrc   = ', nn_writetrc 
210         WRITE(numout,*) '   Use euler integration for TRC (y/n)          ln_top_euler  = ', ln_top_euler
211         WRITE(numout,*) ' '
212      ENDIF
213      !
214    END SUBROUTINE trc_nam_run
215
216
217   SUBROUTINE trc_nam_trc
218      !!---------------------------------------------------------------------
219      !!                     ***  ROUTINE trc_nam  ***
220      !!
221      !! ** Purpose :   read options for the passive tracer run (namelist)
222      !!
223      !!---------------------------------------------------------------------
224      TYPE(PTRACER), DIMENSION(jptra) :: sn_tracer  ! type of tracer for saving if not key_iomput
225      !!
226      NAMELIST/namtrc/ sn_tracer, ln_trcdta,ln_trcdmp, ln_trcdmp_clo
227 
228      INTEGER  ::   ios                 ! Local integer output status for namelist read
229      INTEGER  ::   jn                  ! dummy loop indice
230      !!---------------------------------------------------------------------
231      IF(lwp) WRITE(numout,*)
232      IF(lwp) WRITE(numout,*) 'trc_nam : read the passive tracer namelists'
233      IF(lwp) WRITE(numout,*) '~~~~~~~'
234
235
236      REWIND( numnat_ref )              ! Namelist namtrc in reference namelist : Passive tracer variables
237      READ  ( numnat_ref, namtrc, IOSTAT = ios, ERR = 901)
238901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in reference namelist', lwp )
239
240      REWIND( numnat_cfg )              ! Namelist namtrc in configuration namelist : Passive tracer variables
241      READ  ( numnat_cfg, namtrc, IOSTAT = ios, ERR = 902 )
242902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in configuration namelist', lwp )
243      IF(lwm) WRITE ( numont, namtrc )
244
245      DO jn = 1, jptra
246         ctrcnm    (jn) = TRIM( sn_tracer(jn)%clsname )
247         ctrcln    (jn) = TRIM( sn_tracer(jn)%cllname )
248         ctrcun    (jn) = TRIM( sn_tracer(jn)%clunit  )
249         ln_trc_ini(jn) =       sn_tracer(jn)%llinit
250         ln_trc_wri(jn) =       sn_tracer(jn)%llsave
251      END DO
252     
253    END SUBROUTINE trc_nam_trc
254
255
256   SUBROUTINE trc_nam_dia
257      !!---------------------------------------------------------------------
258      !!                     ***  ROUTINE trc_nam_dia  ***
259      !!
260      !! ** Purpose :   read options for the passive tracer diagnostics
261      !!
262      !! ** Method  : - read passive tracer namelist
263      !!              - read namelist of each defined SMS model
264      !!                ( (PISCES, CFC, MY_TRC )
265      !!---------------------------------------------------------------------
266      INTEGER ::  ierr
267#if defined key_trdmxl_trc  || defined key_trdtrc
268      NAMELIST/namtrc_trd/ nn_trd_trc, nn_ctls_trc, rn_ucf_trc, &
269         &                ln_trdmxl_trc_restart, ln_trdmxl_trc_instant, &
270         &                cn_trdrst_trc_in, cn_trdrst_trc_out, ln_trdtrc
271#endif
272      NAMELIST/namtrc_dia/ ln_diatrc, ln_diabio, nn_writedia, nn_writebio
273
274      INTEGER  ::   ios                 ! Local integer output status for namelist read
275      !!---------------------------------------------------------------------
276
277      IF(lwp) WRITE(numout,*) 
278      IF(lwp) WRITE(numout,*) 'trc_nam_dia : read the passive tracer diagnostics options'
279      IF(lwp) WRITE(numout,*) '~~~~~~~'
280
281      IF(lwp) WRITE(numout,*)
282      IF(lwp) WRITE(numout,*) 'trc_nam_dia : read the passive tracer diagnostics options'
283      IF(lwp) WRITE(numout,*) '~~~~~~~'
284
285      REWIND( numnat_ref )              ! Namelist namtrc_dia in reference namelist : Passive tracer diagnostics
286      READ  ( numnat_ref, namtrc_dia, IOSTAT = ios, ERR = 903)
287903   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dia in reference namelist', lwp )
288
289      REWIND( numnat_cfg )              ! Namelist namtrc_dia in configuration namelist : Passive tracer diagnostics
290      READ  ( numnat_cfg, namtrc_dia, IOSTAT = ios, ERR = 904 )
291904   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dia in configuration namelist', lwp )
292      IF(lwm) WRITE ( numont, namtrc_dia )
293
294      IF(lwp) THEN
295         WRITE(numout,*)
296         WRITE(numout,*)
297         WRITE(numout,*) ' Namelist : namtrc_dia'
298         WRITE(numout,*) '    save additionnal diagnostics arrays         ln_diatrc   = ', ln_diatrc
299         WRITE(numout,*) '    save additionnal biology diagnostics arrays ln_diabio   = ', ln_diabio
300         WRITE(numout,*) '    frequency of outputs for additional arrays  nn_writedia = ', nn_writedia
301         WRITE(numout,*) '    frequency of outputs for biological trends  nn_writebio = ', nn_writebio
302         WRITE(numout,*) ' '
303      ENDIF
304
305      IF( ln_diatrc .AND. .NOT. lk_iomput ) THEN
306         ALLOCATE( trc2d(jpi,jpj,jpdia2d), trc3d(jpi,jpj,jpk,jpdia3d),  &
307           &       ctrc2d(jpdia2d), ctrc2l(jpdia2d), ctrc2u(jpdia2d) ,  & 
308           &       ctrc3d(jpdia3d), ctrc3l(jpdia3d), ctrc3u(jpdia3d) ,  STAT = ierr ) 
309         IF( ierr > 0 )   CALL ctl_stop( 'STOP', 'trcnam: unable to allocate add. diag. array' )
310         !
311         trc2d(:,:,:  ) = 0._wp  ;   ctrc2d(:) = ' '   ;   ctrc2l(:) = ' '    ;    ctrc2u(:) = ' ' 
312         trc3d(:,:,:,:) = 0._wp  ;   ctrc3d(:) = ' '   ;   ctrc3l(:) = ' '    ;    ctrc3u(:) = ' ' 
313         !
314      ENDIF
315
316      IF( ( ln_diabio .AND. .NOT. lk_iomput ) .OR. l_trdtrc ) THEN
317         ALLOCATE( trbio (jpi,jpj,jpk,jpdiabio) , &
318           &       ctrbio(jpdiabio), ctrbil(jpdiabio), ctrbiu(jpdiabio), STAT = ierr ) 
319         IF( ierr > 0 )   CALL ctl_stop( 'STOP', 'trcnam: unable to allocate bio. diag. array' )
320         !
321         trbio(:,:,:,:) = 0._wp  ;   ctrbio(:) = ' '   ;   ctrbil(:) = ' '    ;    ctrbiu(:) = ' ' 
322         !
323      ENDIF
324      !
325   END SUBROUTINE trc_nam_dia
326
327#else
328   !!----------------------------------------------------------------------
329   !!  Dummy module :                                     No passive tracer
330   !!----------------------------------------------------------------------
331CONTAINS
332   SUBROUTINE trc_nam                      ! Empty routine   
333   END SUBROUTINE trc_nam
334   SUBROUTINE trc_nam_run                      ! Empty routine   
335   END SUBROUTINE trc_nam_run
336#endif
337
338   !!----------------------------------------------------------------------
339   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
340   !! $Id$
341   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
342   !!======================================================================
343END MODULE  trcnam
Note: See TracBrowser for help on using the repository browser.