bcb2wh202 | 2 Jul 19:59

Simulating complex PDEs


Hi,

A beginner's question: I have a set of coupled partial differential
equations which I feel that I am close to dealing with in FiPy,
except that they are in phasor form (that is, they have complex-valued
variables).  When I try introducing a source term with complex-typed
coefficient or a variable, initialized with a non-zero imaginary
part, I get this error:

   TypeError: array cannot be safely cast to required type

Is FiPy capable of solving such equations in their complex form?
If not, is the best alternative just splitting each equation into
a pair of coupled equations for the real and imaginary parts of the
complex variable?  I'm guessing that this would be essentially
equivalent to solving any other sets of coupled differential
equations.

(For concreteness, the equations are roughly of this form:

eq1 = TransientTerm(coeff = 1) - VanLeerConvectionTerm(coeff =
(-vg,),diffusionTerm = diffTerm) -  ImplicitSourceTerm(coeff =
-alpha) - ImplicitSourceTerm(coeff=gB*Ip)

except that the (constant) Ip in the last source term will have to
be changed to the product of two other variables.)

Any advice is appreciated.

(Continue reading)

Jonathan Guyer | 2 Jul 20:58

Re: Simulating complex PDEs


On Jul 2, 2008, at 2:03 PM, bcb2wh202@... wrote:

> Is FiPy capable of solving such equations in their complex form?

Well... it certainly doesn't surprise me that it doesn't work. We've  
never tested this usage and I don't think the sparse matrix libraries  
we depend on have support for complex values.

> If not, is the best alternative just splitting each equation into
> a pair of coupled equations for the real and imaginary parts of the
> complex variable?  I'm guessing that this would be essentially
> equivalent to solving any other sets of coupled differential
> equations.

This is how we solve vector PDEs in other cases, so yes, I think  
that's the right approach.


Gmane