Re: Extract 1D profile from 2D or 3D grid

2011-05-20 Thread Daniel Wheeler
Thanks for the kind words. Much appreciated. I hope FiPy is useful to you. On Thu, May 19, 2011 at 4:55 PM, Marc Saudreau wrote: > > Hi Daniel, > > It works ... and that's exactly what I wanted! You're great ! > > Thanks a lot for your help. I used to program in Fortran and a little bit in > C++

Re: Extract 1D profile from 2D or 3D grid

2011-05-19 Thread Marc Saudreau
Hi Daniel, It works ... and that's exactly what I wanted! You're great ! Thanks a lot for your help. I used to program in Fortran and a little bit in C++ and few months ago, I've started to use some python codes for coupling models. So I was wondering if I could find a python library to solve P

Re: Extract 1D profile from 2D or 3D grid

2011-05-19 Thread Daniel Wheeler
Marc, Attached is a fixed script. I did two things. One was to make sure that nx and ny are set as integers. I think they were floats, which was causing some subtle issue or other. I thought we auto cast them to ints internally, but who knows. That fixed the IndexError. I also added a pylab.figure(

Re: Extract 1D profile from 2D or 3D grid

2011-05-19 Thread Marc Saudreau
I've got float64 in both cases !! May my *.py file help you ? Thanks Marc Daniel Wheeler a écrit : What do you get if you print numerix.array(S).dtype? On Thu, May 19, 2011 at 9:13 AM, Marc Saudreau wrote: Hi Daniel,  thanks a lot. Your example works fine when I use it alone. But w

Re: Extract 1D profile from 2D or 3D grid

2011-05-19 Thread Daniel Wheeler
What do you get if you print numerix.array(S).dtype? On Thu, May 19, 2011 at 9:13 AM, Marc Saudreau wrote: > > Hi Daniel, > >  thanks a lot. Your example works fine when I use it alone. But when I want > to use it in > my code, an error occurs with the instruction v([S, S], order=1) : >    __cal

Re: Extract 1D profile from 2D or 3D grid

2011-05-19 Thread Marc Saudreau
Hi Daniel, thanks a lot. Your example works fine when I use it alone. But when I want to use it in my code, an error occurs with the instruction v([S, S], order=1) : __call__C:\FiPy-2.1.2\fipy\variables\cellVariable.py205 IndexError: arrays used as indices must be of integer (or

Re: Extract 1D profile from 2D or 3D grid

2011-05-17 Thread Daniel Wheeler
Hi Marc, CellVariable's __call__ method extracts data. So you can do the following: from fipy import * import pylab L = 1. n = 10 m = Grid2D(nx=n, ny=n, dx=L / n, dy=L / n) x, y = m.cellCenters v = CellVariable(mesh=m, value = x * y) N = 50 S = numerix.arange(N) / float(N - 1) * L pylab.plot(S,

Extract 1D profile from 2D or 3D grid

2011-05-17 Thread Marc Saudreau
Hi everyone, I'm trying to use Fipy to solve a 2D heat transfer problem, and I need to extract from my 2D grid, some 1D profiles. For instance I need to plot temperature versus y axis for x given. I had a look at Fipy examples but I did not find any way to do it. Thanks a lot for any help.