#Declaring Values
V = 3.; #Volume in m**3
P1 = 2500.; #Pressure in kilobar
P2 = 1500.;
T2 = 21.+273; #Temperature in Kelvin
T1 = (T2*P1)/P2;
# Calculations
Cp = 1.005;
Cv = 0.718;
R = Cp-Cv; #Universal Gas Consmath.tant
m = (P1*V)/(R*T1); #Calculating mass
H = m*Cp*(T2-T1);
U = m*Cv*(T2-T1);
Q = U; #Since Consmath.tant Volume Process: Work Done = 0
#Displaying Results
print 'Change in Enthalpy: %5.2f kJ'%(H);
print 'Change in Internal Energy: %5.f kJ'%(U);
print 'Heat Transfer: %4.f kJ'%(Q);
print 'As Answer is negative, system rejects heat'
#Inputs
m = 1.; #Mass in kg
P1 = 7.; #Pressure in bar
T1 = 90.+273; #Temperature in K
P2 = 1.4;
R = 0.287;
G = 1.4; #Gamma for air
#Calculations according to data required
x = P2/P1;
y = 0.1/1.1;
z = x**y;
T2 = T1*z; #calculating T2
print 'Final Temperature is: %3.1f K'%(T2);
W = (m*R*(T1-T2))/(1.1-1);
print 'Work Done is: %3.1f kJ'%(W);
Cv = (R)/(G-1);
Cp = R+Cv;
CI = m*Cv*(T2-T1);
print 'Change in Internal Energy is: %3.2f kJ'%(CI);
Q = CI+W;
print 'Heat Transfer is: %3.2f kJ'%(Q);
# Variables
P1 = 2.75*100; #Pressure in kPa
V1 = 0.09 #Volume in m**3
T1 = 185.+273; #Temperature in Kelvin
T2 = 15.+273;
R = 0.29;
Cp = 1.005;
Cv = 0.715;
# Calculations and Results
m = (P1*V1)/(R*T1);
V2 = (T2/T1)*V1;
W = P1*(V2-V1);
print 'The Work Done: %2.3f kJ'%(W);
Q = m*Cp*(T2-T1);
print 'The Heat Transfer: %2.2f kJ'%(Q);
U = Q-W;
print 'The change in Internal Energy: %2.2f kJ'%(U);
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
m = 0.67;
P1 = 14.;
T1 = 290.+273;
R = 287.;
# Calculations and Results
V1 = (m*R*T1)/(14*(10**5));
print 'The Volume: %2.3f kJ'%(V1);
V2 = 4*V1;
print 'The Final Volume: %2.3f kJ'%(V2);
x = V1/V2;
y = x**1.3;
P2 = P1*y;
print 'The Final Pressure: %2.2f bar'%(P2);
x = V1/V2;
y = x**0.3;
T2 = T1*y;
print 'The Final Temperature: %2.2f K'%(T2);
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
P1 = 510.;
V1 = 0.142;
P2 = 170.;
V2 = 0.275;
H = -65.;
Cv = 0.718;
# Calculations and Results
X = (P2*V2)-(P1*V1);
U = H-X;
print 'The Change in Internal Energy: %2.2f kJ'%(U);
G = H/U;
Cp = G*Cv;
R = Cp-Cv;
print 'The Value of R: %2.3f kJ/kg K'%(R);
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
P1 = 25.;
T1 = 27.+273;
P2 = 5.;
T2 = 20.+273;
V1 = 0.7;
Et = 1.43;
Pn = 101.325;
Tn = 273.;
#Calculations
R = (Pn)/(Et*Tn);
m1 = (Pn*V1)/(R*Tn);
V2 = (m1*R*T1)/(P1*100);
m2 = (P2*100*V2)/(R*T2);
mf = m1-m2;
# Results
print 'The mass of Oxygen used: %3.3f kg'%(mf);
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
n = 1.3;
m = 1.;
T1 = 300.;
T2 = 200.;
W = 90.;
Ro = 8.3143;
# Calculations
R = ((n-m)*W)/((T1-T2)*m);
M = Ro/R;
# Results
print 'The molecular mass of gas is: %3.1f kg/kg mole'%(M);
import math
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
m = 0.18;
V1 = 0.15;
T1 = 15.+273;
P1 = 100.;
V2 = 0.056;
P2 = 400.;
# Calculations and Results
R = (P1*V1)/(m*T1);
print 'The Gas Consmath.tant: %3.3f kJ/kg K'%(R);
M = 8.3141/R;
print 'The Molecular Mass of Gas: %3.2f kg/kg mole'%(M);
x = math.log(P2/P1);
y = math.log(V2/V1);
G = -(x/y);
Cv = R/(G-1);
print 'The Cv: %3.2f kJ/kg K'%(Cv);
Cp = Cv+R;
print 'The Cp: %3.2f kJ/kg K'%(Cp);
x = (G-1)/G;
y = P2/P1;
z = y**x;
T2 = T1*z;
U = m*Cv*(T2-T1);
print 'The change in Internal Energy: %3.2f kJ'%(U);
import math
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
P1 = 100.;
V1 = 0.25;
T1 = 100.+273;
V2 = 0.05;
P2 = 750.;
G = 1.4;
R = 0.298;
# Calculations and Results
n = (math.log(P2/P1))/(math.log(V1/V2));
print 'The Index n: %1.2f '%(n);
T2 = T1*((P2/P1)**((n-1)/n));
Cv = R/(G-1);
Cp = R+Cv;
m = (P1*V1)/(R*T1);
W = (m*R*(T1-T2))/(n-1);
Q = ((G-n)/(G-1))*W;
print 'The Heat change: %2.2f kJ'%(Q);
U = m*Cv*(T2-T1);
print 'The change in Internal Energy: %2.2f kJ'%(U);
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
m = 1.;
P2 = 25.;
P1 = 1.;
pV = 260.;
T1 = 17.+273;
# Calculations and Results
T2 = T1;
V1 = (pV*T1)/(P1*100000);
print 'As process is Isothermal, Initial and Final Temperatures are same ';
print 'The Final Temperature: %3.0f K'%(T1);
V2 = (pV*T2)/(P2*100000);
print 'The Final Volume: %3.5f m**3'%(V2);
CR = P2/P1;
print 'The Compression Ratio: %3.0f '%(CR);
print 'Change in Enthalpy is zero as it is Isothermal process ';
W = P1*100*V1*(math.log(P1/P2));
print 'Work Done is: %3.1f kJ'%(W);
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
P2 = 6.;
Cp = 1.75;
P1 = 1.;
n = 1.3;
T1 = 30.+273;
M = 30.;
m = 2.;
Ro = 8314.4;
# Calculations and Results
R = (Ro/M)/1000;
print 'The Gas Consmath.tant: %3.3f kJ/kg K'%( R);
Cv = Cp-R;
G = Cp/Cv;
print 'The value of Gamma: %1.2f '%(G);
T2 = (T1)*((P2/P1)**((n-1)/n));
print 'Final Temperature: %3.2f K'%(T2);
W = (m*R*(T1-T2))/(n-1);
print 'The work done on the gas: %3.2f kJ'%(W);
Q = ((G-n)/(G-1))*W;
print 'The Heat Transfer is %3.2f kJ'%(Q);
U = m*Cv*(T2-T1);
print 'The change in Internal Energy is %3.2f kJ'%(U);
# note : answer may vary because of rounding off error.
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
P1 = 350.;
P2 = 130.;
R = 0.287;
T1 = 450.;
G = 1.4;
m = 1.;
# Calculations and Results
T2 = T1*((P2/P1)**((G-1)/G));
W = (m*R*(T1-T2))/(G-1);
print 'Amount of External Work done: %3.2f kJ/kg'%(W);
U = -W;
print 'Change in Internal Energy: %3.2f kJ/kg'%(U);
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
P1 = 1.5;
V1 = 0.1;
V2 = 0.04;
P2 = 7.5;
T1 = 30+273;
# Calculations
#Umath.sing ideal gas equation
T2 = (P2*V2*T1)/(P1*V1);
# Results
print 'The Value of Temperature of gas: %3.0f C'%(T2 - 273);
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
P1 = 1.5;
V1 = 3.;
T1 = 27.+273;
P2 = 30.;
T2 = 60.+273;
R = 0.287;
# Calculations and Results
m1 = (P1*100*V1)/(R*T1);
m2 = (P2*100*V1)/(R*T2);
m = m2-m1;
print 'The mass pumped: %2.2f kg'%(m);
V = (m*R*(17+273))/(1*100);
print 'Volume: %2.2f m**3'%(V);
T3 = 27+273;
P3 = (T3*P2)/T2;
print 'Final air pressure in the vessel: %2.2f bar'%(P3);
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
V1 = 1.5;
m = 2.;
T1 = 27.+273;
T2 = 207.+273;
V2 = V1;
M = 28.;
Ro = 8.314;
# Calculations and Results
R = Ro/M;
P1 = (m*R*T1)/V1;
print 'The initial pressure of gas: %3.3f bar'%(P1/100);
P2 = (P1*T2)/T1;
print 'The final pressure of gas: %3.3f bar'%(P2/100);
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
T1 = 27.+273;
V1 = 0.06;
P1 = 150.;
Ro = 8.314;
M = 28.;
# Calculations and Results
R = Ro/M;
m = (P1*100*V1)/(R*T1);
print 'Mass of gas at design condition: %2.1f kg'%(m);
P2 = 170.;
T2 = (T1*P2)/P1;
print 'Fusible plug should melt at: %3.0f K'%(T2);
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
P1 = 7.;
m = 3.7;
V1 = 1.5;
P2 = 1.4;
V2 = 4.5;
U = 648.;
Cv = 1.05;
# Calculations and Results
RT1 = (P1*100*V1)/(m);
RT2 = (P2*100*V2)/(m);
RT = RT1-RT2;
T = (U)/(m*Cv);
R = (RT/T)
print 'The value of R: %1.3f kJ/kg K'%(R);
Cp = Cv+R;
H = m*Cp*(-T);
print 'The change in enthalpy is: %4.2f kJ'%(H);
T1 = RT1/R;
T2 = RT2/R;
print 'Initial Temperature: %3.2f K '%(T1);
print 'Final Temperature: %3.f K '%(T2);
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
V = 1.6;
P = 1.;
m = 2.;
T = 17.+273;
G = 1.4;
# Calculations and Results
R = (P*100*V)/(m*T);
Cv = (R)/(G-1);
print 'The Value of Cv: %1.2f kJ/kg K'%(Cv);
Cp = Cv+R;
print 'The Value of Cp: %1.3f kJ/kg K'%(Cp);
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
V1 = 0.091;
P1 = 2.73;
T1 = 187.+273;
T2 = 27.+273;
Cp = 1.005;
Cv = 0.718;
# Calculations and Results
R = Cp-Cv;
m = (P1*100*V1)/(R*T1);
Q = m*Cp*(T2-T1);
print 'The Value of heat transferred: %1.2f kJ'%(Q);
V2 = (T2*V1)/T1;
W = P1*100*(V2-V1);
print 'The Value of Work done: %1.2f kJ'%(W);
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
m = 28.;
V1 = 3.;
T1 = 100.+273;
T2 = 37.+273;
G = 1.4;
Ro = 8.314;
# Calculations and Results
v = V1/m;
R = Ro/m;
P1 = (m*R*T1)/V1;
print 'The Specific Volume: %1.3f m**3/kg'%(v);
print 'The Initial Pressure: %1.2f kPa'%(P1);
P2 = (P1*T2)/T1;
print 'The Final Pressure: %1.2f kPa'%(P2);
Cv = (R)/(G-1);
Cp = Cv*G;
U = m*Cv*(T2-T1);
H = m*Cp*(T2-T1);
print 'Change in Internal Energy: %1.2f kJ'%(U);
print 'Change in Heat energy: %1.2f kJ'%(H);
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
V1 = 3.;
V1 = V1*100; #In kPa
P1 = 2.;
T1 = 73.+273;
P2 = 7.;
R = 0.287;
Cv = 0.718;
Cp = 1.005;
# Calculations
m = (P1*V1)/(R*T1);
T2 = (P2*T1)/P1;
U = m*Cv*(T2-T1);
H = m*Cp*(T2-T1);
# Results
print 'Change in Internal Energy: %1.2f kJ'%(U);
print 'Change in heat Energy: %1.2f kJ'%(H);
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
m = 1.;
T1 = 27.+273;
T2 = 197.+273;
V1 = 2.1;
R = 0.287;
Cp = 1.005;
# Calculations and Results
W = m*R*(T2-T1);
print 'Work Done: %1.2f kJ'%(W);
Q = m*Cp*(T2-T1);
U = Q-W;
print 'Change in Heat Energy: %1.2f kJ'%(Q);
print 'Change in Internal Energy: %1.2f kJ'%(U);
P = (m*R*T1)/(V1);
V2 = (V1*T2)/(T1);
print 'Pressure: %1.2f kPa'%(P);
print 'Final Volume: %1.1f m**3'%(V2);
import math
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
V1 = 0.5;
P1 = 0.3;
V2 = 0.1;
# Calculations and Results
P2 = (P1*V1)/(V2);
print 'Final Pressure: %1.2f bar'%(P2);
W = (P1*100*V1)*(math.log(V2/V1));
print 'Work Done: %1.2f kJ'%(W);
print 'Change in Internal Energy: 0 kJ as it is Isothermal Process';
print 'Change in Heat Energy: %1.2f kJ'%(W);
import math
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
m = 0.19;
P1 = 1.;
V1 = 0.16;
T1 = 17.+273;
P2 = 4.1;
V2 = 0.046;
Ro = 8.314;
# Calculations and Results
R = (P1*100*V1)/(m*T1);
print 'Gas Constant: %1.2f kJ/kg K'%(R);
M = Ro/R;
print 'Molecular Mass: %1.2f kg/kg mole'%(M);
G = (math.log(P1/P2))/(math.log(V2/V1));
print 'Ratio of Specific Heats: %1.2f '%(G);
Cv = (R)/(G-1);
print 'Value of Cv: %1.2f kJ/kg K'%(Cv);
Cp = G*Cv;
print 'Value of Cp: %1.2f kJ/kg K'%(Cp);
T2 = (P2*100*V2)/(m*R);
U = m*Cv*(T2-T1);
print 'Change in Internal Energy: %1.2f kJ'%(U);
H = m*Cp*(T2-T1);
print 'Heat Transfer: %1.2f kJ'%(H);
W = ((P1*100*V1)-(P2*100*V2))/(G-1);
print 'Work Done: %1.2f kJ'%(W);
# note : rounding off error.
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
V1 = 0.19;
P1 = 5.;
T1 = 190.+273;
P2 = 1.;
H = 100.;
G = 1.4;
R = 0.287;
Cp = 1.005;
# Calculations
V2 = V1*((P1/P2)**(1./G));
W = ((P1*100*V1)-(P2*100*V2))/(G-1);
m = (P1*100*V1)/(R*T1);
T2 = T1*((P2/P1)**((G-1)/G))
x = H/(m*Cp);
T3 = x+T2;
V3 = (V2*T3)/T2;
Wo = P2*100*(V3-V2);
Wf = W+Wo;
# Results
print 'Total Work Done: %1.2f kJ'%(Wf);
# note: rounding off error.
import math
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
V1 = 0.1;
V3 = V1;
P1 = 10.;
T1 = 200.+273;
P2 = 3.;
R = 0.287;
G = 1.4;
Cv = 0.718;
# Calculations and Results
m = (P1*100*V1)/(R*T1);
T2 = T1*((P2/P1)**((G-1)/G));
V2 = V1*((P1/P2)**((1)/G));
T3 = T2;
P3 = (P2*V2)/V3;
print 'Pressure after Isothermal Compression: %1.2f bar'%(P3);
print 'Temperature after isothermal compression: %1.2f K'%(T2);
W1 = ((P1*100*V1)-(P2*100*V2))/(G-1);
print 'Work Developed during adiabatic expansion: %2.0f kJ'%(W1);
W2 = (P2*100*V2)*math.log(V3/V2);
print 'Work of Compression: %1.2f kJ'%(W2);
Q = m*Cv*(T1-T3);
print 'Heat supplied in 3rd Process: %1.2f kJ'%(Q);
U = m*Cv*(T2-T1);
print 'Change in Internal Energy: %1.2f kJ'%(U);
# note: rounding off error.
#Inputs
V1 = 0.028;
P1 = 1.;
T1 = 27.+273;
n = 1.3;
V2 = 0.0046;
T3 = T1;
# Calculations and Results
T2 = T1*((V1/V2)**(n-1));
print 'Temperature after compression: %1.2f K'%(T2);
P2 = P1*((V1/V2)**n);
W = ((P1*100*V1)-(P2*100*V2))/(n-1);
print 'Work Done: %1.2f kJ'%(W);
P3 = (T3*P2)/T2;
print 'Final Pressure: %1.2f bar'%(P3);
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
V1 = 0.15;
P1 = 900.;
T1 = 300.+273;
T3 = T1;
V2 = 3*V1;
R = 0.287;
Cp = 1.005;
G = 1.4;
n = 1.5;
Cv = 0.718;
# Calculations and Results
m = (P1*V1)/(R*T1);
T2 = (V2*T1)/V1;
Q1 = m*Cp*(T2-T1);
print 'Heat Received: %3.2f kJ'%(Q1);
Q2 = (m*Cv)*((n-G)/(n-1))*(T3-T2);
Q3 = m*R*T3*(math.log(1./27));
Qr = 0-(Q2+Q3);
print 'Heat Rejected: %3.2f kJ'%(Qr);
Eff = (1-(Qr/Q1))*100;
print 'Efficiency: %3.2f percent'%(Eff);
# rounding off error.
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
M = 27.;
P1 = 1.;
T1 = 60.+273;
n = 1.3;
Cvm = 21.;
Ro = 8.314;
R = Ro/M;
# Calculations and Results
V1 = (R*T1)/(P1*100);
V2 = V1/12;
x = V1/V2;
P2 = P1*(x**n);
W = ((P1*100*V1)-(P2*100*V2))/(n-1);
print 'Work Done: %3.2f kJ/kg'%(W);
Cv = Cvm/M;
Cp = Cv+R;
G = Cp/Cv;
Q = ((G-n)/(G-1))*W;
print 'Heat Transfer during the process: %3.2f kJ/kg'%(Q);
# note : rounding off error.
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
D = 0.550;
L = 0.740;
r = 12.;
P1 = 100.;
T1 = 27.+273;
n = 1.32;
R = 0.287;
G = 1.4;
V = ((22./7)/4)*D*D*L;
V2 = V/11;
# Calculations and Results
V1 = V2+V;
P2 = P1*((r)**n);
T2 = T1*((r)**(n-1));
print 'The Pressure at end of Compression: %3.3f kPa'%(P2);
print 'The Temperature at end of Compression: %3.3f K'%(T2);
m = (P1*V1)/(R*T1);
print 'The Mass in the cylinder: %3.3f kg'%(m);
W = ((P1*V1)-(P2*V2))/(n-1);
print 'The Work Done: %3.3f kJ'%(W);
Q = ((G-n)/(G-1))*W;
print 'The Heat Transfer: %3.3f kJ'%(Q);
# note : rounding off error.
import math
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
m = 1.;
P1 = 10.;
T1 = 337.+273;
P2 = 1.;
V = 6.;
R = 0.287;
G = 1.4;
# Calculations and Results
x = math.log(P2/P1);
y = math.log(1./V);
n = x/y;
print 'The Value of n: %3.3f '%(n);
V1 = (m*R*T1)/(P1*100);
V2 = V1*6;
W = ((P1*100*V1)-(P2*100*V2))/(n-1);
print 'The Work Done: %3.1f kJ'%(W);
Q = ((G-n)/(G-1))*W;
print 'The Heat Transfer: %3.2f kJ'%(Q);
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
T1 = 430.;
T2 = 289.25;
P2 = 100.;
P1 = 400.;
G = 1.4;
V1 = 0.2;
R = 287.;
Q = 60.;
Cp = 1.005;
# Calculations and Results
T2 = T1*((P2/P1)**((G-1)/G));
V2 = V1*((P1/P2)**(1./G));
m = (P1*1000*V1)/(R*T1);
W1 = (m*(R/1000)*(T1-T2))/(G-1);
T3 = (Q/(m*Cp))+T2;
V3 = (V2*T3)/T2;
W2 = P2*(V3-V2);
W = W1+W2;
print 'The Net Work Done: %3.3f kJ'%(W);
n = ((m*(R/1000)*(T1-T3))/W)+1;
print 'The value of n: %3.2f '%(n);
import math
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg Km = 1;
P1 = 6.;
V1 = 0.01;
V2 = 0.05;
P2 = 2;
# Calculations and Results
W1 = (((P1+P2)/2)*100)*(V2-V1);
print 'The Work done for first cycle: %3.1f kJ'%(W1);
P3 = P2;
V3 = (P1*V1)/P3;
W2 = P2*100*(V3-V2);
print 'The Work done for second cycle: %3.1f kJ'%(W2);
W3 = (P3*100*V3)*(math.log(V1/V3));
print 'The Work done for third cycle: %3.2f kJ'%(W3);
W = W1+W2+W3;
print 'The net Work done: %3.2f kJ'%(W);
Q = W; #As process is cyclic
print 'The Heat Transfer: %3.2f kJ'%(Q);
import math
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
V1 = 0.6;
P1 = 1.;
T1 = 90.+273;
V2 = 0.18;
P2 = 5.;
R = 0.287;
G = 1.4;
# Calculations and Results
m = (P1*100*V1)/(R*T1);
print 'The mass of Gas: %3.4f kg'%(m);
n = (math.log(P2/P1))/(math.log(V1/V2));
print 'The value of n: %3.3f '%(n);
Cv = R/(G-1);
T2 = ((P2*V2)/(P1*V1))*T1;
U = m*Cv*(T2-T1);
print 'The change in Internal Energy: %3.3f kJ'%(U);
import math
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
R = 0.29;
Cp = 1.005;
P1 = 2.75;
P2 = P1;
V1 = 0.09;
T1 = 185+273;
T2 = 15+273;
# Calculations and Results
V2 = (V1*T2)/T1;
m = (P1*100*V1)/(R*T1);
Q = m*Cp*(T2-T1);
print 'The Heat Transfer: %3.3f kJ'%(Q);
W = P1*100*(V2-V1);
print 'The Work done: %3.3f kJ'%(W);
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
T1 = 25.+273;
T2 = 145.+273;
m = 2.;
R = 267.;
G = 1.4;
# Calculations and Results
Cv = R/(G-1);
print 'The value of Cv: %3.1f J/kg K'%(Cv);
Cp = G*Cv;
print 'The value of Cp: %3.1f J/kg K'%(Cp);
U = m*Cv*(T2-T1)*(1./1000);
print 'The change in Internal Energy: %3.1f kJ'%(U);
H = m*Cp*(T2-T1)*(1./1000);
print 'The Heat Transfer: %3.1f kJ'%(H);
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
D = 1.;
h = 4.;
P1 = 100.;
T1 = 27.+273;
P2 = 125.;
Cp = 14.307;
Cv = 10.183;
# Calculations
V1 = (22./7)*(1./4)*(D*D*h);
R = Cp-Cv;
m = (P1*V1)/(R*T1);
T2 = (P2*T1)/P1;
Q = m*Cv*(T2-T1);
# Results
print 'The Heat Transfer: %3.0f kJ'%(Q);
import math
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
V1 = 0.15;
V2 = 3*V1;
P1 = 900.;
P2 = P1;
T1 = 300.+273;
T3 = T1;
n = 1.5;
G = 1.4;
R = 0.287;
Cp = 1.005;
# Calculations and Results
m = (P1*V1)/(R*T1);
T2 = (T1*V2)/V1;
Q1 = m*Cp*(T2-T1);
W1 = m*R*(T2-T3)/(n-1);
Q2 = (G-n)*W1/(G-1);
P3 = P2*((T3/T2)**(G/(G-1)));
Q3 = m*R*T1*math.log(P3/P1);
H_rec = Q1;
print 'The Heat received: %3.1f kJ'%(H_rec);
H_rej = 0-(Q2+Q3);
print 'The Heat Rejected: %3.1f kJ'%(H_rej);
eff = 100*(1-(H_rej/H_rec));
print 'Efficiency: %3.2f percent'%(eff);
import math
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg Km = 1;
V1 = 0.15;
P1 = 1.;
V2 = 0.05;
G = 1.4;
# Calculations and Results
P2 = (V1*P1)/V2;
W_it = P1*100*V1*math.log(P1/P2);
print 'Work done in Isothermal process: %2.2f kJ'%(W_it);
P2 = P1*((V1/V2)**G);
W_ad = ((P1*100*V1)-(P2*100*V2))/(G-1);
print 'Work done in Adiabatic process: %2.2f kJ'%(W_ad);
import math
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
m = 1.;
Cp = 1.005;
P1 = 100.;
T1 = 17.+273;
T2 = T1;
P2 = 2500.;
# Calculations and Results
print 'Final Temperature: %2.2f K'%(T2);
V1 = (260*T1)/(P1*1000);
V2 = (P1*V1)/P2;
print 'Final Volume: %2.5f m**3'%(V2);
n = P2/P1;
print 'Compression ratio: %2.0f '%(n);
H = m*Cp*(T2-T1);
print 'Change in Enthalpy: %2.2f kJ'%(H);
W = P1*V1*math.log(P1/P2);
print 'Work done: %2.2f kJ/kg'%(W);
#Inputs
#The Values in the program are as follows:
#Temperature in Celcius converted to Kelvin(by adding 273)
#Pressure in bar converted to kPa (by multiplying 100)
#Volume in m**3
#Value of R,Cp and Cv in kJ/kg K
P1 = 150.;
T1 = 17.+273;
P2 = 750.;
n = 1.3;
m = 1.;
R = 0.287;
Cp = 1.001;
# Calculations and Results
T2 = T1*((P2/P1)**((n-1)/n));
print 'The final temperature: %2.1f K'%(T2);
W = m*R*(T1-T2)/(n-1);
print 'Work done: %2.2f kJ/kg'%(W);
Cv = Cp-R;
U = m*Cv*(T2-T1);
print 'Change in internal energy: %2.2f kJ/kg'%(U);
G = Cp/Cv;
Q = ((G-n)/(G-1))*W;
print 'Amount of heat transfer: %2.2f kJ/kg'%(Q);
H = m*Cp*(T2-T1);
print 'Change in enthalpy: %2.2f kJ/kg'%(H);