commit c943484f84b61a4ae4b46bace2b9601548cef718
parent fc07ff8fe5671eec8b769d2adbab6523e02a0fc8
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Tue, 17 Mar 2020 17:52:13 +0100
Fix the Planck function invocation for null temperatures
Diffstat:
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/htrdr_c.h b/src/htrdr_c.h
@@ -157,7 +157,7 @@ planck
const double T2 = temperature*temperature;
const double T4 = T2*T2;
const double BOLTZMANN_CONSTANT = 5.6696e-8; /* W/m^2/K^4 */
- ASSERT(lambda_min < lambda_max && temperature >= 0);
+ ASSERT(lambda_min < lambda_max && temperature > 0);
return blackbody_fraction(lambda_min, lambda_max, temperature)
* BOLTZMANN_CONSTANT * T4;
}
diff --git a/src/htrdr_compute_radiance_lw.c b/src/htrdr_compute_radiance_lw.c
@@ -265,7 +265,11 @@ htrdr_compute_radiance_lw
* have this data yet, we use the temperature of the sky at the current
* position as the temperature of the surface. */
temperature = htsky_fetch_temperature(htrdr->sky, pos_next);
- w = planck(band_bounds_m[0], band_bounds_m[1], temperature);
+ if(temperature <= 0) {
+ w = 0;
+ } else {
+ w = planck(band_bounds_m[0], band_bounds_m[1], temperature);
+ }
break;
}