Dear Jonathan and Daniel,

Thank you for suggesting a solution to the problem! Just so I understand:
the anchors are coefficients of source terms that are only non-zero in the
edge cells (left and right respectively) and they allow the problem to be
restated with flux=0 boundary conditions/constraints. It's not quite clear
to me why the huge 1e10 value is also needed?

Out of interest why did the new constraints code have problems with this
example? For example, why does something like this not work?

I_left_BC = I_left.getArithmeticFaceValue()[m.getInteriorFaces()][0]
I_right_BC =  I_right.getArithmeticFaceValue()[m.getInteriorFaces()][-1]
I_right.constrain( A * I_left + C, where=m.getFacesLeft()) # x=0 BC
I_left.constrain(  B * I_right,    where=m.getFacesRight()) # x=D BC

 Is there a way to write this problem using the very clear 'constraints'
way of doing things?

Best wishes,

Dan


On 9 June 2012 00:00, Daniel Wheeler <[email protected]> wrote:

> On Fri, Jun 8, 2012 at 9:59 AM, Jonathan Guyer <[email protected]> wrote:
> >
> >
> > Good question.
> >
> > I've forked your gist at https://gist.github.com/2895662, but I don't
> see any way to show you a diff. What I did is extended the mesh so that the
> boundaries at 0 and D now lie at cell centers and then I used coupled
> ImplicitSourceTerms to apply the coupled boundary conditions.
>
> The anchors should be
>
>   left_anchor = 1e+10 * (x < (dx / 2))
>   right_anchor = 1e+10 * (x > (D - dx / 2))
>
> otherwise two cells are being constrained on the right hand side. If
> the face gradients are constrained, this allows a natural inflow and
> outflow, which seems to get very close to the analytical.
>
>  I_right.faceGrad.constrain(0, m.facesRight)
>  I_left.faceGrad.constrain(0, m.facesLeft)
>
> The diff is this:
>
> 20,24c20,21
> <
> < left_anchor = 1e+10 * (x < (dx / 2))
> < right_anchor = 1e+10 * (x > (D - dx / 2))
> < I_right.faceGrad.constrain(0, m.facesRight)
> < I_left.faceGrad.constrain(0, m.facesLeft)
> ---
> > left_anchor = 1e+10 * (x < dx)
> > right_anchor = 1e+10 * (x > D - dx)
>
> Cheers
>
> --
> Daniel Wheeler
>
> _______________________________________________
> 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 ]

Reply via email to