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

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

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

revision 99 by guez, Wed Jul 2 18:39:15 2014 UTC revision 130 by guez, Tue Feb 24 15:43:51 2015 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, iim, jjm, nisurf, knon, &    SUBROUTINE interfsurf_hq(itime, dtime, jour, rmu0, nisurf, knon, knindex, &
8         knindex, pctsrf, rlat, debut, soil_model, 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, tslab, seaice)         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 alboc_m, only: alboc
23      USE albsno_m, ONLY: albsno      USE albsno_m, ONLY: albsno
24        use calbeta_m, only: calbeta
25      USE calcul_fluxs_m, ONLY: calcul_fluxs      USE calcul_fluxs_m, ONLY: calcul_fluxs
26        use clesphys2, only: soil_model
27      USE dimphy, ONLY: klon      USE dimphy, ONLY: klon
28      USE fonte_neige_m, ONLY: fonte_neige      USE fonte_neige_m, ONLY: fonte_neige
     USE gath2cpl_m, ONLY: gath2cpl  
29      USE indicesol, ONLY: epsfra, is_lic, is_oce, is_sic, is_ter, nbsrf      USE indicesol, ONLY: epsfra, is_lic, is_oce, is_sic, is_ter, nbsrf
30      USE interface_surf, ONLY: coastalflow, riverflow, run_off, &      USE interface_surf, ONLY: run_off, run_off_lic, conf_interface
          run_off_lic, conf_interface, tmp_rlic  
31      USE interfoce_lim_m, ONLY: interfoce_lim      USE interfoce_lim_m, ONLY: interfoce_lim
     USE interfoce_slab_m, ONLY: interfoce_slab  
32      USE interfsur_lim_m, ONLY: interfsur_lim      USE interfsur_lim_m, ONLY: interfsur_lim
33        use soil_m, only: soil
34      USE suphec_m, ONLY: rcpd, rlstt, rlvtt, rtt      USE suphec_m, ONLY: rcpd, rlstt, rlvtt, rtt
35    
36      integer, intent(IN):: itime ! numero du pas de temps      integer, intent(IN):: itime ! numero du pas de temps
37      real, intent(IN):: dtime ! pas de temps de la physique (en s)      real, intent(IN):: dtime ! pas de temps de la physique (en s)
38      integer, intent(IN):: jour ! jour dans l'annee en cours      integer, intent(IN):: jour ! jour dans l'annee en cours
39      real, intent(IN):: rmu0(klon) ! cosinus de l'angle solaire zenithal      real, intent(IN):: rmu0(klon) ! cosinus de l'angle solaire zenithal
40      integer, intent(IN):: iim, jjm      integer, intent(IN):: nisurf ! index de la surface a traiter
41      ! iim, jjm nbres de pts de grille      integer, intent(IN):: knon ! nombre de points de la surface a traiter
42      integer, intent(IN):: nisurf  
43      ! nisurf index de la surface a traiter (1 = sol continental)      integer, intent(in):: knindex(:) ! (knon)
44      integer, intent(IN):: knon      ! index des points de la surface a traiter
45      ! knon nombre de points de la surface a traiter  
     integer, intent(in):: knindex(klon)  
     ! knindex index des points de la surface a traiter  
