Yes, this solves my problem, thank you! I also got this problem and would you
please suggest what's wrong. Sorry for such 'easy' questions but it takes some
time for a beginner to get used to the grammars in FiPy.
Please have a look of the following a sequence of commands and the outputs,
what is the problem with the last command? Thank you for your kindly help!
hzhatlboro
>>> counti
0
>>> k
1
>>> j
1
>>> omega[1,1]
0.0
>>> omega[counti,k]
1.2
>>> (omega[counti,k]-omega[j,k])
1.2
>>> omega[j,k]
0.0
>>> phases[k]
CellVariable(name = "phi1", value = [ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,]
+ 1140 more elements, mesh = UniformGrid2D(dx = 0.25, dy = 0.25, nx = 16, ny =
90))
>>> 1.2*phases[k]
(CellVariable(name = "phi1", value = [ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,]
+ 1140 more elements, mesh = UniformGrid2D(dx = 0.25, dy = 0.25, nx = 16, ny =
90)) * 1.2)
>>> (omega[counti,k]-omega[j,k])*phases[k]
Traceback (most recent call last):
File "<pyshell#32>", line 1, in ?
(omega[counti,k]-omega[j,k])*phases[k]
ValueError: object __array__ method not producing an array
>>>
----- Original Message ----
From: Jonathan Guyer <[EMAIL PROTECTED]>
To: Multiple recipients of list <[email protected]>
Sent: Tuesday, 10 October, 2006 10:02:00 PM
Subject: Re: what does this error mean?
On Oct 10, 2006, at 4:09 PM, hzhatlboro wrote:
> Hi, can you please give me an idea what does the following error
> mean? Thanks for your support!
>
> Traceback (most recent call last):
> File "pf2dtest.py", line 206, in ?
> S20+=s[k]*((.5*epsilon[counti,k]**2-.5*epsilon[j,k]**2)*(phases
> [k].getFaceGrad()).getDivergence \
> TypeError: unsupported operand type(s) for *: 'float' and
> 'instancemethod'
>
> The complete codes at lines 206 & 207 are:-
>
> S20+=s[k]*((.5*epsilon[counti,k]**2-.5*epsilon[j,k]**2)*(phases
> [k].getFaceGrad()).getDivergence \
> +(omega[counti,k]-omega[j,k])*phases
> [k])
What you've written here is incomplete.
Python is seeing
S20+=someCellVariable*(someNumber*someFaceVariable.getDivergence +
somethingElse)
when it wants to see
S20+=someCellVariable*(someNumber*someFaceVariable.getDivergence() +
somethingElse)
___________________________________________________________
The all-new Yahoo! Mail goes wherever you go - free your email address from
your Internet provider. http://uk.docs.yahoo.com/nowyoucan.html