SURFEX v7.3
General documentation of Surfex
 All Classes Files Functions Variables Typedefs
/home/dasprezs/EXPORT_v7_3/src/SURFEX/cotwores.F90
Go to the documentation of this file.
00001 !     #########
00002 SUBROUTINE COTWORES(PTSTEP, HPHOTO, OTR_ML, OSHADE,                   &
00003             PVEGTYPE, OSTRESSDEF, PAH, PBH, PF2I, PDMAX,              &
00004             PPOI, PCSP, PTG, PF2, PSW_RAD, PRA, PQA, PQSAT, PLE,      &
00005             PPSNV, PDELTA, PLAI, PRHOA, PZENITH, PFZERO, PEPSO,       &
00006             PGAMM, PQDGAMM, PGMES,  PGC, PQDGMES, PT1GMES, PT2GMES,   &
00007             PAMAX, PQDAMAX, PT1AMAX, PT2AMAX, PFFV,                   &
00008             PIACAN_SUNLIT, PIACAN_SHADE, PFRAC_SUN, PIACAN,           &
00009             PABC, PAN, PANDAY, PRS, PANFM, PGPP, PANF, PRESP_LEAF     ) 
00010 !   #########################################################################
00011 !
00012 !!****  *COTWORES*  
00013 !!
00014 !!    PURPOSE
00015 !!    -------
00016 !!
00017 !!    Calculates net assimilation of CO2 and leaf conductance.
00018 !!              
00019 !!**  METHOD
00020 !!    ------
00021 !!    Calvet et al. 1998 Forr. Agri. Met. [from model of Jacobs(1994)]
00022 !!
00023 !!    EXTERNAL
00024 !!    --------
00025 !!    none
00026 !!
00027 !!    IMPLICIT ARGUMENTS
00028 !!    ------------------
00029 !!      
00030 !!    USE MODD_CST
00031 !!    USE MODD_CO2V_PAR
00032 !!    USE MODI_COTWO
00033 !!    USE MODI_CCETR
00034 !!    USE MODE_THERMOS
00035 !!
00036 !!    REFERENCE
00037 !!    ---------
00038 !!
00039 !!    Calvet et al. 1998 Forr. Agri. Met. 
00040 !!      
00041 !!    AUTHOR
00042 !!    ------
00043 !!
00044 !!      A. Boone           * Meteo-France *
00045 !!      (following Belair)
00046 !!
00047 !!    MODIFICATIONS
00048 !!    -------------
00049 !!      Original    27/10/97 
00050 !!      V. Masson and V. Rivailland 12/2003 modificatino of ISBA routines order
00051 !!      L. Jarlan   27/10/04 : add of T2 to calculate soil respiration and use
00052 !!                              of CRESPSL key to manage the calculation of soil
00053 !!                              respiration
00054 !!                             PAN et PPST in kgCO2 m-2 s-1 to be fully
00055 !!                              compatible with vegetation growth module (lailoss.f90)
00056 !!      P Le Moigne 09/2005 AGS modifs of L. Jarlan
00057 !!      S. Lafont      03/09 : change units of EPSO GAMM ANDAY
00058 !!      A.L. Gibelin   06/09 : suppress evolution of [CO2] in canopy
00059 !!      A.L. Gibelin   06/09 : move calculations of some CO2 fluxes
00060 !!      A.L. Gibelin   06/09 : add RESP_LEAF
00061 !!      A.L. Gibelin   07/09 : ensure coherence between cotwores and cotworestress
00062 !!      A.L. Gibelin   07/09 : Suppress PPST and PPSTF as outputs, and diagnose GPP
00063 !!        S. Lafont    03/11 : Correct a bug fopr grassland below wilting point
00064 !!      D. Carrer      04/11 : new radiative transfert 
00065 !!      A. Boone       11/11 : add rsmax to MODD_ISBA_PAR
00066 !!      B. Decharme    05/12 : Bug : flood fraction in COTWORES
00067 !!                                   Optimization
00068 !!
00069 !-------------------------------------------------------------------------------
00070 !
00071 USE MODD_CSTS,           ONLY : XMD, XTT, XLVTT
00072 USE MODD_ISBA_PAR,       ONLY : XRS_MAX
00073 USE MODD_CO2V_PAR,       ONLY : XPARCF, XMCO2, XDMAX_AGS,       &
00074                                 XDMAXX, XDMAXN, XAW, XBW, XASW                              
00075 USE MODD_DATA_COVER_PAR, ONLY : NVT_TREE, NVT_EVER, NVT_CONI
00076 USE MODD_SURF_PAR,       ONLY : XUNDEF
00077 !
00078 USE MODI_CCETR
00079 USE MODI_COTWO
00080 !
00081 !*       0.     DECLARATIONS
00082 !               ------------
00083 !
00084 !
00085 USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
00086 USE PARKIND1  ,ONLY : JPRB
00087 !
00088 IMPLICIT NONE
00089 !
00090 !*      0.1    declarations of arguments
00091 !
00092 !
00093 REAL,                INTENT(IN)  :: PTSTEP      ! time step
00094  CHARACTER(LEN=*),    INTENT(IN)  :: HPHOTO      ! Kind of photosynthesis
00095 !                                               ! 'NON'
00096 !                                               ! 'AGS'
00097 !                                               ! 'LAI'
00098 !                                               ! 'AST'
00099 !                                               ! 'LST'
00100 LOGICAL,             INTENT(IN)  :: OTR_ML      ! new TR
00101 LOGICAL, DIMENSION(:),INTENT(IN) :: OSHADE
00102 !
00103 REAL, DIMENSION(:,:),INTENT(IN)  :: PVEGTYPE
00104 !                                PVEGTYPE  = type de vegetation (1 a 9)
00105 !
00106 LOGICAL,DIMENSION(:),INTENT(IN)  :: OSTRESSDEF
00107 REAL,DIMENSION(:),   INTENT(IN)  :: PAH, PBH, PF2I, PDMAX
00108 !                                    PAH, PBH  = coefficients for universal herbaceous
00109 !                                                stress relation 
00110 !                                    OSTRESSDEF   = water stress vegetation comportement 
00111 !                                                (true:defensif false:offensif)
00112 !                                    PF2I      = critical normalized soil water stress    
00113 !                                    PDMAX     = maximum saturation deficit of 
00114 !                                                  atmosphere tolerate by vegetation
00115 !
00116 REAL, DIMENSION(:),  INTENT(IN)  :: PPOI     ! Gaussian weights (as above)
00117 !
00118 REAL,DIMENSION(:),   INTENT(IN)  :: PCSP, PTG, PF2, PSW_RAD, PRA 
00119 !                                    PCSP  = atmospheric concentration of CO2
00120 !                                    PTG   = updated leaf temperature
00121 !                                    PF2   = normalized soil water stress factor
00122 !                                    PSW_RAD = incident solar radiation
00123 !                                    PRA   = aerodynamic resistance
00124 !
00125 REAL,DIMENSION(:),   INTENT(IN)  :: PQA, PQSAT, PLE, PPSNV, PDELTA, PLAI, PRHOA
00126 !                                    PQA   = atmospheric mixing ratio
00127 !                                    PQSAT = surface saturation mixing ratio
00128 !                                    PLE   = evapotranspiration (kgH2O kgAir-1 m s-1)
00129 !                                    PPSNV = snow cover fraction
00130 !                                    PDELTA= fraction of the foliage covered
00131 !                                        by intercepted water
00132 !                                    PLAI  = leaf area index
00133 !                                    PRHOA = air density
00134 !
00135 REAL,DIMENSION(:),    INTENT(IN)  :: PZENITH
00136 !                                    PZENITH = solar zenith angle needed 
00137 !                                    for computation of diffusuion of solar
00138 !                                    radiation: for CO2 model.
00139 !
00140 REAL,DIMENSION(:),    INTENT(IN)  :: PFZERO, PEPSO, PGAMM, PQDGAMM, PGMES, PGC,     
00141                                      PQDGMES, PT1GMES, PT2GMES, PAMAX, PQDAMAX,     
00142                                      PT1AMAX, PT2AMAX      
00143 !                                    PFZERO    = ideal value of F, no photorespiration or 
00144 !                                                saturation deficit
00145 !                                    PEPSO     = maximum initial quantum use efficiency 
00146 !                                                (kgCO2 J-1 PAR)
00147 !                                    PGAMM     = CO2 conpensation concentration (ppmv)
00148 !                                    PQDGAMM   = Log of Q10 function for CO2 conpensation 
00149 !                                                concentration
00150 !                                    PGMES     = mesophyll conductance (m s-1)
00151 !                                    PGC       = cuticular conductance (m s-1)
00152 !                                    PQDGMES   = Log of Q10 function for mesophyll conductance 
00153 !                                    PT1GMES   = reference temperature for computing 
00154 !                                                compensation concentration function for 
00155 !                                                mesophyll conductance: minimum temperature 
00156 !                                    PT2GMES   = reference temperature for computing 
00157 !                                                compensation concentration function for 
00158 !                                                mesophyll conductance: maximum temperature
00159 !                                    PAMAX     = leaf photosynthetic capacity (kg m-2 s-1)
00160 !                                    PQDAMAX   = Log of Q10 function for leaf photosynthetic capacity
00161 !                                    PT1AMAX   = reference temperature for computing 
00162 !                                                compensation concentration function for leaf 
00163 !                                                photosynthetic capacity: minimum temperature
00164 !                                    PT2AMAX   = reference temperature for computing 
00165 !                                                compensation concentration function for leaf 
00166 !                                                photosynthetic capacity: maximum temperature
00167 !
00168 REAL, DIMENSION(:,:), INTENT(IN)    :: PIACAN_SUNLIT, PIACAN_SHADE, PFRAC_SUN
00169 !
00170 REAL, DIMENSION(:), INTENT(IN)      :: PFFV ! Floodplain fraction over vegetation
00171 !
00172 REAL, DIMENSION(:,:), INTENT(INOUT) :: PIACAN ! PAR in the canopy at different gauss level
00173 !
00174 REAL,DIMENSION(:),  INTENT(INOUT) :: PABC, PAN, PANDAY, PRS, PANFM, PGPP
00175 !                                    PABC  = abscissa needed for integration
00176 !                                            of net assimilation and stomatal
00177 !                                            conductance over canopy depth
00178 !                                    PAN   = Net assimilation of CO2
00179 !                                    PANDAY= cumulated daily net assimilation of CO2 (kgCO2/m2/day)
00180 !                                    PRS   = stomatal resistance
00181 !                                    PANFM = maximum leaf assimilation
00182 !                                    PGPP  = Gross Primary Production
00183 !
00184 REAL,DIMENSION(:),    INTENT(OUT) :: PANF
00185 !                                    PANF  = total assimilation over canopy
00186 !
00187 REAL,DIMENSION(:),    INTENT(OUT) :: PRESP_LEAF
00188 !                                    PRESP_LEAF = dark respiration over canopy
00189 !
00190 !*      0.2    declarations of local variables
00191 !
00192 REAL, PARAMETER                :: ZDENOM_MIN  = 1.E-6 ! minimum denominator to prevent division by 0
00193 REAL, PARAMETER                :: ZRS_MIN     = 1.E-4 ! minimum canopy resistance (s m-1)
00194 !
00195 INTEGER                     :: JINT, JJ ! index for loops
00196 !
00197 REAL, DIMENSION(SIZE(PLAI)) :: ZCONVE1, ZTSPC, ZIA
00198 !                                 ZTSPC = temperature conversion (K to C) 
00199 !                                 ZIA   = absorbed PAR
00200 REAL, DIMENSION(SIZE(PLAI)) :: ZLAI, ZGMEST, ZFZERO, ZDMAX
00201 !                                 ZFZERO  = ideal value of F, no photorespiration or 
00202 !                                            saturation deficit
00203 !                                 ZDMAX   = maximum saturation deficit of atmosphere
00204 !                                           tolerate by vegetation
00205 !
00206 REAL, DIMENSION(SIZE(PLAI)) :: ZGAMMT, ZDSP, ZANMAX
00207 !                                 ZGAMMT  = compensation point 
00208 !                                 ZDSP    = saturation deficit of atmosphere 
00209 !                                           verses the leaf surface (with correction)
00210 !
00211 REAL, DIMENSION(SIZE(PLAI)) :: ZXMUS, ZTAN, ZTGS, ZXIA, ZAN0, ZGS0, ZXTGS, ZRDK  
00212 !                                           ZXMUS = cosine of solar zenith angle
00213 !                                           ZTAN  = sum for integrated net assimilation 
00214 !                                           ZTGS  = sum for integrated leaf conductance
00215 !                                           ZXIA  = incident radiation after diffusion
00216 !                                           ZAN0  = net asimilation at each interval
00217 !                                                   in the canopy
00218 !                                           ZGS0  = leaf conductance at each interval
00219 !                                                   in the canopy        
00220 !                                           ZXTGS = total canopy conductance
00221 !                                           ZRDK  = dark respiration
00222 !
00223 REAL, DIMENSION(SIZE(PLAI)) :: ZAN0_,ZGS0_,ZRDK_ ! parameters for shaded leaves
00224 !
00225 REAL, DIMENSION(SIZE(PLAI)) :: ZEPSO
00226 !                                           ZEPSO conversion of PEPSO in kgCO2/kgair m/s
00227 !
00228 REAL, DIMENSION(SIZE(PLAI)) :: ZDMAXSTAR, ZFZEROSTAR, ZFZERON, ZGMESTN  
00229 !                                 ZDMAXSTAR  = maximum saturation deficit of atmosphere
00230 !                                              tolerate by vegetation without soil water stress
00231 !                                 ZFZEROSTAR = initial optimal ratio Ci/Cs for woody vegetation
00232 !                                 ZFZERON    = minimum value for "fzero" in defensive woody strategy
00233 !                                 ZGMESTN    = gmest value at zf2=zf2i in offensive woody strategy
00234 !
00235 !
00236 REAL :: ZABC, ZWEIGHT
00237 !                                           ZABC    = abscissa needed for integration
00238 !                                                     of net assimilation and stomatal 
00239 !                                                     conductance over canopy depth 
00240 !                                                     (working scalar)
00241 !
00242 REAL, DIMENSION(SIZE(PLAI))    :: ZWORK !Work array
00243 !
00244 LOGICAL, DIMENSION(SIZE(PLAI)) :: LHERB, LWOOD, LF2_INF_F2I
00245 !
00246 INTEGER, DIMENSION(1)          :: IDMAX
00247 !
00248 REAL(KIND=JPRB) :: ZHOOK_HANDLE
00249 !-------------------------------------------------------------------------------
00250 !
00251 ! STOMATAL RESISTANCE: ENTRY VARIABLES TO CO2 ROUTINE:
00252 !   CS        = CO2 concentration (kgCO2 kgair-1) cs
00253 !   DSP       = specific humidity deficit (kgH2O kgair-1) ds
00254 !   TSM       = surface temperature (C) ts
00255 !   RG        = global radiation (W m-2) rg
00256 !
00257 ! initialisation: convert from ppm to mg/m-3
00258 !
00259 IF (LHOOK) CALL DR_HOOK('COTWORES',0,ZHOOK_HANDLE)
00260 !
00261 ZCONVE1(:) = XMCO2*PRHOA(:)/XMD
00262 !
00263 ! initialisation: convert from K to C
00264 !
00265 ZTSPC(:)  = PTG(:) - XTT               
00266 !
00267 ZLAI(:)   = PLAI(:)
00268 ZGMEST(:) = PGMES(:)
00269 ZFZERO(:) = PFZERO(:)
00270 !
00271 IF (HPHOTO=='AGS' .OR. HPHOTO=='LAI') THEN
00272   !
00273   !  Compute conductance and assimilation of CO2: 
00274   !
00275   ZDMAX = XDMAX_AGS
00276   !
00277   ! Add soil moisture stress effect to leaf conductance:
00278   !
00279   ZGMEST(:) = ZGMEST(:) * PF2(:)
00280   !
00281 ELSEIF (HPHOTO=='AST' .OR. HPHOTO=='LST' .OR. HPHOTO=='NIT' .OR. HPHOTO=='NCB') THEN
00282   !
00283   WHERE (PLAI(:)==XUNDEF) ZLAI(:)=0.0
00284   !
00285   !    See (Varlet-Granchet C., M. Chartier, G. Gosse,  and R. Bonhomme, 1981: 
00286   !    Rayonnement utilise pour la photosynthese des vegetaux en
00287   !    conditions naturelles: caracterisation et variations. 
00288   !    Oecol. Plant. 2(16), 189-202.)
00289   !
00290   !-------------------------------------
00291   ! Add soil moisture stress effect to leaf conductance:
00292   ! OFFENSIVE and DEFENSIVE water stress response
00293   !  
00294   ZDMAX(:)  = PDMAX(:)
00295   !
00296   LHERB      (:) = (PVEGTYPE(:,NVT_TREE) + PVEGTYPE(:,NVT_EVER) + PVEGTYPE(:,NVT_CONI)<0.5)
00297   LWOOD      (:) = (.NOT.LHERB (:))
00298   LF2_INF_F2I(:) = (PF2(:)<PF2I(:))
00299   !
00300   ! -HERBACEOUS-
00301   !
00302   WHERE (LHERB(:).AND.OSTRESSDEF(:))
00303     ZDMAX(:) = XDMAXN
00304   ENDWHERE
00305   WHERE(LHERB(:).AND..NOT.OSTRESSDEF(:))
00306     ZDMAX(:) = XDMAXX
00307   ENDWHERE
00308   !
00309   ! PAH and PBH are original coefficients of Calvet 2000
00310   WHERE(LHERB(:).AND.(.NOT.LF2_INF_F2I(:)))
00311     ZDMAXSTAR(:) = EXP((LOG(ZGMEST(:)*1000.)-PAH(:))/PBH(:))/1000.
00312     ZDMAX(:) = ZDMAXSTAR(:) - (ZDMAXSTAR(:)-ZDMAX(:))*(1.-PF2(:))/(1.-PF2I(:))
00313   ENDWHERE
00314   !
00315   WHERE(LHERB(:))
00316         ZGMEST(:) = EXP(PAH(:)+PBH(:)*LOG(ZDMAX(:)*1000.))/1000.
00317   ENDWHERE
00318   !
00319   WHERE (LHERB(:).AND.LF2_INF_F2I(:).AND.OSTRESSDEF(:))
00320       ZGMEST(:) = ZGMEST(:) * PF2(:)/PF2I(:)
00321   ENDWHERE
00322   WHERE(LHERB(:).AND.LF2_INF_F2I(:).AND.(.NOT.OSTRESSDEF(:)))
00323       ZDMAX(:) = ZDMAX(:) * PF2(:)/PF2I(:)
00324   ENDWHERE
00325   !
00326   ! to limit photosynthesis under wilting point
00327   WHERE (LHERB(:).AND.(.NOT.OSTRESSDEF(:)).AND.ZDMAX(:)<=XDMAXN)
00328     ZDMAX(:)  = XDMAXN
00329     ZGMEST(:) = (EXP(PAH(:)+PBH(:)*LOG(XDMAXN*1000.))/1000.)*PF2(:)/PF2I(:)
00330   ENDWHERE
00331   !
00332   ! -WOODY-
00333   !
00334   WHERE(LWOOD(:))
00335     ZFZEROSTAR(:) = ( XAW  - LOG(ZGMEST(:)*1000.) )/XBW
00336   ENDWHERE
00337   !
00338   WHERE (LWOOD(:).AND.OSTRESSDEF(:))
00339     ZGMESTN(:) = ZGMEST(:)
00340   ENDWHERE
00341   WHERE(LWOOD(:).AND.(.NOT.OSTRESSDEF(:)))
00342     ZGMESTN(:) = EXP(XASW - XBW*ZFZEROSTAR(:))/1000.
00343   ENDWHERE
00344   !
00345   WHERE (LWOOD(:).AND.LF2_INF_F2I(:)) 
00346     ZGMESTN(:) = ZGMESTN(:)*PF2(:)/PF2I(:)
00347   ENDWHERE
00348   !
00349   WHERE (LWOOD(:).AND.LF2_INF_F2I(:).AND.OSTRESSDEF(:)) 
00350     ZGMESTN(:) = MAX( 1.0E-10, ZGMESTN(:) )
00351   ENDWHERE
00352   !
00353   WHERE(LWOOD(:))
00354     ZFZERON(:) = (XASW - LOG(ZGMESTN(:)*1000.))/XBW
00355   ENDWHERE
00356   !
00357   WHERE(LWOOD(:).AND.(.NOT.LF2_INF_F2I(:)).AND.OSTRESSDEF(:))
00358     ZFZERO(:) = ZFZEROSTAR(:)
00359     ZFZERO(:) = ZFZERO(:) - (ZFZERO(:)-ZFZERON(:))*(1.-PF2(:))/(1.-PF2I(:))  
00360   ENDWHERE    
00361   WHERE(LWOOD(:).AND.(.NOT.LF2_INF_F2I(:)).AND.(.NOT.OSTRESSDEF(:)))
00362     ZFZERO(:) = ZFZEROSTAR(:)
00363     ZGMEST(:) = ZGMEST(:) - (ZGMEST(:)-ZGMESTN(:))*(1.-PF2(:))/(1.-PF2I(:))  
00364   ENDWHERE    
00365   !
00366   WHERE(LWOOD(:).AND.LF2_INF_F2I(:))
00367     ZFZERO(:) = MIN(.95, ZFZERON(:))
00368     ZGMEST(:) = ZGMESTN(:)
00369   ENDWHERE    
00370   !
00371 ENDIF
00372 !
00373 !-------------------------
00374 !
00375 ! compensation point (ppm): temperature response
00376 !
00377 !before optimization (with non log PQDGAMM) : 
00378 !ZGAMMT(:) = PGAMM(:)*PQDGAMM(:)**(0.1*(ZTSPC(:)-25.0))
00379 ZWORK (:) = (0.1*(ZTSPC(:)-25.0)) * PQDGAMM(:)
00380 ZGAMMT(:) = PGAMM(:) * EXP(ZWORK(:))
00381 !
00382 ! specific humidity deficit (kg kg-1)
00383 !
00384 ZDSP(:)   = MAX( 0.0, PQSAT(:) - PQA(:) - PLE(:)*PRA(:)/(PRHOA*XLVTT) )
00385 !
00386 ! cosine of solar zenith angle 
00387 !
00388 ZXMUS(:) = MAX(COS(PZENITH(:)),0.01)
00389 !
00390 !
00391 ! Compute temperature response functions:
00392 !
00393 ! kg/m2/s
00394 !before optimization (with non log PQDAMAX) : 
00395 !ZANMAX(:) = ( PAMAX(:)*PQDAMAX(:)**(0.1*(ZTSPC(:)-25.0)) ) / ...
00396 ZWORK (:) = (0.1*(ZTSPC(:)-25.0)) * PQDAMAX(:)
00397 ZANMAX(:) = ( PAMAX(:) * EXP(ZWORK(:))  ) &
00398           / ( (1.0+EXP(0.3*(PT1AMAX(:)-ZTSPC(:))))* (1.0+EXP(0.3*(ZTSPC(:)-PT2AMAX(:)))) )  
00399 !                 
00400 ! m/s
00401 !before optimization (with non log PQDGMES) : 
00402 !ZGMEST(:) = ( ZGMEST(:)*PQDGMES(:)**(0.1*(ZTSPC(:)-25.0)) ) / ...
00403 ZWORK (:) = (0.1*(ZTSPC(:)-25.0)) * PQDGMES(:)
00404 ZGMEST(:) = ( ZGMEST(:) * EXP(ZWORK(:)) ) &
00405           / ( (1.0+EXP(0.3*(PT1GMES(:)-ZTSPC(:))))*  (1.0+EXP(0.3*(ZTSPC(:)-PT2GMES(:)))) )  
00406 !
00407 !
00408 ! Integration over the canopy: SIZE(PABC) increments
00409 ! are used to approximate the integral.
00410 !
00411 ZTAN(:) = 0.0
00412 ZTGS(:) = 0.0
00413 !
00414 ! Unit conversion
00415 ! ZANMAX and ZEPSO from kgCO2/m2/s to kgCO2/kgair m/s by dividing by RHOA (kgair/m3)
00416 ! ZGAMMT from ppm to kgCO2/kgair
00417 ZGAMMT(:)  = ZGAMMT(:) * XMCO2 / XMD * 1e-6
00418 ZANMAX(:) = ZANMAX(:) / PRHOA(:)
00419 ZEPSO(:)  = PEPSO(:)  / PRHOA(:)
00420 !
00421 ZIA(:)     = PSW_RAD(:)*XPARCF
00422 !
00423 DO JINT = 1, SIZE(PABC)
00424   !
00425   !  Diffusion of incident radiation:
00426   !
00427   IF (OTR_ML) THEN
00428     !
00429     ZABC = 1.
00430     IF (JINT.LT.SIZE(PABC)) ZABC = PABC(JINT+1)
00431     ZWEIGHT = ZABC - PABC(JINT)
00432     ZXIA(:) = PIACAN_SUNLIT(:,JINT)
00433     !
00434   ELSE
00435     !
00436     ZABC = PABC(JINT)
00437     ZWEIGHT = PPOI(JINT)
00438     !
00439     CALL CCETR(ZXIA,ZIA,ZXMUS,ZABC,ZLAI)
00440     !
00441     ! PAR at different Gauss  level in micmolphot/m2/s
00442     !
00443     PIACAN(:,JINT)= ZXIA(:)
00444     !
00445   ENDIF
00446   !
00447   ! Compute conductance and assimilation of CO2: 
00448   !
00449   CALL COTWO(PCSP, PF2, ZXIA, ZDSP, ZGAMMT,             &
00450              ZFZERO, ZEPSO, ZANMAX, ZGMEST, PGC, ZDMAX, &  
00451              ZAN0, ZGS0, ZRDK                           )
00452   !
00453   IF (OTR_ML) THEN
00454     !
00455     ZXIA(:) = PIACAN_SHADE(:,JINT)
00456     CALL COTWO(PCSP, PF2, ZXIA, ZDSP, ZGAMMT,             &
00457                ZFZERO, ZEPSO, ZANMAX, ZGMEST, PGC, ZDMAX, &  
00458                ZAN0_, ZGS0_, ZRDK_                        )
00459     !
00460     WHERE (OSHADE(:))
00461       !ponderate sum.
00462       ZAN0(:)=PFRAC_SUN(:,JINT)*ZAN0(:)+(1.-PFRAC_SUN(:,JINT))*ZAN0_(:)
00463       ZRDK(:)=PFRAC_SUN(:,JINT)*ZRDK(:)+(1.-PFRAC_SUN(:,JINT))*ZRDK_(:)
00464       ZGS0(:)=PFRAC_SUN(:,JINT)*ZGS0(:)+(1.-PFRAC_SUN(:,JINT))*ZGS0_(:)
00465     ENDWHERE
00466     !
00467   ENDIF
00468   !
00469   ! kgCO2/kgair m/s
00470   ZTAN(:) = ZTAN(:) + ZAN0(:)*ZWEIGHT
00471   ZTGS(:) = ZTGS(:) + ZGS0(:)*ZWEIGHT
00472   !
00473 END DO
00474 !
00475 !
00476 ! Total assimilation
00477 !
00478 PANF(:)= ZTAN(:)
00479 !
00480 ! Net assimilation over canopy
00481 !
00482 PAN(:) = (1.0-PDELTA(:))*(1.0-PPSNV(:)-PFFV(:))*PANF(:)*ZLAI(:)
00483 !
00484 ! Dark respiration over canopy (does not depend on radiation, 
00485 ! no need to integrate over vertical dimension)
00486 !
00487 PRESP_LEAF(:) = (1.0-PDELTA(:))*(1.0-PPSNV(:)-PFFV(:))*ZRDK(:)*ZLAI(:)
00488 !
00489 ! Gross primary production over canopy
00490 !
00491 PGPP(:) = PAN(:) + PRESP_LEAF(:)
00492 !
00493 ! Cumulated daily net assimilation over canopy (kgCO2/m2/day)
00494 !
00495 PANDAY(:) = PANDAY(:) + PAN(:) * PTSTEP * PRHOA(:)
00496 !
00497 ! Adjust maximum leaf assimilation:
00498 !
00499 PANFM(:) = MAX( PANF(:), PANFM(:) )
00500 !
00501 ! Total conductance over canopy 
00502 !
00503 ZXTGS(:) = ZTGS(:)*ZLAI(:)
00504 !
00505 ! Canopy resistance from Ags:
00506 !
00507 PRS(:) = MIN( 1.0/(ZXTGS(:)+ZDENOM_MIN), XRS_MAX)
00508 PRS(:) = MAX( PRS(:), ZRS_MIN)
00509 IF (LHOOK) CALL DR_HOOK('COTWORES',1,ZHOOK_HANDLE)
00510 !
00511 END SUBROUTINE COTWORES