Dear Daniel. In this example I was trying to find out a solution for the complex differential equation:
i dphi/dt + d²phi/dx^2 + |phi^2|phi = 0 However, I just learned from the fipy ring that complex conjugates are not possible to include in Fipy. However, if I should calculate the given eqn without the complex conjugate: dphi/dt + d²phi/dx^2 + |phi^2|phi = 0 which example should I follow in the manuscript? I am not sure what the script does, when one sets a phi value before the given PDE...when I thought that the phi value was found exactly by FipY? Thanks! Sergio Sergio Manzetti [ http://www.fjordforsk.no/logo_hr2.jpg ] [ http://www.fjordforsk.no/ | Fjordforsk AS ] [ http://www.fjordforsk.no/ | ] Midtun 6894 Vangsnes Norge Org.nr. 911 659 654 Tlf: +47 57695621 [ http://www.oekolab.com/ | Økolab ] | [ http://www.nanofact.no/ | Nanofactory ] | [ http://www.aq-lab.no/ | AQ-Lab ] | [ http://www.phap.no/ | FAP ] From: "Daniel Wheeler" <daniel.wheel...@gmail.com> To: "fipy" <fipy@nist.gov> Sent: Monday, May 22, 2017 6:05:25 PM Subject: Re: Complex conjugates in FiPY 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 ]
_______________________________________________ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]