program pvt

!this program calculates the specific molar volume, molar density
!and mass density for the given data using the ideal gas law
!JWP 11/12/98

implicit none

real :: P, v, rhomols, rhomass
real, parameter :: Patm=2.0, T=298, R=8.314, M=16

P = 1.013e5 * Patm             ! P in Pa

v = R * T / P                  ! specific volume in m3/mol

rhomols = 1 / v                ! in mol/m3

rhomass = rhomols * M / 1000   ! ... in kg/m3

print *, 'Specific molar volume is ', v, ' m3/mol'
print *, 'Molar density is ', rhomols, ' mol/m3'
print *, 'Mass density is ', rhomass, ' kg/m3'

end program pvt

