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 @ 7103

Last change on this file since 7103 was 7103, checked in by cetlod, 8 years ago

new top interface : move namelist age from namelist_top to namelist_trc

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