kill(all)$

maxima :fvm : appendix ,double integration (time,cv) for time differential (part 1),version 1.0
peter.vlasschaert@gmail.com,27/11/2022

rem : cv =ΔV , (c)ontrol (v)olume.

load package ,option
--------------------------

load(lrats)$ ratprint:false$

double integration ( = time differential )
=============================

→  differential term 

q1:ρ*diff(T(t),t)*c;

→ list representation of term

q1a:args(q1);

find position : derivative
--------------------------------

part(q1a[2]);

args(part(q1a[2]));

makelist(atom(q1a[i]),i,1,3);

makelist(if atom(q1a[i]) = false then s:i, i,1,length(args(q1)));

makelist(if atom(args(q1)[i]) = false then s:i, i,1,length(args(q1)));

print (" s = ",s);

simp:false;

declare([ρ,c],constant);

find main :variable
-------------------------
find T

part(q1a[s],0);

part(q1a[s],1);

→ depend variable       :

m1:part(args(q1)[s],1,0);

→ independent variable :

m2:part(args(q1)[s],1,1);

→ order of differential (of T)

args(part(q1a[s]));

args(part(args(q1)[s]));

m3:last(%);

double integration: q1
-----------------------------
→ first       time : integration
→ second   CV  :  integration

show : representation differential = q1
-------------------------------------------------
use option :→ simp:false, "see above"

→ integration range t : aa →bb

qq:[aa,bb];

p1:'integrate('integrate(q1,t,qq[1],qq[2]),v,0,A*Δx);

rem : don't use  T[t] → T(t)

→ evaluation :p1

simp:true;

→ output : double integration:

p1a:ev(p1,nouns);

p2a:listofvars(p1a);

exclude : declare variable

use : {m1-> T,m2→t,m3->1},"see above"

we want replace :T(bb)-T(aa)

p3a:m1(m2);

time integration : t from aa → bb
----------------------------------------------

→ change variables : 

p4a:[ m1[p]^°,m1[p]];
p4b:makelist(m1(qq[i]),i,1,length(qq));

p4c:map("=",p4b,p4a);

→ final output  integration 

p4d:subst(p4c,p1a);

p4d1:factor(lratsubst([A*Δx=ΔV],p4d));

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

index of p is center cv ,[w],p,[e] {w,e} → interface (in,out)
w → west
e   → east

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

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