-
Notifications
You must be signed in to change notification settings - Fork 7
[Tracking] Simulation Interface #253
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
Changes from 1 commit
4f102e9
1b64d6c
a3cacea
43c8f26
57610b7
c930b2d
7d05cda
28dbe96
79865b6
90b7795
a88eaac
cfb5ef2
efefa03
8e944f1
c56f91d
616ae7e
9928fa3
e0736f9
0204165
8d59a32
d3d7a09
28b5df2
500443d
ec306bc
183b436
83426f9
8e5bfe3
af9d86f
dce763f
e6c379c
42fbf2d
2d8c1fa
e86fbd4
ffd8425
16a663a
8b275d6
ffb3191
422af43
c0b8701
f96fda1
a65a439
a8ac05b
adefa8e
afd8e26
1df75cb
31a6484
c723463
723bc36
e7f927c
3fbc2b5
843f512
a95b0d4
efe80de
15ecc90
380832d
f1871bf
9630ced
60cf99c
6b3307e
7138f3d
9fe2bb5
2fec29e
3fe8d8d
d8825a4
4362cc7
2feb4ca
18982eb
80a5950
a67e365
0a05038
14172f5
49c1e01
f35d4aa
7483b6a
c24e328
f98e89c
0278781
c41cbca
a21dff7
cc13213
85c4a51
4f8084c
c73d24b
eb64d1f
1d0fd2e
a148e4c
e8371b0
7e1ebf5
3ff1242
05a0f49
d9397c9
ae8a43b
57575bf
6f504a6
f633d8a
a2301ef
6aadb50
f87f418
f8b125d
2e06b21
f622440
119a789
60b0813
81cf0bd
d6fe44a
20ae144
90635d7
49acd72
1421474
0dfcc81
f716b93
53d6d72
8b36ef9
7b588c3
6706e9f
0136fa9
ab9864c
6563b6f
63cdbd5
54489ed
c11cb79
ae362f7
5e0f768
c193fc7
8b24218
58c1447
65ae8bb
aeebe7d
c5b5133
d334630
b3a02b5
e2bee1e
b1c6d0c
8068bfb
6e0afbc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,14 +72,34 @@ def from_standard_atmosphere( | |
altitude: LengthType.Positive = 0 * u.m, | ||
temperature_offset: TemperatureType = 0 * u.K, | ||
): | ||
"""Constructs a thermal state from the standard atmosphere model.""" | ||
# pylint: disable=fixme | ||
# TODO: add standard atmosphere implementation | ||
density = 1.225 * u.kg / u.m**3 | ||
temperature = 288.15 * u.K | ||
"""Constructs a thermal state from the standard atmosphere model. | ||
|
||
state = cls(density=density, temperature=temperature, material=Air()) | ||
Parameters: | ||
altitude (LengthType.Positive): The altitude at which the state is calculated. | ||
temperature_offset (TemperatureType): The offset to be applied to the standard temperature. | ||
|
||
Returns: | ||
ThermalState: The thermal state at the given altitude. | ||
""" | ||
# Standard atmosphere constants | ||
t0 = 288.15 * u.K # Sea level standard temperature | ||
p0 = 101325 * u.Pa # Sea level standard pressure | ||
lapse_rate = 0.0065 * u.K / u.m # Temperature lapse rate | ||
r = Air().gas_constant # Specific gas constant for dry air | ||
g0 = 9.80665 * u.m / u.s**2 # Standard gravity | ||
|
||
# Calculate temperature at the given altitude | ||
temperature = t0 - lapse_rate * altitude | ||
temperature += temperature_offset | ||
|
||
# Calculate pressure at the given altitude | ||
pressure = p0 * (1 - (lapse_rate * altitude / t0)) ** (g0 / (r * lapse_rate)) | ||
|
||
# Calculate density at the given altitude | ||
density = pressure / (r * temperature) | ||
|
||
# Construct and return the thermal state | ||
state = cls(density=density, temperature=temperature, material=Air()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure where this model comes from, but I think implementation of US standard atmosphere model is more complex, here is one implementation: https://github.com/flexcompute/design360/blob/develop/design360/client/utils/atmosphere_model.py There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I copied your implementation |
||
return state | ||
|
||
@property | ||
|
@@ -113,7 +133,7 @@ def dynamic_viscosity(self) -> ViscosityType.Positive: | |
|
||
# TODO: should we make this private_attribute? | ||
@pd.validate_call | ||
def mu_ref(self, mesh_unit: LengthType.Positive) -> pd.PositiveFloat: | ||
def _mu_ref(self, mesh_unit: LengthType.Positive) -> pd.PositiveFloat: | ||
"""Computes nondimensional dynamic viscosity.""" | ||
# TODO: use unit system for nondimensionalization | ||
return (self.dynamic_viscosity / (self.speed_of_sound * self.density * mesh_unit)).v.item() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want to keep this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not used anywhere except examples. Let's remove this.