Re: Complex conjugates in FiPY

2017-05-27 Thread Sergio Manzetti
Dear all, following Jonathan's mail, I have prepared a project for simulation 
with FiPY, and here I would like to simulate a 3-variable differential equation 
with a transient term, that is for instance: 

du/dt + Ad³u/dxdydz + Bdu/dx + Cdu/dy + Ddu/dz = sin(x) 


This would be awfully many variables, and I am therefore not sure which example 
in the manual that would be a good tutorial to start this. 

In this simulation I would like to export as many properties as possible of the 
solution, and not only the plot. Are there additional functions n fipy or 
auxiliary programs of analyzing the result that are relevant with 
phase-dynamics of the PDE? Also, is there a plotting function to plot the 
result in 3D coordinate system? 

Thank you! 

Best wishes 
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: "jonathan guyer" <jonathan.gu...@nist.gov> 
To: "fipy" <FIPY@nist.gov> 
Sent: Tuesday, May 23, 2017 10:09:44 PM 
Subject: Re: Complex conjugates in FiPY 

In (intentionally) provocative terms, PDEs with analytical solutions aren't 
good for anything. 

If I want to develop a qualitative understanding of the neutron flux and 
temperature in a nuclear reactor, I can make considerable headway with Bessel 
functions in cylindrically symmetric coordinates and a piece of paper. If I 
want to understand in detail which coolant channels and where in a real reactor 
are most likely to develop boiling conditions that choke off flow and cause 
neighboring fuel elements to melt, then I need a numerical simulation of a 
coupled set of PDEs governing neutron generation and absorption, multi-phase 
fluid flow, heat transport and generation, phase transformation of fuel, 
matrix, and cladding materials, and so on and so on. 

More simplistically, our first example demonstrates several cases of diffusion 
in 1D for basic reason that there are analytical solutions to validate against 
and many people have seen them before. Increase the number of dimensions, alter 
the boundary conditions, or introduce nonlinear coefficients, and there no 
longer are analytical solutions. 

If mathematical analysis of PDEs is your goal, FiPy probably isn't the tool for 
you. 

> On May 23, 2017, at 1:08 PM, Sergio Manzetti <sergio.manze...@fjordforsk.no> 
> wrote: 
> 
> Yes, just the first. But I am still not familiar with the point of numerical 
> simulations, I have bought a book on it, and read a few papers, but they all 
> don't explain the core intention of numerical sims: 
> 
> If it is not to solve the PDE, what is the point of inserting a 
> trial-function unless it has some analytical validity (thus analytical method 
> is required anyway), and therefore what is the real gain of getting a plot of 
> a numerical representation of the change of the solution during a given time 
> frame? 
> 
> If there was an example as simple as "one box of apples of 24 apples times 
> two makes 48 apples" to illustrate what we can get out of a numerical sim, 
> that would be excellent. But also that is difficult to find, even on google. 
> 
> Thanks! 
> Sergio 
> 
> Sergio Manzetti 
> 
> 
> 
> Fjordforsk AS 
> Midtun 
> 6894 Vangsnes 
> Norge 
> Org.nr. 911 659 654 
> Tlf: +47 57695621 
> Økolab | Nanofactory | AQ-Lab | FAP 
> 
> 
> From: "jonathan guyer" <jonathan.gu...@nist.gov> 
> To: "fipy" <FIPY@nist.gov> 
> Sent: Tuesday, May 23, 2017 5:04:59 PM 
> Subject: Re: Complex conjugates in FiPY 
> 
> Have you worked through the examples on our website and in our manual? 
> 
> > On May 23, 2017, at 9:58 AM, Sergio Manzetti 
> > <sergio.manze...@fjordforsk.no> wrote: 
> > 
> > Dear Jonathan. Thank your for this clarification. Can you recommend me a 
> > tutorial or a paper of numerical simuation which shows the use of the 
> > numerical output (plots or other data)? 
> > 
> > Thanks 
> > 
> > Sergio 
> > 
> > 
> > Sergio Manzetti 
> > 
> > 
> > 
> > Fjordforsk AS 
> > Midtun 
> > 6894 Vangsnes 
> > Norge 
> > Org.nr. 911 659 654 
> > Tlf: +47 57695621 
> > Økolab | Nanofactory | AQ-Lab | FAP 
> > 
> > 
> > From: "jonathan guyer" <jonathan.gu...@nist.gov> 
> > To: "fipy" <FIPY@nist.gov> 
> > Sent: Tuesday, May 23, 2017 3:34:51 PM 
> > Subject: Re: Complex conjugates in FiPY 
>

Re: Complex conjugates in FiPY

