source: LMDZ6/trunk/libf/phylmdiso/surf_ocean_mod.F90 @ 4026

Last change on this file since 4026 was 3940, checked in by crisi, 3 years ago

replace files by symbloic liks from phylmdiso towards phylmd.
Many files at once

File size: 15.9 KB
Line 
1!
2! $Id: surf_ocean_mod.F90 3395 2018-09-25 15:22:13Z lguez $
3!
4MODULE surf_ocean_mod
5
6  IMPLICIT NONE
7
8CONTAINS
9  !
10  !******************************************************************************
11  !
12  SUBROUTINE surf_ocean(rlon, rlat, swnet, lwnet, alb1, &
13       windsp, rmu0, fder, tsurf_in, &
14       itime, dtime, jour, knon, knindex, &
15       p1lay, z1lay, cdragh, cdragm, precip_rain, precip_snow, temp_air, spechum, &
16       AcoefH, AcoefQ, BcoefH, BcoefQ, &
17       AcoefU, AcoefV, BcoefU, BcoefV, &
18       ps, u1, v1, gustiness, rugoro, pctsrf, &
19       snow, qsurf, agesno, &
20       z0m, z0h, SFRWL, alb_dir_new, alb_dif_new, evap, fluxsens, fluxlat, &
21       tsurf_new, dflux_s, dflux_l, lmt_bils, &
22       flux_u1, flux_v1, delta_sst, delta_sal, ds_ns, dt_ns, dter, dser, tkt, tks, &
23       taur, sss &
24#ifdef ISO
25        &       ,xtprecip_rain, xtprecip_snow,xtspechum,Roce, &
26        &       xtsnow,xtevap,h1 &
27#endif               
28        &       )
29
30    use albedo, only: alboc, alboc_cd
31    use bulk_flux_m, only: bulk_flux
32    USE dimphy, ONLY: klon, zmasq
33    USE surface_data, ONLY     : type_ocean
34    USE ocean_forced_mod, ONLY : ocean_forced_noice
35    USE ocean_slab_mod, ONLY   : ocean_slab_noice
36    USE ocean_cpl_mod, ONLY    : ocean_cpl_noice
37    USE indice_sol_mod, ONLY : nbsrf, is_oce
38#ifdef ISO
39  USE infotrac_phy, ONLY : ntraciso,niso
40#ifdef ISOVERIF
41    USE isotopes_mod, ONLY: iso_eau,ridicule
42    USE isotopes_verif_mod
43#endif
44#endif
45    USE limit_read_mod
46    use config_ocean_skin_m, only: activate_ocean_skin
47    !
48    ! This subroutine will make a call to ocean_XXX_noice according to the ocean mode (force,
49    ! slab or couple). The calculations of albedo and rugosity for the ocean surface are
50    ! done in here because they are identical for the different modes of ocean.
51
52
53    INCLUDE "YOMCST.h"
54
55    include "clesphys.h"
56    ! for cycle_diurne and for iflag_z0_oce==-1 (prescribed z0)
57
58    ! Input variables
59    !******************************************************************************
60    INTEGER, INTENT(IN)                      :: itime, jour, knon
61    INTEGER, DIMENSION(klon), INTENT(IN)     :: knindex
62    REAL, INTENT(IN)                         :: dtime
63    REAL, DIMENSION(klon), INTENT(IN)        :: rlon, rlat
64    REAL, DIMENSION(klon), INTENT(IN)        :: swnet  ! net shortwave radiation at surface 
65    REAL, DIMENSION(klon), INTENT(IN)        :: lwnet  ! net longwave radiation at surface 
66    REAL, DIMENSION(klon), INTENT(IN)        :: alb1   ! albedo in visible SW interval
67    REAL, DIMENSION(klon), INTENT(IN)        :: windsp ! wind at 10 m, in m s-1
68    REAL, DIMENSION(klon), INTENT(IN)        :: rmu0 
69    REAL, DIMENSION(klon), INTENT(IN)        :: fder
70    REAL, DIMENSION(klon), INTENT(IN)        :: tsurf_in     ! defined only for subscripts 1:knon
71    REAL, DIMENSION(klon), INTENT(IN)        :: p1lay,z1lay ! pression (Pa) et altitude (m) du premier niveau
72    REAL, DIMENSION(klon), INTENT(IN)        :: cdragh
73    REAL, DIMENSION(klon), INTENT(IN)        :: cdragm
74    REAL, DIMENSION(klon), INTENT(IN)        :: precip_rain, precip_snow
75    REAL, DIMENSION(klon), INTENT(IN)        :: temp_air, spechum
76    REAL, DIMENSION(klon), INTENT(IN)        :: AcoefH, AcoefQ, BcoefH, BcoefQ
77    REAL, DIMENSION(klon), INTENT(IN)        :: AcoefU, AcoefV, BcoefU, BcoefV
78    REAL, DIMENSION(klon), INTENT(IN)        :: ps
79    REAL, DIMENSION(klon), INTENT(IN)        :: u1, v1, gustiness
80    REAL, DIMENSION(klon), INTENT(IN)        :: rugoro
81    REAL, DIMENSION(klon,nbsrf), INTENT(IN)  :: pctsrf
82#ifdef ISO
83    REAL, DIMENSION(ntraciso,klon), INTENT(IN)        :: xtprecip_rain, xtprecip_snow
84    REAL, DIMENSION(ntraciso,klon), INTENT(IN)        :: xtspechum
85#endif
86
87    ! In/Output variables
88    !******************************************************************************
89    REAL, DIMENSION(klon), INTENT(INOUT)     :: snow
90    REAL, DIMENSION(klon), INTENT(INOUT)     :: qsurf
91    REAL, DIMENSION(klon), INTENT(INOUT)     :: agesno
92    REAL, DIMENSION(klon), INTENT(inOUT)     :: z0h
93#ifdef ISO
94    REAL, DIMENSION(niso,klon), INTENT(IN)        :: xtsnow
95    REAL, DIMENSION(niso,klon), INTENT(INOUT)        :: Roce 
96#endif
97
98    REAL, intent(inout):: delta_sst(:) ! (knon)
99    ! Ocean-air interface temperature minus bulk SST, in K. Defined
100    ! only if activate_ocean_skin >= 1.
101
102    real, intent(inout):: delta_sal(:) ! (knon)
103    ! Ocean-air interface salinity minus bulk salinity, in ppt. Defined
104    ! only if activate_ocean_skin >= 1.
105
106    REAL, intent(inout):: ds_ns(:) ! (knon)
107    ! "delta salinity near surface". Salinity variation in the
108    ! near-surface turbulent layer. That is subskin salinity minus
109    ! foundation salinity. In ppt.
110
111    REAL, intent(inout):: dt_ns(:) ! (knon)
112    ! "delta temperature near surface". Temperature variation in the
113    ! near-surface turbulent layer. That is subskin temperature
114    ! minus foundation temperature. (Can be negative.) In K.
115
116    ! Output variables
117    !**************************************************************************
118    REAL, DIMENSION(klon), INTENT(OUT)       :: z0m
119    !albedo SB >>>
120    !    REAL, DIMENSION(klon), INTENT(OUT)  :: alb1_new  ! new albedo in visible SW interval
121    !    REAL, DIMENSION(klon), INTENT(OUT)  :: alb2_new  ! new albedo in near IR interval
122    REAL, DIMENSION(6), INTENT(IN)           :: SFRWL
123    REAL, DIMENSION(klon,nsw), INTENT(OUT)   :: alb_dir_new,alb_dif_new
124    !albedo SB <<<     
125    REAL, DIMENSION(klon), INTENT(OUT)       :: evap, fluxsens, fluxlat
126    REAL, DIMENSION(klon), INTENT(OUT)       :: tsurf_new    ! sea surface temperature, in K
127    REAL, DIMENSION(klon), INTENT(OUT)       :: dflux_s, dflux_l     
128    REAL, DIMENSION(klon), INTENT(OUT)       :: lmt_bils
129    REAL, DIMENSION(klon), INTENT(OUT)       :: flux_u1, flux_v1
130
131    REAL, intent(out):: dter(:) ! (knon)
132    ! Temperature variation in the diffusive microlayer, that is
133    ! ocean-air interface temperature minus subskin temperature. In
134    ! K.
135
136    REAL, intent(out):: dser(:) ! (knon)
137    ! Salinity variation in the diffusive microlayer, that is
138    ! ocean-air interface salinity minus subskin salinity. In ppt.
139
140    REAL, intent(out):: tkt(:) ! (knon)
141    ! épaisseur (m) de la couche de diffusion thermique (microlayer)
142    ! cool skin thickness
143
144    REAL, intent(out):: tks(:) ! (knon)
145    ! épaisseur (m) de la couche de diffusion de masse (microlayer)
146
147    REAL, intent(out):: taur(:) ! (knon)
148    ! momentum flux due to rain, in Pa
149
150    real, intent(out):: sss(:) ! (klon)
151    ! Bulk salinity of the surface layer of the ocean, in ppt. (Only
152    ! defined for subscripts 1:knon, but we have to declare it with
153    ! size klon because of the coupling machinery.)
154#ifdef ISO
155    REAL, DIMENSION(ntraciso,klon), INTENT(out)        :: xtevap ! isotopes in surface evaporation flux
156    REAL, DIMENSION(klon), INTENT(out)        :: h1 ! just a diagnostic, not useful for the simulation   
157#endif
158
159    ! Local variables
160    !*************************************************************************
161    INTEGER               :: i, k
162    REAL                  :: tmp
163    REAL, PARAMETER       :: cepdu2=(0.1)**2
164    REAL, DIMENSION(klon) :: alb_eau, z0_lim
165    REAL, DIMENSION(klon) :: radsol
166    REAL, DIMENSION(klon) :: cdragq ! Cdrag pour l'evaporation
167    CHARACTER(len=20),PARAMETER :: modname="surf_ocean"
168    real rhoa(knon) ! density of moist air  (kg / m3)
169    REAL sens_prec_liq(knon)
170
171    REAL t_int(knon) ! ocean-air interface temperature, in K
172    real s_int(knon) ! ocean-air interface salinity, in ppt
173
174    !******************************************************************************
175
176#ifdef ISO
177#ifdef ISOVERIF
178        do i=1,knon
179          if (iso_eau.gt.0) then         
180                 call iso_verif_egalite_choix(xtspechum(iso_eau,i), &
181     &                  spechum(i),'surf_ocean_mod 117', &
182     &                  errmax,errmaxrel)         
183                 call iso_verif_egalite_choix(xtsnow(iso_eau,i), &
184     &                  snow(i),'surf_ocean_mod 127', &
185     &                  errmax,errmaxrel)
186           endif !if (iso_eau.gt.0) then
187        enddo !do i=1,klon
188#endif     
189#endif
190
191    !******************************************************************************
192    ! Calculate total net radiance at surface
193    !
194    !******************************************************************************
195    radsol(1:klon) = 0.0 ! initialisation a priori inutile
196    radsol(1:knon) = swnet(1:knon) + lwnet(1:knon)
197
198    !******************************************************************************
199    ! Cdragq computed from cdrag
200    ! The difference comes only from a factor (f_z0qh_oce) on z0, so that
201    ! it can be computed inside surf_ocean
202    ! More complicated appraches may require the propagation through
203    ! pbl_surface of an independant cdragq variable.
204    !******************************************************************************
205
206    IF ( f_z0qh_oce .ne. 1.) THEN
207       ! Si on suit les formulations par exemple de Tessel, on
208       ! a z0h=0.4*nu/u*, z0q=0.62*nu/u*, d'ou f_z0qh_oce=0.62/0.4=1.55
209       cdragq(1:knon)=cdragh(1:knon)*                                      &
210            log(z1lay(1:knon)/z0h(1:knon))/log(z1lay(1:knon)/(f_z0qh_oce*z0h(1:knon)))
211    ELSE
212       cdragq(1:knon)=cdragh(1:knon)
213    ENDIF
214
215
216    rhoa = PS(:KNON) / (Rd * temp_air(:knon) * (1. + retv * spechum(:knon)))
217
218    !******************************************************************************
219    ! Switch according to type of ocean (couple, slab or forced)
220    !******************************************************************************
221    SELECT CASE(type_ocean)
222    CASE('couple')
223       CALL ocean_cpl_noice( &
224            swnet, lwnet, alb1, &
225            windsp, fder, &
226            itime, dtime, knon, knindex, &
227            p1lay, cdragh, cdragq, cdragm, precip_rain, precip_snow,temp_air,spechum,&
228            AcoefH, AcoefQ, BcoefH, BcoefQ, &
229            AcoefU, AcoefV, BcoefU, BcoefV, &
230            ps, u1, v1, gustiness, tsurf_in, &
231            radsol, snow, agesno, &
232            qsurf, evap, fluxsens, fluxlat, flux_u1, flux_v1, &
233            tsurf_new, dflux_s, dflux_l, sens_prec_liq, sss, delta_sal, rhoa, &
234            delta_sst)
235
236    CASE('slab')
237       CALL ocean_slab_noice( &
238            itime, dtime, jour, knon, knindex, &
239            p1lay, cdragh, cdragq, cdragm, precip_rain, precip_snow, temp_air, spechum,&
240            AcoefH, AcoefQ, BcoefH, BcoefQ, &
241            AcoefU, AcoefV, BcoefU, BcoefV, &
242            ps, u1, v1, gustiness, tsurf_in, &
243            radsol, snow, &
244            qsurf, evap, fluxsens, fluxlat, flux_u1, flux_v1, &
245            tsurf_new, dflux_s, dflux_l, lmt_bils)
246
247    CASE('force')
248       CALL ocean_forced_noice( &
249            itime, dtime, jour, knon, knindex, &
250            p1lay, cdragh, cdragq, cdragm, precip_rain, precip_snow, &
251            temp_air, spechum, &
252            AcoefH, AcoefQ, BcoefH, BcoefQ, &
253            AcoefU, AcoefV, BcoefU, BcoefV, &
254            ps, u1, v1, gustiness, tsurf_in, &
255            radsol, snow, agesno, &
256            qsurf, evap, fluxsens, fluxlat, flux_u1, flux_v1, &
257            tsurf_new, dflux_s, dflux_l, sens_prec_liq, rhoa &
258#ifdef ISO
259            ,xtprecip_rain, xtprecip_snow, xtspechum,Roce,rlat, &
260            xtsnow,xtevap,h1 & 
261#endif           
262            )
263    END SELECT
264
265    !******************************************************************************
266    ! fcodron: compute lmt_bils  forced case (same as wfbils_oce / 1.-contfracatm)
267    !******************************************************************************
268    IF (type_ocean.NE.'slab') THEN
269       lmt_bils(1:klon)=0.
270       DO i=1,knon
271          lmt_bils(knindex(i))=(swnet(i)+lwnet(i)+fluxsens(i)+fluxlat(i)) &
272               *pctsrf(knindex(i),is_oce)/(1.-zmasq(knindex(i)))
273       END DO
274    END IF
275
276    !******************************************************************************
277    ! Calculate ocean surface albedo
278    !******************************************************************************
279    !albedo SB >>>
280    IF (iflag_albedo==0) THEN
281       !--old parametrizations of ocean surface albedo
282       !
283       IF (iflag_cycle_diurne.GE.1) THEN
284          !
285          CALL alboc_cd(rmu0,alb_eau)
286          !
287          !--ad-hoc correction for model radiative balance tuning
288          !--now outside alboc_cd routine
289          alb_eau(1:klon) = fmagic*alb_eau(1:klon) + pmagic
290          alb_eau(1:klon)=MIN(MAX(alb_eau(1:klon),0.0),1.0)
291          !
292       ELSE
293          !
294          CALL alboc(REAL(jour),rlat,alb_eau)
295          !--ad-hoc correction for model radiative balance tuning
296          !--now outside alboc routine
297          alb_eau(1:klon) = fmagic*alb_eau(1:klon) + pmagic
298          alb_eau(1:klon)=MIN(MAX(alb_eau(1:klon),0.04),0.60)
299          !
300       ENDIF
301       !
302       DO i =1, knon
303          DO  k=1,nsw
304             alb_dir_new(i,k) = alb_eau(knindex(i))
305          ENDDO
306       ENDDO
307       !IM 09122015 next line corresponds to the old way of doing in LMDZ5A/IPSLCM5A versions
308       !albedo for diffuse radiation is taken the same as for direct radiation
309       alb_dif_new(1:knon,:)=alb_dir_new(1:knon,:)
310       !IM 09122015 end
311       !
312    ELSE IF (iflag_albedo==1) THEN
313       !--new parametrization of ocean surface albedo by Sunghye Baek
314       !--albedo for direct and diffuse radiation are different
315       !
316       CALL ocean_albedo(knon,rmu0,knindex,windsp,SFRWL,alb_dir_new,alb_dif_new)
317       !
318       !--ad-hoc correction for model radiative balance tuning
319       alb_dir_new(1:knon,:) = fmagic*alb_dir_new(1:knon,:) + pmagic
320       alb_dif_new(1:knon,:) = fmagic*alb_dif_new(1:knon,:) + pmagic
321       alb_dir_new(1:knon,:)=MIN(MAX(alb_dir_new(1:knon,:),0.0),1.0)
322       alb_dif_new(1:knon,:)=MIN(MAX(alb_dif_new(1:knon,:),0.0),1.0)
323       !
324    ELSE IF (iflag_albedo==2) THEN
325       ! F. Codron albedo read from limit.nc
326       CALL limit_read_rug_alb(itime, dtime, jour,&
327            knon, knindex, z0_lim, alb_eau)
328       DO i =1, knon
329          DO  k=1,nsw
330             alb_dir_new(i,k) = alb_eau(i)
331          ENDDO
332       ENDDO
333       alb_dif_new=alb_dir_new
334    ENDIF
335    !albedo SB <<<
336
337    !******************************************************************************
338    ! Calculate the rugosity
339    !******************************************************************************
340    IF (iflag_z0_oce==0) THEN
341       DO i = 1, knon
342          tmp = MAX(cepdu2,gustiness(i)+u1(i)**2+v1(i)**2)
343          z0m(i) = 0.018*cdragm(i) * (gustiness(i)+u1(i)**2+v1(i)**2)/RG  &
344               +  0.11*14e-6 / SQRT(cdragm(i) * tmp)
345          z0m(i) = MAX(1.5e-05,z0m(i))
346       ENDDO
347       z0h(1:knon)=z0m(1:knon) ! En attendant mieux
348
349    ELSE IF (iflag_z0_oce==1) THEN
350       DO i = 1, knon
351          tmp = MAX(cepdu2,gustiness(i)+u1(i)**2+v1(i)**2)
352          z0m(i) = 0.018*cdragm(i) * (gustiness(i)+u1(i)**2+v1(i)**2)/RG  &
353               + 0.11*14e-6 / SQRT(cdragm(i) * tmp)
354          z0m(i) = MAX(1.5e-05,z0m(i))
355          z0h(i)=0.4*14e-6 / SQRT(cdragm(i) * tmp)
356       ENDDO
357    ELSE IF (iflag_z0_oce==-1) THEN
358       DO i = 1, knon
359          z0m(i) = z0min
360          z0h(i) = z0min
361       ENDDO
362    ELSE
363       CALL abort_physic(modname,'version non prevue',1)
364    ENDIF
365
366    if (activate_ocean_skin >= 1) then
367       if (type_ocean /= 'couple') sss(:knon) = 35.
368       call bulk_flux(tkt, tks, taur, dter, dser, t_int, s_int, ds_ns, dt_ns, &
369            u = windsp(:knon), t_ocean_1 = tsurf_new(:knon), s1 = sss(:knon), &
370            rain = precip_rain(:knon) + precip_snow(:knon), &
371            hf = - fluxsens(:knon), hlb = - fluxlat(:knon), &
372            rnl = - lwnet(:knon), &
373            tau = sqrt(flux_u1(:knon)**2 + flux_v1(:knon)**2), rhoa = rhoa, &
374            xlv = [(rlvtt, i = 1, knon)], rf = - sens_prec_liq, dtime = dtime, &
375            rns = swnet(:knon))
376       delta_sst = t_int - tsurf_new(:knon)
377       delta_sal = s_int - sss(:knon)
378       if (activate_ocean_skin >= 2) tsurf_new(:knon) = t_int
379    end if
380
381  END SUBROUTINE surf_ocean
382  !****************************************************************************
383  !
384END MODULE surf_ocean_mod
Note: See TracBrowser for help on using the repository browser.