Presentation is loading. Please wait.

Presentation is loading. Please wait.

Monte Carlo Integration in Excel

Similar presentations


Presentation on theme: "Monte Carlo Integration in Excel"— Presentation transcript:

1 Monte Carlo Integration in Excel
Sean Gant Jay Lee

2 Monte Carlo Integration
y x B f(x)

3 Monte Carlo Integration
y x B f(x)

4 Monte Carlo Integration
y x B f(x)

5 Gas-phase elementary reaction:
2A → B Isothermal reaction in a PFR with no pressure drop Only A is fed, P0 = 8.2 atm, T0 = 500K, ε = -0.5 CA0 = 0.2 mol/dm3, k = 10 dm3/mol-s, vo = 25 dm3/s QUESTION What volume is needed to achieve 90% conversion?

6 Mole Balance: Rate Law: Stoichiometry: Combine:
Since, we have an elementary reaction, the rate law for the reaction rate of A is simply: Since the reactor is isothermal and we have no pressure drop, stoichiometry reveals that… Combining the mole balance, rate law, stoichiometry we obtain a definite integral for the volume.

7 Setting Up Excel Spreadsheet
What are your inputs? (Using “Rand()” Function) X: Your independent variable (range you are integrating) Y: Dependent variable ( from 0 to max over X-range) What is your defined area? L x W of “box” (multiply the two ranges) What constitutes a hit? If random point lies below function then “hit”

8 Setting up Excel Spreadsheet

9 Setting up Excel Spreadsheet
Random Number Generator Rand()*(b-a)+a Generate a number between a and b The “Status” If(X<f(X), “below”, “above”) If value of f(X) > Y then mark “below” The “Count” If(Status=“below”,1,0) If value of status is “below” then count a “hit” Making sense of data Take total number of hits and divide by total number of points to find fraction under function Multiply calculated fraction by area of “box” to find the area under the curve. In this case this value is the volume of your PFR dm3 as compared to 45.3 dm3 found by solving analytically.

10 Setting up Excel Spreadsheet


Download ppt "Monte Carlo Integration in Excel"

Similar presentations


Ads by Google