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.
flxrnf.F90 in trunk/NEMO/OPA_SRC/SBC – NEMO

source: trunk/NEMO/OPA_SRC/SBC/flxrnf.F90 @ 389

Last change on this file since 389 was 389, checked in by opalod, 18 years ago

RB:nemo_v1_update_038: first integration of Agrif :

  • configuration parameters are just integer when agrif is used
  • add call to agrif routines with key_agrif
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 15.3 KB
Line 
1MODULE flxrnf
2   !!======================================================================
3   !!                       ***  MODULE  flxrnf  ***
4   !! Ocean forcing:  runoff
5   !!=====================================================================
6#if defined key_orca_r05
7   !!----------------------------------------------------------------------
8   !!   'key_orca_r05'                               ORCA R05 configuration
9   !!----------------------------------------------------------------------
10#  include "flxrnf_ORCA_R05.h90"
11#else
12   !!----------------------------------------------------------------------
13   !!   Default option                                     Standard runoffs
14   !!----------------------------------------------------------------------
15
16   !!----------------------------------------------------------------------
17   !!   flx_rnf      : monthly runoff read in a NetCDF file
18   !!----------------------------------------------------------------------
19   !! * Modules used
20   USE dom_oce         ! ocean space and time domain
21   USE phycst          ! physical constants
22   USE in_out_manager  ! I/O manager
23   USE daymod          ! calendar
24   USE ioipsl          ! NetCDF IPSL library
25
26   IMPLICIT NONE
27   PRIVATE
28
29   !! * Routine accessibility
30   PUBLIC flx_rnf          ! routine call in step module
31
32   !! * Shared module variables
33   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   &  !:
34      runoff,           &  !: monthly runoff (kg/m2/s)
35      upsadv,           &  !: mixed adv scheme in straits vicinity (hori.)
36      upsrnfh              !: mixed adv scheme in runoffs vicinity (hori.)
37   REAL(wp), PUBLIC, DIMENSION(jpk) ::   &  !:
38      upsrnfz              !: mixed adv scheme in runoffs vicinity (vert.)
39   INTEGER, PUBLIC ::   &  !:
40      nrunoff =  0 ,    &  !: runoff option (namelist)
41      nrnf1, nrnf2         !: first and second record used
42
43   !! * Module variable
44   REAL(wp), DIMENSION(jpi,jpj,2) ::   &  !:
45      rnfdta               !: monthly runoff data array (kg/m2/s)
46   !!----------------------------------------------------------------------
47   !!   OPA 9.0 , LOCEAN-IPSL (2005)
48   !! $Header$
49   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
50   !!----------------------------------------------------------------------
51
52CONTAINS
53
54   SUBROUTINE flx_rnf( kt )
55      !!----------------------------------------------------------------------
56      !!                  ***  ROUTINE flx_rnf  ***
57      !!       
58      !! ** Purpose :   Introduce a climatological run off forcing
59      !!
60      !! ** Method :
61      !!      Initialze each mouth of river with a monthly climatology
62      !!      provided from different data.
63      !!     C a u t i o n : upward water flux, runoff is negative
64      !!                     set at the last loop of the routine
65      !!
66      !! ** Action :
67      !!
68      !! References :
69      !!       J. D. Milliman and R. H. Meade, 1983 : world-wide delivery
70      !!          of river sediment to the oceans, journal of geology vol 91
71      !!          pp 1-21.
72      !!       G. L. Russell and J. R. Miller, 1990 : global river runoff
73      !!          calculated from a global atmospheric general circulation
74      !!          model, journal of hydrology, 117(1990), pp 241-254.
75      !!       F. Van Der Leeden, Troise F. L., Todd D. K. : the water
76      !!          encyclopedia, second edition, lewis publishers.
77      !!       J. W. Weatherly, J. E. Walsh : The effects of precipitation
78      !!          and river runoff in a coupled ice-ocean model of Arctic
79      !!          Climate dynamics 1996 12:785,798
80      !!       Jacobs et al. 1992. J. Glaciol. 38 (130) 375-387.
81      !!
82      !! History :
83      !!        !  94-10  (G.Madec, M. Pontaud, M. Imbard)  Original code
84      !!        !  97-03  (G.Madec)  time dependent version
85      !!        !  98-06  (J.M. Molines)  exact computation of zxy
86      !!                         for months that are not 30 days
87      !!        !  98-07  (M. Imbard)  ORCA and mpp option
88      !!        !  99-08  (J.P. Boulanger H.L.Ayina)  New rivers and
89      !!                         values given in m3/s
90      !!        !  00-04  (G. Madec, K. Roberts) add antarctica ice discharge.
91      !!        !  00-11  (R. Hordoir, E. Durand)  NetCDF FORMAT
92      !!   8.5  !  02-09  (G. Madec)  F90: Free form and module
93      !!----------------------------------------------------------------------
94      !! * arguments
95      INTEGER, INTENT( in  ) ::   kt       ! ocean time step
96
97      !! * Local declarations
98# if ! defined key_coupled
99      INTEGER  ::   ji, jj                 ! dummy loop indices
100      INTEGER ::   &
101         i15 , imois , iman,            &  ! temporary integers
102         idbd, idmeom                      !    "          "
103      REAL(wp) ::   zxy
104# endif
105      CHARACTER (len=32) ::   &
106         clname                            ! monthly runoff filename
107      INTEGER, PARAMETER :: jpmois = 12
108      INTEGER  ::   ipi, ipj, ipk          ! temporary integers
109      INTEGER  ::   ii0, ii1, ij0, ij1     !    "          "
110      INTEGER, DIMENSION(jpmois) ::     &
111         istep                             ! temporary workspace
112      REAL(wp) ::   zdate0, zdt            ! temporary scalars
113      REAL(wp), DIMENSION(jpk) ::       &
114         zlev                              ! temporary workspace
115      REAL(wp), DIMENSION(jpi,jpj) ::   &
116         zlon, zlat,                    &  ! temporary workspace
117         zcoefr                            ! coeff of advection link to runoff
118      !!----------------------------------------------------------------------
119         clname = 'runoff_1m_nomask'       ! monthly runoff filename
120     
121      IF( kt == nit000 ) THEN
122
123         SELECT CASE ( nrunoff )
124
125         CASE ( 0 )
126            IF(lwp) WRITE(numout,*)
127            IF(lwp) WRITE(numout,*) 'flx_rnf : No runoff in this simulation (nrunoff=0)'
128            IF(lwp) WRITE(numout,*) '~~~~~~~'
129           
130         CASE ( 1 )
131            IF(lwp) WRITE(numout,*)
132            IF(lwp) WRITE(numout,*) 'flx_rnf : monthly runoff (nrunoff=1)'
133            IF(lwp) WRITE(numout,*) '~~~~~~~'
134
135         CASE ( 2 )
136            IF(lwp) WRITE(numout,*)
137            IF(lwp) WRITE(numout,*) 'flx_rnf : monthly runoff with upsteam advection'
138            IF(lwp) WRITE(numout,*) '~~~~~~~   in the vicinity of river mouths (nrunoff=2)'
139
140         CASE DEFAULT
141            IF(lwp) WRITE(numout,cform_err)
142            IF(lwp) WRITE(numout,*) ' Error nrunoff = ', nrunoff, ' /= 0, 1 or 2'
143            nstop = nstop + 1
144
145         END SELECT
146
147         ! Set runoffs and upstream coeff to zero
148         runoff (:,:) = 0.e0
149         upsrnfh(:,:) = 0.e0
150         upsrnfz(:)   = 0.e0 
151         upsadv (:,:) = 0.e0
152
153      ENDIF
154
155
156      ! 1. Initialization
157      ! -----------------
158
159      IF( nrunoff == 1 .OR. nrunoff == 2 ) THEN
160# if ! defined key_coupled
161
162         ! year, month, day
163         i15   = nday / 16
164         imois = nmonth + i15 - 1
165         IF( imois == 0 )   imois = jpmois
166         ! Number of days in the month
167         IF( nleapy == 1 .AND. MOD( nyear, 4 ) == 0 ) THEN
168            idbd = nbiss(imois)
169         ELSEIF( nleapy > 1 ) THEN
170            idbd = nleapy
171         ELSE
172            idbd = nobis(imois)
173         ENDIF
174         ! Number of days between imois, 15 and the end of month
175         idmeom = idbd - 15
176# endif
177         ipi = jpiglo
178         ipj = jpjglo
179         ipk = jpk
180         zdt = rdt
181         
182         ! Open file
183
184         IF( kt == nit000 ) THEN
185            iman = jpmois
186            CALL flinopen( clname, mig(1), nlci, mjg(1), nlcj,    &
187               &           .false., ipi, ipj, ipk, zlon,        &
188               &           zlat, zlev, iman, istep, zdate0,   &
189               &           zdt, numrnf )
190            !   Title, dimensions and tests
191# if ! defined key_coupled
192            IF( iman /= jpmois ) THEN
193               IF(lwp) WRITE(numout,*)
194               IF(lwp) WRITE(numout,*) 'problem with time coordinates'
195               IF(lwp) WRITE(numout,*) ' iman ', iman, ' jpmois ', jpmois
196               nstop = nstop + 1
197            ENDIF
198            IF(lwp) WRITE(numout,*) iman, istep, zdate0, rdt, numrnf
199            IF(lwp) WRITE(numout,*) 'numrnf=', numrnf
200            IF(lwp) WRITE(numout,*) 'jpmois=', jpmois
201            IF(lwp) WRITE(numout,*) 'zdt=', zdt
202# endif
203            IF(ipi /= jpidta .AND. ipj /= jpjdta .AND. ipk /= 1) THEN
204               IF(lwp)WRITE(numout,*) ' '
205               IF(lwp)WRITE(numout,*) 'problem with dimensions'
206               IF(lwp)WRITE(numout,*) ' ipi ', ipi, ' jpidta ', jpidta
207               IF(lwp)WRITE(numout,*) ' ipj ', ipj, ' jpjdta ', jpjdta
208               IF(lwp)WRITE(numout,*) ' ipk ', ipk, ' =? 1'
209               nstop = nstop + 1
210            ENDIF
211            IF(lwp)WRITE(numout,*) 'ipi=', ipi, ' ipj=', ipj, ' ipk=', ipk
212         ENDIF
213         
214# if ! defined key_coupled
215
216         ! 2. Read monthly file of runoff
217         ! ------------------------------
218
219         IF( kt == nit000 .OR. imois /= nrnf1 ) THEN
220
221            ! Calendar computation for interpolation
222            !     nrnf1 number of the first array record used in the simulation
223            !     nrnf2 number of the last  array record
224
225            iman = jpmois
226            nrnf1 = imois
227            nrnf2 = nrnf1 + 1
228            nrnf1 = MOD( nrnf1, iman )
229            IF( nrnf1 == 0 ) nrnf1 = iman
230            nrnf2 = MOD( nrnf2, iman )
231            IF( nrnf2 == 0 ) nrnf2 = iman
232           
233            IF(lwp) THEN
234               WRITE(numout,*)
235               WRITE(numout,*) ' runoff monthly field'
236               WRITE(numout,*) ' --------------------'
237               WRITE(numout,*) ' NetCDF format'
238               WRITE(numout,*)
239               WRITE(numout,*) 'first array record used nrnf1 ',nrnf1
240               WRITE(numout,*) 'last  array record used nrnf2 ',nrnf2
241               WRITE(numout,*)
242            ENDIF
243           
244            ! Read monthly runoff data in kg/m2/s
245!ibug
246            IF( kt == nit000 )   rnfdta(:,:,:) = 0.e0
247!ibug
248            CALL flinget( numrnf, 'sorunoff', jpidta, jpjdta, 1, jpmois   &
249               &        , nrnf1, nrnf1, mig(1), nlci, mjg(1), nlcj, rnfdta(1:nlci,1:nlcj,1) )
250            CALL flinget( numrnf, 'sorunoff', jpidta, jpjdta, 1, jpmois   &
251               &        , nrnf2, nrnf2, mig(1), nlci, mjg(1), nlcj, rnfdta(1:nlci,1:nlcj,2) )
252
253            IF(lwp) WRITE(numout,*)
254            IF(lwp) WRITE(numout,*) ' read runoff field ok'
255            IF(lwp) WRITE(numout,*)
256
257         ENDIF
258
259         ! Linear interpolation and conversion in upward water flux
260         ! C a u t i o n : runoff is negative and in kg/m2/s
261
262         zxy = FLOAT( nday + idmeom - idbd * i15 ) / idbd
263
264         runoff(:,:) = -( ( 1.e0 - zxy ) * rnfdta(:,:,1) + zxy * rnfdta(:,:,2) )
265
266         ! Runoff reduction only associated to the ORCA2_LIM configuration
267         ! when reading the NetCDF file runoff_1m_nomask.nc
268         IF( cp_cfg == 'orca' .AND. jp_cfg == 2 )   THEN
269         DO jj = 1, jpj
270            DO ji = 1, jpi
271               IF( gphit(ji,jj) > 40 .AND. gphit(ji,jj) < 65 )   runoff(ji,jj) = 0.85 * runoff(ji,jj)
272            END DO
273         END DO
274         ENDIF
275         
276# endif
277
278      ENDIF
279
280
281      ! 3. Mixed advection scheme
282      ! -------------------------
283
284      IF( nrunoff == 2 .AND. kt == nit000 ) THEN
285
286         ! Upstream and centered scheme in the vicinity of river mouths
287
288         !  Creates the array coef that contains the coefficient to affect to
289         !  the upstream scheme. advection scheme will be:
290         !  coefr * upstream + (1- coefr) centered
291         !  coefr must be between 0 and 1.
292!ibug
293         zcoefr(:,:) = 0.e0
294!ibug
295
296         CALL flinget( numrnf, 'socoefr', jpidta, jpjdta, 1, jpmois, nrnf1,   &
297            &          nrnf1, mig(1), nlci, mjg(1), nlcj, zcoefr(1:nlci,1:nlcj) )
298
299         IF(lwp) WRITE(numout,*)
300         IF(lwp) WRITE(numout,*) ' read coefr for advection ok'
301         IF(lwp) WRITE(numout,*)
302         
303         upsrnfh(:,:) = zcoefr(:,:)
304         upsrnfz(:)   = 0.e0
305         upsrnfz(1)   = 1.0
306         upsrnfz(2)   = 1.0
307         upsrnfz(3)   = 0.5
308         upsrnfz(4)   = 0.25
309         upsrnfz(5)   = 0.125
310         
311         IF( cp_cfg == "orca" .AND. jp_cfg == 2 ) THEN
312            ! ORCA_R2 configuration : upstream scheme in the Sound Strait
313            ij0 = 116   ;   ij1 = 116
314            ii0 = 144   ;   ii1 = 144   ;   upsrnfh( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.25
315            ii0 = 145   ;   ii1 = 147   ;   upsrnfh( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.50
316            ii0 = 148   ;   ii1 = 148   ;   upsrnfh( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.25
317         ENDIF
318
319      ENDIF
320
321      ! Upstream and centered scheme in the vicinity of some straits
322
323      IF( kt == nit000 ) THEN
324
325         IF( cp_cfg == "orca" ) THEN
326
327            SELECT CASE ( jp_cfg )
328            !                                        ! =======================
329            CASE ( 4 )                               !  ORCA_R4 configuration
330               !                                     ! =======================
331
332               !                                          ! Gibraltar Strait
333               ii0 =  70   ;   ii1 =  71
334               ij0 =  52   ;   ij1 =  53   ;   upsadv( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.50
335         
336               !                                     ! =======================
337            CASE ( 2 )                               !  ORCA_R2 configuration
338               !                                     ! =======================
339
340               !                                          ! Gibraltar Strait
341               ij0 = 102   ;   ij1 = 102
342               ii0 = 138   ;   ii1 = 138   ;   upsadv( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.20
343               ii0 = 139   ;   ii1 = 139   ;   upsadv( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.40
344               ii0 = 140   ;   ii1 = 140   ;   upsadv( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.50
345               ij0 = 101   ;   ij1 = 102
346               ii0 = 141   ;   ii1 = 141   ;   upsadv( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.50
347
348               !                                          ! Bab el Mandeb Strait
349               ij0 =  87   ;   ij1 =  88
350               ii0 = 164   ;   ii1 = 164   ;   upsadv( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.10
351               ij0 =  88   ;   ij1 =  88
352               ii0 = 163   ;   ii1 = 163   ;   upsadv( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.25
353               ii0 = 162   ;   ii1 = 162   ;   upsadv( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.40
354               ii0 = 160   ;   ii1 = 161   ;   upsadv( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.50
355               ij0 =  89   ;   ij1 =  89
356               ii0 = 158   ;   ii1 = 160   ;   upsadv( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.25
357               ij0 =  90   ;   ij1 =  90
358               ii0 = 160   ;   ii1 = 160   ;   upsadv( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.25
359
360               !                                          ! Sound Strait
361               ij0 = 116   ;   ij1 = 116
362               ii0 = 145   ;   ii1 = 147   ;   upsadv( mi0(ii0):mi1(ii1) , mj0(ij0):mj1(ij1) ) = 0.50
363         
364            END SELECT
365
366         ENDIF
367
368      ENDIF
369     
370      ! 4. Closing all files
371      ! --------------------
372
373      IF( kt == nitend .AND. nrunoff >= 1 )   CALL flinclo( numrnf )
374
375   END SUBROUTINE flx_rnf
376
377#endif
378   !!======================================================================
379END MODULE flxrnf
Note: See TracBrowser for help on using the repository browser.