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

source: branches/2012/dev_CMCC_2012/NEMOGCM/NEMO/TOP_SRC/trcnam.F90 @ 3593

Last change on this file since 3593 was 3593, checked in by vichi, 11 years ago

Add in branch 2012/dev_CMCC_2012 changes from dev_r3365_CMCC1_BDYOBCopt & dev_r3379_CMCC6_topbfm, see ticket 1002

  • Property svn:keywords set to Id
File size: 11.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_lobster    ! LOBSTER namelist
24   USE trcnam_pisces     ! PISCES namelist
25   USE trcnam_cfc        ! CFC SMS namelist
26   USE trcnam_c14b       ! C14 SMS namelist
27   USE trcnam_my_trc     ! MY_TRC SMS namelist
28   USE trdmod_oce       
29   USE trdmod_trc_oce
30   USE iom               ! I/O manager
31
32   IMPLICIT NONE
33   PRIVATE
34
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   SUBROUTINE trc_nam
48      !!---------------------------------------------------------------------
49      !!                     ***  ROUTINE trc_nam  ***
50      !!
51      !! ** Purpose :   READ and PRINT options for the passive tracer run (namelist)
52      !!
53      !! ** Method  : - read passive tracer namelist
54      !!              - read namelist of each defined SMS model
55      !!                ( (LOBSTER, PISCES, CFC, MY_TRC )
56      !!---------------------------------------------------------------------
57      INTEGER ::  jn, ierr
58      ! Definition of a tracer as a structure
59      TYPE(PTRACER), DIMENSION(jptra) :: sn_tracer  ! type of tracer for saving if not key_iomput
60      !!
61      NAMELIST/namtrc/ nn_dttrc, nn_writetrc, ln_rsttr, nn_rsttr, &
62         &             cn_trcrst_in, cn_trcrst_out, sn_tracer, ln_trcdta, ln_trcdmp, &
63         &             ln_top_euler
64#if defined key_trdmld_trc  || defined key_trdtrc
65      NAMELIST/namtrc_trd/ nn_trd_trc, nn_ctls_trc, rn_ucf_trc, &
66         &                ln_trdmld_trc_restart, ln_trdmld_trc_instant, &
67         &                cn_trdrst_trc_in, cn_trdrst_trc_out, ln_trdtrc
68#endif
69      NAMELIST/namtrc_dia/ ln_diatrc, ln_diabio, nn_writedia, nn_writebio
70
71      !!---------------------------------------------------------------------
72
73      IF(lwp) WRITE(numout,*) 'trc_nam : read the passive tracer namelists'
74      IF(lwp) WRITE(numout,*) '~~~~~~~'
75
76      CALL ctl_opn( numnat, 'namelist_top', 'OLD', 'FORMATTED', 'SEQUENTIAL', 1, numout, .FALSE. )
77
78      ! Namelist nattrc (files)
79      ! ----------------------------------------------
80      nn_dttrc      = 1                 ! default values
81      nn_writetrc   = 10 
82      ln_top_euler  = .FALSE.
83      ln_rsttr      = .FALSE.
84      nn_rsttr      =  0
85      cn_trcrst_in  = 'restart_trc'
86      cn_trcrst_out = 'restart_trc'
87      !
88      DO jn = 1, jptra
89         WRITE( sn_tracer(jn)%clsname,'("TR_",I1)'           ) jn
90         WRITE( sn_tracer(jn)%cllname,'("TRACER NUMBER ",I1)') jn
91         sn_tracer(jn)%clunit  = 'mmole/m3'
92         sn_tracer(jn)%llinit  = .FALSE.
93         sn_tracer(jn)%llsave  = .TRUE.
94      END DO
95      ln_trcdta = .FALSE.
96      ln_trcdmp = .FALSE.
97
98
99      REWIND( numnat )               ! read nattrc
100      READ  ( numnat, namtrc )
101
102      DO jn = 1, jptra
103         ctrcnm    (jn) = TRIM( sn_tracer(jn)%clsname )
104         ctrcln    (jn) = TRIM( sn_tracer(jn)%cllname )
105         ctrcun    (jn) = TRIM( sn_tracer(jn)%clunit  )
106         ln_trc_ini(jn) =       sn_tracer(jn)%llinit
107         ln_trc_wri(jn) =       sn_tracer(jn)%llsave
108      END DO
109
110      !!KPE  computes the first time step of tracer model
111      nittrc000 = nit000 + nn_dttrc - 1
112 
113
114      IF(lwp) THEN                   ! control print
115         WRITE(numout,*)
116         WRITE(numout,*) ' Namelist : namtrc'
117         WRITE(numout,*) '   time step freq. for passive tracer           nn_dttrc      = ', nn_dttrc
118         WRITE(numout,*) '   restart  for passive tracer                  ln_rsttr      = ', ln_rsttr
119         WRITE(numout,*) '   control of time step for passive tracer      nn_rsttr      = ', nn_rsttr
120         WRITE(numout,*) '   first time step for pass. trac.              nittrc000     = ', nittrc000
121         WRITE(numout,*) '   frequency of outputs for passive tracers     nn_writetrc   = ', nn_writetrc 
122         WRITE(numout,*) '   Read inputs data from file (y/n)             ln_trcdta     = ', ln_trcdta
123         WRITE(numout,*) '   Damping of passive tracer (y/n)              ln_trcdmp     = ', ln_trcdmp
124         WRITE(numout,*) '   Use euler integration for TRC (y/n)          ln_top_euler  = ', ln_top_euler
125         WRITE(numout,*) ' '
126         DO jn = 1, jptra
127            WRITE(numout,*) '  tracer nb : ', jn, '    short name : ', ctrcnm(jn)
128         END DO
129         WRITE(numout,*) ' '
130      ENDIF
131
132      rdttrc(:) = rdttra(:) * FLOAT( nn_dttrc )   ! vertical profile of passive tracer time-step
133 
134      IF(lwp) THEN                   ! control print
135        WRITE(numout,*) 
136        WRITE(numout,*) '    Passive Tracer  time step    rdttrc  = ', rdttrc(1)
137        WRITE(numout,*) 
138      ENDIF
139
140      ln_diatrc = .FALSE.
141      ln_diabio = .FALSE.
142      nn_writedia = 10
143      nn_writebio = 10
144
145      REWIND( numnat )               !  namelist namtoptrd : passive tracer trends diagnostic
146      READ  ( numnat, namtrc_dia )
147
148      IF(lwp) THEN
149         WRITE(numout,*)
150         WRITE(numout,*)
151         WRITE(numout,*) ' Namelist : namtrc_dia'
152         WRITE(numout,*) '    save additionnal diagnostics arrays         ln_diatrc   = ', ln_diatrc
153         WRITE(numout,*) '    save additionnal biology diagnostics arrays ln_diabio   = ', ln_diabio
154         WRITE(numout,*) '    frequency of outputs for additional arrays  nn_writedia = ', nn_writedia
155         WRITE(numout,*) '    frequency of outputs for biological trends  nn_writebio = ', nn_writebio
156         WRITE(numout,*) ' '
157      ENDIF
158
159      IF( ln_diatrc .AND. .NOT. lk_iomput ) THEN
160         ALLOCATE( trc2d(jpi,jpj,jpdia2d), trc3d(jpi,jpj,jpk,jpdia3d),  &
161           &       ctrc2d(jpdia2d), ctrc2l(jpdia2d), ctrc2u(jpdia2d) ,  & 
162           &       ctrc3d(jpdia3d), ctrc3l(jpdia3d), ctrc3u(jpdia3d) ,  STAT = ierr ) 
163         IF( ierr > 0 )   CALL ctl_stop( 'STOP', 'trcnam: unable to allocate add. diag. array' )
164      ENDIF
165
166      IF( ( ln_diabio .AND. .NOT. lk_iomput ) .OR. l_trdtrc ) THEN
167         ALLOCATE( trbio (jpi,jpj,jpk,jpdiabio) , &
168           &       ctrbio(jpdiabio), ctrbil(jpdiabio), ctrbiu(jpdiabio), STAT = ierr ) 
169         IF( ierr > 0 )   CALL ctl_stop( 'STOP', 'trcnam: unable to allocate bio. diag. array' )
170      ENDIF
171
172      ! namelist of transport
173      ! ---------------------
174      CALL trc_nam_trp
175
176
177      IF( ln_trcdmp .AND. .NOT.ln_trcdta ) THEN
178         CALL ctl_warn( 'trc_nam: passive tracer damping requires data from files we set ln_trcdta to TRUE' )
179         ln_trcdta = .TRUE.
180      ENDIF
181      !
182      IF( ln_rsttr .AND. .NOT.ln_trcdmp .AND. ln_trcdta ) THEN
183          CALL ctl_warn( 'trc_nam: passive tracer restart and  data intialisation, ',   &
184             &           'we keep the restart values and set ln_trcdta to FALSE' )
185         ln_trcdta = .FALSE.
186      ENDIF
187      !
188      IF( .NOT.ln_trcdta ) THEN
189         ln_trc_ini(:) = .FALSE.
190      ENDIF
191
192      IF(lwp) THEN                   ! control print
193         IF( ln_rsttr ) THEN
194            WRITE(numout,*)
195            WRITE(numout,*) '    read a restart file for passive tracer : ', TRIM( cn_trcrst_in )
196            WRITE(numout,*)
197         ELSE
198            IF( .NOT.ln_trcdta ) THEN
199                WRITE(numout,*)
200                WRITE(numout,*) '  All the passive tracers are initialised with constant values '
201                WRITE(numout,*)
202            ENDIF
203         ENDIF
204      ENDIF
205
206
207#if defined key_trdmld_trc || defined key_trdtrc
208         nn_trd_trc  = 20
209         nn_ctls_trc =  9
210         rn_ucf_trc   =  1.
211         ln_trdmld_trc_instant = .TRUE.
212         ln_trdmld_trc_restart =.FALSE.
213         cn_trdrst_trc_in  = "restart_mld_trc"
214         cn_trdrst_trc_out = "restart_mld_trc"
215         ln_trdtrc(:) = .FALSE.
216
217         REWIND( numnat )               !  namelist namtoptrd : passive tracer trends diagnostic
218         READ  ( numnat, namtrc_trd )
219
220         IF(lwp) THEN
221            WRITE(numout,*)
222            WRITE(numout,*) ' trd_mld_trc_init : read namelist namtrc_trd                    '
223            WRITE(numout,*) ' ~~~~~~~~~~~~~~~~                                               '
224            WRITE(numout,*) '   * frequency of trends diagnostics   nn_trd_trc             = ', nn_trd_trc
225            WRITE(numout,*) '   * control surface type              nn_ctls_trc            = ', nn_ctls_trc
226            WRITE(numout,*) '   * restart for ML diagnostics        ln_trdmld_trc_restart  = ', ln_trdmld_trc_restart
227            WRITE(numout,*) '   * flag to diagnose trends of                                 '
228            WRITE(numout,*) '     instantantaneous or mean ML T/S   ln_trdmld_trc_instant  = ', ln_trdmld_trc_instant
229            WRITE(numout,*) '   * unit conversion factor            rn_ucf_trc             = ', rn_ucf_trc
230            DO jn = 1, jptra
231               IF( ln_trdtrc(jn) ) WRITE(numout,*) '    compute ML trends for tracer number :', jn
232            END DO
233         ENDIF
234#endif
235
236
237      ! namelist of SMS
238      ! ---------------     
239      IF( lk_lobster ) THEN   ;   CALL trc_nam_lobster      ! LOBSTER bio-model
240      ELSE                    ;   IF(lwp) WRITE(numout,*) '          LOBSTER not used'
241      ENDIF
242
243      IF( lk_pisces  ) THEN   ;   CALL trc_nam_pisces      ! PISCES  bio-model
244      ELSE                    ;   IF(lwp) WRITE(numout,*) '          PISCES not used'
245      ENDIF
246
247      IF( lk_cfc     ) THEN   ;   CALL trc_nam_cfc         ! CFC     tracers
248      ELSE                    ;   IF(lwp) WRITE(numout,*) '          CFC not used'
249      ENDIF
250
251      IF( lk_c14b     ) THEN   ;   CALL trc_nam_c14b         ! C14 bomb     tracers
252      ELSE                    ;   IF(lwp) WRITE(numout,*) '          C14 not used'
253      ENDIF
254
255      IF( lk_my_trc  ) THEN   ;   CALL trc_nam_my_trc      ! MY_TRC  tracers
256      ELSE                    ;   IF(lwp) WRITE(numout,*) '          MY_TRC not used'
257      ENDIF
258      !
259   END SUBROUTINE trc_nam
260
261#else
262   !!----------------------------------------------------------------------
263   !!  Dummy module :                                     No passive tracer
264   !!----------------------------------------------------------------------
265CONTAINS
266   SUBROUTINE trc_nam                      ! Empty routine   
267   END SUBROUTINE trc_nam
268#endif
269
270   !!----------------------------------------------------------------------
271   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
272   !! $Id$
273   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
274   !!======================================================================
275END MODULE  trcnam
Note: See TracBrowser for help on using the repository browser.