Daniel, Thank you for the helpful example. I understand what I would like to model, but I am somewhat intimidated by FiPy or Python because I do not have a background in any programming language, so I am proceeding step by step.
Regards, Ryan On Fri, Dec 4, 2009 at 10:28 AM, Daniel Wheeler <[email protected]>wrote: > > On Thu, Dec 3, 2009 at 12:21 PM, Ryan Paul <[email protected]> wrote: > > Hello, > > > > I am a graduate student who has just discovered FiPy, and I am working > > through the helpful examples. However, I am uncertain how to describe an > > initial microstructure using FiPy (e.g. spherical particles randomly > > dispersed in a matrix). > > What exactly is the issue? Is the problem writing down the initial > conditions in maths or translating the initial conditions into code? > Of the top of my head, you probably need something like this: > > var[:] = 0 > for i in range(numberOfParticles): > a = random.random() * L > b = random,random() * L > r = random.random() * L / 20.0 > var[((x - a)**2 + (y - b)**2) < r] = 1 > > if the domain size is L * L and maximum radius is L / 20 for example. > Of course, this will give a flat distribution of radii, there are > other kinds of distributions either in scipy and numpy. > > Hope this helps. > > Cheers > > -- > Daniel Wheeler > >
