You are on page 1of 62

MATHEMATICAL MODELING AND SIMULATION

For
PhD Programme

Shakeel Ahmed Kamboh


PhD (Computational Science)
Department of Mathematics and Statistics
QUEST, Nawabshah

(1)
Course Description

This course provides an introduction to mathematical modeling and


computer simulation of physical and engineering systems.

Working with a broad range of examples, students practice the steps


involved in modeling and analyzing a physical system, learn the role of
models in explaining and predicting the behavior of the physical world,
and develop skills with the programming and computational tools
necessary for simulation.

The course will demonstrate modeling and simulation approaches and


tools that play an increasingly important role in research studies by
applying both the fundamental and applications methods to key
engineering problems.

(2)
Course Objectives

The purpose of teaching this course is to introduce and apply basic


methods and tools for modeling and simulation of continuous, discrete
and combined systems. The main objectives are to:

 Teach students how to mathematically model engineering systems and

 Teach students how to use computer tools to solve the resulting


mathematical models.

The computer tools will be used MATLAB and COMSOL Multiphysics; the
focus will be on developing and solving models existing in various field of
science, engineering and Technology.

(3)
Attendance and Assessment

For Attendance Policy can refer Postgraduate Prospectus

This is a 4 CH course  16 Weeks  Total 64 Lectures

Lecture Schedule

Monday  02:00 pm-3:00 pm


Tuesday  02:00 pm-05:00 pm

(4)
Course Outlines
• Introduction to Mathematical Modeling and Simulation
– Different Real World Systems and Natural Phenomena
– Modeling Process and Model Classification
– Some General Concepts

• A General Overview of Mathematics


• Formulation of Mathematical Models Using
– Linear and Nonlinear Equations
– Systems of Linear and Nonlinear Equations
– Linear and Nonlinear Inequations
– Systems of Linear and Nonlinear Inequations
– Ordinary Differential Equations (ODEs)
– System of ODEs
– Partial Differential Equations (PDEs)
– System of (PDEs)
– Integral Equations
– State Equations

(5)
Course Contents
• Applications of ODEs, PDEs and State Equations
– Initial and boundary value problems
– Wave Motion
– Vibration of a Stretched and Flexible String
– The Vibrating Membrane
– Longitudinal vibration of an Elastic Bar
– Transmission-Line Equations
– Diffusion
– Gravitational Potential
– Electric Potential
– Heat Conduction
– Heat Transfer
– And many others
• Simulation Techniques in 1D and 2D Problems
– Simulation by Finite Difference Method (FDM)
– Simulation by Finite element method (FEM)

• Stochastic Models and Monte Carlo Simulation Methods


• Model Optimization and Calculus of Variation
(6)
Course Contents
• MATLAB Programming
– Arrays and Matrices

– Polynomials and function handles

– Loops and Flow controls

– Data Analysis and Statistics

– Curve fitting

– 1D, 2D and 3D graphics and animation

– ODEs and PDEs

– Optimization

– Signal and image processing

(7)
Course Contents
• Modeling and Simulation of Various Engineering Problems
using COMSOL Multiphysics
– AC/DC
– Diffusion
– Wave Propagation
– Electromagnetism
– Acoustic
– Batteries and Fuel Cells
– Computational Fluid Dynamics (CFD)
– Chemical Reactions
– Heat Transfer
– Plasma
– Radio Frequency
– Structural Mechanics
– Quantum Mechanics
– Subsurface Flow
– Microelecromechanical systems (MEMS)
– Equation Based Models

(8)
Recommended Books

• Chapra S.C, Canalae R.P, Numerical Methods for Engineers,


McGraw Hill, 2003 or latest.
• Cuvelies C.J; Segal a.; and Van Steen Hover, Finite element
methods and Navier-Stokes Equations, D. Reidel Pub. Co, Boston,
Tokyo 2005 or latest.
• Hargreaves M., Engineering System Modeling and control, Logman,
2005 or latest.
• Burden R.L; Faires J.D; Numerical Analysis, PWS Publishing Co.
Boston, 2006 or latest.
• Kai Velten, Mathematical Modeling and Simulation, WILEY-VCH
Verlag GmbH & Co, Weinheim, 2009
• Michael Alder, An Introduction to Mathematical Modeling, online.
• Stewart Robinson, Simulation: The Practice of Model Development
and Use, John Wiley & Sons Ltd

