From 7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Tue, 10 Oct 2017 12:27:19 +0530 Subject: initial commit / add all books --- 555/CH7/EX7.1/1.sce | 17 +++++++++++++++++ 555/CH7/EX7.10/10.sce | 24 ++++++++++++++++++++++++ 555/CH7/EX7.2/2.sce | 28 ++++++++++++++++++++++++++++ 555/CH7/EX7.3/3.sce | 35 +++++++++++++++++++++++++++++++++++ 555/CH7/EX7.6/6.sce | 22 ++++++++++++++++++++++ 555/CH7/EX7.7/7.sce | 20 ++++++++++++++++++++ 555/CH7/EX7.8/8.sce | 25 +++++++++++++++++++++++++ 555/CH7/EX7.9/9.sce | 26 ++++++++++++++++++++++++++ 8 files changed, 197 insertions(+) create mode 100644 555/CH7/EX7.1/1.sce create mode 100644 555/CH7/EX7.10/10.sce create mode 100644 555/CH7/EX7.2/2.sce create mode 100644 555/CH7/EX7.3/3.sce create mode 100644 555/CH7/EX7.6/6.sce create mode 100644 555/CH7/EX7.7/7.sce create mode 100644 555/CH7/EX7.8/8.sce create mode 100644 555/CH7/EX7.9/9.sce (limited to '555/CH7') diff --git a/555/CH7/EX7.1/1.sce b/555/CH7/EX7.1/1.sce new file mode 100644 index 000000000..28dc769b1 --- /dev/null +++ b/555/CH7/EX7.1/1.sce @@ -0,0 +1,17 @@ +// Implementation of example 7.1 +// Basic and Applied Thermodynamics by P.K.Nag + +clc +clear + +// T is temperature,dS is entropy change +T1=35 // degree celsius +T2=37 // degree celsius +t1=T1+273; +t2=T2+273; +// change in entropy is given by dS=mCvlog(t2/t1) +m=1 // kg +Cv=4.187 +dS=m*Cv*log(t2/t1); +printf("change in entropy = %.4f kJ/K",dS); +// end \ No newline at end of file diff --git a/555/CH7/EX7.10/10.sce b/555/CH7/EX7.10/10.sce new file mode 100644 index 000000000..85221fba5 --- /dev/null +++ b/555/CH7/EX7.10/10.sce @@ -0,0 +1,24 @@ +// Implementation of example 7.10 +// Basic and Applied Thermodynamics by P.K.Nag + +clc +clear + +// T is temperature,dS is change in entropy,S is entropy,Q is heat transfer +l=5 // length in m +b=7 // breadth in m +th=0.32 // thickness in m +k=0.71 // W/m*K +t1=6 //degree celsius +t2=21 //degree celsius +T1=t1+273; // K +T2=t2+273; // K +Tr=27 //degree celsius +Ts=2 //degree celsius +tr=Tr+273; +ts=Ts+273; +Q=k*l*b*(T2-T1)/th; +Sgen=(Q/T1)-(Q/T2); +Sgent=(Q/ts)-(Q/tr); +printf("rate of heat transfer through wall = %.2f W \n rate of entropy generation in wall = %.3f W/K \n rate of total entropy generation = %.3f W/K",Q,Sgen,Sgent); +// end \ No newline at end of file diff --git a/555/CH7/EX7.2/2.sce b/555/CH7/EX7.2/2.sce new file mode 100644 index 000000000..f2fcf4132 --- /dev/null +++ b/555/CH7/EX7.2/2.sce @@ -0,0 +1,28 @@ +// Implementation of example 7.2 +// Basic and Applied Thermodynamics by P.K.Nag + +clc +clear + +// T for temperature,m for mass,S for entropy,dS is change in entropy +t1=273 // K +t2=373 // K +m=1 // kg +c=4.187 +// (a) +dSw=m*c*log(t2/t1); +// reservoir's temperature remains constant so dS=Q/T +Q=m*c*(t2-t1); +dSr=-(Q/t2); +dSu=dSw+dSr; +printf("entropy change of universe = %.3f kJ/K \n",dSu); +// (b) +// now water is heated in stages from two reservoirs.. +t3=323 // K +dSw=m*c*log(t3/t1)+m*c*log(t2/t3); +dSr1=-[m*c*(t3-t1)/t3]; +dSr2=-[m*c*(t2-t3)/t2]; +dSu2=dSw+dSr1+dSr2; +printf("entropy change of universe in 2nd case = %.3f kJ/K \n",dSu2); +// the entropy change of universe would be less & less if water is heated in more & more stages...it will be zero if water is heated reversibly... +// end \ No newline at end of file diff --git a/555/CH7/EX7.3/3.sce b/555/CH7/EX7.3/3.sce new file mode 100644 index 000000000..e1a470ec0 --- /dev/null +++ b/555/CH7/EX7.3/3.sce @@ -0,0 +1,35 @@ +// Implementation of example 7.3 +// Basic and Applied Thermodynamics by P.K.Nag + +clc +clear + +m = 1; //mass of ice in kg +Lf = 333.3; //latent heat of fusion of ice in kJ/kg +T2 = 0; //degree C +T2 = T2 + 273; //K +T1 = -5; //degree C +T1 = T1 + 273; //K +Ta = 20; //degree C +Ta = Ta + 273; //K +Cp_ice = 2.093; //specific heat for ice in kJ/kg K +Cp_water = 4.187; //specific heat for water in kJ/kg K + +//(a) +Q = m*Cp_ice*(T2-T1) + m*Lf + m*Cp_water*(Ta-T2); //kJ +dS_atm = -Q/Ta; //kJ/K +//change in entropy of system when temperature changes from -5 to 0 degree C +dS1_sys = m*Cp_ice*log(T2/T1); //kJ/K +//change in entropy of system when ice melts at 0 degree C +dS2_sys = m*Lf/T2; +//change in entropy of when temperature of water changes from 0 to 20 degree C +dS3_sys = m*Cp_water*log(Ta/T2); //kJ/K +dS_sys = dS1_sys + dS2_sys + dS3_sys; +dS_univ = dS_atm + dS_sys; +printf("Entropy increase of the universe = %f kJ/K\n\n",dS_univ); + + +//(b) +Wmin = dS_sys*Ta - Q; +printf("Minimum amount of work necessary to convert water back into ice, Wmin = %0.2f kJ",Wmin); +// end \ No newline at end of file diff --git a/555/CH7/EX7.6/6.sce b/555/CH7/EX7.6/6.sce new file mode 100644 index 000000000..b63796099 --- /dev/null +++ b/555/CH7/EX7.6/6.sce @@ -0,0 +1,22 @@ +// Implementation of example 7.6 +// Basic and Applied Thermodynamics by P.K.Nag + +clc +clear + +T1 = 200; //K +T2 = 100; //K +function Cv = f(T) + Cv = 0.042*T^2; +endfunction + +Q1 = intg(T1,T2,f); + +function S = g(T) + S = f(T)/T; +endfunction + +dS_sys = intg(T1,T2,g); +Wmax = dS_sys*T2 + abs(Q1); +printf("Maximum amount of work that can be recovered as system is cooled down to temperature of reservoir, Wmax = %d J",Wmax); +//end \ No newline at end of file diff --git a/555/CH7/EX7.7/7.sce b/555/CH7/EX7.7/7.sce new file mode 100644 index 000000000..7b30d6bf6 --- /dev/null +++ b/555/CH7/EX7.7/7.sce @@ -0,0 +1,20 @@ +// Implementation of example 7.5 +// Basic and Applied Thermodynamics by P.K.Nag + +clc +clear + +// T for temperature,dS is change in entropy,p for pressure,V is volume +n=1.3 +p1=500 // kPa +V1=0.2 // m^3 +V2=0.05 // m^3 +// the fluid is undergoing reversible adiabatic compression according to the law p*(V^1.3)=constant +p2=p1*(V1/V2)^1.3; +dH=[n*(p2*V2-p1*V1)]/(n-1); +dU=dH-(p2*V2-p1*V1); +dS=0; +Q12=0; +W12=-dU; +printf("change in enthalpy = %.2f kJ \n change in entropy = %.2f \n change in internal energy = %.2f kJ \n heat transfer = %.2f \n work transfer = %.2f kJ",dH,dS,dU,Q12,W12); +// end \ No newline at end of file diff --git a/555/CH7/EX7.8/8.sce b/555/CH7/EX7.8/8.sce new file mode 100644 index 000000000..45abb4d0a --- /dev/null +++ b/555/CH7/EX7.8/8.sce @@ -0,0 +1,25 @@ +// Implementation of example 7.8 +// Basic and Applied Thermodynamics by P.K.Nag + +clc +clear + +Pa = 130; //kPa +Pb = 100; //kPa +Ta = 50; //degree C +Ta = Ta + 273; //K +Tb = 13; //degree C +Tb = Tb + 273; //K +Cp = 1.005; //kJ/kg K +dS_sys = Cp * log(Tb/Ta) - 0.287 * log(Pb/Pa); +dS_surr = 0; +dS_univ = dS_sys + dS_surr; +printf("dS_univ = %f kJ/kg K\n\n",dS_univ); + +if dS_univ<0 then + printf("Flow must be from B to A since entropy cannot be negative\n"); +elseif dS_univ>0 then + printf("Flow must be from A to B as entropy change is positive\n"); +else + printf("Flow will not occur\n"); +end \ No newline at end of file diff --git a/555/CH7/EX7.9/9.sce b/555/CH7/EX7.9/9.sce new file mode 100644 index 000000000..8b5575585 --- /dev/null +++ b/555/CH7/EX7.9/9.sce @@ -0,0 +1,26 @@ +// Implementation of example 7.9 +// Basic and Applied Thermodynamics by P.K.Nag + +clc +clear + +//Mass flow rate of air entering the device m1, Pressure p1, Temperature T1 +//Mass flow rate of air exiting through stream1 m2 and stream2 m3 + +m1 = 2;//kg/s +p1 = 4;//bar +T1 = 300;//K +p2 = 1;//bar +p3 = 1;//bar +T2 = 330;//K +T3 = 270;//K +cp = 1.005;//kJ/kg K +R = 0.287;//KJ/Kg K +m2 = m1/2; +m3 = m2; +//s21 = s2 - s1 +s21 = cp*log(T2/T1)-R*log(p2/p1); +s31 = cp*log(T3/T1)-R*log(p3/p1); +Sgen = m2*s21 + m3*s31; +printf('Sgen = %0.3f kW/K \nSince Sgen > 0, the device is possible',Sgen); +//end \ No newline at end of file -- cgit