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.
sbcrnf.F90 in branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC – NEMO

source: branches/DEV_r1784_3DF/NEMO/OPA_SRC/SBC/sbcrnf.F90 @ 2125

Last change on this file since 2125 was 2125, checked in by cbricaud, 14 years ago

modification: don't allocate fdta arrays when time-interpollation is not used

  • Property svn:keywords set to Id
File size: 13.2 KB
Line 
1MODULE sbcrnf
2   !!======================================================================
3   !!                       ***  MODULE  sbcrnf  ***
4   !! Ocean forcing:  river runoff
5   !!=====================================================================
6   !! History :  OPA  !  2000-11  (R. Hordoir, E. Durand)  NetCDF FORMAT
7   !!   NEMO     1.0  !  2002-09  (G. Madec)  F90: Free form and module
8   !!            3.0  !  2006-07  (G. Madec)  Surface module
9   !!            3.2  !  2009-04  (B. Lemaire)  Introduce iom_put
10   !!----------------------------------------------------------------------
11
12   !!----------------------------------------------------------------------
13   !!   sbc_rnf      : monthly runoffs read in a NetCDF file
14   !!   sbc_rnf_init : runoffs initialisation
15   !!   rnf_mouth    : set river mouth mask
16   !!----------------------------------------------------------------------
17   USE dom_oce         ! ocean space and time domain
18   USE phycst          ! physical constants
19   USE sbc_oce         ! surface boundary condition variables
20   USE fldread         ! ???
21   USE in_out_manager  ! I/O manager
22   USE iom             ! I/O module
23
24   IMPLICIT NONE
25   PRIVATE
26
27   PUBLIC sbc_rnf          ! routine call in step module
28
29   !                                                     !!* namsbc_rnf namelist *
30   CHARACTER(len=100), PUBLIC ::   cn_dir       = './'    !: Root directory for location of ssr files
31   LOGICAL           , PUBLIC ::   ln_rnf_emp   = .false. !: runoffs into a file to be read or already into precipitation
32   TYPE(FLD_N)       , PUBLIC ::   sn_rnf                 !: information about the runoff file to be read
33   TYPE(FLD_N)       , PUBLIC ::   sn_cnf                 !: information about the runoff mouth file to be read
34   LOGICAL           , PUBLIC ::   ln_rnf_mouth = .false. !: specific treatment in mouths vicinity
35   REAL(wp)          , PUBLIC ::   rn_hrnf      = 0.e0    !: runoffs, depth over which enhanced vertical mixing is used
36   REAL(wp)          , PUBLIC ::   rn_avt_rnf   = 0.e0    !: runoffs, value of the additional vertical mixing coef. [m2/s]
37   REAL(wp)          , PUBLIC ::   rn_rfact     = 1.e0    !: multiplicative factor for runoff
38
39   INTEGER , PUBLIC                     ::   nkrnf = 0   !: number of levels over which Kz is increased at river mouths
40   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::   rnfmsk      !: river mouth mask (hori.)
41   REAL(wp), PUBLIC, DIMENSION(jpk)     ::   rnfmsk_z    !: river mouth mask (vert.)
42
43   TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_rnf   ! structure of input SST (file information, fields read)
44
45   !!----------------------------------------------------------------------
46   !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009)
47   !! $Id$
48   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
49   !!----------------------------------------------------------------------
50
51CONTAINS
52
53   SUBROUTINE sbc_rnf( kt )
54      !!----------------------------------------------------------------------
55      !!                  ***  ROUTINE sbc_rnf  ***
56      !!       
57      !! ** Purpose :   Introduce a climatological run off forcing
58      !!
59      !! ** Method  :   Set each river mouth with a monthly climatology
60      !!                provided from different data.
61      !!                CAUTION : upward water flux, runoff forced to be < 0
62      !!
63      !! ** Action  :   runoff updated runoff field at time-step kt
64      !!----------------------------------------------------------------------
65      INTEGER, INTENT(in) ::   kt          ! ocean time step
66      !!
67      INTEGER  ::   ji, jj   ! dummy loop indices
68      INTEGER  ::   ierror   ! temporary integer
69      !!----------------------------------------------------------------------
70      !                                   
71      IF( kt == nit000 ) THEN 
72         IF( .NOT. ln_rnf_emp ) THEN
73            ALLOCATE( sf_rnf(1), STAT=ierror )
74            IF( ierror > 0 ) THEN
75               CALL ctl_stop( 'sbc_rnf: unable to allocate sf_rnf structure' )   ;   RETURN
76            ENDIF
77         ENDIF
78         CALL sbc_rnf_init(sf_rnf)
79         IF( .NOT. ln_rnf_emp ) THEN
80            ALLOCATE( sf_rnf(1)%fnow(jpi,jpj,1) )
81            IF( sf_rnf(1)%ln_tint ) ALLOCATE( sf_rnf(1)%fdta(jpi,jpj,1,2) )
82         ENDIF
83      ENDIF
84
85      !                                                   !-------------------!
86      IF( .NOT. ln_rnf_emp ) THEN                         !   Update runoff   !
87         !                                                !-------------------!
88         !
89         CALL fld_read( kt, nn_fsbc, sf_rnf )   ! Read Runoffs data and provides it
90         !                                      ! at the current time-step
91
92         ! Runoff reduction only associated to the ORCA2_LIM configuration
93         ! when reading the NetCDF file runoff_1m_nomask.nc
94         IF( cp_cfg == 'orca' .AND. jp_cfg == 2 )   THEN
95            DO jj = 1, jpj
96               DO ji = 1, jpi
97                  IF( gphit(ji,jj) > 40 .AND. gphit(ji,jj) < 65 )   sf_rnf(1)%fnow(ji,jj,1) = 0.85 * sf_rnf(1)%fnow(ji,jj,1)
98               END DO
99            END DO
100         ENDIF
101
102         ! C a u t i o n : runoff is negative and in kg/m2/s
103
104         IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN
105            emp (:,:) = emp (:,:) - rn_rfact * ABS( sf_rnf(1)%fnow(:,:,1) )
106            emps(:,:) = emps(:,:) - rn_rfact * ABS( sf_rnf(1)%fnow(:,:,1) )
107            CALL iom_put( "runoffs", sf_rnf(1)%fnow )         ! runoffs
108         ENDIF
109         !
110      ENDIF
111      !
112   END SUBROUTINE sbc_rnf
113
114
115   SUBROUTINE sbc_rnf_init( sf_rnf )
116      !!----------------------------------------------------------------------
117      !!                  ***  ROUTINE sbc_rnf_init  ***
118      !!
119      !! ** Purpose :   Initialisation of the runoffs if (ln_rnf=T)
120      !!
121      !! ** Method  : - read the runoff namsbc_rnf namelist
122      !!
123      !! ** Action  : - read parameters
124      !!----------------------------------------------------------------------
125      TYPE(FLD), INTENT(inout), DIMENSION(:) :: sf_rnf   ! input data
126      !!
127      NAMELIST/namsbc_rnf/ cn_dir, ln_rnf_emp, sn_rnf, sn_cnf, ln_rnf_mouth,   &
128         &                 rn_hrnf, rn_avt_rnf, rn_rfact
129      !!----------------------------------------------------------------------
130
131      !                                   ! ============
132      !                                   !   Namelist
133      !                                   ! ============
134      ! (NB: frequency positive => hours, negative => months)
135      !            !   file    ! frequency !  variable  ! time intep !  clim  ! 'yearly' or ! weights  ! rotation   !
136      !            !   name    !  (hours)  !   name     !   (T/F)    !  (T/F) !  'monthly'  ! filename ! pairs      !
137      sn_rnf = FLD_N( 'runoffs',    -1     , 'sorunoff' ,  .TRUE.    , .true. ,   'yearly'  , ''       , ''         )
138      sn_cnf = FLD_N( 'runoffs',     0     , 'sorunoff' ,  .FALSE.   , .true. ,   'yearly'  , ''       , ''         )
139
140      !
141      REWIND ( numnam )                         ! Read Namelist namsbc_rnf
142      READ   ( numnam, namsbc_rnf )
143
144      !                                         ! Control print
145      IF(lwp) THEN
146         WRITE(numout,*)
147         WRITE(numout,*) 'sbc_rnf : runoff '
148         WRITE(numout,*) '~~~~~~~ '
149         WRITE(numout,*) '   Namelist namsbc_rnf'
150         WRITE(numout,*) '      runoff in a file to be read                ln_rnf_emp   = ', ln_rnf_emp
151         WRITE(numout,*) '      specific river mouths treatment            ln_rnf_mouth = ', ln_rnf_mouth
152         WRITE(numout,*) '      river mouth additional Kz                  rn_avt_rnf   = ', rn_avt_rnf
153         WRITE(numout,*) '      depth of river mouth additional mixing     rn_hrnf      = ', rn_hrnf
154         WRITE(numout,*) '      multiplicative factor for runoff           rn_rfact     = ', rn_rfact   
155      ENDIF
156
157      !                                   ! ==================
158      !                                   !   Type of runoff
159      !                                   ! ==================
160      !
161      IF( ln_rnf_emp ) THEN                     ! runoffs directly provided in the precipitations
162         IF(lwp) WRITE(numout,*)
163         IF(lwp) WRITE(numout,*) '          runoffs directly provided in the precipitations'
164         !
165      ELSE                                      ! runoffs read in a file : set sf_rnf structure
166         !
167         ! sf_rnf already allocated in main routine
168         ! fill sf_rnf with sn_rnf and control print
169         CALL fld_fill( sf_rnf, (/ sn_rnf /), cn_dir, 'sbc_rnf_init', 'read runoffs data', 'namsbc_rnf' )
170         !
171      ENDIF
172
173      !                                   ! ========================
174      !                                   !   River mouth vicinity
175      !                                   ! ========================
176      !
177      IF( ln_rnf_mouth ) THEN                   ! Specific treatment in vicinity of river mouths :
178         !                                      !    - Increase Kz in surface layers ( rn_hrnf > 0 )
179         !                                      !    - set to zero SSS damping (ln_ssr=T)
180         !                                      !    - mixed upstream-centered (ln_traadv_cen2=T)
181         !
182         !                                          ! Number of level over which Kz increase
183         nkrnf = 0
184         IF( rn_hrnf > 0.e0 ) THEN
185            nkrnf = 2
186            DO WHILE( nkrnf /= jpkm1 .AND. gdepw_0(nkrnf+1) < rn_hrnf )   ;   nkrnf = nkrnf + 1   ;   END DO
187            IF( ln_sco )   &
188               CALL ctl_warn( 'sbc_rnf: number of levels over which Kz is increased is computed for zco...' )
189         ENDIF
190         IF(lwp) WRITE(numout,*)
191         IF(lwp) WRITE(numout,*) '          Specific treatment used in vicinity of river mouths :'
192         IF(lwp) WRITE(numout,*) '             - Increase Kz in surface layers (if rn_hrnf > 0 )'
193         IF(lwp) WRITE(numout,*) '               by ', rn_avt_rnf,' m2/s  over ', nkrnf, ' w-levels'
194         IF(lwp) WRITE(numout,*) '             - set to zero SSS damping       (if ln_ssr=T)'
195         IF(lwp) WRITE(numout,*) '             - mixed upstream-centered       (if ln_traadv_cen2=T)'
196         !
197         CALL rnf_mouth                             ! set river mouth mask
198         !
199      ELSE                                      ! No treatment at river mouths
200         IF(lwp) WRITE(numout,*)
201         IF(lwp) WRITE(numout,*) '          No specific treatment at river mouths'
202         rnfmsk  (:,:) = 0.e0 
203         rnfmsk_z(:)   = 0.e0
204         nkrnf = 0
205      ENDIF
206
207   END SUBROUTINE sbc_rnf_init
208
209
210   SUBROUTINE rnf_mouth
211      !!----------------------------------------------------------------------
212      !!                  ***  ROUTINE rnf_mouth  ***
213      !!       
214      !! ** Purpose :   define the river mouths mask
215      !!
216      !! ** Method  :   read the river mouth mask (=0/1) in the river runoff
217      !!                climatological file. Defined a given vertical structure.
218      !!                CAUTION, the vertical structure is hard coded on the
219      !!                first 5 levels.
220      !!                This fields can be used to:
221      !!                 - set an upstream advection scheme 
222      !!                   (ln_rnf_mouth=T and ln_traadv_cen2=T)
223      !!                 - increase vertical on the top nn_krnf vertical levels
224      !!                   at river runoff input grid point (nn_krnf>=2, see step.F90)
225      !!                 - set to zero SSS restoring flux at river mouth grid points
226      !!
227      !! ** Action  :   rnfmsk   set to 1 at river runoff input, 0 elsewhere
228      !!                rnfmsk_z vertical structure
229      !!----------------------------------------------------------------------
230      USE closea, ONLY :    clo_rnf   ! rnfmsk update routine
231      !
232      INTEGER           ::   inum        ! temporary integers
233      CHARACTER(len=32) ::   cl_rnfile   ! runoff file name
234      !!----------------------------------------------------------------------
235      !
236      IF(lwp) WRITE(numout,*)
237      IF(lwp) WRITE(numout,*) 'rnf_mouth : river mouth mask'
238      IF(lwp) WRITE(numout,*) '~~~~~~~~~ '
239
240      cl_rnfile = TRIM( cn_dir )//TRIM( sn_cnf%clname )
241      IF( .NOT. sn_cnf%ln_clim ) THEN   ;   WRITE(cl_rnfile, '(a,"_y",i4)' ) TRIM( cl_rnfile ), nyear    ! add year
242         IF( sn_cnf%cltype == 'monthly' )   WRITE(cl_rnfile, '(a,"m",i2)'  ) TRIM( cl_rnfile ), nmonth   ! add month
243      ENDIF
244 
245      ! horizontal mask (read in NetCDF file)
246      CALL iom_open ( cl_rnfile, inum )                           ! open file
247      CALL iom_get  ( inum, jpdom_data, sn_cnf%clvar, rnfmsk )    ! read the river mouth array
248      CALL iom_close( inum )                                      ! close file
249     
250      IF( nclosea == 1 )    CALL clo_rnf( rnfmsk )                ! closed sea inflow set as ruver mouth
251
252      rnfmsk_z(:)   = 0.e0                                        ! vertical structure
253      rnfmsk_z(1)   = 1.0
254      rnfmsk_z(2)   = 1.0                                         ! **********
255      rnfmsk_z(3)   = 0.5                                         ! HARD CODED on the 5 first levels
256      rnfmsk_z(4)   = 0.25                                        ! **********
257      rnfmsk_z(5)   = 0.125
258      !         
259   END SUBROUTINE rnf_mouth
260   
261   !!======================================================================
262END MODULE sbcrnf
Note: See TracBrowser for help on using the repository browser.