FEM04
FEM04
LECTURE 4
Yu-Ching Wu
Review
Boundary conditions:
at or
at or
4.1 Weak Form of the Governing Equation
x x x
-1 0 +1 -1 0 +1 -1 0 +1
It is the same for every straight line
passing node .
This concept can be extended to
higher degree polynomials (curves).
2-Node Gaussian Quadrature
y y(x) y y
y(x)
y(x)
x x x
-1 0 +1 -1 0 +1 -1 0 +1
Gaussian points
Question: How do we know and
Answer: Corresponding weights
y(x)
-1 +1 x
𝑎1 𝑎2 𝑎3 𝑎4
0
x ξ
a b -1 +1
Matlab Programming
① Download/Unzip ode2_matlab.rar
② Main code: ode2.m
Function: nGauss.m; SF.m
Include: COEF.m
Input Data: MESH.txt; QUAD.txt
Main code: ode2.m
clear
% ---------------------
% INPUT DATA
% ---------------------
load MESH.txt -ASCII MESH.txt & QUAD.txt are input
load QUAD.txt -ASCII files
Main code: ode2.m
B = 0;
for I=1:NUMNP Boundary Conditions
for J=1:3
B = B+abs(SK(I,J));
end
end
Main code: ode2.m
B = B*(1.0E+04);
for I=1:NUMNP Blasting the diagonal
if NPBC(I) == 1
SK(I,2)=B;
Q(I)=Y(I)*B;
end
end
Main code: ode2.m
% ------------------------------
% CALL EQUATION SOLVER
% ------------------------------ nGAUSS Equation solver for
Y = nGAUSS(SK,Q,NUMNP,IB); banded, nonsymmetric
matrices
% ----------- IB Bandwidth=3
% OUTPUT DATA U Wire deflection
% -----------
save Y.txt Y -ASCII
plot(XORD,Y) Y.txt Output data
Function: SF.m
function s = SF(D,node,u)
% ---------------------
if D == 0 If D=0 Calculate shape
if node == 1 functions
s = (0.5 - 0.5*u);
elseif node == 2 N1=0.5-0.5u
s = (0.5 + 0.5*u);
else N2=0.5+0.5u
error('Error #1 in SF
function') Error massage
Function: SF.m
Part A
Determine a differential equation with non-zero coefficients A, B, C, and
D for which the solution is a linear function of x (i.e. y=C0+C1x. Define
three boundary value problems for this ODE:
a) y known at both boundaries.
b) y known at left end boundary and dy/dx known at right end boundary.
c) dy/dx known at left end boundary and y known at right end boundary.
Use program ode2.m to solve these three problems.
Part B
It is necessary to prevent water in a pipe from freezing during the
winter months. The pipe runs from an artesian well to a cabin 2.17
km down a hillside. The insulation for the pipe is partly ground
cover and partly some commercial wrapping material. A fair
approximation to the insulation can be given by
x
h h0 1.3
L
where h is the coefficient of convective heat transfer, and L is the
total length of the pipe. The equation for the temperature in the
pipe can be described by the equation
d d d
k v( C p ) h ( a ) 0 .0
dx dx dx
where
is the temperature C )(
a is the ambient temperature 30.0 C
υ is the velocity in the pipe (m/s)
3
ρ is the density = 1.0 E 03kg / m
C p is the capacity 4.211E 03 Nm / kg C
k is the thermal conductivity = 0 . 574 Nm / sm C
h is the coefficient of convective heat transfer Nm / m 3 s C
In order to keep the water from freezing it is necessary to maintain
average velocity which will keep the water from freezing before it
reaches the cabin? The water enters the pipe from the well at a
temperature of 20 C .
It empties into a storage tank in the cabin which contains water at
approximately the temperature of the entering water. Assume,
3
therefore, that kd / dx 0 h
at the point. Take o 4. 5 Nm / m sC
Due: March 28, 2025
Hand in the following items to me in the
class:
1. Technical report with all answers;
2. The matlab codes which you have
written and modified.
Reading Assignment
J. N. Reddy
“Introduction to the Finite Element Method”
Chap 3 Problems
Project 1
LECTURE 4
Yu-Ching Wu