TreeMig Code
Loading...
Searching...
No Matches
LocalForestDynamics.f90
Go to the documentation of this file.
1!==============================================================================
2!
3! Name : LocalForestDynamics
4!
5! Purpose: calculates the forest dynamics in one cell
6!
7! Remarks: contains the SUBROUTINE
8!
9! LocalForestDynamics (<SpatialDynOneTimeStep<DistrLocalDynThisTime<TimeLoop<TreeMig)
10!
11!==============================================================================
12! design : H. Lischke, N. Zimmermann
13! author(s) : H. Lischke, N. Zimmermann
14! implementation : H. Lischke, N. Zimmermann
15! cleaner : T.J. Loeffler
16! copyright : (c) 1999, 03 by H. Lischke
17!==============================================================================
18!=====================================================================
77!===============================================================
78SUBROUTINE localforestdynamics(nspc, year, doDispersal, thiscell)
79
80 ! <CALL modules for TYPE definitions and +- fixed variables>---------------------------------------------------------------
81 use all_par, only: maxspc, maxhc, maxlc, &
82 ltfrq, &
83 htcl, ltcl, & ! do these really need to be in the All_pars? quite local
86 currstateincell ! Use control parameters
87 IMPLICIT NONE
88
89 ! <Passed variables>--------------------------------------------------------------------------------
90 INTEGER, INTENT(in) :: nspc, year ! Passed number of species [=spec]
91
92 Logical, INTENT(in) :: doDispersal
93
94 ! <Local variables>---------------------------------------------------------------------------------
95 REAL :: lasum, & ! Sum of LA per height? [=laisum]
96 lasqsum, & ! Sum of squared LA per height? [=laisqrsum]
97 srvinhl, & ! remaining ind. per spec/height/light condition in loop [=survNInH]
98 disturbancemort, & ! mortality by disturbance, species independent
99 ntinh, ntinhl, & ! # tree in height class [=nInH <- rNoTreesUnderCond]
100 randomvalue, & ! random value for disturbance calculation
101 randomvalue2, & ! random value for disturbance calculation
102 numin0(0:maxhc, 1:maxspc), & ! temporary variable originating from numNInH
103 stock
104 INTEGER :: minhc, & ! minimum height class
105 i ! looping variable
106 TYPE(currstateincell), INTENT(inout):: thiscell
107
108 ! <Here the SUBROUTINE starts>**********************************************************************
109 stock = stockability(thiscell%lat, thiscell%lon)
110 if (stock <= 1.e-20) return ! if cell cant be inhabited, no dynamics
111
112 !----- First: Initialize the light distribution arrays, i.e. max light on top
113 ltfrq = 0.0
114 ltfrq(maxlc) = 1.0
115 !----- Initialize leaf areas for summing on leaf area
116 lasum = 0.0
117 lasqsum = 0.0
118 !----- Depending on kind of seed production (constant seed pool or by parent trees) the 0th height class is included
119 if (dodispersal) then
120 minhc = 0
121 do i = 1, nspc
122 thiscell%sp(i)%ingrowth = 0.0
123 end do
124 else
125 minhc = 1
126 do i = 1, nspc
127 thiscell%sp(i)%numin(0) = 0.0
128 end do
129 end if
130 !----- Determine whether disturbance occurs in this year and cell (if disturbances are wished)
131 disturbancemort = 0.0
132 if (disturbances .AND. dodispersal) then
133 call random_number(randomvalue)
134 if (randomvalue < disturbprob) then
135 call random_number(randomvalue2)
136 disturbancemort = disturbintensity*randomvalue2
137 end if
138 end if
139 !------- Additional read in disturbances increase mortality
140 disturbancemort = min(1., disturbancemort + thiscell%disturb)
141
142 do htcl = maxhc, minhc, -1
143 do i = 1, nspc
144 ! To take into account also the height class above the highest one, which can be reached,
145 ! because the growth rate is calculated at the lower bound of the height classes, here I test,
146 ! here I test, to "activate" this next height class, to include it into the shading
147 ! and to apply mortality to it
148 ! if (htcl <= spec(i)%maxhtc) then
149 if (htcl <= spec(i)%maxhtc + 1) then
150 numin0(htcl, i) = thiscell%sp(i)%numin(htcl)
151 else
152 numin0(htcl, i) = 0.0
153 end if
154 end do
155 end do
156
157 !----- Next, we loop through height classes, top-down
158 byhcls: do htcl = maxhc, minhc, -1
159 !----- Here the light distribution is calculated based on leaves of current and higher height classes
160 call lfcalc(nspc, htcl, lasum, lasqsum, numin0) ! Light frequency & Leave area
161 !----- By species, the number of trees is calculated and evaluated per height class
162 byspecies: do i = 1, nspc
163 thiscell%sp(i)%seeds(htcl) = 0.0
164 ntinh = numin0(htcl, i)
165 !----- If the species reaches this height class and there are trees in this height class ...
166 ifhcls: if (ntinh > 0.0) then
167 !----- ... determine seed production. Here, as long as it is not yet light dependent
168 call seedprod(i, htcl, ntinh, year, thiscell) ! Seed production
169 !----- ...loop through all light classes
170 bylcls: do ltcl = 1, maxlc
171 !----- ... if this light class occurs...
172 if (ltfrq(ltcl) > 0.0) then
173 !----- ... count how many trees are in this height and light class
174 ntinhl = ntinh*ltfrq(ltcl)
175 !----- ... and let the trees live part of their live: produce seeds, die and grow
176 ! call Seedprod(i,htcl,ntinhl,year, thiscell) ! Seed production (if light dependent)
177 call mort(i, htcl, ltcl, srvinhl, ntinhl, disturbancemort, thiscell) ! Mortality
178 call grow(i, htcl, ltcl, srvinhl, minhc, thiscell) ! Growth
179 end if !----- ltfrq(ltcl) > 0.0
180 end do bylcls
181 end if ifhcls
182
183 end do byspecies
184 end do byhcls
185
186 !----- Last, regeneration is calculated
187 !----- Here part three of regeneration takes place (after seed production and dispersal)
188 !----- the germination of seeds and the survival of seedlings
189
190 call sumspecsseedprodsoverheights(nspc, thiscell) ! In SeedProd.f90
191 call selfregulation(nspc, dodispersal, thiscell)
192 call specimmigration(nspc, year, dodispersal, thiscell)
193 call regen(nspc, stock, dodispersal, thiscell) ! Regeneration of saplings
194end SUBROUTINE localforestdynamics
195!done
subroutine grow(ispec, heightcl, lightcl, srvinhl, minhc, thiscell)
Grow.
Definition Grow.f90:32
subroutine lfcalc(nspc, heightcl, laisum, laisqsum, numin0)
Lfcalc: light distributions.
Definition LfCalc.f90:61
subroutine localforestdynamics(nspc, year, dodispersal, thiscell)
LocalForestDynamics.
subroutine mort(isp, heightcl, lightcl, srvinhl, numb, disturbancemort, thiscell)
Mort.
Definition Mort.f90:53
subroutine regen(nspc, stock, dodispersal, thiscell)
Regen: calculates regeneration.
Definition Regen.f90:65
subroutine sumspecsseedprodsoverheights(nspc, thiscell)
SumSpecsSeedprodsOverHeights.
Definition Seedprod.f90:105
subroutine seedprod(ispec, htcl, ntinh, year, thiscell)
Seedprod.
Definition Seedprod.f90:51
subroutine selfregulation(nspc, dodispersal, thiscell)
SelfRegulation
subroutine specimmigration(nspc, year, dodispersal, thiscell)
SpecImmigration
real, dimension(:, :), allocatable stockability
Definition All_par.f90:53
integer, parameter maxhc
Definition All_par.f90:99
real disturbprob
Definition All_par.f90:87
type(specproperties), dimension(maxspc) spec
Definition All_par.f90:345
integer htcl
Definition All_par.f90:373
real disturbintensity
Definition All_par.f90:88
logical disturbances
Definition All_par.f90:86
integer, parameter maxlc
Definition All_par.f90:100
character(len=:), allocatable e
Definition All_par.f90:93
real ltcl
Definition All_par.f90:371
real, dimension(maxlc) ltfrq
Definition All_par.f90:367
integer, parameter maxspc
Definition All_par.f90:98