User Tools

Site Tools


gibson:teaching:spring-2016:math445:lecture:timestepping

**This is an old revision of the document!** ----

A PCRE internal error occured. This might be caused by a faulty plugin

====== Math 445 lectures 18, 19: time-stepping ====== How do you figure out the path $x(t)$ of a object whose velocity $dx/dt$ is a given function of its position $x$? I.e., given that \begin{eqnarray*} \frac{dx}{dt} = v(x(t)) \end{eqnarray*} for some known function $v(x)$, along with an initial position $x(0)$, how do you solve for the path $x(t)$? (Note that here $x$ and $v$ should be considered vector-valued quantities. I'm leaving out the arrows on top to reduce clutter.) The above equation is an [[https://en.wikipedia.org/wiki/Ordinary_differential_equation| ordinary differential equation]]. MATH 527 //Differential Equations// is all about finding solutions to such equations in closed form. Here we will use **numerical solution methods** to find approximate numerical solutions. To make things concrete, let's solve the following problem. Given the 2D inviscid flow around a cylinder from the [[gibson:teaching:spring-2016:math445:lecture:cylinderflow|last lecture]], what would be the path of a small particle starting at position $(x,y) = (-3.8, 0.6)$, shown below as a red circle? {{ :gibson:teaching:spring-2016:math445:lecture:cylinderpath1.png?direct&400 }} The code for plotting the 2D inviscid cylinder flow is provided in the notes for the last lecture. Here I've just added a quick ''x = [-3.8, 0.6]; plot(x(1), x(2), 'ro');'' to plot the dot. The problem now is to compute and plot the particle as it's advected along by the fluid velocity field $v(x)$, where \begin{eqnarray*} v(x) = \left( \begin{array}{l} v_0 \left(1 - (a/r)^2 \cos 2 \theta \\ -v_0 (a/r)^2 \sin 2 \theta \end{array} \right) \\ \end{eqnarray*} and where $r,\theta$ are the polar coordinates of the vector position $\vec{x} = (x,y)$. ---- **Problem 1:** Write Matlab code that plots the motion of the particle, in discrete steps, using the //forward-Euler timestepping// formula \begin{eqnarray*} \vec{x}(t + \Delta t) = \vec{x}(t) + \Delta t \; \vec{v}(\vec{x}(t)) \end{eqnarray*} This equation says, essential that the distance a particle moves in a small time interval $\Delta t$ is given by the product of $\Delta t$ and the velocity $\vec{v}(\vec{x}(t))$.

gibson/teaching/spring-2016/math445/lecture/timestepping.1460580194.txt.gz · Last modified: 2016/04/13 13:43 by gibson