<!DOCTYPE html>
In many cases of practical importance, the system of interest evolves in time in such a way that the assumption of periodic motion is not useful. Describing the temporal evolution requires integrating the governing equations forward in time. Two examples involving problem that are one-dimensional in space are treated: the time dependent linear wave equation and the non-linear Burgers equation.
When selecting a method well-suited to step a solution forward in time, two questions arise: is the method stable and if it is how accurate is it. These issues are discussed in the next section.
Discretizing a differential equation can introduce spurious solutions. If these extraneous solutions grow, the computed solution will bear no resemblance to the exact solution (for example it might grow exponentially in time). Stability analysis provides a means to determine whether the solution to the discretized problem remains close to the real solution. Accuracy deals with the magnitude of differences between a computed solution and the analytical solution.
As far as accuracy is concerned, a classical example discussed by Strang (pp117-119) concerns a spring-mass system where the position of the mass is . The velocity of the mass is . The force balance governing is:
(3.1) |
Write the problems as a system of two first order equations:
(3.2) |
where is the velocity of the mass. At the mass is displaced to , and the velocity is zero. If the time dependence is discretized into chunks of length , there are several ways to integrate system 3.2 forward in time. Strang compares the following four schemes:
(3.3) |
This scheme is explicit, meaning that the solution a the new time depends solely on quantities evaluated at an earlier time. For this reason it is known as the Forward Euler method. The matrix is the growth matrix. The growth factor is , the determinant of . In this case . The method is conditionally stable and errors grow.
(3.4) |
The Backward Euler methoid is implicit. The growth factor is , always less than one. The method is stabl Terms evaluated at the new time step appear on the right hand side.
The Trapezoidal method is also implicit:
(3.5) |
Now the growth factor is . This is a second-order method, is the method of choice for integrating time-dependent problems (with the exception of stiff problems).
The only drawback to the Trapezoidal method is that it is implicit, requiring a matrix inversion at each time step. The Leapfrog method is:
(3.6) |
The growth factor is also .
Each scheme has been used to integrate system 3.2 forward from to , and the results are compared in figure 3.1, where the dependent variable is show as a function of the other dependent variable .
The two Euler solutions rapidly diverge from the exact solution (the black circle): the accuracy is low. The trapezoidal solution, stay on the circle, however there is a small phase error at the end of a cycle. The leapfrog method has no phase error, but the amplitudes varies by a small amount so that the numerical solution traces an ellipse in the phase plane. The last two methods are much more accurate than the two Euler methods.
The wave equation is a good test bed to evaluate the stabilty of the four numerical schemes described above. Consider the system
(3.7) |
The weak form is:
(3.8) |
Write the time index as a superscript; the solutions and are written as expansions in the trial functions:
(3.9) |
Introducing these expansions into equation 3.8
(3.10) |
(3.11) |
With the new FEM element matrix:
(3.12) |
For linear TF, Maxima gives:
(3.13) |
Form the global matrices from the element matrices in the usual way. The system of equations becomes
(3.14) |
The Forward Euler scheme is achieved by stepping:
(3.15) |
forward. This is an explicit scheme.
For the Backward Euler scheme step:
(3.16) |
For the Trapezoidal scheme, step
(3.17) |
and for the Leapfrog scheme
(3.18) |
Consider a wave system where a gaussian bump of water is released from at . With d’Alemebert’s solution it is clear that two gaussian bumps, each half the height of the original disturbance, will propgaten away from the center, one toward , and the other toward . The solution obtained by integrating the equations with each scheme over a two second period is illustrated in figure 3.2, as difference between the computed and exact solution. The Forward Euler scheme goes unstable immediately, as would any other explicit scheme. The error associated with the Trapezoidal scheme is the smallest, and diminishes as the number of elements squared. The trapezoidal scheme is said to be L-stable. We will adopt this scheme for the rest of the class with one exception: for stiff problems, such as the incompressible Navier-Stokes equations, methods that are L-stable are required.
The two components of equation 3.7 can be combined into the wave equation:
(3.19) |
for simplicity the phase speed is assumed . If the boundary conditions guarantee that the variable satisfies homogeneous Neumann conditions (corresponding to zero mass flux through the boundaries),, the weak version in matrix form is
(3.20) |
Now we replace the second derivatime in time by centered differences:
(3.21) |
This scheme requires initial values at two times. Fortunately we have the d’Alembert solution, so for a Gaussian bump at , start with:
(3.22) |
The solution for a case where is illustrated in figure 3.3. As time increase the initial disturbance produces two faves, each progressing toward opposite ends of the basin, where they reflect and head back toward the center of the basin. The ridges of maximum trace out the characteristics emanating from at .
Read Strang pg 537
Burgers equation is:
(3.23) |
In the following three different exact solutions to Burgers’ equation are reviewed.
If the viscosity , Burgers equation looks like the one-way wave equation. Do characteristics exist? Define . Then, with the chain rule:
(3.24) |
Therefore any function satisfies the inviscid Burgers equation.
(3.25) |
The function is constant along characteristic lines. Hovever, in contrat to the linear case, the characteristics need no longer remain parallel, as illustrated by the solid black lines illustrated on the plane in figure 3.4. At the initial profile is a gaussian function of , symmetric relative to . As time increases the non-linearity distorts the initial profile in such a way that area where the velocity increases with expand and areas where the velocity decrease with sharpen. Eventually these area will contain shocks, where the Riemann solutions take over, as illustrated in figure 3.4.
Returning to the full Bergers equation, look for solutions of the form where , and the constant wave speed is to be determined. The initial condition is as and as . If we introduce the new independent variable into equation 3.23 we get:
(3.26) |
Try a solution of the form
(3.27) |
Equation 3.26 becomes
(3.28) |
The choices
(3.29) |
turn equation 3.28 into an identity. The boundary conditions then determine and so the solution is
(3.30) |
This solution is illustrated in figure 3.5 for several values of the ratio . The form of the solution shows that the wavefront remains locally unchanges, moving to the right at the average speed of the two streams.
Consider equation 3.23 with initial and BC:
(3.31) |
Make the transformation and integrate once in x to get an equation for :
(3.32) |
make the further transformation , equivalent to:
(3.33) |
the derivatives are:
(3.34) |
substitute into equation 3.32:
(3.35) |
and the equation for is:
(3.36) |
This is the heat equation. The initial condition the the various dependent variables are:
(3.37) |
Initially has a step change where . The problem for is identical to the linearized shear layer problem, and the solution is known to be of the form:
(3.38) |
The constants and are determined by the boundary conditions:
(3.39) |
The function becomes:
(3.40) |
and the velocity is
(3.41) |
The evolution in time of the velocity from equation 3.41 is illustrated in figure for an initial velocity disturbance , at three times. The peak velocity translates toward , and the velocity expansion, behind the peak spread out in time. The front, ahead of the peak does not sharpen, because of viscous diffusion.
Now turn our attention to using numerical methods to solve Burgers’ equation. The spatial discretization will be accomplished with FEM. Obtain the weak form by multiplying equation 3.23 by a test function, and integrate over the domain.
(3.42) |
where we have replaced the infinite domain by a (large enough) domain: . There needs to be one initial condition and two boundary conditions.
Look for solutions of the form:
(3.43) |
The superscript refers to time and the subscript refers to location.
(3.44) |
or, using matrix notation
(3.45) |
where is itself a function of .
The boundary conditions specify values of the solution at either end of the spatial domain: they aree Dirichlet conditions, similar to the conditions encountered in section LABEL:sec:C2coos. When the interior and boundary portions of equation 3.45 are separated out:
(3.46) |
where the tilde and hat modifiere are defined in equation 1.41.
Advection is included as an additional term compared to the linear wave equation, namely
(3.47) |
With linear TF, the evaluation of the column vector is relatively straightforward, since gradients of the test functions are constant in each elelement. The contribution to node come from two elements and , as shown in
(3.48) |
The only contributions come from the interval illustrated in figure 3.7, where .
Away from the ends,this allows us to write:
(3.49) |
(3.50) |
The partial derivatives are constants, either , so the second parenthesis can be moved out of the integral:
(3.51) |
where is the distance between neighboring nodes.
(3.52) |
(3.53) |
Finally:
(3.54) |
At the ends:
(3.55) |
Noitice that if
(3.56) |
then
(3.57) |
the whole advection term will be , where the matrix is itself a function of . Element Matrices are .
Because Burgers’ equation is non-linear, there is no assurance that the stability analysis described earlier in this chapter is pertinent. Instead we compare the stability and accuracy of several methods.
(3.58) |
The weakness here is that the matrix is evaluated at the know time. There is a way to overcome this by using Newton’s method: see Strang page 484.
This is a multi step version of the Backward Euler scheme described in section LABEL:sec:C3S2:Acc-Stab. If is the generic dependent variable, we want to integrate
(3.59) |
where the function can be non-linear. Instead of using equation LABEL:eq:C3S2:TSBE, we make use of two earlier points:
(3.60) |
For Burgers equation this is:
(3.61) |
A single TR step is taken at first. Then for the second step, values of and are available.
Reference: Time-Differencing Schemes and Transform Methods, J. of
Computationa Physics, v 20, 196-207, 1976
This scheme belongs to the predictor-corrector family (Strang pg 486), where a prediction of the new value is made based on an explicit value of the nonlinear term, then a coorected value is made based on the nonlinear term evaluted based on the predictor. For the Gadzag scheme:
(3.62) | |||
where is evaluated based on the predictor . The Gadzag scheme has the advantage of requiring only one evaluation of matrix per time step.
This method differs conceptually from all other methods described in that it doesn’t explicitly invole an integration in time. Consider
Instead, given the solution at some time, the solution at a later time is found as a correction based on
Each of the four schemes described above has been evaluated by computing the solution to the travelling wave problem described in sectionsec:C3S2:Burgers:TransFront, with .
Plot comparing ana with different methods
Rather than casting the time dependent wave problem as a system of two equations, it can be cast as a single second order system involving the mass and stiffness matrix. Do this for both trapezoidal and leapfrog schemes and compare results to the exact solution and to the two by two system solution.
Evalute several (at least four) integration schemes of your choice to compare their performace as measured by the Infinity norm of the difference between the solution given by the scheme and the exact solution.