0% found this document useful (0 votes)
19 views6 pages

1.3 Numerical Simulations

FEM Notes

Uploaded by

Sandip Kardile
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views6 pages

1.3 Numerical Simulations

FEM Notes

Uploaded by

Sandip Kardile
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Source: Introduction to the Finite Element Method, 4th Edition

ISBN: 9781259861901
Authors: J. N. Reddy Ph.D.

1.3. Numerical Simulations


While the derivation of the governing equations for most problems is not unduly difficult (in fact, for most problems they can be
found in textbooks), their solution by exact methods of analysis is often difficult due to geometric and material complexities. In
such cases, numerical methods of analysis provide a means of finding solutions. By a numerical simulation of a process, we
mean the solution of the governing equations (or mathematical model) of the process using a numerical method and a
computer. Numerical methods typically transform differential equations governing a continuum to a set of algebraic relations
among the values of dependent variables of a discrete model of the continuum, and these algebraic equations are solved using
computers.

There exist a number of numerical methods, many of which are developed to solve differential equations. In the finite difference
approximation of a differential equation, the derivatives in the latter are replaced by difference quotients (or the function is
expanded in a Taylor series) that involve the values of the solution at discrete mesh points of the domain. The resulting
algebraic equations are solved for the values of the solution at the mesh points after imposing the boundary conditions. We
note that the finite difference method is not based on the concept of minimization of error introduced in the approximation of
the differential equation. It simply provides a means to compute a solution.

In the solution of a differential equation by a classical variational method, the equation is expressed as an equivalent weighted-
integral statement, which often means making the error in the approximation of the differential equation orthogonal to the set
of weight functions. In solid mechanics, the integral statement is equivalent to an energy principle [4]. Then the approximate
solution over the domain is assumed to be a linear combination (∑j cj ϕ j ) of appropriately chosen approximation functions ϕ j
and coefficients cj to be determined. The coefficients cj are determined such that the integral statement is satisfied. Various
variational methods, for example, the Ritz, Galerkin, collocation, and least-squares methods, differ from each other in the choice
of the integral form and weight functions. A more detailed discussion of variational methods is presented in Chapter 2 (also,
see [4]). The classical variational methods, which are truly meshless methods, are powerful methods that provide globally
continuous solutions but suffer from the drawback that the approximation functions for problems with arbitrary domains are
difficult to construct. The modern meshless methods seem to provide a way to construct approximation functions for arbitrary
domains, but they also have their own disadvantages.

Next, we consider two examples of numerical simulations, one for an initial-value problem (IVP) and another for a boundary-
value problem (BVP), using the finite difference method to give the reader a taste of numerical methods and, in the process,
introduce the finite difference method. The examples discussed here are based on the problems introduced in Examples 1.2.1
and 1.2.2. Mathematically, the bar problem of Example 1.2.3 is the same as the heat transfer problem of Example 1.2.2;
therefore, its numerical solution is not discussed here.

Example

Example 1.3.1

Problem statement (The pendulum problem): Consider Eq. (1.2.4) governing the simple planar motion of a pendulum subject
to the initial conditions in Eq. (1.2.5). Use the forward and backward finite difference methods to formulate discretized
forms of the equation. Obtain numerical solutions for three different time steps, Δt = 0.05, Δt = 0.025, and
Δt = 0.001, and compare them graphically with the exact linear solution. Take ℓ = 2.0, g = 32.2, θ 0 = π/4, and v0 = 0
in the numerical computation.

https://accessengineeringlibrary.com/content/book/9781259861901/toc-chapter/chapter1/section/section4

© McGraw-Hill Education. All rights reserved. Any use is subject to the Terms of Use, Privacy Notice and copyright information.
Solution: We begin with the following general first-order differential equation [of whichEq. (1.2.4) is a special case]

du
= f(t,u), 0 < t < T; u(0) = u0
dt

(1.3.1)

where f is a known function of the unknown, u. Equation (1.3.1) must be solved for t > 0 subject to the initial (i.e., time
t = 0) condition u(0) = u0. We approximate the derivative at time t = ti by

du ∣ u(ti+ 1) − u(ti)
( )∣ ≈
dt ∣t=ti ti+ 1 − ti

(1.3.2)

