Class: Atmospheris::Iso5878::AtmosphereProfile
- Inherits:
-
Atmospheris::Isa::Algorithms
- Object
- Atmospheris::Isa::Algorithms
- Atmospheris::Iso5878::AtmosphereProfile
- Defined in:
- lib/atmospheris/iso5878/atmosphere_profile.rb
Overview
Generalized ISA engine for ISO 5878 reference atmospheres.
Extends Isa::Algorithms (open/closed principle) by injecting custom temperature layer structures and latitude-dependent surface conditions. All barometric formula methods (pressure, density, etc.) are inherited and automatically use the custom configuration.
One AtmosphereProfile instance = one atmosphere model (e.g. "15 annual" or "60N winter warm regime").
Constant Summary collapse
- R_SPECIFIC =
287.05287
Constants inherited from Atmospheris::Isa::Algorithms
Atmospheris::Isa::Algorithms::TEMPERATURE_LAYERS
Instance Attribute Summary collapse
-
#model_layers ⇒ Object
readonly
Returns the value of attribute model_layers.
-
#surface_params ⇒ Object
readonly
Returns the value of attribute surface_params.
-
#surface_pressure ⇒ Object
readonly
Returns the value of attribute surface_pressure.
-
#surface_temperature ⇒ Object
readonly
Returns the value of attribute surface_temperature.
Attributes inherited from Atmospheris::Isa::Algorithms
#constants, #pi, #precision, #sqrt2
Instance Method Summary collapse
-
#initialize(surface_params:, surface_temperature:, surface_pressure:, layers:) ⇒ AtmosphereProfile
constructor
A new instance of AtmosphereProfile.
-
#pressure_from_geopotential(geopotential_alt) ⇒ Object
Override: pressure at altitude uses injected model_layers.
-
#temperature_at_layer_from_geopotential(geopotential_alt) ⇒ Object
Override: temperature lookup uses injected model_layers.
Methods inherited from Atmospheris::Isa::Algorithms
#air_number_density_from_geopotential, #air_particle_collision_frequency_from_geopotential, #air_particle_collision_frequency_from_temp, #density_from_geopotential, #dynamic_viscosity, #dynamic_viscosity_from_geopotential, #geometric_altitude_from_geopotential, #geopotential_altitude_from_geometric, #geopotential_altitude_from_pressure_mbar, #geopotential_altitude_from_pressure_mmhg, #gravity_at_geometric, #gravity_at_geopotential, #kelvin_to_celsius, #kinematic_viscosity, #kinematic_viscosity_from_geopotential, #mbar_to_mmhg, #mean_air_particle_speed_from_geopotential, #mean_air_particle_speed_from_temp, #mean_free_path_of_air_particles_from_geopotential, #mmhg_to_mbar, #p_p_n_from_geopotential, #pa_to_mbar, #pa_to_mmhg, #pressure_formula_beta_nonzero, #pressure_formula_beta_zero, #pressure_from_geopotential_mbar, #pressure_from_geopotential_mmhg, #pressure_scale_height_from_geopotential, #pressure_scale_height_from_temp, #rho_rho_n_from_geopotential, #root_rho_rho_n_from_geopotential, #set_precision, #specific_weight_from_geopotential, #speed_of_sound_from_geopotential, #speed_of_sound_from_temp, #temperature_at_layer_celcius, #thermal_conductivity_from_geopotential, #thermal_conductivity_from_temp
Constructor Details
#initialize(surface_params:, surface_temperature:, surface_pressure:, layers:) ⇒ AtmosphereProfile
Returns a new instance of AtmosphereProfile.
38 39 40 41 42 43 44 |
# File 'lib/atmospheris/iso5878/atmosphere_profile.rb', line 38 def initialize(surface_params:, surface_temperature:, surface_pressure:, layers:) @surface_params = surface_params @surface_temperature = surface_temperature.to_f @surface_pressure = surface_pressure.to_f @model_layers = layers set_precision(:normal) end |
Instance Attribute Details
#model_layers ⇒ Object (readonly)
Returns the value of attribute model_layers.
30 31 32 |
# File 'lib/atmospheris/iso5878/atmosphere_profile.rb', line 30 def model_layers @model_layers end |
#surface_params ⇒ Object (readonly)
Returns the value of attribute surface_params.
30 31 32 |
# File 'lib/atmospheris/iso5878/atmosphere_profile.rb', line 30 def surface_params @surface_params end |
#surface_pressure ⇒ Object (readonly)
Returns the value of attribute surface_pressure.
30 31 32 |
# File 'lib/atmospheris/iso5878/atmosphere_profile.rb', line 30 def surface_pressure @surface_pressure end |
#surface_temperature ⇒ Object (readonly)
Returns the value of attribute surface_temperature.
30 31 32 |
# File 'lib/atmospheris/iso5878/atmosphere_profile.rb', line 30 def surface_temperature @surface_temperature end |
Instance Method Details
#pressure_from_geopotential(geopotential_alt) ⇒ Object
Override: pressure at altitude uses injected model_layers.
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/atmospheris/iso5878/atmosphere_profile.rb', line 135 def pressure_from_geopotential(geopotential_alt) i = locate_lower_layer(geopotential_alt) layer = model_layers[i] beta = layer[:B] || 0.0 h_b = layer[:H] t_b = layer[:T] temp = temperature_at_layer_from_geopotential(geopotential_alt) p_b = pressure_layers[i] dh = geopotential_alt - h_b if beta.zero? pressure_formula_beta_zero(p_b, temp, dh) else pressure_formula_beta_nonzero(p_b, beta, t_b, dh) end end |
#temperature_at_layer_from_geopotential(geopotential_alt) ⇒ Object
Override: temperature lookup uses injected model_layers.
125 126 127 128 129 130 131 132 |
# File 'lib/atmospheris/iso5878/atmosphere_profile.rb', line 125 def temperature_at_layer_from_geopotential(geopotential_alt) idx = locate_lower_layer(geopotential_alt) layer = model_layers[idx] beta = layer[:B] || 0.0 t_b = layer[:T] h_b = layer[:H] t_b + beta * (geopotential_alt - h_b) end |