Hi,
Thanks for the replies.
I tried the code given by you, but it is giving an error.
------------------------ERROR----------------------------
Traceback (most recent call last):
File "C:/Documents and Settings/Amit/Desktop/RA/PDE/pde1", line 19, in
-toplevel-
eqX = diffTerm + PowerLawConvectionTerm((1,), diffTerm=diffTerm)
TypeError: __init__() got an unexpected keyword argument 'diffTerm'
-----------------------------------------------------------------
and I am sorry that the equation I wrote was not correct. I want to find the
solution for (D^2+1)y=0 with BC: y(0)=3 and y(pi/2)=3.
Earlier I was getting an error that "no module named fipy". But I am not
getting it now. I don't know how it got corrected by itself.
Thank you,
Amit
Daniel Wheeler <[EMAIL PROTECTED]> wrote:
On Mar 17, 2007, at 8:40 AM, amit soni wrote:
Thanks for your suggestions. Its working now.
I don't know what the problem was in the first time.
Hmm. How did you get it to work?
How can I solve an ODE like ((D^2)+D)y=0 with BC: y(0)=3 and y(pi/2)=3
I think the equation above is a combination of a diffusion and a convection
term. Correct?
I have written this code, but I am not sure whether my representation of the
equation is correct or not and that is why I am not getting correct answer.
I'll correct the code to solve what I think is the equation represented above.
I'll use ## to
comment out lines of your code.
Try not to use the ExplicitDiffusionTerm. This will mean that your solution is
limited by the Euler
stability limit (~dx**2), which is not required for the equation you are trying
to solve.
--------------------------------- Code--------------------------------------
## import matt
from fipy import *
## from fipy.meshes.grid1D import Grid1D
m = Grid1D(nx=50, dx=math.pi/100)
## from fipy.variables.cellVariable import CellVariable
phi = CellVariable(name="solution variable",
mesh=m,
value=0)
valueleft=3
valueright=3
## from fipy.boundaryConditions.fixedValue import FixedValue
BCs = (FixedValue(faces=m.getFacesRight(), value=valueright),
FixedValue(faces=m.getFacesLeft(), value=valueleft))
##from fipy.terms.explicitDiffusionTerm import ExplicitDiffusionTerm
diffTerm = DiffusionTerm()
## eqX = phi == ExplicitDiffusionTerm(coeff=1)
eqX = diffTerm + PowerLawConvectionTerm((1,), diffTerm=diffTerm)
eqX.solve(phi, boundaryConditions=BCs)
viewer = make(phi)
viewer.plot()
raw_input()
Hope the above helps
Cheers
----------------------------------End of
Code-------------------------------------
I am not getting any errors in this code.
Thank you,
Amit
Daniel Wheeler <[EMAIL PROTECTED]> wrote: Try
>>> from fipy import *
>>> m = Grid1D(nx=2)
start a new python prompt and try
>>> from fipy.meshes.grid1D import Grid1D
>>> m = Grid1D(nx=2)
Do either of those work?
On Mar 14, 2007, at 10:17 PM, amit soni wrote:
This is working fine(from fipy import *). It is not giving any errors.
Thanks,
Amit
Daniel Wheeler <[EMAIL PROTECTED]> wrote: Hi Amit,
What happens when you open up a python prompt and type
>>> from fipy import *
On Mar 13, 2007, at 11:22 PM, amit soni wrote:
Hi,
I am getting an error in the line: "from fipy.meshes.grid1D import Grid1D",
which says:
ImportError: No module named fipy.meshes.grid1D
Importing only fipy also gives a similar error.
I have Python2.4.4, numpy, matplotlib and fipy installed on my computer.
Can anyone help me what might be causing this problem?
Thank you,
Amit
---------------------------------
TV dinner still cooling?
Check out "Tonight's Picks" on Yahoo! TV.
--
Daniel Wheeler
---------------------------------
Don't be flakey. Get Yahoo! Mail for Mobile and
always stay connected to friends.
--
Daniel Wheeler
---------------------------------
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
--
Daniel Wheeler
---------------------------------
8:00? 8:25? 8:40? Find a flick in no time
with theYahoo! Search movie showtime shortcut.