Commit 9b87e175 authored by Jouke's avatar Jouke
Browse files

Merge branch 'carbonAllocationToSecondaryGrowth' into 'master'

Fix secondary root growth carbon allocation

See merge request rootmodels/OpenSimRoot!82
parents 6d181436 dbccf2c7
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -642,6 +642,16 @@ void RootGrowthScalingFactor::calculate(const Time &t,double &scale){
	double thrh(1.0);//don't change this a backward compatibility default
	if(threshold)threshold->get(t-plantingTime,thrh);
	thrh*=a;
	//Allow secondary growth to use carbon that is not needed to satisfy the
	//potential longitudinal growth. This can raise the secondary allocation
	//above its configured maximum fraction without reducing longitudinal growth.
	double longitudinalPotential(p-sp);
	if(longitudinalPotential<0) longitudinalPotential=0;
	double carbonNotNeededForLongitudinalGrowth(a-longitudinalPotential);
	if(carbonNotNeededForLongitudinalGrowth>thrh){
		thrh=carbonNotNeededForLongitudinalGrowth;
	}
	if(thrh>a) thrh=a;
	if(s>thrh){
		s=thrh;
		msg::warning("RootGrowthScaling Factor: parameter maxCarbonAllocation2SecondaryGrowth limiting secondary growth.");