Escolar Documentos
Profissional Documentos
Cultura Documentos
1
1. Partial Substitution Method-
Description-
This numerical method is an improvement of Direct Substitution Method
where the Volume at the next time step is calculated by the following
formula-
+1 = + (( ) )
Where 0 < < 1 and here it is taken as 0.5
Algorithm-
In the MATLAB Editor window, define a function that calculates
the RHS of the main equation :
1 (, , ) = = () = + +
. 2
Where
= b = 0.42
=
2
Ao = 10.23
Bo = 0.137
Co = 0.85 106
R = 0.08207
Define another function in the Editor window that calculates the
Volume at the next time step as follows :
= 2 (, , ) = +1 = + 0.5. (( ) )
In the MATLAB prompt window,
o Assign an array V with initial value give as:
V(1)=RT/P
o For subsequent values we use the relation:
V(i+1)= 2 (, , )
o In a while loop, with terminating condition as |V(i)-
V(i+1)| > 0.0001 ( tolerance value ) , we keep on
calculating the volume at the next iteration step till
the condition satisfies and it converges.
o To calculate the number of iterations we increment
the loop index by 1.
This same algorithm is repeated for the given three sets of P and T
respectively.
2
Results-
3
2. Wegstein Substitution Method
Description-
This method requires 2 initial guess values whose function values are
taken on the curve and joined. The point where this line meets the y=x
line is the volume at the next time step. The corresponding point on the
curve is plotted and the same method is repeated till convergence. The
formula used is:
1 .( ) .(1 )
+1 =
1 (1 )+ ( )
Algorithm-
In this case too, we use the previously defined function:
1 (, , ) = = () = + +
. 2
Results-
4
Final Value of V=23.9586
No. Of Iterations required: 4
( )
+1 =
( )
5
Algorithm:
We slightly change the definition of our previously defined
function f(V) to obtain:
1 (, , ) = = () = + +
. 2
We calculated the derivative of f(V) to obtain:
2
/ () = 1
. 2 . 3
And represent it using another function f2(V)= / () in the MATLAB
EDITOR WINDOW
For subsequent values we use the following relation:
( )
+1 =
2 ( )
In a while loop, with terminating condition as V(i)-V(i+1) > 0.0001 (
tolerance value ) , we keep on calculating the volume at the next
iteration step till the condition satisfies and it converges.
To calculate the number of iterations we increment the loop index
by 1.
Results-
6
Final Value of V=8.0614
No. Of Iterations required: 3
7
DISCUSSION
We can clearly see from the results that for a given set of values
for Pressure (P) and Temperature (T), the number of iterations
required for the Wegstein Method and Newton-Raphson Method
to calculate Volume (V) are less than that for the Partial
Substitution Method. Among Wegstein Method and Newton-
Raphson Method, we find the Newton-Raphson Method to be
slightly more efficient ( hence lesser iteration steps ) than the
Wegstein Method. An important point to note is that the Newton-
Raphson Method is a second order method. However the Newton-
Raphson method has a limitation that it can be used only for those
functions whose derivative can be found out analytically. On the
other hand Wegstein method is first order, which might be the
reason why Newton-Raphson method is slightly better and faster
than Wegstein Method. For P = 5 atm and T = 500 K,
Method Number of Iterations
Partial Substitution 12
Wegstein 4
Newton-Raphson 3
Thus, our loop ends whenever this condition is not satisfied giving
us a converged solution correct to four decimal places.
8
We can easily realise the importance of tolerance value from the
fact that if we go on decreasing the tolerance value, we will get a
more accurate solution. While on the contrary, if we take a
reasonably large tolerance value, we will end up with a less
accurate solution though it means lesser number of iterations and
lesser computational time. The following plot shows the
relationship between the tolerance values and number of
iterations( Calculated for partial substitution method ):
9
10