If the canopy height (passed from vegp$hgt) is set to pretty low, spinup() sometimes breaks. I've figured out why for when canopy height == 0: in this case, the vector of canopy nodes ends up being a series of zeros (see this line and the next few), which results in the same height for several nodes....this means the derivative of z will be 0, and end up dividing by zero when taking the d(t) / d(z) in diabatic_cor_can() (see this line in microctools).
But also sometimes if the canopy height is less than a meter, spinup will still break- perhaps because the nodes are too close together? I haven't isolated the problem here. Admittedly I'm not quite sure of the best approach to address this, so I haven't made any proposed changes.
A similar situation occurs if the reqhgt is set negative. At least one reason why this is occurring: the vector of z (height nodes) is handed to windcanopy in runonestep (this line here), and reqhgt is one of the nodes in zo. If reqhgt is negative, it's trying to calculate the wind speed underground.
Happy to discuss when we chat later this week if it would help.
Which operating system are you running?
Windows 10 64
Which version of R are you using?
3.6.1
What is the problem?
If the canopy height (passed from vegp$hgt) is set to pretty low, spinup() sometimes breaks. I've figured out why for when canopy height == 0: in this case, the vector of canopy nodes ends up being a series of zeros (see this line and the next few), which results in the same height for several nodes....this means the derivative of z will be 0, and end up dividing by zero when taking the d(t) / d(z) in diabatic_cor_can() (see this line in microctools).
But also sometimes if the canopy height is less than a meter, spinup will still break- perhaps because the nodes are too close together? I haven't isolated the problem here. Admittedly I'm not quite sure of the best approach to address this, so I haven't made any proposed changes.
A similar situation occurs if the reqhgt is set negative. At least one reason why this is occurring: the vector of z (height nodes) is handed to windcanopy in runonestep (this line here), and reqhgt is one of the nodes in zo. If reqhgt is negative, it's trying to calculate the wind speed underground.
Happy to discuss when we chat later this week if it would help.