Formulating a Monte carlo simulation for corrosion initiation time

15 views (last 30 days)
Hi, I am currently working on formulating a Monte Carlo simulation for predicting corrosion initiation time whereby the formula being applied is
T = X^2 / [4D(erfc^-1(Cth/Co)^2]
where X, D, Cth, Co are random variables with lognormal distributions for X,Co and Cth is a uniform distribution and D a distinct value.
Below is some of the code for the variables required:
X = normrnd(40,0.1,1,1000);
Co = lognrnd(3.5,0.5,1,1000);
D = 5*(10^-5);
Cth= unifrnd(0.6,1.2,1,1000);
E= erfc(Cth/Co);
Where the issue arises is when I try to implement the equation as the random variables are vectors so the power function becomes inapplicable as it requires scalar quantities. More information and assistance is kindly welcome.

Answers (6)

Image Analyst
Image Analyst on 16 Apr 2017
I don't know about the erfc -1 versus the erfc, but how about this:
X = normrnd(40, 0.1, 1, 1000);
Co = lognrnd(3.5, 0.5, 1, 1000);
D = 5*(10^-5);
Cth = unifrnd(0.6, 1.2, 1, 1000);
E = erfc(Cth ./ Co);
T = X .^ 2 ./ [4 * D .* E .^ 2]
plot(T, 'b-');
grid on;
Simply use dot before any * / or ^ operations that use a vector.
  3 Comments
Barry Akenga
Barry Akenga on 17 Apr 2017
The plot arrived at is a Lognormal distribution plot for the probability density function. Which is also the plot I want to arrive at for the pdf.
Barry Akenga
Barry Akenga on 17 Apr 2017
Also I think I have made a mistake whereby, the random variables generation does not have a sigma(std) but has a COV(coefficient of variation). How are you able to generate the relative random variables for the code on matlab?

Sign in to comment.


Pablo Benítez
Pablo Benítez on 30 May 2018
Dear Barry,
I hope you are well. Interestingly, I am working on a similar research to yours, however, the time of corrosion initiation that I am looking for is for carbonation. Have you achieved to get the PDF for the initiation time?
I will be grateful to be in contact with you,
Regards,
Pablo
  2 Comments
Barry Akenga
Barry Akenga on 16 Jul 2018
Edited: Barry Akenga on 16 Jul 2018
Hi Pablo,
Apologies for the late response, I only managed to stumble across your query while perusing through outstanding mail on my inactive account. I did manage to conduct this research and obtain data through matlab. Is there anything in particular I may help you out on?
Regards, Barry
harsh Brar
harsh Brar on 8 May 2022
hi barry,
Hope you are doing well.
Lately I have been working on predicting the service life of concrete on the basis of chloride induced corrosion using monte carlo. I have been trying my best to get results from the code but its not working. I was hoping if you could help me with your code. That will be of great help.
looking forward to hear from you soon.
thank you.

Sign in to comment.


Pablo Benítez
Pablo Benítez on 19 Jul 2018
Hi Barry,
I hope you are going well. Fortunately, I managed to solve the problem of obtaining the time of corrosion onset by carbonation. I have had some problems to perform the Monte Carlo simulation at the beginning, but the problem has been fixed. Anyway, thanks for your response.
Best regards,
Pablo

Barry Akenga
Barry Akenga on 19 Jul 2018
Hi Pablo,
Thanks for getting back to me on this, are you able to convey the code you used to obtain the results required for your Monte Carlo simulation. I did this during my final year for my thesis, however I went a step further and refined my data obtained from the Monte Carlo simulation to obtain variable specific data. Thanks in advance.
Regards, Barry.

Pablo Benítez
Pablo Benítez on 20 Jul 2018
Hi Barry,
I will need to talk to the colleague who helped me with the programming. The code for MCS comprises a part of a larger code that was made for the maintenance planning of structures. Thus, the complete code is currently being reorganized to make a commercial package that will be used for decision-making. So, I do not know if there is any confidentiality to convey a part of the code. If there is no problem, I will send you.
Cheers,
Pablo

Abdelrahman Abdallah
Abdelrahman Abdallah on 23 May 2019
hi barry,
I am working on the same equation and I just wanted to know
did you use the erfinv in matlab and why didnt you use lognrnd(log(3.5),0.5) for surface cholride

Categories

Find more on Genomics and Next Generation Sequencing in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!