kill(all)$

maxima:introduction : θ method ' distillation ', part 2,version 1.0
peter.vlasschaert@gmail.com,23/10/2020

see: website
→ maxima:introduction : θ method ' distillation , part 1,version 1.0
rem: i → component , nc =number of components
         j → stage
rem:co = corrected
        ca = calculated

load packages , option .
===================

load(lrats),ratprint:false$

1)  definition :theta 
===============
co =(co)rrected
ca = (ca)lculated , 'tridiagonale system : equations'

→ def :theta equality  , (part1,p4)

p1a:b[i,co]/d[i,co] = θ*b[i,ca]/d[i,ca];

2) definition :vapor :  v[i,j]
====================

p1b:v[i,j] = V[j]*y[i,j];

3) definition :liquid :   l[i,j]
====================

p1c:l[i,j] =L[j]*x[i,j];

→ constraint :

p2a:sum(x[i,j],i,1,nc)=1;
p2b:sum(y[i,j],i,1,nc)=1;

result : use of p2a,p2b

p3a:sum(p1c,i,1,nc);

p3a1:lratsubst([p2a],p3a);

p3b:sum(p1b,i,1,nc);

p3b1:lratsubst([p2b],p3b);

4) new definition : mole fraction x[i,j],y[i,j]
===============================]
domain : 0 ≤ x[i,j] ≤ 1,0 ≤ y[i,j] ≤ 1,

p4a:solve(p1c,x[i,j])[1];

p4b:solve(p1b,y[i,j])[1];

rem :range j=1(=top)....j=Nf....j=N+1(reboiler)

problem :corrected(=co),component flow rates , two
undetermined  multipliers :β1[j],β2[j]

?  relation between :{β1[j],β2[j]}  & θ

→ given:

p5a:(l[i,j])[co] = β1[j]*(l[i,j]/d[i])[ca]*d[i,co];    /*liquid*/
p5a1: (d[i])[ca] = d[i,ca];
p5b:(v[i,j])[co] = β2[j]*(v[i,j]/d[i])[ca]*d[i,co]; /*vapor*/

→ constraint ,see {p3a1,,p3b1} ,ca

p6a:sum((l[i,j])[ca]=(L[j])[ca]/nc,i,1,nc);
p6b:sum((v[i,j])[ca]=(V[j])[ca]/nc,i,1,nc);

→ 1e) step,sum over i,{p5a,p5b}

p7a1:reverse(sum(p5a,i,1,nc));
p7a2:reverse(sum(p5b,i,1,nc));

→ 2e) step,sum identity {p3a1,p3b1}[]

p7ba1:[l[i,j]=(l[i,j])[co],L[j] = (L[j])[co]];
p7ba2:[v[i,j]=(v[i,j])[co],V[j] = (V[j])[co]];
p7ba:append(p7ba1,p7ba2);

p7b1:lratsubst(p7ba,p3a1);
p7b2:lratsubst(p7ba,p3b1);

→ 3e) step,use 2e  into 1e

p7c1:lratsubst([p7b1],p7a1);
p7c2:lratsubst([p7b2],p7a2);

→ 4e) step,find {β1[j],β2[j]} 

p7d1:solve(p7c1,β1[j])[1];
p7d2:solve(p7c2,β2[j])[1];

→ 5e) step,use :p5a,p5b (given)

p7f1:p5a;
p7f2:p5b;

→ 6e) step,subst p7d1,2,p7f1,2

p7g1:lratsubst([p7d1],p7f1);
p7g2:lratsubst([p7d2],p7f2);

p7g1a:p7g1/(L[j])[co];
p7g1b:p7g2/(V[j])[co];

→7e) step, use p4a,p4b with [co]

result : corrected mole-fraction x,y

p7h1:(x[i,j])[co] = rhs(p7g1a);
p7h2:(y[i,j])[co] = rhs(p7g1b);

--------------------------------------------------------------------------------------------------------------------