On Sep 27, 2013, at 5:12 AM, Damian Kösters <[email protected]> wrote:
> these are the errors I ran into: > > 1) > Traceback (most recent call last): > File "damian_mail.py", line 47, in <module> > phi.constrain(phi.value[bacteria5], where=bacteria2) > IndexError: unsupported iterator index Expected. See http://matforge.org/fipy/ticket/479. > 2) I included > >>>phi.constrain(phi[bacteria5.value], where=bacteria2) > before > >>>viewer = Viewer(vars=phi, datamin=0., datamax=2.) > and never got beyond this line. (It didnt give me an error within two > minutes…) That needs to be phi.value[bacteria5.value], not phi[bacteria5.value]. As it stands, the constraint is that the value at bacteria2 should be the instantaneous value of phi at bacteria5. To determine this, FiPy has to get the field of current values, then apply all constraints and return the result. You have a constraint that depends on all constraints (including itself) and it goes into an infinite loop. > 3) I also tried > >>>phi.constraints[2].value = phi.value[bacteria5] > before > >>>eq.solve(var=phi,dt=timeStepDuration) > Execution of eq.solve also never finished. (Again without giving me a > RuntimeError this time…) Hmmm. That should just give you the "IndexError: unsupported iterator index" like case 1. >>> phi.constraints[2].value = phi.value[bacteria5.value] should work and >>> phi.constraints[2].value = phi[bacteria5.value] should give you an infinite loop like case 2. > * What I would also be interested in is deleting a constraint. I am not sure > how release() works in this context, because I didn't store my constraints in > variables. You need to store your constraints in explicit Constraint objects. See: http://www.ctcms.nist.gov/fipy/fipy/generated/fipy.variables.html#fipy.variables.Variable.release http://www.ctcms.nist.gov/fipy/fipy/generated/fipy.variables.html#fipy.variables.CellVariable.release You can try to manipulate the internal list of phi.constraints, but I wouldn't recommend it. For that matter, the `phi.constraints[2].value =` business I showed you earlier is a bad idea because it depends on a fragile list ordering that you should not depend on. Define a Constraint here, too, and reset its value at your whim. _______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
