source: branches/publications/ORCHIDEE_CAN_r2290/src_stomate/stomate_stand_structure.f90 @ 5242

Last change on this file since 5242 was 2212, checked in by matthew.mcgrath, 10 years ago

DEV: Using the effective variables to make sure we don't have problems after a stand is coppiced

File size: 6.1 KB
Line 
1! =================================================================================================================================
2! MODULE       : stomate_stand_structure
3!
4! CONTACT      : orchidee-help _at_ ipsl.jussieu.fr
5!
6! LICENCE      : IPSL (2006)
7! This software is governed by the CeCILL licence see ORCHIDEE/ORCHIDEE_CeCILL.LIC
8!
9!>\BRIEF         Initialize and update density, crown area.
10!!
11!!\n DESCRIPTION: None
12!!
13!! RECENT CHANGE(S): None
14!!
15!! REFERENCE(S) :
16!!
17!! SVN          :
18!! $HeadURL: svn://forge.ipsl.jussieu.fr/orchidee/branches/ORCHIDEE-DOFOCO/ORCHIDEE/src_stomate/stomate_prescribe.f90 $
19!! $Date: 2013-01-04 16:50:56 +0100 (Fri, 04 Jan 2013) $
20!! $Revision: 1126 $
21!! \n
22!_ ================================================================================================================================
23
24MODULE stomate_stand_structure
25
26  ! modules used:
27
28  USE ioipsl_para
29  USE stomate_data
30  USE pft_parameters
31  USE constantes
32  USE function_library, ONLY:wood_to_height_eff, wood_to_dia_eff, wood_to_cv_eff, wood_to_cn_eff 
33
34  IMPLICIT NONE
35
36  ! private & public routines
37
38  PRIVATE
39  PUBLIC stand_structure_clear, derive_biomass_quantities
40
41    ! first call
42    LOGICAL, SAVE                                    :: firstcall = .TRUE.
43   
44CONTAINS
45
46! =================================================================================================================================
47!! SUBROUTINE   : stand_structure_clear
48!!
49!>\BRIEF        : Set the firstcall flag back to .TRUE. to prepare for the next simulation.
50!_=================================================================================================================================
51
52  SUBROUTINE stand_structure_clear
53    firstcall=.TRUE.
54  END SUBROUTINE stand_structure_clear
55
56
57!! ================================================================================================================================
58!! SUBROUTINE   :derive_biomass_quantities
59!!
60!>\BRIEF        Use the basal areabiomass and number density to derive various
61!!              distributions of the trees in a single grid point for
62!!              all vegetation types
63!!
64!! DESCRIPTION  : I have chosen to do this for a single grid point instead of
65!!                the whole map or a single grid point and single PFT because
66!!                of the compromise between speed (subroutine overhead) and
67!!                flexibility
68!!
69!! RECENT CHANGE(S) : None
70!!
71!! MAIN OUTPUT VARIABLE(S): ::height_dist, ::diameter_dist, ::cn_area_dist, ::cn_vol_dist
72!!
73!! REFERENCE(S) :
74!!
75!! FLOWCHART : None
76!! \n
77!_ ================================================================================================================================
78
79  SUBROUTINE derive_biomass_quantities(npts, nvm, ncirc, circ_class_n, &
80       circ_class_biomass, values)
81
82  !! 0 Variable and parameter declaration
83 
84    !! 0.1 Input variables
85    INTEGER,INTENT(IN)                                      :: npts               !! Number of pixels
86    INTEGER,INTENT(IN)                                      :: nvm                !! Number of PFT types
87    INTEGER,INTENT(IN)                                      :: ncirc              !! Number of circumference classes
88    REAL(r_std), DIMENSION(npts,nvm,ncirc,nparts,nelements), &
89         INTENT(IN)                                         :: circ_class_biomass !! Biomass of the componets of the model 
90                                                                                  !! tree within a circumference
91                                                                                  !! class @tex $(gC ind^{-1})$ @endtex
92    REAL(r_std), DIMENSION(npts,nvm,ncirc), INTENT(IN) &
93                                                            :: circ_class_n       !! Number of trees within each circumference
94                                                                                  !! class @tex $(m^{-2})$ @endtex
95
96    !! 0.2 Output variables
97
98    REAL(r_std),DIMENSION(npts,nvm,ncirc,ndist_types),INTENT(OUT)  &
99                                                            :: values             !! An array which holds data for
100                                                                                  !! various canopy parameters
101
102
103    !! 0.3 Modified variables
104
105    !! 0.4 Local variables
106
107    INTEGER(i_std)                                          :: ipts, ivm, icir, &
108                                                                       idist_type !! index (unitless)
109!_ ================================================================================================================================
110
111    IF (bavard.GE.2) WRITE(numout,*) 'Entering derive_biomass_quantities'
112
113    ! zero everything
114    values(:,:,:,:)=zero
115
116    DO ipts=1,npts
117       DO ivm=1,nvm
118
119          IF (.NOT. is_tree(ivm)) CYCLE
120
121          ! compute the new mean values
122
123          ! for the height
124          values(ipts,ivm,:,iheight)=&
125               wood_to_height_eff(circ_class_biomass(ipts,ivm,:,:,icarbon),ivm)
126
127          ! for the crown area
128          values(ipts,ivm,:,icnarea)=&
129               wood_to_cn_eff(circ_class_biomass(ipts,ivm,:,:,icarbon),ivm)
130
131          ! for the stem diameter
132          values(ipts,ivm,:,idiameter)=&
133               wood_to_dia_eff(circ_class_biomass(ipts,ivm,:,:,icarbon),ivm)
134
135          ! for the crown volume
136          values(ipts,ivm,:,icnvol)=&
137               wood_to_cv_eff(circ_class_biomass(ipts,ivm,:,:,icarbon),ivm)
138
139          ! these next two assume the crowns are ellipsoids...since we are
140          ! interested in spheres at the moment, we just set the two crown
141          ! diameters to be equal for the verticle crown diameter
142          DO icir=1,ncirc
143             values(ipts,ivm,icir,icndiaver)=&
144                  2.0_r_std*(3.0_r_std*values(ipts,ivm,icir,icnvol)/&
145                  (4.0_r_std*pi))**(un/3.0_r_std)
146          ENDDO
147
148          ! for the horizontal crown diameter
149          values(ipts,ivm,:,icndiahor)=values(ipts,ivm,:,icndiaver)
150
151       ENDDO ! loop over PFT
152
153    ENDDO ! loop over points
154
155    IF (bavard.GE.2) WRITE(numout,*) 'Leaving derive_biomass_quantities'
156
157 END SUBROUTINE derive_biomass_quantities
158
159
160END MODULE stomate_stand_structure
161
162
163
Note: See TracBrowser for help on using the repository browser.