Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fire creates unreasonably high temperatures #36449

Closed
swwu opened this issue Dec 25, 2019 · 3 comments · Fixed by #36450
Closed

Fire creates unreasonably high temperatures #36449

swwu opened this issue Dec 25, 2019 · 3 comments · Fixed by #36450

Comments

@swwu
Copy link
Contributor

swwu commented Dec 25, 2019

Describe the bug

As currently implemented, fire appears to create unreasonably high values of "windchill", and therefore of temp_conv, and therefore of body temperature. This means standing next to (or in) fires causes your body temperature to increase up to the 2e7-5e7 range, which, using the conversion of 0.02C = 10u found in weather.h, equates to a temperature range of 40000C-100000C.

Incidentally, there are no real direct effects of being at 100000C other than blisters. The main problem is how long it takes to cool down; you might retain the Scorching effect for hours or even days, which slowly eats away your HP/stamina, generates pain, and eventually kills you.

This usually doesn't matter in gameplay—since players will generally first die from other fire-related issues, like being on fire, when standing in or near many large fires—but occasionally shows up in strange edge cases (see e.g. #32861 , which appears to be a manifestation of this same issue). The issue is most reproducible with the Thermal Dissipation CBM installed, since that negates most of the negative field effects of fires but not the high temperature itself.

My best guess for why this happens is:

  1. the windchill model we use in Weather::get_local_windchill is designed for normal ambient temperatures, rather than the 600-1000C you might expect to find inside an active fire. Indeed, plugging an input value of 1000C (with 50%RH and 0 windspeed) into the equation causes it to return a result of over a million (as in, the projected apparent temperature is over 1000000C). 1000C is, of course, fairly high, but is also a very possible value for player_local_temp when standing in or among fires due to reason 2.
  2. the thermal radiation approximation in Game::get_heat_radiation scales inverse-linearly with manhattan distance rather than inverse-quadratically with euclidean distance. This means it (often significantly) overestimates the heat transferred by radiation from nearby fires. E.g. a fire three tiles up from the player would only divide heat by 3, rather than by 9.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Make a player with the Thermal Dissipation CBM installed, and enough power to run it for a few minutes.
  2. Set a bunch of tiles on fire. This is most easily done by spraying down the area with a flamethrower on "automatic".
  3. Turn on your Thermal Dissipation and stand in a fire. Alternatively, just stand next to some fire(s).
  4. Wait until bodytemp is scorching. Then wait a few minutes more.
  5. Check temp_cur/temp_conv/whatever. You can use gdb or add a println. You can also save, and just look at the values in your savegame JSON. There's probably also some debug-menu way to look at your temperature that I don't know about.
  6. Note that the bodytemp (and temp_conv) appear to be unreasonably high.
  7. Get out of the fire, and note that you retain the Scorching! condition, sometimes for hours. Turning off Thermal Dissipation at this time can be done with no ill effects other than allowing blisters, although you continue to be Scorching!.

Expected behavior

Fires shouldn't be able to heat the player to >1e7u (>20000C) of temperature; that's more than three times as hot as the surface of the sun. Most real-life fires are in the 600C-1000C range at hottest.

Possibly the best thing to do here is to "cap" the extra apparent temperature that Weather::get_local_windchill produces; the runaway term that's responsible for the lion's share of the unreasonably-largeness in the windchill model we use is the exp(17*T/(237+T))one, which represents vapor pressure, and it's very clear that most normal fires don't produce 1e7Pa of extra water vapor pressure (that's about 100 atmospheres) in their vicinity anyways. Capping that term to, say, 100C would make fire heat a lot less unreasonable.

If desirable, I can throw together a PR that addresses the issue in this way.

Screenshots

Here's a screenshot of standing in some fires with Thermal Dissipation on. I "modded" the game here to print radiative temperature, convective temperature, and current body temperature of the torso on every turn, which you can read off the message log. Note that player_local_temp is the sum of radiative and convective temperature.
Screen Shot 2019-12-25 at 3 53 41 PM

Versions and configuration

  • OS: MacOs
    • OS Version: Name: Mac OS X; Version: 10.15.2; Build: 19C57;
  • Game Version: 0.D-10692-gb7329f6ab7 [64-bit]
  • Graphics Version: Tiles
  • Mods loaded: [
    Dark Days Ahead [dda],
    Disable NPC Needs [no_npc_food]
    ]

Additional context

@swwu
Copy link
Contributor Author

swwu commented Dec 26, 2019

(Opened a PR with fix here #36450 )

@Cool3303
Copy link

Cool3303 commented Dec 26, 2019

(all information from the same source you used, you can also read the document paper given as source)
First of all, the windchill Formula used is the "Australian apparent temperature", which unlike other Windchill formulas, also includes a calculation for the Heat index. (I would suggest fixing the name)

The actual Windchill effect only applies below ~25°C. Above that high humidity hinders sweat evaporation so that air actually starts feeling hotter, not colder.

This is measured by the heat index, which only applies until felt! temperatures of at best 50°C. (That means 50°C with 0% air humidity only)

A bigger question would be why the Windchill formula is included at all.
It does not convey an accurate representation of the underlying process and makes a lot of assumptions, like the amount of clothes worn, light movement (1.5m/s) and full sunshine.

A standard heat exchange formula would fare much better and could use clothing coverage to reduce thermal conductivity accordingly.

@swwu
Copy link
Contributor Author

swwu commented Dec 26, 2019

@Cool3303 Yeah, there are some things subtly wrong with using windchill here. Most notably, if it's, say, 10C out, but extremely windy, it's actually possible in-game for body temperature to fall below 10C, which is impossible in the real world (otherwise you'd be able to freeze water just by aiming enough fans at it instead of having to use complicated compressor/condensor setups).

For this specific issue, though, I'd like to avoid getting into those weeds, since changing them would require touching several larger systems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants