Hi,
to get to know fipy I tried to solve the Poisson equation in 2D for two
adjacent rings: one had a constant charge density and the other one was
used as boundary condition \phi=0.
But as I do not really know the charge distribution in the rings I tried
to use another approach by solving the Laplace equation and use both
rings as boundary conditions. But unfortunately my script does not
produce any feasible results unless I specify only FixedValues for the
borders of the plotting area.

I would appreciate it a lot, if someone could help me debug this script:

from fipy import *
nx = 300
dx = 0.05
L = nx * dx
mesh = Grid2D(dx=dx,dy=dx,nx=nx,ny=nx)
x,y = mesh.getCellCenters()
x0,y0 = L/2,L/2
X,Y = mesh.getFaceCenters()

potential = CellVariable(mesh=mesh, name='potential', value=0.)
potential.equation = (DiffusionTerm(coeff = 1.) == 0.)

bcs = (
    FixedValue(value=0.,faces=mesh.getExteriorFaces() & ((
(X-x0-L/4)**2+(Y-y0-L/4)**2<(L/4.)**2 ))),
    FixedValue(value=-5.,faces=mesh.getExteriorFaces() & (
(x-x0)**2+(y-y0)**2<(15*dx)**2 )),
)

potential.equation.sweep(var=potential, boundaryConditions=bcs)
viewer = Viewer(vars=(potential),colorbar=2)
viewer.plot()
raw_input("Press 'Enter' to exit.")

CU andi
-- 
Andreas Hasenkopf
Phone: +49 151 11728439
Homepage: http://www.hasenkopf2000.net
GPG Pub Key: http://goo.gl/4mOsM

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
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