Escolar Documentos
Profissional Documentos
Cultura Documentos
= f (t, (t))
t
Unsteady Problems
Introduction to CFD
t+t
(n+1) = (n) +
f (t, (t)) dt
(3)
f (t, (t)) dt
(4)
or
Contents:
t+t
dt =
t
T. J. Craft
George Begg Building, C41
(2)
t+t
t
where the superscript (n) denotes a quantity evaluated at time t, and (n + 1) at time t + t.
Reading:
J. Ferziger, M. Peric, Computational Methods for Fluid
Dynamics
H.K. Versteeg, W. Malalasekara, An Introduction to Computational Fluid Dynamics: The Finite Volume Method
S.V. Patankar, Numerical Heat Transfer and Fluid Flow
Notes: http://cfd.mace.manchester.ac.uk/tmcfd
- People - T. Craft - Online Teaching Material
The problem is then how to approximate the integral on the right hand side.
If we approximate the integral using the value of f at the initial time, t, then we obtain
(n+1) = (n) + f (t, (n) )t
(5)
This is a fully explicit method. Once we have values at time step n, equation (5) can be
applied in a simple explicit fashion to obtain the value of at time step n + 1.
- p. 3
Overview
If the integral is approximated using the value of the integrand at the final time, t + t, then
we have
(n+1) = (n) + f (t + t, (n+1) )t
(6)
In considering the discretization of fluid flow problems so far we have considered only
steady-state situations.
This has meant we have only discretized spatial derivatives.
This is a fully implicit method. It cannot be solved in a simple pointwise fashion, since values
of (n+1) appear on both the left and right hand sides. In a general case it will thus often
require an iterative solution procedure to obtain (n+1) .
In this lecture we consider how to handle unsteady flow problems, and any additional
complications this might introduce.
The Navier-Stokes momentum equations (for incompressible flow) now become
(Ui Uj )
Ui
1 P
Ui
+
=
+
t
xj
xi
xj
xj
Another alternative is to approximate the integral using a weighted average of the initial and
final values of f .
(1)
When considering how to discretize the time derivatives, we need to recognise a major
difference between space and time coordinates.
In the case of an equally weighted average the integral is evaluated using the trapezium rule:
(n+1) = (n) +
Most real fluid flow problems are (at least to some extent) elliptic in nature meaning that
any forcing introduced has an effect in all directions.
However, the time dependence is purely parabolic any forcing affects only the future,
never the past.
t
f (t, (n) ) + f (t + t, (n+1)
2
(7)
Again, this is an implicit scheme, and will typically require an iterative procedure to obtain
(n+1) .
- p. 4
By expanding as a Taylor series expansion about time t we can examine the accuracy of
the fully explicit scheme:
(t + t) = (t) + t
(t)2
+
2!
2
t2
+ O((t) )
Zone of
Influence
Hence we have
(n+1) = (n) + tf (t, (n) ) + O((t)2 )
(8)
From this we can see that equation (5) shows a truncation error proportional to (t)2 over a
single time step.
xi
However, the number of time steps that must be performed for a given simulated time is
proportional to 1/t.
Zone of
dependence
Hence the total error associated with use of the scheme is proportional to t, and the
scheme is referred to as first order accurate.
xi
In a fully explicit scheme, since the value of at time t(n) is determined purely from its
values at time t(n1) , we need to ensure that the spatial stencil does contain all the relevant
flow information at time t(n1) .
The fully implicit scheme of equation (6) can also be shown to be first order accurate.
- p. 5
The trapezium approximation of equation (7) can be shown to be second order accurate,
since
t
(t)2 /4 2
(t + t) = (t + t/2) +
+
+ O((t)3 )
(9)
2
t t+t/2
2!
t2 t+t/2
(t)2 /4 2
t
+
+ O((t)3 ) (10)
(t) = (t + t/2)
2
t t+t/2
2!
t2 t+t/2
Hence
(n+1)
(n)
(n+1/2)
(n+1/2)
t
(t)2 /4
+
f (t + t/2, (n+1/2) ) +
2
2!
2
t2
t
(t)2 /4
f (t + t/2, (n+1/2) ) +
2
2!
2
t2
+ O((t) ) (11)
t+t/2
- p. 7
t- t
t-2 t
If, however, a time step of 2t were taken, not all the relevant flow information at time
t 2t would be included in the discretization, and the scheme would likely be unstable.
Hence stability often imposes a limit on the time step that can be used in a calculation.
+ O((t) ) (12)
t+t/2
An examination of the stability of different schemes will be covered in the following sections
when applying them to unsteady convection/diffusion problems.
(13)
The truncation error over a single time step is thus proportional to (t)3 , so over a fixed time
integration the scheme is second order.
- p. 6
- p. 8
Stability Analysis
As indicated earlier, the stability of a temporal discretization is often an important issue,
particularly with explicit schemes.
In some cases the solution to a steady flow problem is obtained by introducing a time
derivative term and solving the unsteady problem, marching the solution to a steady state.
In such cases the accuracy of the time discretization is not crucial (since the time derivative
will be zero at the end of the calculation), and one typically wants to take rather large time
steps.
Broadly, we interpret a stable scheme to be one that leads to a bounded solution if the
original differential equation would have done so.
A method that is frequently used to explore stability issues is the Von-Neumann stability
analysis.
The stability of the scheme is therefore particularly important in these cases, since the
time-step size that can be applied may well be limited by this, rather than by accuracy
considerations.
If one assumes there are no forcing terms, then the discretized equation for can be written
in the form
(18)
(n+1) = A (n)
In a solution procedure such as the above, the time-stepping is effectively playing a similar
role to under-relaxation, which was considered earlier in the context of solving steady-state
problems in a segregated fashion.
If we further assume that the eigenvectors of A form a basis, then can be written in terms
of these:
X (n)
(n) =
k ak
(19)
k
(n)
k
The difference between solutions for at successive time steps (using some appropriate
norm) is then
X (n+1)
(n)
k
ak ||
||(n+1) (n) || = ||
k
(20)
k
- p. 9
+
(Uj ) =
t
xj
xj
xj
(14)
The explicit Euler method is obtained by moving all terms except /t to the right hand
side and applying the fully explicit formulation examined earlier:
=
(Uj ) +
f (t, (t))
(15)
t
xj
xj
xj
If we consider the 1-D problem with constant velocity U and diffusivity then the differential
equation becomes
2
(16)
= U
+ 2
t
x
x
Using central differences to approximate spatial derivatives then leads to
13
1
0
2
0
(n)
(n)
(n)
(n)
(n)
i+1 2i + i1
i+1 i1
(n+1)
(n)
A5
A+ @
i
= i + t 4U @
2x
(x)2
(n+1)
- p. 11
Using the discretized equation to relate this difference to that at the previous timestep leads
to
X
X (n) (n1)
(n)
(n1)
||(n+1) (n) || = ||A((n) (n1) )|| = ||A
(k k
)ak || = ||
k (k k
)ak ||
k
(21)
where i =
(17)
1, the index j denotes the spatial position and superscript (n) the time level.
We then examine whether the (complex) coefficient k associated with the Fourier mode k is
less than or greater than unity in magnitude.
in a simple
- p. 10
- p. 12
Substituting the form n exp(ikjx) into the discretized equation (17) leads to
exp(ikx) 2 + exp(ikx)
exp(ikx) exp(ikx)
+ t
n+1 = n 1 U t
2x
(x)2
(23)
or
Another way of examining stability and boundedness is to write the discretized equation as
2t
U t
U t
t
t
(n+1)
(n)
(n)
(n)
i1
= 1
+
+
+
(30)
i
i
i+1
(x)2
(x)2
2x
(x)2
2x
Suppose that represents some scalar quantity that cannot physically be negative.
t
U t
[exp(ikx) exp(ikx)] +
[exp(ikx) + exp(ikx) 2]
=1
2x
(x)2
2t
U t
sin(kx) +
=1i
[cos(kx) 1]
x
(x)2
(24)
(25)
(n)
(n)
(n)
If any of the coefficients associated with i , i+1 or i1 take a negative value then it is
possible that
(n+1)
i
2t
1+
[cos(kx) 1]
(x)2
U t
sin(kx)
x
2t
>0
(x)2
or
t
< 1/2
(x)2
and
t
U t
>0
(x)2
2x
U x
<2
or
(26)
The first of these conditions is the same as found by the Von-Neumann analysis.
The second is that the cell Peclet number (met in earlier lectures) should be less than 2.
Note that this is the condition found earlier to be sufficient for the centred convection scheme
to be bounded.
The restriction t/(x)2 < 1/2 can impose a rather serious constraint on the time step for
practical calculations. If the grid spacing is halved, for example, the time step has to be
reduced by a factor of four.
- p. 13
- p. 15
U t
sin(kx)
x
(27)
2
2t
[cos(kx)
1]
2 = 1 +
(x)2
or
(28)
t
14
(x)2
(n+1)
2t
U t
(x)2
x
(n)
t (n)
+
(x)2 i+1
t
U t
+
(x)2
x
(n)
i1
(32)
If we retain the explicit Euler time discretization, but now use the first order upwind scheme
to discretize the convective terms, the discretized equation for the above unsteady
convection/diffusion problem (assuming U > 0) becomes
1
0
1
0
(n)
(n)
(n)
(n)
(n)
i i1
i+1 2i + i1
(n+1)
(n)
A
A + t @
(31)
= i U t @
i
x
(x)2
(29)
2t
U t
>0
(x)2
x
or
t <
1
(2)/(x)2 + U/x
U t
<1
x
or
t <
x
U
The quantity U t/x is known as the Courant Number, and represents the ratio of the time
step to the time required for a disturbance to be convected across the cell.
- p. 14
- p. 16
The Von-Neumann analysis can also be applied to this case, leading to the same limit on t.
Thus, for a purely convective flow, the introduction of upwinding for the convective flux leads
to conditional stability of the explicit Euler method. Stability is achieved provided the Courant
number is less than unity.
Note that this condition implies that t should be sufficiently small so that a fluid element
cannot travel more than one grid cell length in each time step.
It is worth noting that the exact stability conditions obtained above relate to the rather
simplified problem currently considered. In real fluid flow problems the precise criteria may
be different, although the limits found above are generally good guidelines.
(n)
1
2
U
U
(n+1)
(n+1)
(n+1)
i
i+1
i1 = i
+
+
+
2
2
2
t
(x)
2x
(x)
2x
(x)
t
(34)
- p. 17
Note that this results in a similar tri-diagonal system to that met in the equivalent steady
problem, but with an additional (positive) term in the diagonal element and the additional
(n)
source term i /t.
- p. 19
Since the introduction of the time discretization does not alter the sign of the coefficients, the
solution is unconditionally stable (although as in the steady case, the use of central
differencing for convection can lead to oscillations if the cell Peclet number is too large).
Von-Neumann analysis can again be used to confirm the stability of the scheme.
One drawback of the scheme is that one has to solve a large coupled system of equations at
each time step (using one of the matrix solution techniques examined in an earlier lecture).
Since there will typically be a large number of time steps, employing an efficient solver is
crucial.
An advantage of the scheme is that if marching to a steady state solution, very large time
steps can be used in a stable fashion.
However, if a time accurate solution is required, accuracy considerations may still lead to a
rather small time step because of the first order truncation error.
- p. 18
- p. 20
When considering generic temporal discretizations we noted that approximating the time
integral between t and t + t via the trapezium rule resulted in a second order scheme.
(35)
2
2x
2
(x)2
or
+
t
(x)2
Crank-Nicolson
U
U
(n+1)
(n+1)
i1
+
+
i+1
4x
2(x)2
4x
2(x)2
U
1
U
(n)
(n)
(n)
=
i +
i+1 +
i1
+
+
2
2
2
t
(x)
4x
2(x)
4x
2(x)
(n+1)
Implicit Euler
(36)
The scheme is again implicit, so requires a matrix system solution at each time step.
- p. 21
- p. 23
- p. 22
- p. 24