1 | MODULE 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 | TYPE(FLD_N) :: sn_sal_rnf !: information about the salinities of runoff file to be read |
---|
35 | TYPE(FLD_N) :: sn_tem_rnf !: information about the temperatures of runoff file to be read |
---|
36 | TYPE(FLD_N) :: sn_dep_rnf !: information about the depth which river inflow affects |
---|
37 | LOGICAL , PUBLIC :: ln_rnf_mouth = .false. !: specific treatment in mouths vicinity |
---|
38 | REAL(wp) , PUBLIC :: rn_hrnf = 0.e0 !: runoffs, depth over which enhanced vertical mixing is used |
---|
39 | REAL(wp) , PUBLIC :: rn_avt_rnf = 0.e0 !: runoffs, value of the additional vertical mixing coef. [m2/s] |
---|
40 | LOGICAL , PUBLIC :: ln_rnf_att = .false. !: river runoffs attributes (temp, sal & depth) are specified in a file |
---|
41 | REAL(wp) , PUBLIC :: rn_rfact = 1.e0 !: multiplicative factor for runoff |
---|
42 | |
---|
43 | INTEGER , PUBLIC :: nkrnf = 0 !: number of levels over which Kz is increased at river mouths |
---|
44 | REAL(wp), PUBLIC, DIMENSION(jpi,jpj) :: rnfmsk !: river mouth mask (hori.) |
---|
45 | REAL(wp), PUBLIC, DIMENSION(jpk) :: rnfmsk_z !: river mouth mask (vert.) |
---|
46 | |
---|
47 | TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: sf_rnf !: structure of input river runoff (file information, fields read) |
---|
48 | |
---|
49 | TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: sf_sal_rnf !: structure of input river runoff salinity (file information, fields read) |
---|
50 | TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: sf_tem_rnf !: structure of input river runoff temperature (file information, fields read) |
---|
51 | |
---|
52 | REAL, PUBLIC, DIMENSION(jpi,jpj) :: rnf_dep !: depth of runoff in m |
---|
53 | INTEGER, PUBLIC, DIMENSION(jpi,jpj) :: rnf_mod_dep !: depth of runoff in model levels |
---|
54 | REAL, PUBLIC, DIMENSION(jpi,jpj) :: rnf_sal !: salinity of river runoff |
---|
55 | REAL, PUBLIC, DIMENSION(jpi,jpj) :: rnf_tem !: temperature of river runoff |
---|
56 | |
---|
57 | INTEGER :: ji, jj ,jk ! dummy loop indices |
---|
58 | INTEGER :: inum ! temporary logical unit |
---|
59 | |
---|
60 | !! * Substitutions |
---|
61 | # include "domzgr_substitute.h90" |
---|
62 | |
---|
63 | !!---------------------------------------------------------------------- |
---|
64 | !! NEMO/OPA 3.2 , LOCEAN-IPSL (2009) |
---|
65 | !! $Id$ |
---|
66 | !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) |
---|
67 | !!---------------------------------------------------------------------- |
---|
68 | |
---|
69 | CONTAINS |
---|
70 | |
---|
71 | SUBROUTINE sbc_rnf( kt ) |
---|
72 | !!---------------------------------------------------------------------- |
---|
73 | !! *** ROUTINE sbc_rnf *** |
---|
74 | !! |
---|
75 | !! ** Purpose : Introduce a climatological run off forcing |
---|
76 | !! |
---|
77 | !! ** Method : Set each river mouth with a monthly climatology |
---|
78 | !! provided from different data. |
---|
79 | !! CAUTION : upward water flux, runoff forced to be < 0 |
---|
80 | !! |
---|
81 | !! ** Action : runoff updated runoff field at time-step kt |
---|
82 | !!---------------------------------------------------------------------- |
---|
83 | INTEGER, INTENT(in) :: kt ! ocean time step |
---|
84 | !! |
---|
85 | INTEGER :: ji, jj ! dummy loop indices |
---|
86 | !!---------------------------------------------------------------------- |
---|
87 | ! |
---|
88 | IF( kt == nit000 ) THEN |
---|
89 | CALL sbc_rnf_init ! Read namelist and allocate structures |
---|
90 | ENDIF |
---|
91 | |
---|
92 | ! !-------------------! |
---|
93 | IF( .NOT. ln_rnf_emp ) THEN ! Update runoff ! |
---|
94 | ! !-------------------! |
---|
95 | ! |
---|
96 | CALL fld_read( kt, nn_fsbc, sf_rnf ) ! Read Runoffs data and provides it |
---|
97 | ! ! at the current time-step |
---|
98 | IF ( ln_rnf_att ) THEN |
---|
99 | CALL fld_read ( kt, nn_fsbc, sf_sal_rnf ) |
---|
100 | CALL fld_read ( kt, nn_fsbc, sf_tem_rnf ) |
---|
101 | ENDIF |
---|
102 | |
---|
103 | ! Runoff reduction only associated to the ORCA2_LIM configuration |
---|
104 | ! when reading the NetCDF file runoff_1m_nomask.nc |
---|
105 | IF( cp_cfg == 'orca' .AND. jp_cfg == 2 ) THEN |
---|
106 | DO jj = 1, jpj |
---|
107 | DO ji = 1, jpi |
---|
108 | 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) |
---|
109 | END DO |
---|
110 | END DO |
---|
111 | ENDIF |
---|
112 | |
---|
113 | ! C a u t i o n : runoff is negative and in kg/m2/s |
---|
114 | |
---|
115 | IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN |
---|
116 | rnf(:,:) = rn_rfact * ( sf_rnf(1)%fnow(:,:,1) ) |
---|
117 | IF ( ln_rnf_att ) THEN |
---|
118 | rnf_sal(:,:) = ( sf_sal_rnf(1)%fnow(:,:,1) ) |
---|
119 | rnf_tem(:,:) = ( sf_tem_rnf(1)%fnow(:,:,1) ) |
---|
120 | ELSE |
---|
121 | rnf_sal(:,:) = 0 |
---|
122 | rnf_tem(:,:) = -999 |
---|
123 | ENDIF |
---|
124 | CALL iom_put( "runoffs", rnf ) ! runoffs |
---|
125 | ENDIF |
---|
126 | ! |
---|
127 | ENDIF |
---|
128 | ! |
---|
129 | END SUBROUTINE sbc_rnf |
---|
130 | |
---|
131 | |
---|
132 | SUBROUTINE sbc_rnf_init |
---|
133 | !!---------------------------------------------------------------------- |
---|
134 | !! *** ROUTINE sbc_rnf_init *** |
---|
135 | !! |
---|
136 | !! ** Purpose : Initialisation of the runoffs if (ln_rnf=T) |
---|
137 | !! |
---|
138 | !! ** Method : - read the runoff namsbc_rnf namelist |
---|
139 | !! |
---|
140 | !! ** Action : - read parameters |
---|
141 | !!---------------------------------------------------------------------- |
---|
142 | INTEGER :: ierror ! temporary integer |
---|
143 | CHARACTER(len=32) :: rn_dep_file ! runoff file name |
---|
144 | !! |
---|
145 | NAMELIST/namsbc_rnf/ cn_dir, ln_rnf_emp, sn_rnf, sn_cnf, sn_sal_rnf, sn_tem_rnf, sn_dep_rnf, & |
---|
146 | & ln_rnf_mouth, ln_rnf_att, rn_hrnf, rn_avt_rnf, rn_rfact |
---|
147 | !!---------------------------------------------------------------------- |
---|
148 | |
---|
149 | ! ! ============ |
---|
150 | ! ! Namelist |
---|
151 | ! ! ============ |
---|
152 | ! (NB: frequency positive => hours, negative => months) |
---|
153 | ! ! file ! frequency ! variable ! time intep ! clim ! 'yearly' or ! weights ! rotation ! |
---|
154 | ! ! name ! (hours) ! name ! (T/F) ! (T/F) ! 'monthly' ! filename ! pairs ! |
---|
155 | sn_rnf = FLD_N( 'runoffs', -1 , 'sorunoff' , .TRUE. , .true. , 'yearly' , '' , '' ) |
---|
156 | sn_cnf = FLD_N( 'runoffs', 0 , 'sorunoff' , .FALSE. , .true. , 'yearly' , '' , '' ) |
---|
157 | |
---|
158 | sn_sal_rnf = FLD_N( 'runoffs', 24. , 'rosaline' , .TRUE. , .true. , 'yearly' , '' , '' ) |
---|
159 | sn_tem_rnf = FLD_N( 'runoffs', 24. , 'rotemper' , .TRUE. , .true. , 'yearly' , '' , '' ) |
---|
160 | sn_dep_rnf = FLD_N( 'runoffs', 0. , 'rodepth' , .FALSE. , .true. , 'yearly' , '' , '' ) |
---|
161 | ! |
---|
162 | REWIND ( numnam ) ! Read Namelist namsbc_rnf |
---|
163 | READ ( numnam, namsbc_rnf ) |
---|
164 | |
---|
165 | ! ! Control print |
---|
166 | IF(lwp) THEN |
---|
167 | WRITE(numout,*) |
---|
168 | WRITE(numout,*) 'sbc_rnf : runoff ' |
---|
169 | WRITE(numout,*) '~~~~~~~ ' |
---|
170 | WRITE(numout,*) ' Namelist namsbc_rnf' |
---|
171 | WRITE(numout,*) ' runoff in a file to be read ln_rnf_emp = ', ln_rnf_emp |
---|
172 | WRITE(numout,*) ' specific river mouths treatment ln_rnf_mouth = ', ln_rnf_mouth |
---|
173 | WRITE(numout,*) ' river mouth additional Kz rn_avt_rnf = ', rn_avt_rnf |
---|
174 | WRITE(numout,*) ' depth of river mouth additional mixing rn_hrnf = ', rn_hrnf |
---|
175 | WRITE(numout,*) ' multiplicative factor for runoff rn_rfact = ', rn_rfact |
---|
176 | ENDIF |
---|
177 | |
---|
178 | ! ! ================== |
---|
179 | ! ! Type of runoff |
---|
180 | ! ! ================== |
---|
181 | ! |
---|
182 | IF( ln_rnf_emp ) THEN ! runoffs directly provided in the precipitations |
---|
183 | IF(lwp) WRITE(numout,*) |
---|
184 | IF(lwp) WRITE(numout,*) ' runoffs directly provided in the precipitations' |
---|
185 | IF ( ln_rnf_att ) THEN |
---|
186 | CALL ctl_warn( 'runoffs already included in precipitations & so runoff attributes will not be used' ) |
---|
187 | ln_rnf_att = .FALSE. |
---|
188 | ENDIF |
---|
189 | ! |
---|
190 | ELSE ! runoffs read in a file : set sf_rnf structure |
---|
191 | ! |
---|
192 | ! Allocate sf_rnf structure and (if required) sf_sal_rnf and sf_tem_rnf structures |
---|
193 | ALLOCATE( sf_rnf(1), STAT=ierror ) |
---|
194 | IF( ierror > 0 ) THEN |
---|
195 | CALL ctl_stop( 'sbc_rnf: unable to allocate sf_rnf structure' ) ; RETURN |
---|
196 | ENDIF |
---|
197 | ALLOCATE( sf_rnf(1)%fnow(jpi,jpj,1) ) |
---|
198 | ALLOCATE( sf_rnf(1)%fdta(jpi,jpj,1,2) ) |
---|
199 | |
---|
200 | IF( ln_rnf_att ) THEN |
---|
201 | ALLOCATE( sf_sal_rnf(1), STAT=ierror ) |
---|
202 | IF( ierror > 0 ) THEN |
---|
203 | CALL ctl_stop( 'sbc_sal_rnf: unable to allocate sf_sal_rnf structure' ) ; RETURN |
---|
204 | ENDIF |
---|
205 | ALLOCATE( sf_sal_rnf(1)%fnow(jpi,jpj,1) ) |
---|
206 | ALLOCATE( sf_sal_rnf(1)%fdta(jpi,jpj,1,2) ) |
---|
207 | |
---|
208 | ALLOCATE( sf_tem_rnf(1), STAT=ierror ) |
---|
209 | IF( ierror > 0 ) THEN |
---|
210 | CALL ctl_stop( 'sbc_tmp_rnf: unable to allocate sf_tem_rnf structure' ) ; RETURN |
---|
211 | ENDIF |
---|
212 | ALLOCATE( sf_tem_rnf(1)%fnow(jpi,jpj,1) ) |
---|
213 | ALLOCATE( sf_tem_rnf(1)%fdta(jpi,jpj,1,2) ) |
---|
214 | ENDIF |
---|
215 | ! fill sf_rnf with sn_rnf and control print |
---|
216 | CALL fld_fill( sf_rnf, (/ sn_rnf /), cn_dir, 'sbc_rnf_init', 'read runoffs data', 'namsbc_rnf' ) |
---|
217 | |
---|
218 | IF ( ln_rnf_att ) THEN |
---|
219 | CALL fld_fill (sf_sal_rnf, (/ sn_sal_rnf /), cn_dir, 'sbc_rnf_init', 'read runoff salinity data', 'namsbc_rnf' ) |
---|
220 | CALL fld_fill (sf_tem_rnf, (/ sn_tem_rnf /), cn_dir, 'sbc_rnf_init', 'read runoff temperature data', 'namsbc_rnf' ) |
---|
221 | |
---|
222 | rn_dep_file = TRIM( cn_dir )//TRIM( sn_dep_rnf%clname ) |
---|
223 | CALL iom_open ( rn_dep_file, inum ) ! open file |
---|
224 | CALL iom_get ( inum, jpdom_data, sn_dep_rnf%clvar, rnf_dep ) ! read the river mouth array |
---|
225 | CALL iom_close( inum ) ! close file |
---|
226 | |
---|
227 | rnf_mod_dep(:,:) = 0. |
---|
228 | DO jj = 1, jpj |
---|
229 | DO ji = 1, jpi |
---|
230 | IF ( rnf_dep(ji,jj) > 0.e0 ) THEN |
---|
231 | jk = 2 |
---|
232 | DO WHILE ( jk /= jpkm1 .AND. fsdept(ji,jj,jk) < rnf_dep(ji,jj) ) ; jk = jk + 1 ; ENDDO |
---|
233 | rnf_mod_dep(ji,jj) = jk |
---|
234 | ELSE IF ( rnf_dep(ji,jj) == -1. ) THEN |
---|
235 | rnf_mod_dep(ji,jj) = 1. |
---|
236 | ELSE IF ( rnf_dep(ji,jj) == -999 ) THEN |
---|
237 | rnf_mod_dep(ji,jj) = jpkm1 |
---|
238 | ELSE IF ( rnf_dep(ji,jj) /= 0. ) THEN |
---|
239 | CALL ctl_stop( 'runoff depth not positive, and not -999 or -1, rnf value in file fort.999' ) |
---|
240 | WRITE(999,*) 'ji, jj, rnf(ji,jj) :', ji, jj, rnf(ji,jj) |
---|
241 | ENDIF |
---|
242 | ENDDO |
---|
243 | ENDDO |
---|
244 | ELSE |
---|
245 | rnf_mod_dep(:,:) = 1. |
---|
246 | ENDIF |
---|
247 | ! |
---|
248 | ENDIF |
---|
249 | ! |
---|
250 | DO jj = 1, jpj |
---|
251 | DO ji = 1, jpi |
---|
252 | rnf_dep(ji,jj) = 0. |
---|
253 | DO jk = 1, rnf_mod_dep(ji,jj) ! recalculates rnf_dep to be the depth |
---|
254 | rnf_dep(ji,jj) = rnf_dep(ji,jj) + fse3t(ji,jj,jk) ! in metres to the bottom of the relevant grid box |
---|
255 | ENDDO |
---|
256 | ENDDO |
---|
257 | ENDDO |
---|
258 | ! |
---|
259 | |
---|
260 | ! ! ======================== |
---|
261 | ! ! River mouth vicinity |
---|
262 | ! ! ======================== |
---|
263 | ! |
---|
264 | IF( ln_rnf_mouth ) THEN ! Specific treatment in vicinity of river mouths : |
---|
265 | ! ! - Increase Kz in surface layers ( rn_hrnf > 0 ) |
---|
266 | ! ! - set to zero SSS damping (ln_ssr=T) |
---|
267 | ! ! - mixed upstream-centered (ln_traadv_cen2=T) |
---|
268 | ! |
---|
269 | ! ! Number of level over which Kz increase |
---|
270 | IF ( ln_rnf_att ) & |
---|
271 | & CALL ctl_warn( 'increased mixing turned on but effects may already be spread through depth by ln_rnf_att' ) |
---|
272 | nkrnf = 0 |
---|
273 | IF( rn_hrnf > 0.e0 ) THEN |
---|
274 | nkrnf = 2 |
---|
275 | DO WHILE( nkrnf /= jpkm1 .AND. gdepw_0(nkrnf+1) < rn_hrnf ) ; nkrnf = nkrnf + 1 ; END DO |
---|
276 | IF( ln_sco ) & |
---|
277 | CALL ctl_warn( 'sbc_rnf: number of levels over which Kz is increased is computed for zco...' ) |
---|
278 | ENDIF |
---|
279 | IF(lwp) WRITE(numout,*) |
---|
280 | IF(lwp) WRITE(numout,*) ' Specific treatment used in vicinity of river mouths :' |
---|
281 | IF(lwp) WRITE(numout,*) ' - Increase Kz in surface layers (if rn_hrnf > 0 )' |
---|
282 | IF(lwp) WRITE(numout,*) ' by ', rn_avt_rnf,' m2/s over ', nkrnf, ' w-levels' |
---|
283 | IF(lwp) WRITE(numout,*) ' - set to zero SSS damping (if ln_ssr=T)' |
---|
284 | IF(lwp) WRITE(numout,*) ' - mixed upstream-centered (if ln_traadv_cen2=T)' |
---|
285 | ! |
---|
286 | CALL rnf_mouth ! set river mouth mask |
---|
287 | ! |
---|
288 | ELSE ! No treatment at river mouths |
---|
289 | IF(lwp) WRITE(numout,*) |
---|
290 | IF(lwp) WRITE(numout,*) ' No specific treatment at river mouths' |
---|
291 | rnfmsk (:,:) = 0.e0 |
---|
292 | rnfmsk_z(:) = 0.e0 |
---|
293 | nkrnf = 0 |
---|
294 | ENDIF |
---|
295 | |
---|
296 | END SUBROUTINE sbc_rnf_init |
---|
297 | |
---|
298 | |
---|
299 | SUBROUTINE rnf_mouth |
---|
300 | !!---------------------------------------------------------------------- |
---|
301 | !! *** ROUTINE rnf_mouth *** |
---|
302 | !! |
---|
303 | !! ** Purpose : define the river mouths mask |
---|
304 | !! |
---|
305 | !! ** Method : read the river mouth mask (=0/1) in the river runoff |
---|
306 | !! climatological file. Defined a given vertical structure. |
---|
307 | !! CAUTION, the vertical structure is hard coded on the |
---|
308 | !! first 5 levels. |
---|
309 | !! This fields can be used to: |
---|
310 | !! - set an upstream advection scheme |
---|
311 | !! (ln_rnf_mouth=T and ln_traadv_cen2=T) |
---|
312 | !! - increase vertical on the top nn_krnf vertical levels |
---|
313 | !! at river runoff input grid point (nn_krnf>=2, see step.F90) |
---|
314 | !! - set to zero SSS restoring flux at river mouth grid points |
---|
315 | !! |
---|
316 | !! ** Action : rnfmsk set to 1 at river runoff input, 0 elsewhere |
---|
317 | !! rnfmsk_z vertical structure |
---|
318 | !!---------------------------------------------------------------------- |
---|
319 | USE closea, ONLY : clo_rnf ! rnfmsk update routine |
---|
320 | ! |
---|
321 | INTEGER :: inum ! temporary integers |
---|
322 | CHARACTER(len=32) :: cl_rnfile ! runoff file name |
---|
323 | !!---------------------------------------------------------------------- |
---|
324 | ! |
---|
325 | IF(lwp) WRITE(numout,*) |
---|
326 | IF(lwp) WRITE(numout,*) 'rnf_mouth : river mouth mask' |
---|
327 | IF(lwp) WRITE(numout,*) '~~~~~~~~~ ' |
---|
328 | |
---|
329 | cl_rnfile = TRIM( cn_dir )//TRIM( sn_cnf%clname ) |
---|
330 | IF( .NOT. sn_cnf%ln_clim ) THEN ; WRITE(cl_rnfile, '(a,"_y",i4)' ) TRIM( cl_rnfile ), nyear ! add year |
---|
331 | IF( sn_cnf%cltype == 'monthly' ) WRITE(cl_rnfile, '(a,"m",i2)' ) TRIM( cl_rnfile ), nmonth ! add month |
---|
332 | ENDIF |
---|
333 | |
---|
334 | ! horizontal mask (read in NetCDF file) |
---|
335 | CALL iom_open ( cl_rnfile, inum ) ! open file |
---|
336 | CALL iom_get ( inum, jpdom_data, sn_cnf%clvar, rnfmsk ) ! read the river mouth array |
---|
337 | CALL iom_close( inum ) ! close file |
---|
338 | |
---|
339 | IF( nclosea == 1 ) CALL clo_rnf( rnfmsk ) ! closed sea inflow set as ruver mouth |
---|
340 | |
---|
341 | rnfmsk_z(:) = 0.e0 ! vertical structure |
---|
342 | rnfmsk_z(1) = 1.0 |
---|
343 | rnfmsk_z(2) = 1.0 ! ********** |
---|
344 | rnfmsk_z(3) = 0.5 ! HARD CODED on the 5 first levels |
---|
345 | rnfmsk_z(4) = 0.25 ! ********** |
---|
346 | rnfmsk_z(5) = 0.125 |
---|
347 | ! |
---|
348 | END SUBROUTINE rnf_mouth |
---|
349 | |
---|
350 | !!====================================================================== |
---|
351 | END MODULE sbcrnf |
---|