Skip to content

4/13/17 #12

Merged
merged 9 commits into from
Apr 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions 01_phugoid/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.pyc
764 changes: 764 additions & 0 deletions 01_phugoid/.ipynb_checkpoints/01_01_Phugoid_Theory-checkpoint.ipynb

Large diffs are not rendered by default.

Large diffs are not rendered by default.

929 changes: 929 additions & 0 deletions 01_phugoid/.ipynb_checkpoints/01_03_PhugoidFullModel-checkpoint.ipynb

Large diffs are not rendered by default.

1,187 changes: 1,187 additions & 0 deletions 01_phugoid/.ipynb_checkpoints/01_04_Second_Order_Methods-checkpoint.ipynb

Large diffs are not rendered by default.

764 changes: 764 additions & 0 deletions 01_phugoid/01_01_Phugoid_Theory.ipynb

Large diffs are not rendered by default.

949 changes: 949 additions & 0 deletions 01_phugoid/01_02_Phugoid_Oscillation.ipynb

Large diffs are not rendered by default.

943 changes: 943 additions & 0 deletions 01_phugoid/01_03_PhugoidFullModel.ipynb

Large diffs are not rendered by default.

1,187 changes: 1,187 additions & 0 deletions 01_phugoid/01_04_Second_Order_Methods.ipynb

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions 01_phugoid/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#Module 1: The phugoid model of glider flight.

##Summary

The phugoid model motivates the learning of numerical time integration methods. The model is described by a set of two nonlinear ordinary differential equations, representing the oscillatory trajectory of an aircraft subject to longitudinal perturbations.

