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

source: trunk/NEMOGCM/NEMO/TOP_SRC/trcstp.F90 @ 4624

Last change on this file since 4624 was 4624, checked in by acc, 10 years ago

#1305. Fix slow start-up problems on some systems by introducing and using lwm logical to restrict output of merged namelists to the first (or only) processor. lwm is true only on the first processor regardless of ln_ctl. Small changes to all flavours of nemogcm.F90 are also required to write namctl and namcfg after the call to mynode which now opens output.namelist.dyn and writes nammpp.

  • Property svn:keywords set to Id
File size: 5.7 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
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
20   USE trcrst
21   USE trdmod_trc_oce
22   USE trdmld_trc
23   USE iom
24   USE in_out_manager
25   USE trcsub
26
27   IMPLICIT NONE
28   PRIVATE
29
30   PUBLIC   trc_stp    ! called by step
31
32   !! * Substitutions
33#  include "domzgr_substitute.h90"
34   !!----------------------------------------------------------------------
35   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
36   !! $Id$
37   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
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      !!-------------------------------------------------------------------
51      INTEGER, INTENT( in ) ::  kt      ! ocean time-step index
52      INTEGER               ::  jk, jn  ! dummy loop indices
53      REAL(wp)              ::  ztrai
54      CHARACTER (len=25)    ::  charout 
55
56      REAL(wp), DIMENSION(:,:), POINTER ::   zqsr_tmp ! save qsr during TOP time-step
57      !!-------------------------------------------------------------------
58      !
59      IF( nn_timing == 1 )   CALL timing_start('trc_stp')
60      !
61      IF( kt == nittrc000 .AND. lk_trdmld_trc )  CALL trd_mld_trc_init    ! trends: Mixed-layer
62      !
63      IF( lk_vvl ) THEN                                                   ! update ocean volume due to ssh temporal evolution
64         DO jk = 1, jpk
65            cvol(:,:,jk) = e1e2t(:,:) * fse3t(:,:,jk) * tmask(:,:,jk)
66         END DO
67         IF( lk_degrad )  cvol(:,:,:) = cvol(:,:,:) * facvol(:,:,:)       ! degrad option: reduction by facvol
68         areatot         = glob_sum( cvol(:,:,:) )
69      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
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
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         !
90                                   CALL trc_rst_opn  ( kt )       ! Open tracer restart file
91         IF( lrst_trc )            CALL trc_rst_cal  ( kt, 'WRITE' )   ! calendar
92         IF( lk_iomput ) THEN  ;   CALL trc_wri      ( kt )       ! output of passive tracers with iom I/O manager
93         ELSE                  ;   CALL trc_dia      ( kt )       ! output of passive tracers with old I/O manager
94         ENDIF
95                                   CALL trc_sms      ( kt )       ! tracers: sinks and sources
96                                   CALL trc_trp      ( kt )       ! transport of passive tracers
97         IF( kt == nittrc000 ) THEN
98            CALL iom_close( numrtr )       ! close input tracer restart file
99            IF(lwm) CALL FLUSH( numont )   ! flush namelist output
100         ENDIF
101         IF( lrst_trc )            CALL trc_rst_wri  ( kt )       ! write tracer restart file
102         IF( lk_trdmld_trc  )      CALL trd_mld_trc  ( kt )       ! trends: Mixed-layer
103         !
104         IF( nn_dttrc /= 1   )     CALL trc_sub_reset( kt )       ! resetting physical variables when sub-stepping
105         !
106      ENDIF
107      !
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      !
114      ztrai = 0._wp                                                   !  content of all tracers
115      DO jn = 1, jptra
116         ztrai = ztrai + glob_sum( trn(:,:,:,jn) * cvol(:,:,:)   )
117      END DO
118      IF( lwp ) WRITE(numstr,9300) kt,  ztrai / areatot
1199300  FORMAT(i10,e18.10)
120      !
121      IF( nn_timing == 1 )   CALL timing_stop('trc_stp')
122      !
123   END SUBROUTINE trc_stp
124
125#else
126   !!----------------------------------------------------------------------
127   !!   Default key                                     NO passive tracers
128   !!----------------------------------------------------------------------
129CONTAINS
130   SUBROUTINE trc_stp( kt )        ! Empty routine
131      WRITE(*,*) 'trc_stp: You should not have seen this print! error?', kt
132   END SUBROUTINE trc_stp
133#endif
134
135   !!======================================================================
136END MODULE trcstp
Note: See TracBrowser for help on using the repository browser.