TreeMig Code
Loading...
Searching...
No Matches
InitAndSetConstHeightClProps.f90
Go to the documentation of this file.
1!==============================================================================
41!===============================================================
43
44 ! CALL modules for TYPE definitions and +- fixed variables>---------------------------------------------------------------
45 use all_par, only: tabsepoutput, &
50
53 IMPLICIT NONE
54
55 ! Passed variables>--------------------------------------------------------------------------------
56 INTEGER, INTENT(in) :: nspc ! Passed number of species [=spec]
57
58 ! Local variables>---------------------------------------------------------------------------------
59 INTEGER :: latIni, lonIni, & ! tmp vars to initialize grid with trees
60 isp, & ! looping variable for species
61 ltcl,htcl ! looping variable for light and height classes
62 REAL :: &
63 truht, & ! tmp var to calculate heights [=trueHeight]
64 nexht, & ! tmp var to calculate heights [=nextHeight]
65 diamt, & ! tmp var to calculate diameters [in DetermineTree.. =diam]
66 nextdm, & ! tmp var to calculate diameters [=nextDiam]
67 bio , & ! tmp var to calculate biomass [=BioMassAtHeight(..)]
68 DBHFromHeight,& ! function to calculate diameter from height <- Allometries.f90
69 LAFromDBH,& ! function to calculate leaf area from diameter <- Allometries.f90 [
70 BiomassFromDBH ! function to calculate biomass from diameter <- Allometries.f90
71 character*1 :: tab
72 ! Here the SUBROUTINE starts>**********************************************************************
73 if (tabsepoutput) then
74 tab = char(9)
75 else
76 tab = ','
77 end if
78
79 !----- initialize the light frequencies. First no trees, i.e. full light, highest lightclass frequency 1
80
81 ltfrq = 0.0
82 ltfrq(maxlc) = 1.0
83 ltcum = 1.0
84
85
86 !----- The light values and the LAI values belonging to them in the light classes are calculated
87 byltcls1: do ltcl = 1, maxlc
88 ltval(ltcl) = real(ltcl*(ltcl + 1))/real(maxlc*(maxlc + 1))
89 la(ltcl) = - log( max( ltval(ltcl)/toplt, 0.0000001 ) )/.25 ! inverse Beer-Lambert with extinction factor 0.25
90 end do byltcls1
91
92 byspcs1: do isp = 1, nspc ! species loop
93
94 !----- <Initialize the tree species in grid cells and height classes array [=DetermineTreeSizeVariables]>
95 latloop1: do latini = 1, maxlat ! spatial loops
96 lonloop1: do lonini = 1, maxlon ! spatial loops
97 !----- Here the state variable values for all height classes are initialized to zero
98 byhtcls11: do htcl = 0, maxhc
99 stategrid(latini, lonini)%sp(isp)%numin(htcl) = 0.0
100 end do byhtcls11
101 !----- Here the state variable values for the antagonists, the seedbank and the seedrain are initialized to zero
102 stategrid(latini, lonini)%sp(isp)%antagonist = 10.0
103 stategrid(latini, lonini)%sp(isp)%seedBank = 0.0
104 seedrain(latini, lonini)%sp(isp)%newSeeds = 0.0
105 end do lonloop1
106 end do latloop1
107
108 !----- Here height class dependent but constant values are calculated: biomass, diameter, LA, height
109 nexht = birht
110 nextdm = dbhfromheight(birht, birht, spec(isp)%khmax,spec(isp)%maxdhm)
111 byhtcls1: do htcl = 1, spec(isp)%maxhtc !---- from bottom to top
112 truht = nexht
113 nexht = min((real(htcl)*hcwidth) + birht, real(spec(isp)%khmax)) ! height belonging to height class
114 speccl(isp)%htmin(htcl) = truht ! store height
115 diamt = nextdm
116 nextdm= dbhfromheight(nexht, birht, spec(isp)%khmax,spec(isp)%maxdhm) ! get diameter
117 speccl(isp)%diain(htcl) = diamt ! store diameter
118 speccl(isp)%lain(htcl) = lafromdbh(diamt, spec(isp)%tb,spec(isp)%stn)
119 if (nextdm > diamt) then
120 bio = biomassfromdbh(diamt, spec(isp)%tb, spec(isp)%stn )
121 speccl(isp)%bioin(htcl) = bio * 10 / pltsiz
122 !NZ: use factor 10000 instead of 10 if biomass is stem volume
123 ! factor 10 transforms kg/m2 to t/ha, if you use biomass (normal version)
124 ! factor 10000 transforms into dm3 per ha (NOT m3!!) if stem volume is used instead of biomass
125 ! (see SUBROUTINEs BiomassFromDBH, and Report)
126
127 else ! if at top, then the mean between this biomass and the one at the next height (=diameter) class is taken
128 bio = biomassfromdbh(diamt, spec(isp)%tb, spec(isp)%stn)
129 speccl(isp)%bioin(htcl) = bio*10/pltsiz
130 bio = biomassfromdbh(nextdm, spec(isp)%tb, spec(isp)%stn)
131 speccl(isp)%bioin(htcl) = (speccl(isp)%bioin(htcl) + (bio*10/pltsiz))/2.0
132 end if
133 end do byhtcls1
134
135 !----- Here the values for the lowest height class (seedlings up to 1.37 m) are set...
136 speccl(isp)%htmin(0) = 0.0
137 speccl(isp)%diain(0) = 0.0
138 speccl(isp)%lain(0) = speccl(isp)%lain(1) /10.0 ! rough guess
139 speccl(isp)%bioin(0) = speccl(isp)%bioin(1)/10.0 ! rough guess
140 !----- ...and the states initialized
141 latloop2: do latini = 1, maxlat
142 lonloop2: do lonini = 1, maxlon
143 stategrid(latini, lonini)%sp(isp)%numin(0) = 0.0
144 end do lonloop2
145 end do latloop2
146
147 !----- Here the seed production is determined proportional to LA
148 byhtcls3: do htcl = 0, spec(isp)%maxhtc
149 if (speccl(isp)%htmin(htcl) >= spec(isp)%minmat) then
150 speccl(isp)%seedprod(htcl) = speccl(isp)%lain(htcl) / &
151 speccl(isp)%lain(spec(isp)%maxhtc)
152 else
153 speccl(isp)%seedprod(htcl) = 0
154 end if
155 end do byhtcls3
156
157 !----- Here the values for all height classes higher than the max. one are set
158 if (spec(isp)%maxhtc < maxhc) then
159 resthtcls2: do htcl = spec(isp)%maxhtc + 1, maxhc
160 speccl(isp)%htmin(htcl) = real(spec(isp)%khmax) + 1.0
161 speccl(isp)%diain(htcl) = spec(isp)%maxdhm
162 speccl(isp)%lain(htcl) = 0.0
163 speccl(isp)%bioin(htcl) = 0.0
164 speccl(isp)%seedprod(htcl) = 0
165
166 latloop3: do latini = 1, maxlat
167 lonloop3: do lonini = 1, maxlon
168 stategrid(latini, lonini)%sp(isp)%numin(htcl) = 0.0
169 end do lonloop3
170 end do latloop3
171 end do resthtcls2
172
173 speccl(isp)%htmin(spec(isp)%maxhtc + 1) = spec(isp)%khmax
174 speccl(isp)%htmin(maxhc) = htmax
175 end if
176
177 end do byspcs1
178
179 !----- Write out height and species dependent fixed transformation factors to files
180 byhtcls4: do htcl = 0, maxhc
181 write (biompertreehcloutfile%unit, 101) 0, tab, 0, tab, 0, tab,&
182 (speccl(isp)%bioin(htcl), tab, isp=1, nspc) , 0.
183 write (laipertreehcloutfile%unit, 101) 0, tab, 0, tab, 0, tab,&
184 (speccl(isp)%lain(htcl), tab, isp=1, nspc) , 0.
185 write (dbhpertreehcloutfile%unit, 101) 0, tab, 0, tab, 0, tab,&
186 (speccl(isp)%diain(htcl), tab, isp=1, nspc) , 0.
187 write (seedprodfractpertreehcloutfile%unit, 101) 0, tab, 0, tab, 0, tab,&
188 (speccl(isp)%seedprod(htcl), tab, isp=1, nspc) , 0.
189 write (heightperhcloutfile%unit, 101) 0, tab, 0, tab, 0, tab,&
190 (speccl(isp)%htmin(htcl), tab, isp=1, nspc) , 0.
191 end do byhtcls4
192 !----- Write out light class dependent relativ light intensities and LAI's leading to these
193 write (lightandleafareaperlightclass%unit,102) 0,tab, 0,tab,0,tab,0, tab, ( ltval(ltcl),tab, ltcl=1,maxlc)
194 write (lightandleafareaperlightclass%unit,102) 0,tab, 0,tab,0,tab,0, tab, ( la(ltcl),tab, ltcl=1,maxlc)
195
196
197
198 101 FORMAT(3(i1, a1), 60(e13.7, a1))
199 102 FORMAT(4(i1, a1), 20(e11.5, a1))
200
201
202
203
204end SUBROUTINE initandsetconstheightclprops
205!
206!done
subroutine initandsetconstheightclprops(nspc)
InitAndSetConstHeightClProps.
real pltsiz
Definition All_par.f90:125
integer, parameter maxhc
Definition All_par.f90:99
real, dimension(maxlc) ltval
Definition All_par.f90:370
real hcwidth
Definition All_par.f90:357
type(specpropertiesincl), dimension(maxspc) speccl
Definition All_par.f90:346
type(specproperties), dimension(maxspc) spec
Definition All_par.f90:345
type(currstateincell), dimension(:, :), allocatable stategrid
Definition All_par.f90:340
real, parameter toplt
Definition All_par.f90:121
integer, parameter maxlc
Definition All_par.f90:100
real, dimension(5) a1
Definition All_par.f90:130
real, dimension(maxlc) la
Definition All_par.f90:130
integer real
Definition All_par.f90:27
integer maxlon
Definition All_par.f90:46
real, parameter birht
Definition All_par.f90:120
real, dimension(maxlc) ltfrq
Definition All_par.f90:367
real, dimension(maxlc) ltcum
Definition All_par.f90:368
type(newseedsincell), dimension(:, :), allocatable seedrain
Definition All_par.f90:342
logical tabsepoutput
Definition All_par.f90:89
integer htmax
Definition All_par.f90:358
integer, parameter max
Definition All_par.f90:98
integer maxlat
Definition All_par.f90:45
type(file) heightperhcloutfile
type(file) seedprodfractpertreehcloutfile
type(file) lightandleafareaperlightclass
type(file) biompertreehcloutfile
type(file) laipertreehcloutfile
type(file) dbhpertreehcloutfile