[Fortran] syntaxhighlighter_viewsource syntaxhighlighter_copycode
program ex
  implicit none
  integer,parameter          ::ncomp=2
  character(len=255)         ::hfiles(ncomp),hfmix,herr
  character(len=3)           ::hrf
  integer                    ::ierr
  real(kind=8)               ::t,p,D,Dl,Dv,q,e,h,s,cv,cp,w
  real(kind=8)               ::z(ncomp),x(ncomp),y(ncomp)
  real(kind=8)               ::wm
  real(kind=8),external      ::WMOL
  hfiles(1)="fluids\METHANE.FLD"
  hfiles(2)="fluids\ETHANE.FLD"
  hfmix="fluids\hmx.bnc"
  hrf="DEF"
  t=352.0
  p=15000.0
  z=(/0.93,0.07/)
  call SETUP(ncomp,hfiles,hfmix,hrf,ierr,herr)
  if(ierr .ne. 0)then
    write(*,*)herr
  end if
  call TPFLSH(t,p,z,D,Dl,Dv,x,y,q,e,h,s,cv,cp,w,ierr,herr)
  if(ierr .ne. 0)then
    write(*,*)herr
  end if
  wm=WMOL(z)
  write(*,*)"比焓:",h,"J/mol"
  write(*,*)"比熵:",s,"J/(mol.K)"
  write(*,*)"摩尔质量:",wm,'g/mol'
end program