source: branches/ORCHIDEE_EXT/ORCHIDEE/src_stomate/lpj_cover.f90 @ 64

Last change on this file since 64 was 64, checked in by didier.solyga, 13 years ago

Import first version of ORCHIDEE_EXT

File size: 5.0 KB
Line 
1! recalculate vegetation cover and LAI
2!
3! $Header: /home/ssipsl/CVSREP/ORCHIDEE/src_stomate/lpj_cover.f90,v 1.9 2010/04/06 15:44:01 ssipsl Exp $
4! IPSL (2006)
5!  This software is governed by the CeCILL licence see ORCHIDEE/ORCHIDEE_CeCILL.LIC
6!
7MODULE lpj_cover
8
9  ! modules used:
10
11  USE ioipsl
12  USE stomate_data
13  USE pft_parameters
14
15  IMPLICIT NONE
16
17  ! private & public routines
18
19  PRIVATE
20  PUBLIC cover
21
22CONTAINS
23
24  SUBROUTINE cover (npts, cn_ind, ind, biomass, &
25       veget_max, veget_max_old, veget, lai, litter, carbon)
26
27    !
28    ! 0 declarations
29    !
30
31    ! 0.1 input
32
33    ! Domain size
34    INTEGER(i_std), INTENT(in)                                   :: npts
35    ! crown area (m**2) per ind.
36    REAL(r_std), DIMENSION(npts,nvm), INTENT(in)          :: cn_ind
37    ! density of individuals (1/(m**2 of ground))
38    REAL(r_std), DIMENSION(npts,nvm), INTENT(in)          :: ind
39    REAL(r_std), DIMENSION(npts,nvm), INTENT(in)          :: veget_max_old
40
41    ! 0.2 modified fields
42    ! biomass (gC/(m**2 of ground))
43    REAL(r_std), DIMENSION(npts,nvm,nparts), INTENT(inout)   :: biomass
44    ! "maximal" coverage fraction of a PFT (LAI -> infinity) on ground
45    REAL(r_std), DIMENSION(npts,nvm), INTENT(inout)       :: veget_max
46
47    ! 0.3 output
48
49    ! fractional coverage on ground, taking into account LAI (=grid-scale fpc)
50    REAL(r_std), DIMENSION(npts,nvm), INTENT(inout)       :: veget
51    ! leaf area index OF AN INDIVIDUAL PLANT
52    REAL(r_std), DIMENSION(npts,nvm), INTENT(in)         :: lai
53
54    ! metabolic and structural litter, above and below ground (gC/(m**2 of ground))
55    REAL(r_std),DIMENSION(npts,nlitt,nvm,nlevs), INTENT(inout)         :: litter
56    !  carbon pool: active, slow, or passive,(gC/(m**2 of ground))
57    REAL(r_std),DIMENSION(npts,ncarb,nvm), INTENT(inout)               :: carbon
58
59    ! 0.4 local
60
61    ! index
62    INTEGER(i_std)                                         :: i,j
63
64    ! Litter dilution (gC/m²)
65    REAL(r_std),DIMENSION(npts,nlitt,nlevs)                            :: dilu_lit
66    ! Soil Carbondilution (gC/m²)
67    REAL(r_std),DIMENSION(npts,ncarb)                                  :: dilu_soil_carbon
68
69    ! conversion vectors
70    REAL(r_std),DIMENSION(nvm)                                         :: delta_veg
71    ! vecteur de conversion
72    REAL(r_std)                                                        :: delta_veg_sum
73
74    ! =========================================================================
75
76    !
77    ! 1 If the vegetation is dynamic, calculate new maximum vegetation cover for
78    !   natural plants
79    !
80
81    IF ( control%ok_dgvm ) THEN
82
83       veget_max(:,ibare_sechiba) = 1.
84
85       DO j = 2,nvm
86
87          IF ( natural(j) ) THEN
88
89             veget_max(:,j) = ind(:,j) * cn_ind(:,j)
90
91          ENDIF
92
93          veget_max(:,ibare_sechiba) = veget_max(:,ibare_sechiba) - veget_max(:,j)
94
95       ENDDO
96
97       veget_max(:,ibare_sechiba) = MAX( veget_max(:,ibare_sechiba), zero )
98
99    ENDIF
100
101    DO i = 1, npts         
102       ! Generation of the conversion vector
103
104       delta_veg(:) = veget_max(i,:)-veget_max_old(i,:)
105       delta_veg_sum = SUM(delta_veg,MASK=delta_veg.LT.zero)
106
107       dilu_lit(i,:,:) = zero
108       dilu_soil_carbon(i,:) = zero
109       DO j=1, nvm
110          IF ( delta_veg(j) < -min_stomate ) THEN
111             dilu_lit(i,:,:)=  dilu_lit(i,:,:) - delta_veg(j)*litter(i,:,j,:) / delta_veg_sum
112             dilu_soil_carbon(i,:)=  dilu_soil_carbon(i,:) - delta_veg(j) * carbon(i,:,j) / delta_veg_sum
113          ENDIF
114       ENDDO
115
116       DO j=1, nvm
117          IF ( delta_veg(j) > min_stomate) THEN
118
119             ! Dilution of reservoirs
120
121             ! Litter
122             litter(i,:,j,:)=(litter(i,:,j,:) * veget_max_old(i,j) + dilu_lit(i,:,:) * delta_veg(j)) / veget_max(i,j)
123
124             ! Soil carbon
125             carbon(i,:,j)=(carbon(i,:,j) * veget_max_old(i,j) + dilu_soil_carbon(i,:) * delta_veg(j)) / veget_max(i,j)
126
127          ENDIF
128          !SZ correct biomass to conserve mass since it's defined on veget_max
129          IF(j.GE.2.AND.veget_max_old(i,j).GT.min_stomate.AND.veget_max(i,j).GT.min_stomate) THEN
130             biomass(i,j,:)=biomass(i,j,:)*veget_max_old(i,j)/veget_max(i,j)
131          ENDIF
132
133       ENDDO
134    ENDDO
135
136    !
137    ! 2 Calculate LAI
138    !   The LAI is defined on the space covered by the crown of the plant.
139    !    ( biomass / veget_max ) is in gC/(m**2 covered by the crown)
140    !
141    !MM in Soenke code but not in merge version ; must keep that ??
142!!$    DO j = 2,nvm
143!!$       lai(:,j) = biomass(:,j,ileaf,icarbon)*sla(j)
144!!$    ENDDO
145
146    !
147    ! 3 calculate grid-scale fpc (foliage protected cover)
148    !
149
150    DO j = 2,nvm
151       DO i = 1, npts
152          IF (lai(i,j) == val_exp) THEN               
153             veget(i,j) = veget_max(i,j)
154          ELSE
155             veget(i,j) = veget_max(i,j) * ( 1. - exp( - lai(i,j) * ext_coeff(j) ) )
156          ENDIF
157       ENDDO
158    ENDDO
159    !
160    veget(:,ibare_sechiba) = un
161    DO j = 2,nvm
162       veget(:,ibare_sechiba) = veget(:,ibare_sechiba) - veget(:,j)
163    ENDDO
164
165  END SUBROUTINE cover
166
167END MODULE lpj_cover
Note: See TracBrowser for help on using the repository browser.