TreeMig Code
Loading...
Searching...
No Matches
Grow.f90
Go to the documentation of this file.
1!=====================================================================
30!===============================================================
31SUBROUTINE grow(ispec, heightcl, lightcl, srvinhl, minhc, thiscell)
32
33 ! <CALL modules for TYPE definitions and +- fixed variables>---------------------------------------------------------------
34 use all_par, only: speccl, hcwidth, birht, maxhc, currstateincell ! Use control and species parameters
35
36 IMPLICIT NONE
37
38 ! <Passed variables>--------------------------------------------------------------------------------
39 INTEGER, INTENT(in) :: ispec, & ! species index [=spec]
40 heightcl, & ! height class [=height]
41 lightcl, & ! lightclass [=ilight]
42 minhc ! lowest height class (0 for dispersal, 1 for local simus) [=..]
43 REAL, INTENT(in) :: srvinhl ! remaining ind. per spec/height/light class [=survNInH]
44
45 ! <Local variables>---------------------------------------------------------------------------------
46 INTEGER :: newlwhc, & ! new lower class number of growing trees [=newBotHeight]
47 newuphc ! new upper class number of growing trees [=newTopHeight]
48 REAL :: propbot, & ! proportion of individuals remaining in lower class [=proportionBot]
49 gr, & ! growth rate
50 inHC1, delta
51
52 TYPE(currstateincell):: thiscell
53 ! <Here the SUBROUTINE starts>**********************************************************************
54 !----- <Gets the rel. growth in height classes
55 gr = speccl(ispec)%hlgro(heightcl, lightcl)
56
57 !----- this is the complicated case, because 0th height class is smaller than others
58 if (heightcl == 0) then
59 if (gr <= birht) then
60 newlwhc = 0
61 newuphc = 1
62 propbot = (birht - gr)/birht
63 else
64 newlwhc = max(min(1 + floor((gr - birht)/hcwidth), maxhc), minhc)
65 newuphc = max(min(1 + floor(gr/hcwidth), maxhc), minhc)
66 if (newlwhc == newuphc) then
67 propbot = 1.0
68 else
69 propbot = (speccl(ispec)%htmin(newuphc) - gr)/birht
70 end if
71 end if
72 else
73 newlwhc = max(min(heightcl + floor(gr/hcwidth), maxhc), minhc)
74 newuphc = max(min(1 + newlwhc, maxhc), minhc)
75 propbot = (hcwidth - gr)/hcwidth
76 end if
77
78 !----- <Subtract from height class what leaves given the current looping condition
79 inhc1 = thiscell%sp(ispec)%numin(1)
80 thiscell%sp(ispec)%numin(heightcl) = thiscell%sp(ispec)%numin(heightcl) - srvinhl
81 thiscell%sp(ispec)%numin(newlwhc) = thiscell%sp(ispec)%numin(newlwhc) + (propbot*srvinhl)
82 thiscell%sp(ispec)%numin(newuphc) = thiscell%sp(ispec)%numin(newuphc) + ((1.0 - propbot)*srvinhl)
83
84 if (heightcl == 0) then
85 delta = thiscell%sp(ispec)%numin(1) - inhc1
86 thiscell%sp(ispec)%ingrowth = thiscell%sp(ispec)%ingrowth + delta
87 end if
88
89 if (thiscell%sp(ispec)%numin(heightcl) < 0) then
90 thiscell%sp(ispec)%numin(heightcl) = 0.0
91 end if
92
93end SUBROUTINE grow
94!done
subroutine grow(ispec, heightcl, lightcl, srvinhl, minhc, thiscell)
Grow.
Definition Grow.f90:32
integer, parameter maxhc
Definition All_par.f90:99
real hcwidth
Definition All_par.f90:357
type(specpropertiesincl), dimension(maxspc) speccl
Definition All_par.f90:346
real, parameter birht
Definition All_par.f90:120
integer, parameter max
Definition All_par.f90:98