forked from JGCRI/gcam-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlow_income_FD_fixes.patch
39 lines (35 loc) · 1.46 KB
/
low_income_FD_fixes.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
diff --git a/cvs/objects/functions/source/food_demand_input.cpp b/cvs/objects/functions/source/food_demand_input.cpp
index 17c6468ab..0292ebde0 100644
--- a/cvs/objects/functions/source/food_demand_input.cpp
+++ b/cvs/objects/functions/source/food_demand_input.cpp
@@ -499,12 +499,12 @@ double StaplesFoodDemandInput::calcIncomeTermDerivative( double aAdjIncome ) con
double etas;
if(aAdjIncome > x1) {
- etas = mIncomeElasticity*(1-log(k*aAdjIncome)) / aAdjIncome;
+ etas = (1.0-log(k*aAdjIncome)) / aAdjIncome;
}
else {
- etas = 1.0;
+ etas = (1.0-log(k*x1)) / x1;
}
- return etas;
+ return etas * mIncomeElasticity;
}
NonStaplesFoodDemandInput::NonStaplesFoodDemandInput()
@@ -632,15 +632,15 @@ double NonStaplesFoodDemandInput::calcIncomeTermDerivative( double aAdjIncome )
if(fabs(delta) > 1.0e-3/mIncomeElasticity) {
// lim_x->0 etan = 1
- etan = aAdjIncome < 1.0e-4 ? 1 : 1/delta + aAdjIncome*log(aAdjIncome)/pow(delta, 2);
+ etan = aAdjIncome < 1.0e-4 ? 1.0 : 1.0/delta + aAdjIncome*log(aAdjIncome)/pow(delta, 2);
}
else {
// Represent the income term derivative near x==1 as a Taylor series
- etan = mIncomeElasticity * (0.5 +
+ etan = (0.5 +
1.0/6.0 * delta +
1.0/12.0 * pow(delta, 2) +
1.0/20.0 * pow(delta, 3));
}
- return etan;
+ return etan * mIncomeElasticity;
}