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 9817 for branches/UKMO/dev_r5518_nemo2cice_prints/NEMOGCM/NEMO/TOP_SRC/trcini.F90 – NEMO

Ignore:
Timestamp:
2018-06-21T11:58:42+02:00 (6 years ago)
Author:
dancopsey
Message:

Merged in GO6 package branch up to revision 8356.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/UKMO/dev_r5518_nemo2cice_prints/NEMOGCM/NEMO/TOP_SRC/trcini.F90

    r9816 r9817  
    88   !!            2.0  ! 2005-10 (C. Ethe, G. Madec) revised architecture 
    99   !!            4.0  ! 2011-01 (A. R. Porter, STFC Daresbury) dynamical allocation 
     10   !!             -   ! 2014-06 (A. Yool, J. Palmieri) adding MEDUSA-2 
    1011   !!---------------------------------------------------------------------- 
    1112#if defined key_top 
     
    2425   USE trcini_c14b     ! C14 bomb initialisation 
    2526   USE trcini_my_trc   ! MY_TRC   initialisation 
     27   USE trcini_medusa   ! MEDUSA   initialisation 
     28   USE trcini_idtra    ! idealize tracer initialisation 
     29   USE trcini_age      ! AGE      initialisation 
    2630   USE trcdta          ! initialisation from files 
    2731   USE daymod          ! calendar manager 
    28    USE zpshde          ! partial step: hor. derivative   (zps_hde routine) 
    2932   USE prtctl_trc      ! Print control passive tracers (prt_ctl_trc_init routine) 
    3033   USE trcsub          ! variables to substep passive tracers 
     
    6164      INTEGER ::   jk, jn, jl    ! dummy loop indices 
    6265      CHARACTER (len=25) :: charout 
    63       REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrcdta   ! 4D  workspace 
    6466      !!--------------------------------------------------------------------- 
    6567      ! 
     
    7779         &   CALL ctl_warn(' Coupling with passive tracers and used of diurnal cycle. & 
    7880         & Computation of a daily mean shortwave for some biogeochemical models) ') 
    79  
     81          !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
     82          !!!!! CHECK For MEDUSA 
     83          !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
    8084      IF( nn_cla == 1 )   & 
    8185         &  CALL ctl_stop( ' Cross Land Advection not yet implemented with passive tracer ; nn_cla must be 0' ) 
     
    98102 
    99103      IF( lk_pisces  )       CALL trc_ini_pisces       ! PISCES  bio-model 
     104      IF( lk_medusa  )       CALL trc_ini_medusa       ! MEDUSA  tracers 
     105      IF( lk_idtra   )       CALL trc_ini_idtra        ! Idealize tracers 
    100106      IF( lk_cfc     )       CALL trc_ini_cfc          ! CFC     tracers 
    101107      IF( lk_c14b    )       CALL trc_ini_c14b         ! C14 bomb  tracer 
     108      IF( lk_age     )       CALL trc_ini_age          ! AGE       tracer 
    102109      IF( lk_my_trc  )       CALL trc_ini_my_trc       ! MY_TRC  tracers 
    103110 
    104111      CALL trc_ice_ini                                 ! Tracers in sea ice 
    105112 
    106       IF( lwp ) THEN 
     113# if defined key_debug_medusa 
     114         IF (lwp) write (numout,*) '------------------------------' 
     115         IF (lwp) write (numout,*) 'Jpalm - debug' 
     116         IF (lwp) write (numout,*) ' in trc_init' 
     117         IF (lwp) write (numout,*) ' sms init OK' 
     118         IF (lwp) write (numout,*) ' next: open tracer.stat' 
     119         IF (lwp) write (numout,*) ' ' 
     120         CALL flush(numout) 
     121# endif 
     122 
     123      IF( ln_ctl ) THEN 
    107124         ! 
    108          CALL ctl_opn( numstr, 'tracer.stat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp , narea ) 
     125         IF (narea == 1) THEN   
     126            ! The tracer.stat file only contains global tracer sum values, if  
     127            ! it contains anything at all. Hence it only needs to be opened  
     128            ! and written to on the master PE, not on all PEs.   
     129            CALL ctl_opn( numstr, 'tracer.stat', 'REPLACE','FORMATTED',  &  
     130                          'SEQUENTIAL', -1, numout, lwp , narea )  
     131         ENDIF   
    109132         ! 
    110133      ENDIF 
    111134 
    112       IF( ln_trcdta )      CALL trc_dta_init(jptra) 
    113  
     135# if defined key_debug_medusa 
     136         IF (lwp) write (numout,*) '------------------------------' 
     137         IF (lwp) write (numout,*) 'Jpalm - debug' 
     138         IF (lwp) write (numout,*) ' in trc_init' 
     139         IF (lwp) write (numout,*) 'open tracer.stat -- OK' 
     140         IF (lwp) write (numout,*) ' ' 
     141         CALL flush(numout) 
     142# endif 
     143 
     144 
     145      IF( ln_trcdta ) THEN 
     146#if defined key_medusa 
     147         IF(lwp) WRITE(numout,*) 'AXY: calling trc_dta_init' 
     148         IF(lwp) CALL flush(numout) 
     149#endif 
     150         CALL trc_dta_init(jptra) 
     151      ENDIF 
    114152 
    115153      IF( ln_rsttr ) THEN 
    116154        ! 
     155#if defined key_medusa 
     156        IF(lwp) WRITE(numout,*) 'AXY: calling trc_rst_read' 
     157        IF(lwp) CALL flush(numout) 
     158#endif 
    117159        CALL trc_rst_read              ! restart from a file 
    118160        ! 
    119161      ELSE 
    120162        ! 
     163# if defined key_debug_medusa 
     164         IF (lwp) write (numout,*) '------------------------------' 
     165         IF (lwp) write (numout,*) 'Jpalm - debug' 
     166         IF (lwp) write (numout,*) ' Init from file -- will call trc_dta' 
     167         IF (lwp) write (numout,*) ' ' 
     168         CALL flush(numout) 
     169# endif 
     170        ! 
    121171        IF( ln_trcdta .AND. nb_trcdta > 0 ) THEN  ! Initialisation of tracer from a file that may also be used for damping 
    122             ! 
    123             CALL wrk_alloc( jpi, jpj, jpk, ztrcdta )    ! Memory allocation 
    124172            ! 
    125173            DO jn = 1, jptra 
    126174               IF( ln_trc_ini(jn) ) THEN      ! update passive tracers arrays with input data read from file 
    127175                  jl = n_trc_index(jn)  
    128                   CALL trc_dta( nit000, sf_trcdta(jl),rf_trfac(jl) )   ! read tracer data at nit000 
    129                   ztrcdta(:,:,:) = sf_trcdta(jl)%fnow(:,:,:) 
    130                   trn(:,:,:,jn) = ztrcdta(:,:,:) * tmask(:,:,:)   
     176                  CALL trc_dta( nit000, sf_trcdta(jl), rf_trfac(jl) )   ! read tracer data at nit000 
     177                  trn(:,:,:,jn) = sf_trcdta(jl)%fnow(:,:,:)  
    131178                  IF( .NOT.ln_trcdmp .AND. .NOT.ln_trcdmp_clo ) THEN      !== deallocate data structure   ==! 
    132179                     !                                                    (data used only for initialisation) 
     
    138185               ENDIF 
    139186            ENDDO 
    140             CALL wrk_dealloc( jpi, jpj, jpk, ztrcdta ) 
     187            ! 
    141188        ENDIF 
     189        ! 
     190# if defined key_debug_medusa 
     191         IF (lwp) write (numout,*) '------------------------------' 
     192         IF (lwp) write (numout,*) 'Jpalm - debug' 
     193         IF (lwp) write (numout,*) ' in trc_init' 
     194         IF (lwp) write (numout,*) ' before trb = trn' 
     195         IF (lwp) write (numout,*) ' ' 
     196         CALL flush(numout) 
     197# endif 
    142198        ! 
    143199        trb(:,:,:,:) = trn(:,:,:,:) 
    144200        !  
     201# if defined key_debug_medusa 
     202         IF (lwp) write (numout,*) '------------------------------' 
     203         IF (lwp) write (numout,*) 'Jpalm - debug' 
     204         IF (lwp) write (numout,*) ' in trc_init' 
     205         IF (lwp) write (numout,*) ' trb = trn -- OK' 
     206         IF (lwp) write (numout,*) ' ' 
     207         CALL flush(numout) 
     208# endif 
     209        !  
    145210      ENDIF 
    146211  
    147212      tra(:,:,:,:) = 0._wp 
    148       IF( ln_zps .AND. .NOT. lk_c1d .AND. .NOT. ln_isfcav )   &              ! Partial steps: before horizontal gradient of passive 
    149         &    CALL zps_hde    ( nit000, jptra, trn, gtru, gtrv  )  ! Partial steps: before horizontal gradient 
    150       IF( ln_zps .AND. .NOT. lk_c1d .AND.       ln_isfcav )   & 
    151         &    CALL zps_hde_isf( nit000, jptra, trn, pgtu=gtru, pgtv=gtrv, pgtui=gtrui, pgtvi=gtrvi )       ! tracers at the bottom ocean level 
    152  
    153  
     213      ! 
     214# if defined key_debug_medusa 
     215         IF (lwp) write (numout,*) '------------------------------' 
     216         IF (lwp) write (numout,*) 'Jpalm - debug' 
     217         IF (lwp) write (numout,*) ' in trc_init' 
     218         IF (lwp) write (numout,*) ' partial step -- OK' 
     219         IF (lwp) write (numout,*) ' ' 
     220         CALL flush(numout) 
     221# endif 
    154222      ! 
    155223      IF( nn_dttrc /= 1 )        CALL trc_sub_ini      ! Initialize variables for substepping passive tracers 
    156224      ! 
    157  
     225# if defined key_debug_medusa 
     226         IF (lwp) write (numout,*) '------------------------------' 
     227         IF (lwp) write (numout,*) 'Jpalm - debug' 
     228         IF (lwp) write (numout,*) ' in trc_init' 
     229         IF (lwp) write (numout,*) ' before initiate tracer contents' 
     230         IF (lwp) write (numout,*) ' ' 
     231         CALL flush(numout) 
     232# endif 
     233      ! 
    158234      trai(:) = 0._wp                                                   ! initial content of all tracers 
    159235      DO jn = 1, jptra 
     
    168244         WRITE(numout,*) '          *** Total inital content of all tracers ' 
    169245         WRITE(numout,*) 
     246# if defined key_debug_medusa 
     247         CALL flush(numout) 
     248# endif 
     249         ! 
     250# if defined key_debug_medusa 
     251         WRITE(numout,*) ' litle check :  ', ctrcnm(1) 
     252         CALL flush(numout) 
     253# endif 
    170254         DO jn = 1, jptra 
    171255            WRITE(numout,9000) jn, TRIM( ctrcnm(jn) ), trai(jn) 
     
    180264         CALL prt_ctl_trc( tab4d=trn, mask=tmask, clinfo=ctrcnm ) 
    181265      ENDIF 
     266 
     267      IF(lwp) WRITE(numout,*) 
     268      IF(lwp) WRITE(numout,*) 'trc_init : passive tracer set up completed' 
     269      IF(lwp) WRITE(numout,*) '~~~~~~~' 
     270      IF(lwp) CALL flush(numout) 
     271# if defined key_debug_medusa 
     272         CALL trc_rst_stat 
     273         CALL flush(numout) 
     274# endif 
     275 
    1822769000  FORMAT(' tracer nb : ',i2,'      name :',a10,'      initial content :',e18.10) 
    183277      ! 
Note: See TracChangeset for help on using the changeset viewer.