kill(all)$

maxima:fvm:CDS sheme (convection-diffusion) use A(Pe) & B(Pe) follows A(abs(Pe)),version 1.0
peter.vlasschaert@gmail.com,17/12/2022

ref : 1
maxima :fvm : generalized relation convection-diffusion (Pe=Peclet) ,version1.0a

load packages
--------------------

load(lrats)$

How to use: max,abs,assume,sign
----------------------------------------------

abs(-2);

assume(p>0);

sign(p);

1-abs(p)/2;

forget(p>0);

sign(p);

assume(p<0);

1-abs(p)/2;

-1*max(-p,0);

sign(p);

forget(p<0);

p;

formula: ref1
-----------------

ref 1.p12d

p1:a[p]*Φ[p]=a[W]*Φ[W]+a[E]*Φ[E];

→ ref 1 :p13

p1a:[A(Pe(Δx(e)))=a[E]/D[e],B(Pe(Δx(w)))=a[W]/D[w]];

→ ref 1:{p17x,x=b,c,d}

p1b:B(Pe)=A(Pe)+Pe;
p1c:B(Pe)=A(-Pe);
p1d::A(Pe)=B(-Pe);

→ ref 1:{p18e,p19e},solve.

p1e:A(Pe)=A(abs(Pe))+max(0,-Pe);
p1ea:solve(p1e,part(rhs(p1e),1))[1];
p1f:B(Pe)=A(abs(Pe))+max(0,Pe);
p1fa:solve(p1f,part(rhs(p1e),1))[1];

definition :peclet cell number
---------------------------------------
simplified : reason "CDS",Pe,see below

p1g:[F[e]/D[e]=Pe,F[w]/D[w]=Pe];

given :CDS  → A(|Pe|) =A(abs(Pe))
---------------------------------------------

given : CDS = Central Difference Scheme.
-------------------------------------------------------

p2a:[a[E]=D[e] - F[e]/2,a[W] =D[w]+F[w]/2];

→ A(Pe(Δx(e))) =A(Pe),B(Pe(Δx(w)))=B(Pe),simplified

solve :problem

p2b:[p2a[1]/part(rhs(p2a[1]),1),p2a[2]/part(rhs(p2a[2]),2)];

p2c:expand(p2b);

use :p1g

p2d:expand(lratsubst(p1g,p2c));

use : p1a,simplified Pe

p2e:[A(Pe)=rhs(p2d[1]),B(Pe)=rhs(p2d[2])];

use :p1ea

p2e1:p1ea;

→ Pe > 0

assume(Pe>0);
p2f1:subst(p2e,p2e1);
p2f2:ev(p2f1,nouns);
forget(Pe>0);

→ Pe < 0

assume(Pe<0);
p2g1:subst(p2e,p2e1);
p2g2:ev(p2g1,nouns);
forget(Pe<0);

combine :any Pe

check : A(|Pe|) =1-abs(Pe)/2

assume(Pe<0);
sign(Pe);
p2h1:1-abs(Pe)/2;
forget(Pe<0);

other way : show result use a[W]of check

use :p2e

p3a:p2e[2];

use :p1fa

p3b:p1fa;

p3c:subst([p3a],p3b);

→ Pe > 0

assume(Pe>0);
sign(Pe);
p2ff1:ev(p3c,nouns);
forget(Pe>0);

result :p2ff1 =p2f2,above

→ Pe < 0

assume(Pe<0);
sign(Pe);
p2gg2:ev(p3c,nouns);
forget(Pe<0);

result :p2gg2 = p2g2 ,above

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

final result :√Pe : CDS →A(|Pe|) =1-abs(Pe)/2 (any Pe)

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