0% found this document useful (0 votes)
6 views14 pages

Problem Solving

The document outlines two problem-solving projects: one focused on pipe network analysis using Excel, where data is organized and calculations for flow rates are iteratively updated, and another on plug flow reactor (PFR) analysis using both Excel and MATLAB, where ordinary differential equations are solved to determine concentration changes and reactor length for 90% conversion. The pipe network analysis involves creating a coefficient matrix and using matrix functions, while the PFR analysis employs both the ODE45 solver and the Euler method for comparison. Additionally, the PFR problem incorporates temperature effects on reaction rates using the Arrhenius equation.

Uploaded by

Mohamed Elsahy
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views14 pages

Problem Solving

The document outlines two problem-solving projects: one focused on pipe network analysis using Excel, where data is organized and calculations for flow rates are iteratively updated, and another on plug flow reactor (PFR) analysis using both Excel and MATLAB, where ordinary differential equations are solved to determine concentration changes and reactor length for 90% conversion. The pipe network analysis involves creating a coefficient matrix and using matrix functions, while the PFR analysis employs both the ODE45 solver and the Euler method for comparison. Additionally, the PFR problem incorporates temperature effects on reaction rates using the Arrhenius equation.

Uploaded by

Mohamed Elsahy
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Problem solving

project
Mohamed
219644
Dr: Dalia Amer
TA: Esraa
problem 1: Pipe Network Analysis (Excel)
To solve the pipe network problem, I started by collecting all the pipe data
(diameter, length, roughness, and initial flow rates) and entering them once
in the Pipe Data sheet in Excel. I then set up two iteration sheets where
every calculation is done using formulas that reference the Pipe Data sheet,
so no numbers are typed twice. In each iteration, I calculated the velocity,
Reynolds number, friction factor, K factor, and head loss for all 19 pipes
using one formula per column dragged down across all rows. After that, I
built an 8×8 coefficient matrix where the diagonal of each row is the sum of
the n·hL/Q values for all pipes in that loop, and the off-diagonal values are
the negative n·hL/Q for any pipe shared between two loops. I then used the
Excel MINVERSE and MMULT functions to multiply the inverse of the matrix
by the F vector to get the flow correction ΔQ for each loop. In the second
iteration sheet, the flow rates were updated automatically using formulas
that add or subtract the ΔQ corrections depending on which loops each pipe
belongs to, and then all the pipe properties were recalculated from scratch.
After two iterations, the flow rates in all 19 pipes were updated and the final
results were pulled into a separate summary sheet.

Problem 2 : PFR Analysis (Excel)


Q2.3
Q2.1,2.2 MATLAB
To solve the PFR problem, I first wrote down the three ODEs that describe
how the concentrations of A, C, and B change along the reactor length. For
Question 2.1, I solved these equations in MATLAB using the built-in ODE45
solver by defining the three equations together as a single anonymous
function and passing it directly to ode45 with the initial conditions and
reactor length. For Question 2.2, I solved the same equations using the Euler
method both in Excel and in MATLAB. In Excel, I typed the parameters once
at the top of the sheet and then wrote the Euler formula in the first row of
the table, where each new row calculates the next concentration values
using the row above it and the fixed step size h = 0.5 m, covering the full 10
m reactor in just 20 rows. In MATLAB, I used a simple for loop to do the same
thing with a smaller step size of h = 0.1 m and then plotted both the Euler
and ODE45 results on the same figure to compare them. For Question 2.3, I
changed the setup to a non-isothermal reactor where the rate constant k
depends on temperature using the Arrhenius equation. Since the goal was to
find the shortest reactor length that gives 90% conversion, I chose to
operate at the maximum allowed temperature T = 400 K because a higher
temperature gives a higher k and therefore a faster reaction and shorter
reactor. In Excel, I calculated k once in a single cell using the Arrhenius
formula and referenced that cell in every row of the table. I then used an
INDEX and MATCH formula to find the first row where the conversion reached
90% and read the z value from that row as the answer. In MATLAB, I used
find() to do the same thing after solving with ODE45

You might also like