-
Notifications
You must be signed in to change notification settings - Fork 110
Atmosphere Incorporation: USatm1976, MIL_SPEC_210A Hot/Cold/Polar/Tropical, and Offsets #950
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
base: main
Are you sure you want to change the base?
Changes from all commits
f3a72ad
cff5eab
7e84114
e14d024
52fac6c
2dffa1c
c5ff59d
9e2b4ea
0296736
ffa7825
838c505
736c993
6030e83
c29ff8b
8aa488b
9a2c888
1e52575
f308e0f
ca9d89a
92b28ed
26d248c
90d618c
603b92c
f0c2b94
64af4b7
3ec7454
8473e65
6bc73bf
a8b176d
8d44865
7d7a094
87e9792
a2d732b
d105713
5f3353e
c162208
758544b
b33f673
1ab3e8e
13c21f6
839a18c
05c5b8a
2aba740
d159fab
1f35483
05f6243
f8cda9e
70dd0ba
1b9e315
46c0a21
a3586ab
50bb1f9
12577c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,174 @@ | ||||||
| { | ||||||
| "cells": [ | ||||||
| { | ||||||
| "cell_type": "code", | ||||||
| "execution_count": null, | ||||||
| "metadata": { | ||||||
| "tags": [ | ||||||
| "remove-cell" | ||||||
| ] | ||||||
| }, | ||||||
| "outputs": [], | ||||||
| "source": [ | ||||||
| "# Testing Cell\n", | ||||||
| "from aviary.subsystems.atmosphere.atmosphere import AtmosphereComp\n", | ||||||
| "from aviary.subsystems.atmosphere.StandardAtm1976 import atm_data\n", | ||||||
| "from aviary.subsystems.atmosphere.MIL_SPEC_210A_Cold import atm_data\n", | ||||||
| "from aviary.subsystems.atmosphere.MIL_SPEC_210A_Hot import atm_data\n", | ||||||
| "from aviary.subsystems.atmosphere.MIL_SPEC_210A_Polar import atm_data\n", | ||||||
| "from aviary.subsystems.atmosphere.MIL_SPEC_210A_Tropical import atm_data\n", | ||||||
| "import openmdao.api as om" | ||||||
| ] | ||||||
| }, | ||||||
| { | ||||||
| "cell_type": "markdown", | ||||||
| "metadata": {}, | ||||||
| "source": [ | ||||||
| "# Atmosphere Subsystem\n", | ||||||
| "Aviary has several built-in atmosphere models that support the Aerodynamics calculations, by providing temperature, pressure, speed of sound, and viscosity based on an input altitude. There are two different atmosphere models implemented in Aviary, one coming from the 1976 standard atmosphere tables and the other coming from the publically released MIL-SPEC-210A tables. The standard 1976 tables are the default option and represent the typical conditions experienced at a given altitude. However, it is important to note that \"the atmosphere has never, and will never be, standard\". All of the atmosphere models are approximations. The MIL-SPEC-210A tables represent extreme atmospheres in tropical, arctic (polar winter), extreme hot, and extreme cold climates. \n", | ||||||
| "\n", | ||||||
| "# Comparison between Different Models\n", | ||||||
| "A few graphs comparing the different models have been included so the user can visually understand the different atmosphere models.\n", | ||||||
| "\n", | ||||||
| "\n", | ||||||
| "\n", | ||||||
| "\n", | ||||||
| "\n", | ||||||
| "# How the Atmosphere Model Works\n", | ||||||
| "Examining `atmosphereComp.py` will show the code on how the atmosphere component is implemented. Generally speaking, akima splines that represent the raw data are loaded into the model during initialization. The akima splines are used to enhances computational speed. During every subsequent call to the atmosphere mode, an input altitude is translated via the akima splines into a temperature, pressure, density and then additional calculations are performed to determine speed of sound, and dynamic viscosity. The raw data and the akima splines of that data are contained in individual files (`StandardAtm1976.py`, `MIL_SPEC_210A_cold.py`, `MIL_SPEC_210A_hot.py`, `MIL_SPEC_210A_polar.py`, `MIL_SPEC_210A_tropical.py`). " | ||||||
| ] | ||||||
| }, | ||||||
| { | ||||||
| "cell_type": "markdown", | ||||||
| "metadata": {}, | ||||||
| "source": [ | ||||||
| "# User options reference for AtmosphereComp and AtmosphereGroup\n", | ||||||
| "There are some critical options you can pass to atmosphere that you should know about. These options will allow you to change which source data you use, swap between geocentric or geodetic altitude inputs, and add a temperature offset. Changing the source data swaps the akima splines used to calculate temperature, pressure, and density as a function of altitude. \n", | ||||||
| "\n", | ||||||
| "All the options and their defaults and functions are shown below." | ||||||
| ] | ||||||
| }, | ||||||
| { | ||||||
| "cell_type": "code", | ||||||
| "execution_count": null, | ||||||
| "metadata": {}, | ||||||
| "outputs": [], | ||||||
| "source": [ | ||||||
| "om.show_options_table('aviary.subsystems.atmosphere.atmosphere.AtmosphereComp')" | ||||||
| ] | ||||||
| }, | ||||||
| { | ||||||
| "cell_type": "markdown", | ||||||
| "metadata": {}, | ||||||
| "source": [ | ||||||
| "## Temperature Offset Options\n", | ||||||
| "Adding a temperature offset can enable simulation with especially hot or cold days which is useful in acoustic certification of aircraft. When inputting a temperature offset as an option, the temperature throughout the entire altitude regime is shifted up or down by this ammount. The pressure is assumed to remain constant. This is a simplification we must adhere to because we do not have any additional pressure data or assumptions to build upon. Density is then recalculated as an offset from the source data. This is important because that source data may differ from the ideal gas equations used to calculate density. This is the case for the MIL-SPEC-210A data." | ||||||
| ] | ||||||
| }, | ||||||
| { | ||||||
| "cell_type": "markdown", | ||||||
| "metadata": {}, | ||||||
| "source": [ | ||||||
| "# US 1976 Atmosphere Notes\n", | ||||||
| "The US 1976 atmospheres source information and notes are as follows:" | ||||||
| ] | ||||||
| }, | ||||||
| { | ||||||
| "cell_type": "code", | ||||||
| "execution_count": null, | ||||||
| "metadata": {}, | ||||||
| "outputs": [], | ||||||
| "source": [ | ||||||
| "from aviary.subsystems.atmosphere.StandardAtm1976 import DATA_ORIGIN_NOTE\n", | ||||||
| "\n", | ||||||
| "print(DATA_ORIGIN_NOTE)" | ||||||
| ] | ||||||
| }, | ||||||
| { | ||||||
| "cell_type": "markdown", | ||||||
| "metadata": {}, | ||||||
| "source": [ | ||||||
| "# MIL-SPEC-210A Atmosphere Notes\n", | ||||||
| "The MIL-SPEC-210A atmospheres (including hot/cold/tropical/polar) source information and notes are as follows:" | ||||||
| ] | ||||||
| }, | ||||||
| { | ||||||
| "cell_type": "code", | ||||||
| "execution_count": null, | ||||||
| "metadata": {}, | ||||||
| "outputs": [], | ||||||
| "source": [ | ||||||
| "from aviary.subsystems.atmosphere.MIL_SPEC_210A_Tropical import DATA_ORIGIN_NOTE\n", | ||||||
| "\n", | ||||||
| "print(DATA_ORIGIN_NOTE)" | ||||||
| ] | ||||||
| }, | ||||||
| { | ||||||
| "cell_type": "markdown", | ||||||
| "metadata": {}, | ||||||
| "source": [ | ||||||
| "# Adding your own Atmosphere Model\n", | ||||||
|
Contributor
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. Maybe this is developer guide atmosphere info. I'm starting to think we need to completely re-organize how we organize the docs anyway though, splitting up the subsystems into different places doesn't seem useful... |
||||||
| "If you desire to add your own atmosphere model you can do this one of two ways. Either create a new `AtmosphereComp.py` from scratch, or by importing a new set of raw data and using the current `atmosphereComp.py` to read it in and process it. This will include first saving your new raw data set in a new file and then creating a new set of akima splines for that data and also saving them in the same file. After that, `AtmosphereComp.py` can read in the akima's and run as normal. This walkthrough will help you perform the latter option. Start by creating a new file to hold your raw atmosphere model and the eventual akima splines. \n", | ||||||
| "\n", | ||||||
| "## Create a new Atmosphere file\n", | ||||||
| "You will need to make a new file to hold the raw data of your atmosphere model and the akima splines. This file should be titled after your atmosphere model, i.e. `StandardAtm1976` or `MIL_SPEC_210A_Cold`. \n", | ||||||
| "Save that file inside of the `aviary/subsystems/atmosphere` folder.\n", | ||||||
| "You will need to make a new `_raw_data` dictionary inside your new file. Look at the example `_raw_data` contained in `StandardAtm1976` for reference. \n", | ||||||
| "\n", | ||||||
| "## Converting Raw data Proper Units\n", | ||||||
| "From here on our we need to be especially mindful of units. We are going to use a non-openmdao helper function `_build_akima_coefs` to help create the akima coefficients. \n", | ||||||
|
Contributor
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.
Suggested change
I don't think specifying non-openmdao adds any useful info. It's also not a dymos, numpy, pyoptsparse, etc. helper function so why single out OM? |
||||||
| "We only need to build the akima coefficients once and we do it so that the atmosphere model is very fast. The atmosphere model will need the following information: (Altitude, Temperature, Pressure, Density). If you don't have one of those values that's ok, typically given Altitude, Temperature, and some assumption of the pressure at sea level, all other values can be calculated based on ideal gas assumptions. \n", | ||||||
| "\n", | ||||||
| "Your units inside of `_raw_data` should be one of the following: \n", | ||||||
| "English: [altitude (ft, ), temperature (degF), pressure (inHg at 60degF), density (lbm/ft**3)]\n", | ||||||
| "Altitude can be in either in geodetic or deocentric\n", | ||||||
| "Pressure will only translate properly if given in inHg at 60degF. However, many data sets use inHg at 30degF. \n", | ||||||
| "\n", | ||||||
| "SI Units: [altitude (m), temperature (degK), pressure (millibar), density (kg/m^3)]\n", | ||||||
| "Altitude can be in either in geodetic or deocentric\n", | ||||||
| "\n", | ||||||
| "If your units do not match either English or SI as designated above, you will need to modify the `_build_akima_coefs` function to properly translate your raw data and their units.\n", | ||||||
| "\n", | ||||||
| "## Processing new Akima Splines\n", | ||||||
| "Next, open up `atmosphereComp.py`, you will notice that at the bottom of the file there is an call to `_build_akima_coefs` method and above that there is the `_raw_data` import location. Change the import location to point to your new `_raw_data` file and change the units to be either SI or English, depending on your raw data. Then execute `python atmosphereComp.py`, this will call the `_build_akima_coefs` to build the akima splines using your raw data. Copy those splines into your new atmosphere file you made a few steps earlier and save the file. \n", | ||||||
| "\n", | ||||||
| "## Import the Processed Data\n", | ||||||
| "Next we will need to import these akima splines into `AtmosphereComp()` i.e.\n", | ||||||
| "\n", | ||||||
| "`from NEW_DATA_FILE import atm_data as new_data`\n", | ||||||
| "\n", | ||||||
| "Next, you will need to edit the `Setup()` method of `AtmosphereComp()` to add in your new file as a valid option. In the `self.options.declare('data_source')` call, enter the new name for your model in the `values=new_name` field i.e.:\n", | ||||||
| "\n", | ||||||
| "`self.options.declare('data_source', values=('new_data', 'USatm1976', 'tropical', 'polar', 'hot', 'cold'), default='USatm1976')`\n", | ||||||
| "\n", | ||||||
| "Lastly below the options declarations there is a section of code that loads the atmosphere model based on the user selected options. Add a new line there to properly load youre new file:\n", | ||||||
| "\n", | ||||||
| "`elif self.options['data_source'] == 'new_name': self.source_data = new_data`\n", | ||||||
| "\n", | ||||||
| "## Test Your Model\n", | ||||||
| "Now that you have your model loaded and ready to go, use the manual test at the bottom of `atmosphere.py` to test inputting a few altitude values into your model and inspect the resulting output of temperature, pressure, density, speed of sound, and dynamic viscosity. " | ||||||
| ] | ||||||
| } | ||||||
| ], | ||||||
| "metadata": { | ||||||
| "kernelspec": { | ||||||
| "display_name": "Python 3 (ipykernel)", | ||||||
| "language": "python", | ||||||
| "name": "python3" | ||||||
| }, | ||||||
| "language_info": { | ||||||
| "codemirror_mode": { | ||||||
| "name": "ipython", | ||||||
| "version": 3 | ||||||
| }, | ||||||
| "file_extension": ".py", | ||||||
| "mimetype": "text/x-python", | ||||||
| "name": "python", | ||||||
| "nbconvert_exporter": "python", | ||||||
| "pygments_lexer": "ipython3", | ||||||
| "version": "3.11.12" | ||||||
| } | ||||||
| }, | ||||||
| "nbformat": 4, | ||||||
| "nbformat_minor": 4 | ||||||
| } | ||||||
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.
Can you add a mention of the actual names of the standards Aviary uses for its atmospheres, and what they do? I.E. 1976 standard for a general-purpose average atmosphere + the milspec for various climates