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.
trcdta.F90 in branches/nemo_v3_3_beta/NEMOGCM/NEMO/TOP_SRC – NEMO

source: branches/nemo_v3_3_beta/NEMOGCM/NEMO/TOP_SRC/trcdta.F90 @ 2281

Last change on this file since 2281 was 2281, checked in by smasson, 14 years ago

set proper svn properties to all files...

  • Property svn:keywords set to Id
File size: 8.9 KB
RevLine 
[268]1MODULE trcdta
2   !!======================================================================
[433]3   !!                     ***  MODULE  trcdta  ***
[945]4   !! TOP :  reads passive tracer data
[268]5   !!=====================================================================
[945]6   !! History :   1.0  !  2002-04  (O. Aumont)  original code
7   !!              -   !  2004-03  (C. Ethe)  module
8   !!              -   !  2005-03  (O. Aumont, A. El Moussaoui) F90
[274]9   !!----------------------------------------------------------------------
[945]10#if  defined key_top  &&  defined key_dtatrc
[268]11   !!----------------------------------------------------------------------
[945]12   !!   'key_top'  and  'key_dtatrc'        TOP model + passive tracer data
[268]13   !!----------------------------------------------------------------------
[1077]14   !!   trc_dta      : read ocean passive tracer data
[268]15   !!----------------------------------------------------------------------
[335]16   USE oce_trc
[945]17   USE par_trc
[335]18   USE trc
19   USE lib_print
[945]20   USE iom
[268]21
22   IMPLICIT NONE
23   PRIVATE
24
[1077]25   PUBLIC trc_dta   ! called in trcini.F90 and trcdmp.F90
[268]26
[1953]27   LOGICAL , PUBLIC, PARAMETER ::   lk_dtatrc = .TRUE.   !: temperature data flag
[945]28   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk,jptra) ::   trdta   !: tracer data at given time-step
[268]29
[945]30   REAL(wp), DIMENSION(jpi,jpj,jpk,jptra,2) ::   tracdta            ! tracer data at two consecutive times
31   INTEGER , DIMENSION(jptra) ::   nlectr      !: switch for reading once
32   INTEGER , DIMENSION(jptra) ::   ntrc1       !: number of first month when reading 12 monthly value
33   INTEGER , DIMENSION(jptra) ::   ntrc2       !: number of second month when reading 12 monthly value
[268]34
35   !! * Substitutions
[945]36#  include "top_substitute.h90"
[268]37   !!----------------------------------------------------------------------
[2104]38   !! NEMO/TOP 3.3 , LOCEAN-IPSL (2010)
[1152]39   !! $Id$
[2237]40   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt)
[268]41   !!----------------------------------------------------------------------
42CONTAINS
43
[1011]44   SUBROUTINE trc_dta( kt )
[335]45      !!----------------------------------------------------------------------
[1011]46      !!                   ***  ROUTINE trc_dta  ***
[335]47      !!
48      !! ** Purpose :   Reads passive tracer data (Levitus monthly data)
49      !!
50      !! ** Method  :   Read on unit numtr the interpolated tracer concentra-
51      !!      tion onto the global grid. Data begin at january.
52      !!      The value is centered at the middle of month.
53      !!      In the opa model, kt=1 agree with january 1.
54      !!      At each time step, a linear interpolation is applied between
55      !!      two monthly values.
56      !!----------------------------------------------------------------------
[268]57      INTEGER, INTENT( in ) ::   kt     ! ocean time-step
[945]58      !!
59      CHARACTER (len=39) ::   clname(jptra)
[2104]60      INTEGER, PARAMETER ::   jpmonth = 12    ! number of months
[945]61      INTEGER ::   ji, jj, jn, jl 
62      INTEGER ::   imois, iman, i15, ik  ! temporary integers
63      REAL(wp) ::   zxy, zl
[2104]64!!gm HERE the daymod should be used instead of computation of month and co !!
65!!gm      better in case of real calandar and leap-years !
[335]66      !!----------------------------------------------------------------------
[268]67
68      DO jn = 1, jptra
69
[335]70         IF( lutini(jn) ) THEN
[268]71
[2104]72            IF ( kt == nit000 ) THEN
[335]73               !! 3D tracer data
74               IF(lwp)WRITE(numout,*)
[433]75               IF(lwp)WRITE(numout,*) ' dta_trc: reading tracer' 
76               IF(lwp)WRITE(numout,*) ' data file ', jn, ctrcnm(jn)
[335]77               IF(lwp)WRITE(numout,*)
78               nlectr(jn) = 0
79            ENDIF
80            ! Initialization
[1953]81            iman = jpmonth
[1077]82            i15  = nday / 16
[335]83            imois = nmonth + i15 -1
84            IF( imois == 0 ) imois = iman
[268]85
[493]86
[335]87            ! First call kt=nit000
88            ! --------------------
[268]89
[2104]90            IF ( kt == nit000 .AND. nlectr(jn) == 0 ) THEN
[335]91               ntrc1(jn) = 0
[493]92               IF(lwp) WRITE(numout,*) ' trc_dta : Levitus tracer data monthly fields'
[335]93               ! open file
[945]94# if defined key_pisces
[1645]95               clname(jn) = 'data_1m_'//TRIM(ctrcnm(jn))//'_nomask'
[945]96# else
[1645]97               clname(jn) = TRIM(ctrcnm(jn))
[945]98# endif
[493]99               CALL iom_open ( clname(jn), numtr(jn) )             
[268]100
101            ENDIF
102
[945]103# if defined key_pisces
[335]104            ! Read montly file
[2104]105            IF( ( kt == nit000 .AND. nlectr(jn) == 0)  .OR. imois /= ntrc1(jn) ) THEN
[335]106               nlectr(jn) = 1
[268]107
[335]108               ! Calendar computation
[268]109
[335]110               ! ntrc1 number of the first file record used in the simulation
111               ! ntrc2 number of the last  file record
[268]112
[335]113               ntrc1(jn) = imois
114               ntrc2(jn) = ntrc1(jn) + 1
115               ntrc1(jn) = MOD( ntrc1(jn), iman )
116               IF ( ntrc1(jn) == 0 ) ntrc1(jn) = iman
117               ntrc2(jn) = MOD( ntrc2(jn), iman )
118               IF ( ntrc2(jn) == 0 ) ntrc2(jn) = iman
119               IF(lwp) WRITE(numout,*) 'first record file used ntrc1 ', ntrc1(jn) 
120               IF(lwp) WRITE(numout,*) 'last  record file used ntrc2 ', ntrc2(jn)
[268]121
[335]122               ! Read montly passive tracer data Levitus
[268]123
[493]124               CALL iom_get ( numtr(jn), jpdom_data, ctrcnm(jn), tracdta(:,:,:,jn,1), ntrc1(jn) )
125               CALL iom_get ( numtr(jn), jpdom_data, ctrcnm(jn), tracdta(:,:,:,jn,2), ntrc2(jn) )
[268]126
[335]127               IF(lwp) THEN
128                  WRITE(numout,*)
129                  WRITE(numout,*) ' read tracer data ', ctrcnm(jn),' ok'
130                  WRITE(numout,*)
131               ENDIF
[268]132
[335]133               ! Apply Mask
134               DO jl = 1, 2
135                  tracdta(:,:,:  ,jn,jl) = tracdta(:,:,:,jn,jl) * tmask(:,:,:) 
136                  tracdta(:,:,jpk,jn,jl) = 0.
[493]137                  IF( ln_zps ) THEN                ! z-coord. with partial steps
[335]138                     DO jj = 1, jpj                ! interpolation of temperature at the last level
139                        DO ji = 1, jpi
140                           ik = mbathy(ji,jj) - 1
141                           IF( ik > 2 ) THEN
[1645]142                              zl = ( gdept_0(ik) - fsdept_0(ji,jj,ik) ) / ( gdept_0(ik) - gdept_0(ik-1) )
143                              tracdta(ji,jj,ik,jn,jl) = (1.-zl) * tracdta(ji,jj,ik  ,jn,jl)    &
[945]144                                 &                    +     zl  * tracdta(ji,jj,ik-1,jn,jl)
[335]145                           ENDIF
146                        END DO
147                     END DO
148                  ENDIF
[268]149
150               END DO
[335]151
[268]152            ENDIF
153
[335]154            IF(lwp) THEN
[945]155               WRITE(numout,*) ctrcnm(jn), 'Levitus month ', ntrc1(jn), ntrc2(jn)
[335]156               WRITE(numout,*)
[945]157               WRITE(numout,*) ' Levitus month = ', ntrc1(jn), '  level = 1'
[335]158               CALL prihre( tracdta(1,1,1,jn,1), jpi, jpj, 1, jpi, 20, 1   &
[945]159                  &        ,jpj, 20, 1., numout )
160               WRITE(numout,*) ' Levitus month = ', ntrc1(jn), '  level = ',jpk/2
[335]161               CALL prihre( tracdta(1,1,jpk/2,jn,1), jpi, jpj, 1, jpi,    &
[945]162                  &         20, 1, jpj, 20, 1., numout )
163               WRITE(numout,*) ' Levitus month = ',ntrc1(jn),'  level = ',jpkm1
[335]164               CALL prihre( tracdta(1,1,jpkm1,jn,1), jpi, jpj, 1, jpi,     &
[945]165                  &         20, 1, jpj, 20, 1., numout )
[335]166            ENDIF
[268]167
[335]168            ! At every time step compute temperature data
169            zxy = FLOAT( nday + 15 - 30 * i15 ) / 30.
[945]170            trdta(:,:,:,jn) =  ( 1. - zxy ) * tracdta(:,:,:,jn,1)    &
171               &              +       zxy   * tracdta(:,:,:,jn,2) 
[268]172
[945]173            IF( jn == jpno3 )   trdta(:,:,:,jn) = trdta(:,:,:,jn) *   7.6e-6
174            IF( jn == jpdic )   trdta(:,:,:,jn) = trdta(:,:,:,jn) *   1.0e-6
175            IF( jn == jptal )   trdta(:,:,:,jn) = trdta(:,:,:,jn) *   1.0e-6
176            IF( jn == jpoxy )   trdta(:,:,:,jn) = trdta(:,:,:,jn) *  44.6e-6
177            IF( jn == jpsil )   trdta(:,:,:,jn) = trdta(:,:,:,jn) *   1.0e-6
178            IF( jn == jppo4 )   trdta(:,:,:,jn) = trdta(:,:,:,jn) * 122.0e-6
[493]179
180            ! Close the file
181            ! --------------
182           
[945]183            IF( kt == nitend )   CALL iom_close( numtr(jn) )
[493]184
[945]185# else
[433]186            ! Read init file only
[2104]187            IF( kt == nit000  ) THEN
[1953]188               ntrc1(jn) = 1
[493]189               CALL iom_get ( numtr(jn), jpdom_data, ctrcnm(jn), trdta(:,:,:,jn), ntrc1(jn) )
190               trdta(:,:,:,jn) = trdta(:,:,:,jn) * tmask(:,:,:)
191               CALL iom_close ( numtr(jn) )
[433]192            ENDIF 
[945]193# endif
194         ENDIF
[268]195
[945]196      END DO
197      !
[1011]198   END SUBROUTINE trc_dta
[268]199
200#else
201   !!----------------------------------------------------------------------
[945]202   !!   Dummy module                              NO 3D passive tracer data
[268]203   !!----------------------------------------------------------------------
[1953]204   LOGICAL , PUBLIC, PARAMETER ::   lk_dtatrc = .FALSE.   !: temperature data flag
[268]205CONTAINS
[1011]206   SUBROUTINE trc_dta( kt )        ! Empty routine
207      WRITE(*,*) 'trc_dta: You should not have seen this print! error?', kt
208   END SUBROUTINE trc_dta
[268]209#endif
210
[945]211   !!======================================================================
[268]212END MODULE trcdta
Note: See TracBrowser for help on using the repository browser.