TreeMig Code
Loading...
Searching...
No Matches
CalcCurrentDepFunctsInCell.f90
Go to the documentation of this file.
1!==============================================================================
2!
3! Name : CalcCurrentDepFunctsInCell
4!
5! Purpose: CalcCurrentDepFunctsInCell calculates the spatial forest dynamics
6! on a grid with or without seed dispersal. ContLightDep calculates the
7! continuous light dependence of growth and death.
8!
9! Remarks: contains the SUBROUTINEs
10!
11! CalcCurrentDepFunctsInCell (<LocalDynOneTimeStep<SpatialDynOneTimeStep<
12! TimeLoop<TreeMig)
13! ContLightDep (<GetSpc<TreeMig AND/OR <Regen<LocalDynOneTimeStep<
14! LocalDynOneTimeStep<SpatialDynOneTimeStep<TimeLoop<TreeMig)
15!
16!==============================================================================
17! design : H. Lischke, N. Zimmermann
18! author(s) : H. Lischke, N. Zimmermann
19! implementation : H. Lischke, N. Zimmermann
20! cleaner : T.J. Loeffler
21! copyright : (c) 1999, 03 by H. Lischke
22!==============================================================================
23!=====================================================================
61!===============================================================
62SUBROUTINE calccurrentdepfunctsincell(nspc, ddegs, wtemp, drstr, avnit, brwpr, germDrought)
63
64 ! <CALL modules for TYPE definitions and +- fixed variables>---------------------------------------------------------------
65 use all_par, only: maxspc, maxhc, maxlc, birht, includeenv, kn1, kn2, &
67
68 IMPLICIT NONE
69
70 ! <Passed variables>-------------------------------------------------------------------------------
71 INTEGER, INTENT(in) :: nspc ! Passed number of species [=spec]
72 REAL, INTENT(in) :: ddegs, & ! day-degrees of cell [=dayDegs] !ENV
73 drstr, & ! drough stress of cell [=rDroughtStress] !ENV
74 avnit, & ! av. Nitrogen of cell [=avNitrogen] !ENV
75 wtemp, & ! winter temperature of cell [=winterTemp] !ENV
76 brwpr, & ! browsing pressure of cell [=browsPress] !ENV
77 germDrought ! specific drought values affecting germination
78
79 ! <Local variables>---------------------------------------------------------------------------------
80 INTEGER :: i ! looping variable for species
81 REAL :: truht, & ! tmp var to calculate heights [=trueHeight]
82 diams, & ! tmp var to calculate spec. diameters [in DetermineProc.. =diam]
83 alloc1, & ! tmp allocation var to calculate growth rate [=allo1]
84 alloc2, & ! tmp allocation var to calculate growth rate [=allo2]
85 grofac, & ! diameter increment growth factor [=diamIncFak]
86 hcgrow, & ! height class dep. growth rate [=growthInH]
87 lidep, & ! light dependent growth [=lidep]
88 tdep(maxspc), & ! temperature dependent growth factor [=growthTempDep] !ENV
89 drdep(maxspc), & ! drought dependent growth factor [=growthDroughtDep] !ENV
90 ndep(maxspc), & ! nitrogen dependent growth factor [=growthNDep] !ENV
91 germDrDep, & ! germ suitability dependent germination factor [=growthNDep] !ENV
92 envdpg, & ! local env. dependent growth factor [=allOtherDep] !ENV
93 envetb, & ! temp var. for env. sensitivity to establishment [=..otheretab] !ENV
94 brwetb ! temp var. for browsing sensit. to establ. [=..otheretab] !ENV
95 INTEGER:: htcl, ltcl
96 ! <Here the SUBROUTINE starts>*********************************************************************
97 !----- Check whether site data drive dynamics ----------------------------------------------------
98 include_env: if (includeenv) then
99 !----- Environment dependence of growth and survival !
100 do i = 1, nspc
101 !----- day degree dependence (saturation function) !
102 tdep(i) = max(0.0, 1.0 - exp((1.386/spec(i)%kddmax)*(spec(i)%kddmin - ddegs)))
103 !----- drought dependence
104 drdep(i) = (max(1.0 - drstr/spec(i)%kdrt, 0.0)**0.5)
105 !----- make drought dependence per cell an array later(!), very important!!
106 !----- nitrogen dependence
107 ndep(i) = max(1.0 - exp(kn1(spec(i)%kntol)*(avnit - kn2(spec(i)%kntol))), 0.0)
108 spec(i)%envdep = tdep(i)*drdep(i)*ndep(i)
109 end do
110 !----- establishment dependence on day degree sum and winter temperature
111 do_etab: do i = 1, nspc
112 env_etab: if ((wtemp < real(spec(i)%kwit)) .OR. (ddegs < real(spec(i)%kddmin))) then
113 envetb = 0.0
114 else
115 envetb = 1.0
116 end if env_etab
117 !----- establishment dependence on browsing
118 brwetb = 1.0 - (real(spec(i)%kbrow - 1)*brwpr/30.0)
119 !----- establishment dependence on drought
120 germdrdep = max( 1.0 - germdrought / spec(i)%kGermDrSens, 0.0) ** 0.5
121
122 spec(i)%enveta = envetb * brwetb * germdrdep
123! print *, "germDrought, drstr, spec, enveta,germDrDep , germDrought,kGermDrSens, drdep, kdrt",&
124! germDrought, drstr, i, spec(i)%enveta, &
125! germDrDep,spec(i)%kGermDrSens, drdep(i), spec(i)%kdrt
126 end do do_etab
127
128 else !----- Include_ENV
129 spec%envdep = 1.0
130 spec%enveta = 1.0
131 end if include_env
132 !-----<Initialize env. dependent tree arrays [=DetermineProcRates]; this has moved from InitAndSetConstHeightClProps>-------
133 ! > environment dependent vitality, height growth and diameter growth for species, height class and light class
134 byspcs2: do i = 1, nspc
135 byhtcls2: do htcl = spec(i)%maxhtc, 1, -1
136 envdpg = spec(i)%envdep**0.333333
137 diams = speccl(i)%diain(htcl) ! diameter in height class
138 truht = speccl(i)%htmin(htcl) ! lower bound of height class
139 alloc1 = (2.0*(real(spec(i)%khmax) - birht)/spec(i)%maxdhm)
140 alloc2 = -alloc1/2.0/spec(i)%maxdhm
141 if (htcl <= spec(i)%maxhtc) then ! diameter growth for optimal climate, depending on current diameter
142 grofac = (envdpg*spec(i)%maxgro*diams*(1.0 - (truht/real(spec(i)%khmax))))/ &
143 (2.74 + (((3.0*alloc1) + (4.0*alloc2*diams))*diams))
144 else
145 grofac = 0.0
146 end if
147
148 hcgrow = (grofac*(alloc1 + (2.0*alloc2*diams))) ! translate diameter growth to height growth
149 !----- light dependence values in light classes of growth and mortality
150 byltcls2: do ltcl = 1, maxlc !get the environment dependent vitality, height growth and diameter growth for this species, height class and light class
151 ! lih = ltval(ltcl)
152
153 !----- THIS STEP PRODUCES MOST OF THE COMPUTING TIME
154 !----->OLD call ContLightDep (lih, spec(i)%kligha, lidep)
155 lidep = speccl(i)%lightDepA(ltcl) ! light dependence of this species in this light class;! lightDepA has been calculated in GetSpc
156 speccl(i)%envVitality(htcl, ltcl) = lidep*envdpg ! vitality in this height and light class for this species
157 speccl(i)%hlgro(htcl, ltcl) = lidep*hcgrow ! height growth in this height and light class for this species
158 speccl(i)%growthVitality(htcl, ltcl) = lidep*grofac ! diameter growth in this height and light class for this species
159 end do byltcls2
160 end do byhtcls2
161
162 !----- function values of 0th height class (seedlings to 1.37 m)
163
164 byltcls4: do ltcl = 1, maxlc
165 if (estabeqhc0) then
166 !------ if wished, light dependence of establishment (from FORCLIM) is contributed to 0th height class
167! lih = ltval(ltcl)
168
169 !----- THIS STEP PRODUCES MOST OF THE COMPUTING TIME
170 !----->OLD call ContLightDep (lih, spec(i)%kligha, lidep)
171 lidep = speccl(i)%lightDepE(ltcl) ! lightDepE has been calculated in GetSpc
172 speccl(i)%envVitality(0, ltcl) = lidep*envdpg
173
174 speccl(i)%hlgro(0, ltcl) = lidep*hcgrow
175 speccl(i)%growthVitality(0, ltcl) = lidep*grofac
176 else
177 !----- otherwise the values for the first height class are also used for the 0th one (seedlings)
178 speccl(i)%hlgro(0, ltcl) = speccl(i)%hlgro(1, ltcl)
179 speccl(i)%envVitality(0, ltcl) = speccl(i)%envVitality(1, ltcl)
180 speccl(i)%growthVitality(0, ltcl) = speccl(i)%growthVitality(1, ltcl)
181 end if
182 end do byltcls4
183! set to zero growth, vitality and growthVitality in height classes higher than highest one
184 if (spec(i)%maxhtc < maxhc) then
185 resthtcls2: do htcl = spec(i)%maxhtc + 1, maxhc
186 byltcls3: do ltcl = 1, maxlc
187 speccl(i)%hlgro(htcl, ltcl) = 0.0
188 speccl(i)%envVitality(htcl, ltcl) = 0.0
189 speccl(i)%growthVitality(htcl, ltcl) = 0.0
190 end do byltcls3
191 end do resthtcls2
192 end if
193 end do byspcs2
194end SUBROUTINE calccurrentdepfunctsincell
195!****<Here the SUBROUTINE ends>********************************************************************
196
197!****<Here the SUBROUTINE ContLightDep starts>*****************************************************
198!=====================================================================
217!===============================================================
218SUBROUTINE contlightdep(light, shade_sens_class, lidep)
220 ! <CALL modules for TYPE definitions and +- fixed variables>---------------------------------------------------------------
221 IMPLICIT NONE
222
223 ! <Passed variables>--------------------------------------------------------------------------------
224 INTEGER, INTENT(in) :: shade_sens_class ! Spec. specific light threshold
225 REAL, INTENT(in) :: light ! Light intensity
226 REAL, INTENT(out) :: lidep ! Light dependence
227
228 ! <Local variables>---------------------------------------------------------------------------------
229 REAL :: gl1, gl1old, & ! light response for shade-tolerant species [=gl1]
230 gl9, gl9old, & ! light response for shade-intolerant species [=gl9]
231 eps, steepness, &
232 contstep1, contstep9
233
234! <Here the SUBROUTINE starts>*********************************************************************
235 eps = 0.00000001
236 steepness = 5
237 contstep1 = eps*(1 - exp(-((light/0.05)**steepness)))
238 contstep9 = eps*(1 - exp(-((light/0.08)**steepness)))
239 gl1old = 1.0 - exp(-4.64*(light - 0.05))
240 gl1 = max(gl1old + eps, 0.0) + contstep1
241 gl9old = 2.24*(1.0 - exp(-1.136*(light - 0.08)))
242 gl9 = max(gl9old + eps, 0.0) + contstep9
243 lidep = (gl1 + ((shade_sens_class - 1.0)*(gl9 - gl1)/8.0))
244 if ((lidep < 0.0) .OR. (lidep > 2)) then
245 write (logmessage, *) 'Negative LightDep:'
247 write (logmessage, "(9A8)") "light", "contstep1", "contstep9", "gl1old", "gl9old", "gl1", "gl9", "shade_sens_class", "lidep"
249 write (logmessage, "(7F8.3,I8,F8.3)") light, contstep1, contstep9, gl1old, gl9old, gl1, gl9, shade_sens_class, lidep
251 end if
252
253 lidep = max(lidep, 0.0)**0.333333
254end SUBROUTINE contlightdep
255!done
subroutine calccurrentdepfunctsincell(nspc, ddegs, wtemp, drstr, avnit, brwpr, germdrought)
CalcCurrentDepFunctsInCell
subroutine contlightdep(light, shade_sens_class, lidep)
ContLightDep.
logical estabeqhc0
Definition All_par.f90:90
logical includeenv
Definition All_par.f90:58
integer, parameter maxhc
Definition All_par.f90:99
real, dimension(3) kn2
Definition All_par.f90:135
type(specpropertiesincl), dimension(maxspc) speccl
Definition All_par.f90:346
type(specproperties), dimension(maxspc) spec
Definition All_par.f90:345
integer, parameter maxlc
Definition All_par.f90:100
integer real
Definition All_par.f90:27
real, parameter birht
Definition All_par.f90:120
real, dimension(3) kn1
Definition All_par.f90:134
integer, parameter maxspc
Definition All_par.f90:98
integer, parameter max
Definition All_par.f90:98
LoggerModule.
subroutine logwarning(msg)
LogError
character(len=1024) logmessage