Thanks Jonathan,

I implemented this :

X, Y = mesh.getFaceCenters()
XX = FaceVariable(mesh=mesh, value=X)
YY = FaceVariable(mesh=mesh, value=Y)
facesOutside =  ((XX-CX)**2+(YY-CY)**2 >= CX*CY -0.1 )
BCs=(c.constrain(1., where=facesOutside))

but I still get an error,

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

/home/julien/Dropbox/allinonelevelset/levelset.py in <module>()
    187         advectionEquation.solve(phi, dt=dt)
    188
--> 189         ceq.solve(var=c, dt=dt,boundaryConditions=BCs)
    190         title='snapt'+str(step+10000)+'.png'
    191         #savefig(title,transparent=True)


/usr/local/lib/python2.6/dist-packages/FiPy-2.2_dev-py2.6.egg/fipy/terms/term.pyc
in solve(self, var, solver, boundaryConditions, dt)
    189         """
    190
--> 191         solver = self._prepareLinearSystem(var, solver,
boundaryConditions, dt)
    192
    193         solver._solve()

/usr/local/lib/python2.6/dist-packages/FiPy-2.2_dev-py2.6.egg/fipy/terms/term.pyc
in _prepareLinearSystem(self, var, solver, boundaryConditions, dt)
    155         solver = self.getDefaultSolver(solver)
    156
--> 157         self.__buildMatrix(var, solver, boundaryConditions, dt)
    158
    159         if os.environ.has_key('FIPY_DISPLAY_MATRIX'):

/usr/local/lib/python2.6/dist-packages/FiPy-2.2_dev-py2.6.egg/fipy/terms/term.pyc
in __buildMatrix(self, var, solver, boundaryConditions, dt)
    130
    131         for bc in boundaryConditions:
--> 132             bc._resetBoundaryConditionApplied()
    133
    134         if os.environ.has_key('FIPY_DISPLAY_MATRIX'):

AttributeError: 'NoneType' object has no attribute
'_resetBoundaryConditionApplied'
WARNING: Failure executing file: <levelset.py>



humm, any  ideas ?  thaks a gain,

Julien







On Fri, Apr 1, 2011 at 9:57 PM, Jonathan Guyer <[email protected]> wrote:

>
>
> On Apr 1, 2011, at 9:46 AM, Julien Derr wrote:
>
> > I have a 2D grid, but I would like to have the exterior to be in a
> circular geometry. with a boundary condition c=1 at the exterior, so on the
> exterior circle
> >
> > Naively I wrote this few lines to set the concentration c=1 everywhere
> out of this big circle of radius CX:
> >
> > X, Y = mesh.getFaceCenters()
> > facesOutside =  ((X-CX)**2+(Y-CX)**2 >= CX*CX )
> > BCs = (FixedValue(faces=facesOutside, value=1))
> >
> >
> > and I get the error
>
> > AttributeError: 'numpy.ndarray' object has no attribute 'mesh'
> > WARNING: Failure executing file: <levelset.py>
>
> This error is because X and Y are just numpy arrays and not FaceVariables.
> That will be remedied some day, but in the meantime, you can do:
>
>  X = FaceVariable(mesh=mesh, value=X)
>  Y = FaceVariable(mesh=mesh, value=Y)
>
> However, you will then provoke the error:
>
>  IndexError: Face list has interior faces
>
>
> FiPy is not designed or tested for boundary conditions internal to the
> mesh.
>
>
> On trunk, you can write
>
>  phi.constrain(1., where=facesOutside)
>
> without error, but solving with this constraint is still an untested
> situation.
>
>
>
>

Reply via email to