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

source: branches/UKMO/dev_r5518_GO6_package/NEMOGCM/NEMO/TOP_SRC/trcini.F90 @ 6793

Last change on this file since 6793 was 6793, checked in by davestorkey, 8 years ago

Merge in changes r6482:6692 from the nemo_v3_6_STABLE branch. Only part that changes results for GO6 configurations is a bug fix for the TVD advection scheme put in at r6692.
Custom merge into /branches/UKMO/dev_r5518_GO6_package/NEMOGCM: r6692 cf. r6688 of /branches/2015/nemo_v3_6_STABLE/NEMOGCM@6791

Custom merge into /branches/UKMO/dev_r5518_GO6_package/NEMOGCM: r6688 cf. r6482 of /branches/2015/nemo_v3_6_STABLE/NEMOGCM@6791

File size: 9.9 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_pisces   ! PISCES   initialisation
24   USE trcini_c14b     ! C14 bomb initialisation
25   USE trcini_my_trc   ! MY_TRC   initialisation
[4230]26   USE trcdta          ! initialisation from files
[3294]27   USE daymod          ! calendar manager
[2528]28   USE zpshde          ! partial step: hor. derivative   (zps_hde routine)
[1011]29   USE prtctl_trc      ! Print control passive tracers (prt_ctl_trc_init routine)
[4306]30   USE trcsub          ! variables to substep passive tracers
31   USE lib_mpp         ! distribued memory computing library
32   USE sbc_oce
[5385]33   USE trcice          ! tracers in sea ice
[4306]34 
[335]35   IMPLICIT NONE
36   PRIVATE
[1011]37   
[2528]38   PUBLIC   trc_init   ! called by opa
[268]39
[1011]40    !! * Substitutions
41#  include "domzgr_substitute.h90"
[2715]42   !!----------------------------------------------------------------------
43   !! NEMO/TOP 4.0 , NEMO Consortium (2011)
[6486]44   !! $Id$
[2715]45   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
46   !!----------------------------------------------------------------------
[335]47CONTAINS
[1011]48   
[2528]49   SUBROUTINE trc_init
[1011]50      !!---------------------------------------------------------------------
[2528]51      !!                     ***  ROUTINE trc_init  ***
[335]52      !!
[1011]53      !! ** Purpose :   Initialization of the passive tracer fields
54      !!
55      !! ** Method  : - read namelist
56      !!              - control the consistancy
57      !!              - compute specific initialisations
58      !!              - set initial tracer fields (either read restart
59      !!                or read data or analytical formulation
60      !!---------------------------------------------------------------------
[3294]61      INTEGER ::   jk, jn, jl    ! dummy loop indices
[1011]62      CHARACTER (len=25) :: charout
63      !!---------------------------------------------------------------------
[3294]64      !
65      IF( nn_timing == 1 )   CALL timing_start('trc_init')
66      !
[945]67      IF(lwp) WRITE(numout,*)
[2528]68      IF(lwp) WRITE(numout,*) 'trc_init : initial set up of the passive tracers'
[945]69      IF(lwp) WRITE(numout,*) '~~~~~~~'
[1011]70
[2715]71      CALL top_alloc()              ! allocate TOP arrays
72
[5407]73      l_trcdm2dc = ln_dm2dc .OR. ( ln_cpl .AND. ncpl_qsr_freq /= 1 )
[5385]74      l_trcdm2dc = l_trcdm2dc  .AND. .NOT. lk_offline
75      IF( l_trcdm2dc .AND. lwp ) &
76         &   CALL ctl_warn(' Coupling with passive tracers and used of diurnal cycle. &
77         & Computation of a daily mean shortwave for some biogeochemical models) ')
[1254]78
[3294]79      IF( nn_cla == 1 )   &
80         &  CALL ctl_stop( ' Cross Land Advection not yet implemented with passive tracer ; nn_cla must be 0' )
[1011]81
[4152]82      CALL trc_nam      ! read passive tracers namelists
[3294]83      !
84      IF(lwp) WRITE(numout,*)
[4152]85      !
86      IF( ln_rsttr .AND. .NOT. lk_offline ) CALL trc_rst_cal( nit000, 'READ' )   ! calendar
87      !
[3294]88      IF(lwp) WRITE(numout,*)
89                                                              ! masked grid volume
90      !                                                              ! masked grid volume
91      DO jk = 1, jpk
92         cvol(:,:,jk) = e1e2t(:,:) * fse3t(:,:,jk) * tmask(:,:,jk)
93      END DO
94      IF( lk_degrad ) cvol(:,:,:) = cvol(:,:,:) * facvol(:,:,:)      ! degrad option: reduction by facvol
95      !                                                              ! total volume of the ocean
96      areatot = glob_sum( cvol(:,:,:) )
[1011]97
[3294]98      IF( lk_pisces  )       CALL trc_ini_pisces       ! PISCES  bio-model
99      IF( lk_cfc     )       CALL trc_ini_cfc          ! CFC     tracers
100      IF( lk_c14b    )       CALL trc_ini_c14b         ! C14 bomb  tracer
101      IF( lk_my_trc  )       CALL trc_ini_my_trc       ! MY_TRC  tracers
[2528]102
[5385]103      CALL trc_ice_ini                                 ! Tracers in sea ice
104
[3294]105      IF( lwp ) THEN
106         !
[4152]107         CALL ctl_opn( numstr, 'tracer.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp , narea )
[3294]108         !
[945]109      ENDIF
[1254]110
[4230]111      IF( ln_trcdta )      CALL trc_dta_init(jptra)
[1011]112
[3294]113
[2528]114      IF( ln_rsttr ) THEN
115        !
116        CALL trc_rst_read              ! restart from a file
117        !
[1011]118      ELSE
[3294]119        !
120        IF( ln_trcdta .AND. nb_trcdta > 0 ) THEN  ! Initialisation of tracer from a file that may also be used for damping
121            !
122            DO jn = 1, jptra
123               IF( ln_trc_ini(jn) ) THEN      ! update passive tracers arrays with input data read from file
124                  jl = n_trc_index(jn) 
[6793]125                  CALL trc_dta( nit000, sf_trcdta(jl), rf_trfac(jl) )   ! read tracer data at nit000
126                  trn(:,:,:,jn) = sf_trcdta(jl)%fnow(:,:,:) 
[4230]127                  IF( .NOT.ln_trcdmp .AND. .NOT.ln_trcdmp_clo ) THEN      !== deallocate data structure   ==!
128                     !                                                    (data used only for initialisation)
129                     IF(lwp) WRITE(numout,*) 'trc_dta: deallocate data arrays as they are only used to initialize the run'
130                                                  DEALLOCATE( sf_trcdta(jl)%fnow )     !  arrays in the structure
131                     IF( sf_trcdta(jl)%ln_tint )  DEALLOCATE( sf_trcdta(jl)%fdta )
132                     !
133                  ENDIF
[3294]134               ENDIF
135            ENDDO
[6498]136            !
[2528]137        ENDIF
[3294]138        !
[2528]139        trb(:,:,:,:) = trn(:,:,:,:)
140        !
[1011]141      ENDIF
[2528]142 
[2715]143      tra(:,:,:,:) = 0._wp
[5120]144      IF( ln_zps .AND. .NOT. lk_c1d .AND. .NOT. ln_isfcav )   &              ! Partial steps: before horizontal gradient of passive
145        &    CALL zps_hde    ( nit000, jptra, trn, gtru, gtrv  )  ! Partial steps: before horizontal gradient
146      IF( ln_zps .AND. .NOT. lk_c1d .AND.       ln_isfcav )   &
147        &    CALL zps_hde_isf( nit000, jptra, trn, pgtu=gtru, pgtv=gtrv, pgtui=gtrui, pgtvi=gtrvi )       ! tracers at the bottom ocean level
[1177]148
[5120]149
[3294]150      !
151      IF( nn_dttrc /= 1 )        CALL trc_sub_ini      ! Initialize variables for substepping passive tracers
152      !
[1286]153
[3294]154      trai(:) = 0._wp                                                   ! initial content of all tracers
[1011]155      DO jn = 1, jptra
[3294]156         trai(jn) = trai(jn) + glob_sum( trn(:,:,:,jn) * cvol(:,:,:)   )
157      END DO
[1011]158
[2715]159      IF(lwp) THEN               ! control print
160         WRITE(numout,*)
161         WRITE(numout,*)
162         WRITE(numout,*) '          *** Total number of passive tracer jptra = ', jptra
163         WRITE(numout,*) '          *** Total volume of ocean                = ', areatot
[3294]164         WRITE(numout,*) '          *** Total inital content of all tracers '
[2715]165         WRITE(numout,*)
[3294]166         DO jn = 1, jptra
167            WRITE(numout,9000) jn, TRIM( ctrcnm(jn) ), trai(jn)
168         ENDDO
169         WRITE(numout,*)
[2715]170      ENDIF
[3294]171      IF(lwp) WRITE(numout,*)
[2715]172      IF(ln_ctl) THEN            ! print mean trends (used for debugging)
173         CALL prt_ctl_trc_init
[1011]174         WRITE(charout, FMT="('ini ')")
175         CALL prt_ctl_trc_info( charout )
176         CALL prt_ctl_trc( tab4d=trn, mask=tmask, clinfo=ctrcnm )
177      ENDIF
[3294]1789000  FORMAT(' tracer nb : ',i2,'      name :',a10,'      initial content :',e18.10)
[2715]179      !
[3294]180      IF( nn_timing == 1 )   CALL timing_stop('trc_init')
181      !
[2528]182   END SUBROUTINE trc_init
[268]183
[2715]184
185   SUBROUTINE top_alloc
186      !!----------------------------------------------------------------------
187      !!                     ***  ROUTINE top_alloc  ***
188      !!
189      !! ** Purpose :   Allocate all the dynamic arrays of the OPA modules
190      !!----------------------------------------------------------------------
191      USE trcadv        , ONLY:   trc_adv_alloc          ! TOP-related alloc routines...
192      USE trc           , ONLY:   trc_alloc
193      USE trcnxt        , ONLY:   trc_nxt_alloc
194      USE trczdf        , ONLY:   trc_zdf_alloc
[4990]195      USE trdtrc_oce    , ONLY:   trd_trc_oce_alloc
196#if defined key_trdmxl_trc 
197      USE trdmxl_trc    , ONLY:   trd_mxl_trc_alloc
[2715]198#endif
199      !
200      INTEGER :: ierr
201      !!----------------------------------------------------------------------
202      !
203      ierr =        trc_adv_alloc()          ! Start of TOP-related alloc routines...
204      ierr = ierr + trc_alloc    ()
205      ierr = ierr + trc_nxt_alloc()
206      ierr = ierr + trc_zdf_alloc()
[4990]207      ierr = ierr + trd_trc_oce_alloc()
208#if defined key_trdmxl_trc 
209      ierr = ierr + trd_mxl_trc_alloc()
[2715]210#endif
211      !
212      IF( lk_mpp    )   CALL mpp_sum( ierr )
213      IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'top_alloc : unable to allocate standard ocean arrays' )
214      !
215   END SUBROUTINE top_alloc
216
[1011]217#else
218   !!----------------------------------------------------------------------
219   !!  Empty module :                                     No passive tracer
220   !!----------------------------------------------------------------------
221CONTAINS
[2528]222   SUBROUTINE trc_init                      ! Dummy routine   
223   END SUBROUTINE trc_init
[1011]224#endif
225
[335]226   !!======================================================================
[268]227END MODULE trcini
Note: See TracBrowser for help on using the repository browser.