Hi Daniel,

I implemented your solution which works fine. But I find a conflict with the
level set interface.

I used a custom class to set this value through explicit term only at the
interface:
It works fine, at the interface, but for some reason it also set the value
at the edge of the mesh !!! is there a reason why the end of the mesh would
have the same property as the interface?
does the self.distanceVar._cellInterfaceFlag   Flag is also one at the
outside edge of the mesh ??

I am really confused!

Julien




class _CUSTOMMetalIonSourceVariableEXPLICIT(CellVariable):

    def __init__(self, ionVar = None, distanceVar = None, depositionRate =
None, metalIonMolarVolume = None):

        CellVariable.__init__(self, distanceVar.mesh, hasOld = 0)
        self.ionVar = self._requires(ionVar)
        self.distanceVar = self._requires(distanceVar)
        self.depositionRate = self._requires(depositionRate)
        self.metalIonMolarVolume = metalIonMolarVolume

    def _calcValue(self):
        ionVar = numerix.array(self.ionVar)
        ionVar = numerix.where(ionVar > 1e-20, ionVar, 1e-20)
    value=0.7
    #this is the absorbing boundary used before + a source term  explicit
term, email from Daniel dated july 12,2011
    return self.distanceVar._cellInterfaceFlag * 1e+20  * value







On Thu, Jul 14, 2011 at 5:16 PM, Daniel Wheeler
<[email protected]>wrote:

>
> On Thu, Jul 14, 2011 at 10:44 AM, Julien Derr <[email protected]>
> wrote:
> > reoups.. actually, if you could mind ... I tried this implementation,
> >
> >     return self.distanceVar._cellInterfaceFlag * 1e+20 * (self.ionvar() -
> > 0.1)
> >
> > where 0.1 would be the value I want at the boundary... and ionvar is
> > supposed to represent the diffusing field I guess ...
> >
> > but get the error :
> >
> > AttributeError: '_CUSTOMMetalIonSourceVariable' object has no attribute
> > 'ionvar'
>
> Is ionvar defined anywhere as an attribute of
> '_CUSTOMMetalIonSourceVariable'? Regardless of the error, I don't
> believe your implementation will achieve what you want as you aren't
> using an ImplicitSourceTerm. You need both an implicit and explicit
> source term to fix the value of a cells in a given location. Something
> like this
>
>  >>> x = mesh.cellCenters ## mesh.getCellCenters() for older fipy
>  >>> myRegularEqn + ImplicitSourceTerm(1e+20 * (x > 3)) - 1e-20 * (x
> > 3) * value == 0
>
> This would set the value of the variable to be `value` where x > 3.
>
> --
> Daniel Wheeler
>
>
>

Reply via email to