SURFEX v7.3
General documentation of Surfex
 All Classes Files Functions Variables Typedefs
/home/dasprezs/EXPORT_v7_3/src/SURFEX/isba.F90
Go to the documentation of this file.
00001 !     #########
00002       SUBROUTINE ISBA(HISBA, HPHOTO, OTR_ML, HRUNOFF, HKSAT, HSOC, HRAIN, HHORT, &
00003                       HC1DRY, HSCOND, HSNOW_ISBA, HSNOWRES, HCPSURF, HSOILFRZ,   &
00004                       HDIFSFCOND, TPTIME, OFLOOD, OTEMP_ARP, OGLACIER, PTSTEP,   &
00005                       HIMPLICIT_WIND, PCGMAX, PZREF, PUREF, PDIRCOSZW,           &
00006                       PTA, PQA, PEXNA, PRHOA, PPS, PEXNS, PRR, PSR, PZENITH,     &
00007                       PSW_RAD, PLW_RAD, PVMOD, PPEW_A_COEF, PPEW_B_COEF,         &
00008                       PPET_A_COEF, PPEQ_A_COEF, PPET_B_COEF, PPEQ_B_COEF, PRSMIN,&
00009                       PRGL, PGAMMA, PCV, PRUNOFFD, PSOILWGHT, KLAYER_HORT,       &
00010                       KLAYER_DUN, PALBNIR_TVEG, PALBVIS_TVEG, PALBNIR_TSOIL,     &
00011                       PALBVIS_TSOIL, PALB, PWRMAX_CF, PVEG, PLAI, PEMIS,         &
00012                       PZ0_WITH_SNOW, PZ0H_WITH_SNOW, PVEGTYPE, PZ0EFF, PRUNOFFB, &
00013                       PCGSAT, PC1SAT, PC2REF, PC3, PC4B, PC4REF, PACOEF, PPCOEF, &
00014                       PTAUICE, PWDRAIN, PTDEEP_A, PTDEEP_B, PGAMMAT,             &
00015                       PPSN, PPSNG, PPSNV,                                        &
00016                       PPSNV_A, PSNOWFREE_ALB_VEG, PSNOWFREE_ALB_SOIL, PIRRIG,    &
00017                       PWATSUP, PTHRESHOLD, LIRRIGATE, LIRRIDAY, OSTRESSDEF, PGC, &
00018                       PF2I, PDMAX, PAH, PBH, PCSP, PGMES, PPOI, PFZERO, PEPSO,   &
00019                       PGAMM, PQDGAMM, PQDGMES, PT1GMES, PT2GMES, PAMAX, PQDAMAX, &
00020                       PT1AMAX, PT2AMAX, PABC, PD_G, PDZG, PDZDIF, KWG_LAYER,     &
00021                       PROOTFRAC, PWFC, PWWILT, PWSAT, PBCOEF, PCONDSAT,          &
00022                       PMPOTSAT, PHCAPSOIL, PCONDDRY, PCONDSLD, PD_ICE, PKSAT_ICE,&
00023                       PMUF, PFF, PFFG, PFFV, PFFG_NOSNOW, PFFV_NOSNOW, PFFROZEN, &
00024                       PFALB, PFEMIS, PFFLOOD, PPIFLOOD, PIFLOOD, PPFLOOD,        &
00025                       PLE_FLOOD, PLEI_FLOOD,  PSODELX, PLAT, PLON, PTG, PWG,     &
00026                       PWGI, PCPS, PLVTT, PLSTT, PWR, PRESA, PANFM, PFSAT,        &
00027                       PSNOWALB, PSNOWSWE, PSNOWHEAT, PSNOWRHO, PSNOWGRAN1,       &
00028                       PSNOWGRAN2, PSNOWHIST, PSNOWAGE, PGRNDFLUX, PHPSNOW,       &
00029                       PSNOWHMASS, PSMELTFLUX, PRNSNOW, PHSNOW, PGFLUXSNOW,       &
00030                       PUSTARSNOW, PSRSFC, PRRSFC, PLESL, PEMISNOW, PCDSNOW,      &
00031                       PCHSNOW, PTS_RAD, PTS, PHV, PQS, PSNOWTEMP, PSNOWLIQ,      &
00032                       PSNOWDZ, PCG, PC1, PC2, PWGEQ, PCT, PCH, PCD, PCDN, PRI,   &
00033                       PHU, PHUG, PEMIST, PALBT, PRS, PLE, PRN, PH, PLEI, PLEGI,  &
00034                       PLEG, PLEV, PLES, PLER, PLETR, PEVAP, PGFLUX, PRESTORE,    &
00035                       PUSTAR, PDRAIN, PRUNOFF, PMELT, PMELTADV, PRN_ISBA,        &
00036                       PH_ISBA, PLEG_ISBA, PLEGI_ISBA, PLEV_ISBA, PLETR_ISBA,     &
00037                       PUSTAR_ISBA, PLER_ISBA, PLE_ISBA, PLEI_ISBA, PGFLUX_ISBA,  &
00038                       PHORT, PDRIP, PRRVEG, PAC_AGG, PHU_AGG, PFAPARC, PFAPIRC,  &
00039                       PMUS, PLAI_EFFC, PAN, PANDAY, PRESP_BIOMASS_INST, PIACAN,  &
00040                       PANF, PGPP, PFAPAR, PFAPIR, PFAPAR_BS, PFAPIR_BS,          &
00041                       PIRRIG_FLUX, PDEEP_FLUX                                    )                     
00042 !     ##########################################################################
00043 !
00044 !
00045 !!****  *ISBA*  
00046 !!
00047 !!    PURPOSE
00048 !!    -------
00049 !       Monitor for the calculation of the surface fluxes and of the
00050 !     prognostic variables of the surface over natural areas
00051 !     
00052 !!**  METHOD
00053 !!    ------
00054 !
00055 !!    EXTERNAL
00056 !!    --------
00057 !!
00058 !!    IMPLICIT ARGUMENTS
00059 !!    ------------------ 
00060 !!
00061 !!      
00062 !!    REFERENCE
00063 !!    ---------
00064 !!
00065 !!    Noilhan and Planton (1989)
00066 !!      
00067 !!    AUTHOR
00068 !!    ------
00069 !!      S. Belair           * Meteo-France *
00070 !!
00071 !!    MODIFICATIONS
00072 !!    -------------
00073 !!      Original    10/03/95 
00074 !!      (J.Stein)   25/10/95  add the rain flux computation at the ground
00075 !!                            and the lbc
00076 !!      (J.Stein)   15/11/95  include the strong slopes cases
00077 !!      (J.Stein)   06/02/96  bug correction for the precipitation flux writing 
00078 !!      (J.Stein)   20/05/96  set the right IGRID value for the rain rate
00079 !!      (J.Viviand) 04/02/97  add cold and convective precipitation rate
00080 !!      (J.Stein)   22/06/97  use the absolute pressure    
00081 !!      (V.Masson)  09/07/97  add directional z0 computations and RESA correction     
00082 !!      (V.Masson)  13/02/98  simplify the routine: only vegetation computation
00083 !!                            are now made here.
00084 !!      (A.Boone)   05/10/98  add: Boone et al. (1999) 3 soil-water Layers version
00085 !!      (V.Masson)                 Dumenil and Todini (1992) runoff
00086 !!                                 Calvet (1998) biomass and CO2 assimilation
00087 !!                                 Calvet (1998) LAI evolution
00088 !!      (A.Boone)  03/15/99   Soil ice scheme: modify CG, C1, C2, WSAT, WFC, WILT,
00089 !!                            LEG (add soil ice sublimation); Can modify TS and T2.
00090 !!                            New variables WGI1, WGI2
00091 !!      (A.Boone)  18/01/00   ISBA-ES (3-layer explicit snow scheme option)
00092 !!                            (Boone and Etchevers 2000)
00093 !!                            New variable PSNOWHEAT
00094 !!      (V. Masson) 01/2004   wet leaves fraction computed in separate routine
00095 !!                            all vegetation stress (ISBA, AGS, AST) routines
00096 !!                            called at the same point
00097 !!      (P. LeMoigne) 03/2004 computation of QSAT 
00098 !!      (P. LeMoigne) 10/2004 halstead coefficient as diagnostic for isba
00099 !!      (A. Bogatchev)09/2005 EBA snow option
00100 !!      (P. LeMoigne) 02/2006 z0h and snow
00101 !!      (B. Decharme) 05/2008 Add floodplains scheme
00102 !!      (R. Hamdi)    01/09   Cp and L are not constants (As in ALADIN)
00103 !!      (A.L. Gibelin)  03/2009 : Add respiration diagnostics
00104 !!      A.L. Gibelin   06/09 : move calculations of CO2 fluxes
00105 !!      A.L. Gibelin 07/2009 : Suppress PPST and PPSTF as outputs
00106 !!      (A. Boone)    11/2009 Add local variable: total soil temperature change (before
00107 !!                            phase change) for use by LWT scheme in ISBA-DIF. 
00108 !!      (A. Boone)    03/2010 Add local variable: delta functions for LEG and LEGI
00109 !!                            to numerically correct for when they should be
00110 !!                            zero when hug(i) Qsat < Qa and Qsat > Qa
00111 !!     (A. Carrer)    04/2011 : new radiative transfert (AGS)
00112 !!      (B. Decharme) 09/2012 Bug : Save snow albedo values at beginning
00113 !!                                  of time step for total albedo calculation
00114 !!                            Bug : flood fraction in COTWORES
00115 !!                            new wind implicitation
00116 !!                            Irrigation rate diag
00117 !-------------------------------------------------------------------------------
00118 !
00119 !*       0.     DECLARATIONS
00120 !               ------------
00121 USE MODD_CO2V_PAR,   ONLY : XMC, XMCO2, XPCCO2
00122 USE MODD_SURF_PAR,   ONLY : XUNDEF
00123 USE MODD_CSTS,       ONLY : XLVTT, XLSTT
00124 !
00125 USE MODD_TYPE_DATE_SURF, ONLY: DATE_TIME
00126 !
00127 USE MODI_SOIL
00128 USE MODI_SOILDIF
00129 USE MODI_SOILSTRESS
00130 USE MODI_WET_LEAVES_FRAC
00131 USE MODI_VEG
00132 USE MODI_DRAG
00133 USE MODI_SNOW3L_ISBA
00134 USE MODI_E_BUDGET
00135 USE MODI_HYDRO
00136 USE MODI_ISBA_SNOW_AGR
00137 !
00138 USE MODI_RADIATIVE_TRANSFERT
00139 USE MODI_COTWORES
00140 !
00141 USE MODI_ISBA_FLUXES
00142 !
00143 USE MODE_THERMOS
00144 !
00145 !
00146 !
00147 USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
00148 USE PARKIND1  ,ONLY : JPRB
00149 !
00150 IMPLICIT NONE
00151 !
00152 !*      0.1    declarations of arguments
00153 !              -------------------------
00154 !
00155 !
00156 !* general variables
00157 !  -----------------
00158 !
00159  CHARACTER(LEN=*),     INTENT(IN)  :: HISBA      ! type of ISBA version:
00160 !                                               ! '2-L' (default)
00161 !                                               ! '3-L'
00162 !                                               ! 'DIF'
00163  CHARACTER(LEN=*),     INTENT(IN)  :: HPHOTO     ! Kind of photosynthesis
00164 !                                               ! 'NON'
00165 !                                               ! 'AGS'
00166 !                                               ! 'LAI'
00167 !                                               ! 'AST'
00168 !                                               ! 'LST'
00169 LOGICAL,              INTENT(IN)  :: OTR_ML     ! new TR
00170  CHARACTER(LEN=*),     INTENT(IN)  :: HRUNOFF    ! surface runoff formulation
00171 !                                               ! 'WSAT'
00172 !                                               ! 'DT92'
00173 !                                               ! 'SGH ' Topmodel
00174  CHARACTER(LEN=*),     INTENT(IN)  :: HKSAT      ! soil hydraulic profil option
00175 !                                               ! 'DEF'  = ISBA homogenous soil
00176 !                                               ! 'SGH'  = ksat exponential decay
00177  CHARACTER(LEN=*),     INTENT(IN)  :: HSOC       ! soil organic carbon profil option
00178 !                                               ! 'DEF'  = ISBA homogenous soil
00179 !                                               ! 'SGH'  = SOC profile
00180  CHARACTER(LEN=*),     INTENT(IN)  :: HRAIN      ! Rainfall spatial distribution
00181                                                 ! 'DEF' = No rainfall spatial distribution
00182                                                 ! 'SGH' = Rainfall exponential spatial distribution
00183  CHARACTER(LEN=*),     INTENT(IN)  :: HHORT      ! Horton runoff
00184                                                 ! 'DEF' = no Horton runoff
00185                                                 ! 'SGH' = Horton runoff
00186  CHARACTER(LEN=*),     INTENT(IN)  :: HC1DRY     ! C1 for dry soil formulation
00187 !                                               ! 'DEF' Default: Giard and Bazile
00188 !                                               ! 'GB93' Giordani 1993, Braud 1993
00189 !                                               ! (discontinuous at WILT)
00190  CHARACTER(LEN=*),     INTENT(IN)  :: HSCOND     ! Thermal conductivity
00191 !                                               ! 'NP89' = NP89 implicit method
00192 !                                               ! 'PL98' = Peters-Lidard et al. 1998 used
00193 !                                               ! for explicit computation of CG
00194  CHARACTER(LEN=*),     INTENT(IN)  :: HSNOW_ISBA ! 'DEF' = Default F-R snow scheme
00195 !                                               !         (Douville et al. 1995)
00196 !                                               ! '3-L' = 3-L snow scheme (option)
00197 !                                               !         (Boone and Etchevers 2000)
00198  CHARACTER(LEN=*),     INTENT(IN)  :: HSNOWRES   ! 'DEF' = Default: Louis (ISBA)
00199 !                                               ! 'RIL' = CROCUS (Martin) method
00200 !                                               !  ISBA-SNOW3L turbulant exchange option
00201  CHARACTER(LEN=*),     INTENT(IN)  :: HCPSURF    ! Specific heat
00202 !                                               ! 'DRY' = dry Cp
00203 !                                               ! 'HUM' = humid Cp fct of qs
00204  CHARACTER(LEN=*),     INTENT(IN)  :: HSOILFRZ   ! soil freezing-physics option
00205 !                                               ! 'DEF'   Default (Boone et al. 2000; Giard and Bazile 2000)
00206 !                                               ! 'LWT'   phase changes as above, but relation between unfrozen 
00207 !                                                     water and temperature considered
00208  CHARACTER(LEN=*),     INTENT(IN)  :: HDIFSFCOND ! NOTE: Only used when HISBA = DIF
00209 !                                               ! MLCH' = include the insulating effect of leaf
00210 !                                               !         litter/mulch on the surface thermal cond.
00211 !                                               ! 'DEF' = no mulch effect
00212 !
00213 TYPE(DATE_TIME), INTENT(IN)       :: TPTIME     ! current date and time
00214 !
00215 LOGICAL, INTENT(IN)               :: OFLOOD     ! Activation of the flooding scheme
00216 LOGICAL, INTENT(IN)               :: OTEMP_ARP  ! True  = time-varying force-restore soil temperature (as in ARPEGE)
00217                                                 ! False = No time-varying force-restore soil temperature (Default)
00218 LOGICAL, INTENT(IN)               :: OGLACIER   ! True = Over permanent snow and ice, 
00219 !                                                     initialise WGI=WSAT,
00220 !                                                     Hsnow>=10m and allow 0.8<SNOALB<0.85
00221                                                 ! False = No specific treatment
00222 !
00223  CHARACTER(LEN=*),     INTENT(IN)  :: HIMPLICIT_WIND   ! wind implicitation option
00224 !                                                     ! 'OLD' = direct
00225 !                                                     ! 'NEW' = Taylor serie, order 1
00226 !
00227 REAL,                 INTENT(IN) :: PTSTEP      ! timestep of the integration
00228 !
00229 REAL,                 INTENT(IN) :: PCGMAX      ! maximum soil heat capacity
00230 !
00231 REAL, DIMENSION(:),   INTENT(IN) :: PZREF       ! normal distance of the first
00232 !                                               ! atmospheric level to the
00233 !                                               ! orography
00234 REAL, DIMENSION(:),   INTENT(IN) :: PUREF       ! reference height of the wind
00235 !                                               ! NOTE this is different from ZZREF
00236 !                                               ! ONLY in stand-alone/forced mode,
00237 !                                               ! NOT when coupled to a model (MesoNH)
00238 REAL, DIMENSION(:),   INTENT(IN) ::  PDIRCOSZW  ! Director Cosinus along z
00239 !                                               ! directions at surface w-point
00240 !
00241 !* atmospheric variables
00242 !  ---------------------
00243 !
00244 !            suffix 'A' stands for atmospheric variable at first model level
00245 !            suffix 'S' stands for atmospheric variable at ground level
00246 !
00247 REAL, DIMENSION(:), INTENT(IN)  :: PTA        ! Temperature
00248 REAL, DIMENSION(:), INTENT(IN)  :: PQA        ! specific humidity
00249 REAL, DIMENSION(:), INTENT(IN)  :: PEXNA      ! Exner function
00250 REAL, DIMENSION(:), INTENT(IN)  :: PRHOA      ! air density
00251 !
00252 REAL, DIMENSION(:), INTENT(IN)  :: PPS        ! Pressure
00253 REAL, DIMENSION(:), INTENT(IN)  :: PEXNS      ! Exner function
00254 !
00255 REAL, DIMENSION(:), INTENT(IN)  :: PRR        ! Rain rate (in kg/m2/s)
00256 REAL, DIMENSION(:), INTENT(IN)  :: PSR        ! Snow rate (in kg/m2/s)
00257 !
00258 REAL, DIMENSION(:), INTENT(IN)  :: PZENITH    ! solar zenith angle
00259 REAL, DIMENSION(:), INTENT(IN)  :: PSW_RAD    ! solar   incoming radiation
00260 REAL, DIMENSION(:), INTENT(IN)  :: PLW_RAD    ! thermal incoming radiation
00261 !
00262 REAL, DIMENSION(:), INTENT(IN)  :: PVMOD      ! modulus of the wind
00263 !                                             ! parallel to the orography
00264 !
00265 ! implicit coupling coefficients:
00266 !
00267 REAL, DIMENSION(:), INTENT(IN)  :: PPEW_A_COEF, PPEW_B_COEF, 
00268                                    PPET_A_COEF, PPEQ_A_COEF, 
00269                                    PPET_B_COEF, PPEQ_B_COEF  
00270 !                                  PPEW_A_COEF ! A-wind coefficient
00271 !                                  PPEW_B_COEF ! B-wind coefficient
00272 !                                  PPET_A_COEF ! A-air temperature coefficient
00273 !                                  PPET_B_COEF ! B-air temperature coefficient
00274 !                                  PPEQ_A_COEF ! A-air specific humidity coefficient
00275 !                                  PPEQ_B_COEF ! B-air specific humidity coefficient
00276 !
00277 !* vegetation parameters
00278 !  ---------------------
00279 !
00280 REAL, DIMENSION(:), INTENT(IN)  :: PRSMIN     ! minimum stomatal resistance
00281 REAL, DIMENSION(:), INTENT(IN)  :: PRGL       ! maximum solar radiation
00282 !                                             ! usable in photosynthesis
00283 REAL, DIMENSION(:), INTENT(IN)  :: PGAMMA     ! coefficient for the calculation
00284 !                                             ! of the surface stomatal
00285 !                                             ! resistance
00286 REAL, DIMENSION(:), INTENT(IN)  :: PCV        ! 2*sqrt(pi/day)/sqrt(Cveg*hveg)
00287 !                                             ! where Cveg and hveg are the
00288 !                                             ! heat capacity and conductivity
00289 !                                             ! of the vegetation
00290 REAL, DIMENSION(:), INTENT(IN)  :: PRUNOFFD   ! depth over which sub-grid runoff computed (m)
00291 REAL, DIMENSION(:,:),INTENT(IN) :: PSOILWGHT  ! ISBA-DIF: weights for vertical
00292 !                                             ! integration of soil water and properties
00293 INTEGER,             INTENT(IN) :: KLAYER_HORT! DIF optimization
00294 INTEGER,             INTENT(IN) :: KLAYER_DUN ! DIF optimization
00295 !
00296 REAL, DIMENSION(:), INTENT(IN)  :: PALBNIR_TVEG  ! tot albedo of vegetation in NIR (needed for LM_TR)
00297 REAL, DIMENSION(:), INTENT(IN)  :: PALBVIS_TVEG  ! tot albedo of vegetation in VIS
00298 REAL, DIMENSION(:), INTENT(IN)  :: PALBNIR_TSOIL ! tot albedo of bare soil in NIR
00299 REAL, DIMENSION(:), INTENT(IN)  :: PALBVIS_TSOIL ! tot albedo of bare soil in VIS
00300 REAL, DIMENSION(:), INTENT(IN)  :: PALB       ! albedo of vegetation
00301 REAL, DIMENSION(:), INTENT(IN)  :: PWRMAX_CF  ! coefficient for maximum water interception 
00302 !                                             ! storage capacity on the vegetation (-)
00303 REAL, DIMENSION(:), INTENT(IN)  :: PVEG       ! fraction of vegetation of the
00304 !                                             ! mesh covered by natural or
00305 !                                             ! agricultural areas
00306 !                                             ! 1-PVEG --> bare soil
00307 REAL, DIMENSION(:), INTENT(IN)  :: PLAI       ! LAI as a function of time:
00308 !                                             ! as a function of growth,
00309 !                                             ! decay, assimilation.
00310 REAL, DIMENSION(:), INTENT(IN)  :: PEMIS      ! emissivity of natural surfaces
00311 !                                             ! (without prognostic snow)
00312 REAL, DIMENSION(:), INTENT(IN)  :: PZ0_WITH_SNOW  ! roughness length for momentum
00313 !                                                 ! (with snow taken into account)
00314 REAL, DIMENSION(:), INTENT(IN)  :: PZ0H_WITH_SNOW ! roughness length for heat
00315 !                                                 ! (with snow taken into account)
00316 !
00317 !* ISBA-Ags (with LAI evolution) parameters
00318 !  ----------------------------------------
00319 !
00320 REAL, DIMENSION(:,:), INTENT(IN) :: PVEGTYPE ! fraction of each vegetation
00321 !
00322 !* subgrid-scale orography parameters
00323 !  ----------------------------------
00324 !
00325 REAL, DIMENSION(:),   INTENT(IN) :: PZ0EFF     ! roughness length for momentum
00326 !
00327 REAL, DIMENSION(:),   INTENT(IN) :: PRUNOFFB   ! slope of the runoff curve
00328 !
00329 !* soil parameters
00330 !  ---------------
00331 !
00332 REAL, DIMENSION(:), INTENT(IN)  :: PCGSAT     ! thermal coefficient at
00333 !                                             ! saturation
00334 REAL, DIMENSION(:), INTENT(IN)  :: PC1SAT     ! C1 coefficient at saturation
00335 REAL, DIMENSION(:), INTENT(IN)  :: PC2REF     ! reference value of C2
00336 REAL, DIMENSION(:,:), INTENT(IN):: PC3        ! C3 coefficient
00337 REAL, DIMENSION(:), INTENT(IN)  :: PC4B       ! fiiting soil paramater for vertical diffusion (C4)
00338 REAL, DIMENSION(:), INTENT(IN)  :: PC4REF     !         "
00339 REAL, DIMENSION(:), INTENT(IN)  :: PACOEF     ! a and p coefficients for
00340 REAL, DIMENSION(:), INTENT(IN)  :: PPCOEF     ! the wgeq calculations.
00341 !
00342 REAL, DIMENSION(:), INTENT(IN)  :: PTAUICE    ! characteristic time scale for phase change
00343 !                                             ! within the soil
00344 !
00345 REAL, DIMENSION(:), INTENT(IN)  :: PWDRAIN    ! minimum Wg for drainage (m3/m3)
00346 !
00347 !
00348 REAL, DIMENSION(:), INTENT(IN)  :: PTDEEP_A, PTDEEP_B     
00349                                               ! Deep soil temperature (prescribed)
00350 !                                      PTDEEP_A = Deep soil temperature
00351 !                                                 coefficient depending on flux
00352 !                                      PTDEEP_B = Deep soil temperature (prescribed)
00353 !                                               which models heating/cooling from
00354 !                                               below the diurnal wave penetration
00355 !                                               (surface temperature) depth. If it
00356 !                                               is FLAGGED as undefined, then the zero
00357 !                                               flux lower BC is applied.
00358 !                                      Tdeep = PTDEEP_B + PTDEEP_A * PDEEP_FLUX
00359 !                                              (with PDEEP_FLUX in W/m2)
00360 REAL, DIMENSION(:), INTENT(IN)  :: PGAMMAT    ! Deep soil heat transfer coefficient:
00361 !                                             ! assuming homogeneous soil so that
00362 !                                             ! this can be prescribed in units of 
00363 !                                             ! (1/days): associated time scale with
00364 !                                             ! PTDEEP.
00365 !
00366 REAL, DIMENSION(:), INTENT(IN)  :: PPSN       ! fraction of the grid covered
00367 !                                             ! by snow
00368 REAL, DIMENSION(:), INTENT(IN)  :: PPSNG      ! fraction of the the bare
00369 !                                             ! ground covered by snow
00370 REAL, DIMENSION(:), INTENT(IN)  :: PPSNV      ! fraction of the the veg.
00371 !                                             ! covered by snow
00372 REAL, DIMENSION(:), INTENT(IN)  :: PPSNV_A    ! snow free albedo of vegetation 
00373                                               ! for EBA
00374 REAL, DIMENSION(:), INTENT(IN)  :: PSNOWFREE_ALB_VEG  ! snow free albedo of vegetation 
00375 REAL, DIMENSION(:), INTENT(IN)  :: PSNOWFREE_ALB_SOIL ! snow free albedo of soil 
00376 !
00377 REAL   ,DIMENSION(:),INTENT(IN)    :: PIRRIG
00378 REAL   ,DIMENSION(:),INTENT(IN)    :: PWATSUP
00379 REAL   ,DIMENSION(:),INTENT(IN)    :: PTHRESHOLD
00380 LOGICAL,DIMENSION(:),INTENT(IN)    :: LIRRIGATE
00381 LOGICAL,DIMENSION(:),INTENT(INOUT) :: LIRRIDAY
00382 !
00383 !* ISBA-Ags parameters
00384 !  -------------------
00385 !
00386 LOGICAL, DIMENSION(:), INTENT(IN) :: OSTRESSDEF ! vegetation response type to water
00387 !                                               ! stress (true:defensive false:offensive)
00388 REAL, DIMENSION(:),    INTENT(IN) :: PGC        ! cuticular conductance (m s-1)
00389 REAL, DIMENSION(:),    INTENT(IN) :: PF2I       ! critical normilized soil water 
00390 !                                               ! content for stress parameterisation
00391 REAL, DIMENSION(:),    INTENT(IN) :: PDMAX      ! maximum air saturation deficit
00392 !                                               ! tolerate by vegetation
00393 REAL, DIMENSION(:),    INTENT(IN) :: PAH,PBH    ! coefficients for herbaceous water stress 
00394 !                                               ! response (offensive or defensive) 
00395 !
00396 REAL, DIMENSION(:),    INTENT(IN) :: PCSP       ! atmospheric CO2 concentration
00397 !                                                 [ppmm]=[kg CO2 / kg air]
00398 REAL, DIMENSION(:),    INTENT(IN) :: PGMES      ! mesophyll conductance (m s-1)
00399 !
00400 REAL, DIMENSION(:),    INTENT(IN) :: PPOI       ! Gaussian weights (as above)
00401 !
00402 REAL, DIMENSION(:),    INTENT(IN) :: PFZERO     ! ideal value of F, no photo- 
00403 !                                               ! respiration or saturation deficit
00404 REAL, DIMENSION(:),    INTENT(IN) :: PEPSO      ! maximum initial quantum use
00405 !                                               ! efficiency (mg J-1 PAR)
00406 REAL, DIMENSION(:),    INTENT(IN) :: PGAMM      ! CO2 conpensation concentration (ppmv)
00407 REAL, DIMENSION(:),    INTENT(IN) :: PQDGAMM    ! Log of Q10 function for CO2 conpensation 
00408 !                                               ! concentration
00409 REAL, DIMENSION(:),    INTENT(IN) :: PQDGMES    ! Log of Q10 function for mesophyll conductance 
00410 REAL, DIMENSION(:),    INTENT(IN) :: PT1GMES    ! reference temperature for computing 
00411 !                                               ! compensation concentration function for 
00412 !                                               ! mesophyll conductance: minimum
00413 !                                               ! temperature 
00414 REAL, DIMENSION(:),    INTENT(IN) :: PT2GMES    ! reference temperature for computing 
00415 !                                               ! compensation concentration function for 
00416 !                                               ! mesophyll conductance: maximum
00417 !                                               ! temperature
00418 REAL, DIMENSION(:),    INTENT(IN) :: PAMAX      ! leaf photosynthetic capacity (kgCO2 m-2 s-1)
00419 REAL, DIMENSION(:),    INTENT(IN) :: PQDAMAX    ! Log of Q10 function for leaf photosynthetic capacity
00420 REAL, DIMENSION(:),    INTENT(IN) :: PT1AMAX    ! reference temperature for computing 
00421 !                                               ! compensation concentration function for leaf 
00422 !                                               ! photosynthetic capacity: minimum
00423 !                                               ! temperature
00424 REAL, DIMENSION(:),    INTENT(IN) :: PT2AMAX    ! reference temperature for computing 
00425 !                                               ! compensation concentration function for leaf 
00426 !                                               ! photosynthetic capacity: maximum
00427 !                                               ! temperature
00428 REAL, DIMENSION(:), INTENT(INOUT) :: PABC       ! abscissa needed for integration
00429 !                                               ! of net assimilation and stomatal
00430 !                                               ! conductance over canopy depth
00431 !
00432 !
00433 !* ISBA-DF variables/parameters:                  
00434 !  ------------------------------
00435 ! Parameters:
00436 !
00437 REAL, DIMENSION(:,:), INTENT(IN)    :: PD_G       ! Depth of Bottom of Soil layers       (m)
00438 REAL, DIMENSION(:,:), INTENT(IN)    :: PDZG       ! soil layers thicknesses (DIF option) (m)
00439 REAL, DIMENSION(:,:), INTENT(IN)    :: PDZDIF     ! distance between consecuative layer mid-points (DIF option) (m)
00440 INTEGER, DIMENSION(:),INTENT(IN)    :: KWG_LAYER  ! Number of soil moisture layers (DIF option)
00441 REAL, DIMENSION(:,:), INTENT(IN)    :: PROOTFRAC  ! root fraction                        (-)
00442 REAL, DIMENSION(:,:), INTENT(IN)    :: PWFC       ! field capacity profile               (m3/m3)
00443 REAL, DIMENSION(:,:), INTENT(IN)    :: PWWILT     ! wilting point profile                (m3/m3)
00444 REAL, DIMENSION(:,:), INTENT(IN)    :: PWSAT      ! porosity profile                     (m3/m3)
00445 REAL, DIMENSION(:,:), INTENT(IN)    :: PBCOEF     ! soil water CH78 b-parameter          (-)
00446 REAL, DIMENSION(:,:), INTENT(IN)    :: PCONDSAT   ! hydraulic conductivity at saturation (m/s)
00447 REAL, DIMENSION(:,:), INTENT(IN)    :: PMPOTSAT   ! matric potential at saturation       (m)
00448 REAL, DIMENSION(:,:), INTENT(IN)    :: PHCAPSOIL  ! soil heat capacity                   [J/(K m3)]
00449 REAL, DIMENSION(:,:), INTENT(IN)    :: PCONDDRY   ! soil dry thermal conductivity        [W/(m K)]
00450 REAL, DIMENSION(:,:), INTENT(IN)    :: PCONDSLD   ! soil solids thermal conductivity     [W/(m K)]
00451 !                                        
00452 REAL, DIMENSION(:), INTENT(IN)  :: PD_ICE     !depth of the soil column for the calculation
00453 !                                              of the frozen soil fraction (m)
00454 REAL, DIMENSION(:), INTENT(IN)  :: PKSAT_ICE  !hydraulic conductivity at saturation (m/s)
00455 !                                            
00456 REAL, DIMENSION(:), INTENT(IN)  :: PMUF       !fraction of the grid cell reached by the rainfall
00457 !
00458 REAL, DIMENSION(:), INTENT(IN)   :: PFF       !Floodplain fraction at the surface
00459 REAL, DIMENSION(:), INTENT(IN)   :: PFFG      !Floodplain fraction over the ground
00460 REAL, DIMENSION(:), INTENT(IN)   :: PFFV      !Floodplain fraction over vegetation
00461 REAL, DIMENSION(:), INTENT(IN)   :: PFFG_NOSNOW ! Without snow (ES)
00462 REAL, DIMENSION(:), INTENT(IN)   :: PFFV_NOSNOW ! Without snow (ES)
00463 REAL, DIMENSION(:), INTENT(IN)   :: PFFROZEN  !Fraction of frozen flood
00464 REAL, DIMENSION(:), INTENT(IN)   :: PFALB     !Floodplain albedo
00465 REAL, DIMENSION(:), INTENT(IN)   :: PFEMIS    !Floodplain emis
00466 REAL, DIMENSION(:), INTENT(IN)   :: PFFLOOD   !Efective floodplain fraction
00467 REAL, DIMENSION(:), INTENT(IN)   :: PPIFLOOD  !Floodplains potential infiltration           [kg/m²/s]
00468 REAL, DIMENSION(:), INTENT(INOUT):: PIFLOOD   !Floodplains infiltration                     [kg/m²/s]
00469 REAL, DIMENSION(:), INTENT(INOUT):: PPFLOOD   !Floodplains direct precipitation             [kg/m²/s]
00470 REAL, DIMENSION(:), INTENT(INOUT):: PLE_FLOOD, PLEI_FLOOD !Floodplains latent heat flux     [W/m²]
00471 !
00472 REAL, DIMENSION(:), INTENT(IN)   ::  PSODELX  ! Pulsation for each layer (Only used if LTEMP_ARP=True)
00473 !
00474 REAL, DIMENSION(:), INTENT(IN)   ::  PLAT
00475 REAL, DIMENSION(:), INTENT(IN)   ::  PLON
00476 !
00477 !* prognostic variables
00478 !  --------------------
00479 !
00480 REAL, DIMENSION(:,:), INTENT(INOUT) :: PTG, PWG, PWGI
00481 !                                      PTG   ! soil layer average temperatures        (K)
00482 !                                      PWG   ! soil liquid volumetric water content   (m3/m3)
00483 !                                      PWGI  ! soil frozen volumetric water content   (m3/m3)
00484 !
00485 REAL, DIMENSION(:), INTENT(INOUT)   :: PCPS, PLVTT, PLSTT
00486 !
00487 REAL, DIMENSION(:), INTENT(INOUT) :: PWR      ! liquid water retained on the
00488 !                                             ! foliage of the vegetation
00489 !                                             ! canopy
00490 REAL, DIMENSION(:), INTENT(INOUT) :: PRESA    ! aerodynamic resistance
00491 !
00492 REAL, DIMENSION(:), INTENT(INOUT) :: PANFM    ! maximum leaf assimilation
00493 !
00494 REAL, DIMENSION(:), INTENT(INOUT)  :: PFSAT   ! Topmodel saturated fraction
00495 !
00496 !* ISBA-SNOW3L variables/parameters:
00497 !  ---------------------------------
00498 !
00499 ! Prognostic variables:
00500 !
00501 REAL, DIMENSION(:),   INTENT(INOUT) :: PSNOWALB   ! Snow albedo
00502 REAL, DIMENSION(:,:), INTENT(INOUT) :: PSNOWSWE   ! Snow model layer liquid water equivalent or SWE (kg m-2)  
00503 !                                                 ! NOTE for 'DEF' snow option, only uppermost element
00504 !                                                 ! of this array is non-zero (as it's a one layer scheme)
00505 REAL, DIMENSION(:,:), INTENT(INOUT) :: PSNOWHEAT  ! Snow layer heat content (J/m3) 
00506 REAL, DIMENSION(:,:), INTENT(INOUT) :: PSNOWRHO   ! Snow layer average density (kg/m3)
00507 !                                                 ! NOTE for 'DEF' snow option, only uppermost element
00508 !                                                 ! of this array is used (as it's a one layer scheme)
00509 REAL, DIMENSION(:,:), INTENT(INOUT) :: PSNOWGRAN1 ! Snow grain parameter 1 
00510 REAL, DIMENSION(:,:), INTENT(INOUT) :: PSNOWGRAN2 ! Snow grain parameter 2 
00511 REAL, DIMENSION(:,:), INTENT(INOUT) :: PSNOWHIST  ! Snow grain historical parameter
00512 REAL, DIMENSION(:,:), INTENT(INOUT) :: PSNOWAGE   ! Snow grain age
00513 !                                                  NOTE : methamorphism is only activated if the flag
00514 !                                                  OSNOW_METAMO=TRUE
00515 ! 
00516 ! Diagnostics:
00517 !
00518 REAL, DIMENSION(:), INTENT(OUT)     :: PGRNDFLUX  ! snow/soil-biomass interface flux (W/m2)
00519 !
00520 REAL, DIMENSION(:), INTENT(OUT)     :: PHPSNOW    ! heat release from rainfall (W/m2)
00521 REAL, DIMENSION(:), INTENT(OUT)     :: PSNOWHMASS ! snow heat content change from mass changes (J/m2)
00522 REAL, DIMENSION(:), INTENT(OUT)     :: PSMELTFLUX ! energy removed from soil/vegetation surface
00523 !                                                 ! when last traces of snow melted (W/m2)
00524 REAL, DIMENSION(:), INTENT(OUT)     :: PRNSNOW    ! net radiative flux from snow (W/m2)
00525 REAL, DIMENSION(:), INTENT(OUT)     :: PHSNOW     ! sensible heat flux from snow (W/m2)
00526 REAL, DIMENSION(:), INTENT(OUT)     :: PGFLUXSNOW ! net heat flux from snow (W/m2)
00527 REAL, DIMENSION(:), INTENT(OUT)     :: PUSTARSNOW ! friction velocity
00528 REAL, DIMENSION(:), INTENT(OUT)     :: PSRSFC     ! Snow rate falling outside of snow
00529 !                                                   covered grid area [kg/(m2 s)]
00530 REAL, DIMENSION(:), INTENT(OUT)     :: PRRSFC     ! Rain rate falling outside of snow and flood
00531 !                                                   covered grid area [kg/(m2 s)]
00532 REAL, DIMENSION(:), INTENT(OUT)     :: PLESL      ! Evaporation (liquid) from wet snow (W/m2)
00533 REAL, DIMENSION(:), INTENT(OUT)     :: PEMISNOW   ! snow surface emissivity
00534 REAL, DIMENSION(:), INTENT(OUT)     :: PCDSNOW    ! drag coefficient for momentum over snow
00535 REAL, DIMENSION(:), INTENT(OUT)     :: PCHSNOW    ! drag coefficient for heat over snow
00536 REAL, DIMENSION(:), INTENT(OUT)     :: PTS_RAD    ! effective radiative temperature 
00537 !                                                   of the natural surface (K)
00538 REAL, DIMENSION(:), INTENT(OUT)     :: PTS        ! effective surface temperature (K)
00539 REAL, DIMENSION(:), INTENT(OUT)     :: PHV        ! Halstead coefficient
00540 REAL, DIMENSION(:), INTENT(OUT)     :: PQS        ! surface humidity (kg/kg)
00541 REAL, DIMENSION(:,:), INTENT(OUT)   :: PSNOWTEMP  ! snow layer temperatures (K)
00542 REAL, DIMENSION(:,:), INTENT(OUT)   :: PSNOWLIQ   ! snow layer liquid water content (m)
00543 REAL, DIMENSION(:,:), INTENT(OUT)   :: PSNOWDZ    ! snow layer thickness (m)
00544 !
00545 !
00546 !* output soil parameters
00547 !  ----------------------
00548 !
00549 REAL, DIMENSION(:), INTENT(OUT) :: PCG        ! heat capacity of the ground
00550 REAL, DIMENSION(:), INTENT(OUT) :: PC1        ! coefficients for the moisure
00551 REAL, DIMENSION(:), INTENT(OUT) :: PC2        ! equation.
00552 REAL, DIMENSION(:), INTENT(OUT) :: PWGEQ      ! equilibrium volumetric water
00553 !                                             ! content
00554 REAL, DIMENSION(:), INTENT(OUT) :: PCT        ! area-averaged heat capacity
00555 !
00556 !
00557 !* diagnostic variables
00558 !  --------------------
00559 !
00560 REAL, DIMENSION(:), INTENT(OUT) :: PCH        ! drag coefficient for heat
00561 REAL, DIMENSION(:), INTENT(OUT) :: PCD        ! drag coefficient for momentum
00562 REAL, DIMENSION(:), INTENT(OUT) :: PCDN       ! neutral drag coefficient for momentum
00563 REAL, DIMENSION(:), INTENT(OUT) :: PRI        ! Richardson number
00564 REAL, DIMENSION(:), INTENT(OUT) :: PHU        ! grid-area humidity of the soil
00565 REAL, DIMENSION(:), INTENT(OUT) :: PHUG       ! ground relative humidity
00566 REAL, DIMENSION(:), INTENT(OUT) :: PEMIST     ! total surface emissivity
00567 REAL, DIMENSION(:), INTENT(OUT) :: PALBT      ! total surface albedo
00568 REAL, DIMENSION(:), INTENT(OUT) :: PRS        ! surface stomatal resistance
00569 !
00570 !* surface fluxes
00571 !  --------------
00572 !
00573 REAL, DIMENSION(:), INTENT(INOUT) :: PLE      ! total latent heat flux
00574 REAL, DIMENSION(:), INTENT(OUT) :: PRN        ! net radiation
00575 REAL, DIMENSION(:), INTENT(OUT) :: PH         ! sensible heat flux
00576 REAL, DIMENSION(:), INTENT(OUT) :: PLEI       ! sublimation latent heat flux
00577 REAL, DIMENSION(:), INTENT(OUT) :: PLEGI      ! latent heat of sublimation over frozen soil
00578 REAL, DIMENSION(:), INTENT(OUT) :: PLEG       ! latent heat of evaporation
00579 !                                             ! over the ground
00580 REAL, DIMENSION(:), INTENT(OUT) :: PLEV       ! latent heat of evaporation
00581 !                                             ! over the vegetation
00582 REAL, DIMENSION(:), INTENT(OUT) :: PLES       ! latent heat of sublimation
00583 !                                             ! over the snow
00584 REAL, DIMENSION(:), INTENT(OUT) :: PLER       ! latent heat of the fraction
00585 !                                             ! delta of water retained on the
00586 !                                             ! foliage of the vegetation
00587 REAL, DIMENSION(:), INTENT(OUT) :: PLETR      ! evapotranspiration of the rest
00588 !                                             ! of the vegetation
00589 REAL, DIMENSION(:), INTENT(OUT) :: PEVAP      ! total evaporative flux (kg/m2/s)
00590 REAL, DIMENSION(:), INTENT(OUT) :: PGFLUX     ! flux through the ground
00591 REAL, DIMENSION(:), INTENT(OUT) :: PRESTORE   ! surface restore flux (W m-2)
00592 REAL, DIMENSION(:), INTENT(OUT) :: PUSTAR     ! friction velocity
00593 REAL, DIMENSION(:), INTENT(OUT) :: PDRAIN     ! drainage
00594 REAL, DIMENSION(:), INTENT(OUT) :: PRUNOFF    ! runoff
00595 REAL, DIMENSION(:), INTENT(OUT) :: PMELT      ! melting rate of the snow (kg/m2/s)
00596 REAL, DIMENSION(:), INTENT(OUT) :: PMELTADV   ! advection heat flux from snowmelt (W/m2)
00597 REAL ,DIMENSION(:), INTENT(OUT) :: PIRRIG_FLUX! irrigation rate (kg/m2/s)
00598 !
00599 ! The following surface fluxes are from snow-free portion of grid
00600 ! box when the ISBA-ES option is ON. Otherwise, they are equal
00601 ! to the same variables without the _ISBA extension.
00602 !
00603 REAL, DIMENSION(:), INTENT(OUT) :: PRN_ISBA   ! net radiation
00604 REAL, DIMENSION(:), INTENT(OUT) :: PH_ISBA    ! sensible heat flux
00605 REAL, DIMENSION(:), INTENT(OUT) :: PLEG_ISBA  ! latent heat of evaporation (ground)
00606 REAL, DIMENSION(:), INTENT(OUT) :: PLEGI_ISBA ! latent heat of sublimation (ground)
00607 REAL, DIMENSION(:), INTENT(OUT) :: PLEV_ISBA  ! latent heat of evaporation (vegetation)
00608 REAL, DIMENSION(:), INTENT(OUT) :: PLETR_ISBA ! latent heat of evaporation (transpiration)
00609 REAL, DIMENSION(:), INTENT(OUT) :: PUSTAR_ISBA! friction velocity
00610 REAL, DIMENSION(:), INTENT(OUT) :: PLER_ISBA  ! latent heat of evaporation (plant interception)
00611 REAL, DIMENSION(:), INTENT(OUT) :: PLE_ISBA   ! total latent heat flux 
00612 REAL, DIMENSION(:), INTENT(OUT) :: PLEI_ISBA  ! sublimation latent heat flux 
00613 REAL, DIMENSION(:), INTENT(OUT) :: PGFLUX_ISBA! flux through the ground
00614 !
00615 REAL, DIMENSION(:), INTENT(OUT) :: PHORT      !Horton runoff (kg/m2/s)
00616 !
00617 REAL, DIMENSION(:), INTENT(OUT) :: PDRIP      !Dripping from the vegetation (kg/m2/s)
00618 REAL, DIMENSION(:), INTENT(OUT) :: PRRVEG     !Precip. intercepted by vegetation (kg/m2/s)
00619 !
00620 REAL, DIMENSION(:),  INTENT(OUT) :: PAC_AGG  ! aggregated aerodynamic conductance
00621                                      ! for evaporative flux calculations
00622 REAL, DIMENSION(:),  INTENT(OUT) :: PHU_AGG  ! aggregated relative humidity
00623                                      ! for evaporative flux calculations
00624 !
00625 !
00626 !* diagnostic variables for Carbon assimilation
00627 !  --------------------------------------------
00628 !
00629 REAL, DIMENSION(:),   INTENT(INOUT) :: PAN      ! net CO2 assimilation
00630 REAL, DIMENSION(:),   INTENT(INOUT) :: PANDAY   ! daily net CO2 assimilation
00631 REAL, DIMENSION(:,:),   INTENT(OUT) :: PRESP_BIOMASS_INST  ! instantaneous biomass respiration (kgCO2/kgair m/s)
00632 REAL, DIMENSION(:),   INTENT(INOUT) :: PFAPARC   ! Fapar of vegetation (cumul)
00633 REAL, DIMENSION(:),   INTENT(INOUT) :: PFAPIRC   ! Fapir of vegetation (cumul)
00634 REAL, DIMENSION(:),   INTENT(INOUT) :: PMUS
00635 REAL, DIMENSION(:),   INTENT(INOUT) :: PLAI_EFFC ! Effective LAI (cumul)
00636 REAL, DIMENSION(:,:),   INTENT(OUT) :: PIACAN    ! PAR in the canopy at different gauss level
00637 REAL, DIMENSION(:),     INTENT(OUT) :: PANF      ! total assimilation over canopy
00638 REAL, DIMENSION(:),     INTENT(OUT) :: PGPP      ! Gross Primary Production
00639 REAL, DIMENSION(:),     INTENT(OUT) :: PFAPAR    ! Fapar of vegetation
00640 REAL, DIMENSION(:),     INTENT(OUT) :: PFAPIR    ! Fapir of vegetation
00641 REAL, DIMENSION(:),     INTENT(OUT) :: PFAPAR_BS ! Fapar of bare soil
00642 REAL, DIMENSION(:),     INTENT(OUT) :: PFAPIR_BS ! Fapir of bare soil
00643 !
00644 REAL, DIMENSION(:),     INTENT(OUT) :: PDEEP_FLUX ! Heat flux at bottom of ISBA (W/m2)
00645 
00646 !
00647 !*      0.2    declarations of local variables
00648 !
00649 REAL, DIMENSION(SIZE(PWR)) :: ZCS       ! heat capacity of the snow
00650 REAL, DIMENSION(SIZE(PWR)) :: ZFROZEN1  ! ice fraction in superficial soil
00651 REAL, DIMENSION(SIZE(PWR)) :: ZDELTA    ! fraction of the foliage
00652 !                                       ! covered with intercepted
00653 !                                       ! water
00654 REAL, DIMENSION(SIZE(PWR)) :: ZQSAT     ! expression for the saturation 
00655 !                                       ! specific humidity 
00656 REAL, DIMENSION(SIZE(PWR)) :: ZDQSAT    ! expression for the saturation
00657 !                                       ! specific humidity derivative
00658 REAL, DIMENSION(SIZE(PWR)) :: ZTS_RAD   ! effective radiative temperature 
00659 !                                         of the natural surface (K)
00660 !                                         (snow free part in case of 3-L snow scheme)
00661 !
00662 REAL, DIMENSION(SIZE(PWR)) :: ZWRMAX    ! maximum canopy water interception
00663 !
00664 REAL, DIMENSION(SIZE(PWR)) :: ZF2       ! water stress coefficient
00665 !
00666 REAL, DIMENSION(SIZE(PWR)) :: ZF5       ! water stress coefficient (based on F2)
00667 !                                       ! to enforce Etv=>0 as F2=>0
00668 !
00669 REAL, DIMENSION(SIZE(PWR)) :: ZDWGI1, ZDWGI2 ! Liquid equivalent volumetric soil
00670 !                                              ice content time tendencies (m3/m3)
00671 !
00672 REAL, DIMENSION(SIZE(PWR)) :: ZHUGI    ! humidity over frozen bare ground
00673 !
00674 REAL, DIMENSION(SIZE(PWR)) :: ZEVAPCOR ! evaporation correction as last traces of snow
00675 !                                      ! cover ablate
00676 REAL, DIMENSION(SIZE(PWR)) :: ZLES3L   ! sublimation from ISBA-ES(3L)
00677 REAL, DIMENSION(SIZE(PWR)) :: ZLEL3L   ! evaporation heat flux of water in the snow (W/m2)
00678 REAL, DIMENSION(SIZE(PWR)) :: ZEVAP3L  ! evaporation flux over snow from ISBA-ES (kg/m2/s)
00679 REAL, DIMENSION(SIZE(PWR)) :: ZSNOW_THRUFAL ! rate that liquid water leaves snow pack: 
00680 !                                           ! ISBA-ES [kg/(m2 s)]
00681 REAL, DIMENSION(SIZE(PWR)) :: ZALB3L   !Snow albedo at t-dt for total albedo calculation (ES/CROCUS)
00682 REAL, DIMENSION(SIZE(PWR)) :: ZRI3L    !Snow Ridcharson number (ES/CROCUS)
00683 REAL, DIMENSION(SIZE(PWR)) :: ZT2M     ! restore temperature before time integration (K)
00684 REAL, DIMENSION(SIZE(PWR)) :: ZTSM     ! surface temperature before time integration (K)
00685 !
00686 REAL, DIMENSION(SIZE(PWR)) :: ZLEG_DELTA  ! soil evaporation delta fn
00687 REAL, DIMENSION(SIZE(PWR)) :: ZLEGI_DELTA ! soil sublimation delta fn
00688 !
00689 REAL, DIMENSION(SIZE(PTG,1),SIZE(PTG,2)) :: ZDELTAT
00690 !                                      ! change in temperature over the time
00691 !                                      ! step before adjustment owing to phase 
00692 !                                      ! changes (K)
00693 !
00694 REAL, DIMENSION(SIZE(PWR),SIZE(PABC)) :: ZIACAN_SHADE, ZIACAN_SUNLIT
00695 !                                      ! absorbed PAR of each level within the
00696 !                                      ! canopy - Split into shaded and SUNLIT
00697 REAL, DIMENSION(SIZE(PWR),SIZE(PABC)) :: ZFRAC_SUN  ! fraction of sunlit leaves
00698 !
00699 ! ISBA-DF:
00700 !                                                              
00701 REAL, DIMENSION(SIZE(PWG,1),SIZE(PWG,2)) :: ZSOILHCAPZ ! ISBA-DF Soil heat capacity 
00702 !                                                      ! profile [J/(m3 K)]
00703 REAL, DIMENSION(SIZE(PWG,1),SIZE(PWG,2)) :: ZSOILCONDZ ! ISBA-DF Soil conductivity  
00704 !                                                      ! profile  [W/(m K)]
00705 !
00706 REAL, DIMENSION(SIZE(PWG,1),SIZE(PWG,2)) :: ZF2WGHT    ! water stress factor
00707 !
00708 REAL, DIMENSION(SIZE(PWG,1))             :: ZWGI_EXCESS! Soil ice excess water content
00709 !
00710 ! Other :
00711 !
00712 REAL, DIMENSION(SIZE(PWR)) :: ZTA_IC, ZQA_IC, ZUSTAR2_IC ! TA, QA and friction updated values
00713 !                                                      ! if implicit coupling with atmosphere used.
00714 REAL, DIMENSION(SIZE(PWR)) :: ZTDIURN ! Ice maximum penetration depth for restore (m)
00715 !
00716 ! Necessary to close the energy budget between surfex and the atmosphere:
00717 !
00718 REAL, DIMENSION(SIZE(PWR))   :: ZEMIST
00719 REAL, DIMENSION(SIZE(PWR))   :: ZALBT
00720 !
00721 LOGICAL, DIMENSION(SIZE(PTG,1))  :: GSHADE         ! mask where evolution occurs
00722 REAL(KIND=JPRB) :: ZHOOK_HANDLE
00723 !
00724 !-------------------------------------------------------------------------------
00725 !
00726 !*      1.0    Preliminaries
00727 !              -------------
00728 !
00729 IF (LHOOK) CALL DR_HOOK('ISBA',0,ZHOOK_HANDLE)
00730 !
00731 PC1(:)          = XUNDEF
00732 PC2(:)          = XUNDEF
00733 PWGEQ(:)        = XUNDEF
00734 ZCS(:)          = XUNDEF           
00735 !
00736 ZTA_IC(:)       = XUNDEF
00737 ZQA_IC(:)       = XUNDEF
00738 ZUSTAR2_IC(:)   = 0.0
00739 !
00740 ZTDIURN     (:) = 0.0
00741 ZWGI_EXCESS (:) = 0.0
00742 !
00743 ZEMIST      (:) = XUNDEF
00744 ZALBT       (:) = XUNDEF
00745 ZRI3L       (:) = XUNDEF
00746 !
00747 ZSOILHCAPZ(:,:) = XUNDEF
00748 ZSOILCONDZ(:,:) = XUNDEF
00749 ZF2WGHT   (:,:) = XUNDEF
00750 !
00751 PRS         (:)   = 0.0
00752 !
00753 ! Save surface and sub-surface temperature values at beginning of time step for 
00754 ! budget and flux calculations:
00755 !
00756 ZTSM(:)         = PTG(:,1)
00757 ZT2M(:)         = PTG(:,2)
00758 !
00759 ! Save snow albedo values at beginning of time step for total albedo calculation
00760 !
00761 ZALB3L(:)=PSNOWALB(:)
00762 !
00763 !-------------------------------------------------------------------------------
00764 !
00765 !*      2.0    Soil parameters
00766 !              ---------------
00767 !
00768 IF(HISBA =='2-L' .OR. HISBA == '3-L')THEN
00769 
00770    CALL SOIL (HC1DRY, HSCOND, HSNOW_ISBA, PSNOWRHO(:,1), PVEG, PCGSAT, PCGMAX,  &
00771      PC1SAT, PC2REF, PACOEF, PPCOEF, PCV, PPSN, PPSNG, PPSNV, PFFG, PFFV, PFF,  &
00772      PCG, PC1, PC2, PWGEQ, PCT, ZCS, ZFROZEN1, PTG(:,1), PWG, PWGI,             &
00773      PHCAPSOIL(:,1), PCONDDRY(:,1), PCONDSLD(:,1), PBCOEF(:,1), PWSAT(:,1),     &
00774      PWWILT(:,1), HKSAT,PCONDSAT,PFFG_NOSNOW,PFFV_NOSNOW                        )  
00775 !
00776 ELSE
00777 !
00778    CALL SOILDIF (HSCOND, HDIFSFCOND, PVEG, PCV, PFFG_NOSNOW, PFFV_NOSNOW,       &
00779      PCG, PCGMAX, PCT, ZFROZEN1, PD_G, PTG, PWG, PWGI, KWG_LAYER, PHCAPSOIL,    &
00780      PCONDDRY, PCONDSLD, PBCOEF, PWSAT, PMPOTSAT, ZSOILCONDZ, ZSOILHCAPZ        )
00781 !
00782 ENDIF
00783 !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
00784 !
00785 !*      3.0    Explicit snow scheme
00786 !              --------------------
00787 !
00788  CALL SNOW3L_ISBA(HISBA, HSNOW_ISBA, HSNOWRES, OGLACIER, HIMPLICIT_WIND,         &
00789            TPTIME, PTSTEP,                                                      &
00790            PVEGTYPE, PSNOWSWE, PSNOWHEAT, PSNOWRHO, PSNOWALB,                   &
00791            PSNOWGRAN1, PSNOWGRAN2, PSNOWHIST,PSNOWAGE,                          &
00792            PTG(:,1), PCG, PCT, ZSOILCONDZ(:,1),                                 &
00793            PPS, PTA, PSW_RAD, PQA, PVMOD, PLW_RAD, PRR, PSR,                    &
00794            PRHOA, PUREF, PEXNS, PEXNA, PDIRCOSZW,                               &
00795            PZREF, PZ0_WITH_SNOW, PZ0EFF, PZ0H_WITH_SNOW, PALB, PD_G(:,1),       &
00796            PPEW_A_COEF, PPEW_B_COEF,                                            &
00797            PPET_A_COEF, PPEQ_A_COEF, PPET_B_COEF, PPEQ_B_COEF,                  &
00798            ZSNOW_THRUFAL, PGRNDFLUX, ZEVAPCOR,                                  &
00799            PRNSNOW, PHSNOW, PGFLUXSNOW, PHPSNOW, ZLES3L, ZLEL3L, ZEVAP3L,       &
00800            PUSTARSNOW, PPSN, PSRSFC, PRRSFC, PSMELTFLUX,                        &
00801            PEMISNOW, PCDSNOW, PCHSNOW, PSNOWTEMP, PSNOWLIQ, PSNOWDZ,            &
00802            PSNOWHMASS, ZRI3L, PZENITH, PLAT, PLON                               )  
00803 !
00804 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
00805 !
00806 !*      4.0    Fraction of leaves occupied by intercepted water
00807 !              ------------------------------------------------
00808 !
00809  CALL WET_LEAVES_FRAC(PWR, PVEG, PWRMAX_CF, PZ0_WITH_SNOW, PLAI, ZWRMAX, ZDELTA)
00810 !
00811 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
00812 !
00813 !*      5.0    Plant stress due to soil water deficit
00814 !              --------------------------------------
00815 !
00816  CALL SOILSTRESS(HISBA, ZF2,                 &
00817          PROOTFRAC, PWSAT, PWFC, PWWILT,    &
00818          PWG, PWGI, KWG_LAYER, ZF2WGHT, ZF5 )  
00819 !
00820 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
00821 !
00822 !*      6.0    Radiative transfert
00823 !              -------------------
00824 !
00825 IF (OTR_ML) THEN
00826   CALL RADIATIVE_TRANSFERT(PVEGTYPE,                                    &
00827               PALBVIS_TVEG, PALBVIS_TSOIL, PALBNIR_TVEG, PALBNIR_TSOIL, &
00828               PSW_RAD, PLAI, PZENITH, PABC,                             &
00829               PFAPARC, PFAPIRC, PMUS, PLAI_EFFC, GSHADE, PIACAN,        &              
00830               ZIACAN_SUNLIT, ZIACAN_SHADE, ZFRAC_SUN,                   &
00831               PFAPAR, PFAPIR, PFAPAR_BS, PFAPIR_BS                      )    
00832 ENDIF
00833 !
00834 !  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
00835 !
00836 !*      7.0    Plant stress, stomatal resistance and, possibly, CO2 assimilation
00837 !              --------------------------------------------------------------------
00838 !
00839 ZQSAT=QSAT(PTG(:,1),PPS(:))
00840 !
00841 IF (HPHOTO=='NON') THEN
00842   CALL VEG(PSW_RAD, PTA, PQA, PPS, PRGL, PLAI, PRSMIN, PGAMMA, ZF2, PRS)
00843 ELSE IF (MAXVAL(PGMES).NE.XUNDEF .OR. MINVAL(PGMES).NE.XUNDEF) THEN
00844   CALL COTWORES(PTSTEP, HPHOTO, OTR_ML, GSHADE,                         &
00845             PVEGTYPE, OSTRESSDEF, PAH, PBH, PF2I, PDMAX,                &
00846             PPOI, PCSP, PTG(:,1), ZF2, PSW_RAD, PRESA, PQA, ZQSAT, PLE, &
00847             PPSNV, ZDELTA, PLAI, PRHOA, PZENITH, PFZERO, PEPSO,         &
00848             PGAMM, PQDGAMM, PGMES, PGC, PQDGMES, PT1GMES, PT2GMES,      &
00849             PAMAX, PQDAMAX, PT1AMAX, PT2AMAX, PFFV,                     &
00850             ZIACAN_SUNLIT, ZIACAN_SHADE, ZFRAC_SUN, PIACAN,             &
00851             PABC, PAN, PANDAY, PRS, PANFM, PGPP, PANF, PRESP_BIOMASS_INST(:,1))
00852 ELSE
00853   PRESP_BIOMASS_INST(:,1) = 0.0
00854   PGPP(:) = 0.0
00855 ENDIF
00856 !
00857 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
00858 !
00859 !*      8.0    Aerodynamic drag and heat transfer coefficients
00860 !              -----------------------------------------------
00861 !
00862  CALL DRAG(HISBA, HSNOW_ISBA, HCPSURF,                                           &
00863     PTG(:,1), PWG(:,1), PWGI(:,1), PEXNS, PEXNA, PTA, PVMOD, PQA, PRR, PSR,     &
00864     PPS, PRS, PVEG, PZ0_WITH_SNOW, PZ0EFF, PZ0H_WITH_SNOW,                      &
00865     PWFC(:,1), PWSAT(:,1), PPSNG, PPSNV, PZREF, PUREF,                          &
00866     PDIRCOSZW, ZDELTA, ZF5, PRESA,  PCH, PCD, PCDN, PRI, PHUG, ZHUGI,           &
00867     PHV, PHU, PCPS, PQS, PFFG, PFFV, PFF, PFFG_NOSNOW, PFFV_NOSNOW,             &
00868     ZLEG_DELTA, ZLEGI_DELTA                                                     )  
00869 !
00870 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
00871 !
00872 !*      9.0    Resolution of the surface and soil energy budget
00873 !              ------------------------------------------------
00874 !
00875  CALL E_BUDGET(HISBA, HSNOW_ISBA, OFLOOD, OTEMP_ARP, HIMPLICIT_WIND,             &
00876         PSODELX, PUREF,                                                         &
00877         PPEW_A_COEF, PPEW_B_COEF, PPET_A_COEF, PPEQ_A_COEF, PPET_B_COEF,        &
00878         PPEQ_B_COEF, PVMOD, PCD, PTG, PTSTEP, PSNOWALB, PSW_RAD, PLW_RAD,       &
00879         PTA, PQA, PPS, PRHOA, PEXNS,PEXNA, PCPS, PLVTT, PLSTT,  PVEG,           &
00880         PHUG, ZHUGI, PHV, ZLEG_DELTA, ZLEGI_DELTA, PEMIS, PALB, PRESA,          &
00881         PCT, PPSN, PPSNV, PPSNG, PGRNDFLUX, PSMELTFLUX, ZSNOW_THRUFAL,          &
00882         PD_G, PDZG, PDZDIF, ZSOILCONDZ, ZSOILHCAPZ,  ZALBT, ZEMIST,             &
00883         ZQSAT, ZDQSAT, ZFROZEN1, PTDEEP_A, PTDEEP_B, PGAMMAT,                   &
00884         ZTA_IC, ZQA_IC, ZUSTAR2_IC,                                             &
00885         PSNOWFREE_ALB_VEG, PPSNV_A, PSNOWFREE_ALB_SOIL,                         &
00886         PFFG, PFFV, PFF, PFFROZEN, PFALB, PFEMIS, ZDELTAT, PDEEP_FLUX           )
00887 !
00888 !
00889 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
00890 !
00891 !*      10.0    Energy and momentum fluxes
00892 !              --------------------------
00893 !
00894 !*******************************************************************************
00895 ! WARNING: at this stage, ZALBT and ZEMIST have two different meanings according
00896 !          to the ISBA snow-scheme option:
00897 !  'D95' : they represent aggregated (snow + flood + snow-flood-free) albedo and emissivity
00898 !  '3-L' : they represent                    flood + snow-flood-free  albedo and emissivity
00899 !*******************************************************************************
00900 !
00901  CALL ISBA_FLUXES(HISBA, HSNOW_ISBA, HSOILFRZ, OTEMP_ARP, PTSTEP, PSODELX,       &
00902            PSW_RAD, PLW_RAD, ZTA_IC, ZQA_IC, ZUSTAR2_IC,                        &
00903            PRHOA, PEXNS, PEXNA, PCPS, PLVTT, PLSTT,                             &
00904            PLAI, PVEG, PHUG, ZHUGI, PHV, ZLEG_DELTA, ZLEGI_DELTA, ZDELTA, PRESA,&
00905            ZF5, PRS, ZCS, PCG, PCT, PSNOWSWE(:,1), ZT2M, ZTSM,                  &
00906            PPSN, PPSNV, PPSNG, ZFROZEN1, PTAUICE, ZWGI_EXCESS,                  &
00907            ZALBT, ZEMIST, ZQSAT, ZDQSAT, ZSNOW_THRUFAL,                         &
00908            PRN, PH, PLE, PLEG, PLEGI, PLEV, PLES, PLER, PLETR, PEVAP, PGFLUX,   &
00909            PMELTADV, PMELT, PRESTORE, PUSTAR, ZTS_RAD, ZDWGI1, ZDWGI2, ZDELTAT, &
00910            ZSOILCONDZ, ZSOILHCAPZ, PWSAT, PMPOTSAT, PBCOEF, PD_G, PDZG, PTG,    &
00911            PWGI, PWG, KWG_LAYER, PSRSFC, PPSNV_A, PFFG, PFFV, PFF, PFFROZEN,    &
00912            PLE_FLOOD, PLEI_FLOOD, PSNOWTEMP(:,1), ZTDIURN                       )  
00913 !
00914 ! Compute aggregated coefficients for evaporation
00915 ! Sum(LEV+LEG+LEGI+LES) = ACagg * Lv * RHOA * (HUagg.Qsat - Qa)
00916 !
00917 PAC_AGG(:) =   1. / PRESA(:) / XLVTT                              &
00918      * ( XLVTT*    PVEG(:) *(1.-PPSNV(:))                 *PHV(:)   &
00919        + XLVTT*(1.-PVEG(:))*(1.-PPSNG(:))*(1.-ZFROZEN1(:))          &
00920        + XLSTT*(1.-PVEG(:))*(1.-PPSNG(:))*    ZFROZEN1(:)           &
00921        + XLSTT*                 PPSN (:)                            )  
00922 !
00923 PHU_AGG(:) =   1. / (PRESA(:) * PAC_AGG(:)) / XLVTT               &
00924      * ( XLVTT*    PVEG(:) *(1.-PPSNV(:))                 *PHV(:)   &
00925        + XLVTT*(1.-PVEG(:))*(1.-PPSNG(:))*(1.-ZFROZEN1(:))*PHUG(:)  &
00926        + XLSTT*(1.-PVEG(:))*(1.-PPSNG(:))*    ZFROZEN1(:) *ZHUGI(:) &
00927        + XLSTT*                 PPSN (:)                            )  
00928 !
00929 !*******************************************************************************
00930 ! WARNING: at this stage, all fluxes have two different meanings according
00931 !          to the ISBA snow-scheme option:
00932 !  'D95' : they represent aggregated (snow + flood + snow-flood-free) fluxes
00933 !  '3-L' : they represent                    flood + snow-flood-free  fluxes
00934 !
00935 ! The variables concerned by this are: PRN, PH, PLE, PLEI, PLEG, PLEGI, PLEV, PLES, 
00936 !                                      PLER, PLETR, PEVAP, PUSTAR, PGFLUX
00937 !*******************************************************************************
00938 !
00939 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
00940 !
00941 !*     11.0    Water transfers and phase change in the soil
00942 !              --------------------------------------------
00943 !
00944  CALL HYDRO(HISBA, HSNOW_ISBA, HRUNOFF, OGLACIER, OFLOOD, PTSTEP, PVEGTYPE,      &
00945      PRRSFC, PSRSFC, PLEV, PLETR, PLEG, PLES, PRUNOFFB, PWDRAIN,                &
00946      PC1, PC2, PC3, PC4B, PC4REF, PWGEQ, PCG, PCT, PVEG, ZWRMAX, PMELT,         &
00947      ZDWGI1, ZDWGI2, PLEGI, PRUNOFFD, PSOILWGHT, KLAYER_HORT, KLAYER_DUN,       &     
00948      PPSNV, PPSNG, ZSNOW_THRUFAL, ZEVAPCOR, PWR,                                &
00949      PSNOWSWE(:,1), PSNOWALB, PSNOWRHO(:,1), PBCOEF, PWSAT, PCONDSAT, PMPOTSAT, &
00950      PWFC, PWWILT, ZF2WGHT, ZF2, PD_G, PDZG, PDZDIF, PPS,                       &
00951      PWG, PWGI, PTG, KWG_LAYER, PDRAIN, PRUNOFF,                                &
00952      PIRRIG, PWATSUP, PTHRESHOLD, LIRRIDAY, LIRRIGATE,                          &
00953      HKSAT, HSOC, HRAIN, HHORT, PMUF, PFSAT, PKSAT_ICE, PD_ICE, PHORT, PDRIP,   &
00954      PFFG, PFFV, PFFLOOD, PPIFLOOD, PIFLOOD, PPFLOOD, PRRVEG, ZTDIURN,          &
00955      PIRRIG_FLUX                                                                )
00956 !
00957 PDRAIN(:)=PDRAIN(:)+ZWGI_EXCESS(:)
00958 !
00959 !-------------------------------------------------------------------------------
00960 !
00961 !*     12.0    Aggregated output fluxes and diagnostics
00962 !              -----------------------------------------
00963 !
00964 !* add snow component to output radiative parameters and fluxes in case 
00965 !  of 3-L snow scheme
00966 !
00967 !
00968  CALL ISBA_SNOW_AGR( HSNOW_ISBA,                                   &
00969           ZEMIST, ZALBT,                                          &
00970           PPSN, PPSNG, PPSNV,                                     &
00971           PRN, PH, PLE, PLEI, PLEG, PLEGI, PLEV, PLES, PLER,      &
00972           PLETR, PEVAP, PGFLUX, PLVTT, PLSTT,                     &
00973           PUSTAR,                                                 &
00974           ZLES3L, ZLEL3L, ZEVAP3L,                                &
00975           ZRI3L, ZALB3L,                                          &
00976           PRNSNOW, PHSNOW,  PHPSNOW,                              &
00977           PGFLUXSNOW, PUSTARSNOW,                                 &
00978           PGRNDFLUX, PLESL,                                       &
00979           PEMISNOW,                                               &
00980           PSNOWTEMP, PTS_RAD, PTS, PRI, PSNOWHMASS,               &
00981           PRN_ISBA, PH_ISBA, PLEG_ISBA, PLEGI_ISBA, PLEV_ISBA,    &
00982           PLETR_ISBA, PUSTAR_ISBA, PLER_ISBA, PLE_ISBA,           &
00983           PLEI_ISBA, PGFLUX_ISBA, PMELTADV,                       &
00984           ZTS_RAD, PTG,                                           &
00985           PEMIST, PALBT, PLE_FLOOD, PLEI_FLOOD, PFFG, PFFV, PFF   )  
00986 !
00987 !***************************************************************************
00988 ! All output fluxes and radiative variables have recovered the same physical
00989 ! meaning, that is they are aggregated quantities (snow + snow-free)
00990 !***************************************************************************
00991 !
00992 IF (LHOOK) CALL DR_HOOK('ISBA',1,ZHOOK_HANDLE)
00993 !
00994 !-------------------------------------------------------------------------------
00995 !
00996 END SUBROUTINE ISBA