Professional Documents
Culture Documents
CHL-392
MATLAB Programming of Polymerization
Processes using Monte Carlo Techniques
Monte Carlo Methods are methods that use random numbers and probability
statistics to solve a given problem. In simulating events, as in the case of this
paper, a random number is generated, the different events in this case are the
different reactions taking place which for the system that I have considered are
the 22 reactions taking place. Probability of each of these reactions taking place
is calculated based on the rate of the reaction, which is divided by the sum of all
rates to give the probability. Depending on the random number generated and its
proximity to one of the 22 reactions points one of the reactions is chosen and
simulated. After the simulation of reactions some important property has been
calculated.
In
So a cell matrix is an
array of vectors. Every
time we
add a monomer to a cell
matrix
we will increment the length
cell matrix and add one
more vector in the cell
matrix we will use indexing to keep track of whether
A(1) got added or B(0). In case of dormant chain
converting to free radical chain we will remove that
particular vector from the cell matrix of the dormant
chain and add it to the cell matrix for the free radical
chain. Dead chains are represented by a normal matrix
which is an nxn matrix.
dead
wont
the
of the
matrix is shifted
whether
normal
For the
followed.
Algorithm used for the code. The program has been simulated based on the time
of the reaction. Note that the reaction rate constants used can make a significant
difference to the time required to run the code. As I couldnt find the rate
constants through a literature survey, I have taken them as input from the user.
One drawback of the method used is that it makes use of dynamic arrays and
hence every time we have to allocate some value, Matlab makes a new array
copies the values of the older array into the new array and then assigns the new
value this makes the code computationally slower. A language which allows
dynamic array formation would have been better suited for the purposes of the
code. Conversion with time is plotted in the code
Xi = Xi-1;
Xc = Xc-1;
Xpr = Xpr +
1;
Xcx = Xcx +
1;
Xa = Xa -1;
LEN = length(Ra);
rvec =
vec =
cell2mat(Ra(rvec));
Ra{rvec} = vec;
Simulating the cross-propagation reaction
Xb = Xb
-1;
Xrb = Xrb +
LEN =
length(Ra);
rvec =
vec =
cell2mat(Ra(rvec));
lvec =
Rb(Xrb) =
Xra = Xra
-1;
Ra(rvec)
Find length of Ra
LEN =
length(Ra);
rvec1 =
randsample(LEN,1);
rvec2 =
randsample(LEN,1);
vec1
=cell2mat(Ra(rvec1));
vec2 =
lvec1 =
length(vec1);
lvec2 =
length(vec2);
Xp = Xp
+ 1;
P(Xp) =
lvec1 +lvec2;
Xra -2
Xra =
Ra{rvec1} = [];
Ra{rvec2} = [];
give the plot for conversion vs time. Similarly PDI, Molecular Weight Distribution
can also be done. I havent been able to do that because the data is not available
and due to the limited computing power.