-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create Atmosphere model to wrap ambiance calls (#84)
- Loading branch information
1 parent
e925628
commit 135f189
Showing
8 changed files
with
128 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .atmosphere import Atmosphere | ||
|
||
__all__ = ["Atmosphere"] |
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,50 @@ | ||
import ambiance | ||
from cosapp.systems import System | ||
|
||
from pyturbo.thermo import IdealDryAir | ||
|
||
|
||
class Atmosphere(System): | ||
"""Standard atmosphere model. | ||
Inputs | ||
------ | ||
gas: Gas, default=IdealDryAir() | ||
gas model | ||
altitude[m]: float, default=0.0 | ||
altitude | ||
mach[]: float, default=0.0 | ||
Mach number | ||
dtamb[K]: float, default=0.0 | ||
ambient temperature delta to standard atmosphere | ||
Outputs | ||
------- | ||
pamb[Pa]: float | ||
static ambient pressure | ||
Pt[Pa]: float | ||
total pressure | ||
Tt[K]: float | ||
total temperature | ||
""" | ||
|
||
def setup(self): | ||
self.add_inward("gas", IdealDryAir(), desc="gas model") | ||
self.add_inward("altitude", 0.0, unit="m", desc="altitude") | ||
self.add_inward("mach", 0.0, unit="", desc="Mach number") | ||
self.add_inward( | ||
"dtamb", 0.0, unit="K", desc="ambient temperature delta to standard atmosphere" | ||
) | ||
|
||
self.add_outward("pamb", 101325.0, unit="Pa", desc="ambient pressure") | ||
self.add_outward("Pt", 101325.0, unit="Pa", desc="Total pressure") | ||
self.add_outward("Tt", 288.15, unit="K", desc="Total temperature") | ||
|
||
def compute(self): | ||
atm = ambiance.Atmosphere(self.altitude) | ||
pamb = atm.pressure[0] | ||
tamb = atm.temperature[0] + self.dtamb | ||
|
||
self.pamb = pamb | ||
self.Tt = self.gas.total_t(tamb, self.mach) | ||
self.Pt = self.gas.total_p(pamb, tamb, self.Tt) |
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 |
---|---|---|
@@ -1,8 +1,16 @@ | ||
# Copyright (C) 2022, twiinIT | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
from pyturbo.systems.compressor.compressor import HPC, Booster, CompressorAero, Fan | ||
from pyturbo.systems.compressor.compressor import HPC, Booster, Compressor, CompressorAero, Fan | ||
from pyturbo.systems.compressor.compressor_geom import CompressorGeom | ||
from pyturbo.systems.compressor.compressor_mft_aero import CompressorMftAero | ||
|
||
__all__ = ["CompressorAero", "HPC", "Booster", "Fan", "CompressorGeom", "CompressorMftAero"] | ||
__all__ = [ | ||
"Compressor", | ||
"CompressorAero", | ||
"HPC", | ||
"Booster", | ||
"Fan", | ||
"CompressorGeom", | ||
"CompressorMftAero", | ||
] |
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,22 @@ | ||
import pytest | ||
from cosapp.drivers import NonLinearSolver | ||
|
||
from pyturbo.systems import Atmosphere | ||
|
||
|
||
class TestAtmosphere: | ||
"""Tests for the Atmosphere model.""" | ||
|
||
atm = Atmosphere("atm") | ||
|
||
def test_sea_level_static(self): | ||
atm = self.atm | ||
|
||
atm.altitude = 0.0 | ||
atm.mach = 0.0 | ||
atm.dtamb = 0.0 | ||
atm.run_drivers() | ||
|
||
assert atm.Pt == 101325.0 | ||
assert atm.Tt == 288.15 | ||
assert atm.pamb == 101325.0 |
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