On Sun, Mar 3, 2013 at 6:54 PM, Adam Stone <[email protected]> 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))
>

As you pointed out below, face constraints only work for external faces.
They have no effect on the fluxes across internal faces.


>
> 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.
>

> 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?
>

To achieve this, make the diffusion coefficient dependent on T. Something
like this,

   newDiffCoeff = oldDiffCoeff * (T < threshold)

You can also use the "newDiffCoeff.harmonicFaceValue" as the diffusion
coefficient if you want to ensure that there is zero flux through the faces
when the cell values on one or both sides of the face exceed the
"threshold" value.

-- 
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