Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solving complex PDEs in Python with FiPY

Tags:

python

pde

fipy

I'm attempting to solve a complex PDE with FiPy. It would appear that FiPY does not support complex arguments and the general advice seems to be to split the PDE, solve separately and then recombine. Is this still the case?

Secondly, I can't see any way to set non constant initial conditions. Suppose I'd like to have my mesh not have an identical value in every cell, is there a simpler way to do that other than using setValue?

Thank you.

like image 504
Ashiataka Avatar asked Sep 12 '26 08:09

Ashiataka


1 Answers

FiPy does not support complex arguments, but it does support solving for vectors, which might simplify your task a bit.

See the latter part of this coupled Cahn-Hilliard simulation.

It's certainly possible to set non-uniform initial conditions. See: examples/cahnHilliard/mesh2DCoupled.py for how to set the initial condition to a random field or examples/diffusion/electrostatics.py and and just about anything in examples/phase/ for how to set the initial condition based on coordinates. As you can see in those examples, there are a couple of different syntaxes that work, but setValue() is a perfectly legitimate way to do it.

like image 66
jeguyer Avatar answered Sep 13 '26 22:09

jeguyer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!