2017-05-24 Thread Sergio Manzetti
Thanks for this. My initial intention was mathematical analysis of solutions 
yes, of rogue waves. However, the rogue waves are developed from the non linear 
Schrödinger equation with complex coefficients, both in homogenous and 
non-homogenous variants. The solutions existing are analytical, however 
variations of these PDEs, with also higher order derivatives are of interest to 
the analytical PDE field. So I wanted to understand numerical simulations. From 
FiPY I see that the output is the result of importance, and not the animation 
itself. Therefore I can pursue FiPY further, for other non-complex forms of 
these wave equations. 

I will get back in the future with more queries, as I now see that FiPY is 
useful! 

Thanks, and I hope to participate on some webinar! 

Best wishes 


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: "jonathan guyer" <jonathan.gu...@nist.gov> 
To: "fipy" <FIPY@nist.gov> 
Sent: Tuesday, May 23, 2017 10:09:44 PM 
Subject: Re: Complex conjugates in FiPY 

In (intentionally) provocative terms, PDEs with analytical solutions aren't 
good for anything. 

If I want to develop a qualitative understanding of the neutron flux and 
temperature in a nuclear reactor, I can make considerable headway with Bessel 
functions in cylindrically symmetric coordinates and a piece of paper. If I 
want to understand in detail which coolant channels and where in a real reactor 
are most likely to develop boiling conditions that choke off flow and cause 
neighboring fuel elements to melt, then I need a numerical simulation of a 
coupled set of PDEs governing neutron generation and absorption, multi-phase 
fluid flow, heat transport and generation, phase transformation of fuel, 
matrix, and cladding materials, and so on and so on. 

More simplistically, our first example demonstrates several cases of diffusion 
in 1D for basic reason that there are analytical solutions to validate against 
and many people have seen them before. Increase the number of dimensions, alter 
the boundary conditions, or introduce nonlinear coefficients, and there no 
longer are analytical solutions. 

If mathematical analysis of PDEs is your goal, FiPy probably isn't the tool for 
you. 

> On May 23, 2017, at 1:08 PM, Sergio Manzetti <sergio.manze...@fjordforsk.no> 
> wrote: 
> 
> Yes, just the first. But I am still not familiar with the point of numerical 
> simulations, I have bought a book on it, and read a few papers, but they all 
> don't explain the core intention of numerical sims: 
> 
> If it is not to solve the PDE, what is the point of inserting a 
> trial-function unless it has some analytical validity (thus analytical method 
> is required anyway), and therefore what is the real gain of getting a plot of 
> a numerical representation of the change of the solution during a given time 
> frame? 
> 
> If there was an example as simple as "one box of apples of 24 apples times 
> two makes 48 apples" to illustrate what we can get out of a numerical sim, 
> that would be excellent. But also that is difficult to find, even on google. 
> 
> Thanks! 
> Sergio 
> 
> Sergio Manzetti 
> 
> 
> 
> Fjordforsk AS 
> Midtun 
> 6894 Vangsnes 
> Norge 
> Org.nr. 911 659 654 
> Tlf: +47 57695621 
> Økolab | Nanofactory | AQ-Lab | FAP 
> 
> 
> From: "jonathan guyer" <jonathan.gu...@nist.gov> 
> To: "fipy" <FIPY@nist.gov> 
> Sent: Tuesday, May 23, 2017 5:04:59 PM 
> Subject: Re: Complex conjugates in FiPY 
> 
> Have you worked through the examples on our website and in our manual? 
> 
> > On May 23, 2017, at 9:58 AM, Sergio Manzetti 
> > <sergio.manze...@fjordforsk.no> wrote: 
> > 
> > Dear Jonathan. Thank your for this clarification. Can you recommend me a 
> > tutorial or a paper of numerical simuation which shows the use of the 
> > numerical output (plots or other data)? 
> > 
> > Thanks 
> > 
> > Sergio 
> > 
> > 
> > Sergio Manzetti 
> > 
> > 
> > 
> > Fjordforsk AS 
> > Midtun 
> > 6894 Vangsnes 
> > Norge 
> > Org.nr. 911 659 654 
> > Tlf: +47 57695621 
> > Økolab | Nanofactory | AQ-Lab | FAP 
> > 
> > 
> > From: "jonathan guyer" <jonathan.gu...@nist.gov> 
> > To: "fipy" <FIPY@nist.gov> 
> > Sent: Tuesday, May 23, 2017 3:34:51 PM 
> > Subject: Re: Complex conjugates in FiPY 
>

Re: Complex conjugates in FiPY

2017-05-23 Thread Guyer, Jonathan E. Dr. (Fed)
In (intentionally) provocative terms, PDEs with analytical solutions aren't 
good for anything.

