Thermo Class Documentation

Tore Haug-Warberg

Bjørn Tore Løvfall

Author address:

Department of Chemical Engineering, Norwegian University of Science and Technology, N-7491 Trondheim

E-mail address: tore.haug-warberg@chemeng.ntnu.no
URL: http://www.nt.ntnu.no/∼haugwarb

Abstract.

Contents

Part 1. Model description 1 Part 2. MATLAB code 5 Part 3. Documentation 9 Chapter 1. Root Surface anonymous 10 Chapter 2. Patch Helmholtz anonymous 11 Chapter 3. Patch StandardState anonymous 12 Chapter 4. Chain EquationOfState anonymous 13 Chapter 5. Chain EquationOfState anonymous 14 Chapter 6. Patch ModTVN sw12polar 15 Chapter 7. Patch ModTVN_ideal idealgas 18 Chapter 8. Patch MuT_cp dippr 20 Chapter 9. Patch MuT_hs h0 22 Chapter 10. Chain MuT_hs s0 23

Part 1

Model description

<thermo class="Surface"
tag="IST"
fun="anonymous"
cid="0"
file="misc.xml"
dir="d:/thextron/ruby"
did="8c44fbd1"
keys="">
  <push class="Helmholtz"
  tag="fl"
  fun="anonymous"
  cid="0"
  file="misc.xml"
  dir="d:/thextron/ruby"
  did="89d7503e"
  keys="">
     <push class="StandardState"
     tag="fl"
     fun="anonymous"
     cid="0"
     file="misc.xml"
     dir="d:/thextron/ruby"
     did="e99a4941"
     keys="">
       <push class="MuT_cp"
       tag="ig"
       fun="dippr"
       cid="0"
       file="DIPPR-1996.xml"
       dir="d:/thextron/ruby"
       did="e13ca2af"
       keys="c,tmax,tmin,t0">
         <push class="MuT_hs"
         tag="ig"
         fun="h0"
         cid="0"
         file="DIPPR-1996.xml"
         dir="d:/thextron/ruby"
         did="77d2184d"
         keys="h0">
           <chain class="MuT_hs"
           tag="ig"
           fun="s0"
           cid="0"
           file="DIPPR-1996.xml"
           dir="d:/thextron/ruby"
           did="29e98241"
           keys="s0">
              <mixture class="Mixture">
                <push class="Component"

       cmp="carbon dioxide"
       rxp="/^(carbon(.?)dioxide|co2)$/i"/>
     </mixture>
  </chain>
</push>
</push>
<chain class="EquationOfState"
tag="fl"
fun="anonymous"
cid="0"
file="misc.xml"
dir="d:/thextron/ruby"
did="ca74804a"
keys="">
<push class="ModTVN_ideal"
tag="fl"
fun="idealgas"
cid="0"
file="misc.xml"
dir="d:/thextron/ruby"
did="83897889"
keys="p0,x0,rgas">
  <mixture class="Mixture">
     <push class="Component"
     cmp="carbon dioxide"
     rxp="/^(carbon(.?)dioxide|co2)$/i"/>
  </mixture>
</push>
<chain class="EquationOfState"
tag="fl"
fun="anonymous"
cid="0"
file="misc.xml"
dir="d:/thextron/ruby"
did="ca74804a"
keys="">
  <push class="ModTVN"
  tag="fl"
  fun="sw12polar"
  cid="0"
  file="Span-Wagner-2003.xml"
  dir="d:/thextron/ruby"
  did="8dfb597a"
  keys="t1,a1,t2,a2,tc,rhoc,p2,d1,rgas,d2">
     <mixture class="Mixture">
       <push class="Component"
       cmp="carbon dioxide"
       rxp="/^(carbon(.?)dioxide|co2)$/i"/>
     </mixture>
  </push>

4

</chain> </chain> </push> </push> </thermo>

Part 2

MATLAB code

function [S] = Surface_anonymous_23837736(x)
[S] = Helmholtz_anonymous_23829684(x);

function [S] = Helmholtz_anonymous_23829684(x)
[S] = StandardState_anonymous_23817264(x);