(9)
Week-01, Lectures:1-4

INTRODUCTION TO

MATHEMATICAL MODELING AND SIMULATION (MMS)

(10)
What Is A Model ?

A representation of an object, a
system, or an idea in some form
other than that of the entity itself.

(11)
Types of Models

Physical
(Scale models, prototype plants,…)
Mathematical
(Analytical queueing models, linear
programs, simulation)

(12)
What is Simulation?

 A Simulation of a system is the operation of a


model, which is a representation of that system.
 The model is amenable to manipulation which
would be impossible, too expensive, or too
impractical to perform on the system which it
portrays.
 The operation of the model can be studied, and,
from this, properties concerning the behavior of
the actual system can be inferred.

(13)
Applications

Designing and analyzing manufacturing


systems
Evaluating H/W and S/W requirements for
a computer system
Evaluating a new military weapons
system or tactics
Determining ordering policies for an
inventory system
Designing communications systems and
message protocols for them

(14)
Applications

Designing and operating transportation


facilities such as freeways, airports,
subways, or ports
Evaluating designs for service
organizations such as hospitals, post
offices, or fast-food restaurants
Analyzing financial or economic systems

(15)
Why Teach with Simulations?

Deep Learning
• Instructional simulations have the potential to engage
students in "deep learning" that empowers
understanding as opposed to "surface learning" that
requires only memorization.

(16)
Why Teach with Simulations?
Deep learning means student can learn scientific methods including

• The importance of model building.


• Experiments and simulations are the way scientists
do their work.
• Using instructional simulations gives students
concrete formats of what it means to think like a
scientist and do scientific work.
• the relationships among variables in a model or
models. Simulation allows students to change
parameter values and see what happens.
• Students develop a feel for what variables are
important and the significance of magnitude changes
in parameters.
(17)
Why Teach with Simulations?
• data issues, probability and sampling theory.
Simulations help students understand probability and
sampling theory.
• Instructional simulations have proven their worth many
times over in the statistics based fields.
• The ability to match simulation results with an analytically
derived conclusion is especially valuable in beginning
classes, where students often struggle with sampling
theory.
• how to use a model to predict outcomes.
• Simulations help students understand that scientific
knowledge rests on the foundation of testable hypotheses.

(18)
Why Teach with Simulations?
Learn to reflect on and extend knowledge by:
• actively engaging in student-student or
instructor-student conversations needed to
conduct a simulation. Instructional simulations by
their very nature cannot be passive learning.
• Students are active participants in selecting
parameter values, anticipating outcomes, and
formulating new questions to ask.
• transferring knowledge to new problems and
situations. A well done simulation is constructed to
include an extension to a new problem or new set of
parameters that requires students to extend what
they have learned in an earlier context.

(19)
Why Teach with Simulations?
• understanding and refining their own
thought processes. A well done simulation
includes a strong reflection summary that
requires students to think about how and why
they behaved as they did during the
simulation.
• seeing social processes and social
interactions in action. This is one of the
most significant outcomes of simulation in
social science disciplines such as sociology
and political science.

(20)
Steps In Simulation and
Model Building

1. Define an achievable goal


2. Put together a complete mix of skills on
the team
3. Involve the end-user
4. Choose the appropriate simulation tools
5. Model the appropriate level (s) of detail
6. Start early to collect the necessary
input data
(21)
Steps In Simulation and
Model Building (cont’d)
7. Provide adequate and on-going
documentation
8. Develop a plan for adequate model
verification
(Did we get the “right answers ?”)
9. Develop a plan for model validation
(Did we ask the “right questions ?”)
10. Develop a plan for statistical output
analysis
(22)
Define An Achievable Goal

“To model the…” is NOT a goal!


“To model the…in order to
select/determine feasibility/…is a
goal.
Goal selection is not cast in concrete
Goals change with increasing insight

(23)
Put together a complete
mix of skills on the team
We Need:
-Knowledge of the system under investigation
-System analyst skills (model formulation)
-Model building skills (model Programming)
-Data collection skills
-Statistical skills (input data representation)

(24)
Put together a complete
mix of skills on the team(continued)

We Need:
-More statistical skills (output data
analysis)
-Even more statistical skills (design of
experiments)
-Management skills (to get everyone
pulling in the same direction)

(25)
Involve the end user

-Modeling is a selling job!