If I want to develop a qualitative understanding of the neutron flux and 
temperature in a nuclear reactor, I can make considerable headway with Bessel 
functions in cylindrically symmetric coordinates and a piece of paper. If I 
want to understand in detail which coolant channels and where in a real reactor 
are most likely to develop boiling conditions that choke off flow and cause 
neighboring fuel elements to melt, then I need a numerical simulation of a 
coupled set of PDEs governing neutron generation and absorption, multi-phase 
fluid flow, heat transport and generation, phase transformation of fuel, 
matrix, and cladding materials, and so on and so on.

More simplistically, our first example demonstrates several cases of diffusion 
in 1D for basic reason that there are analytical solutions to validate against 
and many people have seen them before. Increase the number of dimensions, alter 
the boundary conditions, or introduce nonlinear coefficients, and there no 
longer are analytical solutions.

If mathematical analysis of PDEs is your goal, FiPy probably isn't the tool for 
you.

> On May 23, 2017, at 1:08 PM, Sergio Manzetti <sergio.manze...@fjordforsk.no> 
> wrote:
> 
> Yes, just the first. But I am still not familiar with the point of numerical 
> simulations, I have bought a book on it, and read a few papers, but they all 
> don't explain the core intention of numerical sims:
> 
> If it is not to solve the PDE, what is the point of inserting a 
> trial-function unless it has some analytical validity (thus analytical method 
> is required anyway), and therefore what is the real gain of getting a plot of 
> a numerical representation of the change of the solution during a given time 
> frame?
> 
> If there was an example as simple as "one box of apples of 24 apples times 
> two makes 48 apples" to illustrate what we can get out of a numerical sim, 
> that would be excellent. But also that is difficult to find, even on google.
> 
> Thanks!
> Sergio
> 
> Sergio Manzetti
> 
> 
> 
> Fjordforsk AS 
> Midtun
> 6894 Vangsnes
> Norge
> Org.nr. 911 659 654
> Tlf: +47 57695621
> Økolab  |  Nanofactory  |  AQ-Lab  |  FAP
> 
> 
> From: "jonathan guyer" <jonathan.gu...@nist.gov>
> To: "fipy" <FIPY@nist.gov>
> Sent: Tuesday, May 23, 2017 5:04:59 PM
> Subject: Re: Complex conjugates in FiPY
> 
> Have you worked through the examples on our website and in our manual?
> 
> > On May 23, 2017, at 9:58 AM, Sergio Manzetti 
> > <sergio.manze...@fjordforsk.no> wrote:
> > 
> > Dear Jonathan. Thank your for this clarification.  Can you recommend me a 
> > tutorial or a paper of numerical simuation which shows the use of the 
> > numerical output (plots or other data)?
> > 
> > Thanks
> > 
> > Sergio
> > 
> > 
> > Sergio Manzetti
> > 
> > 
> > 
> > Fjordforsk AS 
> > Midtun
> > 6894 Vangsnes
> > Norge
> > Org.nr. 911 659 654
> > Tlf: +47 57695621
> > Økolab  |  Nanofactory  |  AQ-Lab  |  FAP
> > 
> > 
> > From: "jonathan guyer" <jonathan.gu...@nist.gov>
> > To: "fipy" <FIPY@nist.gov>
> > Sent: Tuesday, May 23, 2017 3:34:51 PM
> > Subject: Re: Complex conjugates in FiPY
> > 
> > > On May 23, 2017, at 8:05 AM, Sergio Manzetti 
> > > <sergio.manze...@fjordforsk.no> wrote:
> > > 
> > > 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?
> > 
> > Setting phi before solving the PDE is setting the initial condition. FiPy 
> > is designed to ***numerically*** solve time-evolving PDEs.
> > 
> > 
> > ___
> > 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 ]
> 
> 
> ___
> 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 ]


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


Re: Complex conjugates in FiPY

2017-05-23 Thread Guyer, Jonathan E. Dr. (Fed)
Have you worked through the examples on our website and in our manual?

> On May 23, 2017, at 9:58 AM, Sergio Manzetti <sergio.manze...@fjordforsk.no> 
> wrote:
> 
> Dear Jonathan. Thank your for this clarification.  Can you recommend me a 
> tutorial or a paper of numerical simuation which shows the use of the 
> numerical output (plots or other data)?
> 
> Thanks
> 
> Sergio
> 
> 
> Sergio Manzetti
> 
> 
> 
> Fjordforsk AS 
> Midtun
> 6894 Vangsnes
> Norge
> Org.nr. 911 659 654
> Tlf: +47 57695621
> Økolab  |  Nanofactory  |  AQ-Lab  |  FAP
> 
> 
> From: "jonathan guyer" <jonathan.gu...@nist.gov>
> To: "fipy" <FIPY@nist.gov>
> Sent: Tuesday, May 23, 2017 3:34:51 PM
> Subject: Re: Complex conjugates in FiPY
> 
> > On May 23, 2017, at 8:05 AM, Sergio Manzetti 
> > <sergio.manze...@fjordforsk.no> wrote:
> > 
> > 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?
> 
> Setting phi before solving the PDE is setting the initial condition. FiPy is 
> designed to ***numerically*** solve time-evolving PDEs.
> 
> 
> ___
> 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 ]


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


