simulation

advertisement
Matematisk modelering og
simulering
Hans Petter Langtangen
Simula Research Laboratory
Dept. of Informatics, Univ. of Oslo
Questions I will address
• What is mathematical modeling and
simulation, or computational science?
• Why is it so important?
• When/where is it useful?
• What kind of competence and knowledge is
needed?
The story of the success
of simulation is a story
about making
mathematics much more
useful
The role of mathematics
cannot be underestimated
• For the last 300 years, mathematics has been a
key tool in the development of science and
technology
• Result: dramatically higher living standards
• Mathematics will be dramatically more useful in
the future
• Why? Because of fast computers
• This fact will accelerate science and technology
Why computers make
mathematics more useful
• We have equations (mathematical models) for
how nature works
• Nature = weather, climate, oil production,
airplane manufacturing, space exploration,
epidemics, wireless communication, …
• The difficulty is to solve the equations
• Before the computer: specialized methods with
pen & paper for a few problems
• After modern, fast computers: general and
widely applicable solution methods
It is impossible to exaggerate the extent to which
modern applied mathematics has been shaped and
fuelled by the general availability of fast computers
with large memories. Their impact on mathematics,
both applied and pure, is comparable to the role of
telescopes in astronomy and microscopes in
biology... I am on the safest ground in surmissing that
computing will play en even bigger role in the next
century than today.
P. D. Lax, SIAM Review 1989
All modern weather forecasts
are based on extensive
simulation
Weather forecast in Norway
Horizontal resolution: 4 km
300 x 500 x 38 grid points
Time step: 1 min
Simulation period: 60 h
Determines parameters
in 20.5 billion points
Roar Skålin,
IT manager, met.no
The computer becomes a
lab
• We need to make a program to do
mathematics on a computer
• Complicated mathematical models and
solution methods can be packed in userfriendly software and ”hidden”
• With such software, the computer becomes a
cheap laboratory for experimentation!
• Using the computer as a lab is often called
simulation
• Here we look at simulation based on
mathematical models
Exploration software
Now we do computational
science
• Wikipedia definition:
Computational science is the use of
computers to perform research in other
fields. It is the application of computer
simulation and other forms of computation
to problems in various scientific disciplines.
It is not to be confused with computer
science which is the study of topics related
to computers and information processing.
Related terms
•
•
•
•
Computational science and engineering
Mathematical modeling and simulation
Numerical modeling
Scientific computing
(study, implement and apply algorithms)
• Numerical mathematics
(study properties of algorithms)
Computational science has become the third
pillar of the scientific enterprise, a peer
alongside theory and physical experiment.
Computational science is now indispensable to
the solution of complex problems in every
sector .
Advances in computing...make it possible to
develop computational models...to address
problems previously deemed intractable.
PITAC Report , ”Ensuring America’s
Competitiveness”, to the US president, 2005
The next 10 to 20 years will see
computational science firmly embedded
in the fabric of science – the most
profound development in the scientific
method in over three centuries.
US Department of Energy, 2003
DATASET UNSTRUCTURED_GRID
POINTS 201 float
2.77828 2.18262 -0.25
0.476 2.4 -0.85 0.85 2.4
-0.476 -0.476 2.4 -0.85
-0.85 2.4 -0.476 -0.85
2.4 0.476 -0.476 2.4 0.85
0.476 2.4 0.85 0.85
2.4 0.476 2.55 0.8625 0.66
CELLS 458 2290
4 41 29 65 80
4 53 41 65 82
4 35 34 47 71
The Simulation Pipeline
Prediction & Control
Results
Refinement
Processes
Computations
Mathematical Model
Simulation vs. real
experiments
• Simulation is cheap compared to physical
experiments (lab or field)
• Physical experiments may be dangerous,
impossible or too expensive
• Simulations give more detailed information
and understanding
• The best is to do both!
Past, present and future
applications of simulation
• Weapons, logistics, space exploration
• Classical industry (structural, car, ship, airplane, oil &
gas, chemical, consumer products, …)
• Electronics, telecommunications
• Advanced materials (incl. nanotechnology)
• Construction of new molecules (chemestry on computer)
• Environmental research, incl. climate predictions
• Medicine: surgery, diagnostics
• Geological evolution of the earth (e.g., oil reservoirs)
• Evolution of planets, galaxies, universe
• Biological processes and evolution
• Sociological, psycological, economical processes
Warm winters and cold
summers
Each frame in this animation of the surface temperature
of the Gulf Stream represents a seven day period.
Tsunamis in fjords
Knut-Andreas Lie, SINTEF
The tsunami in the Indian Ocean, Dec 26, 2004
Jan Olav Langseth
Dave George
Randy LeVeque
”Mesh level 1”
111 km x 111 km
”Mesh level 3”
1.7 km x 1.7 km
”Mesh level 4”
25 m x 25 m
Simulation is a key tool in
the aerospace industry
Crashing cars in the
computer is cheaper than in
reality
Unstructured grids
”High lift configuration”
CRAY T3E – 1450 processors, 25 million gridcells
University of Wyoming (1998)
Simulation is a key tool in
studying the universe
A comet, 1 km in diameter, entering Jupiter’s
atmosphere at 134,000 miles per hour. (Red
comet core of solid ice.)
Facts about the simulation
• Turbulent structures
• Gravity/temperature driven
•1 million CPU hours
• 1000 processors
• 100.000 GB of data
Joe Werne, Colorado Research
Associates DivisionNorthWest
Research Associates, Inc.
Simulation is a key tool in
the oil & gas industry
Oil-water flow in oil
reservoirs
Knut-Andreas Lie, SINTEF
New understanding of life
processes
Simulation is important in the exploration of
life processes, ranging from studies of DNA
to investigations of blood circulation and inner
organs like the heart, brain and lungs.
DNA and Drug Design
Better understanding of the
structure of DNA may lead
to new and improved drugs,
like a vaccine for the flu!
What happens with smoke
in your lungs?
3D time-dependent Navier-Stokes simulations of
the airflow in the lungs. Methods from aerospace
and car industry are adapted to life sciences.
Electrical activity in the heart:
estimate infarctions by
simulations
Blood flow simulation
Martin Sandve Alnæs
Tor Ingebrigtsen
Jørgen Isaksen
Kent-Andre Mardal
Ola Skavhaug
Univ. of Tromsø,
Simula Research Lab.
Challenges in simulation:
mathematics, algorithms,
software
•
•
•
•
•
Multi-physics
Multi-scale
Multi-disciplinary
Multi-institutional code/teams
Obtaining real-life input data, e.g., complex
geometries
• Total system simulation
(trees of complex simulation components)
Different types of
mathematical models are
used for different physical
scales
• Elementary particles: quantum mechanics
Schrodinger equation, system of particles
• Molecules: molecular dynamics
System of particles; ordinary differential eqs.
• Macro-scale: continuum mechanics
Partial differential eqs.
Limitations of simulation
• For some industrial processes (esp. structural
analysis), mathematical models and
simulation have high precision
• In complex media (geology, medicine) lack of
media details and complex physics may lead
to low quantitative precision
• Despite low precision, simulation may provide
important insight into the physics
• Simulation as a learning tool in combination
with human experience and knowledge is
often more useful than accurate prediction
Hardware vs algorithmic development 1970 - 2000
Updated version of chart appearing in “Grand Challenges: High performance computing and
communications”, OSTP committee on physical, mathematical and Engineering Sciences, 1992.
Computingin
in
Computing
Computing
in
Computing
in
Parallel
Parallel
Parallel
Parallel
• Simulation requires enormous computational
power (speed, storage)
• Processors get faster…(2x every 18 months)
• …but a much larger gain in speed comes from
coupling computers in parallel
• Split a problem in subproblems and let many
computers deal with subproblems in parallel
• Requires computers to communicate
• Humans think sequentially; constructing parallel
algorithms is hard
Simulation software is more
complex than most other
software!
•
•
•
•
•
Very large program systems
Complicated mathematical models
Great algorithmic complexity
Difficult to test, complicated output
Extreme demands to
 fast computations
 memory usage
