Hi Daniel, What you wrote definitely guided me to the answer. Much thanks! SDE is actually just a PDE with its variable (and initial condition) being in the form of a probability distribution. On 1D mesh at least, fipy seems fully capable of handling that.
On a slightly different note, your lucid explanation of noise variable (as second degree stochasticity) got me working through the examples in those links. Particularly, in < http://www.ctcms.nist.gov/fipy/fipy/generated/variables.html#module-fipy.variables.exponentialNoiseVariable > I may have spotted an error in the module: In short, I noticed that if the mean is set to Variable() -- defaulted to be 0 -- the encapsulating noise variable ("noise" in the example) will generate a *ValueError: scale <= 0* when called upon. Subsequently, feeding it into the viewer will yield * SystemError*: error return without exception set WARNING: Failure executing file: <enoise.py> A look at the exponential equation supports the condition of mean != 0. So does this mean the default mean for ExponentialNoiseVariable is poorly set and requires manual configuration for all future operations? Thanks! On Wed, Jan 4, 2012 at 8:16 AM, Daniel Wheeler <[email protected]>wrote: > > > On Tue, Jan 3, 2012 at 2:59 PM, Yun Tao <[email protected]> wrote: > >> Hi all, >> >> Having just jumped on the Fipy bandwagon, I'm wondering how it fares in >> handling stochastic PDEs. >> > > I don't know a whole lot about stochastic PDEs. We do have some examples > buried in doctests. See the examples in the following: > > < > http://www.ctcms.nist.gov/fipy/fipy/generated/variables.html#module-fipy.variables.uniformNoiseVariable > > > < > http://www.ctcms.nist.gov/fipy/fipy/generated/variables.html#module-fipy.variables.gammaNoiseVariable > > > < > http://www.ctcms.nist.gov/fipy/fipy/generated/variables.html#module-fipy.variables.exponentialNoiseVariable > > > < > http://www.ctcms.nist.gov/fipy/fipy/generated/variables.html#module-fipy.variables.exponentialNoiseVariable > > > < > http://www.ctcms.nist.gov/fipy/fipy/generated/variables.html#module-fipy.variables.gaussianNoiseVariable > > > < > http://www.ctcms.nist.gov/fipy/fipy/generated/variables.html#module-fipy.variables.betaNoiseVariable > > > > None of these include examples that actually solve a PDE, but the noise > variables can be tagged onto terms in the same way as other variables to > form PDEs that include stochastic sources. > > Having gone through multiple examples provided on the website so far, one >> of the major problems I'm facing is the setting of initial condition as a >> probability density function. This step seems to require more than just >> setting the value of CellVariable as a function of >> mesh.getCellCenters()[0]. Any insight? >> > > Would this do for a uniform mesh (for non-uniform meshes you can use the > the noise variables included above)? > > from fipy import Grid1D, CellVariable, numerix, Viewer > m = Grid1D(nx=100) > v = CellVariable(mesh=m) > v[:] = numerix.random.exponential(size=len(v)) > Viewer(v).plot() > raw_input('wait') > > Hope that helps. > > -- > Daniel Wheeler > > _______________________________________________ > fipy mailing list > [email protected] > http://www.ctcms.nist.gov/fipy > [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] > > -- Yun Tao Graduate Group of Ecology Doctoral Candidate Department of Environmental Science and Policy Center for Population Biology University of California, Davis
_______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
