Commit 3e32c623 authored by jouke's avatar jouke
Browse files

minimum absolute error introduced in carbon balance

parent c2f5e6e9
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ PlantCarbonBalance::PlantCarbonBalance(SimulaDynamic* pSD) :
}

///@todo fix storage and exudate modules
#define RELATIVE 100/tinc
#define RELATIVE 100/std::max(tinc,1e-1)
void PlantCarbonBalance::calculate(const Time &t, double &balance) {
	//current cumulative income
	balance=0.;
@@ -120,7 +120,8 @@ void PlantCarbonBalance::calculate(const Time &t, double &balance) {
		//balance
		balance = tinc - ((tdw * cdw) + tresp + texu + tstore + tstarch);//tinc - ((tdw * cdw) + tresp + texu + tstore);
		//relative error
		double terr(balance * RELATIVE);
		const double terr(balance * RELATIVE);
		//if(abs(terr)>0.5) std::cout<<std::endl<<"terr="<<terr<<", Cinc="<<tinc* RELATIVE<<", Ctdw="<<-tdw*cdw* RELATIVE<<", Cresp="<<-tresp* RELATIVE<<", Cexu="<<-texu* RELATIVE<<", Cstore="<<-tstore* RELATIVE<<", Cstarch="<<-tstarch* RELATIVE<<std::endl;
		//try to be more verbose about where the possible error is
		//dry weight of roots versus total allocated carbon
		double ra, rdw;