source: LMDZ6/branches/Amaury_dev/libf/phylmd/surf_ocean_mod.F90 @ 5136

Last change on this file since 5136 was 5123, checked in by abarral, 4 months ago

Correct various minor mistakes from previous commits

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