/[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

revision 101 by guez, Mon Jul 7 17:45:21 2014 UTC revision 116 by guez, Thu Dec 4 16:35:03 2014 UTC
# Line 4  module interfsurf_hq_m Line 4  module interfsurf_hq_m
4    
5  contains  contains
6    
7    SUBROUTINE interfsurf_hq(itime, dtime, jour, rmu0, nisurf, knon, &    SUBROUTINE interfsurf_hq(itime, dtime, jour, rmu0, nisurf, knon, knindex, &
8         knindex, pctsrf, rlat, debut, nsoilmx, tsoil, qsol, &         pctsrf, rlat, debut, nsoilmx, tsoil, qsol, u1_lay, v1_lay, temp_air, &
9         u1_lay, v1_lay, temp_air, spechum, tq_cdrag, petAcoef, peqAcoef, &         spechum, tq_cdrag, petAcoef, peqAcoef, petBcoef, peqBcoef, &
10         petBcoef, peqBcoef, precip_rain, precip_snow, fder, rugos, rugoro, &         precip_rain, precip_snow, fder, rugos, rugoro, snow, qsurf, tsurf, &
11         snow, qsurf, tsurf, p1lay, ps, radsol, evap, fluxsens, fluxlat, &         p1lay, ps, radsol, evap, fluxsens, fluxlat, dflux_l, dflux_s, &
12         dflux_l, dflux_s, tsurf_new, alb_new, alblw, z0_new, pctsrf_new, &         tsurf_new, alb_new, alblw, z0_new, pctsrf_new, agesno, fqcalving, &
13         agesno, fqcalving, ffonte, run_off_lic_0, flux_o, flux_g)         ffonte, run_off_lic_0, flux_o, flux_g)
14    
15      ! Cette routine sert d'aiguillage entre l'atmosphère et la surface      ! Cette routine sert d'aiguillage entre l'atmosphère et la surface
16      ! en général (sols continentaux, océans, glaces) pour les flux de      ! en général (sols continentaux, océans, glaces) pour les flux de
17      ! chaleur et d'humidité.      ! chaleur et d'humidité.
18    
19      ! Laurent Fairhead, 02/2000      ! Laurent Fairhead, February 2000
20    
21      USE abort_gcm_m, ONLY: abort_gcm      USE abort_gcm_m, ONLY: abort_gcm
22      USE albsno_m, ONLY: albsno      USE albsno_m, ONLY: albsno
# Line 39  contains Line 39  contains
39      integer, intent(IN):: nisurf ! index de la surface a traiter      integer, intent(IN):: nisurf ! index de la surface a traiter
40      integer, intent(IN):: knon ! nombre de points de la surface a traiter      integer, intent(IN):: knon ! nombre de points de la surface a traiter
41    
42      integer, intent(in):: knindex(klon)      integer, intent(in):: knindex(:) ! (knon)
43      ! index des points de la surface a traiter      ! index des points de la surface a traiter
44    
45      real, intent(IN):: pctsrf(klon, nbsrf)      real, intent(IN):: pctsrf(klon, nbsrf)
# Line 83  contains Line 83  contains
83      ! rugos rugosite      ! rugos rugosite
84      ! rugoro rugosite orographique      ! rugoro rugosite orographique
85      real, intent(INOUT):: snow(klon), qsurf(klon)      real, intent(INOUT):: snow(klon), qsurf(klon)
86      real, dimension(klon), intent(IN):: tsurf, p1lay      real, intent(IN):: tsurf(:) ! (knon) température de surface
87      ! tsurf temperature de surface      real, dimension(klon), intent(IN):: p1lay
88      ! p1lay pression 1er niveau (milieu de couche)      ! p1lay pression 1er niveau (milieu de couche)
89      real, dimension(klon), intent(IN):: ps      real, dimension(klon), intent(IN):: ps
90      ! ps pression au sol      ! ps pression au sol
91      REAL, DIMENSION(klon), INTENT(INOUT):: radsol      REAL, DIMENSION(klon), INTENT(INOUT):: radsol
92      ! radsol rayonnement net aus sol (LW + SW)      ! radsol rayonnement net aus sol (LW + SW)
93      real, dimension(klon), intent(INOUT):: evap      real, intent(INOUT):: evap(klon) ! evaporation totale
     ! evap evaporation totale  
94      real, dimension(klon), intent(OUT):: fluxsens, fluxlat      real, dimension(klon), intent(OUT):: fluxsens, fluxlat
95      ! fluxsens flux de chaleur sensible      ! fluxsens flux de chaleur sensible
96      ! fluxlat flux de chaleur latente      ! fluxlat flux de chaleur latente
97      real, dimension(klon), intent(OUT):: dflux_l, dflux_s      real, dimension(klon), intent(OUT):: dflux_l, dflux_s
98      real, dimension(klon), intent(OUT):: tsurf_new, alb_new      real, intent(OUT):: tsurf_new(knon) ! température au sol
99      ! tsurf_new temperature au sol      real, intent(OUT):: alb_new(klon) ! albedo
     ! alb_new albedo  
100      real, dimension(klon), intent(OUT):: alblw      real, dimension(klon), intent(OUT):: alblw
101      real, dimension(klon), intent(OUT):: z0_new      real, dimension(klon), intent(OUT):: z0_new
102      ! z0_new surface roughness      ! z0_new surface roughness
# Line 138  contains Line 136  contains
136      real, dimension(klon):: cal, beta, dif_grnd, capsol      real, dimension(klon):: cal, beta, dif_grnd, capsol
137      real, parameter:: calice=1.0/(5.1444e6 * 0.15), tau_gl=86400.*5.      real, parameter:: calice=1.0/(5.1444e6 * 0.15), tau_gl=86400.*5.
138      real, parameter:: calsno=1./(2.3867e6 * 0.15)      real, parameter:: calsno=1./(2.3867e6 * 0.15)
139      real, dimension(klon):: tsurf_temp      real tsurf_temp(knon)
140      real, dimension(klon):: alb_neig, alb_eau      real, dimension(klon):: alb_neig, alb_eau
141      real, DIMENSION(klon):: zfra      real, DIMENSION(klon):: zfra
142      INTEGER, dimension(1):: iloc      INTEGER, dimension(1):: iloc
# Line 173  contains Line 171  contains
171    
172      ffonte(1:knon)=0.      ffonte(1:knon)=0.
173      fqcalving(1:knon)=0.      fqcalving(1:knon)=0.
   
174      cal = 999999.      cal = 999999.
175      beta = 999999.      beta = 999999.
176      dif_grnd = 999999.      dif_grnd = 999999.
# Line 190  contains Line 187  contains
187    
188      ! Aiguillage vers les differents schemas de surface      ! Aiguillage vers les differents schemas de surface
189    
190      if (nisurf == is_ter) then      select case (nisurf)
191        case (is_ter)
192         ! Surface "terre" appel a l'interface avec les sols continentaux         ! Surface "terre" appel a l'interface avec les sols continentaux
193    
194         ! allocation du run-off         ! allocation du run-off
# Line 208  contains Line 206  contains
206    
207         ! calcul albedo: lecture albedo fichier boundary conditions         ! calcul albedo: lecture albedo fichier boundary conditions
208         ! puis ajout albedo neige         ! puis ajout albedo neige
209         call interfsur_lim(itime, dtime, jour, nisurf, knon, knindex, &         call interfsur_lim(itime, dtime, jour, nisurf, knindex, debut, &
210              debut, alb_new, z0_new)              alb_new, z0_new)
211    
212         ! calcul snow et qsurf, hydrol adapté         ! calcul snow et qsurf, hydrol adapté
213         CALL calbeta(nisurf, snow(:knon), qsol(:knon), beta(:knon), &         CALL calbeta(nisurf, snow(:knon), qsol(:knon), beta(:knon), &
# Line 218  contains Line 216  contains
216         IF (soil_model) THEN         IF (soil_model) THEN
217            CALL soil(dtime, nisurf, knon, snow, tsurf, tsoil, soilcap, soilflux)            CALL soil(dtime, nisurf, knon, snow, tsurf, tsoil, soilcap, soilflux)
218            cal(1:knon) = RCPD / soilcap(1:knon)            cal(1:knon) = RCPD / soilcap(1:knon)
219            radsol(1:knon) = radsol(1:knon) + soilflux(1:knon)            radsol(1:knon) = radsol(1:knon) + soilflux(:knon)
220         ELSE         ELSE
221            cal = RCPD * capsol            cal = RCPD * capsol
222         ENDIF         ENDIF
223         CALL calcul_fluxs(klon, knon, nisurf, dtime, tsurf, p1lay, cal, beta, &         CALL calcul_fluxs(nisurf, dtime, tsurf, p1lay(:knon), cal(:knon), &
224              tq_cdrag, ps, precip_rain, precip_snow, snow, qsurf, radsol, &              beta(:knon), tq_cdrag(:knon), ps(:knon), qsurf(:knon), &
225              dif_grnd, temp_air, spechum, u1_lay, v1_lay, petAcoef, peqAcoef, &              radsol(:knon), dif_grnd(:knon), temp_air(:knon), spechum(:knon), &
226              petBcoef, peqBcoef, tsurf_new, evap, fluxlat, fluxsens, dflux_s, &              u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), peqAcoef(:knon), &
227              dflux_l)              petBcoef(:knon), peqBcoef(:knon), tsurf_new, evap(:knon), &
228                fluxlat(:knon), fluxsens(:knon), dflux_s(:knon), dflux_l(:knon))
229         CALL fonte_neige(klon, knon, nisurf, dtime, tsurf, p1lay, beta, &  
230              tq_cdrag, ps, precip_rain(:knon), precip_snow, snow, qsol(:knon), &         CALL fonte_neige(nisurf, dtime, tsurf, p1lay(:knon), beta(:knon), &
231              temp_air, spechum, u1_lay, v1_lay, petAcoef, peqAcoef, petBcoef, &              tq_cdrag(:knon), ps(:knon), precip_rain(:knon), &
232              peqBcoef, tsurf_new, evap, fqcalving, ffonte, run_off_lic_0)              precip_snow(:knon), snow(:knon), qsol(:knon), temp_air(:knon), &
233                spechum(:knon), u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), &
234                peqAcoef(:knon), petBcoef(:knon), peqBcoef(:knon), tsurf_new, &
235                evap(:knon), fqcalving(:knon), ffonte(:knon), run_off_lic_0(:knon))
236    
237         call albsno(klon, knon, dtime, agesno, alb_neig, precip_snow)         call albsno(klon, knon, dtime, agesno, alb_neig, precip_snow)
238         where (snow(1 : knon) .LT. 0.0001) agesno(1 : knon) = 0.         where (snow(1 : knon) < 0.0001) agesno(1 : knon) = 0.
239         zfra(1:knon) = max(0.0, min(1.0, snow(1:knon)/(snow(1:knon) + 10.0)))         zfra(1:knon) = max(0.0, min(1.0, snow(1:knon)/(snow(1:knon) + 10.0)))
240         alb_new(1 : knon) = alb_neig(1 : knon) *zfra(1:knon) + &         alb_new(1 : knon) = alb_neig(1 : knon) *zfra(1:knon) + &
241              alb_new(1 : knon)*(1.0-zfra(1:knon))              alb_new(1 : knon)*(1.0-zfra(1:knon))
# Line 243  contains Line 244  contains
244    
245         ! Remplissage des pourcentages de surface         ! Remplissage des pourcentages de surface
246         pctsrf_new(:, nisurf) = pctsrf(:, nisurf)         pctsrf_new(:, nisurf) = pctsrf(:, nisurf)
247      else if (nisurf == is_oce) then      case (is_oce)
248         ! Surface "ocean" appel a l'interface avec l'ocean         ! Surface "ocean" appel à l'interface avec l'océan
249         ! lecture conditions limites         ! lecture conditions limites
250         call interfoce_lim(itime, dtime, jour, klon, nisurf, knon, knindex, &         call interfoce_lim(itime, dtime, jour, knindex, debut, tsurf_temp, &
251              debut, tsurf_new, pctsrf_new)              pctsrf_new)
252    
        tsurf_temp = tsurf_new  
253         cal = 0.         cal = 0.
254         beta = 1.         beta = 1.
255         dif_grnd = 0.         dif_grnd = 0.
256         alb_neig = 0.         alb_neig = 0.
257         agesno = 0.         agesno = 0.
258           call calcul_fluxs(nisurf, dtime, tsurf_temp, p1lay(:knon), &
259         call calcul_fluxs(klon, knon, nisurf, dtime, tsurf_temp, p1lay, cal, &              cal(:knon), beta(:knon), tq_cdrag(:knon), ps(:knon), &
260              beta, tq_cdrag, ps, precip_rain, precip_snow, snow, qsurf, &              qsurf(:knon), radsol(:knon), dif_grnd(:knon), temp_air(:knon), &
261              radsol, dif_grnd, temp_air, spechum, u1_lay, v1_lay, petAcoef, &              spechum(:knon), u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), &
262              peqAcoef, petBcoef, peqBcoef, tsurf_new, evap, fluxlat, fluxsens, &              peqAcoef(:knon), petBcoef(:knon), peqBcoef(:knon), &
263              dflux_s, dflux_l)              tsurf_new, evap(:knon), fluxlat(:knon), fluxsens(:knon), &
264                dflux_s(:knon), dflux_l(:knon))
265         fder_prev = fder         fder_prev = fder
266         fder = fder_prev + dflux_s + dflux_l         fder = fder_prev + dflux_s + dflux_l
   