• Fancy GUIs and colorful results…
Can anyone do simulation?
• Simulation packages have become ”easy” to
use and provide impressive colorful results
• Result: ”anyone” can simulate!
• However, without a thorough understanding
of the mathematical model, it is easy to
provide wrong input data, or ignore options
• Judging the quality of the results is difficult
What can go wrong?
• Lots of input data, usually with default values,
but are the default values appropriate?
• Picking the wrong mathematical model
• Forgetting boundary conditions
• Choosing an inadequate numerical solution
method and/or associated parameters
• Results consist of numerical artifacts and real
physical features – what is what?
Wrong simulations may lead to
very expensive disasters
• A primary example is the Sleipner platform
• Insufficient use of computations caused a
structural failure and the platform sank
• Cost: 700M $
What kind of competence
do we need to do
simulation?
• Many can run simulation programs, but at least one in
the team must understand the complexity of the model
and pitfalls of the program’s simulation techniques
• Education in simulation is immature and incomplete
• This competence is emerging in new computational
science & engineering university programs
• To do high-quality simulations, one needs competence
that take years to build systematically
• This competence building requires long-term strategic
plans in R&D institutions
Programming builds
competence in an effective
way
• Internal software development is an effective
and simple exercise to build competence
• ”Programming is understanding” (K. Nygaard)
• Even if a sophisticated external software
package is to be used for production
simulation, programming a simplified model is a
specific way to gain insight into the model and
relevant numerical techniques
• Programming is expensive, but building
competence is expensive, and delivering wrong
simulation results is even more expensive…
Summary
• Simulation (computer=lab) is a now key tool
in science and technology
• Every project should investigate the
possibilities offered by simulation!
• Better numerics and faster hardware will
make simulation even more important
• Simulation involves advanced mathematics,
physics, +++ and requires high competence
• The success of simulation relies on sucess in
proper competence building
• Programming = efficient competence building
Download