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

Legend:
Removed from v.223  
changed lines
  Added in v.300

  ViewVC Help
Powered by ViewVC 1.1.21