> restart;#'therm_eq1.mws'.24-06-05.

Chapter 1: Set of pre-written equations available. (REM: use D for Delta instead of E2_E1).

Basic definition of thermodynamic work

> eq1_1:=W=-Int(F[int],r);

`:=`(eq1_1, W = `+`(`-`(Int(F[int], r))))

Work of compression/expansion

> eq1_2:=W=-Int(p,V);

`:=`(eq1_2, W = `+`(`-`(Int(p, V))))

Useful work (not accounting the atmosferic one, at p0)

> eq1_3:=W[u]=W+p[0]*DV;

`:=`(eq1_3, W[u] = `+`(W, `*`(p[0], `*`(DV))))

Definition of energy and energy balance for a control mass

> eq1_4:=DE=W[Q=0];eq1_5:=DE=W+Q;

`:=`(eq1_4, DE = W[Q = 0])

`:=`(eq1_5, DE = `+`(W, Q))

Definition of stored mechanical energy without friction

> eq1_6:=DE[m]=(W+Int(p,V))[E[mdf]=0];

`:=`(eq1_6, DE[m] = (`+`(W, Int(p, V)))[E[mdf] = 0])

Definition of friction-dissipation energy and mechanical energy balance

> eq1_7:=E[mdf]=W+Int(p,V)-DE[m];eq1_8:=W=solve(eq1_7,W);

`:=`(eq1_7, E[mdf] = `+`(W, Int(p, V), `-`(DE[m])))

`:=`(eq1_8, W = `+`(E[mdf], `-`(Int(p, V)), DE[m]))

Definition of internal energy and internal energy equation

> eq1_9:=DU=DE-DE[m];eq1_10:=subs(DE[m]=DEm,eq1_5,eq1_8,DEm=DE[m],eq1_9);

`:=`(eq1_9, DU = `+`(DE, `-`(DE[m])))

`:=`(eq1_10, DU = `+`(E[mdf], `-`(Int(p, V)), Q))

Density and its equation of state in the ideal gas model and the ideal condensed model

> eq1_11:=rho=m/V;eq1_12:=rho=p/(R*T);eq1_13:=R=R[u]/M;eq1_14:=p*V=subs(eq1_11,solve(eq1_12,p)*V);eq1_15:=rho=rho[0];

`:=`(eq1_11, rho = `/`(`*`(m), `*`(V)))

`:=`(eq1_12, rho = `/`(`*`(p), `*`(R, `*`(T))))

`:=`(eq1_13, R = `/`(`*`(R[u]), `*`(M)))

`:=`(eq1_14, `*`(p, `*`(V)) = `*`(m, `*`(R, `*`(T))))

`:=`(eq1_15, rho = rho[0])

The energetic equation of state for perfec calorific substances (for condensed phases no distintion between c[v] and c[p])

> eq1_16:=DU=m*c[v]*DT;eq1_17:=DU=m*c*DT;

`:=`(eq1_16, DU = `*`(m, `*`(c[v], `*`(DT))))

`:=`(eq1_17, DU = `*`(m, `*`(c, `*`(DT))))

Reminder of Mayer's relation and definition of the isentropic exponent

> eq1_18:=c[p]-c[v]=R;eq1_19:=gamma=c[p]/c[v];

`:=`(eq1_18, `+`(c[p], `-`(c[v])) = R)

`:=`(eq1_19, gamma = `/`(`*`(c[p]), `*`(c[v])))

Adiabatic evolution of a perfect gas without friccion (isentropic evolution of a perfect gas). Can be deduced by eq1_2, eq1_4, eq1_13 and Q=0.

> eq1_BEMCQ0F0:=m*c[v]*dT=0-p*dV;eq1_20:=p[1]*V[1]^gamma=p[2]*V[2]^gamma;eq1_21:=T[1]*V[1]^(gamma-1)=T[2]*V[2]^(gamma-1);eq1_22:=T[2]/T[1]=(p[2]/p[1])^((gamma-1)/gamma);

`:=`(eq1_BEMCQ0F0, `*`(m, `*`(c[v], `*`(dT))) = `+`(`-`(`*`(p, `*`(dV)))))

`:=`(eq1_20, `*`(p[1], `*`(`^`(V[1], gamma))) = `*`(p[2], `*`(`^`(V[2], gamma))))

`:=`(eq1_21, `*`(T[1], `*`(`^`(V[1], `+`(gamma, `-`(1))))) = `*`(T[2], `*`(`^`(V[2], `+`(gamma, `-`(1))))))

`:=`(eq1_22, `/`(`*`(T[2]), `*`(T[1])) = `^`(`/`(`*`(p[2]), `*`(p[1])), `/`(`*`(`+`(gamma, `-`(1))), `*`(gamma))))

Momentum equation for a piston (force balance) and its first integral (mechanical energy balance)

> eq1_23:=F=m[P]*diff(x(t),t,t);eq1_24:=Int(F,x=x1..x2)=m[P]*(diff(x(t),t)[x2]^2-diff(x(t),t)[x1]^2)/2;

`:=`(eq1_23, F = `*`(m[P], `*`(diff(x(t), `$`(t, 2)))))

`:=`(eq1_24, Int(F, x = x1 .. x2) = `+`(`*`(`/`(1, 2), `*`(m[P], `*`(`+`(`*`(`^`((diff(x(t), t))[x2], 2)), `-`(`*`(`^`((diff(x(t), t))[x1], 2)))))))))

