Solving Van Der Waals gas equation for volume of a real gas by the method of successive approximation.

 To solve van der Waals gas equation for volume of a real gas by the method of successive approximation.







Python Code:


# ------------------------------------------------
# Exp -4: To solve van der Waals gas equation for
# volume of a real gas by the method of
# successive approximation ( iteration method ).
# ------------------------------------------------
# V = R*T/(P + a/(V*V)) + b = g(V)
# range of V = [3 , 10]
# a = 1.5
# T = 300 K
# R = 8.3144 J/(K. mol )
# -----------------------------------------------

import numpy as np
import math

a = 1.5 # constant
T = 300 #K
R = 8.3144 # J/(K. mol )

# --------------------------
P = 40 # variable
b = 0# vaiiable
# --------------------------

V = 10.0 # initial guass

for it in range (1 , 101 , 1) : # number of iteration

  V_new = R*T /( P + a /( V*V )) + b

  if ( abs ( V_new - V) < 0.008322) :
    break
  V = V_new

# ----------------------------------------
print (" root of VDW equation : ", V_new )
print (" number of iteration : ", it )

# ----------------------------------------

Comments

Popular posts from this blog

Solving Kepler’s equation by Newton-Raphson method

Velapanti Python Program

To find mean , standard deviation and frequency distribution of an actual data set (Python Program)