On Feb 7, 2009, at 9:58 AM, Etienne Rivard wrote:

Now the coefficients are nonlinear and they depend on the value of x. But

if they are assumed constant and I try to solve this problem, the
residuals and the last values close to xi=1 explode (strong divergence).

It converges for me, with rather arbitrarily chosen coefficients. Can you post a minimal code that exhibits the divergence?

I'm know it has a solution, because it's been
found before by other authors.

Maybe they're all wrong. 8^)

I tried changing one boundary condition to fixedValue and it converges! The solution is of course wrong but it's much more stable. Perhaps there's something wrong with the boundary conditions? I've read quite some posts
on BCs in the archives of this mailing list.

and

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

I have a feeling that this is the problem. The FixedFlux boundary condition really needs an overhaul. It works reliably for zero flux, but doesn't always do the right thing for non-zero values with both convection and diffusion.

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, but in FiPy 1.2 syntax, I *think* you would write:

boundarySource = VectorFaceVariable(mesh=...)
boundarySource[mesh.getExteriorFaces()] = -15.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 \
        + boundarySource.getDivergence()

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


Would it be better if I worked with the trunk version of FiPy?

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

We are trying very hard to push a new release out, hopefully in another day or two (just waiting on a clean build of the documentation). I would suggest you wait for that. At that point, we will be encouraging everyone to migrate to the new version.


Reply via email to