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

Last change on this file since 5218 was 5144, checked in by abarral, 5 months ago

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