Lecture 8

advertisement
Feb 4, 2010
Lecture 8
FEM in 2D: Fin with Derivative BC
(Lecture notes taken by Zhibin Deng and Xiaoyin Ji)
๐ถฬ‚
๏‚ท
Steady state problem: -KΔu + Cu =f(x,y)= Cusur on Ω with ๐ถ =
2๐‘๐‘ ๐‘ข๐‘Ÿ
๐ป
๐‘
= 2โž
( ๐‘ ๐‘ข๐‘Ÿ
),
๐ป
where ๐œ•๐›บ = ๐œ•๐›บ1 ∪ ๐œ•๐›บ2 ∪ ๐œ•๐›บ3.
๐‘ข|๐œ•๐›บ1 = ๐‘”(๐‘ฅ, ๐‘ฆ)
๐‘‘๐‘ข
|
= ๐‘๐‘ ๐‘ข๐‘Ÿ ( ๐‘ข๐‘ ๐‘ข๐‘Ÿ − ๐‘ข)
๐‘‘๐‘› ๐œ•๐›บ2
๐‘‘๐‘ข
๐พ |
=0
๐‘‘๐‘› ๐œ•๐›บ3
For a fin cooling problem, parameter ๐ป is usually small.
๐พ
๏‚ท
Weak equation and element matrices.
In order to find the weak equation, multiply the differential equation by ๐œ‘ where ๐œ‘|๐œ•๐›บ1 = 0 and
apply the divergence form of Green’s theorem
โˆฌ ∇ โˆ™ ๐นโƒ— = โˆฎ ๐นโƒ— โˆ™ ๐‘›โƒ—โƒ— ๐‘‘๐œŽ
๐นโƒ— = ๐œ‘∇๐‘ข
∇ โˆ™ ๐นโƒ— = ๐œ‘โˆ†๐‘ข + ∇๐‘ข โˆ™ ∇๐œ‘
This gives
โˆฌ ๐œ‘โˆ†๐‘ข + โˆฌ ∇๐‘ข โˆ™ ∇๐œ‘ = โˆฎ โŸ
(∇๐‘ข โˆ™ ๐‘›โƒ—โƒ—) ๐œ‘๐‘‘๐œŽ
๐‘‘๐‘ข
๐‘‘๐‘›
−๐พ โˆฌ Δ๐‘ข๐œ‘ + ๐ถ โˆฌ ๐‘ข๐œ‘ = โˆฌ ๐ถ๐‘ข๐‘ ๐‘ข๐‘Ÿ ๐œ‘
โˆฌ ๐œ‘โˆ†๐‘ข =
1
[− โˆฌ ๐ถ๐‘ข๐‘ ๐‘ข๐‘Ÿ ๐œ‘ + ๐ถ โˆฌ ๐‘ข๐œ‘]
๐พ
1
Feb 4, 2010
๐‘‘๐‘ข
1
๐œ‘๐‘‘๐œŽ − โˆฌ ∇๐‘ข โˆ™ ∇๐œ‘ = [− โˆฌ ๐ถ๐‘ข๐‘ ๐‘ข๐‘Ÿ ๐œ‘ + ๐ถ โˆฌ ๐‘ข๐œ‘]
๐พ
๐œ•Ω ๐‘‘๐‘›
โˆฎ
๐‘‘๐‘ข
๐œ‘๐‘‘๐œŽ + โˆฌ ๐ถ๐‘ข๐‘ ๐‘ข๐‘Ÿ ๐œ‘
๐œ•Ω ๐‘‘๐‘›
๐พ โˆฌ ∇๐‘ข โˆ™ ∇๐œ‘ + โˆฌ ๐ถ๐‘ข๐œ‘ = ๐พ โˆฎ
โˆฌ(๐พ๐›ป๐‘ข โˆ™ ๐›ป๐œ‘ + ๐ถ๐‘ข๐œ‘) = โˆฌ ๐ถ๐‘ข๐‘ ๐‘ข๐‘Ÿ ๐œ‘ + โˆฎ
๐พ
๐œ•๐›บ1 โ‹ƒ ๐œ•๐›บ2 ∪๐œ•๐›บ3
๐‘‘๐‘ข
๐œ‘๐‘‘๐œŽ
๐‘‘๐‘›
Next apply the boundary conditions to the line integral
โˆฎ๐พ
๐‘‘๐‘ข
๐‘‘๐‘ข
๐‘‘๐‘ข
๐œ‘๐‘‘๐œŽ = ∫ ๐พ
๐œ‘
โŸ ๐‘‘๐œŽ + ∫ ๐‘๐‘ ๐‘ข๐‘Ÿ (๐‘ข๐‘ ๐‘ข๐‘Ÿ − ๐‘ข)๐œ‘๐‘‘๐œŽ + ∫ ๐พ โŸ ๐œ‘๐‘‘๐œŽ
๐‘‘๐‘›
๐‘‘๐‘›
๐‘‘๐‘›
๐œ•๐›บ1
๐œ•๐›บ2
๐œ•๐›บ3
0
0
โˆฌ(๐พ๐›ป๐‘ข โˆ™ ๐›ป๐œ‘ + ๐ถ๐‘ข๐œ‘) = โˆฌ ๐ถ๐‘ข๐‘ ๐‘ข๐‘Ÿ ๐œ‘ + ∫ ๐‘๐‘ ๐‘ข๐‘Ÿ (๐‘ข๐‘ ๐‘ข๐‘Ÿ − ๐‘ข)๐œ‘๐‘‘๐œŽ
๐œ•๐›บ2
This gives the weak equation, which are used to find the element matrices,
โˆฌ(๐‘ฒ๐œต๐’– โˆ™ ๐œต๐‹ + ๐‘ช๐’–๐‹) + ∫ ๐’„๐’”๐’–๐’“ ๐’–๐‹๐’…๐ˆ = โˆฌ ๐‘ช๐’–๐’”๐’–๐’“ ๐‹ + ∫ ๐’„๐’”๐’–๐’“ ๐’–๐’”๐’–๐’“ ๐‹๐’…๐ˆ
๐๐œด๐Ÿ
๐๐œด๐Ÿ
โŸ
โŸ
๐’‚(๐’–,๐‹)
๐’(๐‹)
The domain Ω is approximated by a union of triangular elements. This induces the
approximation of the boundary by a union of edges of selected triangular elements.
๐œ•Ω
โ„Ž
1
1
3
2
2
๐‘’2
๐‘’3
๐‘’1
2
3
3
1
๐‘ข๐‘’ = ๐‘ข1๐‘’ ๐‘1๐‘’ + ๐‘ข2๐‘’ ๐‘2๐‘’ + ๐‘ข3๐‘’ ๐‘3๐‘’
โ„Ž = √(๐‘‘๐‘ฅ)2 + (๐‘‘๐‘ฆ)2
Instead of integrating along the boundary ∂Ω2 , we integrate ๐‘ข๐‘’ along edges close to the boundary
๐œ•๐›บ2 , such as the edge 1-2 in element ๐‘’1 , edge 3-1 in element ๐‘’2 and edge 2-3 in element ๐‘’3 in above
2
Feb 4, 2010
figure. The length of the edge is โ„Ž = √(๐‘‘๐‘ฅ)2 + (๐‘‘๐‘ฆ)2 and can be calculated if the corresponding
system node numbers and their coordinates are known.
๏‚ท
Insertion of the derivative boundary conditions and genbc2fin.m.
npt2(edge,1)
npt2(edge,2)
edge
In order to insert derivative boundary condition on the boundary ๐œ•๐›บ2 , we need to compute
following two items (These two items appeared in weak equation)
∫
๐‘๐‘ ๐‘ข๐‘Ÿ ๐‘ข๐œ‘ ← ∫
๐œ•Ω2
∫
๐œ•Ω2
๐‘๐‘ ๐‘ข๐‘Ÿ ๐‘ข๐‘ ๐‘ข๐‘Ÿ ๐œ‘ ← ∫
๐œ•Ω2
๐œ•Ω2
๐‘๐‘ ๐‘ข๐‘Ÿ ๐‘ข๐‘’ ๐‘๐‘–๐‘’
(๐‘๐‘ ๐‘ข๐‘Ÿ ๐‘ข๐‘ ๐‘ข๐‘Ÿ )๐‘๐‘–๐‘’
There are two ways to insert the boundary condition. One is to insert the above items in element
matrices before we assemble the system matrix; the other one is to adjust the system matrix by
above items after we assemble the system matrix by elements. The MATLAB code fem2d_fin.m
used the latter one.
๐‘›๐‘’๐‘‘๐‘”๐‘’ = total # of edges on the boundary ๐œ•๐›บ2 , ๐œ•๐›บ3
๐‘›๐‘๐‘ก2(๐‘’๐‘‘๐‘”๐‘’, 1 ๐‘œ๐‘Ÿ 2) = system # nodes lies on the boundary ๐œ•๐›บ2 , ๐œ•๐›บ3
HOT MASS
∂Ω1
∂Ω3
∂Ω3
∂Ω2
3
Feb 4, 2010
๏‚ท
Matlab code fem2d_fin.m and required files:
genxyfin.m : generates nodes coordinates (๐‘ฅ, ๐‘ฆ).
gennod.m: generates system node numbers for each element, nod(e,1 or 2 or 3). The array
nod is an ๐‘›๐‘’ × 3 matrix, where ๐‘›๐‘’ is the number of elements. Each row ๐‘’ corresponds to
element ๐‘’.
genbc1fin.m: output the system number of nodes that lies on the boundary ๐œ•๐›บ1
genbc2fin.m: output the system number of nodes that lies on the boundary ๐œ•๐›บ2 and ๐œ•๐›บ3 .
This generates the array npt2(edge,1 or 2) whose values are system node numbers on the
on a particular line segment approximating the second and third parts of the boundary.
Assume the first row is ๐‘›๐‘๐‘ก2(3,1) = 7 ๐‘Ž๐‘›๐‘‘ ๐‘›๐‘๐‘ก2(3,1) = 8. This means the system
number of number 7 is one node of the third edge = 3 and the system node number 8 is the
other node of the third edge = 3.
csur = 10;
usur = 23.0;
for edge = 1:nedge
if edge < nx
npt2(edge,1)
npt2(edge,2)
elseif edge < nx +
npt2(edge,1)
npt2(edge,2)
else
npt2(edge,1)
npt2(edge,2)
end
end
% Nodes lies on the
= edge;
= edge + 1;
(ny - 1)
% Nodes lies on the
= (edge - nx )*nx + 1;
= (edge - nx )*nx + 1 + nx;
% Nodes lies on the
= (edge - (nx + (ny - 1)) )*nx +
= (edge - (nx + (ny - 1)) )*nx +
bottom
left side
right side
nx;
nx + nx;
ffem2d.m: the right hand side ๐‘“ in heat equation.
fem2d_fin.m: the critical difference from fem2d.m in this code is the insertion of
derivative boundary conditions as following:
for edge = 1:nedge
% Insert derivative boundary conditions
% Get the system number of two nodes on the edge
i = npt2(edge,1); j = npt2(edge,2);
dx = x(j) - x(i);
dy = y(j) - y(i);
h = sqrt(dx^2 + dy^2); % Calculate the length of the edge
% Adjust the system matrix
sm(i,i) = sm(i,i) + csur*2*h/6;
sm(i,j) = sm(i,j) + csur*h/6;
sm(j,i) = sm(j,i) + csur*h/6;
sm(j,j) = sm(j,j) + csur*2*h/6;
% Adjust the right hand side vector
rhs(i) = rhs(i) + usur*csur*2*h/6 + csur*usur*h/6;
rhs(j) = rhs(j) + usur*csur*h/6 + csur*usur*2*h/6;
end
4
Feb 4, 2010
๏‚ท
Variations of the problem and fem2d_fin.m
๐œ•Ω1
๐‘ข = 100
๐œ•Ω3
๐œ•Ω3
๐‘ข๐‘ฅ = 0
−๐‘ข๐‘ฅ = 0
−๐‘ข๐‘ฆ = ๐‘๐‘ ๐‘ข๐‘Ÿ (๐‘ข๐‘ ๐‘ข๐‘Ÿ − ๐‘ข)
๐œ•Ω2
Given ๐‘ข๐‘ ๐‘ข๐‘Ÿ = 23, ๐‘๐‘ ๐‘ข๐‘Ÿ = 10, ๐ป = 0.0001, ๐พ = 237, ๐ถ = 2๐‘๐‘ ๐‘ข๐‘Ÿ /๐ป and ๐‘ข|๐œ•๐›บ1 = 100.
Test Case:
−๐‘ข๐‘ฆ๐‘ฆ = 0
(1)
๐‘ข(. 1) = 100
(2)
๐‘ข๐‘ฆ (0) = 10(23 − ๐‘ข(0))
From (1) and (2), the solution ๐‘ข(๐‘ฆ) has the form
๐‘ข(๐‘ฆ) = ๐‘(. 1 − ๐‘ฆ) + 100
Then, ๐‘ข๐‘ฆ = −๐‘, combing with (3), we have
−๐‘ = 10(23 − (๐‘(. 1 − 0) + 100))
This should be used to help debug the proposed code fem2d_fin.m
5
(3)
Feb 4, 2010
Run the MATLAB code in fem2d_fin.m gives the following results:
0.1
0.09
0.08
100
0.07
80
0.06
0.05
60
0.04
40
0.03
20
0.02
0.1
0.01
0
0
0.1
0
0.02
0.04
0.06
0.08
0.08
0.1
0.05
0.06
0.04
0.02
0
0
The test problem is actually one dimensional fin problem. This can also be seen from the above
right figure. Increasing H has the effect of decreasing the heat transfer coefficient of the top and
bottom of the fin while leaving it the same on the three boundary edges. Thus less heat is
allowed to leave the fin as is indicated by the following calculation with H = 2.0:
0.1
0.09
100
0.08
0.07
99.8
0.06
99.6
0.05
0.04
99.4
0.03
99.2
0.1
0.02
0.1
0.01
0.08
0.05
0.06
0.04
0.02
0
0
0.02
0.04
0.06
0.08
0
0.1
6
0
Download