Anders - You should be able to do
x = mesh.x[(phi == 0.5).value] or x = mesh.cellCenters[0, (phi == 0.5).value] or x = mesh.cellCenters[0][(phi == 0.5).value] Note: if you're doing something like a phase field or level set model you may find that phi isn't exactly 0.5, so you may want to make your test something like ((phi > 0.4) * (phi < 0.6)).value - Jon > On Feb 9, 2017, at 9:40 AM, Anders Ericsson <[email protected]> > wrote: > > Hi, > > I am wondering if there is an equivalent to Variable.setValue(value, where) > that can be used to get a value, e.g. Variable.getValue(where = (x > 30)), > or if there is another neat way of achieving this without looping over > indexes. > > I would like to use it to get the spatial position where a variable has a > certain value, i.e. something like: > x = mesh.cellCenters[0].getValue( where = (phi == 0.5)). > > I have looked through the FiPy API variable section without success, so any > help is much appreciated. > > Thanks and best regards, > Anders > _______________________________________________ > 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 ]