46      real, intent(IN):: pctsrf(klon, nbsrf)      real, intent(IN):: pctsrf(klon, nbsrf)
47      ! pctsrf tableau des pourcentages de surface de chaque maille      ! tableau des pourcentages de surface de chaque maille
48      real, dimension(klon), intent(IN):: rlat  
49      ! rlat latitudes      real, intent(IN):: rlat(klon) ! latitudes
50      logical, intent(IN):: debut  
51      ! debut logical: 1er appel a la physique      logical, intent(IN):: debut ! 1er appel a la physique
52      ! (si false calcul simplifie des fluxs sur les continents)      ! (si false calcul simplifie des fluxs sur les continents)
53      !! PB ajout pour soil  
54      logical, intent(in):: soil_model      integer, intent(in):: nsoilmx
55      integer:: nsoilmx      REAL tsoil(klon, nsoilmx)
56      REAL, DIMENSION(klon, nsoilmx):: tsoil  
57      REAL, dimension(klon), intent(INOUT):: qsol      REAL, intent(INOUT):: qsol(klon)
58        ! column-density of water in soil, in kg m-2
59    
60      real, dimension(klon), intent(IN):: u1_lay, v1_lay      real, dimension(klon), intent(IN):: u1_lay, v1_lay
61      ! u1_lay vitesse u 1ere couche      ! u1_lay vitesse u 1ere couche
62      ! v1_lay vitesse v 1ere couche      ! v1_lay vitesse v 1ere couche
# Line 70  contains Line 71  contains
71      real, dimension(klon), intent(IN):: petBcoef, peqBcoef      real, dimension(klon), intent(IN):: petBcoef, peqBcoef
72      ! petBcoef coeff. B de la resolution de la CL pour t      ! petBcoef coeff. B de la resolution de la CL pour t
73      ! peqBcoef coeff. B de la resolution de la CL pour q      ! peqBcoef coeff. B de la resolution de la CL pour q
74      real, dimension(klon), intent(IN):: precip_rain, precip_snow  
75      ! precip_rain precipitation liquide      real, intent(IN):: precip_rain(klon)
76      ! precip_snow precipitation solide      ! precipitation, liquid water mass flux (kg/m2/s), positive down
77    
78        real, intent(IN):: precip_snow(klon)
79        ! precipitation, solid water mass flux (kg/m2/s), positive down
80    
81      REAL, DIMENSION(klon), INTENT(INOUT):: fder      REAL, DIMENSION(klon), INTENT(INOUT):: fder
82      ! fder derivee des flux (pour le couplage)      ! fder derivee des flux (pour le couplage)
83      real, dimension(klon), intent(IN):: rugos, rugoro      real, dimension(klon), intent(IN):: rugos, rugoro
84      ! rugos rugosite      ! rugos rugosite
85      ! rugoro rugosite orographique      ! rugoro rugosite orographique
86      real, dimension(klon), intent(INOUT):: snow, qsurf      real, intent(INOUT):: snow(klon), qsurf(klon)
87      real, dimension(klon), intent(IN):: tsurf, p1lay      real, intent(IN):: tsurf(:) ! (knon) température de surface
88      ! tsurf temperature de surface      real, dimension(klon), intent(IN):: p1lay
89      ! p1lay pression 1er niveau (milieu de couche)      ! p1lay pression 1er niveau (milieu de couche)
90      real, dimension(klon), intent(IN):: ps      real, dimension(klon), intent(IN):: ps
91      ! ps pression au sol      ! ps pression au sol
92      REAL, DIMENSION(klon), INTENT(INOUT):: radsol      REAL, DIMENSION(klon), INTENT(INOUT):: radsol
93      ! radsol rayonnement net aus sol (LW + SW)      ! radsol rayonnement net aus sol (LW + SW)
94      real, dimension(klon), intent(INOUT):: evap      real, intent(INOUT):: evap(klon) ! evaporation totale
     ! evap evaporation totale  
95      real, dimension(klon), intent(OUT):: fluxsens, fluxlat      real, dimension(klon), intent(OUT):: fluxsens, fluxlat
96      ! fluxsens flux de chaleur sensible      ! fluxsens flux de chaleur sensible
97      ! fluxlat flux de chaleur latente      ! fluxlat flux de chaleur latente
98      real, dimension(klon), intent(OUT):: dflux_l, dflux_s      real, dimension(klon), intent(OUT):: dflux_l, dflux_s
99      real, dimension(klon), intent(OUT):: tsurf_new, alb_new      real, intent(OUT):: tsurf_new(knon) ! température au sol
100      ! tsurf_new temperature au sol      real, intent(OUT):: alb_new(klon) ! albedo
     ! alb_new albedo  
101      real, dimension(klon), intent(OUT):: alblw      real, dimension(klon), intent(OUT):: alblw
102      real, dimension(klon), intent(OUT):: z0_new      real, dimension(klon), intent(OUT):: z0_new
103      ! z0_new surface roughness      ! z0_new surface roughness
# Line 116  contains Line 119  contains
119    
120      !IM: "slab" ocean      !IM: "slab" ocean
121      real, dimension(klon), intent(OUT):: flux_o, flux_g      real, dimension(klon), intent(OUT):: flux_o, flux_g
     real, dimension(klon), intent(INOUT):: tslab  
     ! tslab temperature slab ocean  
     real, dimension(klon), intent(INOUT):: seaice ! glace de mer (kg/m2)  
122    
123      ! Local:      ! Local:
124    
     real, allocatable, dimension(:), save:: tmp_tslab  
125      REAL, dimension(klon):: soilcap      REAL, dimension(klon):: soilcap
126      REAL, dimension(klon):: soilflux      REAL, dimension(klon):: soilflux
127    
# Line 130  contains Line 129  contains
129      real, parameter:: t_grnd=271.35      real, parameter:: t_grnd=271.35
130      real, dimension(klon):: zx_sl      real, dimension(klon):: zx_sl
131      integer i      integer i
     real, allocatable, dimension(:), save:: tmp_flux_o, tmp_flux_g  
     real, allocatable, dimension(:), save:: tmp_radsol  
     real, allocatable, dimension(:, :), save:: tmp_pctsrf_slab  
     ! pctsrf_slab pourcentages (0-1) des sous-surfaces dans le slab  
     ! tmp_pctsrf_slab = pctsrf_slab  
     real, allocatable, dimension(:), save:: tmp_seaice  
132    
133      character (len = 20), save:: modname = 'interfsurf_hq'      character (len = 20), save:: modname = 'interfsurf_hq'
134      character (len = 80):: abort_message      character (len = 80):: abort_message
135      logical, save:: first_call = .true.      logical, save:: first_call = .true.
     integer, save:: error  
