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

source: branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/TOP_SRC/trcstp.F90 @ 5105

Last change on this file since 5105 was 5105, checked in by cbricaud, 9 years ago

bug correction

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