* [Lesson 1](http://nbviewer.ipython.org/github/numerical-mooc/numerical-mooc/blob/master/lessons/01_phugoid/01_01_Phugoid_Theory.ipynb) presents the physics of phugoids in the assumption of zero drag (following Lanchester, 1909). Plotting the flight path gives fascinating curve shapes.
* [Lesson 2](http://nbviewer.ipython.org/github/numerical-mooc/numerical-mooc/blob/master/lessons/01_phugoid/01_02_Phugoid_Oscillation.ipynb) develops a single-equation model for zero-drag oscillations, leading to simple harmonic motion. The lesson defines initial-value problems, demonstrates Euler's method, and uses the exact solution to study the numerical convergence.
* [Lesson 3](http://nbviewer.ipython.org/github/numerical-mooc/numerical-mooc/blob/master/lessons/01_phugoid/01_03_PhugoidFullModel.ipynb) develops the full phugoid model and solves it with (vectorized) Euler's method. In the absence of an exact solution, the study of convergence uses a grid-refinement method, obtaining the observed order of convergence. The lesson ends with the paper-airplane challenge.
* [Lesson 4](http://nbviewer.ipython.org/github/numerical-mooc/numerical-mooc/blob/master/lessons/01_phugoid/01_04_Second_Order_Methods.ipynb) starts with the screencast "Euler's method is a first-order method" and develops second-order methods: explicit midpoint (modified Euler) and Runge-Kutta. It ends with a grid-refinement study.

##Badge earning

Completion of this module in the online course platform can earn the learner the Module 1 badge.

###Description: What does this badge represent?

The earner completed Module 1 "The phugoid model of glider flight" of the course "Practical Numerical Methods with Python" (a.k.a., numericalmooc).

###Criteria: What needs to be done to earn it?

To earn this badge, the learner needs to complete the graded assessment in the course platform including: answering quiz about basic numerical Python commands; answering quiz about basics of initial-value problems; completing the individual coding assignment "Rocket flight" and answering the numeric questions online. Earners should also have completed self-study of the four module lessons, by reading, reflecting on and writing their own version of the codes. This is not directly assessed, but it is assumed. Thus, earners are encouraged to provide evidence of this self-study by giving links to their code repositories or other learning objects they created in the process.

###Evidence: Website (link to original digital content)

Desirable: link to the earner's GitHub repository (or equivalent) containing the solution to the "Rocket flight" coding assignment.
Optional: link to the earner's GitHub repository (or equivalent) containing other codes, following the lesson.

###Category:

Higher education, graduate

###Tags:

engineering, computation, higher education, numericalmooc, python, gwu, george washington university, lorena barba, github

###Relevant Links: Is there more information on the web?

[Course About page](http://openedx.seas.gwu.edu/courses/GW/MAE6286/2014_fall/about)

[Course Wiki](http://openedx.seas.gwu.edu/courses/GW/MAE6286/2014_fall/wiki/GW.MAE6286.2014_fall/)

[Course GitHub repo](https://github.com/numerical-mooc/numerical-mooc)
335 changes: 335 additions & 0 deletions 01_phugoid/Rocket_Assignment.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,335 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"###### Content under Creative Commons Attribution license CC-BY 4.0, code under MIT license (c)2014 L.A. Barba, G.F. Forsyth."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Coding Assignment: Rocket"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The equations of motion for a rocket in purely vertical flight are given by\n",
"\n",
"\\begin{align}\n",
"\\frac{dh}{dt} &= v\\\\\n",
"(m_s+m_p) \\frac{dv}{dt}& = -(m_s+m_p)g + \\dot{m}_pv_e - \\frac{1}{2}\\rho v|v|AC_D\n",
"\\end{align}\n",
"\n",
"$h$ is the altitude of the rocket\n",
"\n",
"$m_s = 50kg$ is the weight of the rocket shell\n",
"\n",
"$g = 9.81 \\frac{m}{s^2}$\n",
"\n",
"$\\rho = 1.091 \\frac{kg}{m^3}$ is the average air density (assumed constant throughout flight)\n",
"\n",
"$A = \\pi r^2$ is the maximum cross sectional area of the rocket, where $r = 0.5 m$\n",
"\n",
"$v_e = 325 \\frac{m}{s}$ is the exhaust speed\n",
"\n",
"$C_D = 0.15 $ is the drag coefficient\n",
"\n",
"$m_{po} = 100 kg$ at time $t = 0$ is the initial weight of the rocket propellant\n",
"\n",
"The mass of the remaining propellant is given by:\n",
"\n",
"$$m_p = m_{po} - \\int^t_0 \\dot{m}_p d\\tau$$\n",
"\n",
"where $\\dot{m}_p$ is the time-varying burn rate given by the following figure:\n",
"\n",
"Propellant Burn Rate\n",
"\n",
"![burn rate](./burn.rate.png)\n",
"\n",
"Using Euler's method with a timestep of $\\Delta t=0.1s$, create a Python script to calculate the altitude and velocity of the rocket from launch until crash down. \n",
"\n",
"\n",
"\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Assessment:\n",
"\n",
"To check your answers, you can register for [MAE 6286: Practical Numerical Methods with Python](http://openedx.seas.gwu.edu/courses/GW/MAE6286/2014_fall/about).\n",
"\n",
"1. At time $t=3.2s$, what is the mass (in kg) of rocket propellant remaining in the rocket?\n",
"\n",
"2. What is the maximum speed of the rocket in $\\frac{m}{s}$?\n",
" At what time does this occur (in seconds)? \n",
" What is the altitude at this time (in meters)? \n",
" \n",
"3. What is the rocket's maximum altitude during flight (in meters)? At what time (in seconds) does this occur?\n",
"\n",
"4. At what time (in seconds) does the rocket impact the ground? What is the velocity of the rocket (in $\\frac{m}{s}$) at time of impact?"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Derivation of the rocket equations"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In case you are kind of confused about the rocket equations, here we show how to get to them. \n",
"\n",
"Newton's second law states that the acceleration of the vehicle times its mass is equal to all the forces acting on it. Therefore,\n",
"\n",
"\\begin{equation}\n",
"(m_s + m_p)\\frac{d\\bf{v}}{dt}=\\sum {\\bf F}.\n",
"\\end{equation}\n",
"In the above formula we have assumed that the propellant inside the rocket and the rocket move at the same velocity (in other words, their relative velocity is negligible). \n",
"\n",
"Two of the external forces acting on the rocket are,\n",
"\n",
"\\begin{align}\n",
"{\\bf F}_g&= (m_s+m_p)\\bf{g} \\quad (\\rm{Gravity}),\\\\\n",
"{\\bf F}_d&= - \\frac{1}{2} \\rho_a \\mathbf{v} |\\mathbf{v}| A C_D \\quad (\\rm{Drag}).\n",
"\\end{align}\n",
"\n",
"We also need to consider the force resulting from the ejection of the propellant. During an interval $dt$, the engine of the rocket ejects downwards a mass of propellant given by $\\dot m_p dt$. Relative to the rocket, the speed of the ejected burning gas is assumed constant and equal to $v_e$ (the exhaust speed). The momentum variation induced on the exhaust gas by the engine during that interval is therefore, $d{\\bf p}_{gas} = \\dot m_p {\\bf v}_e dt$. Again using Newton's second law we conclude that the force applied by the rocket on the gas is,\n",
"\n",
"\\begin{align}\n",
"{\\bf F}_{rocket\\rightarrow gas} = \\frac{d{\\bf p}_{gas}}{dt} = \\dot m_p {\\bf v}_e\n",
"\\end{align}\n",
"\n",
"Using Newton's third law (|action| = |reaction|), the force exerted by the exhaust gas on the rocket is then,\n",
"\n",
"\\begin{align}\n",
"{\\bf F}_{gas\\rightarrow rocket} = -{\\bf F}_{rocket\\rightarrow gas} = -\\dot m_p {\\bf v}_e\n",
"\\end{align}\n",
"\n",
"If we collect all the forces acting on the rocket we finally have:\n",
"\n",
"\\begin{align}\n",
"(m_s + m_p)\\frac{d\\bf{v}}{dt}=(m_s+m_p){\\bf g}- \\frac{1}{2} \\rho_a \\mathbf{v} |v| A C_D -\\dot m_p {\\bf v}_e\n",
"\\end{align}\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"---\n",
"\n",
"###### The cell below loads the style of the notebook."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<link href='http://fonts.googleapis.com/css?family=Alegreya+Sans:100,300,400,500,700,800,900,100italic,300italic,400italic,500italic,700italic,800italic,900italic' rel='stylesheet' type='text/css'>\n",
"<link href='http://fonts.googleapis.com/css?family=Arvo:400,700,400italic' rel='stylesheet' type='text/css'>\n",
"<link href='http://fonts.googleapis.com/css?family=PT+Mono' rel='stylesheet' type='text/css'>\n",
"<link href='http://fonts.googleapis.com/css?family=Shadows+Into+Light' rel='stylesheet' type='text/css'>\n",
"<link href='http://fonts.googleapis.com/css?family=Nixie+One' rel='stylesheet' type='text/css'>\n",
"<style>\n",
"\n",
"@font-face {\n",
" font-family: \"Computer Modern\";\n",
" src: url('http://mirrors.ctan.org/fonts/cm-unicode/fonts/otf/cmunss.otf');\n",
"}\n",
"\n",
"#notebook_panel { /* main background */\n",
" background: rgb(245,245,245);\n",
"}\n",
"\n",
"div.cell { /* set cell width */\n",
" width: 750px;\n",
"}\n",
"\n",
"div #notebook { /* centre the content */\n",
" background: #fff; /* white background for content */\n",
" width: 1000px;\n",
" margin: auto;\n",
" padding-left: 0em;\n",
"}\n",
"\n",
"#notebook li { /* More space between bullet points */\n",
" margin-top:0.8em;\n",
"}\n",
"\n",
"/* draw border around running cells */\n",
"div.cell.border-box-sizing.code_cell.running { \n",
" border: 1px solid #111;\n",
"}\n",
"\n",
"/* Put a solid color box around each cell and its output, visually linking them*/\n",
"div.cell.code_cell {\n",
" background-color: rgb(256,256,256); \n",
" border-radius: 0px; \n",
" padding: 0.5em;\n",
" margin-left:1em;\n",
" margin-top: 1em;\n",
"}\n",
"\n",
"div.text_cell_render{\n",
" font-family: 'Alegreya Sans' sans-serif;\n",
" line-height: 140%;\n",
" font-size: 125%;\n",
" font-weight: 400;\n",
" width:600px;\n",
" margin-left:auto;\n",
" margin-right:auto;\n",
"}\n",
"\n",
"\n",
"/* Formatting for header cells */\n",
".text_cell_render h1 {\n",
" font-family: 'Nixie One', serif;\n",
" font-style:regular;\n",
" font-weight: 400; \n",
" font-size: 45pt;\n",
" line-height: 100%;\n",
" color: rgb(0,51,102);\n",
" margin-bottom: 0.5em;\n",
" margin-top: 0.5em;\n",
" display: block;\n",
"}\n",
"\n",
".text_cell_render h2 {\n",
" font-family: 'Nixie One', serif;\n",
" font-weight: 400;\n",
" font-size: 30pt;\n",
" line-height: 100%;\n",
" color: rgb(0,51,102);\n",
" margin-bottom: 0.1em;\n",
" margin-top: 0.3em;\n",
" display: block;\n",
"}\t\n",
"\n",
".text_cell_render h3 {\n",
" font-family: 'Nixie One', serif;\n",
" margin-top:16px;\n",
" font-size: 22pt;\n",
" font-weight: 600;\n",
" margin-bottom: 3px;\n",
" font-style: regular;\n",
" color: rgb(102,102,0);\n",
"}\n",
"\n",
".text_cell_render h4 { /*Use this for captions*/\n",
" font-family: 'Nixie One', serif;\n",
" font-size: 14pt;\n",
" text-align: center;\n",
" margin-top: 0em;\n",
" margin-bottom: 2em;\n",
" font-style: regular;\n",
"}\n",
"\n",
".text_cell_render h5 { /*Use this for small titles*/\n",
" font-family: 'Nixie One', sans-serif;\n",
" font-weight: 400;\n",
" font-size: 16pt;\n",
" color: rgb(163,0,0);\n",
" font-style: italic;\n",
" margin-bottom: .1em;\n",
" margin-top: 0.8em;\n",
" display: block;\n",
"}\n",
"\n",
".text_cell_render h6 { /*use this for copyright note*/\n",
" font-family: 'PT Mono', sans-serif;\n",
" font-weight: 300;\n",
" font-size: 9pt;\n",
" line-height: 100%;\n",
" color: grey;\n",
" margin-bottom: 1px;\n",
" margin-top: 1px;\n",
"}\n",
"\n",
".CodeMirror{\n",
" font-family: \"PT Mono\";\n",
" font-size: 90%;\n",
"}\n",
"\n",
"</style>\n",
"<script>\n",
" MathJax.Hub.Config({\n",
" TeX: {\n",
" extensions: [\"AMSmath.js\"],\n",
" equationNumbers: { autoNumber: \"AMS\", useLabelIds: true}\n",
" },\n",
" tex2jax: {\n",
" inlineMath: [ ['$','$'], [\"\\\\(\",\"\\\\)\"] ],\n",
" displayMath: [ ['$$','$$'], [\"\\\\[\",\"\\\\]\"] ]\n",
" },\n",
" displayAlign: 'center', // Change this to 'center' to center equations.\n",
" \"HTML-CSS\": {\n",
" styles: {'.MathJax_Display': {\"margin\": 4}}\n",
" }\n",
" });\n",
"</script>\n"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from IPython.core.display import HTML\n",
"css_file = '../../styles/numericalmoocstyle.css'\n",
"HTML(open(css_file, \"r\").read())"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.4.3"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Binary file added 01_phugoid/burn.rate.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 01_phugoid/figures/glider_forces-lesson3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 01_phugoid/figures/glider_forces.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.