136      integer:: ii      integer:: ii
     logical, save:: check = .false.  
137      real, dimension(klon):: cal, beta, dif_grnd, capsol      real, dimension(klon):: cal, beta, dif_grnd, capsol
138      real, parameter:: calice=1.0/(5.1444e+06*0.15), tau_gl=86400.*5.      real, parameter:: calice=1.0/(5.1444e6 * 0.15), tau_gl=86400.*5.
139      real, parameter:: calsno=1./(2.3867e+06*.15)      real, parameter:: calsno=1./(2.3867e6 * 0.15)
140      real, dimension(klon):: tsurf_temp      real tsurf_temp(knon)
141      real, dimension(klon):: alb_neig, alb_eau      real, dimension(klon):: alb_neig, alb_eau
142      real, DIMENSION(klon):: zfra      real, DIMENSION(klon):: zfra
143      INTEGER, dimension(1):: iloc      INTEGER, dimension(1):: iloc
144      real, dimension(klon):: fder_prev      real, dimension(klon):: fder_prev
     REAL, dimension(klon):: bidule  
145    
146      !-------------------------------------------------------------      !-------------------------------------------------------------
147    
     if (check) write(*, *) 'Entree ', modname  
   
148      ! On doit commencer par appeler les schemas de surfaces continentales      ! On doit commencer par appeler les schemas de surfaces continentales
149      ! car l'ocean a besoin du ruissellement qui est y calcule      ! car l'ocean a besoin du ruissellement qui est y calcule
150    
151      if (first_call) then      if (first_call) then
152         call conf_interface         call conf_interface
153         if (nisurf /= is_ter .and. klon > 1) then         if (nisurf /= is_ter .and. klon > 1) then
154            write(*, *)' *** Warning ***'            print *, ' Warning:'
155            write(*, *)' nisurf = ', nisurf, ' /= is_ter = ', is_ter            print *, ' nisurf = ', nisurf, ' /= is_ter = ', is_ter
156            write(*, *)'or on doit commencer par les surfaces continentales'            print *, 'or on doit commencer par les surfaces continentales'
157            abort_message='voir ci-dessus'            abort_message='voir ci-dessus'
158            call abort_gcm(modname, abort_message, 1)            call abort_gcm(modname, abort_message, 1)
159         endif         endif
160         if ( is_oce > is_sic ) then         if (is_oce > is_sic) then
161            write(*, *)' *** Warning ***'            print *, 'Warning:'
162            write(*, *)' Pour des raisons de sequencement dans le code'            print *, ' Pour des raisons de sequencement dans le code'
163            write(*, *)' l''ocean doit etre traite avant la banquise'            print *, ' l''ocean doit etre traite avant la banquise'
164            write(*, *)' or is_oce = ', is_oce, '> is_sic = ', is_sic            print *, ' or is_oce = ', is_oce, '> is_sic = ', is_sic
165            abort_message='voir ci-dessus'            abort_message='voir ci-dessus'
166            call abort_gcm(modname, abort_message, 1)            call abort_gcm(modname, abort_message, 1)
167         endif         endif
# Line 184  contains Line 172  contains
172    
173      ffonte(1:knon)=0.      ffonte(1:knon)=0.
174      fqcalving(1:knon)=0.      fqcalving(1:knon)=0.
   
175      cal = 999999.      cal = 999999.
176      beta = 999999.      beta = 999999.
177      dif_grnd = 999999.      dif_grnd = 999999.
# Line 199  contains Line 186  contains
186      flux_o = 0.      flux_o = 0.
187      flux_g = 0.      flux_g = 0.
188    
     if (.not. allocated(tmp_flux_o)) then  
        allocate(tmp_flux_o(klon), stat = error)  
        DO i=1, knon  
           tmp_flux_o(knindex(i))=flux_o(i)  
        ENDDO  
        if (error /= 0) then  
           abort_message='Pb allocation tmp_flux_o'  
           call abort_gcm(modname, abort_message, 1)  
        endif  
     endif  
     if (.not. allocated(tmp_flux_g)) then  
        allocate(tmp_flux_g(klon), stat = error)  
        DO i=1, knon  
           tmp_flux_g(knindex(i))=flux_g(i)  
        ENDDO  
        if (error /= 0) then  
           abort_message='Pb allocation tmp_flux_g'  
           call abort_gcm(modname, abort_message, 1)  
        endif  
     endif  
     if (.not. allocated(tmp_radsol)) then  
        allocate(tmp_radsol(klon), stat = error)  
        if (error /= 0) then  
           abort_message='Pb allocation tmp_radsol'  
           call abort_gcm(modname, abort_message, 1)  
        endif  
     endif  
     DO i=1, knon  
        tmp_radsol(knindex(i))=radsol(i)  
     ENDDO  
     if (.not. allocated(tmp_pctsrf_slab)) then  
        allocate(tmp_pctsrf_slab(klon, nbsrf), stat = error)  
        if (error /= 0) then  
           abort_message='Pb allocation tmp_pctsrf_slab'  
           call abort_gcm(modname, abort_message, 1)  
        endif  
        DO i=1, klon  
           tmp_pctsrf_slab(i, 1:nbsrf)=pctsrf(i, 1:nbsrf)  
        ENDDO  
     endif  
   
     if (.not. allocated(tmp_seaice)) then  
        allocate(tmp_seaice(klon), stat = error)  
        if (error /= 0) then  
           abort_message='Pb allocation tmp_seaice'  
           call abort_gcm(modname, abort_message, 1)  
        endif  
        DO i=1, klon  
           tmp_seaice(i)=seaice(i)  
        ENDDO  
     endif  
   
     if (.not. allocated(tmp_tslab)) then  
        allocate(tmp_tslab(klon), stat = error)  
        if (error /= 0) then  
           abort_message='Pb allocation tmp_tslab'  
           call abort_gcm(modname, abort_message, 1)  
        endif  
     endif  
     DO i=1, klon  
        tmp_tslab(i)=tslab(i)  
     ENDDO  
   
