Download Examples of Discrete Models-Mathematical Modeling and Simulation-Lecture Slides and more Slides Mathematical Modeling and Simulation in PDF only on Docsity!
Lecture Slides
on
Modeling and Simulation
Lecture : Examples of Discrete Models
Discrete Mathematical Models
- There are two important types of discrete systems. The first type
is a discrete system having distinct objects or components and/or
discrete properties and relations associated with them.
- The objects of a discrete system are usually known as entities.
These entities possess attributes that are properties, qualities or
characteristics.
- Entities may be in two kinds of states: either they are busy in
some activity or they are idle and waiting in a queue. The queue
means the common state in which various entities are present
before they move to a next state.
Steady State Heat Conduction Equations
One- Dimensional Discrete Problem
Suppose a discrete system is bounded by two Bo and B1 states as shown in
Fig. 5.18 and S1 to SK are all source states. The random walk of particles
diffusing in the system is assumed to obey the following rules:
Figure 5.18 A One-dimensional discrete model for heat conduction.
Terminal (^) Terminal
B 0 G 1 GK BN
S 1 SK
G 3
S 3
G 2
S 2
- Every particle stays in a state for a short fixed interval of time (say one
micro-second) before going into another state.
- A particle generated in the source state (Si) goes to the ordinary state Gi
with probability one.
- The total number of particles in G0 and G3 are always kept constant
equal to no and n3 respectively.
- A particle that entered G1 or G2 stays there for a short interval (say one
micro-second) and then moves to the left or right state with probability 0.5 to each direction.
- A particle originally at Go goes to the G1 with a probability 0.5 or
terminates its life without going to G1 with probability 0.5. A similar rule applies to G2 too.
- If a particle reaches Go from G1 or G3 from G2 , the life of the particle is
terminated.
- The number of particles in the source states is always maintained to be
Qi.
One- Dimensional Random Walk
N = 200; imax = 100; jmax = 2;
nframes = 20; % number of frames for movie
rand('state', 0) % initialize
i = 50;
for kk = 1: 1000
rr = rand; if((rr >= 0 ) & ( rr < 0.5) ) i = i + 1; elseif((rr >= 0.5 ) & ( rr < 1.0) ) i = i - 1; end if i >= imax break end if i <= 1 break end
plot(kk, i, 'r:.'); hold on F(kk) = getframe; kk
end
Program: One- Dimensional Random Walk
Result: One- Dimensional Random Walk
Here we started with ith position = 50 for a grid of 100 mesh points and as a
function of MC steps we see above the random walk.
Here boundary values are given as A , B , C , and D respectively.
Consider a situation where i = u and j = v is the point where is to be
estimated. Then the Monte Carlo game can be played as following:
1. A particle starts its random walk from a point P (i, j).
2. It can move up, down, right or left i.e., it can have positions (i, j+1), (i, j-1),
(i+1, j), and (i-1, j) respectively with equal probability of ¼ for each
direction.
3. The score of this game is initiated as Ci, j is zero before the start of random
walk.
4. As particle stays in (i, j) position for a second the score is increased by Qi, j.
If it reaches a boundary stat then the C(i, j) is increased by the appropriate
value of f at the boundary and then the life of the particle is terminated.
5. After a large number of games, the average value of C(i,, j ) is approximated
to the f( i,, j ).
Steady State Heat Conduction Equations
Example of Two-dimensional Discrete Model
0 r 0. 25
, the motion will be towards left side if
, the motion will be towards upward direction if^0.^25 ^ r ^0.^5
, the motion will be towards right side if 0. 5 r 0. 75
, the motion will be towards downward direction if 0. 75 r 1. 0
We have a sold bar with surface temperatures known and fixed. There are no
internal heat sources present in the system. Find the temperature at a node (1,
2) using Monte Carlo procedure. The cut-view of the bar in two-dimensional
model is shown in figure. For the point (1,2) let us first formulate the conditions
to play the Monte Carlo game. Its conditions are following:
The random walk is allowed to repeat again with the same start.
Random Number ( r )
Comparison & Decision
Next Position Temperature (oC)
0.390 Up (1, 3) 0
0.977 Down (1, 2) 0
0.202 Left Boundary 100
The next game’s results are shown below:
Random Number ( r )
Comparison & Decision
Next Position Temperature ( oC )
0.949 Down (1, 1) 0
0.751 Down Boundary 70
This game was allowed to repeat ten times and the average temperature
has been estimated as following:
200 100 100 70 10 100 70 100 100 10
T ^ = 86^
oC.
% Program name: monte_diffusion.m for k_trace = 0: 2 N = 200; imax = 100; jmax = 100;
nframes = 20; % number of frames for movie i = 50; j = 50; rand('state', k_trace) % this sets the generator to an
initial state for k = 1: 8000 % left = 0; right = 0; % top = 0; bottom = 0;
for kk = 1: 10 rr = rand; % if((rr >= 0 ) & ( rr < 0.25) & (right == 1)) if((rr >= 0 ) & ( rr < 0.25) ) i = i + 1; j = j; elseif((rr >= 0.25 ) & ( rr < 0.50) ) i = i; j = j + 1; elseif((rr >= 0.50 ) & ( rr < 0.75)) i = i - 1; j = j; elseif((rr >= 0.75 ) & ( rr <= 1.00)) i = i; j = j - 1; end end
Self-avoiding walks
After each step has been added, a random number is used to decide
between the different possible choices for the next step. If the new
site is one which already contains a portion of the walk, the process is
terminated at the Nth step.
The most simple minded approach to the analysis of the data is to
simply make a plot of log<R^2 (N)> vs log N and to calculate v from
the slope.
If corrections to scaling are present, the behavior of the data may
become quite subtle and a more sophisticated approach is needed.
The results can instead be analyzed using traditional 'ratio methods‘.
Examples of different kinds of random walks (RW) on a square lattice.
For the ordinary unbaised RW every possible new step has the same
probability. For the self-avoiding walks (SAW) the walk dies if it touches
itself.
Self-avoiding walks (SAW)