267         iloc = maxloc(fder(1:klon))         iloc = maxloc(fder(1:klon))
268    
269         !IM: flux ocean-atmosphere utile pour le "slab" ocean         !IM: flux ocean-atmosphere utile pour le "slab" ocean
270         DO i=1, knon         DO i=1, knon
271            zx_sl(i) = RLVTT            zx_sl(i) = RLVTT
272            if (tsurf_new(i) .LT. RTT) zx_sl(i) = RLSTT            if (tsurf_new(i) < RTT) zx_sl(i) = RLSTT
273            flux_o(i) = fluxsens(i)-evap(i)*zx_sl(i)            flux_o(i) = fluxsens(i)-evap(i)*zx_sl(i)
274         ENDDO         ENDDO
275    
# Line 286  contains Line 285  contains
285    
286         z0_new = sqrt(rugos**2 + rugoro**2)         z0_new = sqrt(rugos**2 + rugoro**2)
287         alblw(1:knon) = alb_new(1:knon)         alblw(1:knon) = alb_new(1:knon)
288      else if (nisurf == is_sic) then      case (is_sic)
289         ! Surface "glace de mer" appel a l'interface avec l'ocean         ! Surface "glace de mer" appel a l'interface avec l'ocean
290    
291         ! ! lecture conditions limites         ! ! lecture conditions limites
292         CALL interfoce_lim(itime, dtime, jour, klon, nisurf, knon, knindex, &         CALL interfoce_lim(itime, dtime, jour, knindex, debut, tsurf_new, &
293              debut, tsurf_new, pctsrf_new)              pctsrf_new)
294    
        !IM cf LF  
