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 NEMO/trunk/src/TOP – NEMO

source: NEMO/trunk/src/TOP/trcnam.F90

Last change on this file was 14239, checked in by smasson, 3 years ago

trunk: replace key_iomput by key_xios

  • Property svn:keywords set to Id
File size: 13.7 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 par_trc        ! need jptra, number of passive tracers
21   USE oce_trc     ! shared variables between ocean and passive tracers
22   USE trc         ! passive tracers common variables
23   USE trd_oce     !       
24   USE trdtrc_oce  !
25   USE iom         ! I/O manager
26
27   IMPLICIT NONE
28   PRIVATE
29
30   PUBLIC   trc_nam_run  ! called in trcini
31   PUBLIC   trc_nam      ! called in trcini
32
33   TYPE(PTRACER), DIMENSION(jpmaxtrc), PUBLIC  :: sn_tracer  !: type of tracer for saving if not key_xios
34
35   !!----------------------------------------------------------------------
36   !! NEMO/TOP 4.0 , NEMO Consortium (2018)
37   !! $Id$
38   !! Software governed by the CeCILL license (see ./LICENSE)
39   !!----------------------------------------------------------------------
40CONTAINS
41
42   SUBROUTINE trc_nam
43      !!---------------------------------------------------------------------
44      !!                     ***  ROUTINE trc_nam  ***
45      !!
46      !! ** Purpose :   READ and PRINT options for the passive tracer run (namelist)
47      !!
48      !! ** Method  : - read passive tracer namelist
49      !!              - read namelist of each defined SMS model
50      !!                ( (PISCES, CFC, MY_TRC )
51      !!---------------------------------------------------------------------
52      INTEGER  ::   jn   ! dummy loop indice
53      !!---------------------------------------------------------------------
54      !
55      IF( .NOT.l_offline )   CALL trc_nam_run     ! Parameters of the run                                 
56      !               
57      CALL trc_nam_trc                            ! passive tracer informations
58      !                                       
59      IF( ln_rsttr                     )   ln_trcdta = .FALSE.   ! restart : no need of clim data
60      !
61      IF( ln_trcdmp .OR. ln_trcdmp_clo )   ln_trcdta = .TRUE.    ! damping : need to have clim data
62      !
63      !
64      IF(lwp) THEN                   ! control print
65         IF( ln_rsttr ) THEN
66            WRITE(numout,*)
67            WRITE(numout,*) '   ==>>>   Read a restart file for passive tracer : ', TRIM( cn_trcrst_in )
68         ENDIF
69         IF( ln_trcdta .AND. .NOT.ln_rsttr ) THEN
70            WRITE(numout,*)
71            WRITE(numout,*) '   ==>>>   Some of the passive tracers are initialised from climatologies '
72         ENDIF
73         IF( .NOT.ln_trcdta ) THEN
74            WRITE(numout,*)
75            WRITE(numout,*) '   ==>>>   All the passive tracers are initialised with constant values '
76         ENDIF
77      ENDIF
78      !
79      IF(lwp) THEN                              ! control print
80        WRITE(numout,*) 
81        WRITE(numout,*) '   ==>>>   Passive Tracer time step = rn_Dt = ', rn_Dt
82      ENDIF
83      !
84      IF( l_trdtrc )        CALL trc_nam_trd    ! Passive tracer trends
85      !
86   END SUBROUTINE trc_nam
87
88
89   SUBROUTINE trc_nam_run
90      !!---------------------------------------------------------------------
91      !!                     ***  ROUTINE trc_nam  ***
92      !!
93      !! ** Purpose :   read options for the passive tracer run (namelist)
94      !!
95      !!---------------------------------------------------------------------
96      INTEGER  ::   ios   ! Local integer
97      !!
98      NAMELIST/namtrc_run/ ln_rsttr, nn_rsttr, ln_top_euler, &
99        &                  cn_trcrst_indir, cn_trcrst_outdir, cn_trcrst_in, cn_trcrst_out
100      !!---------------------------------------------------------------------
101      !
102      IF(lwp) WRITE(numout,*)
103      IF(lwp) WRITE(numout,*) 'trc_nam_run : read the passive tracer namelists'
104      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~'
105      !
106      CALL load_nml( numnat_ref, 'namelist_top_ref' , numout, lwm )
107      CALL load_nml( numnat_cfg, 'namelist_top_cfg' , numout, lwm )
108      IF(lwm) CALL ctl_opn( numont, 'output.namelist.top', 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE., 1 )
109      !
110      READ  ( numnat_ref, namtrc_run, IOSTAT = ios, ERR = 901)
111901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtrc in reference namelist' )
112      READ  ( numnat_cfg, namtrc_run, IOSTAT = ios, ERR = 902 )
113902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtrc in configuration namelist' )
114      IF(lwm) WRITE( numont, namtrc_run )
115
116      nittrc000 = nit000             ! first time step of tracer model
117
118      IF(lwp) THEN                   ! control print
119         WRITE(numout,*) '   Namelist : namtrc_run'
120         WRITE(numout,*) '      restart  for passive tracer                  ln_rsttr      = ', ln_rsttr
121         WRITE(numout,*) '      control of time step for passive tracer      nn_rsttr      = ', nn_rsttr
122         WRITE(numout,*) '      first time step for pass. trac.              nittrc000     = ', nittrc000
123         WRITE(numout,*) '      Use euler integration for TRC (y/n)          ln_top_euler  = ', ln_top_euler
124      ENDIF
125      !
126   END SUBROUTINE trc_nam_run
127
128
129   SUBROUTINE trc_nam_trc
130      !!---------------------------------------------------------------------
131      !!                     ***  ROUTINE trc_nam  ***
132      !!
133      !! ** Purpose :   read options for the passive tracer run (namelist)
134      !!
135      !!---------------------------------------------------------------------
136      INTEGER ::   ios, ierr, icfc       ! Local integer
137      !!
138      NAMELIST/namtrc/jp_bgc, ln_pisces, ln_my_trc, ln_age, ln_cfc11, ln_cfc12, ln_sf6, ln_c14, &
139         &            sn_tracer, ln_trcdta, ln_trcbc, ln_trcdmp, ln_trcdmp_clo, jp_dia3d, jp_dia2d, &
140         &            ln_trcais
141      !!---------------------------------------------------------------------
142      ! Dummy settings to fill tracers data structure
143      !                  !   name   !   title   !   unit   !   init  !   sbc   !   cbc   !   obc   !   ais   !
144      sn_tracer = PTRACER( 'NONAME' , 'NOTITLE' , 'NOUNIT' , .false. , .false. , .false. , .false. , .false. )
145      !
146      IF(lwp) WRITE(numout,*)
147      IF(lwp) WRITE(numout,*) 'trc_nam_trc : read the passive tracer namelists'
148      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~'
149
150      READ  ( numnat_ref, namtrc, IOSTAT = ios, ERR = 901)
151901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtrc in reference namelist' )
152      READ  ( numnat_cfg, namtrc, IOSTAT = ios, ERR = 902 )
153902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtrc in configuration namelist' )
154      IF(lwm) WRITE( numont, namtrc )
155
156      ! Control settings
157      IF( ln_pisces .AND. ln_my_trc )   CALL ctl_stop( 'Choose only ONE BGC model - PISCES or MY_TRC' )
158      IF( .NOT. ln_pisces .AND. .NOT. ln_my_trc )   jp_bgc = 0
159      ll_cfc = ln_cfc11 .OR. ln_cfc12 .OR. ln_sf6
160      !
161      jptra       =  0
162      jp_pisces   =  0    ;   jp_pcs0  =  0    ;   jp_pcs1  = 0
163      jp_my_trc   =  0    ;   jp_myt0  =  0    ;   jp_myt1  = 0
164      jp_cfc      =  0    ;   jp_cfc0  =  0    ;   jp_cfc1  = 0
165      jp_age      =  0    ;   jp_c14   =  0
166      !
167      IF( ln_pisces )  THEN
168         jp_pisces = jp_bgc
169         jp_pcs0   = 1
170         jp_pcs1   = jp_pisces
171      ENDIF
172      IF( ln_my_trc )  THEN
173          jp_my_trc = jp_bgc
174          jp_myt0   = 1
175          jp_myt1   = jp_my_trc
176      ENDIF
177      !
178      jptra  = jp_bgc
179      !
180      IF( ln_age )    THEN
181         jptra     = jptra + 1
182         jp_age    = jptra
183      ENDIF
184      IF( ln_cfc11 )  jp_cfc = jp_cfc + 1
185      IF( ln_cfc12 )  jp_cfc = jp_cfc + 1
186      IF( ln_sf6   )  jp_cfc = jp_cfc + 1
187      IF( ll_cfc )    THEN
188          jptra     = jptra + jp_cfc
189          jp_cfc0   = jptra - jp_cfc + 1
190          jp_cfc1   = jptra
191      ENDIF
192      IF( ln_c14 )    THEN
193           jptra     = jptra + 1
194           jp_c14    = jptra
195      ENDIF
196      !
197      IF( jptra == 0 )   CALL ctl_stop( 'All TOP tracers disabled: change namtrc setting or check if key_top is active' )
198      !
199      IF(lwp) THEN                   ! control print
200         WRITE(numout,*) '   Namelist : namtrc'
201         WRITE(numout,*) '      Total number of passive tracers              jptra         = ', jptra
202         WRITE(numout,*) '      Total number of BGC tracers                  jp_bgc        = ', jp_bgc
203         WRITE(numout,*) '      Simulating PISCES model                      ln_pisces     = ', ln_pisces
204         WRITE(numout,*) '      Simulating MY_TRC  model                     ln_my_trc     = ', ln_my_trc
205         WRITE(numout,*) '      Simulating water mass age                    ln_age        = ', ln_age
206         WRITE(numout,*) '      Simulating CFC11 passive tracer              ln_cfc11      = ', ln_cfc11
207         WRITE(numout,*) '      Simulating CFC12 passive tracer              ln_cfc12      = ', ln_cfc12
208         WRITE(numout,*) '      Simulating SF6 passive tracer                ln_sf6        = ', ln_sf6
209         WRITE(numout,*) '      Total number of CFCs tracers                 jp_cfc        = ', jp_cfc
210         WRITE(numout,*) '      Simulating C14   passive tracer              ln_c14        = ', ln_c14
211         WRITE(numout,*) '      Read inputs data from file (y/n)             ln_trcdta     = ', ln_trcdta
212         WRITE(numout,*) '      Enable surface, lateral or open boundaries conditions (y/n)  ln_trcbc  = ', ln_trcbc
213         WRITE(numout,*) '      Enable Antarctic Ice Sheet nutrient supply   ln_trcais     = ', ln_trcais
214         WRITE(numout,*) '      Damping of passive tracer (y/n)              ln_trcdmp     = ', ln_trcdmp
215         WRITE(numout,*) '      Restoring of tracer on closed seas           ln_trcdmp_clo = ', ln_trcdmp_clo
216      ENDIF
217      !
218      IF( ll_cfc .OR. ln_c14 ) THEN
219        !                             ! Open namelist files
220        CALL load_nml( numtrc_ref, 'namelist_trc_ref' , numout, lwm )
221        CALL load_nml( numtrc_cfg, 'namelist_trc_cfg' , numout, lwm )
222        IF(lwm) CALL ctl_opn( numonr, 'output.namelist.trc', 'UNKNOWN', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
223        !
224      ENDIF
225      !
226   END SUBROUTINE trc_nam_trc
227
228
229   SUBROUTINE trc_nam_trd
230      !!---------------------------------------------------------------------
231      !!                     ***  ROUTINE trc_nam_dia  ***
232      !!
233      !! ** Purpose :   read options for the passive tracer diagnostics
234      !!
235      !! ** Method  : - read passive tracer namelist
236      !!              - read namelist of each defined SMS model
237      !!                ( (PISCES, CFC, MY_TRC )
238      !!---------------------------------------------------------------------
239#if defined key_trdmxl_trc  || defined key_trdtrc
240      INTEGER  ::   ios, ierr                 ! Local integer
241      !!
242      NAMELIST/namtrc_trd/ nn_trd_trc, nn_ctls_trc, rn_ucf_trc, &
243         &                ln_trdmxl_trc_restart, ln_trdmxl_trc_instant, &
244         &                cn_trdrst_trc_in, cn_trdrst_trc_out, ln_trdtrc
245      !!---------------------------------------------------------------------
246      !
247      IF(lwp) WRITE(numout,*)
248      IF(lwp) WRITE(numout,*) 'trc_nam_trd : read the passive tracer diagnostics options'
249      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~'
250      !
251      ALLOCATE( ln_trdtrc(jptra) ) 
252      !
253      READ  ( numnat_ref, namtrc_trd, IOSTAT = ios, ERR = 905)
254905   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namtrc_trd in reference namelist' )
255      READ  ( numnat_cfg, namtrc_trd, IOSTAT = ios, ERR = 906 )
256906   IF( ios >  0 )   CALL ctl_nam ( ios , 'namtrc_trd in configuration namelist' )
257      IF(lwm) WRITE( numont, namtrc_trd )
258
259      IF(lwp) THEN
260         WRITE(numout,*) '   Namelist : namtrc_trd                    '
261         WRITE(numout,*) '      frequency of trends diagnostics   nn_trd_trc             = ', nn_trd_trc
262         WRITE(numout,*) '      control surface type              nn_ctls_trc            = ', nn_ctls_trc
263         WRITE(numout,*) '      restart for ML diagnostics        ln_trdmxl_trc_restart  = ', ln_trdmxl_trc_restart
264         WRITE(numout,*) '      instantantaneous or mean trends   ln_trdmxl_trc_instant  = ', ln_trdmxl_trc_instant
265         WRITE(numout,*) '      unit conversion factor            rn_ucf_trc             = ', rn_ucf_trc
266         DO jn = 1, jptra
267            IF( ln_trdtrc(jn) ) WRITE(numout,*) '      compute ML trends for tracer number :', jn
268         END DO
269      ENDIF
270#endif
271      !
272   END SUBROUTINE trc_nam_trd
273
274#else
275   !!----------------------------------------------------------------------
276   !!  Dummy module :                                     No passive tracer
277   !!----------------------------------------------------------------------
278CONTAINS
279   SUBROUTINE trc_nam                      ! Empty routine   
280   END SUBROUTINE trc_nam
281   SUBROUTINE trc_nam_run                      ! Empty routine   
282   END SUBROUTINE trc_nam_run
283#endif
284
285   !!======================================================================
286END MODULE trcnam
Note: See TracBrowser for help on using the repository browser.