In: Mechanical Engineering
write a fortran code on helical transcritical compression tube used in pulse tube cryocooler using R407 refrigerant.
it is different than already replied question on
chegg. please dont copy paste that answer i want genuine and
correct code using fortran 77 only
"Input Data"
R_u = 8.314 [kJ/kmol-K] "universal Gas Constant"
T_Ar = 220 [K]
P_Ar = 5000 [kPa] "Pressure for only Argon in the tank initially."
N_Ar = 1 [kmol]
{N_N2 = 3 [kmol]}
T_mix = 200 [K]
T_cr_Ar=151.0 [K] "Critical Constants are found in Table A.1 of the text"
P_cr_Ar=4860 [kPa]
T_cr_N2=126.2 [K]
P_cr_N2=3390 [kPa]
"Ideal-gas Solution:"
P_Ar*V_Tank_IG = N_Ar*R_u*T_Ar "Apply the ideal gas law the gas in the tank."
P_mix_IG*V_Tank_IG = N_mix*R_u*T_mix "Ideal-gas mixture pressure"
N_mix=N_Ar + N_N2 "Moles of mixture"
"Real Gas Solution:"
P_Ar*V_Tank_RG = Z_Ar_1*N_Ar*R_u*T_Ar "Real gas volume of tank"
T_R=T_Ar/T_cr_Ar "Initial reduced Temp. of Ar"
P_R=P_Ar/P_cr_Ar "Initial reduced Press. of Ar"
Z_Ar_1=COMPRESS(T_R, P_R ) "Initial compressibility factor for Ar"
P_Ar_mix*V_Tank_RG = Z_Ar_mix*N_Ar*R_u*T_mix "Real gas Ar Pressure in mixture"
T_R_Ar_mix=T_mix/T_cr_Ar "Reduced Temp. of Ar in mixture"
P_R_Ar_mix=P_Ar_mix/P_cr_Ar "Reduced Press. of Ar in mixture"
Z_Ar_mix=COMPRESS(T_R_Ar_mix, P_R_Ar_mix ) "Compressibility factor for Ar in mixture"
P_N2_mix*V_Tank_RG = Z_N2_mix*N_N2*R_u*T_mix "Real gas N2 Pressure in mixture"
T_R_N2_mix=T_mix/T_cr_N2 "Reduced Temp. of N2 in mixture"
P_R_N2_mix=P_N2_mix/P_cr_N2 "Reduced Press. of N2 in mixture"
Z_N2_mix=COMPRESS(T_R_N2_mix, P_R_N2_mix ) "Compressibility factor for N2 in mixture"
P_mix=P_R_Ar_mix*P_cr_Ar +P_R_N2_mix*P_cr_N2 "Mixture pressure by Dalton's law. 23800"
"Work is the integral of p dv, which can be done analytically."
w_ideal=R*T[1]*Ln(p[1]/p[2])
"First Law - note that u_ideal[2] is equal to u_ideal[1]"
q_ideal-w_ideal=u_ideal[2]-u_ideal[1]
"Entropy change"
DELTAs_ideal=s_ideal[2]-s_ideal[1]
"***** COMPRESSABILITY CHART SOLUTION ******"
"State 1"
Tr[1]=T[1]/T_critical
pr[1]=p[1]/p_critical
Z[1]=COMPRESS(Tr[1], Pr[1])
DELTAh[1]=ENTHDEP(Tr[1], Pr[1])*R*T_critical "Enthalpy departure"
h[1]=h_ideal[1]-DELTAh[1] "Enthalpy of real gas using charts"
u[1]=h[1]-Z[1]*R*T[1]
"Internal energy of gas using charts"
DELTAs[1]=ENTRDEP(Tr[1], Pr[1])*R "Entropy departure"
s[1]=s_ideal[1]-DELTAs[1] "Entropy of real gas using charts"
"State 2"
T[2]=T[1]
Tr[2]=Tr[1]
pr[2]=p[2]/p_critical
Z[2]=COMPRESS(Tr[2], Pr[2])
DELTAh[2]=ENTHDEP(Tr[2], Pr[2])*R*T_critical "Enthalpy departure"
DELTAs[2]=ENTRDEP(Tr[2], Pr[2])*R "Entropy departure"
h[2]=h_ideal[2]-DELTAh[2] "Enthalpy of real gas using charts"
s[2]=s_ideal[2]-DELTAs[2] "Entropy of real gas using charts"
u[2]=h[2]-Z[2]*R*T[2] "Internal energy of gas using charts"
w_chart=Integral(p,v,v[1],v[2])
"We need an equation to relate p and v in the above INTEGRAL function. "
p*v=COMPRESS(Tr[2],p/p_critical)*R*T[1] "To specify relationship between p and v"
"Find the limits of integration"
p[1]*v[1]=Z[1]*R*T[1] "to get v[1], the lower bound"
p[2]*v[2]=Z[2]*R*T[2] "to get v[2], the upper bound"
"First Law - note that u[2] is not equal to u[1]"
q_chart-w_chart=u[2]-u[1]
"Entropy Change"
DELTAs_chart=s[2]-s[1]
"***** SOLUTION USING EES BUILT-IN PROPERTY DATA *****"
"At state 1"
u_ees[1]=intEnergy(Name$,T=T[1],p=p[1])
s_ees[1]=entropy(Name$,T=T[1],p=p[1])
"At state 2"
u_ees[2]=IntEnergy(Name$,T=T[2],p=p[2])
s_ees[2]=entropy(Name$,T=T[2],p=p[2])
"Work using EES built-in properties- note use of EES Integral funcion to evaluate the integral of
pdv."
w_ees=integral(p_ees, v_ees, v_ees[1],v_ees[2])
"The following equation relates p and v in the above INTEGRAL"PROPRIETARY MATERIAL.
educators for course preparation. If you are a student using this Manual, you are using it without permission.
12-60
p_ees=pressure(Name$,T=T[1], v=v_ees) "To specify relationship between p and v"
"Find the limits of integration"
v_ees[1]=volume(Name$, T=T[1],p=p[1]) "to get lower bound"
v_ees[2]=volume(Name$, T=T[2],p=p[2]) "to get upper bound"
"First law - note that u_ees[2] is not equal to u_ees[1]"
q_ees-w_ees=u_ees[2]-u_ees[1]
"Entropy change"
DELTAs_ees=s_ees[2]-s_ees[1]
"Note: In all three solutions to this problem we could have calculated the heat transfer by
q/T=DELTA_s since T is constant. Then the first law could have been used to find the work.
The use of integral of p dv to find the work is a more fundamental approach and can be
used if T is not constant."
SOLUTION
DELTAh[1]=16.48 [kJ/kg]
DELTAh[2]=91.96 [kJ/kg]
DELTAs[1]=0.03029 [kJ/kg-K]
DELTAs[2]=0.1851 [kJ/kg-K]
DELTAs_chart=-0.4162 [kJ/kg-K]
DELTAs_ees=-0.4711 [kJ/kg-K]
DELTAs_ideal=-0.2614 [kJ/kg-K]
Fluid$='C3H8'
h[1]=-2232 [kJ/kg]
h[2]=-2308 [kJ/kg]
h_ideal[1]=-2216 [kJ/kg]
h_ideal[2]=-2216 [kJ/kg]
M=44.1
Name$='Propane'
p=4000
p[1]=1000 [kPa]
p[2]=4000 [kPa]
pr[1]=0.2165
pr[2]=0.8658
p_critical=4620 [kPa]
p_ees=4000
q_chart=-155.3 [kJ/kg]
q_ees=-175.8 [kJ/kg]
q_ideal=-97.54 [kJ/kg]
R=0.1885 [kJ/kg-K]
R_u=8.314 [kJ/mole-K]
s[1]=6.073 [kJ/kg-K]
s[2]=5.657 [kJ/kg-K]
s_ees[1]=2.797 [kJ/kg-K]
s_ees[2]=2.326 [kJ/kg-K]
s_ideal[1]=6.103 [kJ/kg-K]
s_ideal[2]=5.842 [kJ/kg-K]
T[1]=373.2 [K]
T[2]=373.2 [K]
Tr[1]=1.009
Tr[2]=1.009
T_critical=370 [K]
u[1]=-2298 [kJ/kg]
u[2]=-2351 [kJ/kg]
u_ees[1]=688.4 [kJ/kg]
u_ees[2]=617.1 [kJ/kg]
u_ideal[1]=-2286 [kJ/kg]
u_ideal[2]=-2286 [kJ/kg]
v=0.01074
v[1]=0.06506 [m^3/kg]
v[2]=0.01074 [m^3/kg]
v_ees=0.009426
v_ees[1]=0.0646 [m^3/kg]
v_ees[2]=0.009426 [m^3/kg]
w_chart=-101.9 [kJ/kg]
w_ees=-104.5 [kJ/kg]
w_ideal=-97.54 [kJ/kg]
Z[1]=0.9246
Z[2]=0.6104