-Does anyone believe the results?
-Will anyone put the results into action?
-The End-user (your customer) can (and
must) do all of the above BUT, first he
must be convinced!
- He must believe it is HIS Model!

(26)
Choose the Appropriate Simulation Tools

Assuming Simulation is the appropriate means,


three alternatives exist:
1. Build Model in a General Purpose
Language
2. Build Model in a General Simulation
Language
3. Use a Special Purpose Simulation
Package

(27)
Modeling with general purpose languages

 Advantages:
– Little or no additional software cost
– Universally available (portable)
– No additional training (Everybody knows…(language X) ! )
 Disadvantages:
– Every model starts from scratch
– Very little reusable code
– Long development cycle for each model
– Difficult verification phase

(28)
General Purpose Languages Used for Simulation

FORTRAN
– Probably more models than any other language.
PASCAL
– Not as universal as FORTRAN
MODULA
– Many improvements over PASCAL
ADA
– Department of Defense attempt at standardization
C, C++
– Object-oriented programming language

(29)
Modeling with general simulation languages

 Advantages:
– Standardized features often needed in modeling
– Shorter development cycle for each model
– Much assistance in model verification
– Very readable code
 Disadvantages:
– Higher software cost (up-front)
– Additional training required
– Limited portability

(30)
General purpose simulation languages

 GPSS (General Purpose Simulation System)


– Block-structured Language
– Interpretive Execution
– FORTRAN-based (Help blocks)
– World-view: Transactions/Facilities

 SIMSCRIPT II.5
– English-like Problem Description Language
– Compiled Programs
– Complete language (no other underlying language)
– World-view: Processes/ Resources/ Continuous

(31)
GEN. PURPOSE SIMULATION LANGUAGES (continued)

 MODSIM III
– Modern Object-Oriented Language
– Modularity Compiled Programs
– Based on Modula2 (but compiles into C)
– World-view: Processes

 SIMULA
– ALGOL (Algorithmic Language) -based Problem Description
Language
– Compiled Programs
– World-view: Processes

(32)
Gen. Purpose Simulation Languages (continued)

 SLAM (Simulation Language for Alternative Modeling)


– Block-structured Language
– Interpretive Execution
– FORTRAN-based (and extended)
– World-view: Network / event / continuous
 CSIM
– process-oriented language
– C-based (C++ based)
– World-view: Processes

(33)
Modeling with Special-Purpose Simulation Packages

 Advantages
– Very quick development of complex models
– Short learning cycle
– No programming--minimal errors in usage
 Disadvantages
– High cost of software
– Limited scope of applicability
– Limited flexibility (may not fit your specific
application)

(34)
Special Purpose Packages Used for Simulation

 NETWORK II.5
– Simulator for computer systems
 OPNET
– Simulator for communication networks, including
wireless networks
 COMNET III
– Simulator for communications networks
 SIMFACTORY
– Simulator for manufacturing operations

(35)
The Real Cost of Simulation

Many people think of the cost of a


simulation only in terms of the software
package price.
There are actually at least three
components to the cost of simulation:
1. Purchase price of the software
2. Programmer / Analyst time
3. “Timeliness of Results”

(36)
MODEL THE APPROPRIATE LEVEL(S) OF DETAIL

Define the boundaries of the system to


be modeled.
 Some characteristics of “the
environment” (outside the boundaries)
may need to be included in the model.
Not all subsystems will require the same
level of detail.
Control the tendency to model in great
detail those elements of the system
which are well understood, while
skimming over other, less well -
understood sections.

(37)
START EARLY TO COLLECT THE NECESSARY INPUT DATA

Data comes in two quantities:


TOO MUCH!!
TOO LITTLE!!
With too much data, we need techniques for
reducing it to a form usable in our model.
With too little data, we need information
which can be represented by statistical
distributions.

(38)
PROVIDE ADEQUATE AND ON-GOING DOCUMENTATION

In general, programmers hate to document. (They


love to program!)
Documentation is always their lowest priority item.
(Usually scheduled for just after the budget runs
out!)
They believe that “only wimps read manuals.”
What can we do?
– Use self-documenting languages
– Insist on built-in user instructions (help screens)
– Set (or insist on) standards for coding style

(39)
DEVELOP PLAN FOR ADEQUATE MODEL VERIFICATION

Did we get the “right answers?”


(No such thing!!)
Simulation provides something that no other
technique does:
Step by step tracing of the model execution.
This provides a very natural way of checking
the internal consistency of the model.

