Description
Lecture 10
PDE and Programming โ 1
Jung-Il Choi
Lecture 10
โข Partial Differential Equation โข 1D PDEs
๏ฌ 1D Heat equation
๏จ Semi-discretization
๏จ Stability analysis
๏ผ Eigenvalue analysis
๏ผ Modified wavenumber analysis
๏ผ von Neumann analysis
๏จ Accuracy via modified equation
๏จ Example 1
๏ฌ 1D Wave equation
๏จ Semi-discretization
๏จ Stability analysis
๏ผ Modified wavenumber analysis
๏จ Example 2
Contents
Lecture 11
โข Multi-dimension
๏ฌ Heat equation
๏จ Implicit methods in higher
๏จ Approximate factorization
๏จ Stability analysis
๏จ Alternating direction implicit methods (ADI)
๏ฌ Poisson equation
๏จ Iterative solution methods
๏ผ Point Jacobi method
๏ผ Gauss-Seidel method
๏ผ Successive over relaxation method (SOR)
๏ฌ Non-linear PDEs
2 / 41
โข Partial Differential Equation (PDE)
๏ฌ๏ An equation stating a relationship between a function of two or more independent variables and the partial derivatives of this function with respect to these independent variables.Non linear์ ๋ํ์ ์ธ ์
๏จ0: 2D Laplace equation
๐ข 0
๏จ ๐ ๐ฅ, ๐ฆ: 2D Poisson equation
๏ผ โ ๐ข ๐ข ๐
๏จ ๐ : 1D Diffusion equation
๏ผ (โ ๐ข ๐ ๐ข )
๏จ ๐ : 1D Wave equation
๏ผ (โ ๐ข ๐ ๐ข ) ์ด ๊ฒฝ์ฐ๋ ์ผ์ ํ ์๋์ ๋ฐฉํฅ์ผ๋ก ์์ง์ ์๋๊ฐ ๋น ๋ฅด๋ฉด ๋น ๋ฅด๊ฒ, Diffusion equation ๋๋ฆฌ๋ฉด ๋๋ฆฌ๊ฒ
ํ๋ wave equation
ฮฮฆ 4๐๐บ๐
https://en.wilipedia.org/wiki/
3 / 41
โข Solution and linearity(or nonlinearity) of PDEs
๏ฌ The solution of a PDE in some region ๐
of the domain of interest, ๐ท ๐ฅโ, ๐ก
๏จ the particular function, ๐ข ๐ฅโ, ๐ก satisfies the PDE in ๐
,
๏จ and the initial and/or boundary conditions specified on the boundaries of ๐
โ ๐ท.
ํ๊ท ์ ๋ํด์๋ ๋ณด์ฅ์ ๋ฐ์ ์ ์์ (analysis๊ฐ๋ฅ)
initial์ ๋ฌด์กฐ๊ฑด ์ .ํ.ํ ์์์ผ ํ๋ค๋ ๊ฒ์ด ์๋! ์ฌ๋ฌ๋ฒ์ trial์ ํด์ผํจ
๏ฌ Linear PDE https://m.blog.naver.com/pmw9440/221442252220
๏จ All partial derivatives appear in a linear form (first degree in the unknown function ๐ข and its derivatives)
๏จ โANDโ none of the coefficients depend on the dependent variable
๐ข ๐ข 0, ๐ข c ๐ข , ๐๐ข ๐๐ฅ๐ข 0
๏ฌ Nonlinear PDE
Variable coefficient linear PDE
๏จ The derivatives appear in a nonlinear form depends on โindependentโ variable
๏จ โORโ the coefficients depend on the dependent variable
๐ข๐ข ๐๐ข 0, ๐๐ข ๐๐ข
4 / 41
โข Order of PDE
๏ฌ๏ The highest-order derivative
๐ ๐ข ๐๐ข
0 โ 2 ๐๐๐๐๐ ๐๐ฅ ๐๐ฆ
โข Homogeneous vs Nonhomogeneous
๏ฌ๏ Homogeneous PDE
๏จ๏ each of the terms contains ๐ข or the dependent variables or its partial derivatives.
๐ข ๐ข 0
๐ข๐ข ๐๐ข 0 ๐๐ข ๐๐ข 0
๏ฌ๏ Nonhomogeneous PDE
โ ๐ข ๐ข ๐ข ๐ข ๐ ๐ฅ, ๐ฆ, ๐ง
5 / 41
โข Classification of PDEs using characteristics analysis
๏จ๏ Consider the general quasilinear 2nd order nonhomogeneous PDE in 2D:
๐ด๐ข ๐ต๐ข ๐ถ๐ข ๐น ๐ฅ, ๐ฆ, ๐ข, ๐ข , ๐ข
๏ฌ Parabolic equation (๐ต
๏ฌ Hyperbolic equation (๐ต 4๐ด๐ถ
4๐ด๐ถ Quasilinear : linear in the highest-order derivative
0) ์๋์ง๊ฐ ๋ง๋ค๋ฉด, ์จ ์ฌ๋ฐฉ์ ๊ท ์ผํ๊ฒ ๋๋ ์ค๋ชจ๋์ฑ์ด ์ฌ๋ผ์ง๋ ๊ทธ๋ฆผ ์๊ฐํ๋ฉด ์ข์ ๋ชจ์์ด ํฌ๋ฌผ์ ๊ฐ์์!
๐ โ ๐ข : Diffusion equation 0)
ํ๋๊ฐ ์ณ์ ์ค๋ ๋ชจ์!
u(x,t)์ y๋ผ๋ ์์ ์จ์ ํํ์ด๋ ํด๋ฒ๋ฆฌ์
๐ โ ๐ข : Wave equation t์ถ๊ณผ x์ถ์ด ์์ ๋, ๋งค๊ฐ์ฒด๊ฐ c:์๋
c์ t๋ฅผ ๊ณฑํ๋ฉด ๊ฐ ๊ฑฐ๋ฆฌ๊ฐ ๋๋, y = x – ct๋ก ํ๋ฉด 1๋ณ์๋ก ๋ฐ๋
u(x,t) ==> f(x-ct) + f(x+ct) : solution์ด dependentํจ
๏ฌ๏ Elliptic equations (๐ต 4๐ด๐ถ 0)
โ ๐ข 0
โ ๐ข ๐ ๐ฅโ : Laplace equation (homogeneous) and Poisson equation (nonhomogeneous)
Heat equation์ steady stationary condition์ด๋ฉด laplace eq.
โ> ์๊ฐ์ ๋ํ ์์๊ฐ ์์
โ> diffusion eq. solution์ด ๋ณํ์ง ์์ ๋๊น์ง ๊ฐ๋ ๊ฒ ( time scale์ด ์์ด
6 / 41
โข Classification of PDEs using characteristics analysis
๏ฌ๏ The terminology elliptic, parabolic, and hyperbolic chosen to classify PDEs reflects the analogy between the from of the discriminant ๐ฉ๐ ๐๐จ๐ช
๏จ๏ (from the idea of dโAlembertโs solution, methods of characteristics) ๏จ๏ And that which classifies conic section.
๐ด๐ฅ ๐ต๐ฅ๐ฆ ๐ถ๐ฆ ๐ท๐ฅ ๐ธ๐ฆ ๐น 0
Type Defining condition Examples
Parabolic ๐ต 4๐ด๐ถ 0 Diffusion equation
Hyperbolic ๐ต 4๐ด๐ถ 0 Wave equation
Elliptic ๐ต 4๐ด๐ถ 0 Laplace/Poisson equation
๐ด๐ข ๐ต๐ข ๐ถ๐ข ๐น ๐ฅ, ๐ฆ, ๐ข, ๐ข , ๐ข
https://en.wilipedia.org/wiki/
7 / 41
โข Classification of PDEs using characteristics analysis
๏ฌ Characteristics
๏จ Propagate behavior of each fixed point on the space at the โHyperโ space( ๐ 1 D space for ๐D PDE) ๏จ๏ Information, ๐ข (velocity, temperature, pressure etc.) propagates along path.
๏ฌ Are there any points in the solution domain ๐ท ๐ฅ, ๐ฆ passing through a general point ๐ along which the second derivatives of ๐ข x, y are multivalued or discontinuous (kernel space)?
๏จ Homogeneous solution
๏จ If there are such paths, they are called path of information propagation ๏จ๏ Or Characteristics
8 / 41
โข Classification of PDEs using characteristics analysis
๏ฌ๏ Chain rule & Homogeneous solution (Kernel space)
๐ ๐ข ๐ข ๐๐ฅ ๐ข ๐๐ฆ
๐ด
๐๐ฅ
๐ต
๐๐ฆ
๐๐ฅ ๐ถ
๐๐ฆ ๐ข
๐ข
๐ข
๐ข ๐๐ฆ
๐ด ๐ต ๐ถ
โ det ๐๐ฅ ๐๐ฆ 0
๐๐ฅ ๐๐ฆ
0
Discriminant Characteristics Type
๐ต 4๐ด๐ถ 0 Real & Repeated Parabolic
๐ต 4๐ด๐ถ 0 Real & Distinct Hyperbolic
๐ต 4๐ด๐ถ 0 Complex Elliptic
๐๐ฆ ๐ต ๐ต 4๐ด๐ถ
โ
๐๐ฅ 2๐ด
9 / 41
โข Classification of PDEs using characteristics analysis
๏ฌ Parabolic PDEs have one real repeated characteristic path (Critical damping, diffusing)
๏ฌ Hyperbolic PDEs of two real distinct characteristic paths (Overdamping, diffusing)
๏ฌ Elliptic PDEs have no real characteristic paths (Oscillatory)
10 / 41
One-dimensional PDEs
โข 1D Heat equation
๏ฌ Semi-discretization
๏ฌ Temporal discretization
๏ฌ Stability analysis
๏จ Eigenvalue/Eigenvector analysis
๏จ Modified wavenumber analysis
๏จ von Neumann analysis
๏ฌ Accuracy via modified equation
๏ฌ Example 1
โข 1D Wave equation
๏ฌ Semi-discretization
๏ฌ Stability analysis
๏จ๏ Modified wavenumber analysis
๏ฌ Example 2
11 / 41
Full๋ก ํ๋ ค๋ ๋๋ฌด ์จ์ผํ๋๊ฒ ๋ง์..!! 1D Heat equation
โข Semi-discretization – Solving a PDE as a system of ODEs
๏ฌ Numerical methods for PDEs are straightforward extensions of methods developed for initial and boundary value problems in ODEs.
๏ฌ That is, a PDE can be converted to a system of ODEs by using finite difference methods for the derivatives in all but one of dimensions.
๏ฌ Consider the one-dimensional diffusion(or heat equation)
๐๐ ๐ ๐ Initial condition : ๐ ๐ฅ, 0 ๐ ๐ฅ
๐๐ก ๐ผ ๐๐ฅ Boundary condition : ๐ 0, ๐ก ๐ ๐ฟ, ๐ก 0
๏ฌ Discretization of the Domain with ๐ intervals โ ๐ 1 uniformly spaced grid points
ฮ๐ฅ ฮ๐ฅ
๐ฅ ๐ฅ ๐ฅ ๐ฅ ๐ฅ ๐ฅ ๐ฅ ๐ฅ ๐ฅ ฮ๐ฅ
๐ 0, ๐ ๐ are the boundaries
๐ 1, 2, 3, โฏ , ๐ 1 are interior points
12 / 41
๊ณต๊ฐ์ฐจ๋ถ ๋จผ์ (x(j)์์ )
Semi-discretization
๏ฌ Letโs use the second-order central difference scheme to the second derivative.
๐๐ ๐ 2๐ ๐
๐ผ , ๐ 1,2,3, โฏ , ๐ 1 ๐๐ก ฮ๐ฅ
Where ๐ ๐ ๐ฅ, ๐ก
๏ฌ A system of ๐ 1 ordinary differential equations
๏จ Space derivatives for fixed time (โ Semi-discretization) and solving time marching as solving ODEs.
๏จ Can be written in matrix form as:
๐๐
๐ด๐
๐๐ก
๏จ Where as ๐ are the (time-dependent) elements of the vector ๐, and ๐ด is an ๐ 1 ๐ 1 tridiagonal
matrix.
13 / 41
Semi-discretization
2 1 โฏ
๐ผ 1 2 1
๐ด
ฮ๐ฅ โฑ โฑ โฑ
1 2
โ ๐ 1 ๐ 1 tridiagonal matrix which is symmetric
๏ฌ The result is a system of ODEs that can be solved using any of the numerical methods introduced for ODEs, such as Euler methods, RK formulas or multi-step methods.
๏ฌ However, when dealing with systems, we should be concerned about stability.
๏ฌ The range of the eigenvalues of ๐ด determines whether the system is stable.
๐ด๐ ๐๐ โ det ๐ด ๐๐ผ 0
14 / 41
Temporal discretization
โข (Recall) Various time advancement schemes
๐๐
๐ด๐
๐๐ก
๏ฌ Forward Euler scheme
๐ ๐
๐ด๐
ฮ๐ก
๏ฌ Backward Euler scheme
๐ ๐
๐ด๐
ฮ๐ก
๏ฌ Crank-Nicolson scheme
๐ ๐
๐ด
ฮ๐ก
15 / 41
โข Eigenvalue/Eigenvector analysis
๏ฌ (Recall) Diagonalization, Eigenvalues, ฮ & Eigenvectors(Eigenfunctions), ๐
๏จ๏ Diagonalization (Decoupling)
๏ผ๏ Suppose ๐ด has the eigenvalues (๐๐. ๐ด is diagonalizable),
๐ ๐ด๐ ฮ โ ๐ด ๐ฮ๐
๐๐ ๐๐๐๐
๐ด๐ โ ๐ฮ๐ ๐ โ ๐ ฮ๐ ๐
๐๐ก ๐๐ก๐๐ก
๐ ๐ ๐๐๐
ฮ๐ ๐ โ ฮ๐, ๐ ๐ ๐
๐๐ก๐๐ก
๐๐
๐๐ โ ๐ ๐๐ โ ๐ ๐
๐๐ก
๐
0
โฎ ๐ 0
๐
โฎ โฏ ๐ 0
0
โฎ
0 0 ๐
๐ ๐ ๐ โ ๐ ๐๐
16 / 41
๏ฌ Analytical expressions of eigenvalues of the matrix ๐ด
๐๐
๐2 2 cos, ๐ 1,2,3, โฏ , ๐ 1
๐
๏ฌ The eigenvalue with the smallest (๐ 1) and the largest magnitude (๐ ๐ 1) is:
๐ผ ๐
๐2 2 cos, ๐2 2 cos ฮ๐ฅ ๐
๏จ For large, ๐, the Taylor series expansion for cos converges rapidly, and cos converges to -1.
๐ 1๐ ๐ 1
cos 1 โฏ , cos ๐๐๐ ๐ 1
๐ 2!๐
๏จ Using the first two terms in the expansion then,
๐ ๐ผ
๐ ,
๐ ฮ๐ฅ
17 / 41
๐ ๐ผ
๐ 4 ,
๐ ฮ๐ฅ ๐ ๐ผ
4
ฮ๐ฅ
๏ฌ The ratio of the eigenvalue with the largest modulus to that with the smallest modulus is :
๏จ For large N, the system is unstable!
18 / 41
frequency : 1์ด๋น ์ง๋์ Wavenumber : wave์ ์ซ์
โข Modified wavenumber analysis ๊ณต๊ฐ์ฐจ๋ถ์ ์ด๋ป๊ฒ ํ๋์ ๋ํด์ ๊ฒฐ์ ๋จ
๏ฌ๏ Let revisit the heat equation,
๐ผ
cos ๐ฮ๐ฅ
๐๐ก
๐๐
๐ผ๐โฒ ๐
๐๐ก
2
๐โฒ1 cos ๐ฮ๐ฅ
ฮ๐ฅ
๏จ ๐ผ๐ ๐
๐ ๐๐
๏จ Using the forward Euler for time advancement,
2๐ผ
1 cos ๐ฮ๐ฅ ๐
ฮ๐ก ฮ๐ฅ
2 2
ฮ๐ก โ ฮ๐ก
๐ 2๐ผ 1 cos ๐ฮ๐ฅ
ฮ๐ฅ
๏จ Since, 1 cos ๐ฮ๐ฅ 1, the worst-case scenario is :
ฮ๐ฅ
ฮ๐ก
2๐ผ
20 / 41
๐ผ๐
ฮ๐ก
1 ๐
๏ผ For the stability analysis,
๐๐
๐ผ๐โฒ ๐
๐๐ก
2
๐โฒ1 cos ๐ฮ๐ฅ
ฮ๐ฅ
๐ ๐๐
Where ๐ โ ๐ 1
๏จCrank-Nicolson is unconditionally stable
21 / 41
๐๐
๐ผ๐โฒ ๐
๐๐ก
2
๐โฒ1 cos ๐ฮ๐ฅ
ฮ๐ฅ
๏จ Using backward Euler
๐ผ๐ ๐
ฮ๐ก
1 ๐ ๐
๏ผ For the stability analysis,
๐ ๐พ๐
1 1
Where ๐พ โ ๐พ 1
๏จBackward Euler is unconditionally stable
๏ผ However, in contrast to Crank-Nicolson, ๐ โ 0 when ฮ๐ก โ โ. That is, the solution does not exhibit undesirable oscillations (although it would be inaccurate).
22 / 41
๏ฌ๏ Consider the wave equation,
๐๐ข ๐๐ข
๐ 0, 0 ๐ฅ ๐ฟ, ๐ก 0
๐๐ก ๐๐ฅ
๏จ Assuming, ๐ข ๐ฅ, ๐ก ๐ฃ ๐ก ๐
๐๐ฃ๐๐ฃ
๐ ๐๐๐ ๐ ๐ฃ โ ๐๐๐ ๐ฃ Modified wavenumber
๐๐ก๐๐ก
๏จ Semi-discretized equation with central difference scheme,
๐๐ข ๐ข ๐ข ๐๐ฃ sin ๐ฮ๐ฅ
๐ 0 โ ๐๐ ๐ฃ ๐๐๐๐ฃ
๐๐ก 2ฮ๐ฅ ๐๐ก ฮ๐ฅ
23 / 41
โข von Neumann stability analysis
๏ฌ Matrix stability analysis using the eigenvalues of the matrix obtained from a semi-discretization of
PDE
๏จ This is only available for very simple matrices ๏ฌ๏ Consider full discretization of PDE
๏จ von Neumann stability analysis does not account for the effect of boundary conditions; periodic boundary conditions are assumed.
๏จ Linear, constant coefficient differential equations with uniformly spaced spatial grids.
๐๐ ๐ ๐
๐ผ
๐๐ก ๐๐ฅ
๏ฌ Second-order central difference with the explicit Euler method
๐ ๐ ๐ 2๐ ๐
๐ผ
ฮ๐ก ฮ๐ฅ
๏ฌ Assuming a solution of the form
๐ ๐ ๐
24 / 41
๐๐2๐๐
๐ ๐ ๐ ๐ 2๐ ๐
Where ๐ฅ ๐ฅ ฮ๐ฅand ๐ฅ ๐ฅ ฮ๐ฅ.
๐ผฮ๐ก
๐ 12 cos ๐ฮ๐ฅ 2
ฮ๐ฅ
For stability, ๐ 1
2 cos ๐ฮ๐ฅ 1
๐ผฮ๐กฮ๐ฅ
2 cos ๐ฮ๐ฅ 2 โ ฮ๐ก
ฮ๐ฅ
The worst (or the most restrictive) case occurs when cos ๐ฮ๐ฅ
ฮ๐ฅ
ฮ๐ก
2๐ผ
25 / 41
Accuracy via modified equation
๏ฌ By 1 ๐ผ 2 ,
๐ ๐
๐ผ
๐๐ฅ
๏ฌ Consider the (unsteady) heat equation (or 1D diffusion equation) given by:
๏จ ๏ ๐ฅ ๐ฅ ฮ๐ฅ
๏ฌ Discretized equation:
28 / 41
๏ฌ Discretized equation:
๏จ The PDE has been converted to a system of ODEs
๏ฌ Time advancement
๏จ Using forward Euler,
๐ ๐ ฮ๐ก๐น ๐ , ๐ก
1,2,3, โฏ , ๐ 1
๐ผ
๐ 2๐
ฮ๐ฅ
๐ผ
๐ 2๐ ๐
ฮ๐ฅ
โฎ
๐ 1 ๐ sin ๐๐ฅ
๐ 1 ๐ sin ๐๐ฅ
29 / 41
๏ฌ๏ The stability of the numerical solution for time advancement depends on the eigenvalue of the system having the largest magnitude:
๐ผ
๐ 4
ฮ๐ฅ
๏จ When forward Euler is used for real and negative ๐:
2 ฮ๐ฅ
ฮ๐ก
2๐ผ
๏จ For ๐ผ 1 and ฮ๐ฅ 0.05,
ฮ๐ก 0.00125
30 / 41
โข Pseudo-code & Code
31 / 41
โข result
๏ฌ ฮ๐ก 0.001, ฮ๐ฅ 0.05, ๐ผ 1
๏ฌ ฮ๐ก 0.0015, ฮ๐ฅ 0.05, ๐ผ 1
32 / 41
(dissipatio i ์๋์ง๊ฐ์ ์ ์์ด์ง n dispersion: ์๋์ง๊ฐ์ ์ ๋ง์์ง? p ์๊ฐ์ด์ง๋๋๋ชจ์์ด๋ณํ์ง์์์ผํจ .
๏ฌ Consider a semi-discretization of the following first-order wav1diD Wave equationssipation๋๋ๅๆๆจ e equation :์ฐจ๋ถํํ ๋ ,์๋ด๊ทธ์๋๊ฐ์์ํ๋ํ๋ชจ์์ด์๋๊ฒฉ์์์์?!์น์
๏จ aka the convection/transport equation ๊ทธ๋์์ด๋ ต๋ค. (FDM),
๐๐ข ๐๐ข Initial condition : ๐ข ๐ฅ, 0 ๐ ๐ฅ
๐ 0
๐๐ก ๐๐ฅ Boundary condition : ๐ข 0, ๐ก ๐ ๐ฟ, ๐ก 0 ๅฒฌๅท์ถ์๋ฐ’
๏จ A simple model equation for the convection phenomena. l l h t l l l r
๏จ The exact solution is such that an initial disturbance in the domain (๐ข ๐ฅ, 0 ) simply propagates with the constant convection speed ๐ in the positive (or negative) ๐ฅ-direction.
33 / 41
๐๐ข ๐๐ข
๐ 0
๐๐ก ๐๐ฅ
Semi-discretization
๏ฌ๏ Semi-discretization
๏จ Assume ๐ 0, and using central difference scheme, ์๊ฐ์๋ํ์ฐจ๋ถX c ๊ณต๊ฐ์๋ํ์ฐจ๋ถ0.
๐๐ข ๐ข ๐ข
๐ 0
๐๐ก 2ฮ๐ฅ ์ System o f ODE๊ฐ๋จ .
๏จ In matrix from,
๐๐ข
๐ด๐ข
๐๐ก
0 1 โฏ
1 0 1 where ๐ด ๐ 1 ๐ 1 tridiagonal matrix which is not symmetric
โฑ โฑ โฑ
1 0
๏ผ From analytical consideration, no boundary condition is prescribed at ๐ฅ ๐ฟ.
๏ผ However, a special numerical boundary treatment is required at ๐ฅ ๐ฟ owing to the use of central differencing in this problem.
๏ผ A typical well-behaved numerical boundary treatment at ๐ฅ ๐ฟ slightly modifies the last row of the coefficient matrix ๐ด, but we will ignore it for now.
34 / 41
๏จ Thus, the eigenvalues of the matrix resulting from semi-discretization of the convection equation are purely imaginary N ๋ฐ๋์ด๋ถ๋๋ฐฉํฅ์ผ๋กN . balanced๋ stability์จ๋
upwind ์ข์ง์์์๊ฒฐ๊ตญ Upwind .
๐ ๐๐
๐ ๐๐, where ๐ cos
ฮ๐ฅ ๐
๏จ The solution is a superposition of modes, where each modeโs temporal behavior is given by ๐ ๏จ๏ Oscillatory or sinusoidal(non-decaying) character.
35 / 41
๐๐ฃ
๐๐๐๐ฃ
๐๐ก
sin ๐ฮ๐ฅ
๐
ฮ๐ฅ
Stability analysis
๏จ Leap flog method for time advancement,
๐ฃ ๐ฃ sin ๐ฮ๐ฅ
๏ฌ Consider the numerical solution to the homogeneous convection equation
๐๐ข ๐๐ข
๐ 0
๐๐ก ๐๐ฅ 0
๐ก ๐ฅ ๐ฟ 0
๏จ Initial conditions: ๐ข ๐ฅ, 0 ๐ .
๏จ Boundary conditions: ๐ข 0, ๐ก 0
๏จ Although the proper spatial domain for this PDE is semi-infinite, numerical implementation requires a finite domain.
๏จ Thus, we arbitrarily truncate the domain to 0 ๐ฅ 1
๏ฌ Semi-discretized equation using a 2nd order central difference scheme:
๐๐ข ๐ข ๐ข
๐ 0
๐๐ก 2ฮ๐ฅ
37 / 41
โข Pseudo-code & Code
๐ฅ
๐ก
๐ข u โ e
0
๐ โ 1
๐๐ข๐๐ก
๐๐ข๐๐ก
๐๐ข๐๐ก Program solve_wave_eq
โ 0, ๐ฅ โ 0.75
โ 0, ๐๐ก โ 21 ๐๐ก โ 0.01, ๐๐ฅ โ 0.01
.
โ 0
๐ถ๐๐๐ ๐ธ๐ข๐๐๐ ๐๐ ๐
๐พ4 ๐ก, ๐ข, ๐๐ก, ๐๐ก, ๐ค๐๐ฃ๐๐๐, ๐ฅ, ๐๐ฅ
End program
Function waveeq(T, t, x, dx)
โ
โ
๐๐๐ก๐ข๐๐ ๐๐ข๐๐ก
End function
38 / 41
๐ฅ
๐ก
๐ข u โ e
0
๐ โ 1
๐๐ข๐๐ก
๐๐ข๐๐ก
๐๐ข๐๐ก Program solve_wave_eq
โ 0, ๐ฅ โ 0.75
โ 0, ๐๐ก โ 21 ๐๐ก โ 0.01, ๐๐ฅ โ 0.01
.
โ 0
๐ถ๐๐๐ ๐ธ๐ข๐๐๐ ๐๐ ๐
๐พ4 ๐ก, ๐ข, ๐๐ก, ๐๐ก, ๐ค๐๐ฃ๐๐๐, ๐ฅ, ๐๐ฅ
End program
Function waveeq(T, t, x, dx)
โ
โ
๐๐๐ก๐ข๐๐ ๐๐ข๐๐ก
End function
โข Pseudo-code & Code
39 / 41
๐๐๐๐ค๐๐๐ ๐ธ๐ข๐๐๐: ๐ถ๐น๐ฟ 1
๐
๐พ4: ๐ถ๐น๐ฟ 2.83
โข result ฮ๐ก 0.01, ฮ๐ฅ 0.01, ๐ 1)
๏ฌ๏ Euler method ๏ฌ๏ Fourth order Runge-Kutta method
Q&A Thanks for listening




Reviews
There are no reviews yet.