I modified the examples.convection.exponential1D.mesh1D
example and it gives an error when I run it.
from fipy import CellVariable, Grid1D, DiffusionTerm, PowerLawConvectionTerm
from fipy.tools import numerix
diffCoeff = 1.
convCoeff = (10.,)
L = 10.
nx = 100
mesh = Grid1D(dx=L / nx, nx=nx)
valueLeft = (0.,)
valueRight = 0.
var = CellVariable(mesh=mesh, name="variable")
var.faceGrad.constrain(valueLeft, where=mesh.facesLeft)
var.constrain(valueRight, mesh.facesRight)
eq = (DiffusionTerm(coeff=diffCoeff)
+ PowerLawConvectionTerm(coeff=convCoeff))
eq.solve(var=var)
When I run it I get the following error:
...\fipy\solvers\scipy\linearLUSolver.py:41: RuntimeWarning: invalid value encountered in double_scalars
if (numerix.sqrt(numerix.sum(errorVector**2)) / error0) <= self.tolerance:
Did I implement the zero gradient boundary condition right? I only found 2D examples. In this 1D problem does valueLeft
even have to be a vector? I tried with scalar but still got the same error.
I'm new to FiPy and I'm aware that this PDE in this form may not make any sense but I wanted to start from a simpler example and in the end I want to solve a PDE with these boundary conditions and a source. Would adding a source solve my problem?
Any help would be appreciated.