(40)
DEVELOP A PLAN FOR MODEL VALIDATION

VALIDATION: “Doing the right thing”


Or “Asking the right
questions”
How do we know our model represents
the system under investigation?
– Compare to existing system?
– Deterministic Case?

(41)
DEVELOP A PLAN FOR STATISTICAL OUTPUT ANALYSIS

 How much is enough?

Long runs versus Replications

 Techniques for Analysis


Different Real World Systems and Natural Phenomena

Acoustic

Diffusion Electric Field

Magnetic Field
(43)
Different Real World Systems and Natural Phenomena

(44)
Different Real World Systems and Natural Phenomena

(45)
Modeling Process and Model Classification

(46)
Modeling Process and Model Classification

(47)
Terminology

System
– A group of objects that are joined together
in some regular interaction or
interdependence toward the
accomplishment of some purpose.
– Entity
– An object of interest in the system.
– E.g., customers at a bank

(48)
TERMINOLOGY (continued)

 Attribute
– a property of an entity
– E.g., checking account balance
 Activity
– Represents a time period of specified
length.
– Collection of operations that transform the
state of an entity
– E.g., making bank deposits

(49)
TERMINOLOGY (continued)

 Event:
– change in the system state.
– E.g., arrival; beginning of a new execution;
departure
 State Variables
– Define the state of the system
– Can restart simulation from state variables
– E.g., length of the job queue.

(50)
TERMINOLOGY (continued)

Process
– Sequence of events ordered on time

 Note:
– the three concepts (event, process, and
activity) give rise to three alternative ways of
building discrete simulation models

(51)
EXAMPLES OF SYSTEMS AND COMPONENTS

S y s te m E n titie s A ttr ib u te s A c tiv itie s E v e n ts S ta te


V a r ia b le s

B a n k in g C u s to m e r s C h e c k in g M a k in g A r r iv a l; # o f bu sy
account d e p o s its D e p a r tu r e te lle r s ; # o f
b a la n c e c u s to m e r s
w a itin g

Note: State Variables may change continuously (continuous sys.)


over time or they may change only at a discrete set of points
(discrete sys.) in time.

(52)
Classification of Mathematical Models

 Linear vs. nonlinear


If all the operators in a mathematical model exhibit linearity, the
resulting mathematical model is defined as linear. A model is
considered to be nonlinear otherwise.

 Static vs. dynamic


A dynamic model accounts for time-dependent changes in the state
of the system, while a static (or steady-state) model calculates the
system in equilibrium, and thus is time-invariant. Dynamic models
typically are represented by differential equations.

 Explicit vs. implicit


If all of the input parameters of the overall model are known, and the
output parameters can be calculated by a finite series of
computations, the model is said to be explicit otherwise implicit.

(53)
Classification of Mathematical Models
 Discrete vs. continuous
A discrete model treats objects as discrete (integer
values); while a continuous model represents the objects
in a continuous manner (intervals of real numbers).

 Deterministic vs. probabilistic (stochastic)


A deterministic model is one in which no chance or
randomness is involved. Stochastic models are based on
randomness.

 Deductive, inductive, or floating


A deductive model is a logical structure based on a
theory. An inductive model arises from empirical findings
and generalization from them. The floating model rests
on neither theory nor observation, but is merely the
invocation of expected structure.
(54)
Mathematical Models Involving Simple equations
Mathematical Models Involving Simple equations
Mathematical Models Involving Simple equations
Mathematical Models Involving Simple equations
Mathematical Models Involving Simple equations
Mathematical Models Involving Simple equations
Formulating Mathematical Models using constraints

Maxim ize Z  2000 x 1  800 x 2


 1500 x3

 0 .2 x 1  0 .4 x 2
 0 . 2 x 3  60

 0 .5 x 1  0 .6 x 2
 0 . 5 x 3  125
Subject to 
 0 .3 x 1  0 .6 x 2
 0 . 5 x 3  132
 0 .3 x 1  0 .1 x  0 . 2 x 3  30
 2

and

x1 , x 2
, x3  0
Formulating Mathematical Models using constraints

Maxim ize Z  14000 x 1  9000 x 2

 4 x 1  6 x 2  720

 6 x 1  3 x 2  480
Subject to 
 x 1  20
 x  30
 2
and
x1 , x 2  0

You might also like