Post on 11-Jan-2016
1
LECTURE 4
PDEs in the Real World
2
Aim of Lecture
• Recap of finite difference method & Neumann boundary conditions
• The finite difference method for non standard cases• Accuracy & errors of the finite difference method• Historical milestones in the solution of PDEs• Commercial software for the solution of PDEs• Use of numerical computational tools in industry• Hardware technology for PDE solvers
3
Example – Tutorial 4, Q1
02
2
2
2
g
y
u
x
uu(
5,y)
=25
u(0,
y) =
25
25)0,( xu
0)5,(
x
y
u
MODEL
Insulated
25o C
25o C
(0,0)
(5,5)
REAL WORLD
Finite Difference MODEL
h = k = 0.5
i = 1 to 11
j = 1 to 11
25o C
4
Finite Difference Equations• Consider the Poisson equation.
02
2
2
2
gy
u
x
u
022
2
1,,1,
2
,1,,1
g
k
uuu
h
uuu jijijijijiji
• When h = k we have:
Insulated
25o C
25o
C
(0,0)
(5,5)
44
21,1,,1,1
,
ghuuuuu jijijiji
ji
25o C
5
Including Boundary Conditions
• Dirichlet easily implemented:– at sides of domain
– at bottom of domain
Insulated
25o C
25o C
(0,0)
(10,5)
25,1 ju 25,11 ju
25o C
i = 1 2 10 11
j = 1
2
10
11
251, iu
6
Including Boundary Conditions• Neumann Boundary Condition
• FD equation at top boundary (i = 2 to 10) 25
o C
25o C
(0,0)
(5,5)0
y
u
44
210,12,11,111,1
11,
ghuuuuu iiii
i
Virtual Nodes outside the domain
25o C
i i+1i-1
j=11
j=12
j=10
h h
7
Including Boundary Conditions• Use central difference formula.
• At top boundary.
• Therefore Neumann top boundary condition (i = 2, …, 10).
25o C
25o C
(0,0)
(5,5)0
y
u
k
uu
y
u jiji
ji2
1,1,
,
10,12, ii uu
44
2 210,11,111,1
11,
ghuuuu iii
i
25o C
8
Results & Demo
g = 5 g = –5
9
Using Excel – summary/list of tasks• Set up the parameters of problem such as FLAG, h, k, g
– NB when solving a Laplace equation it is better to set up Excel to solve Poisson and then just set g = 0
• Set up the domain (size, x/y values)• Fill in the known (Dirichlet) boundary values• Work out the general FD formula and copy it across all
cells with unknown values• Work out FD formulas for all unknown (Neumann)
boundary values and copy to relevant cells – next week• There should be no cells inside the domain that
reference cells outside the domain (apart from parameters like g or h)– Double click each boundary cell to check
10
Extensions to finite difference method
• Now have a set of tools which we can apply to non-standard cases– Non-square geometries (easy … provided they are
composed of rectangular objects)
– Non-standard equations– Non-standard boundary conditions
• Most real-life cases are non-standard!
11
Non-standard equations• Example (the coefficient 3 makes this non-standard but Laplace like)
• But can substitute difference equations just as before.03
2
2
2
2
y
u
x
u
03632
2
1,,1,
2
,1,,1
k
uuu
h
uuu jijijijijiji
)3(2
322
1,1,2
,1,12
, kh
uuhuuku jijijiji
ji
• Difference formula for each node:
• When h = k we have:
8
33 1,1,,1,1,
jijijiji
ji
uuuuu
12
Non-standard boundary conditions• Example (the –u term makes this non-standard)
• But can use central difference as before
• Here we need to discretise u as
so that
)O(2
21,1,
,
kk
uu
y
u jiji
ji
(once again this introduces artificial nodes, , outside the boundary)
ui,j
uy
u
i i+1i -1j - 2
j -1
j
jiu ,
jijiji
jijiji
kuuu
uk
uu
,1,1,
,1,1,
22
1, jiu
13
Accuracy• The finite difference method is based on truncated Taylor series
)O(2 2
2
,1,,1
,
2
2
xx
uuu
x
u jijiji
ji
- Central difference
• So the errors in this approximation are of the order x2.
• Similar for the derivative in y.
• But x & y are just the mesh spacing in x & y directions.
• Therefore a finer mesh will have lower discretisation errors.
Increase in Accuracy
14
Accuracy
• Example: if x = y = 0.1 then the error is of the order 0.12 = 0.01
• Suppose we double the number of mesh points in x & y directions
• This halves the mesh spacing x = y = 0.05
• So the error is now of the order 0.052 = 0.0025
• Much more accurate.
Increase in Accuracy
15
Accuracy• To test for accuracy we could just keep halving the mesh spacing
• If the solution doesn’t change when we do this, we can assume that the truncation error is insignificant and the discretisation is accurate.
• However as the mesh spacing tends to zero, the number of grid points (and hence the solution time) tend to infinity.
• This is not a problem for the simple examples with just a few grid points that we look at in this course, but in real-life cases, with millions of grid points, it can be a major headache.
Increase in Accuracy
Increase in solution time
Quality of Numerical SolutionsConsistency Discretisation method should become exact as mesh
spacing tends to zero. Therefore truncation error becomes zero as mesh spacing tends to zero.
Stability Numerical solution is stable if it does not magnify errors that appear during the course of solution. For example with iterative methods the solution does not diverge.
Conservation The numerical scheme used ensures that the dependent variable, for example temperature, is conserved. (i.e energy is not created nor destroyed).
Boundedness Numerical solution should lie within specific bounds. For example temperature should be within boundary conditions or temperature cannot be less than -273 Kelvin.
16
Errors in PDEsModelling Errors
These are the difference between the mathematical model and the real world it is trying to represent.
Discretisation Errors
Difference between the exact solution to the mathematical model and the discretised equations used to approximate it.
Convergence Errors
Difference between the iterative solution results and the exact solution to the discretised equations.
Other Errors Other errors, such as rounding errors and overflow errors, can creep in if the programmer is not careful.
17
18
Examples of costly error• Modelling error: The wobbling of the Millenium Bridge,
London, meant that on June 12, 2000 (just two days after opening) it had to be closed and re-engineered.
• Overflow error: The explosion of the Ariane 5 rocket, valued at $500 million, just after lift-off on its maiden voyage off French Guiana, on June 4, 1996, was the consequence of a simple overflow.
• Discretisation error: The sinking of the Sleipner A offshore platform in Gandsfjorden near Stavanger, Norway, on August 23, 1991, resulted in a loss of nearly $1,000,000,000.
(see http://www.ima.umn.edu/~arnold/disasters and http://www.arup.com/MilleniumBridge)
19
Software for solution of PDEs
20
Background – Historical Milestones• Modelling started with the Greeks (1000BC)• Major Breakthrough – Calculus
– Newton, Liebnitz (17th Century)
• Governing PDE equations of physics– Heat Transfer – Fourier (18th Century)– Fluid Flow – Bernouli, Navier-Stokes (19th Century)– Stress Analysis – Hooke, Navier (18th Century)– Electromagnetics – Maxwell (19th Century)
• Only analytical solutions feasible.
21
• Finite differences used to analyze the Aswan dam - Egypt.- “L.F Richardson; Trans. Roy. Soc. A, 210, 307-357 (1910)”.
- used students to compute system of equations !!
• Numerical Methods for solution of equations 19th-20th Centuries
• Computers arrive 1950……
• Birth of Computational Solutions to PDEs – 1950s – 1960s
• Finite Element first used for the analysis of aircraft structures
- “M J Turner et al; J. Aeronautical Sciences, 23, 805-823 (1956)”
- Method based on variational approach - linear stress (Bars, Beams)
Background – Historical Milestones
22
• Finite Elements applied to field problems – Heat Transfer
- “O. Zienkiewicz; The Engineer, 24, 507-510, (1965)”
• Finite Volume Methods first used (Computational Fluid Dynamics)
- “A Wilmslow; J Comp Physics, 1, 149-172, 1966”
- Navier-Stokes flow: “Patankar, Spalding; Int J Heat Mass Trans, 15, 1787-1806 (1972).
• 2000 onwards – computational Modelling now used in all areas of science and engineering.
Background – Historical Milestones
23
Steps in Analysis• CAD – MESHING – ANALYSIS - VISUALISATION
CAD MESH ANALYSIS VISUALISATION
DESIGN ITERATIONS
24
Meshing – Structured and Unstructured
• Data referenced using i,j grid lines
• Poor on complex shapes.
• Finite Difference Methods.
• Good for complex geometry
• Topology representation
- Points - Faces - Elements
• Mixed element types.
• Finite Element and Finite Volume Methods
25
CAD + Meshing Software
• CATIA– http://www.catia.com
• Mentor Graphics– http://www.mentor.com
• FEMSYS– http://www.tnodiana.com
26
Commercial Software – Fluid Flow
• Resources at : http://www.cfd-online.com • Fluent
– http://www.fluent.com • FLOTHERM
– http://www.flomerics.com • PHOENICS
– http://www.cham.co.uk • PHYSICA
– http://www.physica.co.uk
27
Commercial Software – Stress Analysis
• Resources at : http://homepage.usask.ca/~ijm451/finite/fe_resources/fe_resources.html
• ANSYS
– http://www.ansys.com
• MSC Software (NASTRAN, MARC)– http://www.mscsoftware.com
28
Visualisation Software• Most analysis codes will have some
visualisation capabilities.• Leading-edge visualisation codes:
– AVS• http://www.avs.com
– Ensight• http://www.ensight.com
– Flomotion• http://www.flomerics.com
29
Hardware• 1940-50s : ENIAC, Collosuss
– Vacuum Tubes
– <1000’s operations per second
• 1960s Birth of the Transistor
– IBM 360
– DEC PDP-8
– Languages : Fortran
– Punch Cards
• All the above expensive.
• Humble scientists limited to the slide rule.
IBM System 360
Collosuss
Slide Rule
30
Measuring Performance
• Computer speed is often measured in flops• This is the number of floating point operations
(e.g. add, subtract, multiply, divide) that can be performed in 1 second– 1 Megaflop = 1 x 106 Flops (1,000,000)
– 1 Gigaflop = 1 x 109 Flops (1,000,000,000)
– 1 Teraflop = 1 x 1012 Flops (1,000,000,000,000)
– 1 Petaflop = 1 x 1015 Flops (1,000,000,000,000,000)
31
Hardware• 1970s Integrated Circuits
– Cray-1– DEC PDP-11– Vector Processing, – Punch cards– Speed: 1-100 Million Flops
• 1980s : Microprocessors– IBM-PC– Multiprocessor machines– Distributed and Shared Memory– Visualisation software– Speed: 1 Billion Flops (Gigaflop)
Cray - 1
IBM-PC
32
Parallel Processing.• Despite fantastic improvements in computational power, scientists still want to solve problems that take too long (weather simulations, etc)
•Why use only one processor when we can use many?
P ro ce sso r 1 P ro ce sso r 2
P ro ce sso r 3 P ro ce sso r 4
P ro ce sso r 5 P ro ce sso r 6
P ro ce sso r n -1 P ro ce sso r n
S im u la tio n C o de
Traditional (serial) approach
Parallel Processing Approach
Simulation Code
Computer Processor
•Requires rewriting software to allow communication calls.
•Advantage is ability to solve larger problems in shorter time.
33
Issues• Bandwidth
– Rate at which data can be transferred.• Latency
– The time between a process being ready to transmit data and the time at which it is transmitted (often arises due to synchronisation issues).
• Speed up– How fast a parallel simulation is compared to a serial
one, i.e. serial runtime/parallel runtime.• Scalability
– How large a system can be made before performance starts to drop off.
34
Example • Solution of PDEs for modelling Oil Reservoirs.• Hundreds of thousands of elements.• Near perfect speed up for small numbers of
processors
0
5
10
15
20
25
Sp
ee
d U
p
2 4 8 16 32Processors
Linux cluster +SGI O2K (SGI)
IBM SP (ANL)CRAY T3E
+ PC-based cluster using MYRINET
35
Hardware• 1990s
– PC’s catch up with workstations– C, JAVA, Fortran 90, HPF– Internet– Parallel computers (e.g. ASCI)– Speed: TeraFlops
• 2000s– Ultra fast processors– Dual core/quad core machines on desktop– Gigabyte communication bandwidth– Computational Grids (e.g. parallel computers in Chicago &
Stuttgart collaborating on same problem!)– Towards PetaFlop Computing and PetaByte Storage
ASCI - White
36
Worlds Fastest Computers – Nov 2006http://www.top500.org
Based on LINPACK Benchmarks