Skip to content
Snippets Groups Projects
Commit de93a853 authored by Marco Matthies's avatar Marco Matthies
Browse files

Fix ALMaSS.growcrop! to use daily growing-degree days and not total gdd

parent c0d891c1
No related branches found
No related tags found
No related merge requests found
...@@ -201,10 +201,10 @@ function stepagent!(cs::CropState, model::SimulationModel) ...@@ -201,10 +201,10 @@ function stepagent!(cs::CropState, model::SimulationModel)
# (https://www.eea.europa.eu/publications/europes-changing-climate-hazards-1/heat-and-cold/heat-and-cold-2014-mean) # (https://www.eea.europa.eu/publications/europes-changing-climate-hazards-1/heat-and-cold/heat-and-cold-2014-mean)
basetemp = cs.croptype.mingrowthtemp basetemp = cs.croptype.mingrowthtemp
ismissing(basetemp) && (basetemp = 5.0) ismissing(basetemp) && (basetemp = 5.0)
gdd = (maxtemp(model)+mintemp(model))/2 - basetemp delta_gdd = bounds((maxtemp(model) + mintemp(model)) / 2 - basetemp)
gdd > 0 && (cs.growingdegreedays += gdd) cs.growingdegreedays += delta_gdd
# update crop growth # update crop growth
growcrop!(cs, gdd, model) growcrop!(cs, delta_gdd, model)
end end
...@@ -248,14 +248,18 @@ end ...@@ -248,14 +248,18 @@ end
#TODO till!() #TODO till!()
""" """
growcrop!(cropstate, gdd, model) growcrop!(cropstate, delta_gdd, model)
Apply the relevant crop growth model to update the plants crop state Update the crop state on this farm plot for a given daily change in
on this farm plot. Implements the ALMaSS crop growth model by Topping growing-degree days `delta_gdd` (units of 'Kelvin Days').
et al. (see `ALMaSS/Landscape/plant.cpp:PlantGrowthData::FindDiff()` and
Implements the ALMaSS crop growth model by Topping et al. (see
`ALMaSS/Landscape/plant.cpp:PlantGrowthData::FindDiff()` and
`ALMaSS/Landscape/elements.cpp:VegElement::DoDevelopment()`). `ALMaSS/Landscape/elements.cpp:VegElement::DoDevelopment()`).
""" """
function growcrop!(cs::CropState, gdd::Float64, model::SimulationModel) function growcrop!(cs::CropState, delta_gdd::Real, model::SimulationModel)
total_gdd = cs.growingdegreedays
# TODO: logic the wrong way around for fertiliser?
fertiliser in cs.events ? fertiliser in cs.events ?
curve = cs.croptype.lownutrientgrowth : curve = cs.croptype.lownutrientgrowth :
curve = cs.croptype.highnutrientgrowth curve = cs.croptype.highnutrientgrowth
...@@ -270,17 +274,11 @@ function growcrop!(cs::CropState, gdd::Float64, model::SimulationModel) ...@@ -270,17 +274,11 @@ function growcrop!(cs::CropState, gdd::Float64, model::SimulationModel)
cs.LAIgreen = curve.LAIgreen[cs.phase][p] cs.LAIgreen = curve.LAIgreen[cs.phase][p]
return return
else else
gdd = cs.growingdegreedays
# figure out which is the correct slope value to use for growth # figure out which is the correct slope value to use for growth
if p == length(points) || gdd < points[p+1] if p == length(points) || total_gdd < points[p+1]
#FIXME it appears to me from the ALMaSS source code that the curve value cs.height += curve.height[cs.phase][p] * delta_gdd
# for the day is multiplied with that day's growingdegreedays to give the cs.LAItotal += curve.LAItotal[cs.phase][p] * delta_gdd
# diff, which is then added to the previous values. However, this results cs.LAIgreen += curve.LAIgreen[cs.phase][p] * delta_gdd
# in values that are staggeringly too large. I'm not quite sure what the
# issue is here...
cs.height += bounds(curve.height[cs.phase][p]*gdd)
cs.LAItotal += bounds(curve.LAItotal[cs.phase][p]*gdd)
cs.LAIgreen += bounds(curve.LAIgreen[cs.phase][p]*gdd)
return return
end end
#XXX To be precise, we ought to figure out if one or more inflection #XXX To be precise, we ought to figure out if one or more inflection
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment