-
-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
atmos touchups: thermodynamics enforcement week (#6790)
- Loading branch information
Showing
89 changed files
with
1,666 additions
and
1,308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
//* Heat Capacity Entity Definitions *// | ||
//* These are all in J / K. *// | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
//* Thermodynamics - Constants *// | ||
|
||
/** | ||
* Constant used as absolute zero. | ||
* | ||
* * Why the hell is this conflicting with COSMIC_RADIATION_TEMPERATURE? | ||
* * This is basically the absolute zero of simulation. Gas cannot / should not get colder than this, ever. | ||
* * This is -270.3C. | ||
* * Please get this a better name. | ||
*/ | ||
#define TCMB 2.7 | ||
/** | ||
* * Constant used for calculating blackbody radiation emittance. | ||
* * Unit is W / (m^2 * K^4) | ||
*/ | ||
#define STEFAN_BOLTZMANN_CONSTANT 5.6704e-8 | ||
/** | ||
* Temperature of cosmic microwave background radiation used for radiative space cooling. | ||
* | ||
* * This is above TCMB. Why? | ||
*/ | ||
#define COSMIC_RADIATION_TEMPERATURE 3.15 | ||
|
||
//* Thermodynamics - Radiation *// | ||
|
||
// todo: all of these below are semi-confusing. is there a better way? | ||
|
||
/** | ||
* * kPa at 20C | ||
* * This should realistically be higher as gases aren't great conductors until they are dense. | ||
* * Uses the critical pressure for air. | ||
*/ | ||
#define THERMODYNAMICS_OPTIMAL_RADIATOR_PRESSURE 3771 | ||
/** | ||
* The critical point temperature for air. | ||
* | ||
* * This is where standard airmix's liquid / gas / supercritical phases meet. | ||
*/ | ||
#define THERMODYANMICS_CRITICAL_TEMPERATURE_OF_AIR 132.65 | ||
|
||
/** | ||
* Ratio of surface area exposed to theroetical star for radiative heating while in space. | ||
* | ||
* todo: wouldn't it be funny if this was based on overmap entity :drooling: | ||
*/ | ||
#define THERMODYNAMICS_THEORETICAL_STAR_EXPOSURE_RATIO (1 / 4) | ||
/** | ||
* W / m^2 energy hitting external surfaces from a theoretical star. | ||
* | ||
* todo: wouldn't it be funny if this was based on overmap entity :drooling: | ||
*/ | ||
#define THERMODYNAMICS_THEORETICAL_STAR_EXPOSED_POWER_DENSITY 200 | ||
|
||
/// m^2, surface area of 1.7m (H) x 0.46m (D) cylinder | ||
#define THERMODYNAMICS_HUMAN_EXPOSED_SURFACE_AREA 5.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,34 @@ | ||
//* Physics Constants *// | ||
|
||
/// in Kelvin, temperature of cosmic microwave background radiation (used for radiative space cooling) | ||
#define COSMIC_RADIATION_TEMPERATURE 3.15 | ||
/// kPa*L/(K*mol). | ||
#define R_IDEAL_GAS_EQUATION 8.31 | ||
/// W/(m^2*K^4). | ||
#define STEFAN_BOLTZMANN_CONSTANT 5.6704e-8 | ||
|
||
//* Simulation Constants *// | ||
|
||
/// Volume, in liters, of a single tile. Y'KNOW WHY THIS IS A CONSTANT? WELL FOR ONE, initial_gas_mix IS MOLES, NOT PERCENTAGES OR PRESSURES. IF YOU TOUCH THIS, YOU BREAK *EVERYTHING*. DON'T TOUCH THIS. | ||
/// Exceptions can be made if you're a big boy who knows how this clusterfuck of a ZAS/LINDA hybrid works and have good reason to touch this. | ||
#define CELL_VOLUME 2500 | ||
/// Moles in a 2.5 m^3 cell at 101.325 kPa and 20 C. | ||
#define CELL_MOLES (ONE_ATMOSPHERE*CELL_VOLUME/(T20C*R_IDEAL_GAS_EQUATION)) | ||
|
||
//* Gas Constants *// | ||
|
||
/// kPa*L/(K*mol). | ||
#define R_IDEAL_GAS_EQUATION 8.31 | ||
|
||
//* Math Helpers - Pressures *// | ||
|
||
/// 1atm of earth-standard pressure, in kPa | ||
#define ONE_ATMOSPHERE 101.325 | ||
|
||
//* Math Helpers - Temperatures *// | ||
|
||
// todo: T_0C? | ||
|
||
/** | ||
* -60C in Kelvin | ||
* | ||
* * Please get this a better name. T_NEG_60C? | ||
*/ | ||
#define TN60C 213.15 | ||
/// 0 deg C, in Kelvin | ||
#define T0C 273.15 | ||
/// 20 deg C, in Kelvin | ||
#define T20C 293.15 | ||
/// 100 deg C, in Kelvin | ||
#define T100C 373.15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,26 @@ | ||
//! helpers for if we end up doing auxmos | ||
|
||
#define GAS_MIXTURE_VOLUME(GM) (GM.volume * GM.group_multiplier) | ||
#define GAS_MIXTURE_VOLUME_SINGULAR(GM) (GM.volume) | ||
#define GAS_MIXTURE_PRESSURE(GM) (GM.return_pressure()) | ||
#define GAS_MIXTURE_TEMPERATURE(GM) (GM.temperature) | ||
#define GAS_MIXTURE_TOTAL_MOLES(GM) (GM.total_moles * GM.group_multiplier) | ||
#define GAS_MIXTURE_TOTAL_MOLES_SINGULAR(GM) (GM.total_moles) | ||
#define GAS_MIXTURE_HEAT_CAPACITY(GM) (GM.heat_capacity()) | ||
//* Helpers, so we're not up a creek if we ever decide to use something like auxmos. *// | ||
//* -- These are only necessary for things that aren't already proc-calls! -- *// | ||
|
||
//* group multiplier dependent *// | ||
|
||
/// Takes group_multiplier into account. | ||
#define XGM_VOLUME(GM) (GM.volume * GM.group_multiplier) | ||
/// Does not take group_multiplier into account. | ||
#define XGM_VOLUME_SINGULAR(GM) (GM.volume) | ||
/// Takes group_multiplier into account. | ||
#define XGM_TOTAL_MOLES(GM) (GM.total_moles * GM.group_multiplier) | ||
/// Does not take group_multiplier into account. | ||
#define XGM_TOTAL_MOLES_SINGULAR(GM) (GM.total_moles) | ||
/// Takes group_multiplier into account. | ||
/// | ||
/// * In Joules | ||
#define XGM_THERMAL_ENERGY(GM) (GM.heat_capacity() * GM.temperature) | ||
/// Does not take group_multiplier into account. | ||
/// | ||
/// * In Joules | ||
#define XGM_THERMAL_ENERGY_SINGULAR(GM) (GM.heat_capacity_singular() * GM.temperature) | ||
|
||
//* group multiplier independent *// | ||
|
||
#define XGM_TEMPERATURE(GM) (GM.temperature) | ||
#define XGM_PRESSURE(GM) ((GM.total_moles * R_IDEAL_GAS_EQUATION * GM.temperature) / GM.volume) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//* General Functions *// | ||
|
||
/// Atmospherics quantization define. | ||
#define XGM_QUANTIZE(variable) (round(variable,0.00001))/*I feel the need to document what happens here. Basically this is used to catch most rounding errors, however it's previous value made it so that | ||
once gases got hot enough, most procedures wouldnt occur due to the fact that the mole counts would get rounded away. Thus, we lowered it a few orders of magnititude */ | ||
/// floating points are satanic. | ||
/// | ||
/// checks if something is close enough to be equivalent. | ||
/// as of right now, this is within 0.01% of the bigger number. | ||
/// mostly only used in unit tests. | ||
#define XGM_MOSTLY_CLOSE_ENOUGH(A, B) (abs(A - B) <= (max(abs(A), abs(B)) * 0.0001)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.