Ecuaciones diferenciales en derivadas parciales
Pedro CorcueraDpto. Matemática Aplicada y Ciencias de la ComputaciónUniversidad de Cantabria
Ec. derivadas parciales 2
Objetivos
• Revisión de las ecuaciones diferenciales en derivadas parciales y técnicas de solución
Ec. derivadas parciales 3
Diferenciación
• The mathematical definition of a derivative begins with a difference approximation:
and as ∆x is allowed to approach zero, the difference becomes a derivative:
Ec. derivadas parciales 4
Diferenciación de funciones continuas
∆y∆x
=f xi + ∆x( )− f xi( )
∆x
dydx
= lim∆x→0
f xi + ∆x( )− f xi( )∆x
• Taylor series expansion can be used to generate high-accuracy formulas for derivatives by using linear algebra to combine the expansion around several points.
• Three categories for the formula include forward finite-difference, backward finite-difference, and centered finite-difference.
Ec. derivadas parciales 5
Fórmulas de diferenciación de gran exactitud
For a finite
Ec. derivadas parciales 6
Aproximación por diferencia en adelanto
( ) ( ) ( )x
xfxxfx
xfΔ
Δ0Δ
lim −+→
=′
( ) ( ) ( )x
xfxxfxf∆
−∆+≈′'Δ' x
x x+Δx
f(x)
Graphical Representation of forward difference approximation of first derivative.
• The velocity of a rocket is given by
• Where is given in m/s and is given in seconds.a)Use forward difference approximation of the first derivative
of to calculate the acceleration at . Use a step size of .
b)Find the exact value of the acceleration of the rocket.c) Calculate the absolute relative true error for part (b).
Ec. derivadas parciales 7
Aproximación por diferencia en adelanto -ejemplo
( ) 300,8.921001014
1014ln2000 4
4
≤≤−
−×
×= tt
ttν
''ν ''t
( )tν st 16=st 2Δ =
• Solution
Ec. derivadas parciales 8
Aproximación por diferencia en adelanto -ejemplo
( ) ( ) ( )t
ttta iii ∆
−≈ + νν 1 16=it 2Δ =t
182161 =+=∆+=+ ttt ii
( ) ( ) ( )2
161816 νν −≈a
( ) ( ) ( )188.91821001014
1014ln200018 4
4
−
−××
=ν m/s02.453=
( ) ( ) ( )168.91621001014
1014ln200016 4
4
−
−××
=ν m/s07.392=
Hence( ) ( ) ( )
2161816 νν −
≈a2
07.39202.453 −≈ 2m/s474.30≈
The exact value of ( )16a can be calculated by differentiating b)
a)
( ) tt
t 8.921001014
1014ln2000 4
4
−
−×
×=ν as ( ) ( )[ ]tν
dtdta =
Ec. derivadas parciales 9
Aproximación por diferencia en adelanto -ejemplo
Knowing that
( )[ ]t
tdtd 1ln = and 2
11ttdt
d−=
( ) 8.921001014
10141014
210010142000 4
4
4
4
−
−×
×
×
−×=
tdtdtta
( ) ( ) ( ) 8.9210021001014
101411014
210010142000 24
4
4
4
−−
−×
×−
×
−×=
tt
tt
32004.294040
+−−−
=
( ) ( )( )163200
164.29404016+−
−−=a 2m/s674.29=
c) The absolute relative true error is
100Value True
Value eApproximat-Value True⋅=∈t 100
674.29474.30674.29 x−
= %6967.2=
Ec. derivadas parciales 10
Efecto del tamaño de paso en el método de diferencia dividida en adelanto
xexf 49)( =
)2.0(f ′Value of´ using forward difference method.
h )2.0('f aE aε % Significant digits
tE tε %
0.05 88.69336 -8.57389 10.70138 0.025 84.26239 -4.430976 5.258546 0 -4.14291 5.170918 0.0125 82.15626 -2.106121 2.563555 1 -2.03679 2.542193 0.00625 81.12937 -1.0269 1.265756 1 -1.00989 1.260482 0.003125 80.62231 -0.507052 0.628923 1 -0.50284 0.627612 0.001563 80.37037 -0.251944 0.313479 2 -0.25090 0.313152 0.000781 80.24479 -0.125579 0.156494 2 -0.12532 0.156413 0.000391 80.18210 -0.062691 0.078186 2 -0.06263 0.078166 0.000195 80.15078 -0.031321 0.039078 3 -0.03130 0.039073 9.77E-05 80.13512 -0.015654 0.019535 3 -0.01565 0.019534 4.88E-05 80.12730 -0.007826 0.009767 3 -0.00782 0.009766
Ec. derivadas parciales 11
Efecto del tamaño de paso en el método de diferencia dividida en adelanto
0
1
2
3
4
5
6
0 1 2 3 4 5 6 7 8 9 10 11 12
Number of times step size halved, n
|Ea|
%
76
80
84
88
92
0 1 2 3 4 5 6 7 8 9 10 11 12
Number of times step size halved, n
f'(0.
2)
-5
-4
-3
-2
-1
00 2 4 6 8 10 12
Number of times step size halved, n
E a
0
1
2
3
4
1 2 3 4 5 6 7 8 9 10 11
Number of times step size halved, n
Leas
t nu
mbe
r of s
igni
fican
t dig
its
corre
ct
Ec. derivadas parciales 12
Efecto del tamaño de paso en el método de diferencia dividida en adelanto
-9
-6
-3
00 2 4 6 8 10 12
Number of times step size halved, n
E t
0
2
4
6
8
10
12
1 2 3 4 5 6 7 8 9 10 11
Number of times step size halved, n
|Et| %
• Sabemos que
• For a finite ,
• If is chosen as a negative number,
Ec. derivadas parciales 13
Aproximación por diferencia en atraso
( ) ( ) ( )x
xfxxfx
xfΔ
Δ0Δ
lim −+→
=′
'Δ' x ( ) ( ) ( )x
xfxxfxf∆
−∆+≈′
'Δ' x
( ) ( ) ( )x
xfxxfxf∆−
−∆−≈′ ( ) ( )
xxxfxf
ΔΔ−−
=
• This is a backward difference approximation as youare taking a point backward from x. To find the valueof at , we may choose another pointbehind as . This gives
where
Ec. derivadas parciales 14
Aproximación por diferencia en atraso
Graphical Representation of backward difference approximation of first derivative.
xx-Δxx
f(x)
( )xf ′ ixx = 'Δ' x1−= ixx
( ) ( ) ( )x
xfxfxf iii ∆
−≈′ −1
( ) ( )1
1
−
−
−−
=ii
ii
xxxfxf
1Δ −−= ii xxx
• Taylor’s theorem says that if you know the value of a function at a point and all its derivatives at that point, provided the derivatives are continuous between and , then
Substituting for convenience
Ec. derivadas parciales 15
Obtención de la adad a partir de las series de Taylor
f ix
ix 1+ix( ) ( ) ( )( ) ( ) ( ) +−
′′+−′+= +++
2111 !2 ii
iiiiii xxxfxxxfxfxf
ii xxx −= +1Δ( ) ( ) ( ) ( ) ( ) +
′′+′+=+
21 Δ
!2Δ xxfxxfxfxf i
iii
( ) ( ) ( ) ( ) ( ) +∆′′
−∆
−=′ + x
xfx
xfxfxf iii
i !21
( ) ( ) ( ) ( )xOx
xfxfxf iii ∆+
∆−
=′ +1
• The term shows that the error in the approxima-tion is of the order of . It is easy to derive from Taylor series the formula for backward divided difference approximation of the first derivative.
• As shown above, both forward and backward divided difference approximation of the first derivative are accurate on the order of .
• Can we get better approximations? Yes, another method is called the Central difference approxima-tion of the first derivative.
Ec. derivadas parciales 16
Obtención de la adad a partir de las series de Taylor
x∆( )xO ∆
( )xO ∆
• From Taylor series(1)
(2)
Subtracting equation (2) from equation (1)
Ec. derivadas parciales 17
Obtención de la adc a partir de las series de Taylor
( ) ( ) ( ) ( ) ( ) ( ) ( ) +′′′
+′′
+′+=+32
1 Δ!3
Δ!2
Δ xxf
xxf
xxfxfxf iiiii
( ) ( ) ( ) ( ) ( ) ( ) ( ) +′′′
−′′
+′−=−32
1 Δ!3
Δ!2
Δ xxf
xxf
xxfxfxf iiiii
( ) ( ) ( )( ) ( ) ( ) +∆′′′
+∆′=− −+3
11 !322 xxfxxfxfxf i
iii
( ) ( ) ( ) ( ) ( ) +∆′′′
−∆−
=′ −+ 211
!32x
xfx
xfxfxf iii
i
( ) ( ) ( ) ( )211
2xO
xxfxfxf ii
i ∆+∆−
=′ −+
• Hence showing that we have obtained a more accurate formula as the error is of the order of
Ec. derivadas parciales 18
Obtención de la adc a partir de las series de Taylor
( )2xO ∆
x
f(x)
x-Δx x x+Δx
Graphical Representation of central difference approximation of first derivative
• The velocity of a rocket is given by
• Where is given in m/s and is given in seconds.a)Use central divided difference approximation of the first
derivative of to calculate the acceleration at . Use a step size of .
b)Calculate the absolute relative true error for part (a).
Ec. derivadas parciales 19
Aproximación por diferencia central -ejemplo
( ) 300,8.921001014
1014ln2000 4
4
≤≤−
−×
×= tt
ttν
''ν ''t
( )tν st 16=st 2Δ =
• Solution
Ec. derivadas parciales 20
Aproximación por diferencia central -ejemplo
( ) ( ) ( )t
ttta iii ∆
−≈ −+
211 νν 16=it 2Δ =t
142161 =−=∆−=− ttt ii
( ) ( ) ( )22
141816⋅−
≈ννa
( ) ( ) ( )188.91821001014
1014ln200018 4
4
−
−××
=ν m/s02.453=
( ) ( ) ( )148.91421001014
1014ln200014 4
4
−
−××
=ν m/s24.334=
Hence( ) ( ) ( )
4141816 νν −
≈a4
24.33402.453 −≈
2m/s694.29≈
The absolute relative true error is knowing that the exact value atis
b)
a)
st 16=( ) 2m/s674.2916 =a
100674.29
694.29674.29⋅
−=∈t %069157.0=
182161 =+=∆+=+ ttt ii
Ec. derivadas parciales 21
Efecto del tamaño de paso en el método de diferencia dividida central
xexf 49)( =
)2.0(f ′Value of´ using forward difference method.
h )2.0('f aE aε % Significant digits
tE tε %
0.05 80.65467 -0.53520 0.668001 0.025 80.25307 -0.4016 0.500417 1 -0.13360 0.16675 0.0125 80.15286 -0.100212 0.125026 2 -0.03339 0.041672 0.00625 80.12782 -0.025041 0.031252 3 -0.00835 0.010417 0.003125 80.12156 -0.00626 0.007813 3 -0.00209 0.002604 0.001563 80.12000 -0.001565 0.001953 4 -0.00052 0.000651 0.000781 80.11960 -0.000391 0.000488 5 -0.00013 0.000163 0.000391 80.11951 -9.78E-05 0.000122 5 -0.00003 4.07E-05 0.000195 80.11948 -2.45E-05 3.05E-05 6 -0.00001 1.02E-05 9.77E-05 80.11948 -6.11E-06 7.63E-06 6 0.00000 2.54E-06 4.88E-05 80.11947 -1.53E-06 1.91E-06 7 0.00000 6.36E-07
Ec. derivadas parciales 22
Efecto del tamaño de paso en el método de diferencia dividida central
75
85
95
1 3 5 7 9 11
Number of times the step size is halved, n
f'(0.
2)
-1
01 3 5 7 9 11
Number of steps involved, n
E(a)
0
0.1
0.2
0.3
0.4
0.5
0.6
0 1 2 3 4 5 6 7 8 9 10 11 12
Number of steps involved, n
|E(a
)|,%
0
1
2
3
4
5
6
7
8
1 2 3 4 5 6 7 8 9 10 11
Number of steps involved, n
Leas
t nu
mbe
r of s
igni
fican
t dig
its
corre
ct
Ec. derivadas parciales 23
Efecto del tamaño de paso en el método de diferencia dividida central
-0.6
-0.5
-0.4
-0.3
-0.2
-0.1
0.00 2 4 6 8 10 12
Number of steps involved, n
E(t)
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
1 2 3 4 5 6 7 8 9 10 11
Number of times step size halved,n
|Et|
%
• The results from the three difference approximations are given in the following table.
Ec. derivadas parciales 24
Comparación de métodos adad, adat, adc
Type ofDifferenceApproximationForwardBackwardCentral
30.47528.91529.695
2.69672.5584
0.069157
Summary of a (16) using different divided difference approximations
( )16a( )2/ sm
%t∈
• In real life, one would not know the exact value of the derivative – so how would one know how accurately they have found the value of the derivative.
• A simple way would be to start with a step size and keep on halving the step size until the absolute relative approximate error is within a pre-specified tolerance.
• Take the example of finding for
at using the backward divided difference scheme.
Ec. derivadas parciales 25
Obtención del valor de la derivada con una tolerancia específica
( ) tt
t 8.921001014
1014ln2000 4
4
−
−×
×=ν
( )tv′
16=t
• The values obtained using the backward difference approximation method and the corresponding absolute relative approximate errors are given in the following table.
Ec. derivadas parciales 26
Obtención del valor de la derivada con una tolerancia específica
210.50.250.125
28.91529.28929.48029.57729.625
1.27920.647870.326040.16355
t∆ ( )tv′ %a∈ one can see that the absolute relative approximate error decreases as the step size is reduced. At the absolute relative approximate error is 0.16355%, meaning that at least 2 significant digits are correct in the answer.
125.0=∆t
Ec. derivadas parciales 27
Fórmulas de diferencia finita en adelanto
Ec. derivadas parciales 28
Fórmulas de diferencia finita en atraso
Ec. derivadas parciales 29
Fórmulas de diferencia finita centrada
Ec. derivadas parciales 30
Sistemas de ecuaciones lineales
• A matrix consists of a rectangular array of elements represented by a single symbol (example: [A]).
• An individual entry of a matrix is an element(example: a23)
Ec. derivadas parciales 31
Matrices
• Matrices where m=n are called square matrices.• There are a number of special forms of square
matrices:
Ec. derivadas parciales 32
Matrices especiales
Symmetric
A[ ]=5 1 21 3 72 7 8
Diagonal
A[ ]=a11
a22
a33
Identity
A[ ]=1
11
Upper Triangular
A[ ]=a11 a12 a13
a22 a23
a33
Lower Triangular
A[ ]=a11
a21 a22
a31 a32 a33
Banded
A[ ]=
a11 a12
a21 a22 a23
a32 a33 a34
a43 a44
• The elements in the matrix [C] that results from multiplying matrices [A] and [B] are calculated using:
Ec. derivadas parciales 33
Multiplicación matricial
cij = aikbkjk=1
n
∑
• Matrices provide a concise notation for representing and solving simultaneous linear equations:
Ec. derivadas parciales 34
Representación de Algebra Lineal
a11x1 + a12x2 + a13x3 = b1
a21x1 + a22x2 + a23x3 = b2
a31x1 + a32x2 + a33x3 = b3
a11 a12 a13
a21 a22 a23
a31 a32 a33
x1
x2
x3
=
b1
b2
b3
[A]{x} = {b}
• MATLAB provides two direct ways to solve systems of linear algebraic equations [A]{x}={b}:– Left-divisionx = A\b
– Matrix inversionx = inv(A)*b
• The matrix inverse is less efficient than left-division and also only works for square, non-singular systems.
Ec. derivadas parciales 35
Solución con Matlab
• Recall that if a matrix [A] is square, there is another matrix [A]-1, called the inverse of [A], for which [A][A]-1=[A]-1[A]=[I]
• The inverse can be computed in a column by column fashion by generating solutions with unit vectors as the right-hand-side constants:
Ec. derivadas parciales 36
Matriz inversa
A[ ] x1{ }=100
A[ ] x2{ }=
010
A[ ] x3{ }=
001
A[ ]−1 = x1 x2 x3[ ]
• Recall that LU factorization can be used to efficiently evaluate a system for multiple right-hand-side vectors - thus, it is ideal for evaluating the multiple unit vectors needed to compute the inverse.
• Many systems can be modeled as a linear combination of equations, and thus written as a matrix equation:
• The system response can thus be found using the matrix inverse.
Ec. derivadas parciales 37
Matriz inversa y sistemas estímulo -respuesta
Interactions[ ] response{ }= stimuli{ }
• A norm is a real-valued function that provides a measure of the size or “length” of multi-component mathematical entities such as vectors and matrices.
• Vector norms and matrix norms may be computed differently.
Ec. derivadas parciales 38
Normas vectoriales y matriciales
• For a vector {X} of size n, the p-norm is:
• Important examples of vector p-norms include:
Ec. derivadas parciales 39
Normas vectoriales
ini
n
iie
n
ii
xXp
xXXp
xXp
maxmagnitudemaximum:
(length) normEuclidian :2
valuesabsolute theof sum:1
1
1
22
11
≤≤∞
=
=
=−∞=
===
==
∑
∑
X p = xip
i=1
n
∑
1/ p
• Common matrix norms for a matrix [A] include:
• Note - µmax is the largest eigenvalue of [A]T[A].
Ec. derivadas parciales 40
Normas matriciales
column - sum norm A 1 =1≤ j≤nmax aij
i=1
n
∑
Frobenius norm A f = aij2
j=1
n
∑i=1
n
∑
row - sum norm A∞
=1≤i≤nmax aij
j=1
n
∑spectral norm (2 norm) A
2= µmax( )1/2
• The matrix condition number Cond[A] is obtained by calculating Cond[A]=||A||·||A-1||
• In can be shown that:
• The relative error of the norm of the computed solution can be as large as the relative error of the norm of the coefficients of [A] multiplied by the condition number.
• If the coefficients of [A] are known to t digit precision, the solution [X] may be valid to onlyt-log10(Cond[A]) digits.
Ec. derivadas parciales 41
Número de condición de una matriz
∆XX
≤ Cond A[ ]∆AA
• MATLAB has built-in functions to compute both norms and condition numbers:– norm(X,p)
• Compute the p norm of vector X, where p can be any number, inf, or ‘fro’ (for the Euclidean norm)
– norm(A,p)
• Compute a norm of matrix A, where p can be 1, 2, inf, or ‘fro’ (for the Frobenius norm)
– cond(X,p) or cond(A,p)• Calculate the condition number of vector X or matrix A using
the norm specified by p.Ec. derivadas parciales 42
Comandos Matlab
• The Gauss-Seidel method is the most commonly used iterative method for solving linear algebraic equations [A]{x}={b}.
• The method solves each equation in a system for a particular variable, and then uses that value in later equations to solve later variables. For a 3x3 system with nonzero elements along the diagonal, for example, the jth iteration values are found from the j-1th iteration using:
Ec. derivadas parciales 43
Método iterativo: Gauss - Seidel
x1j =
b1 − a12x2j−1 − a13x3
j−1
a11
x2j =
b2 − a21x1j − a23x3
j−1
a22
x3j =
b3 − a31x1j − a32x2
j
a33
• The Jacobi iteration is similar to the Gauss-Seidel method, except the j-1th information is used to update all variables in the jth iteration:
a) Gauss-Seidelb) Jacobi
Ec. derivadas parciales 44
Iteración de Jacobi
• The convergence of an iterative method can be calculated by determining the relative percent change of each element in {x}. For example, for the ithelement in the jth iteration,
• The method is ended when all elements have converged to a set tolerance.
Ec. derivadas parciales 45
Convergencia
%1001
, ×−
=−
ji
ji
ji
ia xxxε
• The Gauss-Seidel method may diverge, but if the system is diagonally dominant, it will definitely converge.
• Diagonal dominance means:
Ec. derivadas parciales 46
Dominancia diagonal
aii > aijj=1j≠i
n
∑
• To enhance convergence, an iterative program can introduce relaxation where the value at a particular iteration is made up of a combination of the old value and the newly calculated value:
where λ is a weighting factor that is assigned a value between 0 and 2.– 0<λ<1: underrelaxation– λ=1: no relaxation– 1<λ≤2: overrelaxation
Ec. derivadas parciales 47
Relajación
( ) oldnewnew 1 iii xxx λλ −+=
Ec. derivadas parciales 48
Ecuaciones diferenciales en derivadas parciales
• Ordinary Differential Equations have only one independent variable
• Partial Differential Equations have more than one independent variable
• subject to certain conditions: where u is the dependent variable, and x and y are the independent variables.
Ec. derivadas parciales 49
Ecuaciones en derivadas parciales
5)0(,353 2 ==+ − yeydxdy x
222
2
2
2
3 yxyu
xu
+=∂∂
+∂∂
• where are functions of , and . is a function of
• can be:Elliptic if B2 – 4AC < 0Parabolic if B2 – 4AC = 0Hyperbolic if B2 – 4AC > 0
Ec. derivadas parciales 50
Clasificación de EDPs de 2 orden
02
22
2
2
=+∂∂
+∂∂
∂+
∂∂ D
yuC
yxuB
xuA
, , and , .u ux y ux y
∂ ∂∂ ∂
CBA and,, yx andD
• EllipticLaplace equation
• ParabolicHeat equation
• Hyperbolic Wave equation
Ec. derivadas parciales 51
Ejemplos de EDPs de 2 orden
02
2
2
2
=∂∂
+∂∂
yT
xT
2
2
xTk
tT
∂∂
=∂∂
2
2
22
2 1ty
cxy
∂∂
=∂∂
2
1,0,1c
CBA −===
0,0, === CBkA
1,0,1 === CBA
• Schematic diagram of a plate with specified temperature boundary conditions
• The Laplace equation governs the temperature:
Ec. derivadas parciales 52
Ejemplo físico de una PDE elíptica
02
2
2
2
=∂∂
+∂∂
yT
xT
bT
lT
tT
rT
L
W
x
y
Ec. derivadas parciales 53
Discretizando la PDE elíptica
tT
rT
x
y
),( ji ),1( ji +
)1,( −ji
),1( ji −
)1,( +ji
)0,0()0,(m
),0( n
bT
lT ),( ji
x∆
y∆x∆y∆
mLx =∆
nWy =∆
( )22
2 ),(),(2),(),(x
yxxTyxTyxxTyxxT
∆∆−+−∆+
≅∂∂
( )22
2 ),(),(2),(),(y
yyxTyxTyyxTyxyT
∆∆−+−∆+
≅∂∂
Ec. derivadas parciales 54
Discretizando la PDE elíptica
tT
rT
x
y
),( ji ),1( ji +
)1,( −ji
),1( ji −
)1,( +ji
)0,0()0,(m
),0( n
bT
lT ),( ji
x∆
y∆x∆y∆
( )2,1,,1
,2
2 2x
TTTxT jijiji
ji ∆
+−≅
∂∂ −+
( )21,,1,
,2
2 2y
TTTyT jijiji
ji ∆
+−≅
∂∂ −+
( )22
2 ),(),(2),(),(x
yxxTyxTyxxTyxxT
∆∆−+−∆+
≅∂∂
( )22
2 ),(),(2),(),(y
yyxTyxTyyxTyxyT
∆∆−+−∆+
≅∂∂
• Substituting these approximations into the Laplace equation yields:
• if,• the Laplace equation can be rewritten as
(Eq. 1)• there are several numerical methods that can be used to solve the
problem:Direct MethodGauss-Seidel MethodLieberman Method
Ec. derivadas parciales 55
Discretizando la PDE elíptica
02
2
2
2
=∂∂
+∂∂
yT
xT
( ) ( )0
222
1,,1,2
,1,,1 =∆
+−+
∆
+− −+−+
yTTT
xTTT jijijijijiji
yx ∆=∆
04 ,1,1,,1,1 =−+++ −+−+ jijijijiji TTTTT
• Consider a plate that is subjected to the boundary conditions shown below. Find the temperature at the interior nodes using a square grid with a length of by using the direct method.
Ec. derivadas parciales 56
Ejemplo 1: Método directo
mm 0.34.2 ×
m6.0
C°50
C°75
C°300
C°100
m4.2
m0.3
x
y
L
W
• We discretize the plate by taking,
• The nodal temperatures at the boundary nodes are given by:
Ec. derivadas parciales 57
Ejemplo 1: Método directo
myx 6.0=∆=∆
x
y
0,0T0,1T 0,2T 0,3T 0,4T
1,0T
2,0T
3,0T
4,0T
5,0T
1,1T 1,2T 1,3T 1,4T
2,1T 2,2T 2,3T 2,4T
3,1T 3,2T 3,3T 3,4T
4,1T 4,2T4,3T 4,4T
5,1T 5,2T 5,3T 5,4TC°300
C°100
C°50
C°75
3,2,1,3003,2,1,50
4,3,2,1,100
4,3,2,1,75
5,
0,
,4
,0
==
==
==
==
iTiT
jTjT
i
i
j
j
4=∆
=x
Lm 5=∆
=y
Wn
• the equation for the temperature at the node (2,3)
• i=2 and j=3
Ec. derivadas parciales 58
Ejemplo 1: Método directo
x
y
0,0T0,1T 0,2T 0,3T 0,4T
1,0T
2,0T
3,0T
4,0T
5,0T
1,1T 1,2T 1,3T 1,4T
2,1T 2,2T 2,3T 2,4T
3,1T 3,3T 3,4T
4,1T 4,2T4,3T 4,4T
5,1T 5,2T 5,3T 5,4T
3,2T
04 3,22,24,23,13,3 =−+++ TTTTT04 3,34,23,22,23,1 =++−+ TTTTT
04 ,1,1,,1,1 =−+++ −+−+ jijijijiji TTTTT
• We can develop similar equations for every interior node leaving us with an equal number of equations and unknowns.
• For this problem the number of equations generated is 12
Ec. derivadas parciales 59
Ejemplo 1: Método directo
• The corner nodal temperature of are not needed• To get the temperature at the interior nodes we have to write Equation 1
for all the combinations of i and j, i=1 and j=1i=1 and j=2i=1 and j=3i=1 and j=4i=2 and j=1i=2 and j=2i=2 and j=3i=2 and j=4i=3 and j=1i=3 and j=2i=3 and j=3i=3 and j=4
Ec. derivadas parciales 60
Ejemplo 1: Método directo
0,00,45,45,0 ,,, TTTT
1,....,1;1,....,1 −=−= njmi1254 1,22,11,1 −=++− TTT
754 2,23,12,11,1 −=++− TTTT754 3,24,13,12,1 −=++− TTTT
3754 4,24,13,1 −=+− TTT504 1,32,21,21,1 −=++− TTTT
04 2,33,22,21,22,1 =++−+ TTTTT04 3,34,23,22,23,1 =++−+ TTTTT
3004 4,34,23,24,1 −=+−+ TTTT1504 2,31,31,2 −=+− TTT
1004 3,32,31,32,2 −=+−+ TTTT1004 4,33,32,33,2 −=+−+ TTTT
4004 4,33,34,2 −=−+ TTT
• We can use Excel and matrix operations to solve the linear equations system
Ec. derivadas parciales 61
Ejemplo 1: Método directo
T1,1 T1,2 T1,3 T1,4 T2,1 T2,2 T2,3 T2,4 T3,1 T3,2 T3,3 T3,4 RHE-4 1 0 0 1 0 0 0 0 0 0 0 -125 T1,1 74.87191 -4 1 0 0 1 0 0 0 0 0 0 -75 T1,2 95.89590 1 -4 1 0 0 1 0 0 0 0 0 -75 T1,3 127.80360 0 1 -4 1 0 0 1 0 0 0 0 -375 T1,4 196.92881 0 0 0 -4 1 0 0 1 0 0 0 -50 T2,1 78.59170 1 0 0 1 -4 1 0 0 1 0 0 0 T2,2 105.90820 0 1 0 0 1 -4 1 0 0 1 0 0 T2,3 143.38960 0 0 1 0 0 1 -4 0 0 0 1 -300 T2,4 206.32000 0 0 0 1 0 0 0 -4 1 0 0 -150 T3,1 83.58680 0 0 0 0 1 0 0 1 -4 1 0 -100 T3,2 105.75540 0 0 0 0 0 1 0 0 1 -4 1 -100 T3,3 133.52670 0 0 0 0 0 0 1 0 0 1 -4 -400 T3,4 184.9617
300.0 300.0 300.0
75.0 196.9 206.3 185.0 100.0
75.0 127.8 143.4 133.5 100.0
75.0 95.9 105.9 105.8 100.0
75.0 74.9 78.6 83.6 100.0
50.0 50.0 50.0
• Recall the discretized equation
• This can be rewritten as
• For the Gauss-Seidel Method, this equation is solved iteratively for all interior nodes until a pre-specified tolerance is met.
Ec. derivadas parciales 62
Método Gauss-Seidel
04 ,1,1,,1,1 =−+++ −+−+ jijijijiji TTTTT
41,1,,1,1
,−+−+ +++
= jijijijiji
TTTTT
• Consider a plate that is subjected to the boundary conditions shown below. Find the temperature at the interior nodes using a square grid with a length of using the Gauss-Siedelmethod. Assume the initial temperature at all interior nodes to be .
Ec. derivadas parciales63
Ejemplo 2: Método Gauss-Seidel
mm 0.34.2 ×
m6.0
C°50
C°75
C°300
C°100
m4.2
m0.3
x
y
L
W
C°0
• Discretizing the plate by taking,
• The nodal temperatures at the boundary nodes are given by:
Ec. derivadas parciales 64
Ejemplo 2: Método Gauss-Seidel
myx 6.0=∆=∆
x
y
0,0T0,1T 0,2T 0,3T 0,4T
1,0T
2,0T
3,0T
4,0T
5,0T
1,1T 1,2T 1,3T 1,4T
2,1T 2,2T 2,3T 2,4T
3,1T 3,2T 3,3T 3,4T
4,1T 4,2T4,3T 4,4T
5,1T 5,2T 5,3T 5,4TC°300
C°100
C°50
C°75
3,2,1,3003,2,1,50
4,3,2,1,100
4,3,2,1,75
5,
0,
,4
,0
==
==
==
==
iTiT
jTjT
i
i
j
j
4=∆
=x
Lm 5=∆
=y
Wn
• Now we can begin to solve for the temperature at each interior node using
• Assume all internal nodes to have an initial temperature of zero.• Iteration 1:
i=1 and j=1 i=2 and j=3 i=1 and j=2 i=2 and j=4 i=1 and j=3 i=3 and j=1i=1 and j=4 i=3 and j=2i=2 and j=1 i=3 and j=3i=2 and j=2 i=3 and j=4
Ec. derivadas parciales 65
Ejemplo 2: Método Gauss-Seidel
CT º25.311,1 =
5,4,3,2,1;4,3,2,1,4
1,1,,1,1, ==
+++= −+−+ ji
TTTTT jijijiji
ji
CT º5625.262,1 =
CT º3906.253,1 =
CT º098.1004,1 =
CT º3125.201,2 =
CT º7188.112,2 =
CT º27735.93,2 =
CT º344.1024,2 =
CT º5781.421,3 =
CT º5742.382,3 =
CT º9629.363,3 =
CT º827.1344,3 =
• Iteration 2:we take the temperatures from iteration 1 and calculate the approximated error.
i=1, j=1 i=2, j=3 i=1, j=2 i=2, j=4 i=1, j=3 i=3, j=1i=1, j=4 i=3, j=2i=2, j=1 i=3, j=3i=2, j=2 i=3, j=4
Ec. derivadas parciales 66
Ejemplo 2: Método Gauss-Seidel
CT º9688.421,1 =
CT º7596.382,1 =
CT º7862.553,1 =
CT º283.1334,1 =
CT º8164.361,2 =
CT º8594.302,2 =
CT º4881.563,2 =
CT º150.1564,2 =
CT º3477.561,3 =
%27.271,1=aε %58.83
3,2=aε
%49.312,1=aε
100,
,,,
×−
= presentji
previousji
presentji
jia TTT
ε
%49.543,1=aε
%90.244,1=aε
%83.441,2=aε
%03.622,2=aε
%46.344,2=aε
%44.241,3=aε
%70.312,3=aε
%44.573,3=aε
%12.164,3=aε
CT º0425.562,3 =
CT º8394.863,3 =
CT º747.1604,3 =
67
Ejemplo 2: Método Gauss-Seidel
Node Temperature Distribution in the Plate (°C)Number of Iterations
1 2 10
31.2500 42.9688 73.0239
26.5625 38.7695 91.9585
25.3906 55.7861 119.0976
100.0977 133.2825 172.9755
20.3125 36.8164 76.6127
11.7188 30.8594 102.1577
9.2773 56.4880 137.3802
102.3438 156.1493 198.1055
42.5781 56.3477 82.4837
38.5742 56.0425 103.7757
36.9629 86.8393 130.8056
134.8267 160.7471 182.2278
1,1T
2,1T
3,1T4,1T
1,2T
2,2T
3,2T4,2T
1,3T2,3T
3,3T4,3T
Ec. derivadas parciales
• The numerical solution of Laplace equation at a point is the average of four neighbors
• Example for cell S8: =(S7+S9+R8+T8)/4
• Enter the boundary conditions in the appropriate cells. • Copy and paste to cover the cells where values of the potential are to
be calculated. This calculation contains a "circular reference“.
Ec. derivadas parciales 68
Ejemplo 2: Método Gauss-Seidel in Excel
41,1,,1,1
,−+−+ +++
= jijijijiji
TTTTT
• To allow circular references and enable iterations:File → Options → FormulasOn the "Calculations options" form select "Enable iterative calculation"
We can increase the Maximum Iterations (100 is the deafult) andreduce the Maximum Change (0.001 is the default). Iterations will stop when the maximum iteration is reached or the change is less than themaximum change.
• F9 to recalculate.Ec. derivadas parciales 69
Ejemplo 2: Método Gauss-Seidel in Excel
• Color cell based on valueTo achieve the cell color based on value: Inicio → Estilos → Formato condicional → Escalas de color → Más reglasWe can chose a 3 color scale with blue for mimimum, white or gray formidpoint and red for maximum.
Ec. derivadas parciales 70
Ejemplo 2: Método Gauss-Seidel in Excel
• Plotting the resultsNormally we use the chart type Surface or Contour.
Ec. derivadas parciales 71
Ejemplo 2: Método Gauss-Seidel in Excel
Ec. derivadas parciales 72
Ejemplo 3: Uso de SolverFinite Difference Solution
8 0 0 0 0 0 0 07 100 51.74 33.90 26.95 25.07 26.95 33.90 51.74 1006 100 73.07 56.89 48.82 46.39 48.82 56.89 73.07 1005 100 83.64 71.80 65.03 62.86 65.03 71.80 83.64 1004 100 89.71 81.62 76.65 75.00 76.65 81.62 89.71 1003 100 93.56 88.31 84.97 83.83 84.97 88.31 93.56 1002 100 96.23 93.11 91.07 90.37 91.07 93.11 96.23 1001 100 98.26 96.80 95.85 95.52 95.85 96.80 98.26 1000 100 100 100 100 100 100 100
x\y 0 1 2 3 4 5 6 7 8
Residuals-squared87 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.00006 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.00005 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.00004 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.00003 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.00002 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.00001 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.00000
x\y 0 1 2 3 4 5 6 7 8
sum = 2.7745E-13
=(-4*D5+D4+D6+C5+E5)^2
=SUMA(D17:J23)
• Recall the equation used in the Gauss-Siedel Method,
• Because the Gauss-Siedel Method is guaranteed to converge, we can accelerate the process by using overrelaxation. In this case,
• The λ is known as the “overrelaxation parameter" and is in the range 0 < λ < 2.
Ec. derivadas parciales 73
Método de Lieberman
41,1,,1,1
,−+−+ +++
= jijijijiji
TTTTT
oldji
newji
relaxedji TTT ,,, )1( λλ −+=
• In the past examples, the boundary conditions on the plate had a specified temperature on each edge. What if the conditions are different ? For example, what if one of the edges of the plate is insulated.
• In this case, the boundary condition would be the derivative of the temperature. Because if the right edge of the plate is insulated, then the temperatures on the right edge nodes also become unknowns.
Ec. derivadas parciales 74
Condiciones de contorno alternativas
C°50
C°75
C°300
m4.2
m0.3
x
y
Insulated
• The finite difference equation in this case for the right edge for the nodes for
• However the node is not inside the plate. The derivative boundary condition needs to be used to account for these additional unknown nodal temperatures on the right edge. This is done by approximating the derivative at the edge node as
Ec. derivadas parciales 75
Condiciones de contorno alternativas
C°50
C°75
C°300
m4.2
m0.3
x
y
Insulated
),( jm 1,..3,2 −= nj04 ,1,1,,1,1 =−+++ +−−+ jmjmjmjmjm TTTTT
),1( jm +
),( jm
)(2,1,1
, xTT
xT jmjm
jm ∆
−≅
∂∂ −+
• Rearranging this approximation gives us,
• We can then substitute this into the original equation gives us,
• Recall that is the edge is insulated then,
• Substituting this again yields,
Ec. derivadas parciales 76
Condiciones de contorno alternativas
jmjmjm x
TxTT,
,1,1 )(2∂∂
∆+= −+
04)(22 ,1,1,,
,1 =−++∂∂
∆+ +−− jmjmjmjm
jm TTTxTxT
0,
=∂∂
jmxT
042 ,1,1,,1 =−++ +−− jmjmjmjm TTTT
• The general form for a second order linear PDE with two independent variables and one dependent variable is
• The criteria for an equation of this type to be considered parabolic:
• Examine the heat-conduction equation given by
where thus we can classify this equation as parabolic.
Ec. derivadas parciales 77
Ecuaciones en derivadas parciales parabólicas
02
22
2
2
=++∂∂
+∂∂
+∂∂
+∂∂
∂+
∂∂ GFu
yuE
xuD
yuC
yxuB
xuA
042 =− ACB
tT
xT
∂∂
=∂∂
2
2
α
0,0,1,0,0,0, ==−===== GFEDCBA α
k = thermal conductivity of rod material,ρ = density of rod material,C = specific heat of the rod material.C
kρ
α =where
• Consider the flow of heat within a metal rod of length L, one end of which is held at a known high temperature, the other end at a lower temperature.– Heat will flow from the hot end to the cooler end. – We'll assume that the rod is perfectly insulated, so that
heat loss through the sides can be neglected.
• We want to calculate the temperature along the length of the rod as a function of time.
Ec. derivadas parciales 78
Ejemplo de una EDP parabólica
• For a rod of length divided into nodes
• The time is similarly broken into time steps of
• Hence corresponds to the temperature at node ,that is,
and time
Ec. derivadas parciales 79
Discretización de una EDP Parabólica
L 1+nnLx =∆
t∆
jiT i
( )( )xix ∆= ( )( )tjt ∆=
Schematic diagram showing interior nodes
x
1−i i 1+i
x∆ x∆
• If we define we can then write the finite central divided
difference approximation of the left hand side at a general interior node( ) as where ( ) is the node number along
the time.• The time derivative on the right hand side is approximated by the
forward divided difference method as,
Ec. derivadas parciales 80
Solución EDP Parabólica: Método explícito
nLx =∆
Schematic diagram showing interior nodes
x
1−i i 1+i
x∆ x∆
i( )2
11
,2
2 2x
TTTxT j
ij
ij
i
ji ∆+−
≅∂∂ −+ j
tTT
tT j
ij
i
ji ∆−
≅∂∂ +1
,
• Substituting these approximations into the governing equation yields
• Solving for the temp at the time node gives
• choosing,
• we can write the equation as,
• we can be solved explicitly: for each internal location node of the rod for time node in terms of the temperature at time node . If we know the temperature at node , and the boundary temperatures, we can find the temperature at the next time step. We continue the process until we reach the time at which we are interested in finding the temperature.
Ec. derivadas parciales 81
Solución EDP Parabólica: Método explícito
( ) tTT
xTTT j
ij
ij
ij
ij
i
∆−
=∆
+− +−+
1
211 2
α
1+j
( )ji
ji
ji
ji
ji TTT
xtTT 112
1 2)( −+
+ +−∆∆
+= α
2)( xt
∆∆
= αλ
( )ji
ji
ji
ji
ji TTTTT 11
1 2 −++ +−+= λ
1+j j0=j
• Consider a steel rod that is subjected to a temperature of on the left end and on the right end. If the rod is of length ,use the explicit method to find the temperature distribution in the rod from and seconds. Use , .
• Given: , ,
• The initial temperature of the rod is .
Ec. derivadas parciales 82
Ejemplo 1 EDP Parabólica: Método explícito
C°100C°25 m05.0
0=t9=t mx 01.0=∆ st 3=∆
KmWk−
= 54 37800mkg
=ρKkg
JC−
= 490
C°20
0=i 1 2 3 4 5
m01.0
CT °= 25CT °=100
• Number of time steps
• Recall,
• Then,
• Boundary Conditions
• All internal nodes are at for :
Ec. derivadas parciales 83
Ejemplo 1 EDP Parabólica: Método explícito
smCk /104129.1
490780054 25−×=×
==ρ
α
33
09=
−=
∆−
=ttt initialfinal
( ) ( )4239.0
01.03104129.1 2
52 =×=
∆∆
= −
xtαλ
3,2,1,0allfor25
100
5
0 =
°=
°=j
CTCT
j
j
C°20 sec0=t 1,2,3,4 allfor ,200 =°= iCTi
CT °=10000
nodesInterior
20
20
20
20
04
03
02
01
°=
°=
°=
°=
CTCTCTCT
CT °= 2505
We can now calculate the temperature at each nodeexplicitly using the equation formulated earlier,
( )ji
ji
ji
ji
ji TTTTT 11
1 2 −++ +−+= λ
• Nodal temperatures vs. Time
Ec. derivadas parciales 84
Ejemplo 1 EDP Parabólica: Método explícito
sec0=t 0=jCT °=1000
0
nodesInterior
20
20
20
20
04
03
02
01
°=
°=
°=
°=
CTCTCTCT
CT °= 2505
ConditionBoundary10010 −°= CT
CTCTCT
CT
°=
°=
°=
°=
120.22
20
20
912.53
14
13
12
11
ConditionBoundary2515 −°= CT
sec3=t 1=jCT °=1002
0
CTCTCTCT
°=
°=
°=
°=
442.22
889.20
375.34
073.59
24
23
22
21
CT °= 2525
sec6=t 2=j sec9=t 3=jCT °=1003
0
CTCTCTCT
°=
°=
°=
°=
872.22
266.27
132.39
953.65
34
33
32
31
CT °= 2535
Ec. derivadas parciales 85
Ejemplo 2 EDP Parabólica: Método explícito
Time-dependent Temperature Distribution in a Brass Rod
(Temperature values in bold are constant)
length, cm 10
heat capacity of brass, cal/g/deg 0,09 (hcap)
thermal conductivity of brass, cal/sec/cm/deg 0,26 (k)
density of brass, g/cm3 8,4 (rho)
Coefficient e in general PDE, =k/(hcap*rho) 0,33(e)
∆x 1 (Dx)
∆t 1 (Dt)
f=e*Dt/(Dx^2) 0,33 (f)
Distance x (cm)
0 1 2 3 4 5 6 7 8 9 10
time
t (se
c)
0 100 0 0 0 0 0 0 0 0 0 0
1 100 32,9 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0
2 100 44,2 10,8 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0
3 100 51,6 18,2 3,6 0,0 0,0 0,0 0,0 0,0 0,0 0
4 100 56,5 24,4 7,2 1,2 0,0 0,0 0,0 0,0 0,0 0
5 100 60,3 29,3 10,9 2,8 0,4 0,0 0,0 0,0 0,0 0
6 100 63,2 33,4 14,3 4,7 1,0 0,1 0,0 0,0 0,0 0
7 100 65,5 36,9 17,4 6,6 1,9 0,4 0,0 0,0 0,0 0
8 100 67,5 39,9 20,3 8,6 3,0 0,8 0,1 0,0 0,0 0
9 100 69,1 42,5 22,9 10,6 4,1 1,3 0,3 0,1 0,0 0
10 100 70,5 44,8 25,3 12,5 5,3 1,9 0,5 0,1 0,0 0
11 100 71,8 46,9 27,5 14,4 6,6 2,6 0,9 0,2 0,0 0
12 100 72,9 48,7 29,6 16,1 7,8 3,3 1,2 0,4 0,1 0
13 100 73,8 50,4 31,4 17,8 9,1 4,1 1,6 0,6 0,2 0
14 100 74,7 51,9 33,2 19,4 10,3 4,9 2,1 0,8 0,2 0
15 100 75,5 53,2 34,8 21,0 11,5 5,8 2,6 1,0 0,3 0
16 100 76,2 54,5 36,3 22,4 12,7 6,6 3,1 1,3 0,5 0
17 100 76,9 55,7 37,7 23,8 13,9 7,5 3,7 1,6 0,6 0
18 100 77,5 56,8 39,1 25,1 15,1 8,4 4,3 2,0 0,7 0
19 100 78,1 57,8 40,3 26,4 16,2 9,2 4,9 2,3 0,9 0
20 100 78,6 58,7 41,5 27,6 17,2 10,1 5,5 2,7 1,1 0
21 100 79,1 59,6 42,6 28,8 18,3 10,9 6,1 3,1 1,2 0
22 100 79,6 60,4 43,6 29,9 19,3 11,7 6,7 3,5 1,4 0
23 100 80,0 61,2 44,6 30,9 20,3 12,6 7,3 3,8 1,6 0
24 100 80,4 61,9 45,6 31,9 21,2 13,4 7,9 4,2 1,8 0
25 100 80,8 62,6 46,5 32,9 22,2 14,2 8,5 4,6 2,0 0
0
10
20
30
40
50
0 20 40 60 80 100
Tem
pera
ture
ºC
Time sec.
Temperature at x=5cm.
0
20
40
60
80
100
120
0 2 4 6 8 10
Tem
pera
ture
ºC
Loc ation on rod cm.
Temperature distribution along the length of the rod
t = 20 sec.t = 50 sec.t = 100 sec.
• Using the explicit method, we were able to find the temperature at each node, one equation at a time.
• However, the temperature at a specific node was only dependent on the temperature of the neighboring nodes from the previous time step. This is contrary to what we expect from the physical problem.
• The implicit method allows us to solve this and other problems by developing a system of simultaneous linear equations for the temperature at all interior nodes at a particular time.
• The second derivative is approximated by the CDD and the first derivative by the BDD scheme at time level j+1 at node ( i ) as
Ec. derivadas parciales 86
Solución EDP Parabólica: Método implícito
tT
xT
∂∂
=∂∂
2
2
α ( )2
11
111
1,2
2 2x
TTTxT j
ij
ij
i
ji ∆+−
≈∂∂ +
−++
+
+
tTT
tT j
ij
i
ji ∆−
≈∂∂ +
+
1
1,
• Substituting these approximations into the heat conduction equation yields
• Rearranging yields
given that
• The rearranged equation can be written for every node during each time step. These equations can then be solved as a simultaneous system of linear equations to find the nodal temperatures at a particular time.
Ec. derivadas parciales 87
Solución EDP Parabólica: Método implícito
tT
xT
∂∂
=∂∂
2
2
α ( ) tTT
xTTT j
ij
ij
ij
ij
i
∆−
=∆
+− ++−
+++
1
2
11
111 2α
ji
ji
ji
ji TTTT =−++− +
+++
−1
111
1 )21( λλλ
( )2xt
∆∆
= αλ
• Consider a steel rod that is subjected to a temperature of on the left end and on the right end. If the rod is of length ,use the implicit method to find the temperature distribution in the rod from and seconds. Use , .
• Given: , ,
• The initial temperature of the rod is .
Ec. derivadas parciales 88
Ejemplo 2 EDP Parabólica: Método implícito
C°100C°25 m05.0
0=t9=t mx 01.0=∆ st 3=∆
KmWk−
= 54 37800mkg
=ρKkg
JC−
= 490
C°20
0=i 1 2 3 4 5
m01.0
CT °= 25CT °=100
• Number of time steps
• Recall,
• Then,
• Boundary Conditions
• All internal nodes are at for :
Ec. derivadas parciales 89
Ejemplo 2 EDP Parabólica: Método implícito
smCk /104129.1
490780054 25−×=×
==ρ
α
33
09=
−=
∆−
=ttt initialfinal
( ) ( )4239.0
01.03104129.1 2
52 =×=
∆∆
= −
xtαλ
3,2,1,0allfor25
100
5
0 =
°=
°=j
CTCT
j
j
C°20 sec0=t 1,2,3,4 allfor ,200 =°= iCTi
CT °=10000
nodesInterior
20
20
20
20
04
03
02
01
°=
°=
°=
°=
CTCTCTCT
CT °= 2505
We can now form the system of equations for the first time step by writing the approximated heat conduction equation for each node
ji
ji
ji
ji TTTT =−++− +
+++
−1
111
1 )21( λλλ
• Nodal temperatures when• For the first time step we can write four such equations with four
unknowns, expressing them in matrix form yields
• The above coefficient matrix is tri-diagonal, so special algorithms (e.g.Thomas’ algorithm) can be used to solve. The solution is given by
Ec. derivadas parciales 90
Ejemplo 2 EDP Parabólica: Método implícito
sec3=t
=
−−−
−−−
598.302020390.62
8478.14239.0004239.08478.14239.0004239.08478.14239.0004239.08478.1
14
13
12
11
TTTT
=
477.21438.21792.24451.39
14
13
12
11
TTTT
=
25477.21438.21792.24451.39
100
15
14
13
12
11
10
TTTTTT
• Nodal temperatures when:
Ec. derivadas parciales 91
Ejemplo 2 EDP Parabólica: Método implícito
sec3=t
=
25477.21438.21792.24451.39
100
15
14
13
12
11
10
TTTTTT
sec6=t sec9=t
=
25836.22876.23669.30326.51
100
25
24
23
22
21
20
TTTTTT
=
25243.24809.26292.36043.59
100
35
34
33
32
31
30
TTTTTT
• Using the implicit method our approximation of was of accuracy
, while our approximation of was of accuracy.
• One can achieve similar orders of accuracy by approximating the second derivative, on the left hand side of the heat equation, at the midpoint of the time step. Doing so yields
• The first derivative, on the right hand side of the heat equation, is approximated using the forward divided difference method at time level
,
Ec. derivadas parciales 92
Solución EDP Parabólica: Método Crank-Nicolson
2
2
xT
∂∂
2)( xO ∆tT
∂∂ )( tO ∆
( ) ( )
∆+−
+∆
+−≈
∂∂ +
−++
+−+2
11
111
211
,2
2 222 x
TTTx
TTTxT j
ij
ij
ij
ij
ij
i
ji
α
1+j
tTT
tT j
ij
i
ji ∆−
≈∂∂ +1
,
• Substituting these approximations into the governing equation for heat conductance yields
• giving
• where
• Having rewritten the equation in this form allows us to discretize the physical problem. We then solve a system of simultaneous linear equations to find the temperature at every node at any point in time.
Ec. derivadas parciales 93
Solución EDP Parabólica: Método Crank-Nicolson
( ) ( ) tTT
xTTT
xTTT j
ij
ij
ij
ij
ij
ij
ij
i
∆−
=
∆+−
+∆
+− ++−
+++−+
1
2
11
111
211 22
2α
ji
ji
ji
ji
ji
ji TTTTTT 11
11
111 )1(2)1(2 +−
++
++− +−+=−++− λλλλλλ
( )2xt
∆∆
= αλ
• Consider a steel rod that is subjected to a temperature of on the left end and on the right end. If the rod is of length ,use the Crank-Nicolson method to find the temperature distribution in the rod from and seconds. Use , .
• Given: , ,
• The initial temperature of the rod is .
Ec. derivadas parciales 94
Ejemplo 3 EDP Parabólica: Método Crank-Nicolson
C°100C°25 m05.0
0=t 9=t mx 01.0=∆ st 3=∆
KmWk−
= 54 37800mkg
=ρKkg
JC−
= 490
C°20
0=i 1 2 3 4 5
m01.0
CT °= 25CT °=100
• Number of time steps
• Recall,
• Then,
• Boundary Conditions
• All internal nodes are at for :
Ec. derivadas parciales 95
Ejemplo 3 EDP Parabólica: Método Crank-Nicolson
smCk /104129.1
490780054 25−×=×
==ρ
α
33
09=
−=
∆−
=ttt initialfinal
( ) ( )4239.0
01.03104129.1 2
52 =×=
∆∆
= −
xtαλ
3,2,1,0allfor25
100
5
0 =
°=
°=j
CTCT
j
j
C°20 sec0=t 1,2,3,4 allfor ,200 =°= iCTi
CT °=10000
nodesInterior
20
20
20
20
04
03
02
01
°=
°=
°=
°=
CTCTCTCT
CT °= 2505
We can now form the system of equations for the first time step by writing the approximated heat conduction equation for each node
ji
ji
ji
ji
ji
ji TTTTTT 11
11
111 )1(2)1(2 +−
++
++− +−+=−++− λλλλλλ
• Nodal temperatures when• For the first time step we can write four such equations with four
unknowns, expressing them in matrix form yields
• The above coefficient matrix is tri-diagonal, so special algorithms (e.g.Thomas’ algorithm) can be used to solve. The solution is given by
Ec. derivadas parciales 96
Ejemplo 3 EDP Parabólica: Método Crank-Nicolson
sec3=t
=
−−−
−−−
718.52000.40000.4030.116
8478.24239.0004239.08478.24239.0004239.08478.24239.0004239.08478.2
14
13
12
11
TTTT
=
607.21797.20746.23372.44
14
13
12
11
TTTT
=
25607.21797.20746.23372.44
100
15
14
13
12
11
10
TTTTTT
• Nodal temperatures when:
Ec. derivadas parciales 97
Ejemplo 3 EDP Parabólica: Método Crank-Nicolson
sec3=t sec6=t sec9=t
=
25607.21797.20746.23372.44
100
15
14
13
12
11
10
TTTTTT
=
25730.22174.23075.31883.55
100
25
24
23
22
21
20
TTTTTT
=
25042.24562.26613.37604.62
100
35
34
33
32
31
30
TTTTTT
• The table below allows you to compare the results from all three methods discussed in juxtaposition with the analytical solution.
Ec. derivadas parciales 98
Comparación de métodos: temperaturas en 9 seg.
Node Explicit Implicit Crank-Nicolson Analytical
34
33
32
31
TTTT
042.24562.26613.37604.62
243.24809.26292.36043.59
872.22266.27132.39953.65
610.23844.25084.37510.62
• The general form for a second order linear PDE with two independent variables and one dependent variable is
• The criteria for an equation of this type to be considered hyperbolic:
• The wave equation (oscillatory systems) given by
where thus we can classify this equation as hyperbolic.
Ec. derivadas parciales 99
Ecuaciones en derivadas parciales hiperbólicas
02
22
2
2
=++∂∂
+∂∂
+∂∂
+∂∂
∂+
∂∂ GFu
yuE
xuD
yuC
yxuB
xuA
042 >− ACB
2
2
2
2
xyk
ty
∂∂
=∂∂
1,0,1 −=== CBA
T = tension,g = gravitational constant,w = weight/unit =W/L ,W=weight, L=lengthw
Tgk =where
• A string of certain length and weight is under a fixed tension. Initially the mid-point of the string is displaced some distance from its equilibrium position and released.
• We want to calculate the displacement as a function of time at fixed intervals along the length of the string.
Ec. derivadas parciales 100
Ejemplo de una EDP hiperbólica
• Once again, we can solve the problem by replacing derivatives by finite differences.
• which, when rearranged, yields
• If we set , the above equation is simplified to
• When employing the simplified equation, the value of is determined by the expression .To begin the calculations (value at t1),
it is required values of the function at t0 = 0 and also a value at t-1. We can get a value for the function at t-1 by making use of the fact that the function is periodic. We can use for the first row.
Ec. derivadas parciales 101
Solución EDP hiperbólica: Método explícito
( ) ( )
∆
+−=
∆+− −+
−+
211
2
11 22x
TTTw
Tgt
TTT ji
ji
ji
ji
ji
ji
( )( )
( )( )
ji
ji
ji
ji
ji T
xt
wTgTTT
xt
wTgT
∆∆
−+−+∆∆
= −−+
+2
21
112
21 12)(
( ) ( ) 122 =∆∆ xwtTg1
111 −
−++ −+= j
ij
ij
ij
i TTTTt∆
wTgxt/
∆=∆
2
01
011 −+ +
= iii
TTT
• A string 50 cm long and weighing 0.5 g is under a tension of 33 kg. Initially the mid-point of the string is displaced 0.5 cm from its equilibrium position and released. We want to calculate the displacement as a function of time at 5 cm intervals along the length of the string, using equation
• From equation the must be 8.8 x 10-5 seconds.
Ec. derivadas parciales 102
Ejemplo 1 EDP hiperbólica
111
1 −−+
+ −+= ji
ji
ji
ji TTTT
wTgxt/
∆=∆ t∆
Ec. derivadas parciales 103
Ejemplo 1 EDP hiperbólicaThe Wave Equation:Vibration of a String
length, cm 50 (L)tension, g 33000 (T)weight,g 0,5 (Wt)weight per unit length, g/cm 0,01 (w)
gravitational constant, cm/sec2 980 (g)Dx 5 (Dx)Dt 8,79E-05 (Dt)
Distance x (cm)0 5 10 15 20 25 30 35 40 45 50
time
t (se
c)
0 0 0,1 0,2 0,3 0,4 0,5 0,4 0,3 0,2 0,1 08,8E-05 0 0,1 0,2 0,3 0,4 0,4 0,4 0,3 0,2 0,1 01,8E-04 0 0,1 0,2 0,3 0,3 0,3 0,3 0,3 0,2 0,1 02,6E-04 0 0,1 0,2 0,2 0,2 0,2 0,2 0,2 0,2 0,1 03,5E-04 0 0,1 0,1 0,1 0,1 0,1 0,1 0,1 0,1 0,1 04,4E-04 0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 05,3E-04 0 -0,1 -0,1 -0,1 -0,1 -0,1 -0,1 -0,1 -0,1 -0,1 06,2E-04 0 -0,1 -0,2 -0,2 -0,2 -0,2 -0,2 -0,2 -0,2 -0,1 07,0E-04 0 -0,1 -0,2 -0,3 -0,3 -0,3 -0,3 -0,3 -0,2 -0,1 07,9E-04 0 -0,1 -0,2 -0,3 -0,4 -0,4 -0,4 -0,3 -0,2 -0,1 08,8E-04 0 -0,1 -0,2 -0,3 -0,4 -0,5 -0,4 -0,3 -0,2 -0,1 09,7E-04 0 -0,1 -0,2 -0,3 -0,4 -0,4 -0,4 -0,3 -0,2 -0,1 01,1E-03 0 -0,1 -0,2 -0,3 -0,3 -0,3 -0,3 -0,3 -0,2 -0,1 01,1E-03 0 -0,1 -0,2 -0,2 -0,2 -0,2 -0,2 -0,2 -0,2 -0,1 01,2E-03 0 -0,1 -0,1 -0,1 -0,1 -0,1 -0,1 -0,1 -0,1 -0,1 01,3E-03 0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 01,4E-03 0 0,1 0,1 0,1 0,1 0,1 0,1 0,1 0,1 0,1 01,5E-03 0 0,1 0,2 0,2 0,2 0,2 0,2 0,2 0,2 0,1 01,6E-03 0 0,1 0,2 0,3 0,3 0,3 0,3 0,3 0,2 0,1 01,7E-03 0 0,1 0,2 0,3 0,4 0,4 0,4 0,3 0,2 0,1 01,8E-03 0 0,1 0,2 0,3 0,4 0,5 0,4 0,3 0,2 0,1 01,8E-03 0 0,1 0,2 0,3 0,4 0,4 0,4 0,3 0,2 0,1 01,9E-03 0 0,1 0,2 0,3 0,3 0,3 0,3 0,3 0,2 0,1 02,0E-03 0 0,1 0,2 0,2 0,2 0,2 0,2 0,2 0,2 0,1 02,1E-03 0 0,1 0,1 0,1 0,1 0,1 0,1 0,1 0,1 0,1 02,2E-03 0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 02,3E-03 0 -0,1 -0,1 -0,1 -0,1 -0,1 -0,1 -0,1 -0,1 -0,1 02,4E-03 0 -0,1 -0,2 -0,2 -0,2 -0,2 -0,2 -0,2 -0,2 -0,1 02,5E-03 0 -0,1 -0,2 -0,3 -0,3 -0,3 -0,3 -0,3 -0,2 -0,1 02,5E-03 0 -0,1 -0,2 -0,3 -0,4 -0,4 -0,4 -0,3 -0,2 -0,1 02,6E-03 0 -0,1 -0,2 -0,3 -0,4 -0,5 -0,4 -0,3 -0,2 -0,1 02,7E-03 0 -0,1 -0,2 -0,3 -0,4 -0,4 -0,4 -0,3 -0,2 -0,1 02,8E-03 0 -0,1 -0,2 -0,3 -0,3 -0,3 -0,3 -0,3 -0,2 -0,1 0
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0 0.0005 0.001 0.0015 0.002 0.0025 0.003
Disp
lacem
ent (
cm.)
Time (sec.)
Displacement evolution at 25 cm