Monday, December 1, 2008

Lifting condensation level calculation using fortran

c Program for calculating Lifting condensation level

real ps,ts,pts,es,qs,zs,pl,tl,ptl,el,ql,zl

print*,'Enter the surface value of pressure'
read*,ps
print*,'Enter the surface value of temperature '
read*,ts
print*,'Enter the surface value of geopotential hight'
read*,zs
print*,'Enter the surface value of Relative humidity (%)'
read*,rh
r=287.05
cp=1004

if(ts.gt.273)then
A=17.26
B=35.86
else
A=21.8
B=7.66
endif
pts=ts*((1000/ps)**(r/cp))
es=6.11*EXP(A*(ts-273.16)/(ts-B))*rh/100
qs=0.622*es/(ps-0.378*es)

ptl=pts
do pl=40,1000
tl=ptl*((pl/1000)**(r/cp))
el=6.11*EXP(A*(tl-273.16)/(tl-B))
ql=0.622*el/(pl-0.378*el)

if(ql.ge.qs)then
zl=zs+(cp*(ts-tl)/9.8)
write(*,*)'Lifting condensation level is',pl
write(*,*)'Temperature of lcl is',tl
write(*,*)'Geopotential hight at lcl is ',zl
goto 10
endif
enddo

10 stop
end

No comments: