The mentioned error seems to be fixed in development version of DOLFIN.
Your code passes ok - it just refines elsewhere than necessary.
Switching the inequality sign in
cell_markers[c] = gamma[c.index()] > gamma_0
seems to behave better.
FEniCS 1.6.0 including Debian/Ubuntu binary packages should be released
soon.
Jan
On Wed, 8 Jul 2015 10:40:01 +0000
Drew Parsons <[email protected]> wrote:
> I apologise for that, I missed a couple of details when I prepared a
> minimum test case. The variable should have been grad_u not Efield.
> Fixing that, the test case (in 2-D) does run successfully.
>
> I've clarified that my problem comes from trying to solve in 1D rather
> than 2D, starting from a UnitIntervalMesh instead of UnitSquareMesh.
>
> I've double checked that the attached script gives the error
> Vertex index (7) out of range [0, 7).
> after identifying the refinement conditions
> 2 cells out of 4 marked for refinement (50.0%).
>
> Drew
>
> On Wed, 2015-07-08 at 11:42 +0200, Jan Blechta wrote:
> > Attached script does not reproduce alleged problem. Instead it fails
> > with message
> >
> > Traceback (most recent call last):
> > File "demo_adaptive-poisson.py", line 74, in <module>
> > gamma = abs(Efield.vector().array())
> > NameError: name 'Efield' is not defined
> >
> > Could you fix it to reproduce the problem?
> >
> > Jan
> >
> >
> > On Mon, 6 Jul 2015 11:41:20 +0000
> > Drew Parsons <[email protected]> wrote:
> >
> > > Hi Fenics Folk,
> > >
> > > I'm not expert in Fenics/Dolfin, I'm evaluating to see if it can
> > > perform better than a calculation I've currently got implemented
> > > in octave (matlab).
> > >
> > > My problem in octave is that it fails to find the solution to
> > > Poisson's equation when the electric field is extremely large. It
> > > uses an adaptive spacing (1D mesh) but it complains that it can't
> > > make
> > > intervals any finer and reached the iteration limit. Perhaps
> > > Fenics
> > > can do a better job?
> > >
> > > So I'm testing your adaptive Poisson example,
> > > /usr/share/dolfin/demo/undocumented/adaptive-poisson/
> > > (maybe the documented auto-adaptive-poisson is better for me, but
> > > anyway).
> > >
> > > The demo works fine. It uses "gamma" as the criterion for mesh
> > > refinement, based on curvatures.
> > >
> > > I've replaced gamma in the example with the absolute value of the
> > > gradient,
> > > grad_u = project(grad(u), VectorFunctionSpace(mesh,
> > > "Lagrange", 1)) gamma = abs(Efield.vector().array())
> > >
> > > The error estimate E (E=gamma*gamma) doesn't make sense then, but
> > > mesh
> > > refinement should still work, right?
> > >
> > > Mesh refinement does work twice, but in the third iteration it
> > > fails
> > > with the error:
> > > *** Error: Unable to add cell using mesh editor.
> > > *** Reason: Vertex index (13) out of range [0, 11).
> > > *** Where: This error was encountered inside MeshEditor.cpp.
> > >
> > > The value of cell_markers going into refine() seems sensible, "3
> > > cells
> > > out of 7 marked for refinement (42.9%)." So I don't understand
> > > why refine() would fail like this.
> > >
> > > So I wanted to check with you if this is a normal error or not.
> > > If it
> > > is normal than please tell me so and I'll keep studying the Fenics
> > > system.
> > >
> > > I'm attaching my python file, which is identical to the one in the
> > > adaptive-poisson example, apart from the change in definition of
> > > gamma
> > > (and a couple of print statements).
> > >
> > > I'm using DOLFIN version: 1.5.0 on Debian unstable.
> > >
> > > Thanks,
> > >
> > > Drew Parsons
> > >
> >
_______________________________________________
fenics mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics