Upcoming SlideShare
×

# Physics Research Summer2009

634 views

Published on

Testing boundary conditions using MATLAB

Published in: Technology
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
634
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
4
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Physics Research Summer2009

1. 1. Advection<br />Non-trivial solutions to the advection equation (right-moving)<br />(1)<br />give a moving pulse, whose direction is determined by the sign of v. Positive v = right-moving.<br />f(x)<br />tx<br />Figure 1<br />For arbitrary functions f, the solution to the advection equation is f(u), where u = (x - vt).<br />Proof:<br />This solution works for all cases. v>0 yields a right-moving wave, and v<0 a left-moving wave.<br />Consider Figure 1, where time advances with each graph from left to right. Notice that each point on the curve is simply being dragged forward. If we mark two x values and their corresponding f(x) values, the movement of the pulse along characteristic lines (lines along which the function does not change) becomes apparent. Figure 3 is a contour plot for Figure 2 as it advances with time.<br />t<br />xb xax<br />xb xa<br />Figure 2Figure 3<br />Derivative Approximations<br />Forward Time Centered Space (FTCS) (Garcia 2000)<br />Consider a set of grid points with known x and f(x) values. We will say this set of data points exists at time level t = tn, and xi denotes x at the ith place. The distance between points is equal to Δx, and the duration between time levels is Δt. <br />What if we want to find information at another time level? (Figure 4)<br />fin+1?<br />Figure 4 finknown<br />We assume this data obeys the advection equation and estimate the function values at time level t = tn+1 using a forward time centered space approximation (FTCS).<br />Recall equation (1).<br />⇒∂f∂tx=xi,t=tn=-v∂f∂xx=xi,t=tn<br />The partial derivative on the right side of this equation can be approximated as<br />≈fi+1n- fi-1n2∆x<br />The partial derivative on the left as<br />≈fin+1- fin∆t<br />Equating the two with the appropriate constant v yields<br />fin+1- fin∆t=-vfi+1n- fi-1n2∆x<br />Solving for fin+1gives<br />fin+1=fin+fi+1n- fi-1n2∆x-v∆t (2)<br />The approximation of the space derivative is second order accurate by virtue of being a centered derivative approximation. The approximation of the time derivative is only first order accurate since it is a forward derivative approximation.<br />The computational molecule, which shows what points are used to approximate the value at the desired point, for FTCS is<br />Figure 5<br />FTCS is unconditionally unstable. If allowed to run for long enough, an FTCS algorithm will always blow up – infinities will start to show up in later time steps.<br />In most numerical methods for evolving hyperbolic partial differential equations, the stability of the system is determined by the Courant factor. The courant factor is α=v∆t∆x, or the ratio of physical wave speed to the speed at which the algorithm propagates information.<br />tConsider a physical light cone.<br />x<br />Figure 6<br />Only events within in the light cone can influence or be influenced by an observer at the origin. For our purposes, the physical light cone of the wave is determined by the physical speed of the wave. The numerical light cone is determined by the spacing of the grid on which function values are known. For example, looking at the computational molecule for FTCS, you can see that numerical light cone.<br />Figure 7<br />Computationally, the only information affecting the approximation of the function value at the gray point is the information at the three black points. Consider a physical light cone mapped onto Figure 7.<br />Figure 8<br />Here, the physical light cone is smaller than the numerical light cone because v<ΔxΔt. Stable approximations will have a numerical light cone bigger than a physical light cone, or a Courant factor α≤1. Keeping with the physical light cone analogy (Figure 6), the computational system can be understood heuristically as taking into account all possible physical influences. However, recall that FTCS is unconditionally unstable, and will eventually blow up even when this condition is satisfied. <br />To get an idea of the problems with FTCS, consider a simple situation such as when a Courant factor is α=1. Here, we would expect that this algorithm would essentially drag the pulse along characteristic lines. This is not true for FTCS. Recall equation (2).<br />fin+1=fin+fi+1n- fi-1n2∆x-v∆t <br />For a Courant factor α=1, the algorithm becomes<br />fin+1=fin-fi+1n- fi-1n2 (3)<br />Since we have provided the algorithm with a very simple system and are looking at a symmetric situation that it should be able to handle easily, we should expect a rather clean-looking answer like <br />fin+1=fi-1n (4)<br />In the case of equation (4), the wave is simply pulled along the characteristic line, which is what should happen computationally when numerical and physical speeds are equal; however, this is clearly not the case for FTCS. Although this is not a rigorous explanation for the fact that FTCS is unconditionally unstable, it does show some of the issues with using FTCS, even when solving very simple systems.<br />Lax (Garcia 2000)<br />Instead of using a known data point at (xi,tn)and then adding the time derivative multiplied by ∆t(-v), the Lax method uses an average of the two points adjacent to xi at time level tnThe lax method uses the average of points to find the point at the next time step.<br />Average <br />Figure 11<br />fin+1=12fi+1n+ fi-1n+ ∆t-vfi+1n- fi-1n2∆x (7)<br />The Lax method includes a diffusion term, which acts as though it takes energy away from the wave, preventing it from blowing up to infinity. As is expected, the Lax method becomes unstable with large Courant factors, but it will also become unstable with very small Courant factors. In the latter condition, the pulse dissipates rather quickly.<br />Centered Time Centered Space (Garcia 2000)<br />The Centered Time Centered Space method uses two initial time levels of data in order to get centered derivatives that are second-order accurate in both space and time <br />n<br />Figure 9<br />From before<br />-v∂f∂xx=xi,t=tn=∂f∂tx=xi,t=tn (5)<br />The derivative approximations are<br />∂f∂xx=xi,t=tn≈fi+1n-fi-1n2∆x<br />And<br />∂f∂tx=xi,t=tn≈fin+1-fin-12∆t<br />Solving equation (5) yields<br />fin+1=fin-1+fi+1n- fi-1n∆x-v∆t (6)<br />Note that the computational molecule for CTCS is<br />Figure 10<br />If α=1, we can assume within a reasonable uncertainty that fin-1 = fi+1n. Therefore, equation (6) reduces to fin+1≈fi-1n. This becomes exact if initial data ensures that fi'=fi+12.<br />Lax-Wendroff (Garcia 2000)<br />This method finds second derivatives, which it then uses to get to the next time step. Figure 12 provides a graphical representation of estimating second derivatives. The derivative is being approximated at the center black point.<br />∂f∂x∂f∂x<br />∂2f∂x2<br />Figure 12<br />Consider a Taylor series expansion<br />ft+∆t,x=f(t,x)+∆t∂f∂tt,x+∆t22!∂2f∂tt,x+…<br />The FTCS effectively truncates the Taylor series estimation at the term with the first-order partial differential. Lax-Wendroff carries the estimation one term further in the expansion. <br />An alternative way of using the Lax-Wendroff method takes a lax step to an intermediate time level and then “leaps” across that intermediate step to the desired value.<br />643Black dots = initial data21<br />5<br />Figure 12<br />For each step in Figure 12:<br /><ul><li>∂f∂xx=xi-12,t=tn≈fin-fi-1n∆x
2. 2. ∂f∂xx=xi+12,t=tn≈fi+1n-fin∆x
3. 3. fi-12n+12≈fi-1n + fin2+∆t2fin- fi-1n∆x-v
4. 4. fi+12n+12≈fin + fi+1n2+∆t2fi+1n- fin∆x-v
5. 5. ∂f∂xx=xi,t=tn+12≈fi+12n+12-fi-12n+12∆x