You are on page 1of 10

PROBLEM STATEMENT-1

Calculate volume V according to the following relationship



= + +
2
For the following P and Temperature combinations-
P( atm ) T( K )
1 300
5 500
100 1000
Use 3 different numerical methods to calculate the Volume ( convergence )
Partial Substitution
Wegstein Substitution
Newton Raphson Method
Assume
= where b = 0.42

= 2

Where Ao = 10.23
Bo = 0.137
Co = 0.85 106
R = 0.08207
Comment on the efficiency of these methods in terms of computation
time and number of iterations
Show the effect of tolerance value in convergence criteria

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-

I. For P=1atm and T=300K

The values of Volume calculated during the iteration process are


as follows:
V=
24.6210 24.2985 24.1331 24.0482 24.0046 23.9822 23.9707 23.9648
23.9618 23.9603 23.9595 23.9591 23.9588 23.9587

Final Value of V=23.9586


No. Of Iterations required: 14

II. For P=5atm and T=500K

The values of Volume calculated during the iteration process are


as follows:
V=
8.2070 8.1350 8.0986 8.0802 8.0709 8.0662 8.0638 8.0626 8.0620
8.0617 8.0615 8.0614

Final Value of V=8.0614


No. Of Iterations required: 12

III. For P=100atm and T=1000K

The values of Volume calculated during the iteration process are


as follows:
V=
0.8207 1.0776 1.0983 1.1031 1.1043 1.1046 1.1046

Final Value of V=1.1047


No. Of Iterations required: 7

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

We define an additional variable S as:


( ) (1 )
=
1
For subsequent values we use the following relation:
( )
+1 = +
1 1
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-

I. For P=1atm and T=300K

The values of Volume calculated during the iteration process are


as follows:
V=
24.6210 23.9760 23.9586 23.9586

4
Final Value of V=23.9586
No. Of Iterations required: 4

II. For P=5atm and T=500K

The values of Volume calculated during the iteration process are


as follows:
V=
8.2070 8.0630 8.0614 8.0614

Final Value of V=8.0614


No. Of Iterations required: 4

III. For P=100atm and T=1000K

The values of Volume calculated during the iteration process are


as follows:
V=
0.8207 1.3345 1.1377 1.1018 1.1047 1.1047

Final Value of V=1.1047


No. Of Iterations required: 6

3. NEWTON RAPHSON TECHNIQUE:


Description:
This method requires one initial guess value (say V0) and the function is
expressed in a form so that RHS = 0 (taking all terms to one side). Now,
f(Vo) is calculated. The function is differentiated so as to calculate f(Vo) .
Using the Newton Raphson Technique, the volume at the next iteration
step is calculated as follows:

( )
+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-

I. For P=1atm and T=300K

The values of Volume calculated during the iteration process are


as follows:
V=
24.6210 23.9591 23.9586 23.9586

Final Value of V=23.9586


No. Of Iterations required: 4

II. For P=5atm and T=500K

The values of Volume calculated during the iteration process are


as follows:
V=
8.2070 8.0614 8.0614

6
Final Value of V=8.0614
No. Of Iterations required: 3

III. For P=100atm and T=1000K

The values of Volume calculated during the iteration process are


as follows:
V=
0.8207 1.0491 1.1031 1.1047 1.1047

Final Value of V=1.1047


No. Of Iterations required: 5

7
DISCUSSION

Q1. Comment on the efficiency of these methods in terms of


computation time and number of iterations.

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

Q2. Show the effect of tolerance value in convergence criteria

For all the three methods we have used the following


convergence criteria for while loop in the MATLAB PROMPT
WINDOW:

V(i)-V(i+1) > (where =0.0001 is our tolerance value)

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

You might also like