Collection of all equations defined:

> eq1_all:=[seq(cat(eq1_,i),i=1..3)]:[seq(cat(eq1_,i),i=1..3)]=%;

[eq1_1, eq1_2, eq1_3] = [W = `+`(`-`(Int(F[int], r))), W = `+`(`-`(Int(p, V))), W[u] = `+`(W, `*`(p[0], `*`(DV)))]

WARNING. A list of all variables follows, to copy and paste to the save command (after Maple7 there is no saving all). CAUTION: After pasting all, I must MANUALLY delete system variables: like RealRange_...

> sort([anames()]);

[RealRange_fromineq, SolveTools, TypeTools, _addmultmp, `diff/diff`, eq1_1, eq1_10, eq1_11, eq1_12, eq1_13, eq1_14, eq1_15, eq1_16, eq1_17, eq1_18, eq1_19, eq1_2, eq1_20, eq1_21, eq1_22, eq1_23, eq1_2...
[RealRange_fromineq, SolveTools, TypeTools, _addmultmp, `diff/diff`, eq1_1, eq1_10, eq1_11, eq1_12, eq1_13, eq1_14, eq1_15, eq1_16, eq1_17, eq1_18, eq1_19, eq1_2, eq1_20, eq1_21, eq1_22, eq1_23, eq1_2...
[RealRange_fromineq, SolveTools, TypeTools, _addmultmp, `diff/diff`, eq1_1, eq1_10, eq1_11, eq1_12, eq1_13, eq1_14, eq1_15, eq1_16, eq1_17, eq1_18, eq1_19, eq1_2, eq1_20, eq1_21, eq1_22, eq1_23, eq1_2...
[RealRange_fromineq, SolveTools, TypeTools, _addmultmp, `diff/diff`, eq1_1, eq1_10, eq1_11, eq1_12, eq1_13, eq1_14, eq1_15, eq1_16, eq1_17, eq1_18, eq1_19, eq1_2, eq1_20, eq1_21, eq1_22, eq1_23, eq1_2...
[RealRange_fromineq, SolveTools, TypeTools, _addmultmp, `diff/diff`, eq1_1, eq1_10, eq1_11, eq1_12, eq1_13, eq1_14, eq1_15, eq1_16, eq1_17, eq1_18, eq1_19, eq1_2, eq1_20, eq1_21, eq1_22, eq1_23, eq1_2...
[RealRange_fromineq, SolveTools, TypeTools, _addmultmp, `diff/diff`, eq1_1, eq1_10, eq1_11, eq1_12, eq1_13, eq1_14, eq1_15, eq1_16, eq1_17, eq1_18, eq1_19, eq1_2, eq1_20, eq1_21, eq1_22, eq1_23, eq1_2...

> #save eq1_1, eq1_10, eq1_11, eq1_12,eq1_13, eq1_14, eq1_15, eq1_16, eq1_17, eq1_18, eq1_19, eq1_2, eq1_20, eq1_21, eq1_22, eq1_23,eq1_24, eq1_3, eq1_4, eq1_5, eq1_6, eq1_7, eq1_8, eq1_9, "../therm_eq1.m":

HOW TO USE IT?

Example: Find the density of water vapor a 100 ÂșC and 100 kPa.

Solution:

There is not a direct procedure rho(T1,p1,substance1,ideal_gas_model) like in EES.

Here you must use Maple subs(T=T1,p=p1,dat,eq1_12), where dat is a list of data, including substance data, previously found by reading an internal data table, in that way:

> restart:read"../therm_eq.m":read"../therm_proc.m":with(therm_proc):su1:="H2O";dat:=[T1=(100+273)*K_,p1=100e3*Pa_];Adat:=get_gas_data(su1);dat:=op(dat),Adat,Const,SI2,SI1:eq1_12;subs(T=T1,p=p1,dat,eq1_12);

`:=`(su1,

`:=`(dat, [T1 = `+`(`*`(373, `*`(K_))), p1 = `+`(`*`(0.100e6, `*`(Pa_)))])

`:=`(Adat, M = `+`(`/`(`*`(0.18e-1, `*`(kg_)), `*`(mol_))), T[b] = `+`(`*`(373.2, `*`(K_))), T[cr] = `+`(`*`(647.3, `*`(K_))), p[cr] = `+`(`*`(0.2212e8, `*`(Pa_))), c[p] = `+`(`/`(`*`(1900., `*`(J_)),...
`:=`(Adat, M = `+`(`/`(`*`(0.18e-1, `*`(kg_)), `*`(mol_))), T[b] = `+`(`*`(373.2, `*`(K_))), T[cr] = `+`(`*`(647.3, `*`(K_))), p[cr] = `+`(`*`(0.2212e8, `*`(Pa_))), c[p] = `+`(`/`(`*`(1900., `*`(J_)),...

rho = `/`(`*`(p), `*`(R, `*`(T)))

rho = `+`(`/`(`*`(.5804350811, `*`(kg_)), `*`(`^`(m_, 3))))

Discouraging? But Maple has the advantage that you may do symbolics, e.g.:

> eq1_12;eqnew:=p=solve(eq1_12,p);

rho = `/`(`*`(p), `*`(R, `*`(T)))

`:=`(eqnew, p = `*`(rho, `*`(R, `*`(T))))

>