http://www.ctcms.nist.gov/fipy/index.html
FiPy is an object oriented, partial differential equation (PDE) solver, written in Python, based on a standard finite volume (FV) approach. The framework has been developed in the Materials Science and Engineering Division (MSED) and Center for Theoretical and Computational Materials Science (CTCMS), in the Material Measurement Laboratory (MML) at the National Institute of Standards and Technology (NIST).
The solution of coupled sets of PDEs is ubiquitous to the numerical simulation of science problems. Numerous PDE solvers exist, using a variety of languages and numerical approaches. Many are proprietary, expensive and difficult to customize. As a result, scientists spend considerable resources repeatedly developing limited tools for specific problems. Our approach, combining the FV method and Python, provides a tool that is extensible, powerful and freely available. A significant advantage to Python is the existing suite of tools for array calculations, sparse matrices and data rendering.
The FiPy framework includes terms for transient diffusion, convection and standard sources, enabling the solution of arbitrary combinations of coupled elliptic, hyperbolic and parabolic PDEs. Currently implemented models include phase field [BoettingerReview:2002] [ChenReview:2002] [McFaddenReview:2002] treatments of polycrystalline, dendritic, and electrochemical phase transformations as well as a level set treatment of the electrodeposition process[NIST:damascene:2001].
If you use FiPy in your research, please cite: (bibtex) (endnote) (pdf)
J. E. Guyer, D. Wheeler & J. A. Warren, "FiPy: Partial Differential Equations with Python," Computing in Science & Engineering 11(3) pp. 6—15 (2009), doi:10.1109/MCSE.2009.52
, http://www.ctcms.nist.gov/fipy
About FiPy Installation FiPy Usage Examples FAQs License |
Numerical Approach FiPy Design FiPy API Credits Publications |
Superconformal Electrodeposition |
Virtual Kinetics of Materials Laboratory |
Download Source Code |
wiki Reporting Bugs |
Global Module Index General Index Glossary |
Search Page Complete Table of Contents References |
一个求解Cahn-Hilliard方程的实例:
http://www.ctcms.nist.gov/fipy/examples/cahnHilliard/generated/examples.cahnHilliard.mesh2D.html
The spinodal decomposition phenomenon is a spontaneous separation of an initially homogenous mixture into two distinct regions of different properties (spin-up/spin-down, component A/component B). It is a “barrierless” phase separation process, such that under the right thermodynamic conditions, any fluctuation, no matter how small, will tend to grow. This is in contrast to nucleation, where a fluctuation must exceed some critical magnitude before it will survive and grow. Spinodal decomposition can be described by the “Cahn-Hilliard” equation (also known as “conserved Ginsberg-Landau” or “model B” of Hohenberg & Halperin)
where is a conserved order parameter, possibly representing alloy composition or spin. The double-well free energy function penalizes states with intermediate values of between 0 and 1. The gradient energy term , on the other hand, penalizes sharp changes of . These two competing effects result in the segregation of into domains of 0 and 1, separated by abrupt, but smooth, transitions. The parameters and determine the relative weighting of the two effects and is a rate constant.
We can simulate this process in FiPy with a simple script:
(Note that all of the functionality of NumPy is imported along with FiPy, although much is augmented for FiPy‘s needs.)
We start the problem with random fluctuations about
FiPy doesn’t plot or output anything unless you tell it to:
For FiPy, we need to perform the partial derivative manually and then put the equation in the canonical form by decomposing the spatial derivatives so that each Term is of a single, even order:
FiPy would automatically interpolate D * a**2 * (1 - 6 * phi * (1 - phi)) onto the faces, where the diffusive flux is calculated, but we obtain somewhat more accurate results by performing a linear interpolation from phi at cell centers to PHI at face centers. Some problems benefit from non-linear interpolations, such as harmonic or geometric means, and FiPy makes it easy to obtain these, too.
Because the evolution of a spinodal microstructure slows with time, we use exponentially increasing time steps to keep the simulation “interesting”. The FiPy user always has direct control over the evolution of their problem.