trenchproject/TrenchR

Function checking

Closed this issue · 7 comments

ys634 commented

Free_or_forced_convection (energybalance):
the return on intermediate condition has grammar error. (the original text just says "for intermediate values, the larger number of Nu should be used.")

Qnet_Gates (OperativeTemperature):
should the Qcond and Qconv be added and not subtracted based on the description?

Tsoil (energybalance):
Is it correct that this function is in energybalance functions and not in Tsoil functions?
Doesn't make sense that the soil temp is colder during the day. The question marks (???) after depth.

(TempWindProfile)
wind_speed_profile and wind_speed_profile_neutral are exactly the same equation.

ys634 commented

soil_conductivity (Tsoil functions)
Doesn't seem that the equations are correct. Need to check with the original reference, which is a book that's not available on google books.

soil_temperature_function & soil_temperature (Tsoil functions)
Is the return supposed to be an array? If this is correct, maybe mention that the return is an array.

Tb_gates (operative temperature functions)
For the code below that produces error,
Te <- tryCatch(uniroot(Qfn, ... {print("Unable to balance energy budget. One issue to check is whether absorbed solar radiation exceeds energy potentially lost to thermal radiation, convection, and conduction.")})

This error might get cumbersome when running a huge file. When running the code on the manuscript for example, there were thousands of these popping up since the data size was 17000.

Changes implemented or functions checked

Check Tb_Fei

ys634 commented

Looked over Tb_Fei and Fei 2011 paper.

As a premise, it seems that the model on the paper only calculates the change in body temperature of lizards given the initial body temperature. If that's what we want the function to do, it would work, but we would have to make it clear in the description and change the input parameters.
Right now in the code, T_o is set to be equal to T_a, which creates issues on calculations for convective heat and radiation.

The issue is that right now the equation to solve for Tb has a combination of Tb^4 and exponent of Tb, and thus Tb is not solvable.
If we want the function to calculate operative temperature, Q_meta probably needs to be expressed differently (right now, Tb is in the exponent), and Taylor series approximation on Q_longwave is necessary, which are not done on the paper.

I reverted the function to iterate to calculate steady state temperature. It starts with To=Ta but they iterates 50 times until it hopefully reaches equilibrium. Can look at Tb equation, but function seems OK for now. Not sure about different estimates of metabolism.

ys634 commented

Ok. Out of curiosity, is there a valid reason for dt = 120 or is it arbitrary?
Maybe better to make it a parameter users can input?

Discusses keeping dt as fixed since it doesn't influence equilibrium temperature