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

source: branches/2013/dev_LOCEAN_2013/NEMOGCM/NEMO/TOP_SRC/trcnam.F90 @ 4152

Last change on this file since 4152 was 4152, checked in by cetlod, 10 years ago

merge in dev_LOCEAN_2013 the 2nd development branch dev_r3940_CNRS4_IOCRS, see ticket #1169

  • Property svn:keywords set to Id
File size: 15.5 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 trdmod_oce       
28   USE trdmod_trc_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      !                                        !   Parameters of the run
59      IF( .NOT. lk_offline ) CALL trc_nam_run
60     
61      !                                        !  passive tracer informations
62      CALL trc_nam_trc
63     
64      !                                        !   Parameters of additional diagnostics
65      CALL trc_nam_dia
66
67      !                                        !   namelist of transport
68      CALL trc_nam_trp
69
70
71      IF( ln_rsttr )                      ln_trcdta = .FALSE.   ! restart : no need of clim data
72      !
73      IF( ln_trcdmp .OR. ln_trcdmp_clo )  ln_trcdta = .TRUE.   ! damping : need to have clim data
74      !
75      IF( .NOT.ln_trcdta ) THEN
76         ln_trc_ini(:) = .FALSE.
77      ENDIF
78
79     IF(lwp) THEN                   ! control print
80         WRITE(numout,*)
81         WRITE(numout,*) ' Namelist : namtrc'
82         WRITE(numout,*) '   Read inputs data from file (y/n)             ln_trcdta     = ', ln_trcdta
83         WRITE(numout,*) '   Damping of passive tracer (y/n)              ln_trcdmp     = ', ln_trcdmp
84         WRITE(numout,*) '   Restoring of tracer on closed seas           ln_trcdmp_clo = ', ln_trcdmp_clo
85         WRITE(numout,*) ' '
86         DO jn = 1, jptra
87            WRITE(numout,*) '  tracer nb : ', jn, '    short name : ', ctrcnm(jn)
88         END DO
89         WRITE(numout,*) ' '
90      ENDIF
91
92      IF(lwp) THEN                   ! control print
93         IF( ln_rsttr ) THEN
94            WRITE(numout,*)
95            WRITE(numout,*) '  Read a restart file for passive tracer : ', TRIM( cn_trcrst_in )
96            WRITE(numout,*)
97         ENDIF
98         IF( ln_trcdta .AND. .NOT.ln_rsttr ) THEN
99            WRITE(numout,*)
100            WRITE(numout,*) '  Some of the passive tracers are initialised from climatologies '
101            WRITE(numout,*)
102         ENDIF
103         IF( .NOT.ln_trcdta ) THEN
104            WRITE(numout,*)
105            WRITE(numout,*) '  All the passive tracers are initialised with constant values '
106            WRITE(numout,*)
107         ENDIF
108      ENDIF
109
110     
111      rdttrc(:) = rdttra(:) * FLOAT( nn_dttrc )   ! vertical profile of passive tracer time-step
112 
113      IF(lwp) THEN                   ! control print
114        WRITE(numout,*) 
115        WRITE(numout,*) '    Passive Tracer  time step    rdttrc  = ', rdttrc(1)
116        WRITE(numout,*) 
117      ENDIF
118
119
120#if defined key_trdmld_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         WRITE ( numont, namtrc_trd )
130
131         IF(lwp) THEN
132            WRITE(numout,*)
133            WRITE(numout,*) ' trd_mld_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_trdmld_trc_restart  = ', ln_trdmld_trc_restart
138            WRITE(numout,*) '   * flag to diagnose trends of                                 '
139            WRITE(numout,*) '     instantantaneous or mean ML T/S   ln_trdmld_trc_instant  = ', ln_trdmld_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      !!---------------------------------------------------------------------
179
180
181      IF(lwp) WRITE(numout,*) 'trc_nam : read the passive tracer namelists'
182      IF(lwp) WRITE(numout,*) '~~~~~~~'
183
184      CALL ctl_opn( numnat_ref, 'namelist_top_ref'   , 'OLD'    , 'FORMATTED', 'SEQUENTIAL', 1, numout, .FALSE. )
185      CALL ctl_opn( numnat_cfg, 'namelist_top_cfg'   , 'OLD'    , 'FORMATTED', 'SEQUENTIAL', 1, numout, .FALSE. )
186      CALL ctl_opn( numont    , 'output.namelist.top', 'REPLACE', 'FORMATTED', 'SEQUENTIAL',-1, numout, .FALSE. )
187
188      REWIND( numnat_ref )              ! Namelist namtrc in reference namelist : Passive tracer variables
189      READ  ( numnat_ref, namtrc_run, IOSTAT = ios, ERR = 901)
190901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in reference namelist', lwp )
191
192      REWIND( numnat_cfg )              ! Namelist namtrc in configuration namelist : Passive tracer variables
193      READ  ( numnat_cfg, namtrc_run, IOSTAT = ios, ERR = 902 )
194902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in configuration namelist', lwp )
195      WRITE ( numont, namtrc )
196
197      !  computes the first time step of tracer model
198      nittrc000 = nit000 + nn_dttrc - 1
199
200      IF(lwp) THEN                   ! control print
201         WRITE(numout,*)
202         WRITE(numout,*) ' Namelist : namtrc'
203         WRITE(numout,*) '   time step freq. for passive tracer           nn_dttrc      = ', nn_dttrc
204         WRITE(numout,*) '   restart  for passive tracer                  ln_rsttr      = ', ln_rsttr
205         WRITE(numout,*) '   control of time step for passive tracer      nn_rsttr      = ', nn_rsttr
206         WRITE(numout,*) '   first time step for pass. trac.              nittrc000     = ', nittrc000
207         WRITE(numout,*) '   frequency of outputs for passive tracers     nn_writetrc   = ', nn_writetrc 
208         WRITE(numout,*) ' '
209      ENDIF
210      !
211    END SUBROUTINE trc_nam_run
212
213
214   SUBROUTINE trc_nam_trc
215      !!---------------------------------------------------------------------
216      !!                     ***  ROUTINE trc_nam  ***
217      !!
218      !! ** Purpose :   read options for the passive tracer run (namelist)
219      !!
220      !!---------------------------------------------------------------------
221      INTEGER ::  jn
222      ! Definition of a tracer as a structure
223      TYPE(PTRACER), DIMENSION(jptra) :: sn_tracer  ! type of tracer for saving if not key_iomput
224      !!
225      NAMELIST/namtrc/ sn_tracer, ln_trcdta,ln_trcdmp, ln_trcdmp_clo
226
227      !!---------------------------------------------------------------------
228      IF(lwp) WRITE(numout,*)
229      IF(lwp) WRITE(numout,*) 'trc_nam : read the passive tracer namelists'
230      IF(lwp) WRITE(numout,*) '~~~~~~~'
231
232
233      REWIND( numnat_ref )              ! Namelist namtrc in reference namelist : Passive tracer variables
234      READ  ( numnat_ref, namtrc, IOSTAT = ios, ERR = 901)
235901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in reference namelist', lwp )
236
237      REWIND( numnat_cfg )              ! Namelist namtrc in configuration namelist : Passive tracer variables
238      READ  ( numnat_cfg, namtrc, IOSTAT = ios, ERR = 902 )
239902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in configuration namelist', lwp )
240      WRITE ( numont, namtrc )
241
242      DO jn = 1, jptra
243         ctrcnm    (jn) = TRIM( sn_tracer(jn)%clsname )
244         ctrcln    (jn) = TRIM( sn_tracer(jn)%cllname )
245         ctrcun    (jn) = TRIM( sn_tracer(jn)%clunit  )
246         ln_trc_ini(jn) =       sn_tracer(jn)%llinit
247         ln_trc_wri(jn) =       sn_tracer(jn)%llsave
248      END DO
249     
250    END SUBROUTINE trc_nam_trc
251
252
253   SUBROUTINE trc_nam_dia
254      !!---------------------------------------------------------------------
255      !!                     ***  ROUTINE trc_nam_dia  ***
256      !!
257      !! ** Purpose :   read options for the passive tracer diagnostics
258      !!
259      !! ** Method  : - read passive tracer namelist
260      !!              - read namelist of each defined SMS model
261      !!                ( (PISCES, CFC, MY_TRC )
262      !!---------------------------------------------------------------------
263      INTEGER ::  ierr
264#if defined key_trdmld_trc  || defined key_trdtrc
265      NAMELIST/namtrc_trd/ nn_trd_trc, nn_ctls_trc, rn_ucf_trc, &
266         &                ln_trdmld_trc_restart, ln_trdmld_trc_instant, &
267         &                cn_trdrst_trc_in, cn_trdrst_trc_out, ln_trdtrc
268#endif
269      NAMELIST/namtrc_dia/ ln_diatrc, ln_diabio, nn_writedia, nn_writebio
270
271      !!---------------------------------------------------------------------
272
273      IF(lwp) WRITE(numout,*) 
274      IF(lwp) WRITE(numout,*) 'trc_nam_dia : read the passive tracer diagnostics options'
275      IF(lwp) WRITE(numout,*) '~~~~~~~'
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      REWIND( numnat_ref )              ! Namelist namtrc_dia in reference namelist : Passive tracer diagnostics
282      READ  ( numnat_ref, namtrc_dia, IOSTAT = ios, ERR = 903)
283903   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dia in reference namelist', lwp )
284
285      REWIND( numnat_cfg )              ! Namelist namtrc_dia in configuration namelist : Passive tracer diagnostics
286      READ  ( numnat_cfg, namtrc_dia, IOSTAT = ios, ERR = 904 )
287904   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_dia in configuration namelist', lwp )
288      WRITE ( numont, namtrc_dia )
289
290      IF(lwp) THEN
291         WRITE(numout,*)
292         WRITE(numout,*)
293         WRITE(numout,*) ' Namelist : namtrc_dia'
294         WRITE(numout,*) '    save additionnal diagnostics arrays         ln_diatrc   = ', ln_diatrc
295         WRITE(numout,*) '    save additionnal biology diagnostics arrays ln_diabio   = ', ln_diabio
296         WRITE(numout,*) '    frequency of outputs for additional arrays  nn_writedia = ', nn_writedia
297         WRITE(numout,*) '    frequency of outputs for biological trends  nn_writebio = ', nn_writebio
298         WRITE(numout,*) ' '
299      ENDIF
300
301      IF( ln_diatrc .AND. .NOT. lk_iomput ) THEN
302         ALLOCATE( trc2d(jpi,jpj,jpdia2d), trc3d(jpi,jpj,jpk,jpdia3d),  &
303           &       ctrc2d(jpdia2d), ctrc2l(jpdia2d), ctrc2u(jpdia2d) ,  & 
304           &       ctrc3d(jpdia3d), ctrc3l(jpdia3d), ctrc3u(jpdia3d) ,  STAT = ierr ) 
305         IF( ierr > 0 )   CALL ctl_stop( 'STOP', 'trcnam: unable to allocate add. diag. array' )
306         !
307         trc2d(:,:,:  ) = 0._wp  ;   ctrc2d(:) = ' '   ;   ctrc2l(:) = ' '    ;    ctrc2u(:) = ' ' 
308         trc3d(:,:,:,:) = 0._wp  ;   ctrc3d(:) = ' '   ;   ctrc3l(:) = ' '    ;    ctrc3u(:) = ' ' 
309         !
310      ENDIF
311
312      IF( ( ln_diabio .AND. .NOT. lk_iomput ) .OR. l_trdtrc ) THEN
313         ALLOCATE( trbio (jpi,jpj,jpk,jpdiabio) , &
314           &       ctrbio(jpdiabio), ctrbil(jpdiabio), ctrbiu(jpdiabio), STAT = ierr ) 
315         IF( ierr > 0 )   CALL ctl_stop( 'STOP', 'trcnam: unable to allocate bio. diag. array' )
316         !
317         trbio(:,:,:,:) = 0._wp  ;   ctrbio(:) = ' '   ;   ctrbil(:) = ' '    ;    ctrbiu(:) = ' ' 
318         !
319      ENDIF
320      !
321   END SUBROUTINE trc_nam_dia
322
323#else
324   !!----------------------------------------------------------------------
325   !!  Dummy module :                                     No passive tracer
326   !!----------------------------------------------------------------------
327CONTAINS
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   !!----------------------------------------------------------------------
335   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
336   !! $Id$
337   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
338   !!======================================================================
339END MODULE  trcnam
Note: See TracBrowser for help on using the repository browser.