189      ! Aiguillage vers les differents schemas de surface      ! Aiguillage vers les differents schemas de surface
190    
191      if (nisurf == is_ter) then      select case (nisurf)
192        case (is_ter)
193         ! Surface "terre" appel a l'interface avec les sols continentaux         ! Surface "terre" appel a l'interface avec les sols continentaux
194    
195         ! allocation du run-off         ! allocation du run-off
196         if (.not. allocated(coastalflow)) then         if (.not. allocated(run_off)) then
197            allocate(coastalflow(knon), stat = error)            allocate(run_off(knon))
198            if (error /= 0) then            run_off = 0.
199               abort_message='Pb allocation coastalflow'         else if (size(run_off) /= knon) then
200               call abort_gcm(modname, abort_message, 1)            print *, 'Bizarre, le nombre de points continentaux'
201            endif            print *, 'a change entre deux appels. J''arrete '
           allocate(riverflow(knon), stat = error)  
           if (error /= 0) then  
              abort_message='Pb allocation riverflow'  
              call abort_gcm(modname, abort_message, 1)  
           endif  
           allocate(run_off(knon), stat = error)  
           if (error /= 0) then  
              abort_message='Pb allocation run_off'  
              call abort_gcm(modname, abort_message, 1)  
           endif  
           !cym  
           run_off=0.0  
           !cym  
   
           ALLOCATE (tmp_rlic(iim, jjm+1))  
           tmp_rlic = 0.0  
        else if (size(coastalflow) /= knon) then  
           write(*, *)'Bizarre, le nombre de points continentaux'  
           write(*, *)'a change entre deux appels. J''arrete ...'  
202            abort_message='voir ci-dessus'            abort_message='voir ci-dessus'
203            call abort_gcm(modname, abort_message, 1)            call abort_gcm(modname, abort_message, 1)
204         endif         endif
        coastalflow = 0.  
        riverflow = 0.  
205    
206         ! Calcul age de la neige         ! Calcul age de la neige
207    
208         ! calcul albedo: lecture albedo fichier boundary conditions         ! calcul albedo: lecture albedo fichier boundary conditions
209         ! puis ajout albedo neige         ! puis ajout albedo neige
210         call interfsur_lim(itime, dtime, jour, nisurf, knon, knindex, &         call interfsur_lim(itime, dtime, jour, nisurf, knindex, debut, &
211              debut, alb_new, z0_new)              alb_new, z0_new)
212    
213         ! calcul snow et qsurf, hydrol adapté         ! calcul snow et qsurf, hydrol adapté
214         CALL calbeta(dtime, nisurf, knon, snow, qsol, beta, capsol, dif_grnd)         CALL calbeta(nisurf, snow(:knon), qsol(:knon), beta(:knon), &
215                capsol(:knon), dif_grnd(:knon))
216    
217         IF (soil_model) THEN         IF (soil_model) THEN
218            CALL soil(dtime, nisurf, knon, snow, tsurf, tsoil, soilcap, &            CALL soil(dtime, nisurf, knon, snow, tsurf, tsoil, soilcap, soilflux)
                soilflux)  