Re: Complex conjugates in FiPY

2017-05-23 Thread Sergio Manzetti
Thanks Daniel, I will try the latter example. 

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: Tuesday, May 23, 2017 4:03:32 PM 
Subject: Re: Complex conjugates in FiPY 

On Tue, May 23, 2017 at 8:05 AM, Sergio Manzetti 
<sergio.manze...@fjordforsk.no> wrote: 
> 
> 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. 

Right, FiPy knows nothing about complex numbers. 

> However, if I should calculate the given eqn without the complex conjugate: 
> 
> dphi/dt + d²phi/dx^2 + |phi^2|phi = 0 

That is a strange equation because it induces counter diffusion, which 
probably won't solve. I'm not sure whether the source term does 
something to counter that, but you can try. 

> which example should I follow in the manuscript? 

There isn't an example that matches this equation exactly, but try 

http://www.ctcms.nist.gov/fipy/examples/diffusion/generated/examples.diffusion.mesh1D.html
 

for the TransientTerm and DiffustionTerm and 

http://www.ctcms.nist.gov/fipy/examples/phase/generated/examples.phase.simple.html
 

for the ImplicitSourceTerm. 

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

Setting the value before solving the PDEs provide the initial value if 
it's an initial value problem. Even a non-initial value problem needs 
to be start somewhere for the non-linear numerical iteration. 


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


Re: Complex conjugates in FiPY

2017-05-23 Thread Daniel Wheeler
On Tue, May 23, 2017 at 8:05 AM, Sergio Manzetti
 wrote:
>
> 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.

Right, FiPy knows nothing about complex numbers.

> However, if I should calculate the given eqn without the complex conjugate:
>
>  dphi/dt + d²phi/dx^2 + |phi^2|phi = 0

That is a strange equation because it induces counter diffusion, which
probably won't solve. I'm not sure whether the source term does
something to counter that, but you can try.

> which example should I follow in the manuscript?

There isn't an example that matches this equation exactly, but try


http://www.ctcms.nist.gov/fipy/examples/diffusion/generated/examples.diffusion.mesh1D.html

for the TransientTerm and DiffustionTerm and


http://www.ctcms.nist.gov/fipy/examples/phase/generated/examples.phase.simple.html

for the ImplicitSourceTerm.

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

Setting the value before solving the PDEs provide the initial value if
it's an initial value problem. Even a non-initial value problem needs
to be start somewhere for the non-linear numerical iteration.


-- 
Daniel Wheeler

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


Re: Complex conjugates in FiPY

2017-05-23 Thread Guyer, Jonathan E. Dr. (Fed)

> On May 23, 2017, at 8:05 AM, Sergio Manzetti  
> wrote:
> 
> 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?

Setting phi before solving the PDE is setting the initial condition. FiPy is 
designed to ***numerically*** solve time-evolving PDEs.


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


Re: Complex conjugates in FiPY

2017-05-23 Thread Guyer, Jonathan E. Dr. (Fed)

> On May 23, 2017, at 8:09 AM, Sergio Manzetti  
> wrote:

> Were can one find the function that results as the solution to the given PDE 
> in FiPY?  For isntance, if this solution was phi = sec²(x) can FiPY print it 
> out?

No. FiPy is a numerical PDE solver. It knows nothing about your analytical 
solution.


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


Re: Complex conjugates in FiPY

2017-05-23 Thread Sergio Manzetti
Dear Daniel, 

This is the current script referred to in the previous email, where I have 
removed the phi.set value for phi. 

Were can one find the function that results as the solution to the given PDE in 
FiPY? For isntance, if this solution was phi = sec²(x) can FiPY print it out? 

Thanks 

Sergio 




dphi/dt + d^2phi/dx² + |phi|² phi = 0 

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


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 ]


Re: Complex conjugates in FiPY

2017-05-23 Thread Sergio Manzetti
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 ]


Re: Complex conjugates in FiPY

2017-05-22 Thread Daniel Wheeler
On Sat, May 20, 2017 at 5:02 AM, Sergio Manzetti
 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 ]