Skip to content

Commit 755678a

Browse files
authored
Merge pull request #16 from cropsinsilico/SoybeanParameterization
Soybean parameterization
2 parents 61e4cf4 + ba74b39 commit 755678a

File tree

10 files changed

+56
-24
lines changed

10 files changed

+56
-24
lines changed

CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ include_directories(${SUNDIALS_INCLUDE_DIRS})
117117
include_directories("${PROJECT_SOURCE_DIR}/include")
118118

119119
target_link_libraries(EPhotosynthesis ${SUNDIALS_LIBRARIES})
120-
121-
target_link_libraries(EPhotosynthesis boost_regex)
120+
target_link_libraries(EPhotosynthesis ${Boost_LIBRARIES})
122121
target_link_libraries(ePhoto EPhotosynthesis)
123122

124123
install(TARGETS EPhotosynthesis DESTINATION lib)

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# ePhotosynthesis
22

3+
On biocluster (Linux), I manage to build it successfully using a conda environment. First, initialize a new conda env so that the package path is on your local drive with r/w permissons. Second, install both boost and sundial through conda. Third, follow the following steps for cmake and make. This way, the cmake should be able to find the boost and sundial automatically. Of course, be sure to activate the related env the next time after login.
4+
5+
Note: The sundials version I used is 5.7.0. The newer one 6.6.1 is not compatible!
6+
37
This is a C++ port of the ePhotosynthesis Matlab model code. The code is built with
48
*CMake*.
59

@@ -42,4 +46,4 @@ The ePhotosynthesis executable takes the following arguments:
4246
-b,--begintime The starting time for the calculations (default is 0)
4347
-s,--stoptime The ending time for the calculations (default is 5000)
4448
-z,--stepsize The step size for the calculations (default is 1)
45-
```
49+
```