219            cal(1:knon) = RCPD / soilcap(1:knon)            cal(1:knon) = RCPD / soilcap(1:knon)
220            radsol(1:knon) = radsol(1:knon) + soilflux(1:knon)            radsol(1:knon) = radsol(1:knon) + soilflux(:knon)
221         ELSE         ELSE
222            cal = RCPD * capsol            cal = RCPD * capsol
223         ENDIF         ENDIF
224         CALL calcul_fluxs( klon, knon, nisurf, dtime, &         CALL calcul_fluxs(nisurf, dtime, tsurf, p1lay(:knon), cal(:knon), &
225              tsurf, p1lay, cal, beta, tq_cdrag, ps, &              beta(:knon), tq_cdrag(:knon), ps(:knon), qsurf(:knon), &
226              precip_rain, precip_snow, snow, qsurf, &              radsol(:knon), dif_grnd(:knon), temp_air(:knon), spechum(:knon), &
227              radsol, dif_grnd, temp_air, spechum, u1_lay, v1_lay, &              u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), peqAcoef(:knon), &
228              petAcoef, peqAcoef, petBcoef, peqBcoef, &              petBcoef(:knon), peqBcoef(:knon), tsurf_new, evap(:knon), &
229              tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l)              fluxlat(:knon), fluxsens(:knon), dflux_s(:knon), dflux_l(:knon))
230    
231         CALL fonte_neige( klon, knon, nisurf, dtime, &         CALL fonte_neige(nisurf, dtime, tsurf, p1lay(:knon), beta(:knon), &
232              tsurf, p1lay, cal, beta, tq_cdrag, ps, &              tq_cdrag(:knon), ps(:knon), precip_rain(:knon), &
233              precip_rain, precip_snow, snow, qsol, &              precip_snow(:knon), snow(:knon), qsol(:knon), temp_air(:knon), &
234              radsol, dif_grnd, temp_air, spechum, u1_lay, v1_lay, &              spechum(:knon), u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), &
235              petAcoef, peqAcoef, petBcoef, peqBcoef, &              peqAcoef(:knon), petBcoef(:knon), peqBcoef(:knon), tsurf_new, &
236              tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l, &              evap(:knon), fqcalving(:knon), ffonte(:knon), run_off_lic_0(:knon))
             fqcalving, ffonte, run_off_lic_0)  
237    
238         call albsno(klon, knon, dtime, agesno, alb_neig, precip_snow)         call albsno(klon, knon, dtime, agesno, alb_neig, precip_snow)
239         where (snow(1 : knon) .LT. 0.0001) agesno(1 : knon) = 0.         where (snow(1 : knon) < 0.0001) agesno(1 : knon) = 0.
240         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)))
241         alb_new(1 : knon) = alb_neig(1 : knon) *zfra(1:knon) + &         alb_new(1 : knon) = alb_neig(1 : knon) *zfra(1:knon) + &
242              alb_new(1 : knon)*(1.0-zfra(1:knon))              alb_new(1 : knon)*(1.0-zfra(1:knon))
243         z0_new = sqrt(z0_new**2+rugoro**2)         z0_new = sqrt(z0_new**2 + rugoro**2)
244         alblw(1 : knon) = alb_new(1 : knon)         alblw(1 : knon) = alb_new(1 : knon)
245    
246         ! Remplissage des pourcentages de surface         ! Remplissage des pourcentages de surface
247         pctsrf_new(:, nisurf) = pctsrf(:, nisurf)         pctsrf_new(:, nisurf) = pctsrf(:, nisurf)
248      else if (nisurf == is_oce) then      case (is_oce)
249         ! Surface "ocean" appel a l'interface avec l'ocean         ! Surface "ocean" appel à l'interface avec l'océan
250         ! lecture conditions limites         ! lecture conditions limites
251         call interfoce_lim(itime, dtime, jour, klon, nisurf, knon, knindex, &         call interfoce_lim(itime, dtime, jour, knindex, debut, tsurf_temp, &
252              debut, tsurf_new, pctsrf_new)              pctsrf_new)
253    
        tsurf_temp = tsurf_new  
254         cal = 0.         cal = 0.
255         beta = 1.         beta = 1.
256         dif_grnd = 0.         dif_grnd = 0.
257         alb_neig = 0.         alb_neig = 0.
258         agesno = 0.         agesno = 0.
259           call calcul_fluxs(nisurf, dtime, tsurf_temp, p1lay(:knon), &
260         call calcul_fluxs( klon, knon, nisurf, dtime, &              cal(:knon), beta(:knon), tq_cdrag(:knon), ps(:knon), &
261              tsurf_temp, p1lay, cal, beta, tq_cdrag, ps, &              qsurf(:knon), radsol(:knon), dif_grnd(:knon), temp_air(:knon), &
262              precip_rain, precip_snow, snow, qsurf, &              spechum(:knon), u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), &
263              radsol, dif_grnd, temp_air, spechum, u1_lay, v1_lay, &              peqAcoef(:knon), petBcoef(:knon), peqBcoef(:knon), &
264              petAcoef, peqAcoef, petBcoef, peqBcoef, &              tsurf_new, evap(:knon), fluxlat(:knon), fluxsens(:knon), &
265              tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l)              dflux_s(:knon), dflux_l(:knon))
   
266         fder_prev = fder         fder_prev = fder
267         fder = fder_prev + dflux_s + dflux_l         fder = fder_prev + dflux_s + dflux_l
   
268         iloc = maxloc(fder(1:klon))         iloc = maxloc(fder(1:klon))
        if (check.and.fder(iloc(1))> 0.) then  
           WRITE(*, *)'**** Debug fder****'  
           WRITE(*, *)'max fder(', iloc(1), ') = ', fder(iloc(1))  
           WRITE(*, *)'fder_prev, dflux_s, dflux_l', fder_prev(iloc(1)), &  
                dflux_s(iloc(1)), dflux_l(iloc(1))  
        endif  
