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 PDE
instead of using fortran routines and put it them into a more global python
code. I've founded two weeks ago FiPy on the web and I'm trying to use
it for my purposes. I'm currently trying some simple things to
understand a little bit
more how using FiPy. My conclusion is that Fipy is very easy to use and seems
powerful.
You really did a great job !
So thanks again.
Marc
Daniel Wheeler <daniel.wheel...@gmail.com> a écrit :
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() statement as you already had a plot. The
second plot didn't seem to show up and adding the statement opened up
a new window. Seems to at least do something now. No idea if it's what
you want though. Good luck.
On Thu, May 19, 2011 at 10:34 AM, Marc Saudreau
<marc.saudr...@clermont.inra.fr> wrote:
I've got float64 in both cases !!
May my *.py file help you ?
Thanks
Marc
Daniel Wheeler <daniel.wheel...@gmail.com> a écrit :
What do you get if you print numerix.array(S).dtype?
On Thu, May 19, 2011 at 9:13 AM, Marc Saudreau
<marc.saudr...@clermont.inra.fr> 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) :
__call__ C:\FiPy-2.1.2\fipy\variables\cellVariable.py 205
IndexError: arrays used as indices must be of integer (or boolean) type
I tried to get the solution by myself but to be honest this one is a
little
bit disturbing.
Any solution ?
Thanks again for your help and time
Marc
Daniel Wheeler <daniel.wheel...@gmail.com> a écrit :
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, v([S, S], order=1))
pylab.show()
raw_input('stopped')
Basically, you can extract any data from "v" with "v([x, y])" where
"x" and "y" define a set of coordinates.
Cheers
On Tue, May 17, 2011 at 4:47 AM, Marc Saudreau
<marc.saudr...@clermont.inra.fr> wrote:
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.
Best regards,
Marc
--
Daniel Wheeler
--
Daniel Wheeler
--
Daniel Wheeler