9 Jun 01:28
Mixed Boundary Conditions
From: Recif <recif@...>
Subject: Mixed Boundary Conditions
Newsgroups: gmane.comp.python.fipy
Date: 2008-06-08 23:28:53 GMT
Subject: Mixed Boundary Conditions
Newsgroups: gmane.comp.python.fipy
Date: 2008-06-08 23:28:53 GMT
Hi,
I would like to use FiPy on a problem with mixed (Robin) boundary conditions.
I was not clear on the implementation, so as a test I tried to solve the
following problem for which the steady-state solution is known:
\begin{align*}
\frac{\partial C}{\partial t} &=\frac{\partial^2 C}{\partial x^2}
- Pe\frac{\partial C}{\partial x} -Da C \qquad 0 < x <1\\
x=0: Pe &= -\frac{\partial C}{\partial x} + Pe C \\
x=1: \frac{\partial C}{\partial x} & = 0
\end{align*}
My program is listed below. I had to switch the sign for the left boundary
condition from what I expected, to avoid negative concentrations. However,
the solution does not converge to the analytical solution, and the flux on the
right boundary is non-zero at later times, despite the specification of zero.
I would appreciate any assistance in fixing these errors.
Recif
__________________________________________________
nx = 50
L=1.0
dx = L/nx
from fipy.meshes.grid1D import Grid1D
mesh = Grid1D(nx = nx, dx = dx)
from fipy.variables.cellVariable import CellVariable
C = CellVariable(name="concentration",mesh=mesh,value=0.0,hasOld=1)
Pe=1.0
Da=1.0
fluxLeft = -Pe*(C.getFaceValue()-1.0)
fluxRight = 0.0
(Continue reading)
RSS Feed