kill(all)$

maxima:fvm:other schemes (convection-diffusion) for computation A(abs(Pe)),version 1.0
peter.vlasschaert@gmail.com,17/12/2022

see website :

ref : 1
maxima :fvm : generalized relation convection-diffusion (Pe=Peclet) ,version1.0a
ref : 2
maxima:fvm:CDS sheme (convection-diffusion) use A(Pe) & B(Pe) follows A(abs(Pe)),version 1.0
ref : 3
maxima:fvm:appendix:exponential scheme "1D -convection-diffusion,u > 0 ",version 1.0
ref : 4
maxima :  linearized exponential scheme (=hybrid scheme,a[E]/D[e])    part1,version 1.0
maxima : linearized exponential scheme (=hybrid scheme ,a[W]/D[w]) part 2,version 1.0

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];

conservation law & a[p]
---------------------------------

pq1:F[e]-F[w] =0;
pq2:a[p] =a[W]+a[E] +F[e]-F[w];

→ 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];

principal equation:     →  A(abs(Pe))=A(Pe)-max(0,-Pe)

px :A(abs(Pe))=A(Pe)-max(0,-Pe);

CDS scheme:
=========

p1:A(abs(Pe))=1-abs(Pe)/2;

upwind  scheme:
=============

p2:A(Pe)= 1+max(-Pe,0);

use : px

p2a:subst([p2],px);

exponential  scheme:
===============

use : ref 3.p10b1

p3:a[E]=F[e]/(%e^Pe(Δx(e))-1);

use : simplified version Pe

p3a:[Pe(Δx(e)) =Pe];

p3a1:subst(p3a,p3);

find : A(Pe),see :p1a

p3b:(p3a1/D[e]);

use :p1g

p3b1:subst(p3a,lhs(p1a[1]))=lratsubst(p1g,rhs(p3b));

p3c:subst([p3b1],px);

→ Pe >0

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

→ Pe <0

assume(Pe<0)$
sign(Pe);
p3db:ev(p3c,nouns);
p3db1:lhs(p3db)=ratsimp(rhs(p3db))/%e^(Pe);
forget(Pe<0)$

combine :

use :p3b1

p3e1:subst([Pe=abs(Pe)],p3b1);

check : Pe < 0

assume(Pe<0)$
sign(Pe);
p3e2:ev(p3e1,nouns);
forget(Pe<0)$

Hybrid  scheme:      :a[E]/D[e] =A(Pe)
============
1e) a[E]/D[e] =-Pe              if       -∞< Pe <-2
2e) a[E]/D[e] =1-Pe/2          if       -2  ≤ Pe ≤  0  (*)
3e) a[E]/D[e] =1-Pe/2          if        0  ≤ Pe ≤  2  (**)
4e) a[E]/D[e] =0                  if        2  ≤ Pe ≤  ∞ 

breaking up range : A(Pe) = 1-Pe/2 the "max function" contains zero "below :p4"
rem : below zero (*) and above zero (*)

p4: px;

1e)  & 2e)  values Pe < 0

assume(Pe <0);
sign(Pe);

→ 1e) range:

p4a:A(Pe) =-Pe;
p4a1:lhs(px) = ev(subst([p4a],rhs(px)),nouns);

→ 2e) range:

p4b:A(Pe) =1-Pe/2;
p4b1:lhs(px) = ev(subst([p4b],rhs(px)),nouns);

forget(Pe<0)$

3e)  & 4e)  values Pe > 0

assume(Pe >0);
sign(Pe);

→ 3e) range:

p4c:A(Pe) =1-Pe/2;
p4c1:lhs(px) = ev(subst([p4c],rhs(px)),nouns);

→ 4e) range:

p4d:A(Pe) =0;
p4d1:lhs(px) = ev(subst([p4d],rhs(px)),nouns);

forget

forget(Pe>0);

sign(Pe);

combine :use max full range {1e,2e,3e,4e}
----------------------------------------------------

p4e:max(0,1-abs(Pe)/2);

set : range 3e) ,example : Pe =1

p4e1: Pe =1;

p4e2:subst([p4e1],p4e);

use :p4c1

p4e3:lhs(p4c1) =subst([p4e1],rhs(p4c1));

check :p4e2 with rhs(p4e3)
-----------------------------------
combine and range : 3e

p4e4:is(p4e2=rhs(p4e3));

test :values →inequality :example→ assume(Pe≤ 0) , remove with : forget the assume.

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

studie 
=====

===================================================================

learning : Formula ,x-direction (1D),see "above"
-----------

see website : 
---------------

A(Pe) = a[E]/D[e],B(Pe) =a[W]/D[e] use Pe =F[e]/D[e]
→ A(Pe) & B(Pe) => A(abs(Pe))
------------------------------------------------------------------------
Pe on the face of CV : Pe(f),see : above "p1a"
------------------------------------------------------------------------
=>  A(abs(Pe))=A(Pe)-max(0,-Pe)
=>  A(abs(Pe))=B(Pe)-max(0,Pe)
------------------------------------------------------------------------
rem :|Pe| = abs(Pe) , "Maxima"
rem : CV = Control Volume
rem : CS  = Control Surface on the CV ,CS ={in CV,out CV}
----------------------------------------------------------------------------
ref :book 
=======
Narosa publishing House
second edition :Computational fluid flow and heat transfer
editors : K Muralidhar & T Sundarajan 
----------------------------------------------------------------------------
pg : 248 →259
-----------------------------------------------------------------------------
used : university :Kampur
-----------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------
=================================================================