Академический Документы
Профессиональный Документы
Культура Документы
(1)
Necessary conditions : - Initial condition : u(0, x) = u0 (x) - Boundary conditions : Dirichlet boundary condition : u(t, x) = h(t, x), for x u(t, x) Neumann boundary condition : = g(t, x), for x n if g(t, x) = 0, then the domain is insulated. Steady-State problem ; ut = 0 and the solution u, boundary condition h/g and the source term f do not depend on time-variable t.
2
u(x) = f (x)
with boundary conditions independent to t. 2.2 Finite dierence method for steady state heat equation(1D) Consider 1-dimensional steady state heat equation : u (x) = f (x) for 0 < x < 1 (2)
with u(0) = , u(1) = : second order ODE. (Of course you can solve this easily!!)
Computational Science & Engineering (CSE) Lee
FDM
[Goal] Find the approximations to the solutions u(x) at x = xj , j = 0, 1, , n, where xj = j h with h = 1/n the mesh size.
Let Uj be our approximation to u(xj ) for j = 0, , n. From the boundary conditions : U0 = , Un = Construct a discrete system of (2) by using centered dierence approximation :
1 D2 Uj = h2 (Uj1 2Uj + Uj+1 ) 1 = h2 (Uj1 2Uj + Uj+1 ) = f (xj ), for j = 1, , n 1 = AU = F,
where
1 A= 2 h
, U =
U1 U2 U3 . . . Un2 Un1
F =
The matrix A is symmetric, positive denite, and sparse. There are many ways to solve the linear system AU = F . = By solve AU = F we obtain our approximation U to u at each node points. How good our approximation is? That is, observe the error E = (E1 , E2 , , En1 )t , where Ej = Uj u(xj ). Local truncation error(LTE) - LTE is dened by replacing Uj with u(xj ) : j = 1 (u(xj1 ) 2u(xj ) + u(xj+1 )) f (xj ) h2 1 = u (xj ) + h2 u (xj ) + O(h4 ) f (xj ) 12 1 2 = h u (xj ) + O(h4 ) 12
Lee
FDM
= j = O(h2 ) as h . - Vector form: = AU F, where U = (u(x1 ), u(x2 ), , u(xn1 ))t . Global error - Let E = U U then we have
1 h2 (Ej1
with boundary condition E0 = En = 0. - Corresponding ODE : e (x) = (x), for 0 < x < 1 with boundary conditions e(0) = e(1) = 0. Since (x) ing twice shows that the global error should be roughly e(x)
1 2 12 h u
(x), integrat-
2.3 Neumann boundary conditions Consider 1-dimensional steady state heat equation : one Neumann boundary condition u (0) = and
u(1) = .
First approach : one-sided approximation for u (0) u (0) implies 1 2 h h h 0 0 0 0 1 2 1 0 0 0 1 2 1 0 . ... ... ... . . . . . . . . 0 0 0 1 2 1 0 0 0 0 0 h2 U0 U1 U2 . . . Un1 Un = f (x1 ) f (x2 ) . . . f (xn1 ) U1 U0 = h
(3)
Lee
FDM
: rst order accurate, for example, 1 0 = 2 (hu(x1 ) hu(x0 )) h 1 1 = u (x0 ) + hu (x0 ) + O(h2 ) = hu (x0 ) + O(h2 ) 2 2 O(h) Second approach:second order accurate method centered approximation to u (0) = Introduce new unknown U1 1 (U1 2U0 + U1 ) = f (x0 ) (4) h2 1 (U1 U1 ) = (5) 2h In order to eliminate U1 , plug (4) into (5) to get 1 h (U0 + U1 ) = + f (x0 ) h 2 The induced linear system AU = F is exactly the same with (3) except the rst component of F is now + h f (x0 ). 2 Third approach : second order accurate one-sided approximation based on the three unknowns U0 , U1 and U2 . 1 3 1 U0 2U1 + U2 = h 2 2
2.4 Existence and Uniqueness Consider 1-dimensional steady state heat equation : Neumann boundary conditions u (0) = 0 For example, one-sided approximation h h 0 0 0 1 2 1 0 1 2 1 1 0 . .. .. .. . . . . . h2 . . . 0 0 0 1 2 0 0 0 0 h and
u (1) = 1 .
(6)
Lee
FDM
= The matrix is singular. In general, there are no solutions or there are innitely many solutions (depending on f ). If there is a solution, U, then U + [1, 1, , 1]t is a solution as well. = This reects that the original system is not well-posed. If 0 = 1 = f = 0, the u(x) = c with any constant c is a solution. If 0 = 1 = 0, that is, the wall is perfectly insulated and the source term f is not identically zero, then what happens? (what if f = 1 ?) 2.5 The 2-dimensional Steady-State Heat Equation Consider a domain R2 and an elliptic equation ( u) = f, where ( u) = (ux )x + (uy )y .
2
(7)
=constant =
u = f : Poisson equation
2
u = 0 : Laplace equation
u(x, y) = g(x, y) if (x, y) : Dirichlet boundary condition u(x,y) = h(x, y) if (x, y) : Neumann boundary condition n Here u(x,y) = n u is the normal-directional derivative on the boundary, where n n is the outward normal vector. If g(x, y) = 0 or h(x, y) = 0 = homogeneous boundary conditions 2.5.1 The 5-point stencil for the Laplacian Consider = [0, 1] [0, 1] and Dirichlet boundary conditions. Assume = 1. Let xi = ix and yj = jy and let ui,j represent an approximation to u(xi , yj ). Discretization of (7) : 1 1 (ui1,j 2ui,j + ui+1,j ) + (ui,j1 2ui,j + ui,j+1 ) = fi,j (x)2 (y)2 Uniform discretization : x = y = h 1 (ui1,j + ui+1,j + ui,j1 + ui,j+1 4ui,j ) = fi,j : 5-point stencil h2
Computational Science & Engineering (CSE) Lee
FDM
(gures)
Accuracy - local truncation error 1 i,j = 2 (u(xi1 , yj ) + u(xi+1 , yj ) + u(xi , yi1 ) + u(xi , yi+1 ) 4u(xi , yj )) f (xi , yj ) h 1 2 = h (uxxxx + uyyyy ) + O(h4 ) 12 - global error Ei,j := ui,j u(xi , yj ) solves Ah E h = h = E h O(h2 ) 2.5.2 The 9-point stencil for the Laplacian (gures)
1 (4ui1,j + 4ui+1,j + 4ui,j1 + 4ui,j+1 6h2 +ui1,j1 + ui1,j+1 + ui+1,j1 + ui+1,j+1 20ui,j ) 1 2 2 u(xi , yj ) = ui,j + h2 (uxxxx + 2uxxyy + uyyyy ) + O(h4 ) 12 error O(h2 )
2
ui,j =
Using 9-point stencil looks no better than 5-point discretization. But, the dominant term in error uxxxx + 2uxxyy + uyyyy = If f = 0 fourth order accuracy.
Computational Science & Engineering (CSE) Lee
2
u) =
FDM
2.6 Singular perturbation and boundary layers Consider a 1-dimensional steady-state advection-diusion equation: ut + aux uxx = :the temperature u(x, t) of a uid owing through a pipe with constant velocity a, where the uid has constant heat diusion coecient and is a source term from heating through the walls of the tube. If a > 0, it is natural to dene a wall-boundary condition at x = 0 such that u(0, t) = (t) :specifying the temperature of the incoming uid If > 0, then the heat can be diusive upstream, so we need to specify outgoing boundary condition, for example u(1, t) = (t). Steady-state : consider au (x) = u (x) + (x) in (0, 1) = u (x) u (x) = f (x), u(0) = , u(1) = . where = /a and f (x) = (1/a)(x). > 0, 0 : need two boundary conditions to uniquely determine the solution = 0 u (x) = f (x) : over specied e 1 e 1 x=1u=3
1 x
(8)
Let = 1, = 3, and f (x) = 1, then the solution is u(x) = + x + ( 1) = 0 = u is discontinuous at x = 1 x < 1 u(x) = x + 1 > 0 (gure) and (9)
Lee
FDM
As 0, the solution (9) toward a discontinuous function that jumps to the value at the last possible moment. The region of rapid transition is called the boundary layer. For this problem, the width of the boundary layer is O( ) as 0. The equation (8) with 0 < << 1 is called a singularly perturbed equation : small perturbation leads huge changes in the character of the equation (solution). Singular perturbation problem cause numerical diculties because the solution changes rapidly over a very small interval in space.
Lee