On Sun, Mar 03, 2013 at 06:54:34PM -0500, Adam Stone wrote: > I'm trying to implement a rough approximation of material removal during > heating. What I tried first was to insert this into the iteration loop > after solving for the temperature distribution: > > T.setValue(0, where=(T > threshold)) > T.faceGrad.constrain(((0,),(0,)), where=(T > threshold)) > > The intent was to set all the faces of the cells where (T > threshold) > to a no-flux condition, in order to create the effect of the flat > boundary becoming concave as material is removed. But I get a > ValueError: shape mismatch: objects cannot be broadcast to a single shape.
Gradients are defined on faces. You could use T.faceGrad.constrain(((0,),(0,)), where=(T.faceValue > threshold)) which interpolates T on the faces. >From my relatively short experience, constrain will work even in the domain. Wether it is a good approach is dependent on the problem. > I imagine that the problem is either that faceGrad.constrain needs a set > of faces whereas (T > threshold) is giving a set of cells, or that > faceGrad.constrain only works for faces at the edges of the mesh. > Looking at the documentation, it seems like for internal boundary > conditions I may need to manipulate the equation using extra source > terms and masks. But in this case I want a fixed flux condition (no flux > through those cells) rather than a fixed value as the example instructs. > Is there any way to achieve this? > > Thanks, > Adam _______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