295         DO ii = 1, knon         DO ii = 1, knon
296            tsurf_new(ii) = tsurf(ii)            tsurf_new(ii) = tsurf(ii)
           !IMbad IF (pctsrf_new(ii, nisurf) < EPSFRA) then  
297            IF (pctsrf_new(knindex(ii), nisurf) < EPSFRA) then            IF (pctsrf_new(knindex(ii), nisurf) < EPSFRA) then
298               snow(ii) = 0.0               snow(ii) = 0.0
              !IM cf LF/JLD tsurf(ii) = RTT - 1.8  
299               tsurf_new(ii) = RTT - 1.8               tsurf_new(ii) = RTT - 1.8
300               IF (soil_model) tsoil(ii, :) = RTT -1.8               IF (soil_model) tsoil(ii, :) = RTT -1.8
301            endif            endif
# Line 319  contains Line 315  contains
315            cal = RCPD * calice            cal = RCPD * calice
316            WHERE (snow > 0.0) cal = RCPD * calsno            WHERE (snow > 0.0) cal = RCPD * calsno
317         ENDIF         ENDIF
        !IMbadtsurf_temp = tsurf  
318         tsurf_temp = tsurf_new         tsurf_temp = tsurf_new
319         beta = 1.0         beta = 1.0
320    
321         CALL calcul_fluxs(klon, knon, nisurf, dtime, tsurf_temp, p1lay, cal, &         CALL calcul_fluxs(nisurf, dtime, tsurf_temp, p1lay(:knon), cal(:knon), &
322              beta, tq_cdrag, ps, precip_rain, precip_snow, snow, qsurf, &              beta(:knon), tq_cdrag(:knon), ps(:knon), qsurf(:knon), &
323              radsol, dif_grnd, temp_air, spechum, u1_lay, v1_lay, petAcoef, &              radsol(:knon), dif_grnd(:knon), temp_air(:knon), spechum(:knon), &
324              peqAcoef, petBcoef, peqBcoef, tsurf_new, evap, fluxlat, fluxsens, &              u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), peqAcoef(:knon), &
325              dflux_s, dflux_l)              petBcoef(:knon), peqBcoef(:knon), tsurf_new, evap(:knon), &
326                fluxlat(:knon), fluxsens(:knon), dflux_s(:knon), dflux_l(:knon))
327    
328         !IM: flux entre l'ocean et la glace de mer pour le "slab" ocean         !IM: flux entre l'ocean et la glace de mer pour le "slab" ocean
329         DO i = 1, knon         DO i = 1, knon
# Line 336  contains Line 332  contains
332                 * dif_grnd(i) * RCPD / cal(i)                 * dif_grnd(i) * RCPD / cal(i)
333         ENDDO         ENDDO
334    
335         CALL fonte_neige(klon, knon, nisurf, dtime, tsurf_temp, p1lay, beta, &         CALL fonte_neige(nisurf, dtime, tsurf_temp, p1lay(:knon), beta(:knon), &
336              tq_cdrag, ps, precip_rain(:knon), precip_snow, snow, qsol(:knon), &              tq_cdrag(:knon), ps(:knon), precip_rain(:knon), &
337              temp_air, spechum, u1_lay, v1_lay, petAcoef, peqAcoef, petBcoef, &              precip_snow(:knon), snow(:knon), qsol(:knon), temp_air(:knon), &
338              peqBcoef, tsurf_new, evap, fqcalving, ffonte, run_off_lic_0)              spechum(:knon), u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), &
339                peqAcoef(:knon), petBcoef(:knon), peqBcoef(:knon), tsurf_new, &
340                evap(:knon), fqcalving(:knon), ffonte(:knon), run_off_lic_0(:knon))
341    
342         ! calcul albedo         ! calcul albedo
343    
344         CALL albsno(klon, knon, dtime, agesno, alb_neig, precip_snow)         CALL albsno(klon, knon, dtime, agesno, alb_neig, precip_snow)
345         WHERE (snow(1 : knon) .LT. 0.0001) agesno(1 : knon) = 0.         WHERE (snow(1 : knon) < 0.0001) agesno(1 : knon) = 0.
346         zfra(1:knon) = MAX(0.0, MIN(1.0, snow(1:knon)/(snow(1:knon) + 10.0)))         zfra(1:knon) = MAX(0.0, MIN(1.0, snow(1:knon)/(snow(1:knon) + 10.0)))
347         alb_new(1 : knon) = alb_neig(1 : knon) *zfra(1:knon) + &         alb_new(1 : knon) = alb_neig(1 : knon) *zfra(1:knon) + &
348              0.6 * (1.0-zfra(1:knon))              0.6 * (1.0-zfra(1:knon))
# Line 360  contains Line 358  contains
358         z0_new = SQRT(z0_new**2 + rugoro**2)         z0_new = SQRT(z0_new**2 + rugoro**2)
359         alblw(1:knon) = alb_new(1:knon)         alblw(1:knon) = alb_new(1:knon)
360    
361      else if (nisurf == is_lic) then      case (is_lic)
362         if (.not. allocated(run_off_lic)) then         if (.not. allocated(run_off_lic)) then
363            allocate(run_off_lic(knon))            allocate(run_off_lic(knon))
364            run_off_lic = 0.            run_off_lic = 0.
# Line 379  contains Line 377  contains
377         beta = 1.0         beta = 1.0
378         dif_grnd = 0.0         dif_grnd = 0.0
379    
380         call calcul_fluxs(klon, knon, nisurf, dtime, tsurf, p1lay, cal, beta, &         call calcul_fluxs(nisurf, dtime, tsurf, p1lay(:knon), cal(:knon), &
381              tq_cdrag, ps, precip_rain, precip_snow, snow, qsurf, radsol, &              beta(:knon), tq_cdrag(:knon), ps(:knon), qsurf(:knon), &
382              dif_grnd, temp_air, spechum, u1_lay, v1_lay, petAcoef, peqAcoef, &              radsol(:knon), dif_grnd(:knon), temp_air(:knon), spechum(:knon), &
383              petBcoef, peqBcoef, tsurf_new, evap, fluxlat, fluxsens, dflux_s, &              u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), peqAcoef(:knon), &
384              dflux_l)              petBcoef(:knon), peqBcoef(:knon), tsurf_new, evap(:knon), &
385                fluxlat(:knon), fluxsens(:knon), dflux_s(:knon), dflux_l(:knon))
386         call fonte_neige(klon, knon, nisurf, dtime, tsurf, p1lay, beta, &  
387              tq_cdrag, ps, precip_rain(:knon), precip_snow, snow, qsol(:knon), &         call fonte_neige(nisurf, dtime, tsurf, p1lay(:knon), beta(:knon), &
388              temp_air, spechum, u1_lay, v1_lay, petAcoef, peqAcoef, petBcoef, &              tq_cdrag(:knon), ps(:knon), precip_rain(:knon), &
389              peqBcoef, tsurf_new, evap, fqcalving, ffonte, run_off_lic_0)              precip_snow(:knon), snow(:knon), qsol(:knon), temp_air(:knon), &
390                spechum(:knon), u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), &
391                peqAcoef(:knon), petBcoef(:knon), peqBcoef(:knon), tsurf_new, &
392                evap(:knon), fqcalving(:knon), ffonte(:knon), run_off_lic_0(:knon))
393    
394         ! calcul albedo         ! calcul albedo
395         CALL albsno(klon, knon, dtime, agesno, alb_neig, precip_snow)         CALL albsno(klon, knon, dtime, agesno, alb_neig, precip_snow)
396         WHERE (snow(1 : knon) .LT. 0.0001) agesno(1 : knon) = 0.         WHERE (snow(1 : knon) < 0.0001) agesno(1 : knon) = 0.
397         zfra(1:knon) = MAX(0.0, MIN(1.0, snow(1:knon)/(snow(1:knon) + 10.0)))         zfra(1:knon) = MAX(0.0, MIN(1.0, snow(1:knon)/(snow(1:knon) + 10.0)))
398         alb_new(1 : knon) = alb_neig(1 : knon)*zfra(1:knon) + &         alb_new(1 : knon) = alb_neig(1 : knon)*zfra(1:knon) + &
399              0.6 * (1.0-zfra(1:knon))              0.6 * (1.0-zfra(1:knon))
# Line 408  contains Line 409  contains
409         pctsrf_new(:, nisurf) = pctsrf(:, nisurf)         pctsrf_new(:, nisurf) = pctsrf(:, nisurf)
410    
411         alblw(1:knon) = alb_new(1:knon)         alblw(1:knon) = alb_new(1:knon)
412      else      case default
413         print *, 'Index surface = ', nisurf         print *, 'Index surface = ', nisurf
414         abort_message = 'Index surface non valable'         abort_message = 'Index surface non valable'
415         call abort_gcm(modname, abort_message, 1)         call abort_gcm(modname, abort_message, 1)
416      endif      end select
417    
418    END SUBROUTINE interfsurf_hq    END SUBROUTINE interfsurf_hq
419    

Legend:
Removed from v.101  
changed lines
  Added in v.116

  ViewVC Help
Powered by ViewVC 1.1.21