We note that the derivative at t = ti is replaced by its definition except that we did not take the limit Δt ≡ ti+ 1 − ti → 0;
that is why it is an approximation. We also note that the slope of u at ti in Eq. (1.3.2) is based on values of u at ti and ti+ 1.
We can also take it to be the slope at t = ti+ 1

du ∣ u(ti+ 1) − u(ti)
( )∣ ≈
dt ∣t=ti+1 ti+ 1 − ti

(1.3.3)

The formula in Eq. (1.3.2) is called, for obvious reasons, forward difference, while that in Eq. (1.3.3) is called backward
difference. The forward difference scheme is also known as Euler's explicit scheme or first-order Runge–Kutta method. For
increasingly small values of Δt, we hope that both approximations have a decreasingly small error in the computation of
the slope. However, the two schemes will have different numerical convergence and stability behavior, as will be discussed
in more detail in Chapter 7.

Substituting Eq. (1.3.2) into Eq. (1.3.1) at t = ti, we obtain the forward difference formula

ui+ 1 = ui + Δt f(ui,ti), ui = u(ti), Δt = ti+ 1 − ti

(1.3.4)

Equation (1.3.4) can be solved, starting from the known value u0 of u(t) at t = 0, for u1 = u(t1) = u(Δt). This process
can be repeated to determine the values of u at times t = Δt,2Δt,… ,nΔt. Of course, there are higher-order finite
difference schemes that are more accurate than the Euler's scheme and we will not discuss them as they are outside the
scope of this study. Note that we are able to convert the ordinary differential equation, Eq. (1.3.1), to an algebraic equation,
Eq. (1.3.4), which needs to be evaluated at different times to construct the time history of u(t).

We now apply Euler's explicit scheme to the second-order equation(1.2.4) subjected to the initial conditions in Eq. (1.2.5).
To apply the procedure described above to the equation at hand, we rewrite Eq. (1.2.4) as a pair of first-order differential
equations (note that vx = ℓv)

https://accessengineeringlibrary.com/content/book/9781259861901/toc-chapter/chapter1/section/section4

© McGraw-Hill Education. All rights reserved. Any use is subject to the Terms of Use, Privacy Notice and copyright information.
dθ dv
= v, = −λ2θ (λ2 = g/ℓ)
dt dt

(1.3.5)

which are coupled (i.e., one cannot be solved without the other). Applying the scheme ofEq. (1.3.4) to the equations at hand,
we obtain

θ i+ 1 = θ i + Δt vi; vi+ 1 = vi − Δt λ2θ i

(1.3.6)

The expressions for θ i+ 1 and vi+ 1 in Eq. (1.3.6) are repeatedly computed using the known solution (θ i, vi) from the
previous time step. At time t = 0, we use the known initial values (θ 0, v0). Thus, one needs a computer and a computer
language like MATLAB, Fortran, or C++ to implement the logic of repeatedly computing θ i+ 1 and vi+ 1 with the help of Eq.
(1.3.6).

The numerical solutions of Eq. (1.3.6) for three different time steps, Δt = 0.05, Δt = 0.025 and Δt = 0.001, along with
the exact linear solution in Eq. (1.2.9) (with ℓ = 2.0, g = 32.2, θ 0 = π/4, v0 = 0) are presented in Fig. 1.3.1. The
accuracy of the numerical solutions is dependent on the size of the time step; the smaller the time step the more accurate
the solution is. For large time steps the solution may even diverge from the true solution.

Figure 1.3.1 Comparison of the numerical solutions θ(t) obtained with Euler's scheme with the
analytical solution of the simple pendulum (linearized equations).

Example

https://accessengineeringlibrary.com/content/book/9781259861901/toc-chapter/chapter1/section/section4

© McGraw-Hill Education. All rights reserved. Any use is subject to the Terms of Use, Privacy Notice and copyright information.
Example 1.3.2

Problem statement (The heat flow problem): Consider the boundary-value problem of Example 1.2.2. Use the centered
difference method to determine the numerical solution of Eq. (1.2.19):

d2θ
m=√
βP
− + m2 θ = 0, , 0<x<L
dx2 kA

Solution: First we divide the domain (0,L) into a finite set of N intervals of equal length Δx, as shown in Fig. 1.3.2(b). Then
we approximate the second derivative of θ = T − T∞ directly using the centered difference scheme [error is of order
O(Δx)2]

