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 5630 for branches/UKMO/dev_r5107_restart_func_and_date/NEMOGCM/NEMO/TOP_SRC/trcstp.F90 – NEMO

Ignore:
Timestamp:
2015-07-23T18:05:51+02:00 (9 years ago)
Author:
dancopsey
Message:

Merged in revision 5518 of the trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/UKMO/dev_r5107_restart_func_and_date/NEMOGCM/NEMO/TOP_SRC/trcstp.F90

    r5500 r5630  
    3030   PUBLIC   trc_stp    ! called by step 
    3131 
     32   REAL(wp), DIMENSION(:,:,:), SAVE, ALLOCATABLE ::   qsr_arr ! save qsr during TOP time-step 
     33   REAL(wp) :: rdt_sampl 
     34   INTEGER  :: nb_rec_per_days 
     35   INTEGER  :: isecfst, iseclast 
     36   LOGICAL  :: llnew 
     37 
    3238   !! * Substitutions 
    3339#  include "domzgr_substitute.h90" 
     
    5460      CHARACTER (len=25)    ::  charout  
    5561 
    56       REAL(wp), DIMENSION(:,:), POINTER ::   zqsr_tmp ! save qsr during TOP time-step 
    5762      !!------------------------------------------------------------------- 
    5863      ! 
     
    6873         areatot         = glob_sum( cvol(:,:,:) ) 
    6974      ENDIF 
    70       !     
    71       IF( ltrcdm2dc ) THEN 
    72          ! When Diurnal cycle, core bulk and LIM2  are activated, put daily mean qsr in qsr for TOP/biogeochemistery time-step 
    73          ! and save qsr with diurnal cycle in qsr_tmp 
    74          CALL wrk_alloc( jpi,jpj, zqsr_tmp ) 
    75          zqsr_tmp(:,:) = qsr     (:,:) 
    76          qsr     (:,:) = qsr_mean(:,:)     
    77       ENDIF 
     75      ! 
     76      IF( l_trcdm2dc )   CALL trc_mean_qsr( kt ) 
    7877      !     
    7978      IF( nn_dttrc /= 1 )   CALL trc_sub_stp( kt )  ! averaging physical variables for sub-stepping 
     
    106105      ENDIF 
    107106      ! 
    108       IF( ltrcdm2dc ) THEN 
    109          ! put back qsr with diurnal cycle in qsr 
    110          qsr(:,:) = zqsr_tmp(:,:) 
    111          CALL wrk_dealloc( jpi,jpj, zqsr_tmp ) 
    112       ENDIF 
    113       ! 
    114107      ztrai = 0._wp                                                   !  content of all tracers 
    115108      DO jn = 1, jptra 
     
    122115      ! 
    123116   END SUBROUTINE trc_stp 
     117 
     118   SUBROUTINE trc_mean_qsr( kt ) 
     119      !!---------------------------------------------------------------------- 
     120      !!             ***  ROUTINE trc_mean_qsr  *** 
     121      !! 
     122      !! ** Purpose :  Compute daily mean qsr for biogeochemical model in case 
     123      !!               of diurnal cycle 
     124      !! 
     125      !! ** Method  : store in TOP the qsr every hour ( or every time-step the latter  
     126      !!              is greater than 1 hour ) and then, compute the  mean with  
     127      !!              a moving average over 24 hours.  
     128      !!              In coupled mode, the sampling is done at every coupling frequency  
     129      !!---------------------------------------------------------------------- 
     130      INTEGER, INTENT(in) ::   kt 
     131      INTEGER  :: jn 
     132 
     133      IF( kt == nittrc000 ) THEN 
     134         IF( ln_cpl )  THEN   
     135            rdt_sampl = 86400. / ncpl_qsr_freq 
     136            nb_rec_per_days = ncpl_qsr_freq 
     137         ELSE   
     138            rdt_sampl = MAX( 3600., rdt * nn_dttrc ) 
     139            nb_rec_per_days = INT( 86400 / rdt_sampl ) 
     140         ENDIF 
     141         ! 
     142         IF( lwp ) THEN 
     143            WRITE(numout,*)  
     144            WRITE(numout,*) ' Sampling frequency dt = ', rdt_sampl, 's','   Number of sampling per day  nrec = ', nb_rec_per_days 
     145            WRITE(numout,*)  
     146         ENDIF 
     147         ! 
     148         ALLOCATE( qsr_arr(jpi,jpj,nb_rec_per_days ) ) 
     149         DO jn = 1, nb_rec_per_days 
     150            qsr_arr(:,:,jn) = qsr(:,:) 
     151         ENDDO 
     152         qsr_mean(:,:) = qsr(:,:) 
     153         ! 
     154         isecfst  = nsec_year + nsec1jan000   !   number of seconds between Jan. 1st 00h of nit000 year and the middle of time step 
     155         iseclast = isecfst 
     156         ! 
     157      ENDIF 
     158      ! 
     159      iseclast = nsec_year + nsec1jan000 
     160      llnew   = ( iseclast - isecfst )  > INT( rdt_sampl )   !   new shortwave to store 
     161      IF( kt /= nittrc000 .AND. llnew ) THEN 
     162          IF( lwp ) WRITE(numout,*) ' New shortwave to sample for TOP at time kt = ', kt, & 
     163             &                      ' time = ', (iseclast+rdt*nn_dttrc/2.)/3600.,'hours ' 
     164          isecfst = iseclast 
     165          DO jn = 1, nb_rec_per_days - 1 
     166             qsr_arr(:,:,jn) = qsr_arr(:,:,jn+1) 
     167          ENDDO 
     168          qsr_arr (:,:,nb_rec_per_days) = qsr(:,:) 
     169          qsr_mean(:,:                ) = SUM( qsr_arr(:,:,:), 3 ) / nb_rec_per_days 
     170      ENDIF 
     171      ! 
     172   END SUBROUTINE trc_mean_qsr 
    124173 
    125174#else 
Note: See TracChangeset for help on using the changeset viewer.