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/UKMO/CO5_package_branch/NEMOGCM/NEMO/TOP_SRC – NEMO

source: branches/UKMO/CO5_package_branch/NEMOGCM/NEMO/TOP_SRC/trcini.F90 @ 8554

Last change on this file since 8554 was 7363, checked in by deazer, 8 years ago

Removed Keywords

File size: 9.3 KB
RevLine 
[268]1MODULE trcini
[945]2   !!======================================================================
3   !!                         ***  MODULE trcini  ***
4   !! TOP :   Manage the passive tracer initialization
5   !!======================================================================
[2715]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
[274]10   !!----------------------------------------------------------------------
[1011]11#if defined key_top
12   !!----------------------------------------------------------------------
13   !!   'key_top'                                                TOP models
14   !!----------------------------------------------------------------------
[2715]15   !!   trc_init  :   Initialization for passive tracer
16   !!   top_alloc :   allocate the TOP arrays
[1011]17   !!----------------------------------------------------------------------
[3294]18   USE oce_trc         ! shared variables between ocean and passive tracers
19   USE trc             ! passive tracers common variables
20   USE trcrst          ! passive tracers restart
[2528]21   USE trcnam          ! Namelist read
[1254]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
[3294]27   USE trcdta          ! initialisation form files
28   USE daymod          ! calendar manager
[2528]29   USE zpshde          ! partial step: hor. derivative   (zps_hde routine)
[1011]30   USE prtctl_trc      ! Print control passive tracers (prt_ctl_trc_init routine)
[3294]31   USE trcsub       ! variables to substep passive tracers
[1011]32   
[335]33   IMPLICIT NONE
34   PRIVATE
[1011]35   
[2528]36   PUBLIC   trc_init   ! called by opa
[268]37
[1011]38    !! * Substitutions
39#  include "domzgr_substitute.h90"
[2715]40   !!----------------------------------------------------------------------
41   !! NEMO/TOP 4.0 , NEMO Consortium (2011)
[7363]42   !! $Id$
[2715]43   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
44   !!----------------------------------------------------------------------
[335]45CONTAINS
[1011]46   
[2528]47   SUBROUTINE trc_init
[1011]48      !!---------------------------------------------------------------------
[2528]49      !!                     ***  ROUTINE trc_init  ***
[335]50      !!
[1011]51      !! ** Purpose :   Initialization of the passive tracer fields
52      !!
53      !! ** Method  : - read namelist
54      !!              - control the consistancy
55      !!              - compute specific initialisations
56      !!              - set initial tracer fields (either read restart
57      !!                or read data or analytical formulation
58      !!---------------------------------------------------------------------
[3294]59      INTEGER ::   jk, jn, jl    ! dummy loop indices
[1011]60      CHARACTER (len=25) :: charout
[3294]61      REAL(wp), POINTER, DIMENSION(:,:,:,:) ::  ztrcdta   ! 4D  workspace
[1011]62      !!---------------------------------------------------------------------
[3294]63      !
64      IF( nn_timing == 1 )   CALL timing_start('trc_init')
65      !
[945]66      IF(lwp) WRITE(numout,*)
[2528]67      IF(lwp) WRITE(numout,*) 'trc_init : initial set up of the passive tracers'
[945]68      IF(lwp) WRITE(numout,*) '~~~~~~~'
[1011]69
[2715]70      CALL top_alloc()              ! allocate TOP arrays
71
[3294]72      IF( ln_dm2dc .AND. ( lk_pisces .OR. lk_lobster ) )    &
73         &  CALL ctl_stop( ' The diurnal cycle is not compatible with PISCES or LOBSTER  ' )
[1254]74
[3294]75      IF( nn_cla == 1 )   &
76         &  CALL ctl_stop( ' Cross Land Advection not yet implemented with passive tracer ; nn_cla must be 0' )
[1011]77
[2715]78      CALL trc_nam                  ! read passive tracers namelists
[3294]79      !
80      IF(lwp) WRITE(numout,*)
[2528]81      IF( ln_rsttr ) THEN
[3294]82        !
83        IF( lk_offline )  neuler = 1   ! Set time-step indicator at nit000 (leap-frog)
84        CALL trc_rst_cal( nittrc000, 'READ' )   ! calendar
85        !
[2528]86      ELSE
[3294]87        IF( lk_offline )  THEN
88           neuler = 0                  ! Set time-step indicator at nit000 (euler)
89           CALL day_init               ! set calendar
90        ENDIF
91        !
[2528]92      ENDIF
[3294]93      IF(lwp) WRITE(numout,*)
94                                                              ! masked grid volume
95      !                                                              ! masked grid volume
96      DO jk = 1, jpk
97         cvol(:,:,jk) = e1e2t(:,:) * fse3t(:,:,jk) * tmask(:,:,jk)
98      END DO
99      IF( lk_degrad ) cvol(:,:,:) = cvol(:,:,:) * facvol(:,:,:)      ! degrad option: reduction by facvol
100      !                                                              ! total volume of the ocean
101      areatot = glob_sum( cvol(:,:,:) )
[1011]102
[3294]103      IF( lk_lobster )       CALL trc_ini_lobster      ! LOBSTER bio-model
104      IF( lk_pisces  )       CALL trc_ini_pisces       ! PISCES  bio-model
105      IF( lk_cfc     )       CALL trc_ini_cfc          ! CFC     tracers
106      IF( lk_c14b    )       CALL trc_ini_c14b         ! C14 bomb  tracer
107      IF( lk_my_trc  )       CALL trc_ini_my_trc       ! MY_TRC  tracers
[2528]108
[3294]109      IF( lwp ) THEN
110         !
111         CALL ctl_opn( numstr, 'tracer.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE., narea )
112         !
[945]113      ENDIF
[1254]114
[3294]115      IF( ln_trcdta )      CALL trc_dta_init
[1011]116
[3294]117
[2528]118      IF( ln_rsttr ) THEN
119        !
120        CALL trc_rst_read              ! restart from a file
121        !
[1011]122      ELSE
[3294]123        !
124        IF( ln_trcdta .AND. nb_trcdta > 0 ) THEN  ! Initialisation of tracer from a file that may also be used for damping
125            !
126            CALL wrk_alloc( jpi, jpj, jpk, nb_trcdta, ztrcdta )    ! Memory allocation
127            !
128            CALL trc_dta( nit000, ztrcdta )   ! read tracer data at nit000
129            !
130            DO jn = 1, jptra
131               IF( ln_trc_ini(jn) ) THEN      ! update passive tracers arrays with input data read from file
132                  jl = n_trc_index(jn) 
133                  trn(:,:,:,jn) = ztrcdta(:,:,:,jl) * tmask(:,:,:) 
134               ENDIF
135            ENDDO
136            CALL wrk_dealloc( jpi, jpj, jpk, nb_trcdta, ztrcdta )
[2528]137        ENDIF
[3294]138        !
[2528]139        trb(:,:,:,:) = trn(:,:,:,:)
140        !
[1011]141      ENDIF
[2528]142 
[2715]143      tra(:,:,:,:) = 0._wp
[1286]144     
[2528]145      IF( ln_zps .AND. .NOT. lk_c1d )   &              ! Partial steps: before horizontal gradient of passive
[2715]146        &    CALL zps_hde( nit000, jptra, trn, gtru, gtrv )       ! tracers at the bottom ocean level
[1177]147
[3294]148      !
149      IF( nn_dttrc /= 1 )        CALL trc_sub_ini      ! Initialize variables for substepping passive tracers
150      !
[1286]151
[3294]152      trai(:) = 0._wp                                                   ! initial content of all tracers
[1011]153      DO jn = 1, jptra
[3294]154         trai(jn) = trai(jn) + glob_sum( trn(:,:,:,jn) * cvol(:,:,:)   )
155      END DO
[1011]156
[2715]157      IF(lwp) THEN               ! control print
158         WRITE(numout,*)
159         WRITE(numout,*)
160         WRITE(numout,*) '          *** Total number of passive tracer jptra = ', jptra
161         WRITE(numout,*) '          *** Total volume of ocean                = ', areatot
[3294]162         WRITE(numout,*) '          *** Total inital content of all tracers '
[2715]163         WRITE(numout,*)
[3294]164         DO jn = 1, jptra
165            WRITE(numout,9000) jn, TRIM( ctrcnm(jn) ), trai(jn)
166         ENDDO
167         WRITE(numout,*)
[2715]168      ENDIF
[3294]169      IF(lwp) WRITE(numout,*)
[2715]170      IF(ln_ctl) THEN            ! print mean trends (used for debugging)
171         CALL prt_ctl_trc_init
[1011]172         WRITE(charout, FMT="('ini ')")
173         CALL prt_ctl_trc_info( charout )
174         CALL prt_ctl_trc( tab4d=trn, mask=tmask, clinfo=ctrcnm )
175      ENDIF
[3294]1769000  FORMAT(' tracer nb : ',i2,'      name :',a10,'      initial content :',e18.10)
[2715]177      !
[3294]178      IF( nn_timing == 1 )   CALL timing_stop('trc_init')
179      !
[2528]180   END SUBROUTINE trc_init
[268]181
[2715]182
183   SUBROUTINE top_alloc
184      !!----------------------------------------------------------------------
185      !!                     ***  ROUTINE top_alloc  ***
186      !!
187      !! ** Purpose :   Allocate all the dynamic arrays of the OPA modules
188      !!----------------------------------------------------------------------
189      USE trcadv        , ONLY:   trc_adv_alloc          ! TOP-related alloc routines...
190      USE trc           , ONLY:   trc_alloc
191      USE trcnxt        , ONLY:   trc_nxt_alloc
192      USE trczdf        , ONLY:   trc_zdf_alloc
193      USE trdmod_trc_oce, ONLY:   trd_mod_trc_oce_alloc
[3294]194#if defined key_trdmld_trc 
[2715]195      USE trdmld_trc    , ONLY:   trd_mld_trc_alloc
196#endif
197      !
198      INTEGER :: ierr
199      !!----------------------------------------------------------------------
200      !
201      ierr =        trc_adv_alloc()          ! Start of TOP-related alloc routines...
202      ierr = ierr + trc_alloc    ()
203      ierr = ierr + trc_nxt_alloc()
204      ierr = ierr + trc_zdf_alloc()
205      ierr = ierr + trd_mod_trc_oce_alloc()
[3294]206#if defined key_trdmld_trc 
[2715]207      ierr = ierr + trd_mld_trc_alloc()
208#endif
209      !
210      IF( lk_mpp    )   CALL mpp_sum( ierr )
211      IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'top_alloc : unable to allocate standard ocean arrays' )
212      !
213   END SUBROUTINE top_alloc
214
[1011]215#else
216   !!----------------------------------------------------------------------
217   !!  Empty module :                                     No passive tracer
218   !!----------------------------------------------------------------------
219CONTAINS
[2528]220   SUBROUTINE trc_init                      ! Dummy routine   
221   END SUBROUTINE trc_init
[1011]222#endif
223
[335]224   !!======================================================================
[268]225END MODULE trcini
Note: See TracBrowser for help on using the repository browser.