bin/ePhotosynthesis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ int main(int argc, const char* argv[]) {
126126
theVars->TestATPCost = stoi(inputs.at("ATPCost"), nullptr);
127127
theVars->record = record;
128128
theVars->useC3 = useC3;
129-
theVars->RUBISCOMETHOD = 1;
129+
theVars->RUBISCOMETHOD = 2;
130130
modules::PR::setRUBISCOTOTAL(3);
131131
if (debugDelta)
132132
dbglvl += 8;

include/Variables.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,11 @@ class Variables {
106106
double Tp = 0;
107107
double alfa = 0.;
108108
double fc = 0.;
109+
double Phi_max = 0.;
109110
double lightParam = 0.;
110-
const double alpha1 = 1.205;
111-
const double alpha2 = 2.06;
111+
const double alpha1 = 0.87;
112+
const double alpha2 = 1.03;
113+
double sensitivity_sf = 1.0; //a scaling factor for enzymes
112114

113115
// Parameters
114116
arr PR_Param = zeros(2);

src/Condition.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "globals.hpp"
2929
#include <boost/algorithm/string_regex.hpp>
3030
#include <boost/regex.hpp>
31+
#include <sstream>
3132

3233
const boost::regex token("\\s+");
3334

src/drivers/EPS_Drive.cpp

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,16 @@
2424
*
2525
**********************************************************************************************************************************************/
2626

27+
#include <math.h>
2728
#include "Variables.hpp"
2829
#include "globals.hpp"
2930
#include "drivers/EPS_Driver.hpp"
3031
#include "modules/EPS.hpp"
3132
#include "modules/PS.hpp"
33+
//#include <iostream>
34+
//#include <fstream>
35+
36+
//using namespace std;
3237

3338
using namespace ePhotosynthesis;
3439
using namespace ePhotosynthesis::modules;
@@ -49,10 +54,13 @@ void EPSDriver::setup() {
4954
SYSInitial(inputVars);
5055
//time = tglobal;
5156
inputVars->Tp = this->Tp;
52-
inputVars->alfa = 0.85;
57+
inputVars->Phi_max = 0.63;
5358
PS::setJmax(inputVars->EnzymeAct.at("Jmax"));
54-
inputVars->fc = 0.15;
55-
PS::setTheta(0.7);
59+
inputVars->fc = 0.2;
60+
61+
double Tp = inputVars->Tp;
62+
double Theta = 0.76 + 0.01713 * Tp - 3.75 * pow(Tp,2.0) / 10000.0;//Yufeng: match Farquhar Matlab
63+
PS::setTheta(Theta);
5664
PS::setbeta(0.7519);
5765
inputVars->BF_FI_com = true;
5866
inputVars->EnzymeAct.at("V1") *= inputVars->alpha1;
@@ -67,6 +75,11 @@ void EPSDriver::setup() {
6775
inputVars->EnzymeAct.at("V13") *= inputVars->alpha2;
6876
inputVars->EnzymeAct.at("V23") *= inputVars->alpha2;
6977

78+
//we scale up some enzymes
79+
inputVars->EnzymeAct.at("V2") *= inputVars->sensitivity_sf;
80+
inputVars->EnzymeAct.at("V13") *= inputVars->sensitivity_sf;
81+
//
82+
7083
inputVars->PR_PS_com = true; // This is a variable indicating whether the PR model is actually need to be combined with PS or not. If 1 then means combined; 0 means not.
7184

7285

@@ -110,10 +123,17 @@ void EPSDriver::setup() {
110123
void EPSDriver::getResults() {
111124
EPSCondition* eps_int_con = new EPSCondition(intermediateRes);
112125
arr temp = EPS::MB(time, eps_int_con, inputVars);
113-
results = zeros(1);
126+
results = zeros(3);
114127
const double Arate = (inputVars->PS_Vel.v1 - inputVars->PR_Vel.v131) * inputVars->AVR;
115128
delete eps_int_con;
129+
130+
// ofstream myfile;
131+
// myfile.open ("hello.txt");
132+
// myfile << "Writing this to a file.\n";
133+
// myfile.close();
116134
results[0] = Arate;
135+
results[1] = inputVars->PS_Vel.v1 * inputVars->AVR; //carboxylation
136+
results[2] = inputVars->PR_Vel.v131 * inputVars->AVR; //photorespiration
117137
}
118138

119139
EPSCondition* EPSDriver::EPS_Init() {

src/ini/BF_Ini.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ BFCondition* BF::_init(Variables *theVars) {
6565
// CPSi=1.0131;% 1.0237 WY201803
6666
// cNADPHsyn=1.094468408;%1.0388 WY201803
6767
if (theVars->lightParam == 0.) {
68-
const double light_scaler = theVars->alfa * (1. - theVars->fc);
68+
const double light_scaler = theVars->Phi_max * (1. - theVars->fc);
6969
theVars->lightParam = theVars->TestLi * 30. * light_scaler;
7070
}
7171

src/ini/FI_Ini.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ FICondition* FI::_init(Variables *theVars) {
5353
if (theVars->useC3) {
5454
FI::cpsii = 1.;
5555
if (theVars->lightParam == 0.) {
56-
const double light_scaler = theVars->alfa * (1 - theVars->fc);
57-
theVars->lightParam = theVars->TestLi * 30 * light_scaler;
56+
const double light_scaler = theVars->Phi_max * (1. - theVars->fc);
57+
theVars->lightParam = theVars->TestLi * 30. * light_scaler;
5858
}
5959
theVars->FI_RC.kA_d = theVars->EnzymeAct.at("kA_d"); // The rate constant of heat dissipation from peripheral antenna Lazar (1999), 0.25~1 *10^(9)
6060
theVars->FI_RC.kA_f = theVars->EnzymeAct.at("kA_f"); // The rate constant of fluorescence emission from peripheral antenna Lazar 1999, with a lifetime of 5 ns at closed reaction center

src/ini/PS_Ini.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@
2727
#include "Variables.hpp"
2828
#include "modules/PS.hpp"
2929

30-
#define R 8.314
31-
#define c_c 38.28
32-
#define dHa_c 80.99
33-
#define c_o 14.68
34-
#define dHa_o 23.72
30+
//Yufeng: I changed these constants to match BioCro's
31+
#define R 8.314E-3 //KJ mole-1 K-1
32+
#define c_c 38.05
33+
#define dHa_c 79.43
34+
#define c_o 20.30
35+
#define dHa_o 36.38
3536
#define RegFactor 1.
3637

3738
using namespace ePhotosynthesis;
@@ -223,7 +224,7 @@ PSCondition* PS::_init(Variables *theVars) {
223224
PS_con->PenP = 0.25;
224225

225226
if (theVars->useC3) {
226-
PS::PS_C_CP = 22.; // Global constant for the total phosphate
227+
PS::PS_C_CP = 30.; // Global constant for the total phosphate
227228
PS::PS_C_CA = 1.5; // Global constant for the total adenylates
228229
PS::PS_C_CN = 1.; // Global constant for the cytosolic Phosphate concentration;
229230
if (theVars->GRNC == 1 && theVars->CO2_cond > 0) {
@@ -248,8 +249,10 @@ PSCondition* PS::_init(Variables *theVars) {
248249

249250
//PsKM11_0 = ;
250251
//PsKM12_0 = ; // O2 1 RuBP+CO2->2PGA 0.28 DEFAUL.
251-
PS::KM11 = 0.0097 * exp(c_c - dHa_c * 1000. / (R * (theVars->Tp + 273.15))) / 272.38;
252-
PS::KM12 = 0.244 * exp(c_o - dHa_o * 1000. / (R * (theVars->Tp + 273.15))) / 165.82;
252+
double kc_25 = exp(c_c - dHa_c / (R * (25.0 + 273.15)));
253+
double ko_25 = exp(c_o - dHa_o / (R * (25.0 + 273.15)));
254+
PS::KM11 = 0.0097 * exp(c_c - dHa_c / (R * (theVars->Tp + 273.15))) / kc_25;
255+
PS::KM12 = 0.244 * exp(c_o - dHa_o / (R * (theVars->Tp + 273.15))) / ko_25;
253256

254257
PS::KM13 = 0.02; // RuBP 1 RuBP+CO2->2PGA
255258
PS::KI11 = 0.84; // PGA
@@ -373,7 +376,7 @@ PSCondition* PS::_init(Variables *theVars) {
373376
PS::PsV10 = PS::PsV10_0 * pow(Q10_10, (theVars->Tp - 25.) / 10.);
374377
PS::PsV13= PS::PsV13_0 * pow(Q10_13, (theVars->Tp - 25.) / 10.);
375378
PS::PsV23 = PS::PsV23_0 * pow(Q10_23, (theVars->Tp - 25.) / 10.);
376-
PS::I2 = theVars->TestLi * theVars->alfa * (1. - theVars->fc) / 2.;
379+
PS::I2 = theVars->TestLi * theVars->Phi_max * (1. - theVars->fc) / 2.;
377380
PS::J = (I2 + PS::Jmax - sqrt(pow(I2 + PS::Jmax, 2.) - 4. * PS::Theta * I2 * PS::Jmax)) / (2. * PS::Theta);
378381

379382
} else {

src/rate/PR_Rate.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,11 @@ void PR::_Rate(const double t, const PRCondition* const PR_con, Variables *theVa
8080
theVars->PR_Vel.v111 = PrV111t * theVars->O2_cond / (theVars->O2_cond + PR::KO *
8181
(1. + theVars->CO2_cond / PR::KC));
8282

83-
if (RuBP < PR::RUBISCOTOTAL)
84-
theVars->PR_Vel.v111 = theVars->PR_Vel.v111 * RuBP / PR::RUBISCOTOTAL;
83+
// if (RuBP < PR::RUBISCOTOTAL)
84+
// theVars->PR_Vel.v111 = theVars->PR_Vel.v111 * RuBP / PR::RUBISCOTOTAL;
85+
if (RuBP < PS::getPsV1() / 2.) {
86+
theVars->PR_Vel.v111 = theVars->PR_Vel.v111 * RuBP / (PS::getPsV1()/ 2.);
87+
}
8588

8689
} else if (theVars->RUBISCOMETHOD == 1) {
8790
theVars->PR_Vel.v111 = PrV111 * theVars->O2_cond / (theVars->O2_cond + PR::KO *

0 commit comments

Comments
 (0)