On Feb 8, 2009, at 11:27 AM, Etienne Rivard wrote:

You should be able to achieve the same effect by using a source.
Daniel recently wrote a FAQ for this in the documentation for trunk,

Ok, didn't notice that, I'll have a closer look.

No reason you would have. It's a very recent addition, and only to the svn repository, until now.


I'll give it a try, but should I adopt what you suggest here and carry it
on to 2.0 or use more traditional boundary conditions?

I'd be inclined to update to 2.0, now that we've released it, and then test with both FixedFlux and with a divergent source. I'm guessing that the latter will work better.

We haven't overhauled boundary conditions, yet, but when we do FixedFlux will probably be rewritten to work exactly like boundarySource.getDivergence()


There's no need to pass any boundaryConditions to sweep() if you do it
this way.

Aha, just out of curiosity, I am I right when I say that - also in this case - when I don't pass any BCs in sweep(), fipy just uses its default
Neumann BC equal to zero and the boundary source compensates for that?

Yes.

It converges for me with both 1.2 and trunk, but I could easily not be
in the same parameter space as you.

I double tested the script I am posting in an initially empty parameter
space (or namespace as IPython calls it) and it exhibited exactly the
behavior I was talking about in my original post. I hope you can spot some
faulty lines.

Sorry; I didn't mean a Python namespace. I meant that the numerical parameters I chose were probably different from yours. Your later post seems to confirm that.

We are trying very hard to push a new release out, hopefully in
another day or two

You guys are on fire!

Given how long we've been sitting on this, I'm not sure how much fire we can lay claim to, but thanks anyway.


On Feb 9, 2009, at 10:30 AM, Etienne Rivard wrote:

Could you please send me the script that you used to test my equation, if you used one at all? I'm sure I'll learn a thing or two from it.

Happy to. Other than very different numerical parameters, it doesn't look like we did things very differently. See below.

On Feb 9, 2009, at 11:38 AM, Etienne Rivard wrote:

I just made some tests with the coefficients and I was able to achieve
convergence. So, I think the problem is on my side, I have to revise the routines I use to calculate the coefficients and see if they are even in
the right range.

OK. Let us know if we can be of any further help.




-------

from fipy import *

mesh = Grid1D(nx=100)

xi = mesh.getCellCenters()[..., 0]
xi = CellVariable(mesh=mesh, value=xi)

xi_f = mesh.getFaceCenters()

x_p = CellVariable(mesh=mesh)

R = 20.
dR_dt = 1.
c = 1.
c_f = 1.
D_p = 1.

unitVector = [1]

diffTerm = ImplicitDiffusionTerm(coeff=xi**2.0*c*D_p/R**2.0)

eq1 = TransientTerm(coeff=xi**2.0*c) \
- ExponentialConvectionTerm(coeff = unitVector*xi_f**3.0/ R*dR_dt*c_f,
                                    diffusionTerm=diffTerm) \
        + 3.0*c*x_p*xi**2.0*dR_dt/R \
        == diffTerm

bc_xp = (
   FixedFlux(faces=mesh.getFacesRight(), value=-15.0),
   FixedFlux(faces=mesh.getFacesLeft(), value=0.0)
   )

dt = 1.

for step in range(100):
    res = eq1.sweep(
            var = x_p,
            boundaryConditions=bc_xp,
            solver=LinearLUSolver(tolerance=1e-11),
            dt=dt)


    print res

Reply via email to