Just FYI, I discovered the problem. At some point my field calculation was returning nan, I didn't notice. The nan naturally propagated to the particle trajectory and wound up as an argument to the points probe. 

Passing nan into the points probe as a coordinate doesn't work. ;-)

thanks,
-steve

On Wednesday, May 22, 2013 9:09:42 AM UTC-6, Robert Cimrman wrote:
Hi Steve,

On 05/22/2013 04:42 PM, Steve Spicklemire wrote:
> I'm using sfepy to solve for the potential in what is essentially a cylindrical lens for charged particles.
>
> I'm attempting to use a probe to evaluate the field components (-grad(u)). Here's what I'm attempting:
>
> def GetFieldAtPoint(res, x, y, eps=0.1):
>    """
>    Return the field strength at a point x,y using eps for centered difference.
>    """
>    probe = PointsProbe((
>        (x + eps, y),
>        (x - eps, y),
>        (x, y + eps),
>        (x, y - eps)), res.pb.domain.mesh)
>
>    pars, vals = probe(res.var)
>    vals = vals.squeeze()
>
>    Ex = (vals[1]-vals[0])/(2.0*eps)
>    Ey = (vals[3]-vals[2])/(2.0*eps)
>
>    return np.array([np.isnan(Ex) and 0.0 or Ex, np.isnan(Ey) and 0.0 or Ey])
>
> But I'm getting a memory exception after several evaluations. I'll try to come up with a complete example to post.. but has anyone see this kind of trouble?
>
> thanks,
> -steve
>
> Program received signal EXC_BAD_ACCESS, Could not access memory.
> Reason: KERN_INVALID_ADDRESS at address: 0x00000000130e16a0
> 0x0000000108513b1f in __pyx_f_5sfepy_3fem_7extmods_5bases_find_ref_coors (__pyx_v_ref_coors=0x10cb28b90, __pyx_v_cells=0x10cb28b40, __pyx_v_status=<value temporarily unavailable, due to optimizations>, __pyx_v_coors=<value temporarily unavailable, due to optimizations>, __pyx_v_ics=0x108521e60, __pyx_v_offsets=0x111c0a870, __pyx_v_iconn=0x10f152450, __pyx_v_mesh_coors=0x10cb330c0, __pyx_v_conns=0x110e3ce60, __pyx_v_eref_coorss=0x10e153950, __pyx_v_nodess=0x10e144638, __pyx_v_mtx_is=0x110e3cdd0, __pyx_v_allow_extrapolation=1, __pyx_v_close_limit=0.10000000000000001, __pyx_v_qp_eps=1.0000000000000001e-15, __pyx_v_i_max=100, __pyx_v_newton_eps=1e-08, __pyx_skip_dispatch=0) at build/src.macosx-10.6-intel-2.7/sfepy/fem/extmods/bases.c:5795
> 5795            __pyx_v_ig = (*__Pyx_BufPtrCContig1d(__pyx_t_5sfepy_3fem_7extmods_5types_int32 *, __pyx_bstruct_iconn.buf, __pyx_t_37, __pyx_bstride_0_iconn));
> (gdb) bt
> #0  0x0000000108513b1f in __pyx_f_5sfepy_3fem_7extmods_5bases_find_ref_coors (__pyx_v_ref_coors=0x10cb28b90, __pyx_v_cells=0x10cb28b40, __pyx_v_status=<value temporarily unavailable, due to optimizations>, __pyx_v_coors=<value temporarily unavailable, due to optimizations>, __pyx_v_ics=0x108521e60, __pyx_v_offsets=0x111c0a870, __pyx_v_iconn=0x10f152450, __pyx_v_mesh_coors=0x10cb330c0, __pyx_v_conns=0x110e3ce60, __pyx_v_eref_coorss=0x10e153950, __pyx_v_nodess=0x10e144638, __pyx_v_mtx_is=0x110e3cdd0, __pyx_v_allow_extrapolation=1, __pyx_v_close_limit=0.10000000000000001, __pyx_v_qp_eps=1.0000000000000001e-15, __pyx_v_i_max=100, __pyx_v_newton_eps=1e-08, __pyx_skip_dispatch=0) at build/src.macosx-10.6-intel-2.7/sfepy/fem/extmods/bases.c:5795
> #1  0x0000000108516b89 in __pyx_pf_5sfepy_3fem_7extmods_5bases_3find_ref_coors (__pyx_self=<value temporarily unavailable, due to optimizations>, __pyx_args=<value temporarily unavailable, due to optimizations>, __pyx_kwds=<value temporarily unavailable, due to optimizations>) at build/src.macosx-10.6-intel-2.7/sfepy/fem/extmods/bases.c:6310
> #2  0x00000001000c1e7d in PyEval_EvalFrameEx ()

This is strange, I have never seen that. I might be able to tell you more after
I try the complete example.

r.