Hello,
yes, running the constraint on the cellvariable phi was indeed the
solution. I got lost a bit this morning...
Now I was trying to release the constraint and got a ValueError:
- - -
x, y = mesh.cellCenters[0], mesh.cellCenters[1]
X, Y = mesh.faceCenters[0], mesh.faceCenters[1]
rect2 = (x>9)&(x<22)&(y>50)&(y<100)
crect2 = Constraint(10,rect2 )
phi.constrain(crect2)
if __name__ == '__main__':
viewer = Viewer(vars=phi, datamin=0., datamax=10.)
viewer.plot()
timeStepDuration = 10 * 0.9 * dx**2 / (2 * D)
steps = 20
for step in range(steps):
if step > 10:
phi.constrain(100.0/(step), bacteria2)
phi.release(constraint=crect2)
- - -
Traceback (most recent call last):
File "damian.py", line 66, in <module>
phi.release(constraint=crect2)
File
"/usr/local/lib/python2.7/dist-packages/fipy/variables/cellVariable.py",
line 680, in release
self.faceConstraints.remove(constraint)
ValueError: list.remove(x): x not in list
What is the reason here?
Thank you for your patience, Jonathan.
Kind regards
Damian
2013/9/30 Guyer, Jonathan E. Dr. <[email protected]>
>
> On Sep 30, 2013, at 4:38 AM, Damian Kösters <[email protected]>
> wrote:
>
> > I try now to work with a Constraint object. This doesn't give me an
> error message but I also do not see the rectangle in the plot.
>
> > >>>x, y = mesh.cellCenters[0], mesh.cellCenters[1]
> > >>>X, Y = mesh.faceCenters[0], mesh.faceCenters[1]
> > >>>
> > >>>rect2 = (x>9)&(x<22)&(y>50)&(y<100)
> > >>>
> > >>>crect2 = Constraint(10,rect2 )
> > >>>
> > >>>rect2.constrain(crect2)
>
> Plot of what? This code constrains the boolean mask rect2 to have value of
> 10 where that mask is true (I think).
>
> I think you want phi.constrain(crect2).
>
>
> _______________________________________________
> fipy mailing list
> [email protected]
> http://www.ctcms.nist.gov/fipy
> [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
>
_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
[ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]