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.
trcstp.F90 in branches/NERC/dev_r5107_NOC_MEDUSA/NEMOGCM/NEMO/TOP_SRC – NEMO

source: branches/NERC/dev_r5107_NOC_MEDUSA/NEMOGCM/NEMO/TOP_SRC/trcstp.F90 @ 5707

Last change on this file since 5707 was 5707, checked in by acc, 9 years ago

JPALM --25-08-2015 -- add MEDUSA in the branch. MEDUSA version already up-to-date with this trunk revision

  • Property svn:keywords set to Id
File size: 6.3 KB
RevLine 
[1457]1MODULE trcstp
2   !!======================================================================
3   !!                       ***  MODULE trcstp  ***
4   !! Time-stepping    : time loop of opa for passive tracer
5   !!======================================================================
[2528]6   !! History :  1.0  !  2004-03  (C. Ethe)  Original
7   !!----------------------------------------------------------------------
[1457]8#if defined key_top
9   !!----------------------------------------------------------------------
10   !!   trc_stp      : passive tracer system time-stepping
11   !!----------------------------------------------------------------------
12   USE oce_trc          ! ocean dynamics and active tracers variables
[4306]13   USE sbc_oce
[2528]14   USE trc
[1457]15   USE trctrp           ! passive tracers transport
16   USE trcsms           ! passive tracers sources and sinks
17   USE prtctl_trc       ! Print control for debbuging
18   USE trcdia
19   USE trcwri
20   USE trcrst
[4990]21   USE trdtrc_oce
22   USE trdmxl_trc
[1457]23   USE iom
24   USE in_out_manager
[3294]25   USE trcsub
[1457]26
27   IMPLICIT NONE
28   PRIVATE
29
[2528]30   PUBLIC   trc_stp    ! called by step
[3294]31
32   !! * Substitutions
33#  include "domzgr_substitute.h90"
[1457]34   !!----------------------------------------------------------------------
[2528]35   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
36   !! $Id$
37   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
[1457]38   !!----------------------------------------------------------------------
39CONTAINS
40
41   SUBROUTINE trc_stp( kt )
42      !!-------------------------------------------------------------------
43      !!                     ***  ROUTINE trc_stp  ***
44      !!                     
45      !! ** Purpose : Time loop of opa for passive tracer
46      !!
47      !! ** Method  :
48      !!              Compute the passive tracers trends
49      !!              Update the passive tracers
50      !!-------------------------------------------------------------------
[3294]51      INTEGER, INTENT( in ) ::  kt      ! ocean time-step index
52      INTEGER               ::  jk, jn  ! dummy loop indices
53      REAL(wp)              ::  ztrai
[4306]54      CHARACTER (len=25)    ::  charout 
55
56      REAL(wp), DIMENSION(:,:), POINTER ::   zqsr_tmp ! save qsr during TOP time-step
[2528]57      !!-------------------------------------------------------------------
[3294]58      !
59      IF( nn_timing == 1 )   CALL timing_start('trc_stp')
60      !
[4990]61      IF( kt == nittrc000 .AND. lk_trdmxl_trc )  CALL trd_mxl_trc_init    ! trends: Mixed-layer
[3294]62      !
[3319]63      IF( lk_vvl ) THEN                                                   ! update ocean volume due to ssh temporal evolution
[3294]64         DO jk = 1, jpk
65            cvol(:,:,jk) = e1e2t(:,:) * fse3t(:,:,jk) * tmask(:,:,jk)
66         END DO
[3319]67         IF( lk_degrad )  cvol(:,:,:) = cvol(:,:,:) * facvol(:,:,:)       ! degrad option: reduction by facvol
[3294]68         areatot         = glob_sum( cvol(:,:,:) )
69      ENDIF
70      !   
[4306]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
78      !   
79      IF( nn_dttrc /= 1 )   CALL trc_sub_stp( kt )  ! averaging physical variables for sub-stepping
80      !   
81      IF( MOD( kt , nn_dttrc ) == 0 ) THEN      ! only every nn_dttrc time step
[2528]82         !
83         IF(ln_ctl) THEN
84            WRITE(charout,FMT="('kt =', I4,'  d/m/y =',I2,I2,I4)") kt, nday, nmonth, nyear
85            CALL prt_ctl_trc_info(charout)
86         ENDIF
87         !
88         tra(:,:,:,:) = 0.e0
89         !
[5707]90# if defined key_debug_medusa
91         IF(lwp) WRITE(numout,*) ' MEDUSA trc_stp begins at kt =', kt
92         CALL flush(numout)
93# endif
[3294]94                                   CALL trc_rst_opn  ( kt )       ! Open tracer restart file
[3680]95         IF( lrst_trc )            CALL trc_rst_cal  ( kt, 'WRITE' )   ! calendar
[3294]96         IF( lk_iomput ) THEN  ;   CALL trc_wri      ( kt )       ! output of passive tracers with iom I/O manager
97         ELSE                  ;   CALL trc_dia      ( kt )       ! output of passive tracers with old I/O manager
[2528]98         ENDIF
[3294]99                                   CALL trc_sms      ( kt )       ! tracers: sinks and sources
[5707]100# if defined key_debug_medusa
101         IF(lwp) WRITE(numout,*) ' MEDUSA trc_stp SMS complete at kt =', kt
102         CALL flush(numout)
103# endif
[3294]104                                   CALL trc_trp      ( kt )       ! transport of passive tracers
[5707]105# if defined key_debug_medusa
106         IF(lwp) WRITE(numout,*) ' MEDUSA trc_stp transport complete at kt =', kt
107         CALL flush(numout)
108# endif
[4147]109         IF( kt == nittrc000 ) THEN
110            CALL iom_close( numrtr )       ! close input tracer restart file
[4624]111            IF(lwm) CALL FLUSH( numont )   ! flush namelist output
[4147]112         ENDIF
[3294]113         IF( lrst_trc )            CALL trc_rst_wri  ( kt )       ! write tracer restart file
[4990]114         IF( lk_trdmxl_trc  )      CALL trd_mxl_trc  ( kt )       ! trends: Mixed-layer
[2528]115         !
[3294]116         IF( nn_dttrc /= 1   )     CALL trc_sub_reset( kt )       ! resetting physical variables when sub-stepping
[5707]117# if defined key_debug_medusa
118         IF(lwp) WRITE(numout,*) ' MEDUSA trc_stp ends at kt =', kt
119         CALL flush(numout)
120# endif
[3294]121         !
[1457]122      ENDIF
[3294]123      !
[4306]124      IF( ltrcdm2dc ) THEN
125         ! put back qsr with diurnal cycle in qsr
126         qsr(:,:) = zqsr_tmp(:,:)
127         CALL wrk_dealloc( jpi,jpj, zqsr_tmp )
128      ENDIF
129      !
[3294]130      ztrai = 0._wp                                                   !  content of all tracers
131      DO jn = 1, jptra
132         ztrai = ztrai + glob_sum( trn(:,:,:,jn) * cvol(:,:,:)   )
133      END DO
134      IF( lwp ) WRITE(numstr,9300) kt,  ztrai / areatot
1359300  FORMAT(i10,e18.10)
136      !
137      IF( nn_timing == 1 )   CALL timing_stop('trc_stp')
138      !
[1457]139   END SUBROUTINE trc_stp
140
141#else
142   !!----------------------------------------------------------------------
143   !!   Default key                                     NO passive tracers
144   !!----------------------------------------------------------------------
145CONTAINS
146   SUBROUTINE trc_stp( kt )        ! Empty routine
147      WRITE(*,*) 'trc_stp: You should not have seen this print! error?', kt
148   END SUBROUTINE trc_stp
149#endif
150
151   !!======================================================================
152END MODULE trcstp
Note: See TracBrowser for help on using the repository browser.