Skip to content

Commit

Permalink
updated (fixed) flag for optimal (maximum) growing season temperature…
Browse files Browse the repository at this point in the history
…s for WOFOST
  • Loading branch information
BramDr committed Nov 3, 2021
1 parent de9ec0e commit 53b5683
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
1 change: 1 addition & 0 deletions vic/plugins/crops/src/wofost_copy_library.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ copy_wofost_parameters(Parameters *from,
to->TempEffMax = from->TempEffMax;
to->TSumEmergence = from->TSumEmergence;
to->IdentifyAnthesis = from->IdentifyAnthesis;
to->MaxOptimumTemp = from->MaxOptimumTemp;
to->OptimumDaylength = from->OptimumDaylength;
to->CriticalDaylength = from->CriticalDaylength;
to->SatVernRequirement = from->SatVernRequirement;
Expand Down
1 change: 1 addition & 0 deletions vic/plugins/crops/src/wofost_init_library.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ initialize_wofost_parameters(Parameters *prm)
prm->TempEffMax = 0.;
prm->TSumEmergence = 0.;
prm->IdentifyAnthesis = 0;
prm->MaxOptimumTemp = 0;
prm->OptimumDaylength = 0.;
prm->CriticalDaylength = 0.;
prm->SatVernRequirement = 0.;
Expand Down
1 change: 1 addition & 0 deletions vic/plugins/wofost/include/wofost.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ typedef struct PARAMETERS {

/** Phenology **/
int IdentifyAnthesis;
float MaxOptimumTemp;
float OptimumDaylength;
float CriticalDaylength;
float SatVernRequirement;
Expand Down
9 changes: 1 addition & 8 deletions vic/plugins/wofost/src/Assim.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@ DailyTotalAssimilation(SimUnit *Grid)
float KDiffuse, EFF, Factor;
float Hour, SinB, PAR, PARDiffuse, PARDirect, AssimMax;
float DailyTotalAssimilation = 0.;
float tiny = 0.001;
float DayTempTmp;
float TempStressTmp;

KDiffuse = Afgen(Grid->crp->prm.KDiffuseTb, &(Grid->crp->st.Development));

Expand All @@ -112,12 +109,8 @@ DailyTotalAssimilation(SimUnit *Grid)
Grid->met->TempStress = Afgen(Grid->crp->prm.FactorAssimRateTemp,
&Grid->met->DayTemp);
if (plugin_options.WOFOST_PTEMP) {
DayTempTmp = Grid->met->DayTemp - tiny;
TempStressTmp = Afgen(Grid->crp->prm.FactorAssimRateTemp,
&DayTempTmp);

// Only adjust TempStress if temperature is above optimal (not below)
if(TempStressTmp > Grid->met->TempStress){
if(Grid->met->DayTemp > Grid->crp->prm.MaxOptimumTemp){
Grid->met->TempStress = 1;
}
}
Expand Down
12 changes: 12 additions & 0 deletions vic/plugins/wofost/src/Cropdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,18 @@ GetCropData(Plant *CROP,
CROP->prm.N_MaxLeaves = Table[19];
CROP->prm.P_MaxLeaves = Table[20];
CROP->prm.K_MaxLeaves = Table[21];

head = CROP->prm.FactorAssimRateTemp;
XValue = 0;
YValue = 0;
while (head) {
if(head->y >= YValue){
XValue = head->x;
YValue = head->y;
}
head = head->next;
}
CROP->prm.MaxOptimumTemp = XValue;

CROP->Emergence = 0;
CROP->TSumEmergence = 0.;
Expand Down

0 comments on commit 53b5683

Please sign in to comment.