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? 

#!/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))) 

vi = Viewer(vars=phi,datamin=0.0, datamax=1.0) 
vi.plot() 

raw_input("Initialization ...") 

phi.constrain(1., mesh.facesLeft) 
phi.constrain(0., mesh.facesRight) 

phi_sq = CellVariable(mesh=mesh) 
phi_sq.setValue( phi*phi ) 

#We now represent the equation, where u = phi, du/dt + d^2u/dx^2 + u^2 = 0 in 
fipy commands. du/dx : is a convection term with a unit scalar coefficient, 
i.e. <SpecificConvectionTerm>(coeff=(1.,), var=u) , 
# du/dt : is a transient term that one can treat as before, i.e. 
TransientTerm(var=u). one can add a second order derivative as 
ExplicitDiffusionTerm(coeff=D) 

eq = TransientTerm(coeff=1., var=phi) + ExponentialConvectionTerm(coeff=(1.,), 
var=phi) + abs((phi_sq))*(phi) == 0.0 

dt = 0.01 
steps = 100 
for step in range(steps): 
eq.sweep(dt=dt) 
# 
phi_sq.setValue( phi * phi ) 
# 
vi.plot() 

phiAnalytical = CellVariable(name="Analytical value", 
mesh=mesh) 

vi = Viewer(vars=(phi, phiAnalytical)) 
vi.plot() 

raw_input("Press <return> ...") 

Thanks! 

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: Friday, May 19, 2017 5:41:56 PM 
Subject: Re: Complex conjugates in FiPY 

On Thu, May 18, 2017 at 9:23 AM, Sergio Manzetti 
<sergio.manze...@fjordforsk.no> wrote: 
> 
> Hello, in the manual on p 318 it gives an example of including the complex 
> conjugate in a fipy script, however this does not seem to work when including 
> the complex conjugate in the actual PDE given. 

Can you link to the example on the webpage? 

http://www.ctcms.nist.gov/fipy/documentation/manual.html 

> Can fiPy include complex conjugate in a PDE, such as 
> 
> u_x + i*u_y = 0 
> 
> ? 

No, it can't. Sorry about that. It would be great functionality, but 
never implemented. 

-- 
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 ]

Reply via email to