From d4c7fbf29049e68f76163bc3c2611d226cff0fa0 Mon Sep 17 00:00:00 2001 From: Steven Wu Date: Wed, 25 Dec 2019 16:12:29 -0800 Subject: [PATCH] Cap windchill heat from vapor pressure to 50C The model we use to approximate windchill seems to have degenerate behavior at high "dry-bulb" temperatures; this manifests most obviously by generating apparent temperatures in the millions of celsius for input temperatures of ~1000C. Since most of this runaway extra temperature is from the vapor pressure term, and since it seems unreasonable that a given 1000C fire would actually have vapor pressure of 10MPa in its vicinity, we cap that vapor pressure-induced extra temperature to only 100C. --- src/weather.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/weather.cpp b/src/weather.cpp index 3ff7296a31b88..74e8751d42d85 100644 --- a/src/weather.cpp +++ b/src/weather.cpp @@ -715,8 +715,14 @@ int get_local_windchill( double temperature, double humidity, double windpower ) tmpwind = tmpwind * 0.44704; tmptemp = temp_to_celsius( tmptemp ); - windchill = 0.33 * ( humidity / 100.00 * 6.105 * exp( 17.27 * tmptemp / - ( 237.70 + tmptemp ) ) ) - 0.70 * tmpwind - 4.00; + // Cap the vapor pressure term to 50C of extra heat, as this term + // otherwise grows logistically to an asymptotic value of about 2e7 + // for large values of temperature. This is presumably due to the + // model being designed for reasonable ambient temperature values, + // rather than extremely high ones. + windchill = 0.33 * std::min( 150.00, humidity / 100.00 * 6.105 * + exp( 17.27 * tmptemp / ( 237.70 + tmptemp ) ) ) - 0.70 * + tmpwind - 4.00; // Convert to Fahrenheit, but omit the '+ 32' because we are only dealing with a piece of the felt air temperature equation. windchill = windchill * 9 / 5; }