SURFEX v7.3
General documentation of Surfex
 All Classes Files Functions Variables Typedefs
/home/dasprezs/EXPORT_v7_3/src/SURFEX/isba_fluxes.F90
Go to the documentation of this file.
00001 !     ######spl
00002       SUBROUTINE ISBA_FLUXES(HISBA, HSNOW_ISBA, HSOILFRZ, OTEMP_ARP,           &
00003                           PTSTEP, PSODELX,                                     &
00004                           PSW_RAD, PLW_RAD, PTA, PQA, PUSTAR2,                 &
00005                           PRHOA, PEXNS, PEXNA, PCPS, PLVTT, PLSTT,             &
00006                           PLAI, PVEG, PHUG, PHUI, PHV,                         &
00007                           PLEG_DELTA, PLEGI_DELTA, PDELTA, PRA,                &
00008                           PF5, PRS, PCS, PCG, PCT, PSNOWSWE, PT2M, PTSM,       &
00009                           PPSN, PPSNV, PPSNG, PFROZEN1,                        &
00010                           PTAUICE, PWGI_EXCESS,                                &
00011                           PALBT, PEMIST, PQSAT, PDQSAT, PSNOW_THRUFAL,         &
00012                           PRN, PH, PLE, PLEG, PLEGI, PLEV,                     &
00013                           PLES, PLER, PLETR, PEVAP,                            &
00014                           PGFLUX, PMELTADV, PMELT, PRESTORE,                   &
00015                           PUSTAR, PTS_RAD,                                     &
00016                           PDWGI1, PDWGI2, PDELTAT,                             &
00017                           PSOILCONDZ, PSOILHCAPZ, PWSATZ, PMPOTSATZ, PBCOEFZ,  &
00018                           PD_G, PDZG, PTG, PWGI, PWG, KWG_LAYER,               &
00019                           PSR, PPSNV_A,                                        &
00020                           PFFG, PFFV, PFF, PFFROZEN, PLE_FLOOD, PLEI_FLOOD,    &
00021                           PSNOWTEMP, PTDIURN                                   )
00022 !     ##########################################################################
00023 !
00024 !!****  *ISBA_FLUXES*  
00025 !!
00026 !!    PURPOSE
00027 !!    -------
00028 !
00029 !     Calculates the 
00030 !     1.) evolution of the surface and deep-soil temperature
00031 !     (i.e., Ts and T2) due to snow melt (DEF option) and soil ice phase changes, 
00032 !     2.) the surface fluxes.
00033 !         
00034 !     
00035 !!**  METHOD
00036 !!    ------
00037 !
00038 !     1- snow melt latent heat, liquid rate (DEF option)
00039 !     2- latent heating from soil ice phase changes
00040 !     3- derive the surface fluxes.
00041 !
00042 !!    EXTERNAL
00043 !!    --------
00044 !!
00045 !!    none
00046 !!
00047 !!    IMPLICIT ARGUMENTS
00048 !!    ------------------ 
00049 !!
00050 !!      
00051 !!    REFERENCE
00052 !!    ---------
00053 !!
00054 !!    Noilhan and Planton (1989)
00055 !!    Belair (1995)
00056 !!    Douville et al. (1995)
00057 !!    Boone et al. (2000)
00058 !!      
00059 !!    AUTHOR
00060 !!    ------
00061 !!
00062 !!      S. Belair           * Meteo-France *
00063 !!
00064 !!    MODIFICATIONS
00065 !!    -------------
00066 !!      Original    14/03/95 
00067 !!      (J.Stein)   15/11/95 use the wind components in the flux computation
00068 !!      (J.Noilhan) 15/03/96 use the potential temperature instead of the
00069 !!                           temperature for the heat flux computation 
00070 !!      (J.Stein)   27/03/96 use only H and LE in the soil scheme
00071 !!      (A.Boone V.Masson) 05/10/98 splits e_budget in two for CO2
00072 !!      (A.Boone)   03/10/99 explicit latent heat of sublimation calculated 
00073 !!      (A.Boone)   08/11/00 snow melt and soil ice phase changes herein
00074 !!      (A.Boone)   06/05/02 Updates, ordering. Addition of 'HSOILFRZ' option
00075 !!                           and introduction of snow melt timescale to 'DEF' snow option
00076 !!      (P.LeMoigne) 01/07/05 expression of latent heat flux as a function of
00077 !!                            w'theta' instead of w'T' (divison by surface exner)
00078 !!      (P.LeMoigne) 28/07/05 dependence on qs for cp
00079 !!      (A. Dziedzic and PLM) 10/2006 EBA snow option
00080 !!      (B. Decharme)01/2009  Floodplains
00081 !!      (B. Decharme)03/2009  BUG : effect of insolation due to vegetation cover
00082 !!                                  at 1 for bare soil
00083 !!      (R. Hamdi)   01/09    Cp and L are not constants (As in ALADIN)
00084 !!      (B. Decharme)09/2009  Close the energy budget with the D95 snow scheme
00085 !!      (A.Boone)    03/2010  Add delta fnctions to force LEG ans LEGI=0
00086 !!                            when hug(i)Qsat < Qa and Qsat > Qa
00087 !!      (A.Boone)    11/2011  Add RS_max limit to Etv
00088 !!      (B. Decharme)07/2012  Time spliting for soil ice
00089 !!      (B. Decharme)07/2012  Error in restore flux calculation (only for diag)
00090 !!      (B. Decharme)10/2012  Melt rate with D95 computed using max(XTAU,PTSTEP)
00091 !!                            Same for soil ice if ISBA-FR
00092 !                             Bug on TG2 calculation
00093 !-------------------------------------------------------------------------------
00094 !
00095 !*       0.     DECLARATIONS
00096 !               ------------
00097 !
00098 USE MODD_CSTS,       ONLY : XSTEFAN, XCPD, XLSTT, XLVTT, XCL, XTT, XPI, XDAY, &
00099                             XCI, XRHOLI, XLMTT, XRHOLW, XG, XCL, XCONDI
00100 USE MODD_SURF_PAR,   ONLY : XUNDEF
00101 USE MODD_ISBA_PAR,   ONLY : XWGMIN, XSPHSOIL, XDRYWGHT, XRS_MAX
00102 USE MODD_SNOW_PAR,   ONLY : XTAU_SMELT
00103 !
00104 USE MODE_THERMOS
00105 !
00106 USE MODI_ICE_SOILDIF              
00107 !
00108 USE MODE_SURF_SNOW_FRAC
00109 !
00110 USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
00111 USE PARKIND1  ,ONLY : JPRB
00112 !
00113 IMPLICIT NONE
00114 !
00115 !*      0.1    declarations of arguments
00116 !
00117  CHARACTER(LEN=*),   INTENT(IN)   :: HISBA   ! type of soil (Force-Restore OR Diffusion)
00118 !                                           ! '2-L'
00119 !                                           ! '3-L'
00120 !                                           ! 'DIF'   ISBA-DF
00121 !
00122  CHARACTER(LEN=*), INTENT(IN)  :: HSNOW_ISBA ! 'DEF' = Default F-R snow scheme
00123 !                                           !         (Douville et al. 1995)
00124 !                                           ! '3-L' = 3-L snow scheme (option)
00125 !                                           !         (Boone and Etchevers 2001)
00126 !
00127  CHARACTER(LEN=*),   INTENT(IN) :: HSOILFRZ  ! soil freezing-physics option
00128 !                                           ! 'DEF'   Default (Boone et al. 2000; Giard and Bazile 2000)
00129 !                                           ! 'LWT'   phase changes as above, but relation between unfrozen 
00130 !                                                     water and temperature considered
00131 !
00132 LOGICAL, INTENT(IN)              :: OTEMP_ARP ! True  = time-varying force-restore soil temperature (as in ARPEGE)
00133                                                ! False = No time-varying force-restore soil temperature (Default)
00134 !
00135 !
00136 REAL, INTENT (IN)                :: PTSTEP ! model time step (s)
00137 !
00138 !
00139 REAL, DIMENSION(:), INTENT(IN)   :: PSODELX  ! Pulsation for each layer (Only used if LTEMP_ARP=True)
00140 !
00141 REAL, DIMENSION(:), INTENT (IN)  :: PUSTAR2
00142 !                                     wind friction after implicitation (m2/s2)
00143 !
00144 REAL, DIMENSION(:), INTENT (IN)  :: PSW_RAD, PLW_RAD, PTA, PQA, PRHOA
00145 !                                     PSW_RAD = incoming solar radiation
00146 !                                     PLW_RAD = atmospheric infrared radiation
00147 !                                     PTA = near-ground air temperature
00148 !                                     PQA = near-ground air specific humidity
00149 !                                     PRHOA = near-ground air density
00150 !
00151 REAL, DIMENSION(:), INTENT(IN)   :: PEXNS, PEXNA
00152 REAL, DIMENSION(:), INTENT(IN)   :: PVEG, PLAI
00153 REAL, DIMENSION(:), INTENT(IN)   :: PHUG, PHUI, PHV, PDELTA, PRA, PRS, PF5
00154 REAL, DIMENSION(:), INTENT(IN)   :: PPSN, PPSNV, PPSNG, PFROZEN1, PTAUICE
00155 REAL, DIMENSION(:), INTENT(IN)   :: PALBT, PEMIST
00156 REAL, DIMENSION(:), INTENT(IN)   :: PQSAT, PDQSAT
00157 REAL, DIMENSION(:), INTENT(IN)   :: PLEG_DELTA, PLEGI_DELTA
00158 !                                     PVEG = fraction of vegetation
00159 !                                     PHUG = relative humidity of the soil
00160 !                                     PHV = Halstead coefficient
00161 !                                     PF5 = water stress numerical correction factor (based on F2)
00162 !                                     PDELTA = fraction of the foliage covered
00163 !                                              by intercepted water
00164 !                                     PRA = aerodynamic surface resistance for
00165 !                                           heat transfers
00166 !                                     PRS = surface stomatal resistance
00167 !                                     PPSN = grid fraction covered by snow
00168 !                                     PPSNV = fraction of the vegetation covered
00169 !                                             by snow
00170 !                                     PPSNG = fraction of the ground covered by
00171 !                                             snow 
00172 !                                     PFROZEN1 = fraction of ice in near-surface
00173 !                                                ground
00174 !                                     PALBT = area averaged albedo
00175 !                                     PEMIST = area averaged emissivity
00176 !                                     PQSAT = stauration vapor humidity at 't'
00177 !                                     PDQSAT= stauration vapor humidity derivative at 't'
00178 !                                     PLAI  = Leaf Area Index (m2 m-2)
00179 !                                     PTAUICE = characteristic time scale for soil water
00180 !                                               phase changes (s)
00181 !                                     PLEG_DELTA = soil evaporation delta fn
00182 !                                     PLEGI_DELTA = soil evaporation delta fn
00183 !
00184 REAL, DIMENSION(:), INTENT (IN)  :: PCS, PCG, PCT, PT2M, PTSM, PSNOWSWE
00185 !                                     PCT    = area-averaged heat capacity (K m2 J-1)
00186 !                                     PCS    = heat capacity of the snow (K m2 J-1)
00187 !                                     PCG    = heat capacity of the soil (K m2 J-1)
00188 !                                     PT2M   = mean surface (or restore) temperature at start 
00189 !                                              of time step (K)
00190 !                                     PTSM   = surface temperature at start 
00191 !                                              of time step (K)
00192 !                                     PSNOWSWE = equivalent water content of
00193 !                                              the snow reservoir (kg m-2)
00194 !
00195 REAL, DIMENSION(:), INTENT(IN)   :: PSNOW_THRUFAL
00196 !                                     PSNOW_THRUFAL = rate that liquid water leaves snow pack: 
00197 !                                                ISBA-ES [kg/(m2 s)]
00198 REAL, DIMENSION(:), INTENT(IN)   :: PSR 
00199 !                                     PSR = snow precipitation rate [kg/(m2 s)]
00200 REAL, DIMENSION(:), INTENT(IN)   :: PPSNV_A
00201 !                                     PPSNV_A = vegetation covered by snow EBA scheme
00202 !
00203 REAL, DIMENSION(:), INTENT(OUT)  :: PRN, PH, PLE, PLEG, PLEV, PLES
00204 REAL, DIMENSION(:), INTENT(OUT)  :: PLER, PLETR, PEVAP, PGFLUX, PMELTADV, PMELT, PRESTORE
00205 !                                     PRN = net radiation at the surface
00206 !                                     PH = sensible heat flux
00207 !                                     PLE = latent heat flux
00208 !                                     PLEG = latent heat flux from the soil surface
00209 !                                     PLEV = latent heat flux from the vegetation
00210 !                                     PLES = latent heat flux from the snow
00211 !                                     PLER = direct evaporation from the fraction
00212 !                                            delta of the foliage
00213 !                                     PLETR = transpiration of the remaining
00214 !                                             part of the leaves
00215 !                                     PEVAP = total evaporative flux (kg/m2/s)
00216 !                                     PGFLUX = ground flux
00217 !                                     PMELTADV = heat advection by melting snow
00218 !                                                (acts to restore temperature to
00219 !                                                 melting point) (W/m2)
00220 !                                     PMELT = melting rate of snow (kg m-2 s-1)
00221 !                                     PRESTORE = surface restore flux (W m-2)
00222 !
00223 REAL, DIMENSION(:), INTENT(OUT)  :: PLEGI
00224 !                                     PLEGI = sublimation component of the 
00225 !                                             latent heat flux from the soil surface
00226 !
00227 REAL, DIMENSION(:), INTENT(OUT)  :: PUSTAR
00228 !                                     friction velocity
00229 REAL, DIMENSION(:), INTENT(OUT)  :: PTS_RAD    ! effective radiative temperature 
00230 !                                                of the natural surface (K)
00231 !
00232 REAL, DIMENSION(:), INTENT(OUT) ::    PDWGI1, PDWGI2
00233 !                                     PDWGI1   = near-surface liquid water equivalent
00234 !                                                volumetric ice content tendency
00235 !                                     PDWGI2   = deep ground liquid water equivalent
00236 !                                                volumetric ice content tendency
00237 !
00238 REAL, DIMENSION(:,:), INTENT(IN) ::   PDELTAT
00239 !                                      PDELTAT = change in temperature over the time
00240 !                                                step before adjustment owing to phase 
00241 !                                                changes (K)
00242 !
00243 REAL, DIMENSION(:,:), INTENT(IN)    :: PD_G, PWSATZ, PSOILHCAPZ, PSOILCONDZ
00244 !                                      PD_G   = Depth of bottom of Soil layers (m)
00245 !                                      PWSATZ    = porosity (m3/m3)
00246 !                                      PSOILHCAPZ=ISBA-DF Soil heat capacity profile [J/(m3 K)]
00247 !                                      PSOILCONDZ= ISBA-DF Soil conductivity profile  [W/(m K)]
00248 !
00249 REAL, DIMENSION(:,:), INTENT(IN)    :: PDZG
00250 !                                      PDZG   = Layer thickness (DIF option)
00251 !
00252 REAL, DIMENSION(:,:), INTENT(IN)    :: PMPOTSATZ, PBCOEFZ
00253 !                                      PMPOTSATZ = matric potential at saturation (m)
00254 !                                      PBCOEFZ   = slope of the water retention curve (-)
00255 !
00256 REAL, DIMENSION(:), INTENT(IN)      :: PCPS, PLVTT, PLSTT
00257 !                                      PCPS  = heat capacity at surface
00258 !
00259 REAL, DIMENSION(:,:), INTENT(INOUT):: PWG, PWGI, PTG 
00260 !                                     PWGI   = soil frozen volumetric water content (m3/m3)
00261 !                                     PWG    = soil liquid volumetric water content (m3/m3)
00262 !                                     PTG    = soil temperature profile (K)
00263 !
00264 INTEGER, DIMENSION(:), INTENT(IN) :: KWG_LAYER  
00265 !                                    KWG_LAYER = Number of soil moisture layers (DIF option)
00266 !
00267 REAL, DIMENSION(:), INTENT(IN)   :: PFFV      !Floodplain fraction over vegetation
00268 REAL, DIMENSION(:), INTENT(IN)   :: PFF       !Floodplain fraction at the surface
00269 REAL, DIMENSION(:), INTENT(IN)   :: PFFG   !Efective floodplain fraction
00270 REAL, DIMENSION(:), INTENT(IN)   :: PFFROZEN  !fraction of frozen flood
00271 REAL, DIMENSION(:), INTENT(OUT)  :: PLE_FLOOD, PLEI_FLOOD !Floodplains latent heat flux           [W/mē]
00272 REAL, DIMENSION(:), INTENT(OUT)  :: PSNOWTEMP  ! snow layer temperatures (K)
00273 !
00274 REAL, DIMENSION(:), INTENT(OUT)     :: PTDIURN
00275 !                                      PTDIURN      = penetration depth for restore (m)
00276 !
00277 REAL, DIMENSION(:), INTENT(OUT)     :: PWGI_EXCESS
00278 !                                      PWGI_EXCESS = Soil ice excess water content
00279 !
00280 !*      0.2    declarations of local variables
00281 !
00282 REAL                        ::   ZKSOIL     ! coefficient for soil freeze/thaw
00283 !
00284 REAL, DIMENSION(SIZE(PLAI)) :: ZZHV,                  
00285 !                                             for the calculation of the latent
00286 !                                             heat of evapotranspiration
00287 !
00288                                ZTN
00289 !                                             average temperature used in 
00290 !                                             the calculation of the 
00291 !                                             melting effect
00292 !
00293 REAL, DIMENSION(SIZE(PLAI)) ::   ZKSFC_FRZ, ZFREEZING, ZICE_MELT, ZWIM,       
00294                                  ZWIT, ZWGI1, ZWGI2, ZWM, ZSOILHEATCAP,       
00295                                  ZICEEFF, ZEFFIC, ZDT, ZKSFC_IVEG,            
00296                                  ZWGMIN, ZTGMAX, ZMATPOT, ZDELTAT,            
00297                                  ZDELTATI, ZLEGI
00298 !                                ZKSFC_FRZ    = surface insolation coefficient (kg m-2 K-1)
00299 !                                ZKSFC_IVEG   = non-dimensional vegetation insolation coefficient
00300 !                                ZFREEZING    = rate for freezing soil water (kg m-2)
00301 !                                ZICE_MELT    = rate for melting soil ice (kg m-2)
00302 !                                ZWIM,ZWIT    = available ice content (m3 m-3)
00303 !                                ZWGI1,ZWGI2  = volumetric ice contents (m3 m-3)
00304 !                                ZWM          = available liquid water content (m3 m-3)
00305 !                                ZSOILHEATCAP = soil heat capacity (J  m-3 K-1)
00306 !                                ZICEEFF      = effective soil ice penetration depth (m)
00307 !                                ZEFFIC       = phase change efficiency
00308 !                                ZDT          = initial temperature change over time step (K)
00309 !                                ZMATPOT      = soil matric potential (m)
00310 !                                ZWGMIN       = volumetric water content above which soil water can
00311 !                                               be unfrozen (if energy and mass available)(m3 m-3)
00312 !                                ZTGMAX       = temperature below which liquid water 
00313 !                                               can be frozen (if energy and mass available)(K)
00314 !                                ZDELTA       = Freezing or melting temperature depression (K) after 
00315 !                                               possible flux correction
00316 !                                ZDELTAI      = Initial Freezing or melting temperature depression (K)
00317 !
00318 REAL, DIMENSION(SIZE(PLAI)) ::  ZPSN, ZPSNV, ZPSNG, ZFRAC
00319 !                               ZPSN, ZPSNV, ZPSNG = snow fractions corresponding to
00320 !                                                    dummy arguments PPSN, PPSNG, PPSNV
00321 !                                                    if HSNOW_ISBA = 'DEF' (composite
00322 !                                                    or Force-Restore snow scheme), else
00323 !                                                    they are zero for explicit snow case
00324 !                                                    as snow fluxes calculated outside of
00325 !                                                    this routine using the 
00326 !                                                    HSNOW_ISBA = '3-L' option.
00327 !
00328 REAL, DIMENSION(SIZE(PLAI)) ::  ZNEXTSNOW
00329 !                               ZNEXTSNOW = Futur snow reservoir to close the
00330 !                                           energy budget (see hydro_snow.f90)
00331 !
00332 REAL, DIMENSION(SIZE(PLAI)) ::  ZCONDAVG, ZWSAT_AVGZ, ZTAUICE
00333 !                               ZCONDAVG   = average thermal conductivity of surface
00334 !                                            and sub-surface layers (W m-1 K-1)
00335 !                               ZWSAT_AVGZ = soil column average porosity (m3 m-3)
00336 !                               ZTAUICE    = Caracteristic time for ice in force-restore 
00337 !                                            if Ptstep > 3300s
00338 !
00339 !
00340 !*      0.2    local arrays for EBA scheme
00341 !
00342 REAL                            :: ZEPS1
00343 !
00344 !*      0.3    declarations of local parameters
00345 !
00346 REAL, PARAMETER             :: ZINSOLFRZ_VEG = 0.20  ! (-)       Vegetation insolation coefficient
00347 !
00348 REAL, PARAMETER             :: ZINSOLFRZ_LAI = 30.0  ! (m2 m-2)  Vegetation insolation coefficient
00349 !
00350 REAL, PARAMETER             :: ZTWGHT     = 0.50 ! (-)   (0 < ZTWGHT <= 1/2)
00351 !                                                                Weight for averaging the actual and flux corrected
00352 !                                                                temperature depressions. Default is 1/2
00353 !                                                                If ZTWGHT=0, then flux correction is OFF.
00354 REAL, PARAMETER             :: ZEFFIC_MIN = 0.01 ! (-)   (0 <= ZEFFIC_MIN << 1)
00355 !                                                                This parameter ensures
00356 !                                                                a small minimum melt or freeze efficiency...
00357 !                                                                It is numerical. When it is small, it has
00358 !                                                                a only small impact on results, except
00359 !                                                                that it keeps very small values of ice from persisting
00360 !                                                                over long periods of time as they approach zero.
00361 !                                                                If it is zero, then this effect off.
00362 !
00363 REAL, PARAMETER :: ZTIMEMAX = 900.  ! s  Maximum timescale for ice soil dif
00364 !
00365 REAL            :: ZTSTEP      ! maximum time split time step (<= PTSTEP)
00366 !                              ! ONLY used for DIF option.
00367 !
00368 INTEGER         :: JJ
00369 INTEGER         :: INDT, JDT   ! Time splitting indicies
00370 !
00371 REAL, DIMENSION(SIZE(PLAI))          :: ZWORK1, ZWORK2, ZWORK3, ZWGI_EXCESS
00372 !
00373 REAL(KIND=JPRB) :: ZHOOK_HANDLE
00374 !-------------------------------------------------------------------------------
00375 !
00376 !-------------------------------------------------------------------------------
00377 !
00378 !*       0.     Initialization
00379 !               --------------
00380 IF (LHOOK) CALL DR_HOOK('ISBA_FLUXES',0,ZHOOK_HANDLE)
00381 IF (HSNOW_ISBA == 'EBA') ZEPS1=1.0E-8
00382 !
00383 PMELT(:)        = 0.0
00384 PLER(:)         = 0.0 
00385 !
00386 ZTN(:)          = 0.0
00387 !
00388 ZFREEZING(:)    = 0.0
00389 ZKSFC_FRZ(:)    = 0.0
00390 ZKSFC_IVEG(:)   = 0.0
00391 ZEFFIC(:)       = 0.0
00392 ZICE_MELT(:)    = 0.0
00393 ZWGI1(:)        = 0.0
00394 ZWIM(:)         = 0.0
00395 ZSOILHEATCAP(:) = 0.0
00396 PTDIURN(:)      = 0.0
00397 ZWIT(:)         = 0.0
00398 ZWGI2(:)        = 0.0
00399 ZCONDAVG(:)     = 0.0
00400 ZTGMAX(:)       = 0.0
00401 ZWGMIN(:)       = 0.0
00402 ZMATPOT(:)      = 0.0
00403 ZWSAT_AVGZ(:)   = XUNDEF
00404 !
00405 PWGI_EXCESS(:)  = 0.0
00406 ZWGI_EXCESS(:)  = 0.0
00407 !
00408 ! If ISBA-ES option in use, then snow covered surface
00409 ! fluxes calculated outside of this routine, so set
00410 ! the local snow fractions here to zero:
00411 ! 
00412 IF(HSNOW_ISBA == '3-L' .OR. HSNOW_ISBA == 'CRO' .OR. HISBA == 'DIF')THEN
00413    ZPSN(:)      = 0.0
00414    ZPSNG(:)     = 0.0
00415    ZPSNV(:)     = 0.0
00416 ELSE
00417    ZPSN(:)      = PPSN(:)
00418    ZPSNG(:)     = PPSNG(:)+PFFG(:)
00419    ZPSNV(:)     = PPSNV(:)+PFFV(:)
00420    ZFRAC(:)     = PPSNG(:)
00421 ENDIF
00422 !
00423 !
00424 DO JJ=1,SIZE(PTG,1)
00425 !-------------------------------------------------------------------------------
00426 !*       1.     FLUX CALCULATIONS
00427 !               -----------------
00428 !                                            temperature change
00429   ZDT(JJ)      = PTG(JJ,1) - PTSM(JJ)
00430 !
00431 !                                            net radiation
00432 !
00433   PRN(JJ)      = (1. - PALBT(JJ)) * PSW_RAD(JJ) + PEMIST(JJ) *      &
00434               (PLW_RAD(JJ) - XSTEFAN * (PTSM(JJ)** 3)*(4.*PTG(JJ,1) - 3.*PTSM(JJ)))
00435 !
00436   PTS_RAD(JJ)=((PTSM(JJ)** 3)*(4.*PTG(JJ,1) - 3.*PTSM(JJ)))**0.25
00437 !                                            sensible heat flux
00438 !
00439   PH(JJ)       = PRHOA(JJ) * PCPS(JJ) * (PTG(JJ,1) - PTA(JJ)*PEXNS(JJ)/PEXNA(JJ)) &
00440               / PRA(JJ) / PEXNS(JJ)
00441 !
00442   ZWORK1(JJ) = PRHOA(JJ) * (1.-PVEG(JJ))*(1.-ZPSNG(JJ)) / PRA(JJ)
00443   ZWORK2(JJ) = PQSAT(JJ)+PDQSAT(JJ)*ZDT(JJ) 
00444 !                                            latent heat of sublimation from
00445 !                                            the ground
00446 !
00447   PLEGI(JJ)    = ZWORK1(JJ) * PLSTT(JJ) * ( PHUI(JJ) * ZWORK2(JJ) - PQA(JJ)) * PFROZEN1(JJ) * PLEGI_DELTA(JJ)
00448 !
00449 !                                            total latent heat of evaporation from
00450 !                                            the ground
00451 !
00452   PLEG(JJ)     = ZWORK1(JJ) * PLVTT(JJ) * ( PHUG(JJ) * ZWORK2(JJ) - PQA(JJ)) * (1.-PFROZEN1(JJ)) * PLEG_DELTA(JJ)
00453 !
00454   ZWORK2(JJ) = PRHOA(JJ) * (ZWORK2(JJ) - PQA(JJ))
00455   ZWORK3(JJ) = ZWORK2(JJ) / PRA(JJ)
00456 !                                            latent heat of evaporation from 
00457 !                                            the snow canopy
00458 !
00459   PLES(JJ)     = PLSTT(JJ) * ZPSN(JJ) * ZWORK3(JJ)
00460 !
00461 !                                            latent heat of evaporation from
00462 !                                            evaporation
00463 !
00464   PLEV(JJ)     = PLVTT(JJ) * PVEG(JJ)*(1.-ZPSNV(JJ)) * PHV(JJ) * ZWORK3(JJ)
00465 !
00466 !                                            latent heat of evapotranspiration
00467 !                                            
00468   ZZHV(JJ)     = MAX(0., SIGN(1.,PQSAT(JJ) - PQA(JJ)))
00469   PLETR(JJ)    = ZZHV(JJ) * (1. - PDELTA(JJ)) * PLVTT(JJ) * PVEG(JJ)*(1-ZPSNV(JJ))          &
00470                * ZWORK2(JJ) *( (1/(PRA(JJ) + PRS(JJ))) - ((1.-PF5(JJ))/(PRA(JJ) + XRS_MAX)) )
00471 !               
00472 !
00473   PLER(JJ)     = PLEV(JJ) - PLETR(JJ)
00474 !
00475 !                                            latent heat of free water (floodplains)
00476 !
00477   PLE_FLOOD(JJ)  = PLVTT(JJ) * (1.-PFFROZEN(JJ)) * PFF(JJ) * ZWORK3(JJ) 
00478 !
00479   PLEI_FLOOD(JJ) = PLSTT(JJ) * PFFROZEN(JJ) * PFF(JJ) * ZWORK3(JJ) 
00480 !
00481 !                                            total latent heat of evaporation
00482 !                                            without flood
00483 !
00484   PLE(JJ)      = PLEG(JJ) + PLEV(JJ) + PLES(JJ) + PLEGI(JJ)
00485 !
00486 !                                            heat flux into the ground
00487 !                                            without flood
00488 !
00489   PGFLUX(JJ)   = PRN(JJ) - PH(JJ) - PLE(JJ)
00490 !
00491 !                                            heat flux due to snow melt
00492 !                                            (ISBA-ES/SNOW3L)
00493 !
00494   PMELTADV(JJ) = PSNOW_THRUFAL(JJ)*XCL*(XTT - PTG(JJ,1))
00495 !
00496 !                                            restore heat flux in FR mode,
00497 !                                            or surface to sub-surface heat
00498 !                                            flux using the DIF mode.
00499 !
00500 !
00501   PEVAP(JJ)    = ((PLEV(JJ) + PLEG(JJ))/PLVTT(JJ)) + ((PLEGI(JJ) + PLES(JJ))/PLSTT(JJ))
00502 !                                            total evaporative flux (kg/m2/s)
00503 !                                            without flood
00504 !-------------------------------------------------------------------------------
00505 !
00506 !*       2.     FRICTION VELOCITY
00507 !               -----------------
00508 !
00509 !
00510   PUSTAR(JJ) = SQRT(PUSTAR2(JJ))
00511 !
00512 ENDDO
00513 
00514 IF(HSNOW_ISBA == 'D95')THEN
00515 !cdir nodep
00516   DO JJ=1,SIZE(PTG,1)
00517     PLE    (JJ)  = PLE    (JJ) + PLE_FLOOD(JJ) + PLEI_FLOOD(JJ)
00518     PGFLUX (JJ)  = PGFLUX (JJ) - PLE_FLOOD(JJ) - PLEI_FLOOD(JJ)
00519     PEVAP  (JJ)  = PEVAP  (JJ) + PLE_FLOOD(JJ)/PLVTT(JJ) + PLEI_FLOOD(JJ)/PLSTT(JJ)
00520   ENDDO
00521 ENDIF
00522 !
00523 IF (HISBA /= 'DIF') THEN
00524 !
00525 ! "Restore" flux between surface and deep layer:
00526 !
00527    PRESTORE(:) = 2.0*XPI*(PTG(:,1)-PT2M(:))/(PCT(:)*XDAY)  
00528 !
00529    IF(OTEMP_ARP)THEN
00530       PRESTORE(:)=2.0*XPI*(PTG(:,1)-PTG(:,2))/(PCT(:)*XDAY*PSODELX(1)*(PSODELX(1)+PSODELX(2)))
00531    ENDIF
00532 !
00533 ELSE
00534 !
00535 ! "Restore" flux here is actually the heat flux between the surface
00536 ! and sub-surface layers:
00537 !
00538   DO JJ=1,SIZE(PTG,1)
00539     ZCONDAVG(JJ) = (PDZG(JJ,1)*PSOILCONDZ(JJ,1) + PDZG(JJ,2)*PSOILCONDZ(JJ,2))/PD_G(JJ,2)
00540     PRESTORE(JJ) = 2.*ZCONDAVG(JJ)*(PTG(JJ,1)-PTG(JJ,2))/PD_G(JJ,2)
00541   ENDDO
00542 !
00543 ENDIF
00544 !
00545 !-------------------------------------------------------------------------------
00546 !
00547 !*       3.     SNOWMELT LATENT HEATING EFFECTS ('DEF' option)
00548 !               ----------------------------------------------
00549 !
00550 IF( (HSNOW_ISBA == 'D95' .OR. HSNOW_ISBA == 'EBA') .AND. HISBA /= 'DIF' )THEN
00551 !                                            temperature tn
00552 !
00553     IF (HSNOW_ISBA == 'D95') THEN
00554 !           
00555       ZTN       (:) = (1.-PVEG(:))*PTG(:,1) + PVEG(:)*PT2M(:)
00556 !
00557 !     Only diag
00558       PSNOWTEMP (:) = ZTN (:)
00559 !
00560 !
00561 !                                            melting rate
00562 !                                            there is melting only if T > T0 and
00563 !                                            of course when SNOWSWE > 0.
00564 !
00565       WHERE ( ZTN(:) > XTT .AND. PSNOWSWE(:) > 0.0 )
00566         PMELT(:) = ZPSN(:)*(ZTN(:)-XTT) / (PCS(:)*XLMTT*MAX(XTAU_SMELT,PTSTEP))
00567       END WHERE
00568 !
00569 !                                            close the energy budget: cannot melt 
00570 !                                            more than the futur available snow
00571 !      
00572       ZNEXTSNOW(:) = PSNOWSWE(:) + PTSTEP * (PSR(:) - PLES(:) / PLSTT(:))
00573 !
00574       WHERE ( PMELT(:) > 0.0 )
00575 !              
00576               PMELT(:)=MIN(PMELT(:),ZNEXTSNOW(:)/PTSTEP)      
00577               ZNEXTSNOW(:) = ZNEXTSNOW(:) - PTSTEP * PMELT
00578 !              
00579 !             removes very small fraction
00580               ZFRAC(:) = SNOW_FRAC_GROUND(ZNEXTSNOW(:))
00581               WHERE(ZFRAC(:)<1.0E-4)
00582                     PMELT(:)     = PMELT(:) + ZNEXTSNOW(:) / PTSTEP       
00583               ENDWHERE   
00584 !       
00585       ENDWHERE   
00586 !    
00587     ELSEIF (HSNOW_ISBA == 'EBA') THEN
00588 !    
00589       PMELT(:)=MIN( PSNOWSWE(:)/PTSTEP + PSR(:) - PLES(:)/PLSTT(:) , &
00590                     MAX(0.0,(PTG(:,1)-XTT))  / MAX(ZEPS1,PCT*PTSTEP) / XLMTT )
00591 !
00592     ENDIF
00593 !
00594 !                                            new temperature Ts(t) after melting
00595 !                                            (cooling due to the melting of the
00596 !                                            snow)
00597 !
00598   PTG(:,1) = PTG(:,1) - PCT(:)*XLMTT*PMELT(:)*PTSTEP
00599 !
00600 ENDIF
00601 !
00602 !-------------------------------------------------------------------------------
00603 !
00604 !*       4.     EFFECT OF THE MELTING/FREEZING 
00605 !               ON THE SOIL HEAT AND ICE CONTENTS
00606 !               ('DIF' soil option)
00607 !               ---------------------------------
00608 !
00609 ! The values for the two coefficients (multiplied by VEG and LAI) 
00610 ! in the expression below are from 
00611 ! Giard and Bazile (2000), Mon. Wea. Rev.: they model the effect of insolation due to
00612 ! vegetation cover. This used by both 'DEF' (code blocks 3.-4.) and 'DIF' options.
00613 !
00614 WHERE(PLAI(:)/=XUNDEF .AND. PVEG(:)/=0.)
00615     ZKSFC_IVEG(:) = (1.0-ZINSOLFRZ_VEG*PVEG(:)) * (1.0-(PLAI(:)/ZINSOLFRZ_LAI))
00616 ELSEWHERE
00617     ZKSFC_IVEG(:) = 1.0 ! No vegetation
00618 ENDWHERE
00619 !
00620 !
00621 IF (HISBA == 'DIF') THEN
00622 !
00623 ! Determine soil phase changes and ice evolution:
00624 !
00625    ZLEGI(:) = (1.0-PPSNG(:)-PFFG(:))*PLEGI(:)
00626 !
00627    INDT = MAX(1,NINT(PTSTEP/ZTIMEMAX))
00628 !
00629    ZTSTEP = PTSTEP/REAL(INDT)
00630 !
00631   DO JDT = 1,INDT
00632      CALL ICE_SOILDIF(ZTSTEP, PTAUICE, ZKSFC_IVEG, ZLEGI,     &
00633                       PSOILHCAPZ, PWSATZ, PMPOTSATZ, PBCOEFZ, &
00634                       PTG, PWGI, PWG, KWG_LAYER,              &
00635                       PDELTAT,  PDZG,  ZWGI_EXCESS            )
00636 
00637      PWGI_EXCESS(:) = PWGI_EXCESS(:) + ZWGI_EXCESS(:)/REAL(INDT)
00638   ENDDO                      
00639 !
00640 ELSE
00641 !
00642 !*       5.1    Melting/freezing normalized coefficient
00643 !               ---------------------------------------
00644 !
00645   ZKSOIL       = (0.5 * SQRT(XCONDI*XCI*XRHOLI*XDAY/XPI))/XLMTT
00646 !
00647   ZTAUICE (:) = MAX(PTSTEP,PTAUICE(:))
00648 !
00649   DO JJ=1,SIZE(PTG,1)
00650 !-------------------------------------------------------------------------------
00651 !*       5.     EFFECT OF THE MELTING/FREEZING 
00652 !               ON THE SURFACE-SOIL HEAT AND ICE CONTENTS
00653 !               ('DEF' or Force-Restore soil option)
00654 !               -----------------------------------------
00655 !
00656 !        5.0    Average soil-column porosity
00657 !               ----------------------------
00658 !               if Force-Restore option in use, then vertical
00659 !               profiles of soil hydrological parameters are constant,
00660 !               so use the values in uppermost element (arbitrary)
00661 !
00662     ZWSAT_AVGZ(JJ) = PWSATZ(JJ,1)
00663 !
00664 !
00665 !               Influence of vegetation insolation on surface:
00666 !
00667     ZKSFC_FRZ(JJ) = ZKSOIL * ZKSFC_IVEG(JJ)
00668 !
00669   ENDDO
00670 !*       5.2    Water freezing
00671 !               --------------
00672 !
00673   IF(HSOILFRZ == 'LWT')THEN
00674 !
00675 ! use option to control phase changes based on a relationship
00676 ! between the unfrozen liquid water content and temperature.
00677 ! Uses the Clapp and Hornberger model for water potential.
00678 ! The energy-limit method used by Boone et al. 2000 and
00679 ! Giard and Bazile (2000) is the default. 
00680 !
00681     DO JJ=1,SIZE(PTG,1)
00682       ZMATPOT(JJ)   = MIN(PMPOTSATZ(JJ,1), XLMTT*(PTG(JJ,1)-XTT)/(XG*PTG(JJ,1)) )
00683       ZWGMIN(JJ)    = ZWSAT_AVGZ(JJ)*( (ZMATPOT(JJ)/PMPOTSATZ(JJ,1))**(-1./PBCOEFZ(JJ,1)) )
00684 
00685       ZMATPOT(JJ)   = PMPOTSATZ(JJ,1)*( (PWG(JJ,1)/ZWSAT_AVGZ(JJ))**(-PBCOEFZ(JJ,1)) )
00686       ZTGMAX(JJ)    = XLMTT*XTT/(XLMTT - XG* ZMATPOT(JJ))
00687     ENDDO
00688   ELSE
00689     ZWGMIN(:)    = XWGMIN
00690     ZTGMAX(:)    = XTT
00691   ENDIF
00692 !
00693 !
00694    ZDELTATI(:)  = PTG(:,1) - ZTGMAX(:) ! initial temperature depression 
00695 !
00696 ! Limit phase change energy by energy actually available for phase changes:
00697 ! (this has little effect generally but was found to prevent oscillations
00698 ! between soil T and water/ice in rare circumstances, notably for large time steps).
00699 ! We take an average of this flux-limited value and actual
00700 ! (one could eventually put in a time dependence on the weights used in averaging,
00701 ! perhaps giving larger weight to limited flux for larger time steps...for now
00702 ! just a constant factor assumed)
00703 !
00704    ZDELTAT(:)  = ZDELTATI(:)
00705    ZDELTAT(:)  = MIN(ZDELTAT(:), MAX(0.0,ZDT(:)))
00706    ZDELTAT(:)  = MAX(ZDELTAT(:), MIN(0.0,ZDT(:)))
00707    ZDELTAT(:)  = ZTWGHT*ZDELTAT(:) + (1.0-ZTWGHT)*ZDELTATI(:)   
00708    WHERE(ZDT(:)*ZDELTAT(:) < 0.0)ZDELTAT(:) = 0.0
00709 !
00710 
00711   DO JJ=1,SIZE(PTG,1)
00712 !    
00713     ZWORK2(JJ) = XRHOLW*PD_G(JJ,1)
00714     ZEFFIC(JJ)    = MAX(ZEFFIC_MIN,(PWG(JJ,1)-XWGMIN)/ZWSAT_AVGZ(JJ))
00715     ZFREEZING(JJ) = MIN( MAX(0.0,PWG(JJ,1)-ZWGMIN(JJ))*ZWORK2(JJ),    &  
00716                   ZKSFC_FRZ(JJ)*ZEFFIC(JJ)*MAX( -ZDELTAT(JJ), 0.) )
00717 !
00718 !*       5.3    Ground Ice melt
00719 !               ---------------
00720 !
00721     ZEFFIC(JJ)    =  MAX(ZEFFIC_MIN,PWGI(JJ,1)/(ZWSAT_AVGZ(JJ)-XWGMIN))
00722     ZICE_MELT(JJ) = MIN( PWGI(JJ,1)*ZWORK2(JJ),                      &
00723                   ZKSFC_FRZ(JJ)*ZEFFIC(JJ)*MAX( ZDELTAT(JJ), 0. ) )
00724 !
00725 !*       5.4    Ice reservoir evolution
00726 !               -----------------------
00727 !
00728 ! Melting of ice/freezing of water:
00729 !
00730     ZWGI1(JJ) = PWGI(JJ,1) + (PTSTEP/ZTAUICE(JJ))*(1.0-ZPSNG(JJ))*        &
00731               (ZFREEZING(JJ) - ZICE_MELT(JJ))/ZWORK2(JJ) 
00732 !
00733 !
00734     ZWGI1(JJ)  = MAX( ZWGI1(JJ) , 0.             )
00735     ZWGI1(JJ)  = MIN( ZWGI1(JJ) , ZWSAT_AVGZ(JJ)-XWGMIN)
00736 !
00737 ! Time tendency:
00738 !
00739     PDWGI1(JJ) = ZWGI1(JJ) - PWGI(JJ,1)
00740 !
00741 !
00742 !*       5.5    Effect on temperature
00743 !               ---------------------
00744 !
00745     PTG(JJ,1)   = PTG(JJ,1) + PDWGI1(JJ)*XLMTT*PCT(JJ)*ZWORK2(JJ)
00746 !
00747 !-------------------------------------------------------------------------------
00748 !
00749 !*       6.     EFFECT OF THE MELTING/FREEZING 
00750 !               ON THE DEEP-SOIL HEAT AND ICE CONTENTS
00751 !               ('DEF' or Force-Restore soil option)
00752 !               --------------------------------------
00753 !
00754     ZWORK1(JJ) = PD_G(JJ,1)/PD_G(JJ,2)
00755 !*       6.1  Available Deep ice content
00756 !             --------------------------
00757 !
00758     ZWIM(JJ) = ( PWGI(JJ,2) - ZWORK1(JJ) * PWGI(JJ,1) )  / ( 1. - ZWORK1(JJ) )
00759 !
00760     ZWIM(JJ) = MAX(0.,ZWIM(JJ))  ! Just in case of round-off errors
00761 !
00762 !*       6.2  Deep liquid water content
00763 !             -------------------------
00764 !
00765     ZWM(JJ)  = ( PWG(JJ,2) - ZWORK1(JJ) * PWG(JJ,1) )  / ( 1. - ZWORK1(JJ) )
00766 !
00767 !*       6.3    Water freezing
00768 !               --------------
00769 !
00770 ! Total soil volumetric heat capacity [J/(m3 K)]:
00771 !
00772     ZSOILHEATCAP(JJ) = XCL*XRHOLW*PWG(JJ,2)  +                           &
00773                      XCI*XRHOLI*PWGI(JJ,2) +                           &
00774                      XSPHSOIL*XDRYWGHT*(1.0-ZWSAT_AVGZ(JJ))*(1.0-ZWSAT_AVGZ(JJ))
00775 !
00776 ! Soil thickness which corresponds to T2 (m): 2 times the diurnal
00777 ! surface temperature wave penetration depth as T2 is the average
00778 ! temperature for this layer:
00779 !
00780     PTDIURN(JJ)   = MIN(PD_G(JJ,2), 4./(ZSOILHEATCAP(JJ)*PCG(JJ)))
00781 !
00782 ! Effective soil ice penetration depth (m):
00783 !
00784     ZICEEFF(JJ)   = (PWGI(JJ,2)/(PWGI(JJ,2)+PWG(JJ,2)))*PD_G(JJ,2)
00785 !
00786     ZDT(JJ)       = PTG(JJ,2) - PT2M(JJ) ! temperature depression (K)
00787 !
00788   ENDDO
00789 
00790   IF(HSOILFRZ == 'LWT')THEN
00791 !
00792 ! as for the surface layer (above)JJ 
00793 ! Note also that if the 'DIF'
00794 ! soil option is not in force, then the soil parameters are assumed
00795 ! to be homogeneous (in the verticalJJ thus we use 1st element of 2nd dimension
00796 ! of the 2D-soil parameter arrays).
00797 !
00798     DO JJ=1,SIZE(PTG,1)
00799 
00800        ZMATPOT(JJ)   = MIN(PMPOTSATZ(JJ,1), XLMTT*(PTG(JJ,2)-XTT)/(XG*PTG(JJ,2)) )
00801        ZWGMIN(JJ)    = ZWSAT_AVGZ(JJ)*( (ZMATPOT(JJ)/PMPOTSATZ(JJ,1))**(-1./PBCOEFZ(JJ,1)) )
00802 
00803        ZMATPOT(JJ)   = PMPOTSATZ(JJ,1)*( (PWG(JJ,2)/ZWSAT_AVGZ(JJ))**(-PBCOEFZ(JJ,1)) )
00804        ZTGMAX(JJ)    = XLMTT*XTT/(XLMTT - XG* ZMATPOT(JJ))
00805     ENDDO
00806   ELSE
00807     ZWGMIN(:)    = XWGMIN
00808     ZTGMAX(:)    = XTT
00809   ENDIF
00810 !
00811    ZDELTATI(:)  = PTG(:,2) - ZTGMAX(:) ! initial temperature depression 
00812 !
00813 ! Limit phase change energy by energy actually available for phase changes:
00814 ! (this has little effect generally but was found to prevent oscillations
00815 ! between soil T and water/ice in rare circumstances, notably for large time steps).
00816 ! We take an average of this flux-limited value and actual
00817 ! (one could eventually put in a time dependence on the weights used in averaging,
00818 ! perhaps giving larger weight to limited flux for larger time steps...for now
00819 ! just a constant factor assumed)
00820 !
00821    ZDELTAT(:)  = ZDELTATI(:)
00822    ZDELTAT(:)  = MIN(ZDELTAT(:), MAX(0.0,ZDT(:)))
00823    ZDELTAT(:)  = MAX(ZDELTAT(:), MIN(0.0,ZDT(:)))
00824    ZDELTAT(:)  = ZTWGHT*ZDELTAT(:) + (1.0-ZTWGHT)*ZDELTATI(:)   
00825    WHERE(ZDT(:)*ZDELTAT(:) < 0.0)ZDELTAT(:) = 0.0
00826 !
00827 ! Allow freezing by T2 up to a certain depth so that
00828 ! T2 energy can not be used to freeze soil water
00829 ! at levels sufficiently deep in the soil.
00830 !
00831   DO JJ=1,SIZE(PTG,1)
00832   
00833     ZWORK1(JJ) = PD_G(JJ,1)/PD_G(JJ,2)
00834     ZWORK2(JJ) = XRHOLW*(PD_G(JJ,2)-PD_G(JJ,1))
00835 
00836     ZFREEZING(JJ) = 0.0
00837     IF (ZICEEFF(JJ) <= PTDIURN(JJ)) THEN
00838 !
00839       ZEFFIC(JJ)    = MAX(ZEFFIC_MIN, MAX(0.0,ZWM(JJ) - XWGMIN)/ZWSAT_AVGZ(JJ))
00840       ZFREEZING(JJ) = MIN( MAX(0.0, ZWM(JJ) - ZWGMIN(JJ))* ZWORK2(JJ),            &
00841                      ZKSOIL*ZEFFIC(JJ)*MAX( -ZDELTAT(JJ) , 0. ) )
00842     ENDIF
00843 !
00844 !
00845 !*       6.4    Ground Ice melt
00846 !               ---------------
00847 !
00848     ZEFFIC(JJ)    = MAX(ZEFFIC_MIN, ZWIM(JJ)/(ZWSAT_AVGZ(JJ)-XWGMIN))
00849     ZICE_MELT(JJ) = MIN( ZWIM(JJ)*ZWORK2(JJ),             &
00850                   ZKSOIL*ZEFFIC(JJ)*MAX( ZDELTAT(JJ) , 0. ) )
00851 !
00852 !
00853 !*       6.5    Deep-part of deep-soil Ice reservoir evolution
00854 !               ----------------------------------------------
00855 !
00856     ZWIT(JJ)   = ZWIM(JJ) + (PTSTEP/ZTAUICE(JJ))*(1.0-ZPSNG(JJ))*       &
00857                ((ZFREEZING(JJ) - ZICE_MELT(JJ))/ ZWORK2(JJ))
00858 !
00859     ZWIT(JJ)   = MAX( ZWIT(JJ) , 0.             )
00860     ZWIT(JJ)   = MIN( ZWIT(JJ) , ZWSAT_AVGZ(JJ)-XWGMIN)
00861 !
00862 !
00863 !*       6.6    Add reservoir evolution from surface freezing (WI2 contains WI1)
00864 !               ----------------------------------------------------------------
00865 !
00866     ZWGI2(JJ)  = (1.-ZWORK1(JJ))*ZWIT(JJ) +  ZWORK1(JJ)*ZWGI1(JJ)
00867 !
00868     PDWGI2(JJ) = ZWGI2(JJ) - PWGI(JJ,2)
00869 !
00870 !
00871 !*       6.7    Effect on temperature
00872 !               ---------------------
00873 !
00874     PTG(JJ,2) = PTG(JJ,2) + PDWGI2(JJ)*XLMTT*PCG(JJ)*XRHOLW*PD_G(JJ,2)
00875 !
00876   ENDDO
00877 ENDIF
00878 !
00879 IF (LHOOK) CALL DR_HOOK('ISBA_FLUXES',1,ZHOOK_HANDLE)
00880 !-------------------------------------------------------------------------------
00881 END SUBROUTINE ISBA_FLUXES
00882 
00883 
00884 
00885 
00886 
00887 
00888 
00889 
00890 
00891 
00892