Hi, FiPy.

So I would like to check to see if my code is doing what I think it is.

Here is the code:

#param. and mesh
cellSize=0.05
radius=1.
radiusI=radius/3
rMid=(radius+radiusI)/2
from fipy import *
from numpy import *
mesh = Gmsh2D('''cellSize = %(cellSize)g;
        radius = %(radius)g;
        radiusI=%(radiusI)g;
        Point(1) = {0, 0, 0, cellSize};
        Point(2) = {radius, 0, 0, cellSize};
        Point(3) = {0, radius, 0, cellSize};
        Point(5) = {-radius, 0, 0, cellSize};
        Point(6) = {0, -radius, 0, cellSize};
        Circle(1) = {2, 1, 3};
        Circle(2) = {3, 1, 5};
        Circle(3) = {5, 1, 6};
        Circle(4) = {6, 1, 2};
        Line Loop(1) = {1, 2, 3, 4};
        Point(200) = {radiusI, 0, 0, cellSize};
        Point(300) = {0, radiusI, 0, cellSize};
        Point(500) = {-radiusI, 0, 0, cellSize};
        Point(600) = {0,-radiusI, 0, cellSize};
        Circle(100) = {200, 1, 300};
        Circle(200) = {300, 1, 500};
        Circle(300) = {500, 1, 600};
        Circle(400) = {600, 1, 200};
        Line Loop(100) = {100, 200, 300, 400};
        Plane Surface(1)={1,100};
        ''' % locals())
#initial conditions
phi=GaussianNoiseVariable(mesh=mesh,mean=0,variance=1.3)
D=1
L=2.5
eq=TransientTerm()==DiffusionTerm(coeff=D)
X,Y=mesh.faceCenters
innerFaces=(mesh.exteriorFaces & ((X**2+Y**2)**.5 < rMid))
outerFaces=(mesh.exteriorFaces & ((X**2+Y**2)**.5 > rMid))
#boundary conditions
phi.faceGrad.constrain(((1/L)*sin(2*(phi.faceValue))/2)*mesh._faceNormals,where=outerFaces)
phi.faceGrad.constrain((-(1/L)*sin(2*(phi.faceValue))/2)*mesh._faceNormals,where=innerFaces)
#solver
timeStepDuration=10*0.9*cellSize**2/(2*D)
steps=50
for step in range(steps):
    eq.solve(var=phi,dt=timeStepDuration)

My problem is the following:

Attachment: problem.pdf
Description: Adobe PDF document


Sorry for a possible notation confusion here, phi in my code is alpha in the problem description above.

My question:
Have I appropriately translated my problem into FiPy language?

Thanks, ahead of time and for all the help thus far.

Best, 
Kyle

On Nov 24, 2014, at 12:55 PM, Daniel Wheeler <[email protected]> wrote:

http://nbviewer.ipython.org/gist/wd15/f04b22c6ec80b1eda8e3

_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to