source: LMDZ6/branches/contrails/libf/phylmd/surf_ocean_mod.F90 @ 5449

Last change on this file since 5449 was 5285, checked in by abarral, 8 weeks ago

As discussed internally, remove generic ONLY: ... for new _mod_h modules

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