Commit ed5875ed authored by Eric Duminil's avatar Eric Duminil
Browse files

DRY

parent 61a747b4
......@@ -101,14 +101,10 @@ public class TreeWaterDemand {
int dayOfYear = counter.getDayOfYear();
double hourOfDay = counter.getHour() + 0.5;
//TODO: DRY
double netRadiation = rn(temp, actualVaporPressure, incomingRadiation, height, dayOfYear, hourOfDay,
lz, lm);
double extraterrestrialRadiation = extraterrestrialRadiation(dayOfYear, hourOfDay, lz, lm);
double netLongwaveRadiation = rnl(temp, actualVaporPressure, incomingRadiation, height, dayOfYear, hourOfDay, lz, lm);
double et0 = et0(temp, actualVaporPressure, incomingRadiation, height, windSpeed, humidity, dayOfYear,
hourOfDay, lz, lm);
double extraterrestrialRadiation = extraterrestrialRadiation(dayOfYear, hourOfDay, lz, lm); // ra
double netLongwaveRadiation = rnl(temp, actualVaporPressure, incomingRadiation, height, extraterrestrialRadiation); // rnl
double netRadiation = rn(incomingRadiation, netLongwaveRadiation);
double et0 = et0(temp, actualVaporPressure, incomingRadiation, height, windSpeed, humidity, netRadiation);
double et0u = et0u(svf, advection, et0);
......@@ -163,9 +159,7 @@ public class TreeWaterDemand {
}
private static double et0(double temperature, double actualVaporPressure, double shortWaveRadiation, double height,
double windSpeed, double humidity, int dayOfYear, double hourOfDay, double lz, double lm) {
double netRadiation = rn(temperature, actualVaporPressure, shortWaveRadiation, height, dayOfYear, hourOfDay,
lz, lm);
double windSpeed, double humidity, double netRadiation) {
double gamma = gamma(height);
double saturationVaporPressure = saturationVaporPressure(temperature);
double delta = delta(temperature, saturationVaporPressure);
......@@ -197,21 +191,18 @@ public class TreeWaterDemand {
}
// unit is apparently [MJ / (m².h)]
private static double rn(double temperature, double actualVaporPressure, double shortWaveRadiation, double height,
int dayOfYear, double hourOfDay, double lz, double lm) {
private static double rn(double shortWaveRadiation, double rnl) {
// 1 - 0.23: albedo effect of grass
return (1 - 0.23) * shortWaveRadiation
- rnl(temperature, actualVaporPressure, shortWaveRadiation, height, dayOfYear, hourOfDay, lz, lm);
return (1 - 0.23) * shortWaveRadiation - rnl;
}
// unit is apparently [MJ / (m².h)]
private static double rnl(double temperature, double actualVaporPressure, double shortWaveRadiation, double height,
int dayOfYear, double hourOfDay, double lz, double lm) {
double extraterrestrialRadiation){
// divide by 24 for hourly
double sigma = 4.903E-9 / 24;
double rs = shortWaveRadiation;
double ra = extraterrestrialRadiation(dayOfYear, hourOfDay, lz, lm);
double rso = (0.75 + 2 * 10E-5 * height) * ra;
double rso = (0.75 + 2 * 10E-5 * height) * extraterrestrialRadiation;
double rsRsoQuotient = 0.5;
if (rso != 0) {
rsRsoQuotient = rs / rso;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment