Buckets:
| { | |
| "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", | |
| "$$\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", | |
| "\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", | |
| "\n", | |
| "\n", | |
| "that is,\n", | |
| "\n", | |
| "$$\n", | |
| "\\begin{equation}\n", | |
| " \\dot{m}_p \\left( t \\right) =\n", | |
| " \\begin{cases}\n", | |
| " 20 & \\quad \\text{if} \\quad t < 5 \\\\\n", | |
| " 0 & \\quad \\text{otherwise}\n", | |
| " \\end{cases}\n", | |
| "\\end{equation}\n", | |
| "$$\n", | |
| "\n", | |
| "Using Euler's method with a time-step size of $\\Delta t=0.1s$, create a Python script to calculate the altitude and velocity of the rocket from launch until crash down." | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "## Assessment:\n", | |
| "\n", | |
| "To check your answers, you can register for [MAE 6286: Practical Numerical Methods with Python](https://openedx.seas.gwu.edu/courses/course-v1:MAE+MAE6286+2017/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": {}, | |
| "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", | |
| "<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro' 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: \"Source Code Pro\";\n", | |
| " font-size: 90%;\n", | |
| "}\n", | |
| "\n", | |
| ".alert-box {\n", | |
| " padding:10px 10px 10px 36px;\n", | |
| " margin:5px;\n", | |
| "}\n", | |
| "\n", | |
| ".success {\n", | |
| " color:#666600;\n", | |
| " background:rgb(240,242,229);\n", | |
| "}\n", | |
| "</style>\n", | |
| "\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", | |
| " MathJax.Hub.Queue(\n", | |
| " [\"resetEquationNumbers\", MathJax.InputJax.TeX],\n", | |
| " [\"PreProcess\", MathJax.Hub],\n", | |
| " [\"Reprocess\", MathJax.Hub]\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())" | |
| ] | |
| } | |
| ], | |
| "metadata": { | |
| "kernelspec": { | |
| "display_name": "Python 3 (MOOC)", | |
| "language": "python", | |
| "name": "py36-mooc" | |
| }, | |
| "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.6.5" | |
| } | |
| }, | |
| "nbformat": 4, | |
| "nbformat_minor": 1 | |
| } | |
Xet Storage Details
- Size:
- 12.7 kB
- Xet hash:
- 26e63c092cfef342b85831322ed248cfe911b44cbbc2d0058eb77d837a3cb0c3
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.