Chapter 6 Poisson's Equation: FEM Approximation: 6.1 Governing Equations
Chapter 6 Poisson's Equation: FEM Approximation: 6.1 Governing Equations
kx nx + k y n y = q*
x y on S
= *
where
nx, ny are the x and y components of the outward unit normal vector to S
q*, Φ* are the boundary values of the quantities shown
It is this form of the equation that we will use to obtain our finite element
approximations.
Before proceeding, we show that Eq. 6.8 can be used to obtain the corresponding
functional associated with Eqs. 6.1 and 6.2. To do so, we note that
1
2
2
kx + ky = k x + k y
x x y y 2 x y
and
( )Q = (Q )
( )q* = (q* )
Hence, we can write
1 2 1 2
k x + k y − Q dV − q *dS = 0
2 x 2 y
V S
k x 0 x
dV − V QdV − S q dS = 0
*
V x y 0 k y
y
where
= x
y
and that
N I N J N K
x
I
abbreviated as
= N
Also recall that
= N and = N
We now substitute the above FEM approximations into Eq. 6.14 and integrate. We
must do so, of course, element by element. We begin with the volume integral
associate with the stiffness term, where, for our generic element e, we have
RdV = V N RN dV
T
Ve e
where
NI
Qe = V N J Q( x, y)dV
e
N
K
The total contribution from element e to the volume integration in Eq.6.8 is
which gives us
where
S
1 −
Qm
QS = = S S q(S )dS
l
Qn S
S
lS
The governing interpretation for Qm and Qn is that they equal the first moment of area
of q(S) about their respective nodal point, divided by the length of the segment. Hence,
we place a point Q at each node that gives the same moment as the distributed q. Also,
note that
Qm + Qn = qdS
SS
The nodal point coordinates will be located in two arrays, XORD and YORD.
6.3.2 Integration of [K]e and {Q}e matrices
Because our shape functions N are linear in x and y, the gradient terms in N
are constants. If we also assume that the coefficients kx and ky, in [R] are constant, we
can write
K e = V N RN dV
T
= N R N dV
T
Ve
= N R N V
T
Note again the notation we have chosen to use for our region of integration. In the
above, V is actually the area of the element. The notation indicates that we are
assuming it is an area associated with a volume of unit thickness.
The derivatives of the shape functions will be stored in the arrays DNDX and DNDY,
where, for example;
N 2
DNDX(2) =
x
The element stiffness matrix, [K], will be stored in the 3×3 array S(J, K), defined in
terms of the DNDX and DNDY arrays as
S(J, K) = (DNDX(J) * RX * DNDX(K)
+ DNDY(J) * RY * DNDY(K)) * VOL
where
VOL = ((XJ * YK) - (XK * YJ))/2.0
If we assume Q constant within each element, it can be shown that all three
components of {Q}e are equal and have the value
Q * VOL/3.0
Qe = Q * VOL/3.0
Q * VOL/3.0
The matrix is symmetric and will also be banded; thus, appropriate storage will be
used.
COEF.m
The three parameters, kx(x, y), ky(x, y), and Q(x, y), are defined for each element with
the COEF.m INCLUDE. Available for the definitions will be the coordinates of the
centroid of the element, XC and YC, as well as the element number, the NP array, etc.
The parameters are assumed constant within the element for the integrations. This
provides a good approximation for the integration of the stiffness matrix where all
other terms in the integrand are constant. However, it is not as accurate a procedure
for integration of the right-hand side. Care must be taken to make elements small
enough that Q(x, y) is approximately constant within each element, or at least
approximately linear.
6.4.2 Code
Here we have defined our NPcode values to indicate the side of the mesh on which
the node appears, and only on the sides where there is need to specify a boundary
condition that differs from the default values. We have chosen to number the sides
counterclockwise, starting with the lower boundary. Thus, nodes 11, 6, and 1 are
given NPcode numbers equal to 4, and nodes 15, 10, and 5 are given NPcode numbers
equal to 2. However, there is no need to indicate that nodes 2, 3, and 4 on side 1 or
that nodes 12, 13, and 14 are on side 3, because there is no need to change any of the
default values associated with these nodes. The important concept to understand is
that the NPcode values are for your use and only your use in your INITIAL.m code.
Use them there to identify the nodes for which you wish to assign boundary
conditions that differ from the default boundary conditions. See the following
example for the INITIAL.m code. Note, however, if you wish to assign boundary
values in INITIAL.m without reference to the NPcode values, that is your option; you
can simply give all nodes an NPcode value of zero and use, for example, the nodal
coordinates to determine what boundary conditions to assign.
The NWLD values have been assigned to make the numbering begin at the upper left
corner and increase download, similar to the example given earlier. Sketch the mesh
with the new numbers and verify the NWLD data as well as the IB value shown. Keep
in mind that only poisson.m uses the new numbers, not the user. In all data files, and
in INITIAL.m, the original node numbers should be used.
The user INCLUDE codes for the test problem are: INITIAL.m and COEF.m
In INITIAL.m, we search through all NPcode values to identify those equal to 2 (node
is on side 2) and equal to 4 ( node is on side 4). We again emphasize that these
numbers simply point out to the user wants them to point out. We could have used 3
and 9 to indicate the specified PHI values for these nodes and have accomplished the
very same purpose.
The test problem has conastant coeffcients; hence, our COEF.m code is fairly simple.
In problems with more complicated coefficients, for example, those that depend on
the x and y coordinates, functions can be written in this code. Keep in mind when you
write this code that you have use of all variables that have been calculated in
poisson.m up to the line where COEF appears. This includes the coordinates of the
element’s centroid, XC and YC, as well as the gradients of the shape functions and
other quantities.
At the conclusion of the analysis, the resulting Φ values are saved in your working
directory in a file named PHI. For the test problem, it will contain the exact answers,
which are
9.0 7.5 6.0 4.5 3.0
9.0 7.5 6.0 4.5 3.0
9.0 7.5 6.0 4.5 3.0
shwon in the order corresponding to the mesh nodes.
Three auxiliary codes can be used in conjunction with poisson.m to help prepare input
data and to help analyze the solution. They can be found in Appendix D and are as
follows
mesh.m Generate mesh files:
MESHo.txt, NODES.txt, NP.txt
newnum.m Generate data file NWLD.txt
topo.m Creates plots of PHI.txt values