function [S] = StandardState_anonymous_23817264(x)
[S]       = EquationOfState_anonymous_25957024(x);
i         = [3];
[S_1]     = MuT_cp_dippr_23808960(x(1));
S.g(1)   = S.g(1) + S_1.dmudT'*x(i);
S.g(i)   = S.g(i) + S_1.mu;
S.H(1,1) = S.H(1,1) + S_1.d2mudTdT'*x(i);
S.H(i,1) = S.H(i,1) + S_1.dmudT;
S.H(1,i) = S.H(i,1)';

function [S] = EquationOfState_anonymous_25957024(x)
[S]   = EquationOfState_anonymous_25872664(x);
[S_1] = ModTVN_ideal_idealgas_25955956(x);
S.g   = S.g + S_1.g;
S.H   = S.H + S_1.H;

function [S] = EquationOfState_anonymous_25872664(x)
[S] = ModTVN_sw12polar_25871596(x);

function [S] = ModTVN_sw12polar_25871596(x)
R                 = 8.314511984;
T_c               = 304.1282;
rho_c             = 10624.90627;
tau               = T_c/x(1);
delta             = x(3)/x(2)/rho_c;
N                 = x(3);
a_1               = [0.89875108;-2.1281985;-0.06819032;0.076355306;0.00022053253];
t_1               = [0.25;1.25;1.5;0.25;0.875];
d_1               = [1.0;1.0;1.0;3.0;7.0];
a_2               = [0.41541823;0.71335657;0.00030354234;-0.36643143;-
0.0014407781;-0.089166707;-0.023699887];
t_2               = [2.375;2.0;2.125;3.5;6.5;4.75;12.5];
d_2               = [1.0;2.0;5.0;1.0;1.0;4.0;2.0];

p_2               = [1.0;1.0;1.0;2.0;2.0;2.0;3.0];
u_2               = d_2 - p_2.*delta.^p_2;
v_2               = exp(-delta.^p_2);
phir              = a_1'*(delta.^d_1.*tau.^t_1) + a_2'*(v_2.*delta.^d_2.*tau.^t_2);
phi_taur         = a_1'*(delta.^d_1.*t_1.*tau.^(t_1 - 1)) + a_2'*(v_2.*delta.^d_2.*t_2.*tau.^(t_2 -
1));
phi_deltar       = a_1'*(d_1.*delta.^(d_1 - 1).*tau.^t_1) + a_2'*(v_2.*delta.^(d_2 -
1).*u_2.*tau.^t_2);
phi_tautaur      = a_1'*(delta.^d_1.*t_1.*(t_1 - 1).*tau.^(t_1 - 2)) + a_2'*(v_2.*delta.^d_2.*t_2.*(t_2 -
1).*tau.^(t_2 - 2));
phi_deltadeltar = a_1'*(d_1.*(d_1 - 1).*delta.^(d_1 - 2).*tau.^t_1) + a_2'*(v_2.*delta.^(d_2 -
2).*(u_2.*(u_2 - 1) - p_2.^2.*delta.^p_2).*tau.^t_2);
phi_deltataur   = a_1'*(d_1.*delta.^(d_1 - 1).*t_1.*tau.^(t_1 - 1)) + a_2'*(v_2.*delta.^(d_2 -
1).*t_2.*u_2.*tau.^(t_2 - 1));
g_1               = N*R*(phir - tau*phi_taur);
g_2               = -R*T_c*rho_c*delta^2*phi_deltar/tau;
g_i               = R*T_c*(phir + delta*phi_deltar)/tau;
H_11              = N*R*tau^3*phi_tautaur/T_c;
H_21              = -R*delta^2*rho_c*(phi_deltar - tau*phi_deltataur);
H_i1              = R*(phir - tau*phi_taur + delta*(phi_deltar - tau*phi_deltataur));
H_22              = R*T_c*rho_c^2*delta^3*(delta*phi_deltadeltar + 2*phi_deltar)/(tau*N);
H_i2              = -R*T_c*rho_c*delta^2*(delta*phi_deltadeltar + 2*phi_deltar)/(tau*N);
H_ii              = R*T_c*delta*(delta*phi_deltadeltar + 2*phi_deltar)/(tau*N);
S.g               = [g_1;g_2;g_i];
S.H               = [H_11,H_21,H_i1;H_21,H_22,H_i2;H_i1,H_i2,H_ii];

