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