≈( i 1 )
d2θ θ − − 2θ i + θ i+ 1
( )
2
dx x=xi (Δx)2

(1.3.7)

Figure 1.3.2 Heat transfer in a bar and a typical finite difference mesh.

This approximation involves three points, called mesh points, at which function evaluations are required. The mesh points
are separated by a distance of Δx. Using the above approximation in Eq. (1.2.19), we obtain

− (θ i− 1 − 2θ i + θ i+ 1) + (mΔx)2θ i = 0 or − θ i− 1 + [2 + (mΔx)2]θ i − θ i+ 1 = 0

(1.3.8)

Equation (1.3.8) is valid for any mesh point x = xi, i = 1,2,… ,N , at which the solution is not known. The formula
contains values of θ at three mesh points x = xi− 1, xi, and x = xi+ 1 at a time. Note that Eq. (1.3.8) is not used at mesh
point x = x0 = 0 because the temperature is known there, as given in Eq. (1.2.20). However, use of Eq. (1.3.8) at mesh
point x = xN = L requires the knowledge of the fictitious value θ N+ 1 (as we see in the sequel, we never have to deal with
such fictitious values in the finite element method). The forward finite difference approximation of the second boundary
condition in Eq. (1.2.20) at mesh point xN = L can be used to determine θ N+ 1:

https://accessengineeringlibrary.com/content/book/9781259861901/toc-chapter/chapter1/section/section4

© McGraw-Hill Education. All rights reserved. Any use is subject to the Terms of Use, Privacy Notice and copyright information.
θ N+ 1 − θ N
+ θ N = 0 ⇒ θ N+ 1 = (1 − ) θN
β βΔx
Δx k k

(1.3.9)

Application of the formula in Eq. (1.3.7) to mesh points at x1,x2,… ,xN yields

−θ 0 + Dθ 1 − θ 2 = 0
−θ 1 + Dθ 2 − θ 3 = 0
−θ 2 + Dθ 3 − θ 4 = 0
… … …
−θ N− 1 + Dθ N − θ N+ 1 = 0

(1.3.10)

where D = [2 + (mΔx)2]. Equation (1.3.9) can be used to eliminate θ N+ 1 from the last equation in (1.3.10). Then Eq.
(1.3.10) consists of N equations in N unknowns, θ 1,θ 2,… ,θ N.

As a specific example, consider a steel rod of diameter d = 0.02 m, length L = 0.05 m, and thermal conductivity k = 50
W/(m · ∘ C). Suppose that the temperature at the left end is T0 = 320∘C , ambient temperature is T∞ = 20∘C , and film
conductance (or heat transfer coefficient) β = 100 W/(m2 · °C). For this data, we have

β βP β(πd)
= 2, m2 = = = 400, θ 0 ≡ θ(0) = T(0) − T∞ = 300∘C
k kA k(πd2/4)

For a subdivision of four intervals (N = 4), we have Δx = 0.0125 m, D = 2 + (20 × 0.0125)2 = 2.0625, and
D − 1 + (βΔx/k) = 1.0875. For this case, there are four equations in four unknowns:

2.0625 θ 1 − θ2 = 300
− θ 1 +2.0625 θ 2 − θ3 = 0
− θ 2 +2.0625 θ 3 − θ4 = 0
− θ 3 +1.0875 θ 4 = 0

(1.3.11)

The above tridiagonal system of algebraic equations can be solved using the Gauss elimination method (this is where we
need a computer!). The solution is given by

{θ} = {245.81, 206.98, 181.10, 166.52}T

(1.3.12)

The analytical solution at the same points is

https://accessengineeringlibrary.com/content/book/9781259861901/toc-chapter/chapter1/section/section4

© McGraw-Hill Education. All rights reserved. Any use is subject to the Terms of Use, Privacy Notice and copyright information.
{θ} = {248.75, 213.13, 190.90, 180.66}T

(1.3.13)

The maximum error is about 7.8%. When the number of mesh points is doubled, the maximum error goes down to 4.2%, and
it is 1% when the number of mesh points is increased to 32 (results are not included here for these cases).

https://accessengineeringlibrary.com/content/book/9781259861901/toc-chapter/chapter1/section/section4

© McGraw-Hill Education. All rights reserved. Any use is subject to the Terms of Use, Privacy Notice and copyright information.

You might also like