This repository has been archived by the owner on Dec 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Atmosphere.hpp
140 lines (119 loc) · 4.07 KB
/
Atmosphere.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
//The MIT License (MIT)
//
//Copyright (c) <2012>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify,
// merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// =====================
// Author:
// Daniel Williams
//
#ifndef __ATMOSPHERE_HPP__
#define __ATMOSPHERE_HPP__
#include "common.hpp"
// ====== ======= // ====== ======= Atmosphere.hpp // ====== =======// ====== =======
namespace MeshGen{
class Atmosphere {
public:
enum climate_t {
CLIMATE_ARCTIC,
CLIMATE_ASTEROID,
CLIMATE_CUSTOM, // everything else
CLIMATE_DEFAULT,
CLIMATE_DESERT,
CLIMATE_JUNGLE, // == rainforest, monsoon
CLIMATE_SAVANNA,
CLIMATE_TEMPERATE,
CLIMATE_TEST,
CLIMATE_TUNDRA, // == alpine, steppe, steppe
CLIMATE_WATERWORLD
};
climate_t climate_here;
// altitude terrain is built from:
// minimum altitude of terrain.
// n.b.: 0: sea level
// <0: underwater
// near 0: shoreline
// units: m
float altitude_m;
float height_scale_m;
// density at sea level
// units: kg/m^3
// 1.2 kg/m3 = 0.0012 g/cc (at standard temperature and pressure (@STP))
static const float density_air_standard_kgm3;
float density_kgm3;
// how much water (or other fluid evaporates)
// units: m/yr
float evaporation_myr;
// acceleration due to gravity
// units:m/s^2
// == 1g == earth standard gravity
static const float gravity_earth_standard_mss;
float gravity_mss;
// mean yearly precipitation
// 1200 mm/year is roughly average for temperate climes
// units: m/year
float precipitation_myr;
// a measure of how much the rain is spread out...
// 1 is all at once (flash flood)
// 0 is completely spread out.
float precip_distribution;
// derived.
// units: 1 Pa = 1 kg/m/s^2
// 1 atm = 101.325 kPa (at standard temperature and pressure (@STP))
// == earth standard pressure at sea level
static const float pressure_earth_standard_pa;
float pressure_pa;
// constant
// units: J/(kg degK)
static const float specific_gas_constant_air;
// mean yearly temperature
// units: degrees Celsius
float temperature_C;
// 0 deg Celsius = 273.15 deg Kelvin
static const float temperature_zero_C_K;
//float temperature_variance_dc;
float windflow_m3s;
// ====== ======= Calculate Methods: // ====== =======
public:
Atmosphere();
~Atmosphere();
// out units: meters / year
float calculate_evaporation_myr(float pressure, float temperature, float airflow, float humidity);
// out units: Pa
float calculate_pressure_pa(float rho, float temp );
// ====== ======= Get Methods // ====== =======
static const char* get_climate_t_names(climate_t clim_type);
climate_t get_climate(){return climate_here;}
// ====== ======= Set Methods // ====== =======
void set(climate_t clim);
void setArcticClimate();
void setAsteroidClimate();
void setDefaultClimate();
void setDesertClimate();
void setCustomClimate();
void setJungleClimate();
void setSavannaClimate();
void setTemperateClimate();
void setTestClimate();
void setTundraClimate();
void setWaterworldClimate();
void printAtmosphericParameters();
}; // class
} // namespace
#endif // #ifndef __ATMOSPHERE_HPP__