vegdynam.cpp 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668
  1. ///////////////////////////////////////////////////////////////////////////////////////
  2. /// \file vegdynam.cpp
  3. /// \brief Vegetation dynamics and disturbance
  4. ///
  5. /// \author Ben Smith
  6. /// $Date: 2013-05-03 15:09:06 +0200 (Fri, 03 May 2013) $
  7. ///
  8. ///////////////////////////////////////////////////////////////////////////////////////
  9. // WHAT SHOULD THIS FILE CONTAIN?
  10. // Module source code files should contain, in this order:
  11. // (1) a "#include" directive naming the framework header file. The framework header
  12. // file should define all classes used as arguments to functions in the present
  13. // module. It may also include declarations of global functions, constants and
  14. // types, accessible throughout the model code;
  15. // (2) other #includes, including header files for other modules accessed by the
  16. // present one;
  17. // (3) type definitions, constants and file scope global variables for use within
  18. // the present module only;
  19. // (4) declarations of functions defined in this file, if needed;
  20. // (5) definitions of all functions. Functions that are to be accessible to other
  21. // modules or to the calling framework should be declared in the module header
  22. // file.
  23. //
  24. // PORTING MODULES BETWEEN FRAMEWORKS:
  25. // Modules should be structured so as to be fully portable between models (frameworks).
  26. // When porting between frameworks, the only change required should normally be in the
  27. // "#include" directive referring to the framework header file.
  28. #include "config.h"
  29. #include "vegdynam.h"
  30. #include "growth.h"
  31. #include "driver.h"
  32. /// Internal help function for splitting up nitrogen fire fluxes into components
  33. void report_fire_nfluxes(Patch& patch, double nflux_fire) {
  34. patch.fluxes.report_flux(Fluxes::NH3_FIRE, Fluxes::NH3_FIRERATIO * nflux_fire);
  35. patch.fluxes.report_flux(Fluxes::NOx_FIRE, Fluxes::NOx_FIRERATIO * nflux_fire);
  36. patch.fluxes.report_flux(Fluxes::N2O_FIRE, Fluxes::N2O_FIRERATIO * nflux_fire);
  37. patch.fluxes.report_flux(Fluxes::N2_FIRE, Fluxes::N2_FIRERATIO * nflux_fire);
  38. }
  39. ///////////////////////////////////////////////////////////////////////////////////////
  40. // RANDPOISSON
  41. // Internal functions for generating random numbers
  42. int randpoisson(double expectation, long& seed) {
  43. // DESCRIPTION
  44. // Returns a random integer drawn from the Poisson distribution with specified
  45. // expectation (for computational reasons, the Gaussian normal distribution is
  46. // used as an approximation of the Poisson distribution for expected values >100)
  47. double p, q, r;
  48. int n;
  49. if (expectation <= 100) {
  50. // For expected values up to 100, calculate a true Poisson number
  51. p = exp(-expectation);
  52. q = p;
  53. r=randfrac(seed);
  54. n = 0;
  55. while (q < r) {
  56. n++;
  57. p *= expectation / (double)n;
  58. q += p;
  59. }
  60. return n;
  61. }
  62. // For higher expected values than 100, approximate the Poisson distribution
  63. // by the Gaussian normal distribution with mean equal to the expected value,
  64. // and standard deviation the square root of this value
  65. do {
  66. r=randfrac(seed)*8.0-4.0;
  67. p = exp(-r * r / 2.0);
  68. } while (randfrac(seed)>p);
  69. return max(0, (int)(r * sqrt(expectation) + expectation + 0.5));
  70. }
  71. ///////////////////////////////////////////////////////////////////////////////////////
  72. // BIOCLIMATIC LIMITS ON ESTABLISHMENT AND SURVIVAL
  73. // Internal functions (do not call directly from framework)
  74. bool establish(Patch& patch, const Climate& climate, Pft& pft) {
  75. // DESCRIPTION
  76. // Determines whether specified PFT is within its bioclimatic limits for
  77. // establishment in a given patch and climate. Returns true if PFT can establish
  78. // under specified conditions, false otherwise
  79. // The following limits are implemented:
  80. // tcmin_est = minimum coldest month mean temperature for the last 20 years
  81. // tcmax_est = maximum coldest month mean temperature for the last 20 years
  82. // twmin_est = minimum warmest month mean temperature
  83. // gdd5min_est = minimum growing degree day sum on 5 deg C base
  84. // ecev3 - restrict all vegetation establishment on Antarctica to the Antarctic peninsula north of 65 degS
  85. if (climate.lat < -65.0)
  86. return false;
  87. if (!patch.managed && (climate.mtemp_min20 < pft.tcmin_est ||
  88. climate.mtemp_min20 > pft.tcmax_est ||
  89. climate.mtemp_max < pft.twmin_est ||
  90. climate.agdd5 < pft.gdd5min_est)) return false;
  91. if(patch.stand.landcover != CROPLAND) {
  92. if (vegmode != POPULATION && patch.par_grass_mean < pft.parff_min) return false;
  93. }
  94. // guess2008 - DLE - new drought limited establishment
  95. if (ifdroughtlimitedestab) {
  96. // Compare this PFT's/species' drought_tolerance with the average wcont over the
  97. // growing season, in this patch. Higher drought_tolerance values (set in the .ins file)
  98. // lead to greater restrictions on establishment.
  99. if (pft.drought_tolerance > patch.soil.awcont[0]) {
  100. return false;
  101. }
  102. }
  103. // else
  104. return true;
  105. }
  106. bool survive(const Climate& climate, Pft& pft) {
  107. // DESCRIPTION
  108. // Determines whether specified PFT is within its bioclimatic limits for survival
  109. // in a given climate. Returns true if PFT can survive in the specified climate,
  110. // false otherwise
  111. // The following limit is implemented:
  112. // tcmin_surv = minimum coldest month temperature for the last 20 years (deg C)
  113. if (climate.mtemp_min20 < pft.tcmin_surv ||
  114. climate.mtemp_max20 - climate.mtemp_min20 < pft.twminusc) return false;
  115. // else
  116. return true;
  117. }
  118. ///////////////////////////////////////////////////////////////////////////////////////
  119. // ESTABLISHMENT
  120. // Internal functions (do not call directly from framework)
  121. void establishment_lpj(Stand& stand,Patch& patch) {
  122. // DESCRIPTION
  123. // Establishment in population (standard LPJ) mode.
  124. // Simulates population increase through establishment each simulation year for
  125. // trees and grasses and introduces new PFTs if climate conditions become suitable.
  126. // This function assumes each Individual object represents the average individual
  127. // of a PFT population, and that there is (at most) one Individual object per PFT
  128. // per modelled area (stand and patch).
  129. // This is the only function in which new average individuals are added to the
  130. // vegetation in population mode.
  131. const double K_EST=0.12; // maximum overall sapling establishment rate (indiv/m2)
  132. double fpc_tree; // summed fractional cover for tree PFTs
  133. double fpc_grass; // summed fractional cover for grass PFTs
  134. double est_tree;
  135. // overall establishment rate for trees on modelled area basis (indiv/m2)
  136. double est_pft;
  137. // establishment rate for a particular PFT on modelled area basis (for trees,
  138. // indiv/m2; for grasses, fraction of modelled area colonised)
  139. int ntree_est; // number of establishing tree PFTs
  140. int ngrass_est; // number of establishing grass PFTs
  141. bool present;
  142. // Obtain reference to Vegetation object
  143. Vegetation& vegetation=patch.vegetation;
  144. // Loop through all possible PFTs to determine whether there are any not currently
  145. // present but within their bioclimatic limits for establishment
  146. pftlist.firstobj();
  147. while (pftlist.isobj) {
  148. Pft& pft=pftlist.getobj();
  149. if (stand.pft[pft.id].active) { //standpft.active is set in landcover_init according to rules for each stand
  150. // Is this PFT already represented?
  151. present=false;
  152. vegetation.firstobj();
  153. while (vegetation.isobj && !present) {
  154. Individual& indiv=vegetation.getobj();
  155. if (indiv.pft.id==pft.id) present=true;
  156. vegetation.nextobj();
  157. }
  158. if (!present) {
  159. if (establish(patch,stand.get_climate(),pft)) {
  160. // Not present but can establish, so introduce as new average
  161. // individual
  162. Individual& indiv=vegetation.createobj(pft,vegetation);
  163. if (pft.lifeform==GRASS) {
  164. indiv.height=0.0;
  165. indiv.crownarea=1.0; // (value not used)
  166. indiv.densindiv=1.0;
  167. indiv.fpc=0.0;
  168. }
  169. }
  170. }
  171. }
  172. pftlist.nextobj(); // ... on to next PFT
  173. }
  174. // Calculate total FPC and number of PFT's (i.e. average individuals) establishing
  175. // this year for trees and grasses respectively
  176. fpc_tree=0.0;
  177. fpc_grass=0.0;
  178. ntree_est=0;
  179. ngrass_est=0;
  180. // Loop through individuals
  181. vegetation.firstobj();
  182. while (vegetation.isobj) {
  183. Individual& indiv=vegetation.getobj();
  184. // For this individual ...
  185. if (indiv.pft.lifeform==TREE) {
  186. if (establish(patch, stand.get_climate(), indiv.pft)) ntree_est++;
  187. fpc_tree+=indiv.fpc;
  188. }
  189. else if (indiv.pft.lifeform==GRASS) {
  190. fpc_grass+=indiv.fpc;
  191. if (establish(patch, stand.get_climate(), indiv.pft)) ngrass_est++;
  192. }
  193. vegetation.nextobj(); // ... on to next individual
  194. }
  195. // Calculate overall establishment rate for trees
  196. // Trees can establish in unoccupied regions of the stand, and in regions
  197. // occupied by grasses. Establishment reduced in response to canopy closure as
  198. // tree cover approaches 100%
  199. // Smith et al 2001, Eqn (17)
  200. est_tree=K_EST*(1.0-exp(-5.0*(1.0-fpc_tree)))*(1.0-fpc_tree);
  201. // Loop through individuals
  202. vegetation.firstobj();
  203. while (vegetation.isobj) {
  204. // For this individual ...
  205. Individual& indiv=vegetation.getobj();
  206. if (indiv.pft.lifeform==TREE && establish(patch, stand.get_climate(), indiv.pft)) {
  207. // ESTABLISHMENT OF NEW TREE SAPLINGS
  208. // Partition overall establishment equally among establishing PFTs
  209. est_pft=est_tree/(double)ntree_est;
  210. if (est_pft<0.0)
  211. fail("establishment_area: negative establishment rate");
  212. // Adjust density of individuals across modelled area to account for
  213. // addition of new saplings
  214. indiv.densindiv+=est_pft;
  215. // Account for flux from the atmosphere to new saplings
  216. // (flux is downward and therefore negative)
  217. if(!indiv.istruecrop_or_intercropgrass()) {
  218. indiv.report_flux(Fluxes::ESTC,
  219. -(indiv.pft.regen.cmass_leaf+
  220. indiv.pft.regen.cmass_root+indiv.pft.regen.cmass_sap+
  221. indiv.pft.regen.cmass_heart)*est_pft);
  222. #ifdef CRESCENDO_FACE
  223. indiv.report_flux(Fluxes::DESTC,
  224. -(indiv.pft.regen.cmass_leaf +
  225. indiv.pft.regen.cmass_root + indiv.pft.regen.cmass_sap +
  226. indiv.pft.regen.cmass_heart)*est_pft);
  227. #endif
  228. }
  229. // Adjust average individual C biomass based on average biomass and density
  230. // of the new saplings
  231. indiv.cmass_leaf+=indiv.pft.regen.cmass_leaf*est_pft;
  232. indiv.cmass_root+=indiv.pft.regen.cmass_root*est_pft;
  233. indiv.cmass_sap+=indiv.pft.regen.cmass_sap*est_pft;
  234. indiv.cmass_heart+=indiv.pft.regen.cmass_heart*est_pft;
  235. // Calculate storage pool size
  236. indiv.max_n_storage = (indiv.cmass_leaf + indiv.cmass_root) / indiv.pft.cton_leaf_avr;
  237. if (!indiv.alive)
  238. indiv.scale_n_storage = indiv.max_n_storage * indiv.pft.cton_leaf_avr /
  239. ((indiv.pft.regen.cmass_leaf + indiv.pft.regen.cmass_root +
  240. indiv.pft.regen.cmass_sap + indiv.pft.regen.cmass_heart) * est_pft);
  241. }
  242. else if ((indiv.pft.lifeform==GRASS && indiv.pft.phenology!=CROPGREEN) &&
  243. establish(patch, stand.get_climate(), indiv.pft)) {
  244. // ESTABLISHMENT OF GRASSES
  245. // Grasses establish throughout unoccupied regions of the grid cell
  246. // Overall establishment partitioned equally among establishing PFTs
  247. est_pft=(1.0-fpc_tree-fpc_grass)/(double)ngrass_est;
  248. // Account for flux from atmosphere to grass regeneration
  249. if (!indiv.istruecrop_or_intercropgrass()) {
  250. indiv.report_flux(Fluxes::ESTC,
  251. -(indiv.pft.regen.cmass_leaf+
  252. indiv.pft.regen.cmass_root)*est_pft);
  253. #ifdef CRESCENDO_FACE
  254. indiv.report_flux(Fluxes::DESTC,
  255. -(indiv.pft.regen.cmass_leaf +
  256. indiv.pft.regen.cmass_root)*est_pft);
  257. #endif
  258. }
  259. // Add regeneration biomass to overall biomass
  260. indiv.cmass_leaf+=est_pft*indiv.pft.regen.cmass_leaf;
  261. indiv.cmass_root+=est_pft*indiv.pft.regen.cmass_root;
  262. // Calculate storage pool size
  263. indiv.max_n_storage = (indiv.cmass_leaf + indiv.cmass_root) / indiv.pft.cton_leaf_avr;
  264. if (!indiv.alive)
  265. indiv.scale_n_storage = indiv.max_n_storage * indiv.pft.cton_leaf_avr /
  266. ((indiv.pft.regen.cmass_leaf + indiv.pft.regen.cmass_root) * est_pft);
  267. }
  268. // Update allometry to account for changes in average individual biomass
  269. allometry(indiv);
  270. vegetation.nextobj(); // ... on to next individual
  271. }
  272. }
  273. void establishment_guess(Stand& stand,Patch& patch) {
  274. // DESCRIPTION
  275. // Establishment in cohort or individual mode.
  276. // Establishes new tree saplings and simulates grass population increase each
  277. // establishment year (every year in individual mode). New grass PFTs are
  278. // introduced (any year) if climate conditions become suitable.
  279. // Saplings are given an amount of carbon proportional to the hypothetical forest
  280. // floor NPP for this year and are "moulded" by calls to the standard allocation
  281. // function (growth module). The coefficient SAPSIZE controls the relative amount
  282. // of carbon given each sapling and should be set to a value resulting in saplings
  283. // around breast height in the first year (before development of a shading canopy).
  284. // For tree PFTs within their bioclimatic limits for establishment, the expected
  285. // number of saplings (est) established in each patch is given by:
  286. //
  287. // for model initialisation:
  288. // (1) est = est_max*patcharea
  289. // if spatial mass effect enabled (stand-level "propagule pool" influences
  290. // establishment):
  291. // (2) est = c*(kest_repr*cmass_repr+kest_bg)
  292. // if no spatial mass effect and propagule pool exists (cmass_repr non-negligible):
  293. // (3) est = c*(kest_pres+kest_bg)
  294. // if no spatial mass effect and no propagule pool:
  295. // (4) est = c*kest_bg
  296. // where
  297. // (5) c = mu(anetps_ff/anetps_ff_max)*est_max*patcharea
  298. // (6) mu(F) = exp(alphar*(1-1/F)) (Fulton 1991, Eqn 4)
  299. // where
  300. // kest_repr = PFT-specific constant (kest_repr*cmass_repr should
  301. // approximately equal 1 at the highest plausible value of
  302. // cmass_repr for the PFT)
  303. // kest_bg = PFT-specific constant in range 0-1 (usually << 1)
  304. // (set to zero if background establishment disabled)
  305. // kest_pres = PFT-specific constant in range 0-1 (usually ~1)
  306. // cmass_repr = net C allocated to reproduction for this PFT in all patches of
  307. // this stand this year (kgC/m2)
  308. // est_max = (nominal) maximum establishment rate for this PFT
  309. // (saplings/m2/year)
  310. // patcharea = patch area (m2)
  311. // anetps_ff = potential annual net assimilation at forest floor for this
  312. // PFT (kgC/m2/year)
  313. // anetps_ff_max = maximum value of anetps_ff for this PFT in this stand so far
  314. // in the simulation (kgC/m2/year)
  315. // alphar = PFT-specific constant (parameter capturing non-linearity in
  316. // recruitment rate relative to understorey growing conditions)
  317. //
  318. // In individual mode, and in cohort mode if stochastic establishment is enabled,
  319. // the actual number of new saplings established is a number drawn from the Poisson
  320. // distribution with expectation 'est'. In cohort mode, with stochastic
  321. // establishment disabled, a cohort representing exactly 'est' individuals (may be
  322. // not-integral) is established.
  323. const double SAPSIZE=0.1;
  324. // coefficient in calculation of initial sapling size and initial
  325. // grass biomass (see comment above)
  326. bool present; // whether PFT already present in this patch
  327. double c; // constant in equation for number of new saplings (Eqn 5)
  328. double est; // expected number of new saplings for PFT in this patch
  329. double nsapling;
  330. // actual number of new saplings for PFT in this patch (may include a
  331. // fractional part in cohort mode with stochastic establishment disabled)
  332. double bminit; // initial sapling biomass (kgC) or new grass biomass (kgC/m2)
  333. double ltor; // leaf to fine root mass ratio for new saplings or grass
  334. int newindiv=0; // number of new Individual objects to add to vegetation for this PFT
  335. double kest_bg;
  336. int i;
  337. // ecev3 - use cohort limit from RCA. This was also used in EC-Earth v2.4
  338. // Ben 2008-01-04: limit to number of living cohorts of same PFT in a patch
  339. int ncohort;
  340. const int MAXCOHORT=10; // ecev3 - was 5 in v2.4.1
  341. // Obtain reference to Vegetation object
  342. Vegetation& vegetation=patch.vegetation;
  343. const bool establish_active_pfts_before_management = true;
  344. // guess2008 - determine the number of woody PFTs that can establish
  345. // Thomas Hickler
  346. int nwoodypfts_estab=0;
  347. pftlist.firstobj();
  348. while (pftlist.isobj) {
  349. Pft& pft=pftlist.getobj();
  350. Standpft& standpft=stand.pft[pft.id];
  351. bool force_planting = patch.plant_this_year && standpft.plant;
  352. bool est_this_year;
  353. if(establish_active_pfts_before_management)
  354. est_this_year = !patch.managed || !patch.plant_this_year && standpft.reestab;
  355. else
  356. est_this_year = !run_landcover || !patch.plant_this_year && standpft.reestab;
  357. if (establish(patch, stand.get_climate(), pft) && pft.lifeform == TREE && standpft.active && (est_this_year || force_planting))
  358. nwoodypfts_estab++;
  359. pftlist.nextobj();
  360. }
  361. // Loop through PFTs
  362. pftlist.firstobj();
  363. while (pftlist.isobj) {
  364. Pft& pft=pftlist.getobj();
  365. Standpft& standpft=stand.pft[pft.id];
  366. // For this PFT ...
  367. // Stands cloned this year to be treated here as first year
  368. bool init_clone = date.year == stand.clone_year && pft.landcover == stand.landcover;
  369. // No grass establishment during planting year
  370. bool force_planting = patch.plant_this_year && standpft.plant;
  371. bool est_this_year;
  372. if(establish_active_pfts_before_management)
  373. est_this_year = !patch.managed || !patch.plant_this_year && standpft.reestab;
  374. else
  375. est_this_year = !run_landcover || !patch.plant_this_year && standpft.reestab;
  376. if (stand.pft[pft.id].active) {
  377. if (patch.age==0 || init_clone) {
  378. patch.pft[pft.id].anetps_ff_est=patch.pft[pft.id].anetps_ff;
  379. patch.pft[pft.id].wscal_mean_est=patch.pft[pft.id].wscal_mean;
  380. // BLARP
  381. if (date.year==0 || date.year==stand.first_year || init_clone)
  382. patch.pft[pft.id].anetps_ff_est_initial=patch.pft[pft.id].anetps_ff;
  383. }
  384. else {
  385. patch.pft[pft.id].anetps_ff_est+=patch.pft[pft.id].anetps_ff;
  386. patch.pft[pft.id].wscal_mean_est+=patch.pft[pft.id].wscal_mean;
  387. }
  388. if (establish(patch, stand.get_climate(), pft) && (est_this_year || force_planting)) {
  389. if (pft.lifeform==GRASS) {
  390. // ESTABLISHMENT OF GRASSES
  391. // Each grass PFT represented by just one individual in each patch
  392. // Check whether this grass PFT already represented ...
  393. present=false;
  394. vegetation.firstobj();
  395. while (vegetation.isobj && !present) {
  396. if (vegetation.getobj().pft.id==pft.id) present=true;
  397. vegetation.nextobj();
  398. }
  399. if (!present) {
  400. // ... if not, add it
  401. Individual& indiv=vegetation.createobj(pft,vegetation);
  402. indiv.height=0.0;
  403. indiv.crownarea=1.0; // (value not used)
  404. indiv.densindiv=1.0;
  405. indiv.fpc=1.0;
  406. // Initial grass biomass proportional to potential forest floor
  407. // net assimilation this year on patch area basis
  408. if(pft.phenology == CROPGREEN)
  409. bminit = SAPSIZE * 0.01;
  410. else if(patch.has_disturbances() && patch.disturbed)
  411. bminit = SAPSIZE * patch.pft[pft.id].anetps_ff_est_initial;
  412. else
  413. bminit = SAPSIZE * patch.pft[pft.id].anetps_ff;
  414. // Initial leaf to fine root biomass ratio based on
  415. // hypothetical value of water stress parameter
  416. ltor=patch.pft[pft.id].wscal_mean*pft.ltor_max;
  417. // Allocate initial biomass
  418. if(!indiv.istruecrop_or_intercropgrass())
  419. allocation_init(bminit,ltor,indiv);
  420. // Calculate initial allometry
  421. allometry(indiv);
  422. // Calculate storage pool size
  423. if(indiv.pft.phenology == CROPGREEN) {
  424. indiv.max_n_storage = CMASS_SEED / indiv.pft.cton_leaf_avr;
  425. indiv.scale_n_storage = indiv.max_n_storage * indiv.pft.cton_leaf_avr / CMASS_SEED;
  426. }
  427. else {
  428. indiv.max_n_storage = indiv.cmass_root * indiv.pft.fnstorage / indiv.pft.cton_leaf_avr;
  429. indiv.scale_n_storage = indiv.max_n_storage * indiv.pft.cton_leaf_avr / bminit;
  430. }
  431. // Establishment flux is not debited for 'new' Individual
  432. // objects - their carbon is debited in function growth()
  433. // if they survive the first year
  434. }
  435. }
  436. else if (pft.lifeform==TREE) {
  437. // ESTABLISHMENT OF NEW TREE SAPLINGS
  438. if (patch.age == 0 || init_clone){
  439. // First simulation year - initialising patch
  440. // Eqn 1
  441. est=pft.est_max*patcharea;
  442. }
  443. else {
  444. // Every year except year 1
  445. // Eqns 5, 6
  446. if (patch.pft[pft.id].anetps_ff>0.0 &&
  447. !negligible(patch.pft[pft.id].anetps_ff)) {
  448. double expval=max(-100.0,pft.alphar-pft.alphar/patch.pft[pft.id].anetps_ff*stand.pft[pft.id].anetps_ff_max);
  449. c=exp(expval)*pft.est_max*patcharea;
  450. }
  451. else
  452. c=0.0;
  453. // Background establishment enabled?
  454. if (ifbgestab)
  455. kest_bg=pft.kest_bg;
  456. else
  457. kest_bg=0.0;
  458. // Spatial mass effect enabled?
  459. // Eqns 2, 3, 4
  460. if (ifsme)
  461. est=c*(pft.kest_repr*stand.pft[pft.id].cmass_repr+kest_bg);
  462. else if (!negligible(stand.pft[pft.id].cmass_repr))
  463. est=c*(pft.kest_pres+kest_bg);
  464. else
  465. est=c*kest_bg;
  466. }
  467. // guess2008 - scale est by the number of woody PFTs/species that can establish
  468. // Otherwise, simply adding more PFTs or species would increase est
  469. est*=3.0/double(nwoodypfts_estab);
  470. // Have a value for expected number of new saplings (est)
  471. // Actual number of new saplings drawn from the Poisson distribution
  472. // (except cohort mode with stochastic establishment disabled)
  473. if (ifstochestab && !force_planting || vegmode==INDIVIDUAL) nsapling=randpoisson(est, stand.seed);
  474. else nsapling=est;
  475. if (vegmode==COHORT) {
  476. // BLARP added for OECD experiment (is this sensible?)
  477. if (patch.has_disturbances() && patch.disturbed || force_planting) {
  478. patch.pft[pft.id].anetps_ff_est=
  479. patch.pft[pft.id].anetps_ff_est_initial;
  480. patch.pft[pft.id].wscal_mean_est=patch.pft[pft.id].wscal_mean;
  481. newindiv=!negligible(nsapling / patcharea);
  482. }
  483. else if (patch.age%estinterval && !init_clone || patch.plant_this_year) {
  484. // Not an establishment year - save sapling count for
  485. // establishment the next establishment year
  486. // Establishment each year in managed patches
  487. patch.pft[pft.id].nsapling+=nsapling;
  488. }
  489. else {
  490. if (patch.age && !init_clone) {// all except first year after disturbance
  491. nsapling+=patch.pft[pft.id].nsapling;
  492. patch.pft[pft.id].anetps_ff_est/=(double)estinterval;
  493. patch.pft[pft.id].wscal_mean_est/=(double)estinterval;
  494. }
  495. newindiv=!negligible(nsapling / patcharea);
  496. // round down to 0 if nsapling very small
  497. }
  498. // ecev3 - implement cohort limit
  499. // Ben 2008-01-04: limit number of living cohorts of same
  500. // PFT in patch
  501. ncohort=0;
  502. vegetation.firstobj();
  503. while (vegetation.isobj) {
  504. Individual& indiv=vegetation.getobj();
  505. if (indiv.pft.id==pft.id) ncohort++;
  506. vegetation.nextobj();
  507. }
  508. if (ncohort>=MAXCOHORT) newindiv=0;
  509. // ecev3 - end of change
  510. }
  511. else if (vegmode == INDIVIDUAL) {
  512. newindiv=(int)(nsapling+0.5); // round up to be on the safe side
  513. }
  514. // LUMIP: deforest experiment turn off new tree saplings if necessary
  515. if (deforest_method_type > 0) { // ensure the follwoing section is disabled if no deforest requested
  516. bool est_disabled=false;
  517. switch(deforest_method_type) {
  518. case 1: // deforest if start<=year<end and in all grid points,
  519. if (deforest_start_year>0) {
  520. est_disabled=(date.get_calendar_year() >= deforest_start_year);
  521. patch.deforest_active=true;
  522. }
  523. // turn it off after the end year if requested
  524. if (est_disabled && (deforest_end_year>0)) {
  525. // this ensures we can turn the est on (disable the est_disabled) again after the end year, regardless of what was decided before
  526. if (date.get_calendar_year() > deforest_end_year) {
  527. est_disabled=false;
  528. patch.deforest_active=false;
  529. }
  530. }
  531. break;
  532. case 2: // like 1, but only in gridpoints and years with a primary to secondary transition vs>0
  533. // if deforestation is allready activated for this pft and patch (comes from lpjg state)
  534. if (patch.deforest_active) {
  535. est_disabled = true;
  536. }
  537. if (stand.get_gridcell().landcover.frac_transfer[NATURAL][NATURAL]>0) {
  538. if (deforest_start_year>0) {
  539. if (date.get_calendar_year() >= deforest_start_year) {
  540. est_disabled=true;
  541. // need to remember in the lpjg state that the deforestation for this pft in this patch is activated
  542. patch.deforest_active=true;
  543. }
  544. } else {
  545. est_disabled=true;
  546. patch.deforest_active=true;
  547. }
  548. }
  549. if (est_disabled && (deforest_end_year>0)) { // turn est on again after the end year if requested
  550. // this ensures we can turn the est on again (disable the est_disabled) again after the end year, regardless of what was decided before
  551. if (date.get_calendar_year() > deforest_end_year) {
  552. est_disabled=false;
  553. patch.deforest_active=false;
  554. }
  555. }
  556. break;
  557. default: // default: 0=deforest disabled (=establishment possible)
  558. est_disabled=false;
  559. break;
  560. }
  561. if (est_disabled) {
  562. newindiv=0;
  563. }
  564. }
  565. // Now create 'newindiv' new Individual objects
  566. for (i=0;i<newindiv;i++) {
  567. // Create average individual for a new cohort (cohort mode)
  568. // or an actual individual (individual mode)
  569. Individual& indiv=vegetation.createobj(pft,vegetation);
  570. if (vegmode==COHORT)
  571. indiv.densindiv=nsapling/patcharea;
  572. else if (vegmode==INDIVIDUAL)
  573. indiv.densindiv=1.0/patcharea;
  574. indiv.age=0.0;
  575. // Initial biomass proportional to potential forest floor net
  576. // assimilation for this PFT in this patch
  577. bminit=SAPSIZE*patch.pft[pft.id].anetps_ff_est;
  578. // Initial leaf to fine root biomass ratio based on hypothetical
  579. // value of water stress parameter
  580. ltor=patch.pft[pft.id].wscal_mean_est*pft.ltor_max;
  581. // Allocate initial biomass
  582. allocation_init(bminit,ltor,indiv);
  583. // Calculate initial allometry
  584. allometry(indiv);
  585. // Calculate storage pool size
  586. indiv.max_n_storage = indiv.cmass_sap * indiv.pft.fnstorage / indiv.pft.cton_leaf_avr;
  587. indiv.scale_n_storage = indiv.max_n_storage * indiv.pft.cton_leaf_avr / bminit;
  588. // Establishment flux is not debited for 'new' Individual
  589. // objects - their carbon is debited in function growth()
  590. // if they survive the first year
  591. }
  592. }
  593. }
  594. // Reset running sums for next year (establishment years only in cohort mode)
  595. if (vegmode!=COHORT || !(patch.age%estinterval) && !patch.plant_this_year) {
  596. patch.pft[pft.id].nsapling=0.0;
  597. patch.pft[pft.id].wscal_mean_est=0.0;
  598. patch.pft[pft.id].anetps_ff_est=0.0;
  599. }
  600. }
  601. // ... on to next PFT
  602. pftlist.nextobj();
  603. }
  604. }
  605. ///////////////////////////////////////////////////////////////////////////////////////
  606. // MORTALITY
  607. // Internal functions (do not call directly from framework)
  608. void mortality_lpj(Stand& stand, Patch& patch, const Climate& climate, double fireprob) {
  609. // DESCRIPTION
  610. // Mortality in population (standard LPJ) mode.
  611. // Simulates population decrease through mortality each simulation year for trees
  612. // and grasses; "kills" PFT populations if climate conditions become unsuitable for
  613. // survival.
  614. // This function assumes each Individual object represents the average individual
  615. // of a PFT population, and that there is (at most) one Individual object per PFT
  616. // per modelled area (stand and patch).
  617. // For tree PFTs, the fraction of the population killed is given by:
  618. //
  619. // (1) mort = min ( mort_greff + mort_shade + mort_fire, 1)
  620. // where mort_greff = mortality preempted by low growth efficiency, given by:
  621. // (2) mort_greff = K_MORT1 / (1 + K_MORT2*greff)
  622. // (3) greff = annual_npp / leaf_area
  623. // (4) leaf_area = cmass_leaf * sla
  624. // mort_shade = mortality due to shading ("self thinning") as total tree cover
  625. // approaches 1 (see code)
  626. // mort_fire = mortality due to fire; the fraction of the modelled area affected by
  627. // fire (fireprob) is calculated in function fire; actual mortality is influenced
  628. // by PFT-specific resistance to burning (see code).
  629. //
  630. // Grasses are subject to shading and fire mortality only
  631. // References: Sitch et al 2001, Smith et al 2001, Thonicke et al 2001
  632. // INPUT PARAMETER
  633. // fireprob = fraction of modelled area affected by fire
  634. const double K_MORT1=0.01; // constant in mortality equation [c.f. mort_max; LPJF]
  635. const double K_MORT2=35.0;
  636. // constant in mortality equation [c.f. k_mort; LPJF]; the value here differs
  637. // from LPJF's k_mort in that growth efficiency here based on annual NPP, c.f.
  638. // net growth increment; LPJF
  639. const double FPC_TREE_MAX=0.95; // maximum summed tree fractional projective cover
  640. double fpc_dec; // required reduction in FPC
  641. double fpc_tree; // summed FPC for all tree PFTs
  642. double fpc_grass; // summed FPC for all grasses
  643. double deltafpc_tree_total; // total tree increase in FPC this year
  644. double mort;
  645. // total mortality for PFT (fraction of current FPC)
  646. double mort_greffic;
  647. // background mortality plus mortality preempted by low growth efficiency
  648. // (fraction of current FPC)
  649. double mort_shade;
  650. // mortality associated with light competition (fraction of current FPC)
  651. double mort_fire;
  652. bool killed;
  653. // Obtain reference Vegetation object
  654. Vegetation& vegetation=patch.vegetation;
  655. // Calculate total tree and grass FPC and total increase in FPC this year for trees
  656. fpc_tree=0.0;
  657. fpc_grass=0.0;
  658. deltafpc_tree_total=0.0;
  659. // Loop through individuals
  660. vegetation.firstobj();
  661. while (vegetation.isobj) {
  662. Individual& indiv=vegetation.getobj();
  663. // For this individual ...
  664. if (indiv.pft.lifeform==TREE) {
  665. fpc_tree+=indiv.fpc;
  666. if (indiv.deltafpc<0.0) indiv.deltafpc=0.0;
  667. deltafpc_tree_total+=indiv.deltafpc;
  668. }
  669. else if (indiv.pft.lifeform==GRASS) fpc_grass+=indiv.fpc;
  670. vegetation.nextobj(); // ... on to next individual
  671. }
  672. // KILL PFTs BEYOND BIOCLIMATIC LIMITS FOR SURVIVAL
  673. // Loop through individuals
  674. vegetation.firstobj();
  675. while (vegetation.isobj) {
  676. Individual& indiv=vegetation.getobj();
  677. // For this individual ...
  678. killed=false;
  679. if (!survive(climate,indiv.pft)) {
  680. // Remove completely if PFT beyond its bioclimatic limits for survival
  681. indiv.kill();
  682. vegetation.killobj();
  683. killed=true;
  684. }
  685. if (!killed) vegetation.nextobj(); // ... on to next individual
  686. }
  687. // CALCULATE AND IMPLEMENT MORTALITY
  688. // Loop through individuals
  689. vegetation.firstobj();
  690. while (vegetation.isobj) {
  691. Individual& indiv=vegetation.getobj();
  692. // For this individual ...
  693. killed=false;
  694. if (indiv.pft.lifeform==TREE) {
  695. // TREE MORTALITY
  696. // Mortality associated with low growth efficiency (includes
  697. // parameterisation of population background mortality)
  698. // NOTE: growth efficiency quantified as (annual NPP)/(leaf area)
  699. // c.f. LPJF, which uses net growth increment instead of NPP
  700. mort_greffic=K_MORT1/(1.0+K_MORT2*max(indiv.anpp,0.0)/indiv.cmass_leaf/
  701. indiv.pft.sla);
  702. // Mortality associated with light competition
  703. // Self thinning imposed when total tree cover above FPC_TREE_MAX,
  704. // partitioned among tree PFTs in proportion to this year's FPC increment
  705. if (fpc_tree>FPC_TREE_MAX) {
  706. if (!negligible(deltafpc_tree_total))
  707. fpc_dec=(fpc_tree-FPC_TREE_MAX)*indiv.deltafpc/deltafpc_tree_total;
  708. else
  709. fpc_dec=0.0;
  710. mort_shade=1.0-fracmass_lpj(indiv.fpc-fpc_dec,indiv.fpc,indiv);
  711. }
  712. else
  713. mort_shade=0.0;
  714. // Mortality due to fire
  715. if (patch.has_fires()) mort_fire=fireprob*(1.0-indiv.pft.fireresist);
  716. else mort_fire=0.0;
  717. // Sum mortality components to give total mortality (maximum 1)
  718. mort=min(mort_greffic+mort_shade+mort_fire,1.0);
  719. // Reduce population density and C biomass on modelled area basis
  720. // to account for loss of killed individuals
  721. indiv.reduce_biomass(mort, mort_fire);
  722. }
  723. else if (indiv.pft.lifeform==GRASS) {
  724. // GRASS MORTALITY
  725. if (indiv.pft.landcover==CROPLAND)
  726. fpc_grass=indiv.fpc;
  727. // Shading mortality: grasses can persist only on regions not occupied
  728. // by trees
  729. if (fpc_grass>1.0-min(fpc_tree,FPC_TREE_MAX)) {
  730. fpc_dec=(fpc_grass-1.0+min(fpc_tree,FPC_TREE_MAX))*indiv.fpc/fpc_grass;
  731. mort_shade=1.0-fracmass_lpj(indiv.fpc-fpc_dec,indiv.fpc,indiv);
  732. }
  733. else
  734. mort_shade=0.0;
  735. // Mortality due to fire
  736. if (patch.has_fires())
  737. mort_fire=fireprob*(1.0-indiv.pft.fireresist);
  738. else mort_fire=0.0;
  739. // Sum mortality components to give total mortality (maximum 1)
  740. mort=min(mort_shade+mort_fire,1.0);
  741. // Reduce C biomass on modelled area basis to account for biomass lost
  742. // through mortality
  743. indiv.reduce_biomass(mort, mort_fire);
  744. }
  745. // Remove this PFT population completely if all individuals killed
  746. if (negligible(indiv.densindiv)) {
  747. vegetation.killobj();
  748. killed=true;
  749. }
  750. // Update allometry
  751. else allometry(indiv);
  752. if (!killed) vegetation.nextobj(); // ... on to next individual
  753. }
  754. }
  755. void mortality_guess(Stand& stand, Patch& patch, const Climate& climate, double fireprob) {
  756. // DESCRIPTION
  757. // Mortality in cohort and individual modes.
  758. // Simulates death of individuals or reduction in individual density through
  759. // mortality (including fire mortality) each simulation year for trees, and
  760. // reduction in biomass due to fire for grasses; kills individuals/cohorts if
  761. // climate conditions become unsuitable for survival.
  762. //
  763. // For trees, death can result from the following factors:
  764. //
  765. // (1) a background mortality rate related to PFT mean longevity;
  766. // (2) when mean growth efficiency over an integration period (five years) falls
  767. // below a PFT-specific threshold;
  768. // (3) stress associated with high temperatures (a "soft" bioclimatic limit,
  769. // intended mainly for boreal tree PFTs; Sitch et al 2001, Eqn 55);
  770. // (4) fire (probability calculated in function fire)
  771. // (5) when climatic conditions are such that all individuals of the PFT are
  772. // killed.
  773. //
  774. // For grasses, (4) and (5) above are modelled only.
  775. //
  776. // For trees and in cohort mode, mortality may be stochastic or deterministic
  777. // (according to the value of global variable ifstochmort). In stochastic mode,
  778. // expected mortality rates are imposed as stochastic probabilities of death; in
  779. // deterministic mode, cohort density is reduced by the fraction represented by
  780. // the mortality rate.
  781. if(patch.managed_this_year)
  782. return;
  783. // INPUT PARAMETER
  784. // fireprob = probability of fire in this patch
  785. double mort;
  786. // overall mortality (excluding fire mortality): fraction of cohort killed, or:
  787. // probability of individual being killed
  788. double mort_min;
  789. // background component of overall mortality (see 'mort')
  790. double mort_greff;
  791. // component of overall mortality associated with low growth efficiency
  792. double mort_fire;
  793. // expected fraction of cohort killed (or: probability of individual being
  794. // killed) due to fire
  795. double frac_survive;
  796. // fraction of cohort (or individual) surviving
  797. double greff;
  798. // growth efficiency for individual/cohort this year (kgC/m2 leaf/year)
  799. double greff_mean;
  800. // five-year-mean growth efficiency (kgC/m2 leaf/year)
  801. int nindiv; // number of individuals (remaining) in cohort
  802. int nindiv_prev; // number of individuals in cohort prior to mortality
  803. int i;
  804. bool killed;
  805. const double KMORTGREFF=0.3;
  806. // value of mort_greff when growth efficiency below PFT-specific threshold
  807. const double KMORTBG_LNF=-log(0.001);
  808. // coefficient in calculation of background mortality (negated natural log of
  809. // fraction of population expected to survive to age 'longevity'; see Eqn 14
  810. // below)
  811. const double KMORTBG_Q=2.0;
  812. // exponent in calculation of background mortality (shape parameter for
  813. // relationship between mortality and age (0=constant mortality; 1=linear
  814. // increase; >1->exponential; steepness increases for increasing positive
  815. // values)
  816. // Obtain reference to Vegetation object for this patch
  817. Vegetation& vegetation=patch.vegetation;
  818. // FPC grasses
  819. double fpcgrasses = 0.0;
  820. if (stand.landcover == PASTURE || stand.landcover == URBAN || stand.landcover == PEATLAND) {
  821. vegetation.firstobj();
  822. while (vegetation.isobj) {
  823. Individual& indiv = vegetation.getobj();
  824. // For this individual ...
  825. if (indiv.pft.lifeform == GRASS)
  826. fpcgrasses += indiv.fpc;
  827. vegetation.nextobj(); // ... on to next individual
  828. }
  829. }
  830. // FIRE MORTALITY
  831. if (patch.has_fires()) {
  832. // Impose fire in this patch with probability 'fireprob'
  833. if (randfrac(stand.seed)<fireprob) {
  834. // Loop through individuals
  835. vegetation.firstobj();
  836. while (vegetation.isobj) {
  837. Individual& indiv=vegetation.getobj();
  838. // For this individual ...
  839. killed=false;
  840. // Fraction of biomass destroyed by fire
  841. mort_fire=1.0-indiv.pft.fireresist;
  842. if (indiv.pft.lifeform==GRASS) {
  843. // GRASS PFT
  844. // Reduce individual biomass
  845. indiv.reduce_biomass(mort_fire, mort_fire);
  846. // Update allometry
  847. allometry(indiv);
  848. }
  849. else {
  850. // TREE PFT
  851. if (ifstochmort) {
  852. // Impose stochastic mortality
  853. // Each individual in cohort dies with probability 'mort_fire'
  854. // Number of individuals represented by 'indiv'
  855. // (round up to be on the safe side)
  856. nindiv=(int)(indiv.densindiv*patcharea+0.5);
  857. nindiv_prev=nindiv;
  858. for (i=0;i<nindiv_prev;i++)
  859. if (randfrac(stand.seed)>indiv.pft.fireresist) nindiv--;
  860. if (nindiv_prev)
  861. frac_survive=(double)nindiv/(double)nindiv_prev;
  862. else
  863. frac_survive=0.0;
  864. }
  865. // Deterministic mortality (cohort mode only)
  866. else frac_survive=1.0-mort_fire;
  867. // Reduce individual biomass on patch area basis
  868. // to account for loss of killed individuals
  869. indiv.reduce_biomass(1.0 - frac_survive, 1.0 - frac_survive);
  870. // Remove this cohort completely if all individuals killed
  871. // (in individual mode: removes individual if killed)
  872. if (negligible(indiv.densindiv)) {
  873. vegetation.killobj();
  874. killed=true;
  875. }
  876. }
  877. if (!killed) vegetation.nextobj(); // ... on to next individual
  878. }
  879. }
  880. }
  881. // MORTALITY NOT ASSOCIATED WITH FIRE
  882. // Loop through individuals
  883. vegetation.firstobj();
  884. while (vegetation.isobj) {
  885. Individual& indiv=vegetation.getobj();
  886. // For this individual ...
  887. killed=false;
  888. // KILL INDIVIDUALS/COHORTS BEYOND BIOCLIMATIC LIMITS FOR SURVIVAL
  889. if (!survive(climate,indiv.pft)) {
  890. // Kill cohort/individual, transfer biomass to litter
  891. indiv.kill();
  892. vegetation.killobj();
  893. killed=true;
  894. }
  895. else {
  896. if (indiv.pft.lifeform==TREE) {
  897. // Calculate this year's growth efficiency
  898. // Eqn 31, Smith et al 2001
  899. if (!negligible(indiv.cmass_leaf))
  900. greff=max(indiv.anpp,0.0)/indiv.cmass_leaf/indiv.pft.sla;
  901. else
  902. greff=0.0;
  903. // Calculate 5 year mean growth efficiency
  904. indiv.greff_5.add(greff);
  905. greff_mean = indiv.greff_5.mean();
  906. // BACKGROUND MORTALITY
  907. //
  908. // This is now modelled as an increasing probability of death with
  909. // age. The expected likelihood of death by "background" factors at a
  910. // given age is given by the general relationship [** = raised to the
  911. // power of]:
  912. // (1) mort(age) = min( Z * ( age / longevity ) ** Q , 1)
  913. // where Z is a constant (value derived below);
  914. // Q is a positive constant
  915. // (or zero for constant mortality with age)
  916. // longevity is the age at which the fraction of the initial
  917. // cohort expected to survive is a known value, F
  918. // It is possible to derive the value of Z given values for longevity,
  919. // Q and F, by integration:
  920. //
  921. // The rate of change of cohort size (P) at any age is given by:
  922. // (2) dP/dage = -mort(age) * P
  923. // Combining (1) and (2),
  924. // (3) dP/dage = -Z.(age/longevity)**Q.P
  925. // From (3),
  926. // (4) (1/P) dP = -Z.(age/longevity)**Q.dage
  927. // Integrating the LHS of eqn 4 from P_0 (initial cohort size) to
  928. // P_longevity (cohort size at age=longevity); and the RHS of eqn 4
  929. // from 0 to longevity:
  930. // (5) LHS = ln(P_longevity) - ln(P_0)
  931. // (6) = ln(P_longevity/P_0)
  932. // (7) = ln(P_0*F/P_0)
  933. // (8) = ln(F)
  934. // (9) RHS = integral[0,longevity] -Z.(age/longevity)**Q.dage
  935. // (10) = integral[0,longevity] -Z.(1/longevity)**Q.age**Q.dage
  936. // (11) = -Z.(1/longevity)**Q.integral[0,longevity] age**Q.dage
  937. // (12) = -Z.(1/longevity)**Q.longevity**(Q+1)/(Q+1)
  938. // (Zwillinger 1996, p 360)
  939. // Combining (8) and (12),
  940. // (13) Z = - ln(F) * (Q+1) / longevity
  941. // Combining (1) and (13),
  942. // (14) mort(age) =
  943. // min ( -ln(F) * (Q+1) / longevity * (age/longevity)**P, 1)
  944. // Eqn 14
  945. mort_min=min(1.0,KMORTBG_LNF*(KMORTBG_Q+1)/indiv.pft.longevity*
  946. pow(indiv.age/indiv.pft.longevity,KMORTBG_Q));
  947. // Growth suppression mortality
  948. // Smith et al 2001; c.f. Pacala et al 1993, Eqn 5
  949. // guess2008 - introduce a smoothly-varying mort_greff - 5 is the exponent in the global validation
  950. if (ifsmoothgreffmort)
  951. mort_greff=KMORTGREFF/(1.0+pow((greff_mean/(indiv.pft.greff_min)),5.0));
  952. else {
  953. // Standard case, as in guess030124
  954. if (greff_mean<indiv.pft.greff_min)
  955. mort_greff=KMORTGREFF;
  956. else
  957. mort_greff=0.0;
  958. }
  959. // Increase growth efficiency mortality if summed crown area within
  960. // cohort exceeds 1 (to ensure self-thinning for shade-tolerant PFTs)
  961. if (vegmode==COHORT) {
  962. if (indiv.crownarea*indiv.densindiv>1.0)
  963. mort_greff=max((indiv.crownarea*indiv.densindiv-1.0)/
  964. (indiv.crownarea*indiv.densindiv),mort_greff);
  965. }
  966. // Overall mortality: c.f. Eqn 29, Smith et al 2001
  967. mort=mort_min+mort_greff-mort_min*mort_greff;
  968. // guess2008 - added safety check
  969. if (mort > 1.0 || mort < 0.0)
  970. fail("error in mortality_guess: bad mort value");
  971. if (ifstochmort) {
  972. // Impose stochastic mortality
  973. // Each individual in cohort dies with probability 'mort'
  974. nindiv=(int)(indiv.densindiv*patcharea+0.5);
  975. nindiv_prev=nindiv;
  976. for (i=0;i<nindiv_prev;i++)
  977. if (randfrac(stand.seed)<mort) nindiv--;
  978. if (nindiv_prev)
  979. frac_survive=(double)nindiv/(double)nindiv_prev;
  980. else
  981. frac_survive=0.0;
  982. }
  983. // Deterministic mortality (cohort mode only)
  984. else frac_survive=1.0-mort;
  985. // Reduce individual density and biomass on patch area basis
  986. // to account for loss of killed individuals
  987. indiv.reduce_biomass(1.0 - frac_survive, 0.0);
  988. // Remove this cohort completely if all individuals killed
  989. // (in individual mode: removes individual if killed)
  990. if (negligible(indiv.densindiv)) {
  991. vegetation.killobj();
  992. killed=true;
  993. }
  994. // Update allometry
  995. else allometry(indiv);
  996. }
  997. else {
  998. // GRASS MORTALITY in PASTURE, URBAN and PEATLAND stands
  999. // i.e. shading mortality when grass LAI gets too high (cf mortality_lpj above), whereupon
  1000. // biomass is reduced (ends up in litter) to be consistent with the given LAI limit: maxlai_urban_pasture_peatland
  1001. if (ECEARTH) {
  1002. double mort_shade = 0.0;
  1003. if ((stand.landcover == PASTURE || stand.landcover == URBAN || stand.landcover == PEATLAND) && !negligible(indiv.cmass_leaf) &&
  1004. indiv.pft.lifeform == GRASS) {
  1005. // Max values
  1006. const double maxlai_urban_pasture_peatland = 6.0;
  1007. double maxfpc_urban_pasture_peatland = 1.0 - exp(-.5 * maxlai_urban_pasture_peatland);
  1008. // This individual
  1009. double grasslai = indiv.cmass_leaf * indiv.pft.sla;
  1010. double grassfpc = 1.0 - exp(-.5 * grasslai);
  1011. if (grassfpc > maxfpc_urban_pasture_peatland) {
  1012. // fracmass_lpj calculates and returns new biomass as a fraction of old biomass given an FPC
  1013. // reduction from fpc_high to fpc_low, assuming LPJ allometry
  1014. double fpc_dec = (grassfpc - maxfpc_urban_pasture_peatland) * grassfpc / fpcgrasses;
  1015. mort_shade = 1.0 - fracmass_lpj(grassfpc - fpc_dec, grassfpc, indiv);
  1016. }
  1017. // Reduce C biomass to account for biomass lost through shading mortality
  1018. if (mort_shade> 0.0) {
  1019. indiv.reduce_biomass(mort_shade, 0.0);
  1020. allometry(indiv);
  1021. }
  1022. } // correct stand and grass type
  1023. } // EC-EARTH only
  1024. }
  1025. }
  1026. // ... on to next individual
  1027. if (!killed) vegetation.nextobj();
  1028. }
  1029. }
  1030. ///////////////////////////////////////////////////////////////////////////////////////
  1031. // FIRE DISTURBANCE
  1032. // Internal function (do not call directly from framework)
  1033. void fire(Patch& patch,double& fireprob) {
  1034. // DESCRIPTION
  1035. // Calculates probability/incidence of disturbance by fire; implements
  1036. // volatilisation of above-ground litter due to fire.
  1037. // Mortality due to fire implemented in mortality functions, not here.
  1038. //
  1039. // Reference: Thonicke et al 2001, with updated Eqn 9
  1040. // OUTPUT PARAMETER
  1041. // fireprob = probability of fire in this patch this year
  1042. // (in population mode: fraction of modelled area affected by fire)
  1043. const double MINFUEL=0.2;
  1044. // Minimum total aboveground litter required for fire (kgC/m2)
  1045. double litter_ag;
  1046. // total aboveground litter (kgC/m2) [litter_ag_total/1000, fuel/1000; LPJF]
  1047. double me_mean;
  1048. // mean litter flammability moisture threshold [=moisture of extinction, me;
  1049. // Thonicke et al 2001 Eqn 2; moistfactor; LPJF]
  1050. double pm;
  1051. // probability of fire on a given day [p(m); Thonicke et al 2001, Eqn 2;
  1052. // fire_prob; LPJF]
  1053. double n;
  1054. // summed length of fire season (days) [N; Thonicke et al 2001, Eqn 4;
  1055. // fire_length; LPJF]
  1056. double s;
  1057. // annual mean daily probability of fire [s; Thonicke et al 2001, Eqn 8;
  1058. // fire_index; LPJF]
  1059. double sm; // s-1
  1060. double mort_fire; // fire mortality as fraction of current FPC
  1061. double burnt_litter; // litter burnt by fire
  1062. int p;
  1063. // Calculate fuel load (total aboveground litter)
  1064. litter_ag=0.0;
  1065. // Loop through PFTs
  1066. for (p=0;p<npft;p++) {
  1067. litter_ag += patch.pft[p].litter_leaf + patch.pft[p].litter_sap + patch.pft[p].litter_heart +
  1068. patch.pft[p].litter_repr;
  1069. }
  1070. // Soil Litter
  1071. litter_ag += patch.soil.sompool[SURFSTRUCT].cmass + patch.soil.sompool[SURFMETA].cmass +
  1072. patch.soil.sompool[SURFFWD].cmass + patch.soil.sompool[SURFCWD].cmass;
  1073. // Prevent fire if fuel load below prescribed threshold
  1074. if (litter_ag<MINFUEL) {
  1075. fireprob=0.0;
  1076. return;
  1077. }
  1078. // Calculate mean litter flammability moisture threshold
  1079. me_mean=0.0;
  1080. // Loop through PFTs
  1081. for (p=0;p<npft;p++) {
  1082. me_mean += (patch.pft[p].litter_leaf + patch.pft[p].litter_sap + patch.pft[p].litter_heart +
  1083. patch.pft[p].litter_repr) * patch.pft[p].pft.litterme / litter_ag;
  1084. }
  1085. // Soil litter
  1086. me_mean += (patch.soil.sompool[SURFSTRUCT].cmass * patch.soil.sompool[SURFSTRUCT].litterme +
  1087. patch.soil.sompool[SURFMETA].cmass * patch.soil.sompool[SURFMETA].litterme +
  1088. patch.soil.sompool[SURFFWD].cmass * patch.soil.sompool[SURFFWD].litterme +
  1089. patch.soil.sompool[SURFCWD].cmass * patch.soil.sompool[SURFCWD].litterme) / litter_ag;
  1090. // Calculate length of fire season in days
  1091. // Eqn 2, 4, Thonicke et al 2001
  1092. // NOTE: error in Eqn 2, Thonicke et al - multiplier should be PI/4, not PI
  1093. n=0.0;
  1094. for (int day = 0; day < date.year_length(); day++) {
  1095. //double airTtoday = patch.stand.get_gridcell().climate.temp;
  1096. //if (airTtoday > 5.0) // ecev3 limit
  1097. // Eqn 2
  1098. pm = exp(-PI*patch.soil.dwcontupper[day] / me_mean*patch.soil.dwcontupper[day] /
  1099. me_mean);
  1100. //else
  1101. // pm = 0;// Eqn 2
  1102. // Eqn 4
  1103. n+=pm;
  1104. }
  1105. // Calculate fraction of grid cell burnt
  1106. // Thonicke et al 2001, Eqn 9
  1107. s=n/(double)date.year_length();
  1108. sm=s-1;
  1109. fireprob=s*exp(sm/(0.45*sm*sm*sm+2.83*sm*sm+2.96*sm+1.04));
  1110. if (fireprob>1.0)
  1111. fail("fire: probability of fire >1.0");
  1112. else if (fireprob<0.001) fireprob=0.001; // c.f. LPJF
  1113. // Calculate expected flux from litter due to fire
  1114. // (fluxes from vegetation calculated in mortality functions)
  1115. for (p=0;p<npft;p++) {
  1116. // Assume litter is as fire resistant as the vegetation it originates from
  1117. mort_fire=fireprob*(1.0-patch.pft[p].pft.fireresist);
  1118. // Calculate flux from burnt litter
  1119. burnt_litter = mort_fire*(patch.pft[p].litter_leaf + patch.pft[p].litter_sap +
  1120. patch.pft[p].litter_heart + patch.pft[p].litter_repr);
  1121. patch.fluxes.report_flux(Fluxes::FIREC, burnt_litter);
  1122. patch.fluxes.report_flux(Fluxes::FIRELITTERC, burnt_litter);
  1123. report_fire_nfluxes(patch, mort_fire * (patch.pft[p].nmass_litter_leaf +
  1124. patch.pft[p].nmass_litter_sap + patch.pft[p].nmass_litter_heart));
  1125. // Account for burnt above ground litter
  1126. patch.pft[p].litter_leaf *= (1.0 - mort_fire);
  1127. patch.pft[p].litter_sap *= (1.0 - mort_fire);
  1128. patch.pft[p].litter_heart *= (1.0 - mort_fire);
  1129. patch.pft[p].litter_repr *= (1.0 - mort_fire);
  1130. patch.pft[p].nmass_litter_leaf *= (1.0 - mort_fire);
  1131. patch.pft[p].nmass_litter_sap *= (1.0 - mort_fire);
  1132. patch.pft[p].nmass_litter_heart *= (1.0 - mort_fire);
  1133. }
  1134. // Soil litter
  1135. double mort_fire_struct = fireprob * (1.0 - patch.soil.sompool[SURFSTRUCT].fireresist);
  1136. double mort_fire_meta = fireprob * (1.0 - patch.soil.sompool[SURFMETA].fireresist);
  1137. double mort_fire_fwd = fireprob * (1.0 - patch.soil.sompool[SURFFWD].fireresist);
  1138. double mort_fire_cwd = fireprob * (1.0 - patch.soil.sompool[SURFCWD].fireresist);
  1139. burnt_litter = patch.soil.sompool[SURFSTRUCT].cmass * mort_fire_struct +
  1140. patch.soil.sompool[SURFMETA].cmass * mort_fire_meta +
  1141. patch.soil.sompool[SURFFWD].cmass * mort_fire_fwd +
  1142. patch.soil.sompool[SURFCWD].cmass * mort_fire_cwd;
  1143. // Calculate flux from burnt soil litter
  1144. patch.fluxes.report_flux(Fluxes::FIREC, burnt_litter);
  1145. patch.fluxes.report_flux(Fluxes::FIRELITTERC, burnt_litter);
  1146. // Account for burnt above ground litter
  1147. patch.soil.sompool[SURFSTRUCT].cmass *= (1.0 - mort_fire_struct);
  1148. patch.soil.sompool[SURFMETA].cmass *= (1.0 - mort_fire_meta);
  1149. patch.soil.sompool[SURFFWD].cmass *= (1.0 - mort_fire_fwd);
  1150. patch.soil.sompool[SURFCWD].cmass *= (1.0 - mort_fire_cwd);
  1151. // Calculate nitrogen flux from burnt soil litter
  1152. double nflux_fire = patch.soil.sompool[SURFSTRUCT].nmass * mort_fire_struct +
  1153. patch.soil.sompool[SURFMETA].nmass * mort_fire_meta +
  1154. patch.soil.sompool[SURFFWD].nmass * mort_fire_fwd +
  1155. patch.soil.sompool[SURFCWD].nmass * mort_fire_cwd;
  1156. report_fire_nfluxes(patch, nflux_fire);
  1157. patch.soil.sompool[SURFSTRUCT].nmass *= (1.0 - mort_fire_struct);
  1158. patch.soil.sompool[SURFMETA].nmass *= (1.0 - mort_fire_meta);
  1159. patch.soil.sompool[SURFFWD].nmass *= (1.0 - mort_fire_fwd);
  1160. patch.soil.sompool[SURFCWD].nmass *= (1.0 - mort_fire_cwd);
  1161. }
  1162. ///////////////////////////////////////////////////////////////////////////////////////
  1163. // DISTURBANCE
  1164. // Generic patch-destroying disturbance with a prescribed probability
  1165. // Internal function - do not call from framework
  1166. void disturbance(Patch& patch, double disturb_prob) {
  1167. // DESCRIPTION
  1168. // Destroys all biomass in a patch with a certain stochastic probability.
  1169. // Biomass enters the litter, which is not affected by the disturbance.
  1170. // NB: cohort and individual mode only
  1171. // INPUT PARAMETER
  1172. // disturb_prob = the probability of a disturbance this year
  1173. if (randfrac(patch.stand.seed)<disturb_prob) {
  1174. Vegetation& vegetation = patch.vegetation;
  1175. vegetation.firstobj();
  1176. while (vegetation.isobj) {
  1177. Individual& indiv = vegetation.getobj();
  1178. indiv.kill();
  1179. vegetation.killobj();
  1180. }
  1181. patch.disturbed = true;
  1182. patch.age = 0;
  1183. }
  1184. else patch.disturbed = false;
  1185. }
  1186. ///////////////////////////////////////////////////////////////////////////////////////
  1187. // VEGETATION DYNAMICS
  1188. // Should be called by framework at the end of each simulation year, after vegetation,
  1189. // climate and soil attributes have been updated
  1190. void vegetation_dynamics(Stand& stand,Patch& patch) {
  1191. // DESCRIPTION
  1192. // Implementation of fire disturbance and population dynamics (establishment and
  1193. // mortality) at end of simulation year. Bioclimatic constraints to survival and
  1194. // establishment are imposed within mortality and establishment functions
  1195. // respectively.
  1196. double fireprob = 0.0;
  1197. // probability of fire in this patch this year
  1198. // (in population mode: fraction of modelled area affected by fire this year)
  1199. // Calculate fire probability and volatilise litter
  1200. if (patch.has_fires()) {
  1201. fire(patch,fireprob);
  1202. }
  1203. patch.fireprob = fireprob;
  1204. if (vegmode == POPULATION) {
  1205. // POPULATION MODE
  1206. // Mortality
  1207. mortality_lpj(stand, patch, stand.get_climate(), fireprob);
  1208. // Establishment
  1209. establishment_lpj(stand,patch);
  1210. }
  1211. else {
  1212. // INDIVIDUAL AND COHORT MODES
  1213. // Patch-destroying disturbance
  1214. // Disturbance when N limitation is switched on to get right pft composition under N limitation faster
  1215. if (ifcentury && ifnlim && patch.stand.get_gridcell().getsimulationyear(date.year) == freenyears) {
  1216. disturbance(patch, 1.0);
  1217. if (patch.disturbed) {
  1218. return; // no mortality or establishment this year
  1219. }
  1220. }
  1221. // Normal disturbance with probability interval of distinterval
  1222. if (patch.has_disturbances()) {
  1223. // We don't allow disturbance while documenting for calculation of Century equilibrium
  1224. bool during_century_solvesom = ifcentury &&
  1225. patch.stand.get_gridcell().getsimulationyear(date.year) >= patch.soil.solvesomcent_beginyr &&
  1226. patch.stand.get_gridcell().getsimulationyear(date.year) <= patch.soil.solvesomcent_endyr;
  1227. if (patch.age && !during_century_solvesom && date.year != stand.clone_year) {
  1228. disturbance(patch,1.0 / distinterval);
  1229. if (patch.disturbed) {
  1230. return; // no mortality or establishment this year
  1231. }
  1232. }
  1233. }
  1234. // Mortality
  1235. mortality_guess(stand, patch, stand.get_climate(), fireprob);
  1236. // Establishment
  1237. establishment_guess(stand,patch);
  1238. }
  1239. patch.age++;
  1240. }
  1241. ///////////////////////////////////////////////////////////////////////////////////////
  1242. // REFERENCES
  1243. //
  1244. // LPJF refers to the original FORTRAN implementation of LPJ as described by Sitch
  1245. // et al 2001
  1246. // Fulton, MR 1991 Adult recruitment rate as a function of juvenile growth in size-
  1247. // structured plant populations. Oikos 61: 102-105.
  1248. // Pacala SW, Canham, CD & Silander JA Jr 1993 Forest models defined by field
  1249. // measurements: I. The design of a northeastern forest simulator. Canadian Journal
  1250. // of Forest Research 23: 1980-1988.
  1251. // Prentice, IC, Sykes, MT & Cramer W 1993 A simulation model for the transient
  1252. // effects of climate change on forest landscapes. Ecological Modelling 65:
  1253. // 51-70.
  1254. // Sitch, S, Prentice IC, Smith, B & Other LPJ Consortium Members (2000) LPJ - a
  1255. // coupled model of vegetation dynamics and the terrestrial carbon cycle. In:
  1256. // Sitch, S. The Role of Vegetation Dynamics in the Control of Atmospheric CO2
  1257. // Content, PhD Thesis, Lund University, Lund, Sweden.
  1258. // Smith, B, Prentice, IC & Sykes, M (2001) Representation of vegetation dynamics in
  1259. // the modelling of terrestrial ecosystems: comparing two contrasting approaches
  1260. // within European climate space. Global Ecology and Biogeography 10: 621-637
  1261. // Thonicke, K, Venevsky, S, Sitch, S & Cramer, W (2001) The role of fire disturbance
  1262. // for global vegetation dynamics: coupling fire into a Dynamic Global Vegetation
  1263. // Model. Global Ecology and Biogeography 10: 661-677.
  1264. // Zwillinger, D 1996 CRC Standard Mathematical Tables and Formulae, 30th ed. CRC
  1265. // Press, Boca Raton, Florida.