UpdatePhenoStage <- function(share,clim,site,veg,rstep,CN_Mode){ share$GDDTot_alt = share$GDDTot #share$GDDTot_alt = share$DWaterGDDTot #share$GDDTot_alt = share$GDD_DWater_gt_thresholdTot #share$GDDTot_alt = share$GDD_SoilWater_gt_thresholdTot #share$PhenoStage distinguishes: #growth & maturity=1 from dormancy & senescence=0 if(share$PhenoStage==0) { #if senescent or dormant #if((share$GDDTot_alt<=veg$GDDFolEnd && share$PhenoStageYearStart==0) || # (share$GDDTot_alt>veg$GDDFolEnd && share$PhenoStageYearStart==1)) { #if((clim$doy[rstep]veg$SenescStart && share$PhenoStageYearStart==1)) { if((clim$doy[rstep]veg$GDDFolStart) || (clim$doy[rstep]>veg$SenescStart && share$GDDSenesc 1 (or 5) cm after drought during senescence #}else{ #change to PhenoStage=1: # if GDDTot >=veg$GDDFolStart # and either: current day < senesc doy AND PhenoStageYearStart = 0 # or: current day > senesc doy AND PhenoStageYearStart = 1 #print(paste("share$GDDTot_alt=",share$GDDTot_alt, " ; veg$GDDFolStart=",veg$GDDFolStart)) if((share$GDDTot_alt >=veg$GDDFolStart)){ #print("foo") #if(clim$doy[rstep]=veg$GDDFolStart && share$PhenoStageYearStart==0) || (share$GDDTot_alt= veg$SenescStart){ #if(clim$doy[rstep] >= veg$SenescStart || share$GDDTot_alt > veg$GDDFolEnd){ share$PhenoStage=0 } #} #end of second half of conditional for test of PFT==4 } } return(share) } PhenologyNew <- function(share,clim,veg,rstep,GrowthPhase) { # # Phenology calculations for the PnET ecosystem model. # #global veg site clim share rstep if ( GrowthPhase == 1) { #print("GrowthPhase=1") if (share$PhenoStage==1) { OldFolMass <- share$FolMass #GDDFolEff <- (share$GDDTot - veg$GDDFolStart) / (veg$GDDFolEnd - veg$GDDFolStart) #GDDFolEff <- max(0, min(1, GDDFolEff)) # if > 1, lower to 1 #delGDDFolEff <- GDDFolEff - share$OldGDDFolEff # change from previous value if(veg$GDDFolEnd