Swayseeker Air Artist
Ideas to solve air pollution problems. Things you may not know about air. The blog owner T E Miller (Swayseeker) will not accept liability or responsibility for any problems or mistakes. You can contact me at millertrader@gmail.com Also see my profile at https://mewe.com/i/thomasmiller13
Friday, June 6, 2025
Compare the mixing ratio of two air parcels
Tuesday, May 20, 2025
Evaporative cooling of air
procedure EvapCool;
var
iocode:integer;
ch:char;
Tap1,Tap2,HR1,HR2,T1,T2,RHwb,Twb,Pwb,effc,Pv1,Pv2,Psat1,Psat2,
RH1,RH2,Pa1,Pa2,Tk1,Tk2,P,V,Tw,A1,B1,C1,A2,B2,C2,RHwb1,mwe,mwen,
mwed,ma1,mv1,ma2,mv2,Ad1,Bd1,Cd1,Ad2,Bd2,Cd2,Psatd1,Psatd2,LCL1,
LCL2,eff,D1,d2,mv11,ma11,mv21,ma21,VPD1,VPD2,
Td1,Td2,VPDr,ew,fw,gw,hw,iw,Enth1,Enth2:extended;
begin
repeat
clrscr;
repeat
write('Enter initial T1 in deg C ');
{$I-}
readln(T1);
{$I+}
iocode:=ioresult;
until (iocode=0) and (T1>0) and (T1<100);
repeat
write('Enter relative humidity RH1% ');
{$I-}
readln(RH1);
{$I+}
iocode:=ioresult;
until (iocode=0) and (RH1>0) and (RH1<=100);
repeat
write('Enter atmospheric pressure P in kPa ');
{$I-}
readln(P);
{$I+}
iocode:=ioresult;
until (iocode=0) and (P>50) and (P<=130);
repeat
write('Enter volume of air V in cubic m ');
{$I-}
readln(V);
{$I+}
iocode:=ioresult;
until (iocode=0) and (V>0);
repeat
write('Enter efficiency of evaporative cooling ');
{$I-}
readln(eff);
{$I+}
iocode:=ioresult;
until (iocode=0) and (eff>0) and (eff<100);
Pwb:=P/101.325;
RHwb1:=RH1;
RH1:=RH1/100;
Tk1:=T1+273.15;
Psat1:=0.61121*exp((18.678-T1/234.5)*(T1/(257.14+T1)));
Pv1:=Psat1*RH1;
Pa1:=P-Pv1;
ma1:=Pa1*V/(0.287*Tk1);
mv1:=Pv1*V/(0.4615*Tk1);
D1:=(ma1+mv1)/V;
HR1:=mv1/ma1;
Twb:=T1;
repeat
Twb:=Twb-0.001;
ew:=17.502*Twb;
fw:=240.97+Twb;
gw:=ew/fw;
hw:=66.8745*(1+0.00115*Twb);
iw:=6.112*exp(17.502*T1/(240.97+T1));
RHwb:=(611.2*exp(gw)-hw*Pwb*(T1-Twb))/iw;
until (RHwb<=RHwb1);
T2:=T1-(eff/100)*(T1-Twb);
mwen:=ma1*1.006*(T1-T2)+1.88*mv1*(T1-T2);
mwed:=2501.3+1.88*T2;
mwe:=mwen/mwed;
HR2:=(mwe+mv1)/ma1;
Psat2:=0.61121*exp((18.678-T2/234.5)*(T2/(257.14+T2)));
RH2:=HR2*P/((0.62185+HR2)*Psat2);
Pv2:=RH2*Psat2;
Tk2:=T2+273.15;
Pv2:=Psat2*RH2;
Pa2:=P-Pv2;
ma2:=Pa2*V/(0.287*Tk2);
mv2:=Pv2*V/(0.4615*Tk2);
D2:=(mv2+ma2)/V;
ad2:=9.81*(1-D1/D2);
Enth1:=ma1*1.006*T1+mv1*(2501.3+1.88*T1);
Enth2:=ma1*1.006*T2+(mv1+mwe)*(2501.3+1.88*T2);
writeln;
writeln('RESULTS:');
writeln('HR1 = ',HR1:13:5,' kg vapour/kg dry air');
writeln('HR2 = ',HR2:13:5,' kg vapour/kg dry air');
writeln('ma1 = ',ma1:15:5,' kg');
writeln('mv1 = ',mv1:15:5,' kg');
writeln('Initial wet bulb Twb = ',Twb:15:3,' deg C');
writeln('Mass of water evaporated mwe = ',mwe:15:4,' kg');
writeln('Mass of water evaporated = ',mwe/1000:15:6,' tonnes');
writeln('Air cooled to ',T2:15:4,' deg C');
writeln('Final RH = ',RH2*100:15:2,'%');
writeln('Initial density D1 = ',D1:15:4,' kg per cubic m');
writeln('Final density D2 = ',D2:15:4,' kg per cubic m');
writeln('Enth1 = ',enth1:15:3,' kJ, Enth2 = ',enth2:15:3,' kJ');
write('Another Y/N?');
repeat
ch:=readkey
until (ch in ['Y','N','y','n']);
until (ch in ['N','n']);
end;
Tuesday, April 29, 2025
Percentage of oxygen in air
procedure PercO;
var
iocode:integer;
ch,chm:char;
t1,rh1,rh2,pv1,pa1,mv1,ma1,psat1,
a1,b1,c1,tk1,p1,PO2,Perco2:extended;
begin
repeat
clrscr;
repeat
write('Enter air temp T1 deg C ');
{$I-}
readln(T1);
{$I+}
iocode:=ioresult;
until (iocode=0) and (T1>0) and (T1<100);
repeat
write('Enter relative humidity RH1% ');
{$I-}
readln(RH1);
{$I+}
iocode:=ioresult;
until (iocode=0) and (RH1>0) and (RH1<=100);
repeat
write('Enter atmospheric pressure P1 in kPa ');
{$I-}
readln(P1);
{$I+}
iocode:=ioresult;
until (iocode=0) and (P1>20) and (P1<=150);
Tk1:=T1+273.15;
A1:=18.678-T1/234.5;
B1:=T1/(257.14+T1);
C1:=A1*B1;
Psat1:=0.61121*exp(C1);
Pv1:=Psat1*(Rh1/100);
Pa1:=P1-Pv1;
PO2:=Pa1*(21/100);
ma1:=Pa1*1000/(0.287*Tk1);
mv1:=Pv1*1000/(0.4615*Tk1);
PercO2:=100*(PO2/P1);
writeln;
writeln('Percentage of oxygen in air by volume is: ',PercO2:12:3,'%');
writeln('Mass of water vapour per 1000 cubic m of air is:',mv1:12:3,' kg');
writeln('Mass of dry air per 1000 cubic m of air is: ',ma1:12:3,' kg');
writeln;
write('Another Y/N?');
repeat
ch:=readkey
until (ch in ['Y','N','y','n']);
until (ch in ['N','n']);
end;
Saturday, April 19, 2025
Air density after adding water vapour Turbo Pascal code
procedure RHnew;
var
iocode:integer;
ch,chm:char;
Dens1,dens2,hr1,hr2,t2,t1,rh1,rh2,pv1,pa1,pa2,mv1,mv2,ma1,psat1,psat2,
mf1,mf2,pv2,a1,b1,c1,tk1,tk2,p1,p2,mwa1,a2,b2,c2,v1,v2,ma2,
vpd1,vpd2,v2t,twb1,twb2,rhwb,ew,fw,gw,hw,iw,rhwb1,rhwb2,
pwb1,pwb2:extended;
begin
repeat
clrscr;
repeat
write('Enter air temp T1 deg C ');
{$I-}
readln(T1);
{$I+}
iocode:=ioresult;
until (iocode=0) and (T1>0) and (T1<100);
repeat
write('Enter RH1 % ');
{$I-}
readln(RH1);
{$I+}
iocode:=ioresult;
until (iocode=0) and (RH1>0) and (RH1<=100);
repeat
write('Enter atm P1 in kPa ');
{$I-}
readln(P1);
{$I+}
iocode:=ioresult;
until (iocode=0) and (P1>20) and (P1<=150);
repeat
write('Enter V1 in cubic m ');
{$I-}
readln(V1);
{$I+}
iocode:=ioresult;
until (iocode=0) and (V1>0);
repeat
write('Enter mass mwa1 of water added in kg ');
{$I-}
readln(mwa1);
{$I+}
iocode:=ioresult;
until (iocode=0) and (mwa1>=0);
repeat
write('Enter T2 in deg C ');
{$I-}
readln(T2);
{$I+}
iocode:=ioresult;
until (iocode=0) and (T2>0) and (T2<100);
repeat
write('Enter P2 in kPa ');
{$I-}
readln(P2);
{$I+}
iocode:=ioresult;
until (iocode=0) and (P2>=20) and (P2<=150);
Tk1:=T1+273.15;
Tk2:=T2+273.15;
A1:=18.678-T1/234.5;
B1:=T1/(257.14+T1);
C1:=A1*B1;
Psat1:=0.61121*exp(C1);
Pv1:=Psat1*(Rh1/100);
Pa1:=P1-Pv1;
mf1:=Pv1/P1;
ma1:=Pa1*V1/(0.287*Tk1);
mv1:=Pv1*V1/(0.4615*Tk1);
VPD1:=Psat1-Pv1;
mv2:=mwa1+mv1;
HR1:=mv1/ma1;
HR2:=mv2/ma1;
A2:=18.678-T2/234.5;
B2:=T2/(257.14+T2);
C2:=A2*B2;
Psat2:=0.61121*exp(C2);
RH2:=HR2*P2/((0.62185+HR2)*Psat2);
Pv2:=Psat2*RH2;
Pa2:=P2-Pv2;
mf2:=Pv2/P2;
ma2:=ma1;
V2:=mv2*(0.4615*Tk2)/Pv2;
V2t:=ma2*(0.287*Tk2)/Pa2;
VPD2:=Psat2-Pv2;
Pwb1:=P1/101.325;
RHwb1:=RH1;
TWB1:=T1;
repeat
Twb1:=Twb1-0.001;
ew:=17.502*Twb1;
fw:=240.97+Twb1;
gw:=ew/fw;
hw:=66.8745*(1.0+0.00115*Twb1);
iw:=6.112*exp(17.502*T1/(240.97+T1));
RHwb:=(611.2*exp(gw)-hw*Pwb1*(T1-Twb1))/iw;
until (RHwb<=RHwb1);
Pwb2:=P2/101.325;
RHwb2:=RH2*100;
Twb2:=T2;
repeat
Twb2:=Twb2-0.001;
ew:=17.502*Twb2;
fw:=240.97+Twb2;
gw:=ew/fw;
hw:=66.8745*(1.0+0.00115*Twb2);
iw:=6.112*exp(17.502*T2/(240.97+T2));
RHwb:=(611.2*exp(gw)-hw*Pwb2*(T2-Twb2))/iw;
until (RHwb<=RHwb2);
dens1:=(ma1+mv1)/V1;
dens2:=(ma2+mv2)/V2;
writeln('ma1 = ',ma1:12:5,' kg');
writeln('mv1 = ',mv1:12:5,' kg');
writeln('mole fraction of water vapour mf1 = ',mf1:12:5,' ');
writeln('VPD1 = ',VPD1:12:5,' kPa');
writeln('mv2 = ',(mv1+mwa1):12:5,' kg');
writeln('mole fraction of water vapour mf2 = ',mf2:12:5,' ');
writeln('VPD2 = ',VPD2:12:5,' kPa');
writeln('RH2 = ',(RH2*100):12:3,'%');
writeln('V2 = ',(V2):15:4,' cubic m');
writeln('V2 test = ',(V2t):15:4,' cubic m');
writeln('Twb1 = ',Twb1:15:4,' deg C');
writeln('Twb2 = ',Twb2:15:4,' deg C');
writeln('Dens1 = ',dens1:15:4,' kg/cubic m, Dens2 = ',dens2:15:4,' kg/cubic m');
writeln('');
write('Another? Y/N');
repeat
ch:=readkey
until (ch in ['Y','y','N','n']);
until (ch in ['N','n']);
end;
Air density after adding water vapour Delphi Code
label 1;
var
hr1,hr2,t2,t1,rh1,rh2,pv1,pa1,pa2,mv1,mv2,ma1,psat1,psat2,
mf1,mf2,pv2,a1,b1,c1,tk1,tk2,p1,p2,mwa1,a2,b2,c2,v1,v2,ma2,
vpd1,vpd2,v2t,twb1,twb2,rhwb,ew,fw,gw,hw,iw,rhwb1,rhwb2,
pwb1,pwb2,dens1,dens2:extended;
errors1:boolean;
calcstr1,calcstr2,calcstr3,calcstr4,calcstr5,calcstr6,calcstr7,calcstr8,calcstr9,
calcstr10,calcstr11,calcstr12,calcstr13,calcstr14:string[30];
begin
errors1:=false;
form1.hide;
form1.show;
form1.memo1.SelectAll;
form1.memo1.clearselection;
try
T1:=strtofloat(form1.edit1.text);
RH1:=strtofloat(form1.edit2.text);
P1:=strtofloat(form1.edit3.text);
V1:=strtofloat(form1.edit4.text);
mwa1:=strtofloat(form1.edit5.text);
T2:=strtofloat(form1.edit6.text);
P2:=strtofloat(form1.edit7.text);
except errors1:=true;
end;
if (errors1=true) or
(t1<0.01) or (T1>80) or (rh1<1) or (rh1>100) or (P1<30) or (p1>140) or (V1<=0)
or (mwa1<=0) or (T2<0.01) or (T2>80) or (P2<30) or (P2>140)
then begin
form1.memo1.lines.add('Check Entries');
goto 1
end;
Tk1:=T1+273.15;
Tk2:=T2+273.15;
A1:=18.678-T1/234.5;
B1:=T1/(257.14+T1);
C1:=A1*B1;
Psat1:=0.61121*exp(C1);
Pv1:=Psat1*(Rh1/100);
Pa1:=P1-Pv1;
mf1:=Pv1/P1;
ma1:=Pa1*V1/(0.287*Tk1);
mv1:=Pv1*V1/(0.4615*Tk1);
VPD1:=Psat1-Pv1;
mv2:=mwa1+mv1;
HR1:=mv1/ma1;
HR2:=mv2/ma1;
A2:=18.678-T2/234.5;
B2:=T2/(257.14+T2);
C2:=A2*B2;
Psat2:=0.61121*exp(C2);
RH2:=HR2*P2/((0.62185+HR2)*Psat2);
Pv2:=Psat2*RH2;
Pa2:=P2-Pv2;
mf2:=Pv2/P2;
ma2:=ma1;
V2:=mv2*(0.4615*Tk2)/Pv2;
V2t:=ma2*(0.287*Tk2)/Pa2;
VPD2:=Psat2-Pv2;
Pwb1:=P1/101.325;
RHwb1:=RH1;
TWB1:=T1;
repeat
Twb1:=Twb1-0.001;
ew:=17.502*Twb1;
fw:=240.97+Twb1;
gw:=ew/fw;
hw:=66.8745*(1.0+0.00115*Twb1);
iw:=6.112*exp(17.502*T1/(240.97+T1));
RHwb:=(611.2*exp(gw)-hw*Pwb1*(T1-Twb1))/iw;
until (RHwb<=RHwb1);
Pwb2:=P2/101.325;
RHwb2:=RH2*100;
Twb2:=T2;
repeat
Twb2:=Twb2-0.001;
ew:=17.502*Twb2;
fw:=240.97+Twb2;
gw:=ew/fw;
hw:=66.8745*(1.0+0.00115*Twb2);
iw:=6.112*exp(17.502*T2/(240.97+T2));
RHwb:=(611.2*exp(gw)-hw*Pwb2*(T2-Twb2))/iw;
until (RHwb<=RHwb2);
dens1:=(ma1+mv1)/V1;
dens2:=(ma1+mv2)/V2;
str(ma1:15:3,calcstr1);
form1.memo1.lines.add('ma1 is: '+calcstr1+' kg');
str(mv1:15:3,calcstr2);
form1.memo1.lines.add('mv1 is: '+calcstr2+' kg');
str(mf1:15:3,calcstr3);
form1.memo1.lines.add('mf1 is: '+calcstr3+' ');
str(VPD1:15:3,calcstr4);
form1.memo1.lines.add('VPD1 is: '+calcstr4+' kPa');
str(mv2:15:3,calcstr5);
form1.memo1.lines.add('mv2 is: '+calcstr5+' kg');
str(mf2:15:3,calcstr6);
form1.memo1.lines.add('mf2 is: '+calcstr6+' ');
str(VPD2:15:3,calcstr7);
form1.memo1.lines.add('VPD2 is: '+calcstr7+' kPa');
str((RH2*100):15:3,calcstr8);
form1.memo1.lines.add('RH2 is: '+calcstr8+'%');
str(V2:15:3,calcstr9);
form1.memo1.lines.add('V2 is: '+calcstr9+' cubic m');
str(V2t:15:3,calcstr10);
form1.memo1.lines.add('V2t (check on line above) is: '+calcstr10+' cubic m');
str(Twb1:15:3,calcstr11);
form1.memo1.lines.add('Wet bulb initial Twb1 is: '+calcstr11+' deg C');
str(Twb2:15:3,calcstr12);
form1.memo1.lines.add('Wet bulb final Twb2 is: '+calcstr12+' deg C');
str(dens1:15:3,calcstr13);
form1.memo1.lines.add('Air density Dens1 is: '+calcstr13+' kg/cubic m');
str(dens2:15:3,calcstr14);
form1.memo1.lines.add('Air density Dens2 is: '+calcstr14+' kg/cubic m');
1: end;
Wednesday, March 25, 2020
Covid-19 and vitamin D
Italy is famous for narrow streets where sunlight does not easily enter. Could this be why Italy was so badly affected?
Covid-19 causes respiratory problems. Is it significant that vitamin D helps prevent respiratory infections - see article mentioned.
Saturday, February 1, 2020
Sample code
var
T1,Rh1,RH2,T2,T1c,ht,Psat1,Psat2,Pv,Tdew,Psat:extended;
errors1:boolean;
calcstr2,calcstr1:string[30];
begin
errors1:=false;
form4.hide;
form4.show;
{form4.Memo1.clearselection};
try
T1:=strtofloat(form4.edit1.Text);
Rh1:=strtofloat(form4.edit2.Text);
T2:=strtofloat(form4.edit3.Text);
except
errors1:=true;
end;
if (errors1=true) or
(t1<0.01) or (t1>69) or (rh1<0) or (rh1>100) or
(t2<0.1) or (t2>70) or (T2<T1+0.02)
then begin
form4.Memo1.Lines.Add('CHECK ENTRIES.');
goto 1
end;
T1C:=T1;
ht:=1000*(T2-T1)/3.3;
RH1:=RH1/100;
Psat1:=0.61121*exp((18.678-T1/234.5)*T1/(257.14+T1));
Pv:=Psat1*RH1;
Psat2:=0.61121*exp((18.678-T2/234.5)*T2/(257.14+T2));
Rh2:=Pv/Psat2; {ie partial pressure of water vapour/psat2}
str(rh2*100:9:2,calcstr1);
form4.Memo1.lines.Add('Final relative humidity (at T2) is: '+calcstr1+'%.');
Tdew:=T1;
repeat
Tdew:=Tdew-0.001;
Psat:=0.61121*exp((18.678-Tdew/234.5)*Tdew/(257.14+Tdew));
until (Psat<=Pv);
str(Tdew:12:2,calcstr2);
form4.Memo1.Lines.Add('Dew point is: '+calcstr2+' deg C.');
1: end;
Saturday, January 11, 2020
Problems with renewable energy
"Solar photovoltaic panels, whose operating life is 20 to 30 years, lose productivity over time. The International Renewable Energy Agency estimated that there were about 250,000 metric tons of solar panel waste in the world at the end of 2016 and that this figure would definitely increase. Solar panels contain lead, cadmium, and other toxic chemicals that cannot be removed without breaking apart the entire panel. 3
"More disconcerting, however, is the environmental impact of these chemicals. Based on installed capacity and power-related weight, we can estimate that by 2016, photovoltaics had spread about 11,000 tons of lead and about 800 tons of cadmium. A hazard summary of cadmium compounds produced by the EPA points out that exposure to cadmium can lead to serious lung irritation and long-lasting impairment of pulmonary functions. Exposure to lead hardly needs further explanation."
https://theconversation.com/theres-a-looming-waste-crisis-from-australias-solar-energy-boom-117421 says:
"Solar panels generally last about 20 years. And lead-acid and lithium-ion batteries, which will be the most common battery storage for solar, last between five and 15 years. Many solar panels have already been retired, but battery waste will start to emerge more significantly in 2025. By 2050 the projected amount of waste from retired solar panels in Australia is over 1,500 kilotonnes (kT)." and
Australia currently has little capacity to recycle both solar panelsand batteries."
https://quillette.com/2019/02/27/why-renewables-cant-save-the-planet/ says:
"Consider California. Between 2011–17 the cost of solar panels declined about 75 percent, and yet our electricity prices rose five times more than they did in the rest of the U.S. It’s the same story in Germany, the world leader in solar and wind energy. Its electricity prices increased 50 percent between 2006–17, as it scaled up renewables."
https://www.renewableenergyworld.com/2019/04/02/why-100-renewable-energy-goals-are-not-practical-policies/#gref says: "The issue is that our current technologies are intermittent, variable, and unpredictable as they depend on the weather and consequently have limited capacity factors. At the scale needed, storage is currently not a viable option as the technology is very expensive and still developing."
https://www.investors.com/politics/commentary/renewable-energy-possible-good-environment/ says: "There's another problem with renewable energy that environmentalists and politicians tend to overlook when pushing their 100% renewable plans.
Thursday, January 9, 2020
Facebook Profile and Other Sites
For other sites of mine see https://temsites.blogspot.com
Wednesday, January 8, 2020
Cheap Energy for Africa with Carbon Dioxide Reduction
1) Allow mines to install their own gas turbine power stations so mines can operate well and cheaply all the time
2) Encourage gas and oil companies to set up in South Africa, but legislate that they must distribute alkaline rock dust (from alkaline mine tailings, etc), to react with carbon dioxide and remove it from the atmosphere.
3) Also allow smelters to set up their own gas turbine power stations so that aluminium smelters, etc, can operate well all the time.
Africa and other regions need reliable power and it is unlikely that greenhouse gas concentrations will be reduced. The world could use gas and also alkaline rock to remove carbon dioxide in general from the air and the carbon dioxide created by burning the gas. We could cool Earth like this.
Taking CO2 out of the air: Here is some mathematics for all: Basalt has a density of about 3 tonnes per cubic metre.
A 1 mm thick layer of basalt spread over an area of 1 square km has a volume of (1/1000)x(1000)x(1000) = 1000 cubic metres.
Mass of 1 mm thick basalt layer on 1 square km = volumexdensity = (1000 cubic metres)x(3 tonnes per cubic metre) =3000 tonnes.
1 tonne of basalt can react with about 0.3 tonnes of CO2.
Therefore 3000 tones of basalt can react with about 3000x0.3 = 900 tonnes of CO2.
In a cubic metre of air in a polluted city there could be about 900 tonnes of CO2 in a cubic km.
Conclusion: A 1 mm thick layer of basalt could take out all the CO2 for a km above the basalt layer. Powdered basalt should be used to make the reaction thousands of times faster.
See https://insideclimatenews.org/news/
https://arstechnica.com/science/2018/02/
https://gulfnews.com/world/gulf/oman/
https://arctic-news.blogspot.com/2016/
Tuesday, November 26, 2019
Lift for a balloon by adding water vapour
A cubic metre of the surrounding air has 1.6 kg of water evaporated into it and ends up at 95 deg C (so the system is a cubic metre of air at 25 deg C and 1.6 kg of water both heated to 95 deg C). The buoyancy of 1 cubic metre of this hot expanded air is now 0.462 kg. The RH is now 82.03% (after water added and heated). With no water added but surrounding air heated to 95 deg C the RH would be 2.25% and the buoyancy would be 0.221 kg.
Friday, November 1, 2019
Amount of basalt to react with CO2 in air
Here is Delphi computer code that will calculate approximately how much basalt powder is needed The inputs are T (air temperature in deg C), RH in %, P (atmospheric pressure in kPa - at the coast P is about 101 kPa), ppm (parts per million of CO2 (probably 415 or more parts).
Code is below:
label 1;
var
Dair,Ma,Tk,Mv,Pv,HR,P,RH,T,Psatw,Pdair,PCO2,MCO2,
Dairkg,PercCV,PercVV,ppm,molH2O,molCO2,thirdc,mbthirdc:extended;
errors1:boolean;
calcstr1,calcstr2,calcstr3,calcstr4,calcstr5,calcstr6,calcstr7,
calcstr8,calcstr9,calcstr10,calcstr11,calcstr12,calcstr13:string[30];
begin
errors1:=false;
form21.hide;
form21.show;
try
T:=strtofloat(form21.edit1.Text);
RH:=strtofloat(form21.edit2.Text);
P:=strtofloat(form21.edit3.Text);
ppm:=strtofloat(form21.edit4.Text);
except
errors1:=true;
end;
if (errors1=true) or
(T<0) or (T>70) or (RH<1) or (RH>100) or (P<10) or (P>150) or
(ppm<100) or (ppm>2500)
then begin
form21.canvas.textout(0,100,'CHECK ENTRIES.');
goto 1
end;
Tk:=T+273.15;
Psatw:=0.61121*exp((18.678-T/234.5)*T/(257.14+T));
Pv:=Psatw*RH/100;
Pdair:=(P-Pv);
PCO2:=Pdair*ppm/1000000;
{HR:=0.622*Pv/(P-Pv);}
Mv:=Pv/(0.4615*Tk);
Ma:=(P-Pv)/(0.287*Tk);
MCO2:=PCO2/(0.1889*Tk);
HR:=Mv/Ma;
Dair:=Mv+Ma;
PercCV:=(PCO2/P)*100;
PercVV:=(Pv/P)*100;
molH2O:=Pv/(0.00831447*Tk);
molCO2:=PCO2/(0.00831447*Tk);
thirdc:=MCO2*1000000*(1/3);
mbthirdc:=thirdC*3.33333;
str(Psatw:13:4,calcstr1);
str(Pv:13:4,calcstr2);
str(HR:13:6,calcstr3);
str(Mv*1000:13:3,calcstr4);
str(Ma*1000:13:3,calcstr5);
str(Dair*1000:13:3,calcstr6);
str(MCO2*1000:13:3,calcstr7);
str(MCO2*1000000:13:2,calcstr8);
str(PercCV:13:3,calcstr9);
str(PercVV:13:3,calcstr10);
str(molCO2:13:4,calcstr11);
str(molH2O:13:4,calcstr12);
str(mbthirdc:13:1,calcstr13);
form21.canvas.textout(0,120,'Saturation vapour pressure over water (Psatwater) is: '+calcstr1+' kPa.');
form21.canvas.textout(0,150,'Pv (actual vapour pressure over water) is: '+calcstr2+' kPa.');
form21.canvas.textout(0,180,'HR (humidity ratio over water) is: '+calcstr3+' kg/kg.');
form21.canvas.textout(0,210,'Mass of vapour in one cubic metre is: '+calcstr4+' grams.');
form21.canvas.textout(0,240,'Mass of DRY air in one cubic metre is: '+calcstr5+' grams.');
form21.canvas.textout(0,270,'Density of air (includes water vapour) is: '+calcstr6+' grams per cubic metre.');
form21.canvas.textout(0,300,'Mass of carbon dioxide in one cubic metre is: '+calcstr7+' grams.');
form21.canvas.textout(0,330,'Mass of carbon dioxide in one cubic kilometre is: '+calcstr8+' tonnes.');
form21.canvas.textout(0,360,'Carbon dioxide (volume percent) is: '+calcstr9+'%.');
form21.canvas.textout(0,390,'Water vapour (volume percent) is: '+calcstr10+'%.');
form21.canvas.textout(0,420,'Moles of carbon dioxide in one cubic metre is: '+calcstr11+' mol.');
form21.canvas.textout(0,450,'Moles of water vapour in one cubic metre is: '+calcstr12+' mol.');
form21.canvas.textout(0,480,'Mass of basalt needed to take out a third of the CO2 in one cubic km is: '+calcstr13+' tonnes.');
1: end;
Saturday, September 14, 2019
Water from air Delphi2 Code
T1 is the temperature of the surrounding air in deg C, RH1 is the relative humidity in percent, P1 is the atmospheric pressure in kPa (at sea level it is about 101.325 kPa), T2 is the temperature to which the air will be cooled, V1 is the volume of air you are going to cool in cubic metres. Code below:
label 1;
var
EnthV1MWh,EnthV1kWh,EnthV1,NokgdaV1,Enthd,Psatw1,Psatw2,Tk1,Tk2,Mvpa1,Enth1,Enth2,Ma1,Mv1,HR1,HR2,
Pv1,PV2,T1,RH1,P1,P2,T2,V1,kgDryAir,EdpkgDA,EnthDV,HR1mHR2,HR1mHR2V,kgpkWh,Td,RH,Psat,Pv,Tdew:extended;
errors1:boolean;
calcstr2,calcstr1,calcstr3,calcstr4,calcstr5,calcstr6,calcstr7,
calcstr8,calcstr9,calcstr10,calcstr11,calcstr12,calcstr13,calcstr14,
calcstr15,calcstr16,calcstr17,calcstr18:string[30];
begin
errors1:=false;
form2.hide;
form2.show;
try
T1:=strtofloat(form2.edit1.Text);
RH1:=strtofloat(form2.edit2.Text);
P1:=strtofloat(form2.edit3.Text);
T2:=strtofloat(form2.edit4.Text);
V1:=strtofloat(form2.edit5.Text);
except
errors1:=true;
end;
if (errors1=true) or
(T1<0.1) or (T1>100) or (RH1<0.1) or (RH1>100) or (P1<50) or (P1>150) or (T2<0.1) or
(T2>100) or (V1<0) or (T2>=T1-0.01)
then begin
form2.canvas.textout(0,100,'CHECK ENTRIES.');
goto 1
end;
Tk1:=T1+273.15;
Tk2:=T2+273.15;
Td:=T1;
RH:=RH1;
Psat:=0.61121*exp((18.678-Td/234.5)*Td/(257.14+Td));
Pv:=(RH/100)*Psat;
Tdew:=Td;
repeat
Tdew:=Tdew-0.001;
Psat:=0.61121*exp((18.678-Tdew/234.5)*Tdew/(257.14+Tdew));
until (Psat<=Pv);
str(Tdew:12:2,calcstr18);
Psatw1:=0.61121*exp((18.678-T1/234.5)*T1/(257.14+T1));
Pv1:=Psatw1*RH1/100;
HR1:=0.622*Pv1/(P1-Pv1);
Ma1:=(P1-Pv1)/(0.287*Tk1);
Enth1:=(1.005*T1)+HR1*(2501.3+1.88*T1);
Psatw2:=0.61121*exp((18.678-T2/234.5)*T2/(257.14+T2));
HR2:=Hr1;
P2:=P1;
if (Psatw2<PV1) then begin
Pv2:=Psatw2;
HR2:=0.622*Pv2/(P2-Pv2);
form2.canvas.textout(0,90,'Water condenses out. Dew point is:'+calcstr18+' deg C');
end;
Enth2:=(1.005*T2)+HR2*(2501.3+1.88*T2);
kgDryAir:=V1*Ma1;
EdpkgDA:=(Enth2-Enth1);
EnthDV:=kgDryAir*EdpkgDA;
HR1mHR2:=HR1-HR2;
HR1mHR2V:=kgDryAir*HR1mHR2;
kgpkWh:=(-1)*HR1mHR2V/(EnthDV/3600);
str(Enth1:13:4,calcstr1);
str(Enth2:13:4,calcstr2);
str(EdpkgDA:13:6,calcstr3);
str(Ma1:13:4,calcstr4);
str(kgDryAir,calcstr5);
str(EnthDV,calcstr6);
str((EnthDV/3600),calcstr7);
str((EnthDV/3600000),calcstr8);
str((HR1mHR2*1000):13:4,calcstr9);
str(HR1mHR2V,calcstr10);
str((HR1*1000):13:4,calcstr11);
str((HR2*1000):13:4,calcstr12);
str(EnthV1MWh,calcstr16);
str(kgpkWh:13:4,calcstr17);
form2.canvas.textout(0,120,'Enthalpy1 per kg dry air is: '+calcstr1+' kJ/kg dry air.');
form2.canvas.textout(0,150,'Enthalpy2 per kg dry air is: '+calcstr2+' kJ/kg dry air.');
form2.canvas.textout(0,180,'Enthalpy difference per kg dry air is: '+calcstr3+' kJ/kg dry air.');
form2.canvas.textout(0,210,'Mass of DRY air in one cubic metre of original air is: '+calcstr4+' kg.');
form2.canvas.textout(0,240,'Number of kg of dry air in V1 is: '+calcstr5+' kg.');
form2.canvas.textout(0,270,'FOR VOLUME V1: Heat added to volume V1 of air (Enthalpy difference for volume V1) is: '+calcstr6+' kJ.');
form2.canvas.textout(0,300,'FOR VOLUME V1: Heat added to volume V1 of air is: '+calcstr7+' kWh.');
form2.canvas.textout(0,330,'FOR VOLUME V1: Heat added to volume V1 of air is: '+calcstr8+' MWh.');
form2.canvas.textout(0,370,'HR1 - HR2 g/kg is: '+calcstr9+' grams of water vapour per kg dry air (CONDENSES OUT).');
form2.canvas.textout(0,400,'(HR1 - HR2 kg/kg)x(number of kg dry air in volume V1) is: '+calcstr10+' kg of water (CONDENSES OUT).');
form2.canvas.textout(0,440,'HR1 is: '+calcstr11+' g/kg.');
form2.canvas.textout(0,470,'HR2 is: '+calcstr12+' g/kg.');
form2.canvas.textout(0,520,'SUMMARY. Total mass of water condensing out of the air is: '+calcstr10+' kg.');
form2.canvas.textout(0,550,'SUMMARY: Total heat added to the air is: '+calcstr7+' kWh.');
form2.canvas.textout(0,580,'SUMMARY: kg of water produced per kWh of heat removed from air: '+calcstr17+' kg/kWh.');
form2.canvas.textout(0,610,'SUMMARY: Dew point temperature is: '+calcstr18+' deg C.');
1: end;