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.
Changeset 6225 for branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/trcini.F90 – NEMO

Ignore:
Timestamp:
2016-01-08T10:35:19+01:00 (8 years ago)
Author:
jamesharle
Message:

Update MPP_BDY_UPDATE branch to be consistent with head of trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2014/dev_r4704_NOC5_MPP_BDY_UPDATE/NEMOGCM/NEMO/TOP_SRC/trcini.F90

    r4607 r6225  
    1818   USE oce_trc         ! shared variables between ocean and passive tracers 
    1919   USE trc             ! passive tracers common variables 
    20    USE trcrst          ! passive tracers restart 
    2120   USE trcnam          ! Namelist read 
    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 
    26    USE trcdta          ! initialisation from files 
    2721   USE daymod          ! calendar manager 
    28    USE zpshde          ! partial step: hor. derivative   (zps_hde routine) 
    2922   USE prtctl_trc      ! Print control passive tracers (prt_ctl_trc_init routine) 
    3023   USE trcsub          ! variables to substep passive tracers 
     24   USE trcrst 
    3125   USE lib_mpp         ! distribued memory computing library 
    3226   USE sbc_oce 
     27   USE trcice          ! tracers in sea ice 
     28   USE trcbc,   only : trc_bc_init ! generalized Boundary Conditions 
    3329  
    3430   IMPLICIT NONE 
     
    3733   PUBLIC   trc_init   ! called by opa 
    3834 
    39     !! * Substitutions 
    40 #  include "domzgr_substitute.h90" 
    4135   !!---------------------------------------------------------------------- 
    4236   !! NEMO/TOP 4.0 , NEMO Consortium (2011) 
     
    5852      !!                or read data or analytical formulation 
    5953      !!--------------------------------------------------------------------- 
    60       INTEGER ::   jk, jn, jl    ! dummy loop indices 
    61       CHARACTER (len=25) :: charout 
    62       REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrcdta   ! 4D  workspace 
    63       !!--------------------------------------------------------------------- 
    6454      ! 
    6555      IF( nn_timing == 1 )   CALL timing_start('trc_init') 
     
    6959      IF(lwp) WRITE(numout,*) '~~~~~~~' 
    7060 
    71       CALL top_alloc()              ! allocate TOP arrays 
    72  
    73 #if defined key_offline 
    74       ltrcdm2dc = .FALSE. 
    75 #endif 
    76  
    77       IF( ltrcdm2dc )CALL ctl_warn( ' Diurnal cycle on physics but not in PISCES or LOBSTER ' ) 
    78  
    79       IF( nn_cla == 1 )   & 
    80          &  CALL ctl_stop( ' Cross Land Advection not yet implemented with passive tracer ; nn_cla must be 0' ) 
    81  
    82       CALL trc_nam      ! read passive tracers namelists 
     61      ! 
     62      CALL top_alloc()   ! allocate TOP arrays 
     63      ! 
     64      CALL trc_ini_ctl   ! control  
     65      ! 
     66      CALL trc_nam       ! read passive tracers namelists 
    8367      ! 
    8468      IF(lwp) WRITE(numout,*) 
     
    8771      ! 
    8872      IF(lwp) WRITE(numout,*) 
    89                                                               ! masked grid volume 
     73      ! 
     74      CALL trc_ini_sms   ! SMS 
     75      ! 
     76      CALL trc_ini_trp   ! passive tracers transport 
     77      ! 
     78      CALL trc_ice_ini   ! Tracers in sea ice 
     79      ! 
     80      IF( lwp )  & 
     81         &  CALL ctl_opn( numstr, 'tracer.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp , narea ) 
     82      ! 
     83      CALL trc_ini_state  !  passive tracers initialisation : from a restart or from clim 
     84      ! 
     85      IF( nn_dttrc /= 1 )        CALL trc_sub_ini      ! Initialize variables for substepping passive tracers 
     86      ! 
     87      CALL trc_ini_inv   ! Inventories 
     88      ! 
     89      IF( nn_timing == 1 )   CALL timing_stop('trc_init') 
     90      ! 
     91   END SUBROUTINE trc_init 
     92 
     93 
     94   SUBROUTINE trc_ini_ctl 
     95      !!---------------------------------------------------------------------- 
     96      !!                     ***  ROUTINE trc_ini_ctl  *** 
     97      !! ** Purpose :        Control  + ocean volume 
     98      !!---------------------------------------------------------------------- 
     99      INTEGER ::   jk    ! dummy loop indices 
     100      ! 
     101      ! Define logical parameter ton control dirunal cycle in TOP 
     102      l_trcdm2dc = ln_dm2dc .OR. ( ln_cpl .AND. ncpl_qsr_freq /= 1 ) 
     103      l_trcdm2dc = l_trcdm2dc  .AND. .NOT. lk_offline 
     104      IF( l_trcdm2dc .AND. lwp )   CALL ctl_warn( 'Coupling with passive tracers and used of diurnal cycle.',   & 
     105         &                           'Computation of a daily mean shortwave for some biogeochemical models ' ) 
     106      ! 
     107   END SUBROUTINE trc_ini_ctl 
     108 
     109 
     110   SUBROUTINE trc_ini_inv 
     111      !!---------------------------------------------------------------------- 
     112      !!                     ***  ROUTINE trc_ini_stat  *** 
     113      !! ** Purpose :      passive tracers inventories at initialsation phase 
     114      !!---------------------------------------------------------------------- 
     115      INTEGER ::  jk, jn    ! dummy loop indices 
     116      CHARACTER (len=25) :: charout 
     117      !!---------------------------------------------------------------------- 
    90118      !                                                              ! masked grid volume 
    91119      DO jk = 1, jpk 
    92          cvol(:,:,jk) = e1e2t(:,:) * fse3t(:,:,jk) * tmask(:,:,jk) 
     120         cvol(:,:,jk) = e1e2t(:,:) * e3t_n(:,:,jk) * tmask(:,:,jk) 
    93121      END DO 
    94       IF( lk_degrad ) cvol(:,:,:) = cvol(:,:,:) * facvol(:,:,:)      ! degrad option: reduction by facvol 
     122      IF( lk_degrad )   cvol(:,:,:) = cvol(:,:,:) * facvol(:,:,:)    ! degrad option: reduction by facvol 
    95123      !                                                              ! total volume of the ocean  
    96124      areatot = glob_sum( cvol(:,:,:) ) 
    97  
     125      ! 
     126      trai(:) = 0._wp                                                   ! initial content of all tracers 
     127      DO jn = 1, jptra 
     128         trai(jn) = trai(jn) + glob_sum( trn(:,:,:,jn) * cvol(:,:,:)   ) 
     129      END DO 
     130 
     131      IF(lwp) THEN               ! control print 
     132         WRITE(numout,*) 
     133         WRITE(numout,*) 
     134         WRITE(numout,*) '          *** Total number of passive tracer jptra = ', jptra 
     135         WRITE(numout,*) '          *** Total volume of ocean                = ', areatot 
     136         WRITE(numout,*) '          *** Total inital content of all tracers ' 
     137         WRITE(numout,*) 
     138         DO jn = 1, jptra 
     139            WRITE(numout,9000) jn, TRIM( ctrcnm(jn) ), trai(jn) 
     140         ENDDO 
     141         WRITE(numout,*) 
     142      ENDIF 
     143      IF(lwp) WRITE(numout,*) 
     144      IF(ln_ctl) THEN            ! print mean trends (used for debugging) 
     145         CALL prt_ctl_trc_init 
     146         WRITE(charout, FMT="('ini ')") 
     147         CALL prt_ctl_trc_info( charout ) 
     148         CALL prt_ctl_trc( tab4d=trn, mask=tmask, clinfo=ctrcnm ) 
     149      ENDIF 
     1509000  FORMAT(' tracer nb : ',i2,'      name :',a10,'      initial content :',e18.10) 
     151      ! 
     152   END SUBROUTINE trc_ini_inv 
     153 
     154 
     155   SUBROUTINE trc_ini_sms 
     156      !!---------------------------------------------------------------------- 
     157      !!                     ***  ROUTINE trc_ini_sms  *** 
     158      !! ** Purpose :   SMS initialisation 
     159      !!---------------------------------------------------------------------- 
     160      USE trcini_cfc      ! CFC      initialisation 
     161      USE trcini_pisces   ! PISCES   initialisation 
     162      USE trcini_c14b     ! C14 bomb initialisation 
     163      USE trcini_my_trc   ! MY_TRC   initialisation 
     164      !!---------------------------------------------------------------------- 
    98165      IF( lk_pisces  )       CALL trc_ini_pisces       ! PISCES  bio-model 
    99166      IF( lk_cfc     )       CALL trc_ini_cfc          ! CFC     tracers 
    100167      IF( lk_c14b    )       CALL trc_ini_c14b         ! C14 bomb  tracer 
    101168      IF( lk_my_trc  )       CALL trc_ini_my_trc       ! MY_TRC  tracers 
    102  
    103       IF( lwp ) THEN 
    104          ! 
    105          CALL ctl_opn( numstr, 'tracer.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp , narea ) 
    106          ! 
    107       ENDIF 
    108  
     169      ! 
     170   END SUBROUTINE trc_ini_sms 
     171 
     172   SUBROUTINE trc_ini_trp 
     173      !!---------------------------------------------------------------------- 
     174      !!                     ***  ROUTINE trc_ini_trp  *** 
     175      !! 
     176      !! ** Purpose :   Allocate all the dynamic arrays of the OPA modules 
     177      !!---------------------------------------------------------------------- 
     178      USE trcdmp , ONLY:  trc_dmp_ini 
     179      USE trcadv , ONLY:  trc_adv_ini 
     180      USE trcldf , ONLY:  trc_ldf_ini 
     181      USE trczdf , ONLY:  trc_zdf_ini 
     182      USE trcrad , ONLY:  trc_rad_ini 
     183      ! 
     184      INTEGER :: ierr 
     185      !!---------------------------------------------------------------------- 
     186      ! 
     187      IF( ln_trcdmp )  CALL  trc_dmp_ini          ! damping 
     188                       CALL  trc_adv_ini          ! advection 
     189                       CALL  trc_ldf_ini          ! lateral diffusion 
     190                       CALL  trc_zdf_ini          ! vertical diffusion 
     191                       CALL  trc_rad_ini          ! positivity of passive tracers  
     192      ! 
     193   END SUBROUTINE trc_ini_trp 
     194 
     195 
     196   SUBROUTINE trc_ini_state 
     197      !!---------------------------------------------------------------------- 
     198      !!                     ***  ROUTINE trc_ini_state *** 
     199      !! ** Purpose :          Initialisation of passive tracer concentration  
     200      !!---------------------------------------------------------------------- 
     201      USE zpshde          ! partial step: hor. derivative   (zps_hde routine) 
     202      USE trcrst          ! passive tracers restart 
     203      USE trcdta          ! initialisation from files 
     204      ! 
     205      INTEGER ::   jk, jn, jl    ! dummy loop indices 
     206      REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrcdta   ! 4D  workspace 
     207      !!---------------------------------------------------------------------- 
     208      ! 
     209      ! Initialisation of tracers Initial Conditions 
    109210      IF( ln_trcdta )      CALL trc_dta_init(jptra) 
    110211 
     212      ! Initialisation of tracers Boundary Conditions 
     213      IF( lk_my_trc )     CALL trc_bc_init(jptra) 
    111214 
    112215      IF( ln_rsttr ) THEN 
     
    143246  
    144247      tra(:,:,:,:) = 0._wp 
    145        
    146       IF( ln_zps .AND. .NOT. lk_c1d )   &              ! Partial steps: before horizontal gradient of passive 
    147         &    CALL zps_hde( nit000, jptra, trn, gtru, gtrv )       ! tracers at the bottom ocean level 
    148  
    149       ! 
    150       IF( nn_dttrc /= 1 )        CALL trc_sub_ini      ! Initialize variables for substepping passive tracers 
    151       ! 
    152  
    153       trai(:) = 0._wp                                                   ! initial content of all tracers 
    154       DO jn = 1, jptra 
    155          trai(jn) = trai(jn) + glob_sum( trn(:,:,:,jn) * cvol(:,:,:)   ) 
    156       END DO 
    157  
    158       IF(lwp) THEN               ! control print 
    159          WRITE(numout,*) 
    160          WRITE(numout,*) 
    161          WRITE(numout,*) '          *** Total number of passive tracer jptra = ', jptra 
    162          WRITE(numout,*) '          *** Total volume of ocean                = ', areatot 
    163          WRITE(numout,*) '          *** Total inital content of all tracers ' 
    164          WRITE(numout,*) 
    165          DO jn = 1, jptra 
    166             WRITE(numout,9000) jn, TRIM( ctrcnm(jn) ), trai(jn) 
    167          ENDDO 
    168          WRITE(numout,*) 
    169       ENDIF 
    170       IF(lwp) WRITE(numout,*) 
    171       IF(ln_ctl) THEN            ! print mean trends (used for debugging) 
    172          CALL prt_ctl_trc_init 
    173          WRITE(charout, FMT="('ini ')") 
    174          CALL prt_ctl_trc_info( charout ) 
    175          CALL prt_ctl_trc( tab4d=trn, mask=tmask, clinfo=ctrcnm ) 
    176       ENDIF 
    177 9000  FORMAT(' tracer nb : ',i2,'      name :',a10,'      initial content :',e18.10) 
    178       ! 
    179       IF( nn_timing == 1 )   CALL timing_stop('trc_init') 
    180       ! 
    181    END SUBROUTINE trc_init 
    182  
     248      !                                                         ! Partial top/bottom cell: GRADh(trn) 
     249   END SUBROUTINE trc_ini_state 
    183250 
    184251   SUBROUTINE top_alloc 
     
    188255      !! ** Purpose :   Allocate all the dynamic arrays of the OPA modules 
    189256      !!---------------------------------------------------------------------- 
    190       USE trcadv        , ONLY:   trc_adv_alloc          ! TOP-related alloc routines... 
    191257      USE trc           , ONLY:   trc_alloc 
    192       USE trcnxt        , ONLY:   trc_nxt_alloc 
    193       USE trczdf        , ONLY:   trc_zdf_alloc 
    194       USE trdmod_trc_oce, ONLY:   trd_mod_trc_oce_alloc 
    195 #if defined key_trdmld_trc  
    196       USE trdmld_trc    , ONLY:   trd_mld_trc_alloc 
     258      USE trdtrc_oce    , ONLY:   trd_trc_oce_alloc 
     259#if defined key_trdmxl_trc  
     260      USE trdmxl_trc    , ONLY:   trd_mxl_trc_alloc 
    197261#endif 
    198262      ! 
     
    200264      !!---------------------------------------------------------------------- 
    201265      ! 
    202       ierr =        trc_adv_alloc()          ! Start of TOP-related alloc routines... 
    203       ierr = ierr + trc_alloc    () 
    204       ierr = ierr + trc_nxt_alloc() 
    205       ierr = ierr + trc_zdf_alloc() 
    206       ierr = ierr + trd_mod_trc_oce_alloc() 
    207 #if defined key_trdmld_trc  
    208       ierr = ierr + trd_mld_trc_alloc() 
     266      ierr =        trc_alloc() 
     267      ierr = ierr + trd_trc_oce_alloc() 
     268#if defined key_trdmxl_trc  
     269      ierr = ierr + trd_mxl_trc_alloc() 
    209270#endif 
    210271      ! 
Note: See TracChangeset for help on using the changeset viewer.