On Sat, May 20, 2017 at 5:02 AM, Sergio Manzetti
<sergio.manze...@fjordforsk.no> wrote:
>
> Dear Daniel, I am wondering if you can clarify a small. thing.
>
> In the given script, phi is set as e^ix, and the numerical simulation treats 
> the given PDE. Is phi tested for wether it is a result of the given PDE in 
> this script ? Or does the script do something else?

I'm not quite sure what you're asking, but I'm sure that the script
below does not work as you intend it to work.

> #!/usr/bin/env python
> # testing a non-complex variant of the NLSE
>
> import numpy
> import cmath as math
> from fipy import *
> from fipy import numerix
>
> nx = 50
> dx = 1. / float(nx)
>
> mesh = Grid1D(nx=nx,dx=dx)
> X = mesh.cellCenters[0]
>
> phi = CellVariable(mesh=mesh, name="Solution")
> phi.setValue(0.5-0.5*numerix.exp((1j*X)))

At this point your script is broken, "phi.value.imag" is all zero
while "(0.5-0.5*numerix.exp((1j*X))).value.imag" is non-zero. The type
of the CellVariable is wrong initially and the type doesn't change
when the value is reset.

-- 
Daniel Wheeler
_______________________________________________
fipy mailing list
fipy@nist.gov
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to