simulkade / FVTool

Finite volume toolbox for Matlab/Octave

Home Page:http://fvt.simulkade.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Boundary conditions

Whatsoever opened this issue · comments

Dear Dr. Eftekhari,

Thank you for provided us with a flexible quite simple software. I just do not get how to use the boundary conditions or which kind of approach It uses.
In a 1D (so far i am interested in that), I see that the matrix will be:
| a1 a2 0 .....0 |
A =| .....O ........... | where a1 = -(BC.left.b/2 + BC.left.a/dx_1)
| 0 .....0 a3 a4 | a2 = -(BC.left.b/2 + BC.left.a/dx_1)
a3 = BC.right.b/2 + BC.right.a/dx_end
a4 = BC.right.b/2 - BC.right.a/dx_end

and the vector of boundary conditions:
|q1 | q1 = -(BC.left.c)
q = | 0 |
|q2 | q2 = BC.right.c

So I must implement the values of a, b, and c for each side:

If I want a dirichlet boundary such as c(0, t) =C0; (left side constant), how do it do it? (equal for the right side?)

and

If I want a flux boundary (cauchy boundary) c(0, t) = C0 + (D/v) dC(0, t)/dx ; (left side constant), how do it do it? (equal for the right side?)

and a no flux boundary such as v = 0 and dC(0, t)/dx =0;(left side constant), how do it do it? (equal for the right side?)

Thank a lot

Best Regards,

Daniel

Hi Daniel,

Thank you for your comment, and sorry for the lack of a proper documentation. I have implemented the boundary as:
a grad(phi).e + b phi = c,
where e is the unit vector. For a Dirichlet boundary, you can write:
BC.left.a(:)=0.0;
BC.left.b(:)=1.0;
BC.left.c(:)=C0;

For a Neumann boundary (constant flux, i.e., D d phi/dx=q), write:
BC.left.a(:)=D;
BC.left.b(:)=0.0;
BC.left.c(:)=q;

and for a Mixed or Robin boundary c(0, t) = C0 + (D/v) dC(0, t)/dx, or after rearrangement (D/v) dC(0, t)/dx - c(0, t) = -C0
BC.left.a(:)=D/v;
BC.left.b(:)=-1.0;
BC.left.c(:)=-C0;

I hope it helps.

Cool, lot of thanks.