1 | MODULE sbcflx |
---|
2 | !!====================================================================== |
---|
3 | !! *** MODULE sbcflx *** |
---|
4 | !! Ocean forcing: momentum, heat and freshwater flux formulation |
---|
5 | !!===================================================================== |
---|
6 | !! History : 1.0 ! 2006-06 (G. Madec) Original code |
---|
7 | !! 3.3 ! 2010-10 (S. Masson) add diurnal cycle |
---|
8 | !!---------------------------------------------------------------------- |
---|
9 | |
---|
10 | !!---------------------------------------------------------------------- |
---|
11 | !! namflx : flux formulation namlist |
---|
12 | !! sbc_flx : flux formulation as ocean surface boundary condition (forced mode, fluxes read in NetCDF files) |
---|
13 | !!---------------------------------------------------------------------- |
---|
14 | USE oce ! ocean dynamics and tracers |
---|
15 | USE dom_oce ! ocean space and time domain |
---|
16 | USE sbc_oce ! surface boundary condition: ocean fields |
---|
17 | USE sbcdcy ! surface boundary condition: diurnal cycle on qsr |
---|
18 | USE phycst ! physical constants |
---|
19 | USE fldread ! read input fields |
---|
20 | USE iom ! IOM library |
---|
21 | USE in_out_manager ! I/O manager |
---|
22 | USE sbcwave ! wave physics |
---|
23 | USE lib_mpp ! distribued memory computing library |
---|
24 | USE lbclnk ! ocean lateral boundary conditions (or mpp link) |
---|
25 | USE wrk_nemo ! work arrays |
---|
26 | |
---|
27 | IMPLICIT NONE |
---|
28 | PRIVATE |
---|
29 | |
---|
30 | PUBLIC sbc_flx ! routine called by step.F90 |
---|
31 | |
---|
32 | INTEGER , PARAMETER :: jpfld = 5 ! maximum number of files to read |
---|
33 | INTEGER , PARAMETER :: jp_utau = 1 ! index of wind stress (i-component) file |
---|
34 | INTEGER , PARAMETER :: jp_vtau = 2 ! index of wind stress (j-component) file |
---|
35 | INTEGER , PARAMETER :: jp_qtot = 3 ! index of total (non solar+solar) heat file |
---|
36 | INTEGER , PARAMETER :: jp_qsr = 4 ! index of solar heat file |
---|
37 | INTEGER , PARAMETER :: jp_emp = 5 ! index of evaporation-precipation file |
---|
38 | TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: sf ! structure of input fields (file informations, fields read) |
---|
39 | LOGICAL , PUBLIC :: ln_shelf_flx = .FALSE. ! UKMO SHELF specific flux flag |
---|
40 | LOGICAL , PUBLIC :: ln_rel_wind = .FALSE. ! UKMO SHELF specific flux flag - relative winds |
---|
41 | REAL(wp) :: rn_wfac ! multiplication factor for ice/ocean velocity in the calculation of wind stress (clem) |
---|
42 | INTEGER :: jpfld_local ! maximum number of files to read (locally modified depending on ln_shelf_flx) |
---|
43 | |
---|
44 | !! * Substitutions |
---|
45 | # include "domzgr_substitute.h90" |
---|
46 | # include "vectopt_loop_substitute.h90" |
---|
47 | !!---------------------------------------------------------------------- |
---|
48 | !! NEMO/OPA 3.3 , NEMO-consortium (2010) |
---|
49 | !! $Id$ |
---|
50 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
51 | !!---------------------------------------------------------------------- |
---|
52 | CONTAINS |
---|
53 | |
---|
54 | SUBROUTINE sbc_flx( kt ) |
---|
55 | !!--------------------------------------------------------------------- |
---|
56 | !! *** ROUTINE sbc_flx *** |
---|
57 | !! |
---|
58 | !! ** Purpose : provide at each time step the surface ocean fluxes |
---|
59 | !! (momentum, heat, freshwater and runoff) |
---|
60 | !! |
---|
61 | !! ** Method : - READ each fluxes in NetCDF files: |
---|
62 | !! i-component of the stress utau (N/m2) |
---|
63 | !! j-component of the stress vtau (N/m2) |
---|
64 | !! net downward heat flux qtot (watt/m2) |
---|
65 | !! net downward radiative flux qsr (watt/m2) |
---|
66 | !! net upward freshwater (evapo - precip) emp (kg/m2/s) |
---|
67 | !! |
---|
68 | !! CAUTION : - never mask the surface stress fields |
---|
69 | !! - the stress is assumed to be in the (i,j) mesh referential |
---|
70 | !! |
---|
71 | !! ** Action : update at each time-step |
---|
72 | !! - utau, vtau i- and j-component of the wind stress |
---|
73 | !! - taum wind stress module at T-point |
---|
74 | !! - wndm 10m wind module at T-point |
---|
75 | !! - qns non solar heat flux including heat flux due to emp |
---|
76 | !! - qsr solar heat flux |
---|
77 | !! - emp upward mass flux (evap. - precip.) |
---|
78 | !! - sfx salt flux; set to zero at nit000 but possibly non-zero |
---|
79 | !! if ice is present (computed in limsbc(_2).F90) |
---|
80 | !!---------------------------------------------------------------------- |
---|
81 | INTEGER, INTENT(in) :: kt ! ocean time step |
---|
82 | !! |
---|
83 | INTEGER :: ji, jj, jf ! dummy indices |
---|
84 | INTEGER :: ierror ! return error code |
---|
85 | INTEGER :: ios ! Local integer output status for namelist read |
---|
86 | REAL(wp) :: zfact ! temporary scalar |
---|
87 | REAL(wp) :: zrhoa = 1.22 ! Air density kg/m3 |
---|
88 | REAL(wp) :: zcdrag = 1.5e-3 ! drag coefficient |
---|
89 | REAL(wp) :: totwind ! UKMO SHELF: Module of wind speed |
---|
90 | REAL(wp) :: ztx, zty, zmod, zcoef ! temporary variables |
---|
91 | !! |
---|
92 | CHARACTER(len=100) :: cn_dir ! Root directory for location of flx files |
---|
93 | NAMELIST/namsbc_flx/ ln_shelf_flx, ln_rel_wind, rn_wfac ! Put here to allow merging with another UKMO branch |
---|
94 | TYPE(FLD_N), DIMENSION(jpfld) :: slf_i ! array of namelist information structures |
---|
95 | TYPE(FLD_N) :: sn_utau, sn_vtau, sn_qtot, sn_qsr, sn_emp ! informations about the fields to be read |
---|
96 | NAMELIST/namsbc_flx/ cn_dir, sn_utau, sn_vtau, sn_qtot, sn_qsr, sn_emp |
---|
97 | !!--------------------------------------------------------------------- |
---|
98 | ! |
---|
99 | IF( kt == nit000 ) THEN ! First call kt=nit000 |
---|
100 | ! set file information |
---|
101 | REWIND( numnam_ref ) ! Namelist namsbc_flx in reference namelist : Files for fluxes |
---|
102 | READ ( numnam_ref, namsbc_flx, IOSTAT = ios, ERR = 901) |
---|
103 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_flx in reference namelist', lwp ) |
---|
104 | |
---|
105 | REWIND( numnam_cfg ) ! Namelist namsbc_flx in configuration namelist : Files for fluxes |
---|
106 | READ ( numnam_cfg, namsbc_flx, IOSTAT = ios, ERR = 902 ) |
---|
107 | 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namsbc_flx in configuration namelist', lwp ) |
---|
108 | IF(lwm) WRITE ( numond, namsbc_flx ) |
---|
109 | ! |
---|
110 | IF(lwp) THEN ! Namelist print |
---|
111 | WRITE(numout,*) |
---|
112 | WRITE(numout,*) 'sbc_flx : Flux forcing' |
---|
113 | WRITE(numout,*) '~~~~~~~~~~~' |
---|
114 | WRITE(numout,*) ' Namelist namsbc_flx : shelf seas configuration (force with winds instead of momentum)' |
---|
115 | WRITE(numout,*) ' shelf seas configuration ln_shelf_flx = ', ln_shelf_flx |
---|
116 | WRITE(numout,*) ' relative wind speed ln_rel_wind = ', ln_rel_wind |
---|
117 | WRITE(numout,*) ' wind multiplication factor rn_wfac = ', rn_wfac |
---|
118 | ENDIF |
---|
119 | ! ! check: do we plan to use ln_dm2dc with non-daily forcing? |
---|
120 | IF( ln_dm2dc .AND. sn_qsr%nfreqh /= 24 ) & |
---|
121 | & CALL ctl_stop( 'sbc_blk_core: ln_dm2dc can be activated only with daily short-wave forcing' ) |
---|
122 | ! |
---|
123 | ! ! store namelist information in an array |
---|
124 | slf_i(jp_utau) = sn_utau ; slf_i(jp_vtau) = sn_vtau |
---|
125 | slf_i(jp_qtot) = sn_qtot ; slf_i(jp_qsr ) = sn_qsr |
---|
126 | slf_i(jp_emp ) = sn_emp |
---|
127 | ! |
---|
128 | ALLOCATE( sf(jpfld), STAT=ierror ) ! set sf structure |
---|
129 | IF( ierror > 0 ) THEN |
---|
130 | CALL ctl_stop( 'sbc_flx: unable to allocate sf structure' ) ; RETURN |
---|
131 | ENDIF |
---|
132 | DO ji= 1, jpfld |
---|
133 | ALLOCATE( sf(ji)%fnow(jpi,jpj,1) ) |
---|
134 | IF( slf_i(ji)%ln_tint ) ALLOCATE( sf(ji)%fdta(jpi,jpj,1,2) ) |
---|
135 | END DO |
---|
136 | ! ! fill sf with slf_i and control print |
---|
137 | CALL fld_fill( sf, slf_i, cn_dir, 'sbc_flx', 'flux formulation for ocean surface boundary condition', 'namsbc_flx' ) |
---|
138 | ! |
---|
139 | sfx(:,:) = 0.0_wp ! salt flux due to freezing/melting (non-zero only if ice is present; set in limsbc(_2).F90) |
---|
140 | ! |
---|
141 | ENDIF |
---|
142 | |
---|
143 | CALL fld_read( kt, nn_fsbc, sf ) ! input fields provided at the current time-step |
---|
144 | |
---|
145 | IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN ! update ocean fluxes at each SBC frequency |
---|
146 | |
---|
147 | !!UKMO SHELF wind speed relative to surface currents - put here to allow merging with coupling branch |
---|
148 | IF( ln_shelf_flx ) THEN |
---|
149 | CALL wrk_alloc( jpi,jpj, zwnd_i, zwnd_j ) |
---|
150 | |
---|
151 | IF( ln_rel_wind ) THEN |
---|
152 | DO jj = 2, jpjm1 |
---|
153 | DO ji = fs_2, fs_jpim1 ! vect. opt. |
---|
154 | zwnd_i(ji,jj) = ( sf(jp_utau)%fnow(ji,jj,1) - rn_wfac * 0.5 * ( ssu_m(ji-1,jj ) + ssu_m(ji,jj) )) |
---|
155 | zwnd_j(ji,jj) = ( sf(jp_vtau)%fnow(ji,jj,1) - rn_wfac * 0.5 * ( ssv_m(ji ,jj-1) + ssv_m(ji,jj) )) |
---|
156 | END DO |
---|
157 | END DO |
---|
158 | CALL lbc_lnk( zwnd_i(:,:) , 'T', -1. ) |
---|
159 | CALL lbc_lnk( zwnd_j(:,:) , 'T', -1. ) |
---|
160 | ELSE |
---|
161 | zwnd_i(:,:) = sf(jp_utau)%fnow(:,:,1) |
---|
162 | zwnd_j(:,:) = sf(jp_vtau)%fnow(:,:,1) |
---|
163 | ENDIF |
---|
164 | ENDIF |
---|
165 | |
---|
166 | IF( ln_dm2dc ) THEN ; qsr(:,:) = sbc_dcy( sf(jp_qsr)%fnow(:,:,1) ) ! modify now Qsr to include the diurnal cycle |
---|
167 | ELSE ; qsr(:,:) = sf(jp_qsr)%fnow(:,:,1) |
---|
168 | ENDIF |
---|
169 | !CDIR COLLAPSE |
---|
170 | DO jj = 1, jpj ! set the ocean fluxes from read fields |
---|
171 | DO ji = 1, jpi |
---|
172 | utau(ji,jj) = sf(jp_utau)%fnow(ji,jj,1) |
---|
173 | vtau(ji,jj) = sf(jp_vtau)%fnow(ji,jj,1) |
---|
174 | qns (ji,jj) = sf(jp_qtot)%fnow(ji,jj,1) - sf(jp_qsr)%fnow(ji,jj,1) |
---|
175 | emp (ji,jj) = sf(jp_emp )%fnow(ji,jj,1) |
---|
176 | END DO |
---|
177 | END DO |
---|
178 | ! ! add modification due to drag coefficient read from wave forcing |
---|
179 | ! ! this code is inefficient but put here to allow merging with another UKMO branch |
---|
180 | IF( ln_shelf_flx ) THEN |
---|
181 | IF( ln_cdgw .AND. nn_drag == jp_std ) THEN |
---|
182 | IF( cpl_wdrag ) THEN |
---|
183 | ! reset utau and vtau to the wind components: the momentum will |
---|
184 | ! be calculated from the coupled value of the drag coefficient |
---|
185 | DO jj = 1, jpj |
---|
186 | DO ji = 1, jpi |
---|
187 | utau(ji,jj) = zwnd_i(ji,jj) |
---|
188 | vtau(ji,jj) = zwnd_j(ji,jj) |
---|
189 | END DO |
---|
190 | END DO |
---|
191 | ELSE |
---|
192 | DO jj = 1, jpj |
---|
193 | DO ji = 1, jpi |
---|
194 | totwind = sqrt(zwnd_i(ji,jj)*zwnd_i(ji,jj) + zwnd_j(ji,jj)*zwnd_j(ji,jj)) |
---|
195 | utau(ji,jj) = zrhoa * cdn_wave(ji,jj) * zwnd_i(ji,jj) * totwind |
---|
196 | vtau(ji,jj) = zrhoa * cdn_wave(ji,jj) * zwnd_j(ji,jj) * totwind |
---|
197 | END DO |
---|
198 | END DO |
---|
199 | ENDIF |
---|
200 | ELSE IF( nn_drag == jp_const ) THEN |
---|
201 | DO jj = 1, jpj |
---|
202 | DO ji = 1, jpi |
---|
203 | totwind = sqrt(zwnd_i(ji,jj)*zwnd_i(ji,jj) + zwnd_j(ji,jj)*zwnd_j(ji,jj)) |
---|
204 | utau(ji,jj) = zrhoa * zcdrag * zwnd_i(ji,jj) * totwind |
---|
205 | vtau(ji,jj) = zrhoa * zcdrag * zwnd_j(ji,jj) * totwind |
---|
206 | END DO |
---|
207 | END DO |
---|
208 | ENDIF |
---|
209 | ENDIF |
---|
210 | ! ! add to qns the heat due to e-p |
---|
211 | qns(:,:) = qns(:,:) - emp(:,:) * sst_m(:,:) * rcp ! mass flux is at SST |
---|
212 | ! |
---|
213 | ! ! module of wind stress and wind speed at T-point |
---|
214 | zcoef = 1. / ( zrhoa * zcdrag ) |
---|
215 | !CDIR NOVERRCHK |
---|
216 | DO jj = 2, jpjm1 |
---|
217 | !CDIR NOVERRCHK |
---|
218 | DO ji = fs_2, fs_jpim1 ! vect. opt. |
---|
219 | ztx = utau(ji-1,jj ) + utau(ji,jj) |
---|
220 | zty = vtau(ji ,jj-1) + vtau(ji,jj) |
---|
221 | zmod = 0.5 * SQRT( ztx * ztx + zty * zty ) |
---|
222 | taum(ji,jj) = zmod |
---|
223 | IF( ln_shelf_flx ) THEN |
---|
224 | ! winds as received, not relative to the current |
---|
225 | ztx = sf(jp_utau)%fnow(ji-1,jj ) + sf(jp_utau)%fnow(ji,jj) |
---|
226 | zty = sf(jp_vtau)%fnow(ji ,jj-1) + sf(jp_vtau)%fnow(ji,jj) |
---|
227 | wndm(ji,jj) = 0.5 * SQRT( ztx * ztx + zty * zty ) |
---|
228 | ELSE |
---|
229 | wndm(ji,jj) = SQRT( zmod * zcoef ) |
---|
230 | ENDIF |
---|
231 | END DO |
---|
232 | END DO |
---|
233 | taum(:,:) = taum(:,:) * tmask(:,:,1) ; wndm(:,:) = wndm(:,:) * tmask(:,:,1) |
---|
234 | CALL lbc_lnk( taum(:,:), 'T', 1. ) ; CALL lbc_lnk( wndm(:,:), 'T', 1. ) |
---|
235 | |
---|
236 | IF( nitend-nit000 <= 100 .AND. lwp ) THEN ! control print (if less than 100 time-step asked) |
---|
237 | WRITE(numout,*) |
---|
238 | WRITE(numout,*) ' read daily momentum, heat and freshwater fluxes OK' |
---|
239 | DO jf = 1, jpfld |
---|
240 | IF( jf == jp_utau .OR. jf == jp_vtau ) zfact = 1. |
---|
241 | IF( jf == jp_qtot .OR. jf == jp_qsr ) zfact = 0.1 |
---|
242 | IF( jf == jp_emp ) zfact = 86400. |
---|
243 | WRITE(numout,*) |
---|
244 | WRITE(numout,*) ' day: ', ndastp , TRIM(sf(jf)%clvar), ' * ', zfact |
---|
245 | CALL prihre( sf(jf)%fnow, jpi, jpj, 1, jpi, 20, 1, jpj, 10, zfact, numout ) |
---|
246 | END DO |
---|
247 | CALL FLUSH(numout) |
---|
248 | ENDIF |
---|
249 | ! |
---|
250 | IF( ln_shelf_flx ) THEN |
---|
251 | CALL wrk_dealloc( jpi,jpj, zwnd_i, zwnd_j ) |
---|
252 | ENDIF |
---|
253 | ! |
---|
254 | ENDIF |
---|
255 | ! |
---|
256 | END SUBROUTINE sbc_flx |
---|
257 | |
---|
258 | !!====================================================================== |
---|
259 | END MODULE sbcflx |
---|