269    
270         !IM: flux ocean-atmosphere utile pour le "slab" ocean         !IM: flux ocean-atmosphere utile pour le "slab" ocean
271         DO i=1, knon         DO i=1, knon
272            zx_sl(i) = RLVTT            zx_sl(i) = RLVTT
273            if (tsurf_new(i) .LT. RTT) zx_sl(i) = RLSTT            if (tsurf_new(i) < RTT) zx_sl(i) = RLSTT
274            flux_o(i) = fluxsens(i)-evap(i)*zx_sl(i)            flux_o(i) = fluxsens(i)-evap(i)*zx_sl(i)
           tmp_flux_o(knindex(i)) = flux_o(i)  
           tmp_radsol(knindex(i))=radsol(i)  
275         ENDDO         ENDDO
276    
277         ! calcul albedo         ! calcul albedo
278         if ( minval(rmu0) == maxval(rmu0) .and. minval(rmu0) == -999.999 ) then         if (minval(rmu0) == maxval(rmu0) .and. minval(rmu0) == -999.999) then
279            CALL alboc(FLOAT(jour), rlat, alb_eau)            CALL alboc(jour, rlat, alb_eau)
280         else ! cycle diurne         else ! cycle diurne
281            CALL alboc_cd(rmu0, alb_eau)            CALL alboc_cd(rmu0, alb_eau)
282         endif         endif
# Line 394  contains Line 286  contains
286    
287         z0_new = sqrt(rugos**2 + rugoro**2)         z0_new = sqrt(rugos**2 + rugoro**2)
288         alblw(1:knon) = alb_new(1:knon)         alblw(1:knon) = alb_new(1:knon)
289      else if (nisurf == is_sic) then      case (is_sic)
        if (check) write(*, *)'sea ice, nisurf = ', nisurf  
   
290         ! Surface "glace de mer" appel a l'interface avec l'ocean         ! Surface "glace de mer" appel a l'interface avec l'ocean
291    
292         ! ! lecture conditions limites         ! ! lecture conditions limites
293         CALL interfoce_lim(itime, dtime, jour, &         CALL interfoce_lim(itime, dtime, jour, knindex, debut, tsurf_new, &
294              klon, nisurf, knon, knindex, &              pctsrf_new)
             debut, &  
             tsurf_new, pctsrf_new)  
295    
        !IM cf LF  
296         DO ii = 1, knon         DO ii = 1, knon
297            tsurf_new(ii) = tsurf(ii)            tsurf_new(ii) = tsurf(ii)
           !IMbad IF (pctsrf_new(ii, nisurf) < EPSFRA) then  
298            IF (pctsrf_new(knindex(ii), nisurf) < EPSFRA) then            IF (pctsrf_new(knindex(ii), nisurf) < EPSFRA) then
299               snow(ii) = 0.0               snow(ii) = 0.0
              !IM cf LF/JLD tsurf(ii) = RTT - 1.8  
