WSL/SLF GitLab Repository

Commit 8e1a9c0f authored by Mathias Bavay's avatar Mathias Bavay
Browse files

When introducing TAU_CLD, a nasty bug found its way into the ALLSKY_LW...

When introducing TAU_CLD, a nasty bug found its way into the ALLSKY_LW generator that lead to always compute a perfectly clear sky... 
parent bcbfdcfe
......@@ -420,9 +420,9 @@ bool AllSkyLWGenerator::generate(const size_t& param, MeteoData& md)
{
double &value = md(param);
if (value==IOUtils::nodata) {
const double TA=md(MeteoData::TA), RH=md(MeteoData::RH);
const double TA=md(MeteoData::TA), RH=md(MeteoData::RH), TAU_CLD=md(MeteoData::TAU_CLD);
if (TA==IOUtils::nodata || RH==IOUtils::nodata) return false;
double cloudiness = (md.param_exists("TAU_CLD"))? Atmosphere::Kasten_cloudiness( 1.-md("TAU_CLD") ) : IOUtils::nodata;
double cloudiness = (TAU_CLD!=IOUtils::nodata)? Atmosphere::Kasten_cloudiness( 1.-TAU_CLD ) : IOUtils::nodata;
const string station_hash = md.meta.stationID + ":" + md.meta.stationName;
const double julian_gmt = md.date.getJulian(true);
......
......@@ -110,7 +110,7 @@ double Atmosphere::wetBulbTemperature(const double& T, const double& RH, const d
/**
* @brief Black Globe Temperature.
* This is an estimation of the black globe temperature based on physical modeling as in
* V. E. Dimiceli, S. F. Piltz and S. A. Amburn, <i>"Estimation of Black Globe Temperature for Calculation of the Wet Bulb Globe Temperature Index"</i> in World Congress on Engineering and Computer Science, <b>2</b>, 2011.
* V. E. Dimiceli, S. F. Piltz and S. A. Amburn, <i>"Estimation of Black Globe Temperature for Calculation of the Wet Bulb Globe Temperature Index"</i> in World Congress on Engineering and Computer Science, <b>2</b>, 2011.
* @param TA air temperature (K)
* @param RH relative humidity (between 0 and 1)
* @param VW wind velocity (m/s)
......@@ -122,13 +122,13 @@ double Atmosphere::wetBulbTemperature(const double& T, const double& RH, const d
double Atmosphere::blackGlobeTemperature(const double& TA, const double& RH, const double& VW, const double& iswr_dir, const double& iswr_diff, const double& cos_Z)
{
const double a=1, b=1, c=1; //HACK: get real values!
const double S = iswr_dir + iswr_diff;
const double h = a * pow(S, b) * pow(cos_Z, c);
const double emissivity = 0.575 * pow(RH*waterSaturationPressure(TA), 1./7.);
const double B = S * (iswr_dir/(4.*Cst::stefan_boltzmann*cos_Z) + 1.2/Cst::stefan_boltzmann*iswr_diff) + emissivity*Optim::pow4(TA);
const double C = h * pow(VW, 0.58) / 5.3865e-8;
const double Tg = (B + C*TA + 7680000) / (C + 256000);
return Tg;
}
......@@ -226,7 +226,7 @@ double Atmosphere::WBGT_index(const double& TA, const double& RH, const double&
const double NWB = wetBulbTemperature(TA, RH, altitude);
const double GT = blackGlobeTemperature(TA, RH, VW, iswr_dir, iswr_diff, cos_Z);
const double DB = TA;
return 0.7*NWB + 0.2*GT + 0.1*DB;
}
......
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