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.
trcini.F90 in branches/2011/dev_r2787_PISCES_improvment/NEMOGCM/NEMO/TOP_SRC – NEMO

source: branches/2011/dev_r2787_PISCES_improvment/NEMOGCM/NEMO/TOP_SRC/trcini.F90 @ 2957

Last change on this file since 2957 was 2957, checked in by cetlod, 13 years ago

dev_r2787_PISCES_improvment:keep the possiblity to switch between old and new parameterisation of production

  • Property svn:keywords set to Id
File size: 9.4 KB
Line 
1MODULE trcini
2   !!======================================================================
3   !!                         ***  MODULE trcini  ***
4   !! TOP :   Manage the passive tracer initialization
5   !!======================================================================
6   !! History :   -   ! 1991-03 (O. Marti)  original code
7   !!            1.0  ! 2005-03 (O. Aumont, A. El Moussaoui) F90
8   !!            2.0  ! 2005-10 (C. Ethe, G. Madec) revised architecture
9   !!            4.0  ! 2011-01 (A. R. Porter, STFC Daresbury) dynamical allocation
10   !!----------------------------------------------------------------------
11#if defined key_top
12   !!----------------------------------------------------------------------
13   !!   'key_top'                                                TOP models
14   !!----------------------------------------------------------------------
15   !!   trc_init  :   Initialization for passive tracer
16   !!   top_alloc :   allocate the TOP arrays
17   !!----------------------------------------------------------------------
18   USE oce_trc
19   USE trc
20   USE trcrst
21   USE trcnam          ! Namelist read
22   USE trcini_cfc      ! CFC      initialisation
23   USE trcini_lobster  ! LOBSTER  initialisation
24   USE trcini_pisces   ! PISCES   initialisation
25   USE trcini_c14b     ! C14 bomb initialisation
26   USE trcini_my_trc   ! MY_TRC   initialisation
27   USE trcdta   
28   USE daymod
29   USE zpshde          ! partial step: hor. derivative   (zps_hde routine)
30   USE prtctl_trc      ! Print control passive tracers (prt_ctl_trc_init routine)
31   
32   IMPLICIT NONE
33   PRIVATE
34   
35   PUBLIC   trc_init   ! called by opa
36
37    !! * Substitutions
38#  include "domzgr_substitute.h90"
39   !!----------------------------------------------------------------------
40   !! NEMO/TOP 4.0 , NEMO Consortium (2011)
41   !! $Id$
42   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
43   !!----------------------------------------------------------------------
44CONTAINS
45   
46   SUBROUTINE trc_init
47      !!---------------------------------------------------------------------
48      !!                     ***  ROUTINE trc_init  ***
49      !!
50      !! ** Purpose :   Initialization of the passive tracer fields
51      !!
52      !! ** Method  : - read namelist
53      !!              - control the consistancy
54      !!              - compute specific initialisations
55      !!              - set initial tracer fields (either read restart
56      !!                or read data or analytical formulation
57      !!---------------------------------------------------------------------
58      !
59      INTEGER                                       ::   jk, jn    ! dummy loop indices
60      REAL(wp)                                      :: zareatot
61      REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: zvolume     ! volume of ocean
62      CHARACTER (len=25)                            :: charout
63      !!---------------------------------------------------------------------
64
65      IF(lwp) WRITE(numout,*)
66      IF(lwp) WRITE(numout,*) 'trc_init : initial set up of the passive tracers'
67      IF(lwp) WRITE(numout,*) '~~~~~~~'
68
69      CALL top_alloc()              ! allocate TOP arrays
70
71      ALLOCATE( zvolume(ji,jj,jk) )
72
73      CALL trc_nam                  ! read passive tracers namelists
74
75      !                             ! restart for passive tracer (input)
76      IF( ln_rsttr ) THEN
77         IF(lwp) WRITE(numout,*) '       read a restart file for passive tracer : ', cn_trcrst_in
78         IF(lwp) WRITE(numout,*) ' '
79      ELSE
80         IF( lwp .AND. lk_dtatrc ) THEN
81            DO jn = 1, jptra
82               IF( lutini(jn) )  &                  ! open input FILE only IF lutini(jn) is true
83                  &  WRITE(numout,*) ' read an initial file for passive tracer number :', jn, ' traceur : ', ctrcnm(jn) 
84             END DO
85          ENDIF
86          IF( lwp ) WRITE(numout,*)
87      ENDIF
88
89      IF( ln_dm2dc .AND. ( lk_pisces .OR. lk_lobster ) )    &
90         &       CALL ctl_stop( ' The diurnal cycle is not compatible with PISCES or LOBSTER  ' )
91
92      IF( nn_cla == 1 )   &
93         &       CALL ctl_stop( ' Cross Land Advection not yet implemented with passive tracer ; nn_cla must be 0' )
94
95      IF( lk_lobster ) THEN   ;   CALL trc_ini_lobster      ! LOBSTER bio-model
96      ELSE                    ;   IF(lwp) WRITE(numout,*) '          LOBSTER not used'
97      ENDIF
98     
99      IF( lk_pisces  ) THEN   ;   CALL trc_ini_pisces       ! PISCES  bio-model
100      ELSE                    ;   IF(lwp) WRITE(numout,*) '          PISCES not used'
101      ENDIF
102     
103      IF( lk_cfc     ) THEN   ;   CALL trc_ini_cfc          ! CFC     tracers
104      ELSE                    ;   IF(lwp) WRITE(numout,*) '          CFC not used'
105      ENDIF
106
107      IF( lk_c14b    ) THEN   ;   CALL trc_ini_c14b         ! C14 bomb  tracer
108      ELSE                    ;   IF(lwp) WRITE(numout,*) '          C14 not used'
109      ENDIF
110     
111      IF( lk_my_trc  ) THEN   ;   CALL trc_ini_my_trc       ! MY_TRC  tracers
112      ELSE                    ;   IF(lwp) WRITE(numout,*) '          MY_TRC not used'
113      ENDIF
114
115      IF( ln_rsttr ) THEN
116        !
117        IF( lk_offline )  neuler = 1   ! Set time-step indicator at nit000 (leap-frog)
118        CALL trc_rst_read              ! restart from a file
119        !
120      ELSE
121        IF( lk_offline )  THEN
122           neuler = 0                  ! Set time-step indicator at nit000 (euler)
123           CALL day_init               ! set calendar
124        ENDIF
125#if defined key_dtatrc
126        CALL trc_dta( nit000 )      ! Initialization of tracer from a file that may also be used for damping
127        DO jn = 1, jptra
128           IF( lutini(jn) )   trn(:,:,:,jn) = trdta(:,:,:,jn) * tmask(:,:,:)   ! initialisation from file if required
129        END DO
130#endif
131        trb(:,:,:,:) = trn(:,:,:,:)
132        !
133      ENDIF
134 
135      tra(:,:,:,:) = 0._wp
136     
137      IF( ln_zps .AND. .NOT. lk_c1d )   &              ! Partial steps: before horizontal gradient of passive
138        &    CALL zps_hde( nit000, jptra, trn, gtru, gtrv )       ! tracers at the bottom ocean level
139
140
141      !                                                              ! masked grid volume
142      zvolume(:,:,:) = e1e2t(:,:)  * fse3t(:,:,jk) * tmask(:,:,jk)   
143#if defined key_degrad
144      zvolume(:,:,:) = zvolume(:,:,:) * facvol(:,:,:)
145#endif
146      zareatot       = glob_sum( zvolume(:,:,:) )                    ! total volume of ocean
147
148      trai = 0._wp                                                   ! initial content of all tracers
149      DO jn = 1, jptra
150         trai = trai + glob_sum( trn(:,:,:,jn) * zvolume(:,:,:)   )
151      END DO     
152
153      IF(lwp) THEN               ! control print
154         WRITE(numout,*)
155         WRITE(numout,*)
156         WRITE(numout,*) '          *** Total number of passive tracer jptra = ', jptra
157         WRITE(numout,*) '          *** Total volume of ocean                = ', zareatot
158         WRITE(numout,*) '          *** Total inital content of all tracers  = ', trai
159         WRITE(numout,*)
160      ENDIF
161
162      IF(ln_ctl) THEN            ! print mean trends (used for debugging)
163         CALL prt_ctl_trc_init
164         WRITE(charout, FMT="('ini ')")
165         CALL prt_ctl_trc_info( charout )
166         CALL prt_ctl_trc( tab4d=trn, mask=tmask, clinfo=ctrcnm )
167      ENDIF
168      !
169   END SUBROUTINE trc_init
170
171
172   SUBROUTINE top_alloc
173      !!----------------------------------------------------------------------
174      !!                     ***  ROUTINE top_alloc  ***
175      !!
176      !! ** Purpose :   Allocate all the dynamic arrays of the OPA modules
177      !!----------------------------------------------------------------------
178      USE trcadv        , ONLY:   trc_adv_alloc          ! TOP-related alloc routines...
179      USE trc           , ONLY:   trc_alloc
180      USE trcnxt        , ONLY:   trc_nxt_alloc
181      USE trczdf        , ONLY:   trc_zdf_alloc
182      USE trdmod_trc_oce, ONLY:   trd_mod_trc_oce_alloc
183#if ! defined key_iomput
184      USE trcdia        , ONLY:   trc_dia_alloc
185#endif
186#if defined key_trcdmp 
187      USE trcdmp        , ONLY:   trc_dmp_alloc
188#endif
189#if defined key_dtatrc
190      USE trcdta        , ONLY:   trc_dta_alloc
191#endif
192#if defined key_trdmld_trc   ||   defined key_esopa
193      USE trdmld_trc    , ONLY:   trd_mld_trc_alloc
194#endif
195      !
196      INTEGER :: ierr
197      !!----------------------------------------------------------------------
198      !
199      ierr =        trc_adv_alloc()          ! Start of TOP-related alloc routines...
200      ierr = ierr + trc_alloc    ()
201      ierr = ierr + trc_nxt_alloc()
202      ierr = ierr + trc_zdf_alloc()
203      ierr = ierr + trd_mod_trc_oce_alloc()
204#if ! defined key_iomput
205      ierr = ierr + trc_dia_alloc()
206#endif
207#if defined key_trcdmp 
208      ierr = ierr + trc_dmp_alloc()
209#endif
210#if defined key_dtatrc
211      ierr = ierr + trc_dta_alloc()
212#endif
213#if defined key_trdmld_trc   ||   defined key_esopa
214      ierr = ierr + trd_mld_trc_alloc()
215#endif
216      !
217      IF( lk_mpp    )   CALL mpp_sum( ierr )
218      IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'top_alloc : unable to allocate standard ocean arrays' )
219      !
220   END SUBROUTINE top_alloc
221
222#else
223   !!----------------------------------------------------------------------
224   !!  Empty module :                                     No passive tracer
225   !!----------------------------------------------------------------------
226CONTAINS
227   SUBROUTINE trc_init                      ! Dummy routine   
228   END SUBROUTINE trc_init
229#endif
230
231   !!======================================================================
232END MODULE trcini
Note: See TracBrowser for help on using the repository browser.