kill(all)$

maxima : principle balance ,conservation, momentum 'version 1.0'
peter.vlasschaert@gmail.com,19/08/2021

load :packages,option
----------------------

load(lrats)$ratprint:false$

flow : u : x-direction
          v : y-direction
         w : z-direction

definition : balance (see:fig 1)
=======================

p1: IN=ACCUM +OUT;

a)  Mass conservation (Kg/s,mol/s,........).
---------------------------------------------------------

p2a:ρ=Kg/m^3;  /*density*/
p2b:A=m^2;       /*Area*/
p2c:ve= m/s;     /*velocity*/
p2d:deb=m^3/s /*debiet*/;

p2:[p2a,p2b,p2c,p2d];

p22a:makelist(rhs(p2[i])=lhs(p2[i]),i,1,length(p2));

p3a:[Kg/s] =[Kg/m^3,m^3/s];
p3a1:part(p3a,2,1);
p3a2:part(p3a,2,2);
p3a3:lhs(p3a)=makelist(subst(p22a,part(p3a,2,i)),i,1,length(rhs(p3a)));
p3b:[Kg/s] =[Kg/m^3,m/s,m^2];
p3b3:lhs(p3b)=makelist(subst(p22a,part(p3b,2,i)),i,1,length(rhs(p3b)));

→ symbole (use :p2)

p3aa:lhs(p3a) =product(rhs(p3a3)[i],i,1,length(rhs(p3a)));

p3bb:lhs(p3b) =product(rhs(p3b3)[i],i,1,length(rhs(p3b)));

b)  Momentum balance(Kg/s*ve,mol/s*ve,........)
-----------------------------------------------------------------
force = Kg*m/s^2

definition : Force
=============

p4: force = Kg*m/s^2;

p4a:[Kg/s*ve]=append(rhs(p3a),[m/s]);

p4a1:lhs(p4a)= product(rhs(p4a)[i],i,1,length(rhs(p4a)));

p4b:lhs(p4a)=append(rhs(p3b),[m/s]);

p4b1:lhs(p4a)= product(rhs(p4b)[i],i,1,length(rhs(p4b)));

→ symbole (use :p2)

p4a3:lhs(p4a)=makelist(subst(p22a,part(p4a,2,i)),i,1,length(rhs(p4a)));

p4a31:lhs(p4a)=product(rhs(p4a3)[i],i,1,length(rhs(p4a)));

p4b3:lhs(p4a)=makelist(subst(p22a,part(p4b,2,i)),i,1,length(rhs(p4b)));

p4b31:lhs(p4b)=product(rhs(p4b3)[i],i,1,length(rhs(p4b)));

flow x-diction :ve^2=u*u = u*v

flow : x-direction ( ACCUM = 0)
========================

balance:IN=ACCUM +OUT, infintesimale volume : dx*dy*dz, x -direction flow.

p1a:subst([ACCUM=0],p1);

A in : red  , A out : green

mass balance : conservation 
======================
?  m[x], m[x+dx]

→ IN

p5a:lhs(p1a) =m[x];

→ use p3bb

p5a1:rhs(p5a)=rhs(p3bb);

p5a2:lratsubst([p5a1],p5a);

→OUT

p5b:rhs(p1a)=m[x+dx];

→ use p3bb

p5b1:rhs(p5b)=m[x]+'diff(m[x],x)*dx;

p5b2:lhs(p5b1)=lratsubst([p5a1],rhs(p5b1));

p5b3:subst([p5b2],p5b);

→ combination : IN,OUT (use :p1a)

p5c:[p5a2,p5b3];

p5c1::lhs(p1a)-rhs(p1a)=0;

p5c2:subst(p5c,p5c1);

depends(ve,[x]);

ve(x)=u

p5c3:(ev(p5c2,nouns))*(-1);

rem : A = dy*dz

p5c4: subst([A=dy*dz],p5c3);

p5c4a:lhs(p5c4);

rem : dV=dx*dy*dz ≠0 ,ρ≠0

p5c5:ratcoeff(p5c4a,diff(ve,x));;

p5d:p5c4/p5c5;

result

→ conservation law (= flow incompressible, ρ=constant)

→ (1dimensional),i=1

x-direction :ve = u

depends(u,[x]);

p5d1:subst([ve=u],p5d);

→(2-dimensional),i=2

x-direction :ve = u, A= dy*dz  ≠ 0
y-direction :ve = v ,A = dx*dz ≠ 0

depends(v,[y]);

p5d2:subst([x=y,u=v],lhs(p5d1));

p5d3:lhs(p5d1)+p5d2 = 0;

→(3-dimensional),i=3

x-direction :ve = u 
y-direction :ve = v 
z-direction :ve = w ,A=dx*dy ≠ 0

p5d4:'diff(u,x)+'diff(v,y)+'diff(w,z)=0;

==============================
sum(IINi) = sum(INi), i=1,2,3
==============================