kill(all)$

maxima:appendix:fvm,quickscheme Φ[e],version 1.0 when(u>0,u<0),version 1.0
peter.vlasschaert@gmail.com,04/11/2022

ref :
new:31/10/2022:maxima :  appendix : fvm : Grid generation for CV in 1D,version 1.0

Quick-scheme = Quadratic Upwind Interpolation for Convective Kinetics

principal (Quick-scheme)
------------------------------
- two nodal values : Upstream 
- one nodal value   : Downstream

grid : (WW) → (W)→w→ (p) →[e]→( E) → (EE)

( )   = nodal values
[e]  = interface of CV
---------------------------
CV = Control Volume

→ Φ[e]  (x-direction,u>0)
------------------------------
u = velocity x-direction

two nodal values : W, p
one nodal value   : E

ref : Φ[W] @ x=0
→   Φ[p]   @ x=Δx
→   Φ[E]   @ x=2*Δx
=>   Φ[e]   @ x=3/2*Δx

find :{a,b,c}

p1:Φ = a*x^2+b*x+c;

→ Φ[W] @ x=0

p1a:subst([Φ =Φ[W] ,x=0],p1);

→   Φ[p]   @ x=Δx

p1b:subst([Φ =Φ[p] ,x=Δx],p1);

→   Φ[E]   @ x=2*Δx

p1c:subst([Φ =Φ[E] ,x=2*Δx],p1);

p1d:[p1a,p1b,p1c];

→ solve :

p2:sort(listofvars(rhs(p1)));

p2a:makelist(p2[i],i,1,length(p2)-1);

p2b:flatten(solve(p1d,p2a));

p2c:subst(p2b,p1);

find : =>   Φ[e]   @ x=3/2*Δx

use : p2c

p3:subst([ Φ =Φ[e] ],lhs(p2c)) =subst([ x=3/2*Δx],rhs(p2c));

p3a:ratsimp(expand(p3));

control check :[6-1+3 = 8]

→ Φ[e]  (x-direction,u<0)
------------------------------
u = velocity x-direction

two nodal values : E, EE
one nodal value   : p

ref : Φ[p]     @ x=0
→   Φ[E]     @ x=Δx
→   Φ[EE]   @ x=2*Δx
=>   Φ[e]      @ x=Δx/2

find :{a,b,c}

v:p2a;

q1:p1;

→ Φ[p]     @ x=0

q1a:subst([Φ =Φ[p] ,x=0],p1);

→   Φ[E]     @ x=Δx

q1b:subst([Φ =Φ[E] ,x=Δx],p1);

→   Φ[EE]   @ x=2*Δx

q1c:subst([Φ =Φ[EE] ,x=2*Δx],p1);

q1d:[q1a,q1b,q1c];

→ solve :

q2b:flatten(solve(q1d,p2a));

q2c:subst(q2b,p1);

find : =>   Φ[e]   @ x=Δx/2

use : q2c

q3:subst([ Φ =Φ[e] ],lhs(q2c)) =subst([ x=Δx/2],rhs(q2c));

q3a:ratsimp(expand(q3));

control check :[3-1+6 =8]

rem : ref : can be taken , x=0 as you like.