equation of state in fortran program

 Equation of state in fortran program

In thermodynamics, different gas laws, for example, Boyle's law, Charles law, have been derived by using the concept of ideal gas. Ideal gas is actually an ideal concept. No ideal gas exists in atmosphere. 

Equation of state is the thermodynamical equation based on concept of ideal gas. Real gases, that are present in the atmosphere, are studied by using this equation. 

For n mole of ideal gas, the ideal gas equation or equation of state is given as,

PV = nRT  ................. (1)

 Where, 

P = pressure

V = volume

T = absolute temperature

R = Universal gas constant.

At normal temperature and pressure, that is, normal conditions, 

P = `1.01 \times 10^(5)` Pascal

V = `22.4 \times 10^(-3)` `m^3`

T= `0^o` C = (0 + 273) K = 273 K

  Then equation (1) gives,

`R =  \frac(P \times V)(n \times T)`

`R = \frac(1.01 \times 10^5 \times 22.4 \times 10^(-3))(n \times 273)`

For one mole ideal gas, n =1,

`R = \frac{1.01 \times 10^5 \times 22.4 \times 10^{-3}}{1 \times 273}`

`\therefore` R = 8.31 `J mol^(-1) K^(-1)`

 This is the value of universal gas constant at normal temperature and pressure conditions.

Also learn, Why speed of light is taken in mass energy relation, `E =mc^2` ?

Fortran program on Equation of State

program eqofstate !PV= nRT
! This program helps you to calculate different variables in equation of state
!==================Technical Things===========
!=============TribhuvanUniversity=====================
!========Central Department of Physics=========
!=================Nepal=======================================
implicit none
real::p,t,v,n ! Variable declaration
real::R1 , R2  !Universal gas constant
integer::r !integer for defining condition of calculation of different variables
write(*,*) 'Euation of State, PV = nRT'
write(*,*) " " !for space
write(*,*) "What do you want to calculate?"
write(*,*) " "
write(*,*) "Note: Enter necessary values in SI units, to get results in SI units"
write(*,*) " "
write(*,*) "Enter 1 to calculate no. of mole(n), enter 2 to calculate pressure(P), "
write(*,*) " "
write(*,*) "Enter 3 to calculate volume(V), enter 4 to calculate temperature(T) or"
write(*,*) " "
write(*,*) "Enter 5 to calculate Universal gas constant(R) at normal conditions"
!Conditions for calculation of different variables of equation of state
read(*,*) r
if (r==1) then ! for calculation of no. of  moles
goto 100
elseif (r==2) then ! for calculation of presure
goto 200
elseif (r==3) then ! for calculation of volume
goto 300
elseif (r==4) then ! for calculation of temperature
goto 400
elseif (r==5) then ! for calculation of gas constant
goto 500
else
stop
end if
!=========================================
100 write(*,*) "To calculate n, enter value of p, v,t"
read(*,*) p,v,t
R1=8.31 ! value of universal gas constant at normal conditions.
n =(p*v)/(t*R1)
write(*,*) "value of n is", n, 'moles'
stop
!========================================
200 write(*,*) "To calculate P, enter value of n, V, T"
read(*,*) n, v, t
R1=8.31
p =(n*t*R1)/v
write(*,*) "value of P is", p, 'Pascal'
stop
!========================================
300 write(*,*) "To calculate V, enter value of n, P, T"
read(*,*) n, p, t
R1=8.31
v =(n*t*R1)/p
write(*,*) "value of V is", v, 'm^3'
stop
!========================================
400 write(*,*) "To calculate T, enter value of n, p, v"
read(*,*) n, p, v
R1=8.31
t =(p*v)/(n*R1)
write(*,*) "value of T is", t, 'K'
stop
!========================================
500 write(*,*) "To calculate R, enter value of n, v, t, p"
read(*,*) n, v, t, p
R2=(p*v)/(n*t)
write(*,*) "value of R is", R2, 'J/K.mol'
!========================================
end program

For downloading fortran file of the program,

Click the Link, Download File.

Follow this blog for more updates.

Comments

These posts may also be useful for you

top 3 websites for downloading research papers for free

plot graph in gnuplot from csv and data file | knowledge of physics

projectile motion in fortran | relation of angle of projection and horizontal range

NEB physics exam numerical problems with solutions for grade 12 students

how to create GIF animation in gnuplot | animation using gnuplot software

how to plot 3D and parametric graphs in gnuplot | three dimensional plot in gnuplot software

NEB board exam maths solved problems with proper solutions - available for free | short answered mathematics problems solved group A

NEB grade 11 and 12 maths exam MCQ solved problems | NEB mathematics MCQ solved problems