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

source: branches/2016/dev_r7012_ROBUST5_CNRS/NEMOGCM/NEMO/TOP_SRC/trcnam.F90 @ 7097

Last change on this file since 7097 was 7097, checked in by lovato, 8 years ago

New top interface : update my_trc and revise structure of TOP component initialisation, see ticket #1782

  • Property svn:keywords set to Id
File size: 15.1 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_pisces     ! PISCES namelist
23   USE trcnam_cfc        ! CFC SMS namelist
24   USE trcnam_c14        ! C14 SMS namelist
25   USE trcnam_age        ! AGE 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   TYPE(PTRACER), DIMENSION(jpmaxtrc), PUBLIC  :: sn_tracer  ! type of tracer for saving if not key_iomput
38
39   !!----------------------------------------------------------------------
40   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
41   !! $Id$
42   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
43   !!----------------------------------------------------------------------
44CONTAINS
45
46   SUBROUTINE trc_nam
47      !!---------------------------------------------------------------------
48      !!                     ***  ROUTINE trc_nam  ***
49      !!
50      !! ** Purpose :   READ and PRINT options for the passive tracer run (namelist)
51      !!
52      !! ** Method  : - read passive tracer namelist
53      !!              - read namelist of each defined SMS model
54      !!                ( (PISCES, CFC, MY_TRC )
55      !!---------------------------------------------------------------------
56      INTEGER  ::   jn                  ! dummy loop indice
57      !
58      IF( .NOT.lk_offline )   CALL trc_nam_run     ! Parameters of the run                                 
59      !               
60      CALL trc_nam_trc     ! passive tracer informations
61      !                                       
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               )   ln_trc_ini(:) = .FALSE.
67
68      IF(lwp) THEN                   ! control print
69         IF( ln_rsttr ) THEN
70            WRITE(numout,*)
71            WRITE(numout,*) '  Read a restart file for passive tracer : ', TRIM( cn_trcrst_in )
72            WRITE(numout,*)
73         ENDIF
74         IF( ln_trcdta .AND. .NOT.ln_rsttr ) THEN
75            WRITE(numout,*)
76            WRITE(numout,*) '  Some of the passive tracers are initialised from climatologies '
77            WRITE(numout,*)
78         ENDIF
79         IF( .NOT.ln_trcdta ) THEN
80            WRITE(numout,*)
81            WRITE(numout,*) '  All the passive tracers are initialised with constant values '
82            WRITE(numout,*)
83         ENDIF
84      ENDIF
85      !
86      rdttrc = rdt * FLOAT( nn_dttrc )          ! passive tracer time-step
87      !
88      IF(lwp) THEN                              ! control print
89        WRITE(numout,*) 
90        WRITE(numout,*) '    Passive Tracer  time step    rdttrc  = ', rdttrc
91        WRITE(numout,*) 
92      ENDIF
93      !
94      IF( l_trdtrc )        CALL trc_nam_trd    ! Passive tracer trends
95      !
96   END SUBROUTINE trc_nam
97
98
99   SUBROUTINE trc_nam_run
100      !!---------------------------------------------------------------------
101      !!                     ***  ROUTINE trc_nam  ***
102      !!
103      !! ** Purpose :   read options for the passive tracer run (namelist)
104      !!
105      !!---------------------------------------------------------------------
106      NAMELIST/namtrc_run/ nn_dttrc, ln_rsttr, nn_rsttr, ln_top_euler, &
107        &                  cn_trcrst_indir, cn_trcrst_outdir, cn_trcrst_in, cn_trcrst_out
108      !
109      INTEGER  ::   ios                 ! Local integer output status for namelist read
110      !!---------------------------------------------------------------------
111      !
112      IF(lwp) WRITE(numout,*) 'trc_nam_run : read the passive tracer namelists'
113      IF(lwp) WRITE(numout,*) '~~~~~~~'
114
115      CALL ctl_opn( numnat_ref, 'namelist_top_ref'   , 'OLD'    , 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
116      CALL ctl_opn( numnat_cfg, 'namelist_top_cfg'   , 'OLD'    , 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
117      IF(lwm) CALL ctl_opn( numont, 'output.namelist.top', 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE., 1 )
118
119      REWIND( numnat_ref )              ! Namelist namtrc in reference namelist : Passive tracer variables
120      READ  ( numnat_ref, namtrc_run, IOSTAT = ios, ERR = 901)
121901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in reference namelist', lwp )
122
123      REWIND( numnat_cfg )              ! Namelist namtrc in configuration namelist : Passive tracer variables
124      READ  ( numnat_cfg, namtrc_run, IOSTAT = ios, ERR = 902 )
125902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in configuration namelist', lwp )
126      IF(lwm) WRITE ( numont, namtrc_run )
127
128      !  computes the first time step of tracer model
129      nittrc000 = nit000 + nn_dttrc - 1
130
131      IF(lwp) THEN                   ! control print
132         WRITE(numout,*)
133         WRITE(numout,*) ' Namelist : namtrc_run'
134         WRITE(numout,*) '   time step freq. for passive tracer           nn_dttrc      = ', nn_dttrc
135         WRITE(numout,*) '   restart  for passive tracer                  ln_rsttr      = ', ln_rsttr
136         WRITE(numout,*) '   control of time step for passive tracer      nn_rsttr      = ', nn_rsttr
137         WRITE(numout,*) '   first time step for pass. trac.              nittrc000     = ', nittrc000
138         WRITE(numout,*) '   Use euler integration for TRC (y/n)          ln_top_euler  = ', ln_top_euler
139         WRITE(numout,*) ' '
140      ENDIF
141      !
142    END SUBROUTINE trc_nam_run
143
144   SUBROUTINE trc_nam_trc
145      !!---------------------------------------------------------------------
146      !!                     ***  ROUTINE trc_nam  ***
147      !!
148      !! ** Purpose :   read options for the passive tracer run (namelist)
149      !!
150      !!---------------------------------------------------------------------
151      INTEGER  ::   ios, ierr, icfc       ! Local integer output status for namelist read
152      !!
153      NAMELIST/namtrc/jptra, ln_pisces, ln_my_trc, ln_age, ln_cfc11, ln_cfc12, ln_c14, &
154         &            sn_tracer, ln_trcdta, ln_trcdmp, ln_trcdmp_clo
155      !!---------------------------------------------------------------------
156      ! Dummy settings to fill tracers data structure
157      !                  !   name   !   title   !   unit   !   init  !   sbc   !   cbc   !   obc  !
158      sn_tracer = PTRACER( 'NONAME' , 'NOTITLE' , 'NOUNIT' , .false. , .false. , .false. , .false.)
159      !
160      IF(lwp) WRITE(numout,*)
161      IF(lwp) WRITE(numout,*) 'trc_nam_trc : read the passive tracer namelists'
162      IF(lwp) WRITE(numout,*) '~~~~~~~'
163
164      REWIND( numnat_ref )              ! Namelist namtrc in reference namelist : Passive tracer variables
165      READ  ( numnat_ref, namtrc, IOSTAT = ios, ERR = 901)
166901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in reference namelist', lwp )
167
168      REWIND( numnat_cfg )              ! Namelist namtrc in configuration namelist : Passive tracer variables
169      READ  ( numnat_cfg, namtrc, IOSTAT = ios, ERR = 902 )
170902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc in configuration namelist', lwp )
171      IF(lwm) WRITE ( numont, namtrc )
172
173      ! Control settings
174      IF( ln_pisces .AND. ln_my_trc )   CALL ctl_stop( 'Choose only ONE BGC model - PISCES or MY_TRC' )
175      IF( .NOT. ln_pisces .AND. .NOT. ln_my_trc )   jptra = 0
176      ll_cfc = ln_cfc11 .OR. ln_cfc12
177      !
178      jp_pisces   =  0    ;   jp_pcs0  =  0    ;   jp_pcs1  = 0
179      jp_my_trc   =  0    ;   jp_myt0  =  0    ;   jp_myt1  = 0
180      jp_cfc      =  0    ;   jp_cfc0  =  0    ;   jp_cfc1  = 0
181      jp_age      =  0    ;   jp_c14   = 0
182      !
183      IF( ln_pisces )  THEN
184         jp_pisces = jptra
185         jp_pcs0   = 1
186         jp_pcs1   = jp_pisces
187      ENDIF
188      IF( ln_my_trc )  THEN
189          jp_my_trc = jptra
190          jp_myt0   = 1
191          jp_myt1   = jp_my_trc
192      ENDIF
193      !
194      jp_bgc  =   jptra
195      !
196      IF( ln_age )    THEN
197         jptra     = jptra + 1
198         jp_age    = jptra
199      ENDIF
200      IF( ln_cfc11 )  jp_cfc = jp_cfc + 1
201      IF( ln_cfc12 )  jp_cfc = jp_cfc + 1
202      IF( ll_cfc )    THEN
203          jptra     = jptra + jp_cfc
204          jp_cfc0   = jptra - jp_cfc + 1
205          jp_cfc1   = jptra
206      ENDIF
207      IF( ln_c14 )    THEN
208           jptra     = jptra + 1
209           jp_c14    = jptra
210      ENDIF
211      !
212      IF( jptra == 0 )   CALL ctl_stop( 'All TOP tracers disabled: change namtrc setting or check if key_top is active' )
213      !
214      IF(lwp) THEN                   ! control print
215         WRITE(numout,*)
216         WRITE(numout,*) ' Namelist : namtrc'
217         WRITE(numout,*) '   Total number of passive tracers              jptra         = ', jptra
218         WRITE(numout,*) '   Simulating PISCES model                      ln_pisces     = ', ln_pisces
219         WRITE(numout,*) '   Simulating MY_TRC  model                     ln_my_trc     = ', ln_my_trc
220         WRITE(numout,*) '   Simulating water mass age                    ln_age        = ', ln_age
221         WRITE(numout,*) '   Simulating CFC11 passive tracer              ln_cfc11      = ', ln_cfc11
222         WRITE(numout,*) '   Simulating CFC12 passive tracer              ln_cfc12      = ', ln_cfc12
223         WRITE(numout,*) '   Simulating C14   passive tracer              ln_c14        = ', ln_c14
224         WRITE(numout,*) '   Read inputs data from file (y/n)             ln_trcdta     = ', ln_trcdta
225         WRITE(numout,*) '   Damping of passive tracer (y/n)              ln_trcdmp     = ', ln_trcdmp
226         WRITE(numout,*) '   Restoring of tracer on closed seas           ln_trcdmp_clo = ', ln_trcdmp_clo
227         WRITE(numout,*) '   Total number of BGC-like tracers             jp_bgc        = ', jp_bgc
228         WRITE(numout,*) ' '
229         WRITE(numout,*) ' '
230      ENDIF
231      !
232      IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'trc_nam_ice: unable to allocate arrays' )
233      !
234      IF( ln_age .OR. ll_cfc .OR. ln_c14 ) THEN
235        !                             ! Open namelist files
236        CALL ctl_opn( numtrc_ref, 'namelist_trc_ref'   ,     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
237        CALL ctl_opn( numtrc_cfg, 'namelist_trc_cfg'   ,     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
238        IF(lwm) CALL ctl_opn( numonr, 'output.namelist.trc', 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
239        !
240      ENDIF
241
242   END SUBROUTINE trc_nam_trc
243
244   SUBROUTINE trc_nam_trd
245      !!---------------------------------------------------------------------
246      !!                     ***  ROUTINE trc_nam_dia  ***
247      !!
248      !! ** Purpose :   read options for the passive tracer diagnostics
249      !!
250      !! ** Method  : - read passive tracer namelist
251      !!              - read namelist of each defined SMS model
252      !!                ( (PISCES, CFC, MY_TRC )
253      !!---------------------------------------------------------------------
254
255#if defined key_trdmxl_trc  || defined key_trdtrc
256      INTEGER  ::   ios                 ! Local integer output status for namelist read
257      INTEGER ::  ierr
258      !!
259      NAMELIST/namtrc_trd/ nn_trd_trc, nn_ctls_trc, rn_ucf_trc, &
260         &                ln_trdmxl_trc_restart, ln_trdmxl_trc_instant, &
261         &                cn_trdrst_trc_in, cn_trdrst_trc_out, ln_trdtrc
262      !!---------------------------------------------------------------------
263
264      IF(lwp) WRITE(numout,*)
265      IF(lwp) WRITE(numout,*) 'trc_nam_trd : read the passive tracer diagnostics options'
266      IF(lwp) WRITE(numout,*) '~~~~~~~'
267
268      !
269      ALLOCATE( ln_trdtrc(jptra) ) 
270      !
271      REWIND( numnat_ref )              ! Namelist namtrc_trd in reference namelist : Passive tracer trends
272      READ  ( numnat_ref, namtrc_trd, IOSTAT = ios, ERR = 905)
273905   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_trd in reference namelist', lwp )
274
275      REWIND( numnat_cfg )              ! Namelist namtrc_trd in configuration namelist : Passive tracer trends
276      READ  ( numnat_cfg, namtrc_trd, IOSTAT = ios, ERR = 906 )
277906   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namtrc_trd in configuration namelist', lwp )
278      IF(lwm) WRITE ( numont, namtrc_trd )
279
280      IF(lwp) THEN
281         WRITE(numout,*)
282         WRITE(numout,*) ' trd_mxl_trc_init : read namelist namtrc_trd                    '
283         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~                                               '
284         WRITE(numout,*) '   * frequency of trends diagnostics   nn_trd_trc             = ', nn_trd_trc
285         WRITE(numout,*) '   * control surface type              nn_ctls_trc            = ', nn_ctls_trc
286         WRITE(numout,*) '   * restart for ML diagnostics        ln_trdmxl_trc_restart  = ', ln_trdmxl_trc_restart
287         WRITE(numout,*) '   * flag to diagnose trends of                                 '
288         WRITE(numout,*) '     instantantaneous or mean ML T/S   ln_trdmxl_trc_instant  = ', ln_trdmxl_trc_instant
289         WRITE(numout,*) '   * unit conversion factor            rn_ucf_trc             = ', rn_ucf_trc
290         DO jn = 1, jptra
291            IF( ln_trdtrc(jn) ) WRITE(numout,*) '    compute ML trends for tracer number :', jn
292         END DO
293      ENDIF
294#endif
295      !
296   END SUBROUTINE trc_nam_trd
297
298#else
299   !!----------------------------------------------------------------------
300   !!  Dummy module :                                     No passive tracer
301   !!----------------------------------------------------------------------
302CONTAINS
303   SUBROUTINE trc_nam                      ! Empty routine   
304   END SUBROUTINE trc_nam
305   SUBROUTINE trc_nam_run                      ! Empty routine   
306   END SUBROUTINE trc_nam_run
307#endif
308
309   !!----------------------------------------------------------------------
310   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
311   !! $Id$
312   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
313   !!======================================================================
314END MODULE trcnam
Note: See TracBrowser for help on using the repository browser.