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, 13 years ago

set proper svn properties to all files...

  • Property svn:keywords set to Id
File size: 8.9 KB
Line 
1MODULE trcdta
2   !!======================================================================
3   !!                     ***  MODULE  trcdta  ***
4   !! TOP :  reads passive tracer data
5   !!=====================================================================
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
9   !!----------------------------------------------------------------------
10#if  defined key_top  &&  defined key_dtatrc
11   !!----------------------------------------------------------------------
12   !!   'key_top'  and  'key_dtatrc'        TOP model + passive tracer data
13   !!----------------------------------------------------------------------
14   !!   trc_dta      : read ocean passive tracer data
15   !!----------------------------------------------------------------------
16   USE oce_trc
17   USE par_trc
18   USE trc
19   USE lib_print
20   USE iom
21
22   IMPLICIT NONE
23   PRIVATE
24
25   PUBLIC trc_dta   ! called in trcini.F90 and trcdmp.F90
26
27   LOGICAL , PUBLIC, PARAMETER ::   lk_dtatrc = .TRUE.   !: temperature data flag
28   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk,jptra) ::   trdta   !: tracer data at given time-step
29
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
34
35   !! * Substitutions
36#  include "top_substitute.h90"
37   !!----------------------------------------------------------------------
38   !! NEMO/TOP 3.3 , LOCEAN-IPSL (2010)
39   !! $Id$
40   !! Software governed by the CeCILL licence  (NEMOGCM/License_CeCILL.txt)
41   !!----------------------------------------------------------------------
42CONTAINS
43
44   SUBROUTINE trc_dta( kt )
45      !!----------------------------------------------------------------------
46      !!                   ***  ROUTINE trc_dta  ***
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      !!----------------------------------------------------------------------
57      INTEGER, INTENT( in ) ::   kt     ! ocean time-step
58      !!
59      CHARACTER (len=39) ::   clname(jptra)
60      INTEGER, PARAMETER ::   jpmonth = 12    ! number of months
61      INTEGER ::   ji, jj, jn, jl 
62      INTEGER ::   imois, iman, i15, ik  ! temporary integers
63      REAL(wp) ::   zxy, zl
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 !
66      !!----------------------------------------------------------------------
67
68      DO jn = 1, jptra
69
70         IF( lutini(jn) ) THEN
71
72            IF ( kt == nit000 ) THEN
73               !! 3D tracer data
74               IF(lwp)WRITE(numout,*)
75               IF(lwp)WRITE(numout,*) ' dta_trc: reading tracer' 
76               IF(lwp)WRITE(numout,*) ' data file ', jn, ctrcnm(jn)
77               IF(lwp)WRITE(numout,*)
78               nlectr(jn) = 0
79            ENDIF
80            ! Initialization
81            iman = jpmonth
82            i15  = nday / 16
83            imois = nmonth + i15 -1
84            IF( imois == 0 ) imois = iman
85
86
87            ! First call kt=nit000
88            ! --------------------
89
90            IF ( kt == nit000 .AND. nlectr(jn) == 0 ) THEN
91               ntrc1(jn) = 0
92               IF(lwp) WRITE(numout,*) ' trc_dta : Levitus tracer data monthly fields'
93               ! open file
94# if defined key_pisces
95               clname(jn) = 'data_1m_'//TRIM(ctrcnm(jn))//'_nomask'
96# else
97               clname(jn) = TRIM(ctrcnm(jn))
98# endif
99               CALL iom_open ( clname(jn), numtr(jn) )             
100
101            ENDIF
102
103# if defined key_pisces
104            ! Read montly file
105            IF( ( kt == nit000 .AND. nlectr(jn) == 0)  .OR. imois /= ntrc1(jn) ) THEN
106               nlectr(jn) = 1
107
108               ! Calendar computation
109
110               ! ntrc1 number of the first file record used in the simulation
111               ! ntrc2 number of the last  file record
112
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)
121
122               ! Read montly passive tracer data Levitus
123
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) )
126
127               IF(lwp) THEN
128                  WRITE(numout,*)
129                  WRITE(numout,*) ' read tracer data ', ctrcnm(jn),' ok'
130                  WRITE(numout,*)
131               ENDIF
132
133               ! Apply Mask
134               DO jl = 1, 2
135                  tracdta(:,:,:  ,jn,jl) = tracdta(:,:,:,jn,jl) * tmask(:,:,:) 
136                  tracdta(:,:,jpk,jn,jl) = 0.
137                  IF( ln_zps ) THEN                ! z-coord. with partial steps
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
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)    &
144                                 &                    +     zl  * tracdta(ji,jj,ik-1,jn,jl)
145                           ENDIF
146                        END DO
147                     END DO
148                  ENDIF
149
150               END DO
151
152            ENDIF
153
154            IF(lwp) THEN
155               WRITE(numout,*) ctrcnm(jn), 'Levitus month ', ntrc1(jn), ntrc2(jn)
156               WRITE(numout,*)
157               WRITE(numout,*) ' Levitus month = ', ntrc1(jn), '  level = 1'
158               CALL prihre( tracdta(1,1,1,jn,1), jpi, jpj, 1, jpi, 20, 1   &
159                  &        ,jpj, 20, 1., numout )
160               WRITE(numout,*) ' Levitus month = ', ntrc1(jn), '  level = ',jpk/2
161               CALL prihre( tracdta(1,1,jpk/2,jn,1), jpi, jpj, 1, jpi,    &
162                  &         20, 1, jpj, 20, 1., numout )
163               WRITE(numout,*) ' Levitus month = ',ntrc1(jn),'  level = ',jpkm1
164               CALL prihre( tracdta(1,1,jpkm1,jn,1), jpi, jpj, 1, jpi,     &
165                  &         20, 1, jpj, 20, 1., numout )
166            ENDIF
167
168            ! At every time step compute temperature data
169            zxy = FLOAT( nday + 15 - 30 * i15 ) / 30.
170            trdta(:,:,:,jn) =  ( 1. - zxy ) * tracdta(:,:,:,jn,1)    &
171               &              +       zxy   * tracdta(:,:,:,jn,2) 
172
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
179
180            ! Close the file
181            ! --------------
182           
183            IF( kt == nitend )   CALL iom_close( numtr(jn) )
184
185# else
186            ! Read init file only
187            IF( kt == nit000  ) THEN
188               ntrc1(jn) = 1
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) )
192            ENDIF 
193# endif
194         ENDIF
195
196      END DO
197      !
198   END SUBROUTINE trc_dta
199
200#else
201   !!----------------------------------------------------------------------
202   !!   Dummy module                              NO 3D passive tracer data
203   !!----------------------------------------------------------------------
204   LOGICAL , PUBLIC, PARAMETER ::   lk_dtatrc = .FALSE.   !: temperature data flag
205CONTAINS
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
209#endif
210
211   !!======================================================================
212END MODULE trcdta
Note: See TracBrowser for help on using the repository browser.