300               tsurf_new(ii) = RTT - 1.8               tsurf_new(ii) = RTT - 1.8
301               IF (soil_model) tsoil(ii, :) = RTT -1.8               IF (soil_model) tsoil(ii, :) = RTT -1.8
302            endif            endif
303         enddo         enddo
304    
305         CALL calbeta(dtime, nisurf, knon, snow, qsol, beta, capsol, dif_grnd)         CALL calbeta(nisurf, snow(:knon), qsol(:knon), beta(:knon), &
306                capsol(:knon), dif_grnd(:knon))
307    
308         IF (soil_model) THEN         IF (soil_model) THEN
309            CALL soil(dtime, nisurf, knon, snow, tsurf_new, tsoil, soilcap, &            CALL soil(dtime, nisurf, knon, snow, tsurf_new, tsoil, soilcap, &
# Line 430  contains Line 316  contains
316            cal = RCPD * calice            cal = RCPD * calice
317            WHERE (snow > 0.0) cal = RCPD * calsno            WHERE (snow > 0.0) cal = RCPD * calsno
318         ENDIF         ENDIF
        !IMbadtsurf_temp = tsurf  
319         tsurf_temp = tsurf_new         tsurf_temp = tsurf_new
320         beta = 1.0         beta = 1.0
321    
322         CALL calcul_fluxs( klon, knon, nisurf, dtime, &         CALL calcul_fluxs(nisurf, dtime, tsurf_temp, p1lay(:knon), cal(:knon), &
323              tsurf_temp, p1lay, cal, beta, tq_cdrag, ps, &              beta(:knon), tq_cdrag(:knon), ps(:knon), qsurf(:knon), &
324              precip_rain, precip_snow, snow, qsurf, &              radsol(:knon), dif_grnd(:knon), temp_air(:knon), spechum(:knon), &
325              radsol, dif_grnd, temp_air, spechum, u1_lay, v1_lay, &              u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), peqAcoef(:knon), &
326              petAcoef, peqAcoef, petBcoef, peqBcoef, &              petBcoef(:knon), peqBcoef(:knon), tsurf_new, evap(:knon), &
327              tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l)              fluxlat(:knon), fluxsens(:knon), dflux_s(:knon), dflux_l(:knon))
328    
329         !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
330         DO i = 1, knon         DO i = 1, knon
331            flux_g(i) = 0.0            flux_g(i) = 0.0
332              IF (cal(i) > 1e-15) flux_g(i) = (tsurf_new(i) - t_grnd) &
333            !IM: faire dependre le coefficient de conduction de la glace de mer                 * dif_grnd(i) * RCPD / cal(i)
           ! de l'epaisseur de la glace de mer, dans l'hypothese ou le coeff.  
           ! actuel correspond a 3m de glace de mer, cf. L.Li  
   
           ! IF(1.EQ.0) THEN  
           ! IF(siceh(i).GT.0.) THEN  
           ! new_dif_grnd(i) = dif_grnd(i)*3./siceh(i)  
           ! ELSE  
           ! new_dif_grnd(i) = 0.  
           ! ENDIF  
           ! ENDIF !(1.EQ.0) THEN  
   
           IF (cal(i).GT.1.0e-15) flux_g(i)=(tsurf_new(i)-t_grnd) &  
                * dif_grnd(i) *RCPD/cal(i)  
           ! & * new_dif_grnd(i) *RCPD/cal(i)  
           tmp_flux_g(knindex(i))=flux_g(i)  
           tmp_radsol(knindex(i))=radsol(i)  
334         ENDDO         ENDDO
335    
336         CALL fonte_neige( klon, knon, nisurf, dtime, &         CALL fonte_neige(nisurf, dtime, tsurf_temp, p1lay(:knon), beta(:knon), &
337              tsurf_temp, p1lay, cal, beta, tq_cdrag, ps, &              tq_cdrag(:knon), ps(:knon), precip_rain(:knon), &
338              precip_rain, precip_snow, snow, qsol, &              precip_snow(:knon), snow(:knon), qsol(:knon), temp_air(:knon), &
339              radsol, dif_grnd, temp_air, spechum, u1_lay, v1_lay, &              spechum(:knon), u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), &
340              petAcoef, peqAcoef, petBcoef, peqBcoef, &              peqAcoef(:knon), petBcoef(:knon), peqBcoef(:knon), tsurf_new, &
341              tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l, &              evap(:knon), fqcalving(:knon), ffonte(:knon), run_off_lic_0(:knon))
             fqcalving, ffonte, run_off_lic_0)  
342    
343         ! calcul albedo         ! calcul albedo
344    
345         CALL albsno(klon, knon, dtime, agesno, alb_neig, precip_snow)         CALL albsno(klon, knon, dtime, agesno, alb_neig, precip_snow)
346         WHERE (snow(1 : knon) .LT. 0.0001) agesno(1 : knon) = 0.         WHERE (snow(1 : knon) < 0.0001) agesno(1 : knon) = 0.
347         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)))
348         alb_new(1 : knon) = alb_neig(1 : knon) *zfra(1:knon) + &         alb_new(1 : knon) = alb_neig(1 : knon) *zfra(1:knon) + &
349              0.6 * (1.0-zfra(1:knon))              0.6 * (1.0-zfra(1:knon))
350    
# Line 484  contains Line 352  contains
352         fder = fder_prev + dflux_s + dflux_l         fder = fder_prev + dflux_s + dflux_l
353    
354         iloc = maxloc(fder(1:klon))         iloc = maxloc(fder(1:klon))
        if (check.and.fder(iloc(1))> 0.) then  
           WRITE(*, *)'**** Debug fder ****'  
           WRITE(*, *)'max fder(', iloc(1), ') = ', fder(iloc(1))  
           WRITE(*, *)'fder_prev, dflux_s, dflux_l', fder_prev(iloc(1)), &  
                dflux_s(iloc(1)), dflux_l(iloc(1))  
        endif  
   
355    
356         ! 2eme appel a interfoce pour le cumul et le passage des flux a l'ocean         ! 2eme appel a interfoce pour le cumul et le passage des flux a l'ocean
357    
358         z0_new = 0.002         z0_new = 0.002
359         z0_new = SQRT(z0_new**2+rugoro**2)         z0_new = SQRT(z0_new**2 + rugoro**2)
360         alblw(1:knon) = alb_new(1:knon)         alblw(1:knon) = alb_new(1:knon)
361    
362      else if (nisurf == is_lic) then      case (is_lic)
   
        if (check) write(*, *)'glacier, nisurf = ', nisurf  
   
363         if (.not. allocated(run_off_lic)) then         if (.not. allocated(run_off_lic)) then
364            allocate(run_off_lic(knon), stat = error)            allocate(run_off_lic(knon))
           if (error /= 0) then  
              abort_message='Pb allocation run_off_lic'  
              call abort_gcm(modname, abort_message, 1)  
           endif  
