On Wed, Nov 7, 2012 at 1:43 PM, Julien Derr <[email protected]> wrote:

> Hi everyone,


> I am using constrain in a syntax like
> c.constrain(1., where=facesOutside)
>
> If I want to release the constrain, Is it possible? how can I do this ?
>

Hi Julien,

Yes this is possible. There is a method of the Variable class called
"release". All this does is remove the constraint from the variables list
of constraints. One issue in the case above it getting a handle on the
actual constraint. You'll need to use the "faceConstraints" list to do
this. The following will probably deal with your issue.

  > import fipy as fp
  > m = fp.Grid1D()
  > v = fp.CellVariable(mesh=m)
  > v.constrain(1., where=m.facesLeft)
  > print v.faceValue
  [ 1.  0.]
  > v.release(v.faceConstraints[0])
  > print v.faceValue
  [ 0.  0.]

It might be better if "constrain" returned a reference to the actual
constraint rather than using the "faceConstraints" attribute to get the
reference, but at least for now it works as described above.

Cheers

-- 
Daniel Wheeler
_______________________________________________
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