/[lmdze]/trunk/phylmd/Interface_surf/interfsurf_hq.f
ViewVC logotype

Diff of /trunk/phylmd/Interface_surf/interfsurf_hq.f

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/Sources/phylmd/Interface_surf/interfsurf_hq.f revision 217 by guez, Thu Mar 30 14:25:18 2017 UTC trunk/phylmd/Interface_surf/interfsurf_hq.f revision 305 by guez, Tue Sep 11 11:08:38 2018 UTC
# Line 4  module interfsurf_hq_m Line 4  module interfsurf_hq_m
4    
5  contains  contains
6    
7    SUBROUTINE interfsurf_hq(dtime, jour, rmu0, nisurf, knon, knindex, debut, &    SUBROUTINE interfsurf_hq(julien, mu0, nisurf, knindex, tsoil, qsol, u1_lay, &
8         tsoil, qsol, u1_lay, v1_lay, temp_air, spechum, tq_cdrag, petAcoef, &         v1_lay, temp_air, spechum, tq_cdrag, tAcoef, qAcoef, tBcoef, qBcoef, &
9         peqAcoef, petBcoef, peqBcoef, precip_rain, precip_snow, fder, rugos, &         rain_fall, snow_fall, rugos, rugoro, snow, qsurf, ts, p1lay, ps, &
10         rugoro, snow, qsurf, tsurf, p1lay, ps, radsol, evap, flux_t, fluxlat, &         radsol, evap, flux_t, fluxlat, dflux_l, dflux_s, tsurf_new, albedo, &
11         dflux_l, dflux_s, tsurf_new, albedo, z0_new, pctsrf_new_sic, agesno, &         z0_new, pctsrf_new_sic, agesno, fqcalving, ffonte, run_off_lic_0, &
12         fqcalving, ffonte, run_off_lic_0)         run_off_lic)
13    
14      ! Cette routine sert d'aiguillage entre l'atmosph\`ere et la surface      ! Cette routine sert d'aiguillage entre l'atmosph\`ere et la surface
15      ! en g\'en\'eral (sols continentaux, oc\'eans, glaces) pour les flux de      ! en g\'en\'eral (sols continentaux, oc\'eans, glaces) pour les flux de
# Line 20  contains Line 20  contains
20      USE abort_gcm_m, ONLY: abort_gcm      USE abort_gcm_m, ONLY: abort_gcm
21      use alboc_cd_m, only: alboc_cd      use alboc_cd_m, only: alboc_cd
22      USE albsno_m, ONLY: albsno      USE albsno_m, ONLY: albsno
     use calbeta_m, only: calbeta  
23      USE calcul_fluxs_m, ONLY: calcul_fluxs      USE calcul_fluxs_m, ONLY: calcul_fluxs
     use clesphys2, only: soil_model  
     USE dimphy, ONLY: klon  
24      USE fonte_neige_m, ONLY: fonte_neige      USE fonte_neige_m, ONLY: fonte_neige
25      USE indicesol, ONLY: epsfra, is_lic, is_oce, is_sic, is_ter      USE indicesol, ONLY: epsfra, is_lic, is_oce, is_sic, is_ter
     USE interface_surf, ONLY: conf_interface  
26      USE interfsur_lim_m, ONLY: interfsur_lim      USE interfsur_lim_m, ONLY: interfsur_lim
27      use read_sst_m, only: read_sst      use limit_read_sst_m, only: limit_read_sst
28      use soil_m, only: soil      use soil_m, only: soil
29      USE suphec_m, ONLY: rcpd, rtt      USE suphec_m, ONLY: rcpd, rtt
30    
31      real, intent(IN):: dtime ! pas de temps de la physique (en s)      integer, intent(IN):: julien ! jour dans l'annee en cours
32      integer, intent(IN):: jour ! jour dans l'annee en cours      real, intent(IN):: mu0(:) ! (knon) cosinus de l'angle solaire zenithal
     real, intent(IN):: rmu0(klon) ! cosinus de l'angle solaire zenithal  
33      integer, intent(IN):: nisurf ! index de la surface a traiter      integer, intent(IN):: nisurf ! index de la surface a traiter
     integer, intent(IN):: knon ! nombre de points de la surface a traiter  
34    
35      integer, intent(in):: knindex(:) ! (knon)      integer, intent(in):: knindex(:) ! (knon)
36      ! index des points de la surface a traiter      ! index des points de la surface a traiter
37    
     logical, intent(IN):: debut ! 1er appel a la physique  
     ! (si false calcul simplifie des fluxs sur les continents)  
   
38      REAL, intent(inout):: tsoil(:, :) ! (knon, nsoilmx)      REAL, intent(inout):: tsoil(:, :) ! (knon, nsoilmx)
39    
40      REAL, intent(INOUT):: qsol(klon)      REAL, intent(INOUT):: qsol(:) ! (knon)
41      ! column-density of water in soil, in kg m-2      ! column-density of water in soil, in kg m-2
42    
43      real, dimension(klon), intent(IN):: u1_lay, v1_lay      real, intent(IN):: u1_lay(:), v1_lay(:) ! (knon) vitesse 1ere couche
44      ! u1_lay vitesse u 1ere couche  
45      ! v1_lay vitesse v 1ere couche      real, intent(IN):: temp_air(:) ! (knon) temperature de l'air 1ere couche
46      real, dimension(klon), intent(IN):: temp_air, spechum      real, intent(IN):: spechum(:) ! (knon) humidite specifique 1ere couche
47      ! temp_air temperature de l'air 1ere couche      real, intent(IN):: tq_cdrag(:) ! (knon) coefficient d'echange
     ! spechum humidite specifique 1ere couche  
     real, dimension(klon), intent(INOUT):: tq_cdrag ! coefficient d'echange  
48    
49      real, dimension(klon), intent(IN):: petAcoef, peqAcoef      real, intent(IN):: tAcoef(:), qAcoef(:) ! (knon)
50      ! coefficients A de la r\'esolution de la couche limite pour t et q      ! coefficients A de la r\'esolution de la couche limite pour t et q
51    
52      real, dimension(klon), intent(IN):: petBcoef, peqBcoef      real, intent(IN):: tBcoef(:), qBcoef(:) ! (knon)
53      ! coefficients B de la r\'esolution de la couche limite pour t et q      ! coefficients B de la r\'esolution de la couche limite pour t et q
54    
55      real, intent(IN):: precip_rain(klon)      real, intent(IN):: rain_fall(:) ! (knon)
56      ! precipitation, liquid water mass flux (kg / m2 / s), positive down      ! precipitation, liquid water mass flux (kg / m2 / s), positive down
57    
58      real, intent(IN):: precip_snow(klon)      real, intent(IN):: snow_fall(:) ! (knon)
59      ! precipitation, solid water mass flux (kg / m2 / s), positive down      ! precipitation, solid water mass flux (kg / m2 / s), positive down
60    
61      REAL, INTENT(INOUT):: fder(klon) ! derivee des flux (pour le couplage)      real, intent(IN):: rugos(:) ! (knon) rugosite
62      real, intent(IN):: rugos(klon) ! rugosite      real, intent(IN):: rugoro(:) ! (knon) rugosite orographique
     real, intent(IN):: rugoro(klon) ! rugosite orographique  
63      real, intent(INOUT):: snow(:) ! (knon)      real, intent(INOUT):: snow(:) ! (knon)
64      real, intent(INOUT):: qsurf(klon)      real, intent(OUT):: qsurf(:) ! (knon)
65      real, intent(IN):: tsurf(:) ! (knon) temp\'erature de surface      real, intent(IN):: ts(:) ! (knon) temp\'erature de surface
66      real, intent(IN):: p1lay(klon) ! pression 1er niveau (milieu de couche)      real, intent(IN):: p1lay(:) ! (knon) pression 1er niveau (milieu de couche)
67      real, dimension(klon), intent(IN):: ps ! pression au sol      real, intent(IN):: ps(:) ! (knon) pression au sol
68        REAL, INTENT(IN):: radsol(:) ! (knon) rayonnement net au sol (LW + SW)
     REAL, DIMENSION(klon), INTENT(INOUT):: radsol  
     ! rayonnement net au sol (LW + SW)  
   
69      real, intent(OUT):: evap(:) ! (knon) evaporation totale      real, intent(OUT):: evap(:) ! (knon) evaporation totale
70    
71      real, intent(OUT):: flux_t(:) ! (knon) flux de chaleur sensible      real, intent(OUT):: flux_t(:) ! (knon) flux de chaleur sensible
72      ! (Cp T) à la surface, positif vers le bas, W / m2      ! (Cp T) à la surface, positif vers le bas, W / m2
73        
74      real, intent(OUT):: fluxlat(:) ! (knon) flux de chaleur latente      real, intent(OUT):: fluxlat(:) ! (knon) flux de chaleur latente
75      real, dimension(klon), intent(OUT):: dflux_l, dflux_s      real, intent(OUT):: dflux_l(:), dflux_s(:) ! (knon)
76      real, intent(OUT):: tsurf_new(:) ! (knon) temp\'erature au sol      real, intent(OUT):: tsurf_new(:) ! (knon) temp\'erature au sol
77      real, intent(OUT):: albedo(:) ! (knon) albedo      real, intent(OUT):: albedo(:) ! (knon) albedo
78      real, intent(OUT):: z0_new(klon) ! surface roughness      real, intent(OUT):: z0_new(:) ! (knon) surface roughness
79    
80      real, intent(in):: pctsrf_new_sic(:) ! (klon)      real, intent(in):: pctsrf_new_sic(:) ! (knon)
81      ! nouvelle repartition des surfaces      ! nouvelle repartition des surfaces
82    
83      real, intent(INOUT):: agesno(:) ! (knon)      real, intent(INOUT):: agesno(:) ! (knon)
84    
85        real, intent(OUT):: fqcalving(:) ! (knon)
86      ! Flux d'eau "perdue" par la surface et n\'ecessaire pour limiter la      ! Flux d'eau "perdue" par la surface et n\'ecessaire pour limiter la
87      ! hauteur de neige, en kg / m2 / s      ! hauteur de neige, en kg / m2 / s
     real, dimension(klon), intent(INOUT):: fqcalving  
88    
89      ! Flux thermique utiliser pour fondre la neige      real, intent(OUT):: ffonte(:) ! (knon)
90      real, dimension(klon), intent(INOUT):: ffonte      ! flux thermique utilis\'e pour fondre la neige
91    
92      real, dimension(klon), intent(INOUT):: run_off_lic_0      real, intent(INOUT):: run_off_lic_0(:) ! (knon)
93      ! run_off_lic_0 runoff glacier du pas de temps precedent      ! run_off_lic_0 runoff glacier du pas de temps precedent
94    
95        REAL, intent(OUT):: run_off_lic(:) ! (knon) ruissellement total
96    
97      ! Local:      ! Local:
98      REAL soilcap(knon)      REAL soilcap(size(knindex)) ! (knon)
99      REAL soilflux(knon)      REAL soilflux(size(knindex)) ! (knon)
     logical:: first_call = .true.  
100      integer ii      integer ii
101      real cal(knon)      real cal(size(knindex)) ! (knon)
102      real beta(klon) ! evap reelle      real beta(size(knindex)) ! (knon) evap reelle
103      real dif_grnd(klon), capsol(klon)      real tsurf(size(knindex)) ! (knon)
104      real, parameter:: calice = 1. / (5.1444e6 * 0.15), tau_gl = 86400. * 5.      real alb_neig(size(knindex)) ! (knon)
105      real, parameter:: calsno = 1. / (2.3867e6 * 0.15)      real zfra(size(knindex)) ! (knon)
     real tsurf_temp(knon)  
     real alb_neig(knon)  
     real zfra(knon)  
106      REAL, PARAMETER:: fmagic = 1. ! facteur magique pour r\'egler l'alb\'edo      REAL, PARAMETER:: fmagic = 1. ! facteur magique pour r\'egler l'alb\'edo
107        REAL, PARAMETER:: max_eau_sol = 150. ! in kg m-2
108        REAL, PARAMETER:: tau_gl = 86400. * 5.
109    
110      !-------------------------------------------------------------      !-------------------------------------------------------------
111    
     ! On doit commencer par appeler les schemas de surfaces continentales  
     ! car l'ocean a besoin du ruissellement qui est y calcule  
   
     if (first_call) then  
        call conf_interface  
   
        if (nisurf /= is_ter .and. klon > 1) then  
           print *, ' nisurf = ', nisurf, ' /= is_ter = ', is_ter  
           print *, 'or on doit commencer par les surfaces continentales'  
           call abort_gcm("interfsurf_hq", &  
                'On doit commencer par les surfaces continentales')  
        endif  
   
        if (is_oce > is_sic) then  
           print *, 'is_oce = ', is_oce, '> is_sic = ', is_sic  
           call abort_gcm("interfsurf_hq", &  
                "L'ocean doit etre traite avant la banquise")  
        endif  
   
        first_call = .false.  
     endif  
   
     ! Initialisations diverses  
   
     ffonte(1:knon) = 0.  
     fqcalving(1:knon) = 0.  
     cal = 999999.  
     beta = 999999.  
     dif_grnd = 999999.  
     capsol = 999999.  
     z0_new = 999999.  
     tsurf_new = 999999.  
   
     ! Aiguillage vers les differents schemas de surface  
   
112      select case (nisurf)      select case (nisurf)
113      case (is_ter)      case (is_ter)
114         ! Surface "terre", appel \`a l'interface avec les sols continentaux         ! Surface "terre", appel \`a l'interface avec les sols continentaux
# Line 168  contains Line 118  contains
118         ! Read albedo from the file containing boundary conditions then         ! Read albedo from the file containing boundary conditions then
119         ! add the albedo of snow:         ! add the albedo of snow:
120    
121         call interfsur_lim(dtime, jour, knindex, debut, albedo, z0_new)         call interfsur_lim(julien, knindex, albedo, z0_new)
122    
123         ! Calcul de snow et qsurf, hydrologie adapt\'ee         beta = min(2. * qsol / max_eau_sol, 1.)
124         CALL calbeta(is_ter, snow, qsol(:knon), beta(:knon), &         CALL soil(is_ter, snow, ts, tsoil, soilcap, soilflux)
125              capsol(:knon), dif_grnd(:knon))         cal = RCPD / soilcap
126    
127         IF (soil_model) THEN         CALL calcul_fluxs(ts, p1lay, cal, beta, tq_cdrag, ps, qsurf, &
128            CALL soil(dtime, is_ter, snow, tsurf, tsoil, soilcap, soilflux)              radsol + soilflux, temp_air, spechum, u1_lay, v1_lay, tAcoef, &
129            cal = RCPD / soilcap              qAcoef, tBcoef, qBcoef, tsurf_new, evap, fluxlat, flux_t, dflux_s, &
130            radsol(1:knon) = radsol(1:knon) + soilflux              dflux_l, dif_grnd = 0.)
131         ELSE         CALL fonte_neige(is_ter, rain_fall, snow_fall, snow, qsol, &
132            cal = RCPD * capsol(:knon)              tsurf_new, evap, fqcalving, ffonte, run_off_lic_0, run_off_lic)
        ENDIF  
   
        CALL calcul_fluxs(dtime, tsurf, p1lay(:knon), cal, &  
             beta(:knon), tq_cdrag(:knon), ps(:knon), qsurf(:knon), &  
             radsol(:knon), dif_grnd(:knon), temp_air(:knon), spechum(:knon), &  
             u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), peqAcoef(:knon), &  
             petBcoef(:knon), peqBcoef(:knon), tsurf_new, evap, &  
             fluxlat, flux_t, dflux_s(:knon), dflux_l(:knon))  
        CALL fonte_neige(is_ter, dtime, precip_rain(:knon), &  
             precip_snow(:knon), snow, qsol(:knon), tsurf_new, evap, &  
             fqcalving(:knon), ffonte(:knon), run_off_lic_0(:knon))  
133    
134         call albsno(dtime, agesno, alb_neig, precip_snow(:knon))         call albsno(agesno, alb_neig, snow_fall)
135         where (snow < 0.0001) agesno = 0.         where (snow < 0.0001) agesno = 0.
136         zfra = max(0., min(1., snow / (snow + 10.)))         zfra = max(0., min(1., snow / (snow + 10.)))
137         albedo = alb_neig * zfra + albedo * (1. - zfra)         albedo = alb_neig * zfra + albedo * (1. - zfra)
# Line 200  contains Line 139  contains
139      case (is_oce)      case (is_oce)
140         ! Surface "oc\'ean", appel \`a l'interface avec l'oc\'ean         ! Surface "oc\'ean", appel \`a l'interface avec l'oc\'ean
141    
142         call read_sst(dtime, jour, knindex, debut, tsurf_temp)         ffonte = 0.
143           call limit_read_sst(julien, knindex, tsurf)
144         cal = 0.         cal = 0.
145         beta = 1.         beta = 1.
146         dif_grnd = 0.         call calcul_fluxs(tsurf, p1lay, cal, beta, tq_cdrag, ps, qsurf, radsol, &
147                temp_air, spechum, u1_lay, v1_lay, tAcoef, qAcoef, tBcoef, qBcoef, &
148                tsurf_new, evap, fluxlat, flux_t, dflux_s, dflux_l, dif_grnd = 0.)
149         agesno = 0.         agesno = 0.
150         call calcul_fluxs(dtime, tsurf_temp, p1lay(:knon), cal, &         albedo = alboc_cd(mu0) * fmagic
             beta(:knon), tq_cdrag(:knon), ps(:knon), qsurf(:knon), &  
             radsol(:knon), dif_grnd(:knon), temp_air(:knon), spechum(:knon), &  
             u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), peqAcoef(:knon), &  
             petBcoef(:knon), peqBcoef(:knon), tsurf_new, evap, &  
             fluxlat, flux_t, dflux_s(:knon), dflux_l(:knon))  
        fder = fder + dflux_s + dflux_l  
        albedo = alboc_cd(rmu0(knindex)) * fmagic  
151         z0_new = sqrt(rugos**2 + rugoro**2)         z0_new = sqrt(rugos**2 + rugoro**2)
152           fqcalving = 0.
153      case (is_sic)      case (is_sic)
154         ! Surface "glace de mer" appel a l'interface avec l'ocean         ! Surface "glace de mer" appel a l'interface avec l'ocean
155    
156         DO ii = 1, knon         DO ii = 1, size(knindex)
157            tsurf_new(ii) = tsurf(ii)            IF (pctsrf_new_sic(ii) < EPSFRA) then
           IF (pctsrf_new_sic(knindex(ii)) < EPSFRA) then  
158               snow(ii) = 0.               snow(ii) = 0.
159               tsurf_new(ii) = RTT - 1.8               tsurf_new(ii) = RTT - 1.8
160               IF (soil_model) tsoil(ii, :) = RTT - 1.8               tsoil(ii, :) = RTT - 1.8
161              else
162                 tsurf_new(ii) = ts(ii)
163            endif            endif
164         enddo         enddo
165    
166         CALL calbeta(is_sic, snow, qsol(:knon), beta(:knon), &         CALL soil(is_sic, snow, tsurf_new, tsoil, soilcap, soilflux)
167              capsol(:knon), dif_grnd(:knon))         cal = RCPD / soilcap
168           tsurf = tsurf_new
        IF (soil_model) THEN  
           CALL soil(dtime, is_sic, snow, tsurf_new, tsoil, soilcap, &  
                soilflux)  
           cal = RCPD / soilcap  
           radsol(1:knon) = radsol(1:knon) + soilflux  
           dif_grnd = 0.  
        ELSE  
           dif_grnd = 1. / tau_gl  
           cal = RCPD * calice  
           WHERE (snow > 0.) cal = RCPD * calsno  
        ENDIF  
        tsurf_temp = tsurf_new  
169         beta = 1.         beta = 1.
170           CALL calcul_fluxs(tsurf, p1lay, cal, beta, tq_cdrag, ps, qsurf, &
171         CALL calcul_fluxs(dtime, tsurf_temp, p1lay(:knon), cal, &              radsol + soilflux, temp_air, spechum, u1_lay, v1_lay, tAcoef, &
172              beta(:knon), tq_cdrag(:knon), ps(:knon), qsurf(:knon), &              qAcoef, tBcoef, qBcoef, tsurf_new, evap, fluxlat, flux_t, dflux_s, &
173              radsol(:knon), dif_grnd(:knon), temp_air(:knon), spechum(:knon), &              dflux_l, dif_grnd = 1. / tau_gl)
174              u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), peqAcoef(:knon), &         CALL fonte_neige(is_sic, rain_fall, snow_fall, snow, qsol, &
175              petBcoef(:knon), peqBcoef(:knon), tsurf_new, evap, &              tsurf_new, evap, fqcalving, ffonte, run_off_lic_0, run_off_lic)
             fluxlat, flux_t, dflux_s(:knon), dflux_l(:knon))  
        CALL fonte_neige(is_sic, dtime, precip_rain(:knon), &  
             precip_snow(:knon), snow, qsol(:knon), tsurf_new, evap, &  
             fqcalving(:knon), ffonte(:knon), run_off_lic_0(:knon))  
176    
177         ! Compute the albedo:         ! Compute the albedo:
178    
179         CALL albsno(dtime, agesno, alb_neig, precip_snow(:knon))         CALL albsno(agesno, alb_neig, snow_fall)
180         WHERE (snow < 0.0001) agesno = 0.         WHERE (snow < 0.0001) agesno = 0.
181         zfra = MAX(0., MIN(1., snow / (snow + 10.)))         zfra = MAX(0., MIN(1., snow / (snow + 10.)))
182         albedo = alb_neig * zfra + 0.6 * (1. - zfra)         albedo = alb_neig * zfra + 0.6 * (1. - zfra)
183    
        fder = fder + dflux_s + dflux_l  
184         z0_new = SQRT(0.002**2 + rugoro**2)         z0_new = SQRT(0.002**2 + rugoro**2)
185      case (is_lic)      case (is_lic)
186         ! Surface "glacier continentaux" appel a l'interface avec le sol         ! Surface "glacier continentaux" appel a l'interface avec le sol
187    
188         IF (soil_model) THEN         CALL soil(is_lic, snow, ts, tsoil, soilcap, soilflux)
189            CALL soil(dtime, is_lic, snow, tsurf, tsoil, soilcap, soilflux)         cal = RCPD / soilcap
           cal = RCPD / soilcap  
           radsol(1:knon) = radsol(1:knon) + soilflux  
        ELSE  
           cal = RCPD * calice  
           WHERE (snow > 0.) cal = RCPD * calsno  
        ENDIF  
190         beta = 1.         beta = 1.
191         dif_grnd = 0.         call calcul_fluxs(ts, p1lay, cal, beta, tq_cdrag, ps, qsurf, &
192                radsol + soilflux, temp_air, spechum, u1_lay, v1_lay, tAcoef, &
193         call calcul_fluxs(dtime, tsurf, p1lay(:knon), cal, &              qAcoef, tBcoef, qBcoef, tsurf_new, evap, fluxlat, flux_t, dflux_s, &
194              beta(:knon), tq_cdrag(:knon), ps(:knon), qsurf(:knon), &              dflux_l, dif_grnd = 0.)
195              radsol(:knon), dif_grnd(:knon), temp_air(:knon), spechum(:knon), &         call fonte_neige(is_lic, rain_fall, snow_fall, snow, qsol, &
196              u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), peqAcoef(:knon), &              tsurf_new, evap, fqcalving, ffonte, run_off_lic_0, run_off_lic)
             petBcoef(:knon), peqBcoef(:knon), tsurf_new, evap, &  
             fluxlat, flux_t, dflux_s(:knon), dflux_l(:knon))  
        call fonte_neige(is_lic, dtime, precip_rain(:knon), &  
             precip_snow(:knon), snow, qsol(:knon), tsurf_new, evap, &  
             fqcalving(:knon), ffonte(:knon), run_off_lic_0(:knon))  
197    
198         ! calcul albedo         ! calcul albedo
199         CALL albsno(dtime, agesno, alb_neig, precip_snow(:knon))         CALL albsno(agesno, alb_neig, snow_fall)
200         WHERE (snow < 0.0001) agesno = 0.         WHERE (snow < 0.0001) agesno = 0.
201         albedo = 0.77         albedo = 0.77
202    

Legend:
Removed from v.217  
changed lines
  Added in v.305

  ViewVC Help
Powered by ViewVC 1.1.21