function [S] = ModTVN_ideal_idealgas_25955956(x)
R      = 8.314511984;
pcirc = [101325.0];
xcirc = [1.0];
T      = x(1);
V      = x(2);
i      = [3];
n      = x(i);
NR     = sum(n)*R;
NRT   = NR*T;
e      = [1];
p      = R*log(R*T*(n./pcirc)/V);
g_1   = n'*p;
g_2   = -NRT/V;
g_i   = T*p;
H_11  = NR/T;
H_21  = -NR/V;
H_i1  = p + R*e;
H_22  = NRT/V^2;
H_i2  = -R*(T/V)*e;
H_ii  = R*T*diag(e./n);
S.g   = [g_1;g_2;g_i];

S.H   = [H_11,H_21',H_i1';H_21,H_22,H_i2';H_i1,H_i2,H_ii];

function [S] = MuT_cp_dippr_23808960(T)
t_0         = [298.15];
t_min       = [50.0];
t_max       = [5000.0];
C           = [29.37,34.54,1428.0,26.4,588.0];
c_1         = C(:,1);
c_2         = C(:,2);
c_3         = C(:,3);
c_4         = C(:,4);
c_5         = C(:,5);
c_p         = c_1 + c_2.*c_3.^2./(T^2*sinh(c_3/T).^2) + c_4.*c_5.^2./(T^2*cosh(c_5/T).^2);
h           = c_1*T + c_2.*c_3.*cosh(c_3/T)./sinh(c_3/T) - c_4.*c_5.*sinh(c_5/T)./cosh(c_5/T) -
c_1.*t_0 - c_2.*c_3.*cosh(c_3./t_0)./sinh(c_3./t_0) + c_4.*c_5.*sinh(c_5./t_0)./cosh(c_5./t_0);
s           = c_1*log(T) + c_4.*(log(cosh(c_5/T)) - c_5.*sinh(c_5/T)./cosh(c_5/T)/T) + c_2.*(c_3.*cosh(c_3/T)./sinh(c_3/T)/T -
log(sinh(c_3/T))) - c_1.*log(t_0) - c_4.*(log(cosh(c_5./t_0)) - c_5.*sinh(c_5./t_0)./cosh(c_5./t_0)./t_0) -
c_2.*(c_3.*cosh(c_3./t_0)./sinh(c_3./t_0)./t_0 - log(sinh(c_3./t_0)));
S.mu        = h - T*s;
S.dmudT     = -s;
S.d2mudTdT = -(c_p/T);
i           = [1];
[S_1]       = MuT_hs_h0_23796204(T);
S.mu(i)     = S.mu(i) + S_1.mu;
S.dmudT(i) = S.dmudT(i) + S_1.dmudT;

function [S] = MuT_hs_h0_23796204(T)
hcirc   = [-393510.0];
[S]      = MuT_hs_s0_23790012(T);
S.mu     = S.mu + hcirc;
S.dmudT = S.dmudT + [0];

function [S] = MuT_hs_s0_23790012(T)
scirc   = [213.677];
S.mu     = -(T*scirc);
S.dmudT = -scirc;

Part 3

Documentation

CHAPTER 1 Root Surface anonymous

Surface-anonymous-23837736 : x ↷ S

(1.1) [S] = Helmholtz_anonymous_23829684(x)

CHAPTER 2 Patch Helmholtz anonymous

Helmholtz-anonymous-23829684 : x ↷ S

(2.1) [S] = StandardState_anonymous_23817264(x)

CHAPTER 3 Patch StandardState anonymous

StandardState-anonymous-23817264 : x ↷ S

(3.1) [S] = EquationOfState_anonymous_25957024(x)

(3.2)  i = (3)

(3.3) [S_{1}] = MuT_cp_dippr_23808960(x_{[1]})

S×g_{[1]} = S×g_{[1]}

+ S_{1}×dmudT^{T}x_{[i]} (3.4)

S×g_{[i]} = S×g_{[i]}

+ S_{1}×mu (3.5)

S×H_{[1,1]} = S×H_{[1,1]}

+ S_{1}×d2mudT dT^{T}x_{[i]} (3.6)

S×H_{[i,1]} = S×H_{[i,1]}

+ S_{1}×dmudT (3.7)

(3.8)  S×H_{[1,i]} = S×H_{[i,1]}^{T}

CHAPTER 4 Chain EquationOfState anonymous

EquationOfState-anonymous-25957024 : x ↷ S

(4.1) [S] = EquationOfState_anonymous_25872664(x) (4.2) [S_{1}] = ModTVN_ideal_idealgas_25955956(x)

S×g = S×g

+ S_{1}×g (4.3)

S×H = S×H

+ S_{1}×H (4.4)

CHAPTER 5 Chain EquationOfState anonymous

EquationOfState-anonymous-25872664 : x ↷ S

(5.1) [S] = ModTVN_sw12polar_25871596(x)

CHAPTER 6 Patch ModTVN sw12polar

ModTVN-sw12polar-25871596 : x ↷ S

(6.1)  R = 8.314511984 kg m^{2} ; K mol s^{2}
(6.2)  T_{c} = \frac{304.1282 K}{nil}
(6.3)  ρ_{c} = \begin{matrix}10624.90627 & mol \\ m & ^{3} \end{matrix}
(6.4)  τ = \frac{T_{c}}{x_{[1]}}
(6.5)  δ = \frac{\begin{matrix}x & _{[3]} \\ x & _{[2]} \end{matrix}}{ρ_{c}}
(6.6)  N = x_{[3]}
(6.7)  a_{1} = ( \frac{0.89875108}{nil} \frac{−2.1281985}{nil} \frac{−0.06819032}{nil} \frac{0.076355306}{nil} \frac{0.00022053253}{nil} )
(6.8)  t_{1} = ( \frac{0.25}{nil} \frac{1.25}{nil} \frac{1.5}{nil} \frac{0.25}{nil} \frac{0.875}{nil} )
(6.9)  d_{1} = (\frac{1.0}{nil} \frac{1.0}{nil} \frac{1.0}{nil} \frac{3.0}{nil} \frac{7.0}{nil} )

(6.10)  a_{2} = ( \frac{0.41541823}{nil} \frac{0.71335657}{nil} \frac{0.00030354234}{nil} \frac{−0.36643143}{nil} \frac{−0.0014407781}{nil} \frac{−0.089166707}{nil} \frac{−0.023699887}{nil} )

(6.11)  t_{2} = (\frac{2.375}{nil} \frac{2.0}{nil} \frac{2.125}{nil} \frac{3.5}{nil} \frac{6.5}{nil} \frac{4.75}{nil} \frac{12.5}{nil} )

(6.12)  d_{2} = (\frac{1.0}{nil} \frac{2.0}{nil} \frac{5.0}{nil} \frac{1.0}{nil} \frac{1.0}{nil} \frac{4.0}{nil} \frac{2.0}{nil} )

(6.13)  p_{2} = (\frac{1.0}{nil} \frac{1.0}{nil} \frac{1.0}{nil} \frac{2.0}{nil} \frac{2.0}{nil} \frac{2.0}{nil} \frac{3.0}{nil} )

u_{2} = d_{2}

− p_{2} · δ^{·p_{2}} (6.14)

(6.15)  v_{2} = exp (−δ^{·p_{2}})
ϕ^{r} = a_{1}^{T} (δ^{·d_{1}} · τ^{·t_{1}})

+ a_{2}^{T} (v_{2} · δ^{·d_{2}} · τ^{·t_{2}}) (6.16)

ϕ_{τ}^{r} = a_{1}^{T} (δ^{·d_{1}} · t_{1} · τ^{·t_{1}−1})

+ a_{2}^{T} (v_{2} · δ^{·d_{2}} · t_{2} · τ^{·t_{2}−1}) (6.17)

ϕ_{δ}^{r} = a_{1}^{T} (d_{1} · δ^{·d_{1}−1} · τ^{·t_{1}})

+ a_{2}^{T} (v_{2} · δ^{·d_{2}−1} · u_{2} · τ^{·t_{2}}) (6.18)

ϕ_{ττ}^{r} = a_{1}^{T} (δ^{·d_{1}} · t_{1} · (t_{1} − 1) · τ^{·t_{1}−2})

+ a_{2}^{T} (v_{2} · δ^{·d_{2}} · t_{2} · (t_{2} − 1) · τ^{·t_{2}−2}) (6.19)

ϕ_{δδ}^{r} = a_{1}^{T} (d_{1} · (d_{1} − 1) · δ^{·d_{1}−2} · τ^{·t_{1}})

+ a_{2}^{T} (v_{2} · δ^{·d_{2}−2} · (u_{2} · (u_{2} − 1) − p_{2}^{·2} · δ^{·p_{2}}) · τ^{·t_{2}}) (6.20)

ϕ_{δτ}^{r} = a_{1}^{T} (d_{1} · δ^{·d_{1}−1} · t_{1} · τ^{·t_{1}−1})

+ a_{2}^{T} (v_{2} · δ^{·d_{2}−1} · t_{2} · u_{2} · τ^{·t_{2}−1}) (6.21)

(6.22)  g_{1} = NR (ϕ^{r} − τϕ_{τ}^{r})
(6.23)  g_{2} = \frac{−RT_{c}ρ_{c}δ^{2}ϕ_{δ}^{r}}{τ}

(6.24)  g_{i} = \frac{RT_{c} (ϕ^{r} + δϕ_{δ}^{r})}{τ}

(6.25)  H_{1,1} = \frac{NRτ^{3}ϕ_{ττ}^{r}}{T_{c}}
(6.26)  H_{2,1} = −Rδ^{2}ρ_{c} (ϕ_{δ}^{r} − τϕ_{δτ}^{r})
(6.27)  H_{i,1} = R (ϕ^{r} − τϕ_{τ}^{r} + δ (ϕ_{δ}^{r} − τϕ_{δτ}^{r}))
(6.28)  H_{2,2} = \frac{RT_{c}ρ_{c}^{2}δ^{3} (δϕ_{δδ}^{r} + 2ϕ_{δ}^{r})}{τN}

(6.29)  H_{i,2} = \frac{−RT_{c}ρ_{c}δ^{2} (δϕ_{δδ}^{r} + 2ϕ_{δ}^{r})}{τN}

(6.30)  H_{i,i} = \frac{RT_{c}δ (δϕ_{δδ}^{r} + 2ϕ_{δ}^{r})}{τN}

(6.31)  S×g = (\begin{matrix}g_{1} \\ g_{2} \\ g_{i} \end{matrix})

(6.32)  S×H = (\begin{matrix}H_{1,1} & H_{2,1} & H_{i,1} \\ H_{2,1} & H_{2,2} & H_{i,2} \\ H_{i,1} & H_{i,2} & H_{i,i} \end{matrix})

CHAPTER 7 Patch ModTVN_ideal idealgas

ModTVN-ideal-idealgas-25955956 : x ↷ S

(7.1)  R = 8.314511984 kg m^{2} ; K mol s^{2}
(7.2)  p^{∘} = (\begin{matrix}101325.0 & kg \\ m & s & ^{2} \end{matrix})
(7.3)  x^{∘} = (\frac{1.0}{nil} )
(7.4)  T = x_{[1]}
(7.5)  V = x_{[2]}
(7.6)  i = (3)
(7.7)  n = x_{[i]}
(7.8)  NR = ∑_{i} (n)_{[i]} R
(7.9)  NRT = NRT
(7.10)  e = (1)
(7.11)  p = R ln (\frac{RT (n ÷ p^{∘})}{V})
(7.12)  g_{1} = n^{T}p
(7.13)  g_{2} = \frac{−NRT}{V}
(7.14)  g_{i} = T p
(7.15)  H_{1,1} = \frac{NR}{T}
(7.16)  H_{2,1} = \frac{−NR}{V}
H_{i,1} = p

+ Re (7.17)

(7.18)  H_{2,2} = \frac{NRT}{V^{2}}

(7.19)  H_{i,2} = −R (\frac{T}{V} ) e^{(7.20)  H_{i,i} = RT (e ÷ n)^{D}}^{(7.21)  S×g = (\begin{matrix}g_{1} \\ g_{2} \\ g_{i} \end{matrix})}^{(7.22)  S×H = (\begin{matrix}H_{1,1} & H_{2,1}^{T} & H_{i,1}^{T} \\ H_{2,1} & H_{2,2} & H_{i,2}^{T} \\ H_{i,1} & H_{i,2} & H_{i,i} \end{matrix})}

CHAPTER 8 Patch MuT_cp dippr

MuT-cp-dippr-23808960 : T ↷ S

(8.1)  t_{0} = (\frac{298.15 K}{nil})
(8.2)  t_{min} = (\frac{50.0 K}{nil})
(8.3)  t_{max} = (\frac{5000.0 K}{nil})
(8.4) C = ( 29.37 kg m^{2} ; K mol s^{2} 34.54 kg m^{2} ; K mol s^{2} \frac{1428.0 K}{nil} 26.4 kg m^{2} ; K mol s^{2} \frac{588.0 K}{nil})
(8.5)  c_{1} = C_{[⋆,1]}
(8.6)  c_{2} = C_{[⋆,2]}
(8.7)  c_{3} = C_{[⋆,3]}
(8.8)  c_{4} = C_{[⋆,4]}
(8.9)  c_{5} = C_{[⋆,5]}
c_{p} = c_{1}

+ c_{2} · c_{3}^{·2} ÷ (T^{2} sinh (\frac{c_{3}}{T} )^{·2})

+ c_{4} · c_{5}^{·2} ÷ (T^{2} cosh (\frac{c_{5}}{T} )^{·2}) (8.10)

h = c_{1}T

+ c_{2} · c_{3} · cosh (\frac{c_{3}}{T} ) ÷ sinh (\frac{c_{3}}{T} )

− c_{4} · c_{5} · sinh (\frac{c_{5}}{T} ) ÷ cosh (\frac{c_{5}}{T} )

− c_{1} · t_{0}

− c_{2} · c_{3} · cosh (c_{3} ÷ t_{0}) ÷ sinh (c_{3} ÷ t_{0})

(8.11) + c_{4} · c_{5} · sinh (c_{5} ÷ t_{0}) ÷ cosh (c_{5} ÷ t_{0})

s = c_{1} ln (T)

+ c_{4} · (ln (cosh (\frac{c_{5}}{T} )) − \frac{c_{5} · sinh (\frac{c_{5}}{T} ) ÷ cosh (\frac{c_{5}}{T} )}{T})

+ c_{2} · (\frac{c_{3} · cosh (\frac{c_{3}}{T} ) ÷ sinh (\frac{c_{3}}{T} )}{T} − ln (sinh (\frac{c_{3}}{T} )))

− c_{1} · ln (t_{0})

− c_{4} · (ln (cosh (c_{5} ÷ t_{0})) − c_{5} · sinh (c_{5} ÷ t_{0}) ÷ cosh (c_{5} ÷ t_{0}) ÷ t_{0})

(8.12) − c_{2} · (c_{3} · cosh (c_{3} ÷ t_{0}) ÷ sinh (c_{3} ÷ t_{0}) ÷ t_{0} − ln (sinh (c_{3} ÷ t_{0})))

S×mu = h

− T s (8.13)

(8.14)  S×dmudT = −s
(8.15)  S×d2mudT dT = − (\frac{c_{p}}{T} )
(8.16)  i = (1)

[S_{1}] = MuT_hs_h0_23796204(T) (8.17)

S×mu_{[i]} = S×mu_{[i]}

+ S_{1}×mu (8.18)

S×dmudT_{[i]} = S×dmudT_{[i]}

+ S_{1}×dmudT (8.19)

CHAPTER 9 Patch MuT_hs h0

MuT-hs-h0-23796204 : T ↷ S
(9.1)  h^{∘} = (\begin{matrix}−393510.0 & kg & m & ^{2} \\ mol & s & ^{2} \end{matrix} )

[S] = MuT_hs_s0_23790012(T) (9.2)

S×mu = S×mu

+ h^{∘} (9.3)

S×dmudT = S×dmudT

+ (0) (9.4)

CHAPTER 10 Chain MuT_hs s0

MuT-hs-s0-23790012 : T ↷ S

(10.1)  s^{∘} = (\begin{matrix}213.677 & kg & m & ^{2} \\ K & mol & s & ^{2} \end{matrix} )
(10.2)  S×mu = − (T s^{∘})
(10.3)  S×dmudT = −s^{∘}