365            run_off_lic = 0.            run_off_lic = 0.
366         endif         endif
367    
# Line 524  contains Line 378  contains
378         beta = 1.0         beta = 1.0
379         dif_grnd = 0.0         dif_grnd = 0.0
380    
381         call calcul_fluxs( klon, knon, nisurf, dtime, &         call calcul_fluxs(nisurf, dtime, tsurf, p1lay(:knon), cal(:knon), &
382              tsurf, p1lay, cal, beta, tq_cdrag, ps, &              beta(:knon), tq_cdrag(:knon), ps(:knon), qsurf(:knon), &
383              precip_rain, precip_snow, snow, qsurf, &              radsol(:knon), dif_grnd(:knon), temp_air(:knon), spechum(:knon), &
384              radsol, dif_grnd, temp_air, spechum, u1_lay, v1_lay, &              u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), peqAcoef(:knon), &
385              petAcoef, peqAcoef, petBcoef, peqBcoef, &              petBcoef(:knon), peqBcoef(:knon), tsurf_new, evap(:knon), &
386              tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l)              fluxlat(:knon), fluxsens(:knon), dflux_s(:knon), dflux_l(:knon))
387    
388         call fonte_neige( klon, knon, nisurf, dtime, &         call fonte_neige(nisurf, dtime, tsurf, p1lay(:knon), beta(:knon), &
389              tsurf, p1lay, cal, beta, tq_cdrag, ps, &              tq_cdrag(:knon), ps(:knon), precip_rain(:knon), &
390              precip_rain, precip_snow, snow, qsol, &              precip_snow(:knon), snow(:knon), qsol(:knon), temp_air(:knon), &
391              radsol, dif_grnd, temp_air, spechum, u1_lay, v1_lay, &              spechum(:knon), u1_lay(:knon), v1_lay(:knon), petAcoef(:knon), &
392              petAcoef, peqAcoef, petBcoef, peqBcoef, &              peqAcoef(:knon), petBcoef(:knon), peqBcoef(:knon), tsurf_new, &
393              tsurf_new, evap, fluxlat, fluxsens, dflux_s, dflux_l, &              evap(:knon), fqcalving(:knon), ffonte(:knon), run_off_lic_0(:knon))
             fqcalving, ffonte, run_off_lic_0)  
   
        ! passage du run-off des glaciers calcule dans fonte_neige au coupleur  
        bidule=0.  
        bidule(1:knon)= run_off_lic(1:knon)  
        call gath2cpl(bidule, tmp_rlic, klon, knon, iim, jjm, knindex)  
394    
395         ! calcul albedo         ! calcul albedo
   
396         CALL albsno(klon, knon, dtime, agesno, alb_neig, precip_snow)         CALL albsno(klon, knon, dtime, agesno, alb_neig, precip_snow)
397         WHERE (snow(1 : knon) .LT. 0.0001) agesno(1 : knon) = 0.         WHERE (snow(1 : knon) < 0.0001) agesno(1 : knon) = 0.
398         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)))
399         alb_new(1 : knon) = alb_neig(1 : knon)*zfra(1:knon) + &         alb_new(1 : knon) = alb_neig(1 : knon)*zfra(1:knon) + &
400              0.6 * (1.0-zfra(1:knon))              0.6 * (1.0-zfra(1:knon))
401    
402         !IM: plusieurs choix/tests sur l'albedo des "glaciers continentaux"         !IM: plusieurs choix/tests sur l'albedo des "glaciers continentaux"
        ! alb_new(1 : knon) = 0.6 !IM cf FH/GK  
        ! alb_new(1 : knon) = 0.82  
        ! alb_new(1 : knon) = 0.77 !211003 Ksta0.77  
        ! alb_new(1 : knon) = 0.8 !KstaTER0.8 & LMD_ARMIP5  
403         !IM: KstaTER0.77 & LMD_ARMIP6         !IM: KstaTER0.77 & LMD_ARMIP6
404         alb_new(1 : knon) = 0.77         alb_new(1 : knon) = 0.77
405    
   
406         ! Rugosite         ! Rugosite
   
407         z0_new = rugoro         z0_new = rugoro
408    
409         ! Remplissage des pourcentages de surface         ! Remplissage des pourcentages de surface
   
410         pctsrf_new(:, nisurf) = pctsrf(:, nisurf)         pctsrf_new(:, nisurf) = pctsrf(:, nisurf)
411    
412         alblw(1:knon) = alb_new(1:knon)         alblw(1:knon) = alb_new(1:knon)
413      else      case default
414         write(*, *)'Index surface = ', nisurf         print *, 'Index surface = ', nisurf
415         abort_message = 'Index surface non valable'         abort_message = 'Index surface non valable'
416         call abort_gcm(modname, abort_message, 1)         call abort_gcm(modname, abort_message, 1)
417      endif      end select
418    
419    END SUBROUTINE interfsurf_hq    END SUBROUTINE interfsurf_hq
420    

Legend:
Removed from v.99  
changed lines
  Added in v.130

  ViewVC Help
Powered by ViewVC 1.1.21