kill(all)$

maxima:appendix:fvm:integral gauss divergence theorema ,version 1.0
peter.vlasschaert@gmail.com,01/11/2022

FVM : Finite Volume Method
CV    : Control Volume.
CS     : Control  Surface

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

load(vect)$ ratprint:false$

1e) step :declare : F ,vector (Maxima)
-------------------------------------------------

declare(F,nonscalar)$

p1:express(F);

→  (p)redicate : check ,nonscalar(p)

p1a:nonscalarp(F);

vector component : x-direction

p1b:p1[1];

x-direction ,y-direction ,z-direction

p1c:makelist(p1[i],i,1,length(p1));

2e) step ∇.F =div(F)  
-------------------------
rsesult : not a vector.

p2:div(F);

→  3D : vector ,cartesian coordinates.

p2a:express(p2);

rem : ∇ = grad 

Φ : scalar potential ( T = temperature)

p2b:express(grad(Φ));

3e) step n=unit vector : vector(n)/norm(n),
--------------------------------------------------------
n = normal vector to surface (here the FVM cell)

declare(n,nonscalar)$ /*unit vector*/

p3:express(n);

4e) step gauss : divergence theorem. (p4)
------------------------------------------------------

p4a:f(v) = div(F);
p4b:f(s) = F.n; /*dot product two vectors*/

f(v) =express(div(F));

f(s) =express(F.n);

p4:integrate( f(v),v) ='integrate(f(s),s);

meaning : volume integral => surface integral.

ref :new:31/10/2022:maxima :  appendix : fvm : Grid generation for CV in 1D,version 1.0
------------------------------------------------------------------------------------------------------------------
→ interface of CV ( for 1 D) =ds , follows → interface :w,e (=CS) from the (CV)
e = east, w =west
------------------------------------------------------------------------------------------------------------------

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

dv   = volume ( FVM : CV)                                    , cartesian (dv = dx*dy*dz)
ds    = surface ( FVM : interface from CV = CS)   , surface    (ds =dx*dy,ds=dy*dz,ds =dx*dz)
n*ds = unit surface vector on the CV 

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

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