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

source: branches/DEV_r1879_FCM/NEMOGCM/NEMO/TOP_SRC/trcdta.F90 @ 2007

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

update branches/DEV_r1879_FCM/NEMOGCM/NEMO with tags/nemo_v3_2_1/NEMO

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.0 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 1.0 , LOCEAN-IPSL (2005)
39   !! $Id$
40   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
41   !!----------------------------------------------------------------------
42
43CONTAINS
44
45   !!----------------------------------------------------------------------
46   !!   Default case                                            NetCDF file
47   !!----------------------------------------------------------------------
48   
49   SUBROUTINE trc_dta( kt )
50      !!----------------------------------------------------------------------
51      !!                   ***  ROUTINE trc_dta  ***
52      !!
53      !! ** Purpose :   Reads passive tracer data (Levitus monthly data)
54      !!
55      !! ** Method  :   Read on unit numtr the interpolated tracer concentra-
56      !!      tion onto the global grid. Data begin at january.
57      !!      The value is centered at the middle of month.
58      !!      In the opa model, kt=1 agree with january 1.
59      !!      At each time step, a linear interpolation is applied between
60      !!      two monthly values.
61      !!----------------------------------------------------------------------
62      INTEGER, INTENT( in ) ::   kt     ! ocean time-step
63      !!
64      CHARACTER (len=39) ::   clname(jptra)
65      INTEGER, PARAMETER ::   &
66         jpmonth = 12    ! number of months
67      INTEGER ::   ji, jj, jn, jl 
68      INTEGER ::   imois, iman, i15, ik  ! temporary integers
69      REAL(wp) ::   zxy, zl
70      !!----------------------------------------------------------------------
71
72      DO jn = 1, jptra
73
74         IF( lutini(jn) ) THEN
75
76            IF ( kt == nittrc000 ) THEN
77               !! 3D tracer data
78               IF(lwp)WRITE(numout,*)
79               IF(lwp)WRITE(numout,*) ' dta_trc: reading tracer' 
80               IF(lwp)WRITE(numout,*) ' data file ', jn, ctrcnm(jn)
81               IF(lwp)WRITE(numout,*)
82               nlectr(jn) = 0
83            ENDIF
84            ! Initialization
85            iman = jpmonth
86            i15  = nday / 16
87            imois = nmonth + i15 -1
88            IF( imois == 0 ) imois = iman
89
90
91            ! First call kt=nit000
92            ! --------------------
93
94            IF ( kt == nittrc000 .AND. nlectr(jn) == 0 ) THEN
95               ntrc1(jn) = 0
96               IF(lwp) WRITE(numout,*) ' trc_dta : Levitus tracer data monthly fields'
97               ! open file
98# if defined key_pisces
99               clname(jn) = 'data_1m_'//TRIM(ctrcnm(jn))//'_nomask'
100# else
101               clname(jn) = TRIM(ctrcnm(jn))
102# endif
103               CALL iom_open ( clname(jn), numtr(jn) )             
104
105            ENDIF
106
107# if defined key_pisces
108            ! Read montly file
109            IF( ( kt == nittrc000 .AND. nlectr(jn) == 0)  .OR. imois /= ntrc1(jn) ) THEN
110               nlectr(jn) = 1
111
112               ! Calendar computation
113
114               ! ntrc1 number of the first file record used in the simulation
115               ! ntrc2 number of the last  file record
116
117               ntrc1(jn) = imois
118               ntrc2(jn) = ntrc1(jn) + 1
119               ntrc1(jn) = MOD( ntrc1(jn), iman )
120               IF ( ntrc1(jn) == 0 ) ntrc1(jn) = iman
121               ntrc2(jn) = MOD( ntrc2(jn), iman )
122               IF ( ntrc2(jn) == 0 ) ntrc2(jn) = iman
123               IF(lwp) WRITE(numout,*) 'first record file used ntrc1 ', ntrc1(jn) 
124               IF(lwp) WRITE(numout,*) 'last  record file used ntrc2 ', ntrc2(jn)
125
126               ! Read montly passive tracer data Levitus
127
128               CALL iom_get ( numtr(jn), jpdom_data, ctrcnm(jn), tracdta(:,:,:,jn,1), ntrc1(jn) )
129               CALL iom_get ( numtr(jn), jpdom_data, ctrcnm(jn), tracdta(:,:,:,jn,2), ntrc2(jn) )
130
131               IF(lwp) THEN
132                  WRITE(numout,*)
133                  WRITE(numout,*) ' read tracer data ', ctrcnm(jn),' ok'
134                  WRITE(numout,*)
135               ENDIF
136
137               ! Apply Mask
138               DO jl = 1, 2
139                  tracdta(:,:,:  ,jn,jl) = tracdta(:,:,:,jn,jl) * tmask(:,:,:) 
140                  tracdta(:,:,jpk,jn,jl) = 0.
141                  IF( ln_zps ) THEN                ! z-coord. with partial steps
142                     DO jj = 1, jpj                ! interpolation of temperature at the last level
143                        DO ji = 1, jpi
144                           ik = mbathy(ji,jj) - 1
145                           IF( ik > 2 ) THEN
146                              zl = ( gdept_0(ik) - fsdept_0(ji,jj,ik) ) / ( gdept_0(ik) - gdept_0(ik-1) )
147                              tracdta(ji,jj,ik,jn,jl) = (1.-zl) * tracdta(ji,jj,ik  ,jn,jl)    &
148                                 &                    +     zl  * tracdta(ji,jj,ik-1,jn,jl)
149                           ENDIF
150                        END DO
151                     END DO
152                  ENDIF
153
154               END DO
155
156            ENDIF
157
158            IF(lwp) THEN
159               WRITE(numout,*) ctrcnm(jn), 'Levitus month ', ntrc1(jn), ntrc2(jn)
160               WRITE(numout,*)
161               WRITE(numout,*) ' Levitus month = ', ntrc1(jn), '  level = 1'
162               CALL prihre( tracdta(1,1,1,jn,1), jpi, jpj, 1, jpi, 20, 1   &
163                  &        ,jpj, 20, 1., numout )
164               WRITE(numout,*) ' Levitus month = ', ntrc1(jn), '  level = ',jpk/2
165               CALL prihre( tracdta(1,1,jpk/2,jn,1), jpi, jpj, 1, jpi,    &
166                  &         20, 1, jpj, 20, 1., numout )
167               WRITE(numout,*) ' Levitus month = ',ntrc1(jn),'  level = ',jpkm1
168               CALL prihre( tracdta(1,1,jpkm1,jn,1), jpi, jpj, 1, jpi,     &
169                  &         20, 1, jpj, 20, 1., numout )
170            ENDIF
171
172            ! At every time step compute temperature data
173            zxy = FLOAT( nday + 15 - 30 * i15 ) / 30.
174            trdta(:,:,:,jn) =  ( 1. - zxy ) * tracdta(:,:,:,jn,1)    &
175               &              +       zxy   * tracdta(:,:,:,jn,2) 
176
177            IF( jn == jpno3 )   trdta(:,:,:,jn) = trdta(:,:,:,jn) *   7.6e-6
178            IF( jn == jpdic )   trdta(:,:,:,jn) = trdta(:,:,:,jn) *   1.0e-6
179            IF( jn == jptal )   trdta(:,:,:,jn) = trdta(:,:,:,jn) *   1.0e-6
180            IF( jn == jpoxy )   trdta(:,:,:,jn) = trdta(:,:,:,jn) *  44.6e-6
181            IF( jn == jpsil )   trdta(:,:,:,jn) = trdta(:,:,:,jn) *   1.0e-6
182            IF( jn == jppo4 )   trdta(:,:,:,jn) = trdta(:,:,:,jn) * 122.0e-6
183
184            ! Close the file
185            ! --------------
186           
187            IF( kt == nitend )   CALL iom_close( numtr(jn) )
188
189# else
190            ! Read init file only
191            IF( kt == nittrc000  ) THEN
192               ntrc1(jn) = 1
193               CALL iom_get ( numtr(jn), jpdom_data, ctrcnm(jn), trdta(:,:,:,jn), ntrc1(jn) )
194               trdta(:,:,:,jn) = trdta(:,:,:,jn) * tmask(:,:,:)
195               CALL iom_close ( numtr(jn) )
196            ENDIF 
197# endif
198
199         ENDIF
200
201      END DO
202      !
203   END SUBROUTINE trc_dta
204
205#else
206   !!----------------------------------------------------------------------
207   !!   Dummy module                              NO 3D passive tracer data
208   !!----------------------------------------------------------------------
209   LOGICAL , PUBLIC, PARAMETER ::   lk_dtatrc = .FALSE.   !: temperature data flag
210CONTAINS
211   SUBROUTINE trc_dta( kt )        ! Empty routine
212      WRITE(*,*) 'trc_dta: You should not have seen this print! error?', kt
213   END SUBROUTINE trc_dta
214#endif
215
216   !!======================================================================
217END MODULE trcdta
Note: See TracBrowser for help on using the repository browser.