T is in deg C, P is in kPa, RH is a percentage.
The inputs are initial temperature Ti above sea surface, initial relative humidity (RH) above sea surface, initial atmospheric pressure just above the sea surface (P1) and final temperature Tf (above land of desert), and P2 (at altitude of land of desert). Delphi computer code below:
label 1;
var
Tdewi,Tdewf,Pvf,LCL1,LCL2,Pvi,Psatwi,Psa
Psat,h,p:extended;
errors1:boolean;
calcstr6,calcstr5,calcstr4,calcstr2,calc
begin
errors1:=false;
form47.hide;
form47.show;
try
Ti:=strtofloat(form47.edit1.Text);
RH:=strtofloat(form47.edit2.Text);
P1:=strtofloat(form47.edit3.Text);
Tf:=strtofloat(form47.edit4.Text);
P2:=strtofloat(form47.edit5.Text);
except
errors1:=true;
end;
if (errors1=true) or (Ti<0) or (Ti>100) or (RH>100) or (RH<0) or (P1<2) or (P1>500) or (Tf<0)
or (Tf>100) or (P2<2) or (P2>500)
then begin
form47.canvas.textout(0,100,'CHECK ENTRIES.');
goto 1
end;
Psatwi:=0.61121*exp((18.678-Ti/
Pvi:=Psatwi*(RH/100);
HR:=0.622*Pvi/(P1-Pvi);
Psatwf:=0.61121*exp((18.678-Tf/
RHf:=(HR*P2)/((0.622+HR)*Psatwf);
Pvf:=RHf*Psatwf;
Tdewi:=Ti;
repeat
Tdewi:=Tdewi-0.001;
Psat:=0.61121*exp((18.678-Tdewi/
until (Psat<=Pvi);
str(Tdewi:12:2,calcstr3);
Tdewf:=Tf;
repeat
Tdewf:=Tdewf-0.001;
Psat:=0.61121*exp((18.678-Tdewf/
until (Psat<=Pvf);
str(Tdewf:12:2,calcstr4);
LCL1:=125*(Ti-Tdewi);
LCL2:=125*(Tf-Tdewf);
str(LCL1:15:2,calcstr5);
str(LCL2:15:2,calcstr6);
str((100*RHf):15:2,calcstr1);
str(HR:15:5,calcstr2);
If(RHf<1) then form47.canvas.textout(0,120,'Relative humidity (RH) AFTER PARCEL HAS MOVED is: '+calcstr1+'%.');
If (RHf<1) then form47.canvas.textout(0,150,'Humidity ratio (HR) remains the same as the air parcel moves: '+calcstr2+' kg/kg.');
If(RHf>1) then form47.canvas.textout(0,120,'Air has become SATURATED and FICTITIOUS relative humidity (RH) AFTER PARCEL HAS MOVED is: '+calcstr1+'%.');
form47.canvas.textout(0,190,'Dew point for initial Ti and P1 situation is: '+calcstr3+' deg C.');
if (RHf<1) then form47.canvas.textout(0,220,'Dew point for final Tf and P2 situation is '+calcstr4+' deg C.');
form47.canvas.textout(0,260,'LCL1 for initial Ti and P1 situation is: '+calcstr5+' m.');
if (RHf<1) then form47.canvas.textout(0,290,'LCL2 for final Tf and P2 situation is '+calcstr6+' m.');
1: end;
No comments:
Post a Comment