TreeMig Code
Loading...
Searching...
No Matches
Report.f90
Go to the documentation of this file.
1!==============================================================================
2!
3! Name : Report
4!
5! Remarks: contains the SUBROUTINE
6!
7! Report (<LocalDynOneTimeStep<DistrLocalDynThisTime<TimeLoop<TreeMig)
8!
9!==============================================================================
10! design : H. Lischke, N. Zimmermann
11! author(s) : H. Lischke, N. Zimmermann
12! implementation : H. Lischke, N. Zimmermann
13! cleaner : T.J. Loeffler
14! copyright : (c) 1999, 03 by H. Lischke
15!==============================================================================
16
17!=====================================================================
57!===============================================================
58SUBROUTINE report(nspc, year, lat, lon)
59 ! <CALL modules for TYPE definitions and +- fixed variables>---------------------------------------------------------------
64 use filelistmodule, only: &
69
70
71 IMPLICIT NONE
72
73 ! <Passed variables>--------------------------------------------------------------------------------
74 INTEGER, INTENT(in) :: nspc, year, lat, lon ! Passed number of species, year of calculation
75
76 ! <Local variables>---------------------------------------------------------------------------------
77 INTEGER :: height, & ! loop-counter
78 i , & ! loop-counter
79 rpti
80 REAL :: bio(nspc), & ! species biomass
81 num(nspc), & ! species number
82 basalArea(nspc), & ! basal area
83 pollen(nspc), pol4perc(nspc), & ! pollen amount and 4*percent
84 sumpollen, &
85 sumbio, sumbasalarea, diversity, &
86 sumnumber, sumseeds, sumantagon, sumingrowth, &
87 BiodivIndex, sumnumbh(0:maxhc), lai(nspc), sumlai, rbio, yr, rlat, rlon, totNPP, num_i
88
89 character*1 :: tab
90
91 ! <Here the SUBROUTINE starts>**********************************************************************
92
95 !----- Calculate NPP
96 ! totLAI = 0.
97 do i = 1, nspc
98 sumbio = 0
99 do height = 1, spec(i)%maxhtc
100 rbio = (stategrid(lat, lon)%sp(i)%numin(height))*(speccl(i)%bioin(height))
101 sumbio = sumbio + rbio
102 end do !height
103 stategrid(lat, lon)%sp(i)%NPP = sumbio - stategrid(lat, lon)%sp(i)%specTotalBiomass
104 stategrid(lat, lon)%sp(i)%specTotalBiomass = sumbio
105 totnpp = totnpp + stategrid(lat, lon)%sp(i)%NPP
106 end do
107
108!----- Calculate av. biomasses
109 yr = year + simustartyear
110 rpti = 1
111 do i=1,10 ! determine current report interval
112 if (yr >= reportintervals(i,2) .and. yr <= reportintervals(i,3) ) then
113 rpti=reportintervals(i,1)
114 exit
115 end if
116 end do
117 if (((mod(year, rpti) == 0)) .AND. (stockability(lat, lon) > 0.0)) then
118 sumbio = 0
119 sumnumber = 0
120 sumseeds = 0
121 sumantagon = 0
122 sumpollen = 0
123 sumingrowth = 0
124 sumnumbh = 0
125 sumlai = 0
126 sumbasalarea =0
127 !----- Calculate biomass and density sums over species in heights and total
128 byspc: do i = 1, nspc
129 bio(i) = 0
130 num(i) = 0
131 pollen(i) = 0
132 lai(i) = 0
133 basalarea(i) = 0
134
135 do height = 1, spec(i)%maxhtc
136 num_i = stategrid(lat, lon)%sp(i)%numin(height)
137 num(i) = num(i) + num_i
138 bio(i) = bio(i) + num_i * speccl(i)%bioin(height)
139 lai(i) = lai(i) + num_i * speccl(i)%lain(height)/833.0
140 basalarea(i) = basalarea(i) + num_i * ((speccl(i)%diaIn(height)/2 )**2) * pi * 10000./833.
141 pollen(i) = pollen(i) + num_i * speccl(i)%seedprod(height) * spec(i)%repFac
142 sumnumbh(height) = sumnumbh(height) + num_i
143 end do
144
145 ! sumseeds = sumseeds + stateGrid(lat,lon)%sp(i)%seedBank
146 sumseeds = sumseeds + seedrain(lat, lon)%sp(i)%newseeds
147 sumingrowth = sumingrowth + stategrid(lat, lon)%sp(i)%ingrowth
148 sumantagon = sumantagon + stategrid(lat, lon)%sp(i)%antagonist
149 sumbio = sumbio + bio(i)
150 sumnumber = sumnumber + num(i)
151 sumpollen = sumpollen + pollen(i)
152 sumlai = sumlai + lai(i)
153 sumbasalarea =sumbasalarea + basalarea(i)
154 end do byspc
155
156 !----- Calculate pollen percent
157 if (abs(sumpollen) < 1.e-20) then
158 pol4perc = 0.0
159 else
160 pol4perc = 100.0*pollen/sumpollen
161 end if
162
163 if (tabsepoutput) then
164 tab = char(9)
165 else
166 tab = ','
167 end if
168 if(writeoutput%netcdf) then
169 !----- write values of diversity
170 if (writeoutput%biodiv) then
171 diversity = biodivindex(nspc, bio, sumbio)
172 biodiv_nc%values2D(lon, lat) = diversity
173 end if
174
175 !----- write values of biomass (t/ha) per species
176 if (writeoutput%biomass) then
177 do i=1,nspc
178 biomass_nc%values3D(i,lon, lat) = bio(i)
179 end do
180 biomass_nc%values3D(nspc+1,lon, lat) = sumbio
181 end if
182 !----- write values of density (1/patchsize) per species
183 if (writeoutput%number) then
184 do i=1,nspc
185 number_nc%values3D(i,lon, lat) = num(i)*10000/pltsiz
186 end do
187 number_nc%values3D(nspc+1,lon, lat) = sumnumber*10000/pltsiz ! number per ha
188 end if
189 !----- write values of the seed numbers in seed bank (1/patchsize) per species
190 if (writeoutput%seeds) then
191 do i=1,nspc
192 seed_nc%values3D(i,lon, lat) = stategrid(lat, lon)%sp(i)%sb
193 end do
194 seed_nc%values3D(nspc+1,lon, lat) = sumseeds
195 end if
196 !----- write values of ingrowth (1/patchsize) per species
197 if (writeoutput%ingrowth) then
198 do i=1,nspc
199 ingrowth_nc%values3D(i,lon, lat) = stategrid(lat,lon)%sp(i)%ingrowth
200 end do
201 ingrowth_nc%values3D(nspc+1,lon, lat) = sumingrowth
202 end if
203 !----- write values of the NPP (t/ha) per species
204 if (writeoutput%NPP) then
205 do i=1,nspc
206 npp_nc%values3D(i,lon, lat) = stategrid(lat, lon)%sp(i)%NPP
207 end do
208 npp_nc%values3D(nspc+1,lon, lat) = totnpp
209 end if
210 !----- write values of basal area (m2/ha) per species
211 if (writeoutput%basalArea) then
212 do i=1,nspc
213 basalarea_nc%values3D(i,lon, lat) = basalarea(i)
214 end do
215 basalarea_nc%values3D(nspc+1,lon, lat) = sumbasalarea
216 end if
217 !----- write values of antagonists
218 if (writeoutput%antagonists) then
219 do i=1,nspc
220 antagonist_nc%values3D(i,lon, lat) = stategrid(lat, lon)%sp(i)%antagonist
221 end do
222 antagonist_nc%values3D(nspc+1,lon, lat) = sumantagon
223 end if
224 !----- write values of pollen percents
225 if (writeoutput%pollen) then
226 do i=1,nspc
227 pollen_nc%values3D(i,lon, lat) = pol4perc(i)
228 end do
229 pollen_nc%values3D(nspc+1,lon, lat) = sumpollen
230 end if
231 !----- write values of lai (m^2/m^2) per species
232 if (writeoutput%lai) then
233 do i=1,nspc
234 lai_nc%values3D(i,lon, lat) = lai(i)
235 end do
236 lai_nc%values3D(nspc+1,lon, lat) = sumlai
237 end if
238 !----- write values of light distributions (fraction in lightclasses)
239 if (writeoutput%light) then
240 do height = 1, maxhc+1
241 do i=1,maxlc
242 light_nc%values4D(height, i, lon, lat) = ltprf(height-1,i)
243 end do
244 end do
245 end if
246 !----- write values of height structure
247 if (writeoutput%hstruct) then
248 do i = 1, nspc
249 sumnumbh(0) = sumnumbh(0) + stategrid(lat, lon)%sp(i)%numin(0)
250 end do
251 do height = 0, maxhc
252 do i=1,nspc
253 heightstruct_nc(height+1)%values3D(i,lon, lat) = stategrid(lat, lon)%sp(i)%numin(height)
254 end do
255 heightstruct_nc(height+1)%values3D(nspc+1,lon, lat) = sumnumbh(height)
256 end do
257 end if
258 else ! not netcdf
259 !----- Output of diversity
260 if (writeoutput%biodiv) then
261 diversity = biodivindex(nspc, bio, sumbio)
262 write (biodivoutfile%unit, 100) lat, tab, lon, tab, year, tab, diversity
263 end if
264
265 !----- Output of biomass (t/ha) per species
266 if (writeoutput%biomass) then
267 write (biomassoutfile%unit, 100) lat, tab, lon, tab, year, tab, &
268 (bio(i), tab, i=1, nspc), sumbio
269 end if
270 !----- Output of density (1/patchsize) per species
271 if (writeoutput%number) then
272 write (numberoutfile%unit, 100) lat, tab, lon, tab, year, tab, &
273 (num(i)*10000/pltsiz, tab, i=1, nspc), sumnumber*10000/pltsiz ! number per ha
274 end if
275 !----- output of the seed numbers in seed bank (1/patchsize) per species
276 if (writeoutput%seeds) then
277 write (seedoutfile%unit, 100) lat, tab, lon, tab, year, tab, &
278 (stategrid(lat, lon)%sp(i)%sb, tab, i=1, nspc), sumseeds
279 end if
280 !----- output of the ingrowth (1/patchsize) per species
281 if (writeoutput%ingrowth) then
282 write(ingrowthoutfile%unit,100) lat, tab, lon, tab, year, tab, &
283 (stategrid(lat,lon)%sp(i)%ingrowth , tab, i=1,nspc), sumingrowth
284 end if
285 !----- output of the NPP (t/ha) per species
286 if (writeoutput%NPP) then
287 write (nppoutfile%unit, 100) lat, tab, lon, tab, year, tab, &
288 (stategrid(lat, lon)%sp(i)%NPP, tab, i=1, nspc), totnpp
289 end if
290 !----- output of the basal area (m2/ha) per species
291 if (writeoutput%basalArea) then
292 write (basareaoutfile%unit, 100) lat, tab, lon, tab, year, tab, &
293 (basalarea(i), tab, i=1, nspc), sumbasalarea
294 end if
295 !----- output of the antagonists
296 if (writeoutput%antagonists) then
297 write (antaoutfile%unit, 100) lat, tab, lon, tab, year, tab, &
298 (stategrid(lat, lon)%sp(i)%antagonist, tab, i=1, nspc), sumantagon
299 end if
300 !----- output of the pollen percents
301 if (writeoutput%pollen) then
302 write (pollenoutfile%unit, 100) lat, tab, lon, tab, year, tab, &
303 (pol4perc(i),tab, i=1,nspc), sumpollen
304 end if
305 !----- output of the lai (m^2/m^2) per species
306 if (writeoutput%lai) then
307 write (laioutfile%unit, 100) lat, tab, lon, tab, year, tab, &
308 (lai(i), tab, i=1, nspc), sumlai
309 end if
310
311 !----- output of the height structure (1/patchsize)
312 if (writeoutput%hstruct) then
313 do i = 1, nspc
314 sumnumbh(0) = sumnumbh(0) + stategrid(lat, lon)%sp(i)%numin(0)
315 end do
316 do height = 0, maxhc
317 write (heightstructoutfiles(height + 1)%unit, 100) lat, tab, lon, tab, year, tab, &
318 (stategrid(lat, lon)%sp(i)%numin(height), tab, i=1, nspc), sumnumbh(height)
319 end do
320 end if
321
322 !----- output of the light distributions (fraction in lightclasses)
323 if (writeoutput%light) then
324 do height = 0, maxhc
325 write (lightdistrperhcloutfile%unit, 101) lat, tab, lon, tab, year, tab, height, tab,&
326 (ltprf(height,i), tab, i=1, maxlc)
327 end do
328 end if
329 end if
330
331 end if
332100 FORMAT(3(i5, a1), 60(e13.7, a1))
333101 FORMAT(4(i5, a1), 40(e13.7, a1))
334end SUBROUTINE report
subroutine report(nspc, year, lat, lon)
Report.
Definition Report.f90:59
real pltsiz
Definition All_par.f90:125
real lonrealstart
Definition All_par.f90:50
real, dimension(:, :), allocatable stockability
Definition All_par.f90:53
integer simustartyear
Definition All_par.f90:27
real, dimension(0:maxhc, maxlc) ltprf
Definition All_par.f90:369
integer, dimension(10, 3) reportintervals
Definition All_par.f90:29
integer, parameter maxhc
Definition All_par.f90:99
real cellsidelength
Definition All_par.f90:63
real unitofspatialdata
Definition All_par.f90:53
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
type(wroutp) writeoutput
Definition All_par.f90:143
integer, parameter maxlc
Definition All_par.f90:100
real, dimension(5) a1
Definition All_par.f90:130
real latrealstart
Definition All_par.f90:50
character(len=:), allocatable e
Definition All_par.f90:93
type(newseedsincell), dimension(:, :), allocatable seedrain
Definition All_par.f90:342
logical tabsepoutput
Definition All_par.f90:89
real, parameter pi
Definition All_par.f90:119
type(ncvar) basalarea_nc
type(file) nppoutfile
type(file) biodivoutfile
type(ncvar) ingrowth_nc
type(ncvar) antagonist_nc
type(ncvar) number_nc
type(ncvar), dimension(16) heightstruct_nc
type(ncvar) light_nc
type(file) numberoutfile
type(file) lightdistrperhcloutfile
type(ncvar) lai_nc
type(file) biomassoutfile
type(file) pollenoutfile
type(file) ingrowthoutfile
type(file) seedoutfile
type(ncvar) biodiv_nc
type(ncvar) biomass_nc
type(file), dimension(16) heightstructoutfiles
type(file) antaoutfile
type(file) laioutfile
type(ncvar) npp_nc
type(ncvar) pollen_nc
type(ncvar) seed_nc
type(file) basareaoutfile