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

source: branches/dev_001_GM/NEMO/TOP_SRC/trcdta.F90 @ 766

Last change on this file since 766 was 765, checked in by gm, 16 years ago

dev_001_GM - create 1 parameter module by tracers (CFC, LOBSTER, PISCES..) - never compiled

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