P.S. Would you recommend "sweeping" in a time-evolving problem that's as
simple as the one in my script?

On Mon, Aug 29, 2016 at 12:54 PM, Guyer, Jonathan E. Dr. (Fed) <
jonathan.gu...@nist.gov> wrote:

> The script as you supplied it had the constraint commented out. You said
> the answer doesn't change when you uncomment the constraint, and I'm
> suggesting that you need to sweep it because the constraint clearly depends
> on the solution.
>
> Beyond that, I don't understand why you're trying to write a no-flux Robin
> condition. FiPy is intrinsically no-flux. What is the real problem that you
> are trying to solve that FiPy's intrinsic boundary conditions doesn't
> already do for you?
>
> > On Aug 29, 2016, at 12:37 PM, Yun Tao <yun...@ucdavis.edu> wrote:
> >
> > ​Hi Jonathan,
> >
> > So if I understand correctly, what you're saying is that my script, as
> it is now (without sweeping), is generating incorrect results even though
> the solution appears conserved? ​
> >
> > On Mon, Aug 29, 2016 at 9:55 AM, Guyer, Jonathan E. Dr. (Fed) <
> jonathan.gu...@nist.gov> wrote:
> > Every time you solve, you change the value of phi, which changes your
> boundary condition, which will change the solution for phi. You need to
> sweep.
> >
> > > On Aug 26, 2016, at 4:32 PM, Yun Tao <yun...@ucdavis.edu> wrote:
> > >
> > > Thank you, Jonathan, for the insight. Sorry about my confusion -- I'm
> still slowly teaching myself the fundamentals as a biologist.
> > >
> > > I've now read more on the topic. Based on your comments:
> > >
> > > ​"​By constraining var.faceGrad to zero, you are saying that the
> boundary flux is
> > >   \phi b \tanh(alpha*r) (pos-den)/r​"​
> > > This is not a conservative boundary condition.
> > >
> > > ​it makes more sense why having var.faceGrad.constrain(0,
> where=m.exteriorFaces) causes the solution to blow up if advection points
> rightward toward a point-attractor ("den") and to leak if advection points
> leftward. ​
> > >
> > > I think I've now also correctly set up the Robin BC (line 38 in
> attached script) -- the solution's integral over space ("cell volume") is
> indeed conserved at 1 throughout the simulation. However, not defining my
> boundary condition at all appears to give exactly the same results. Is this
> because FiPy assumes Robin BC if given no specification?
> > >
> > > Thanks,
> > > Yun
> > >
> > >
> > > On Thu, Aug 25, 2016 at 10:52 AM, Guyer, Jonathan E. Dr. (Fed) <
> jonathan.gu...@nist.gov> wrote:
> > > I'm not sure why you conclude from that example that
> > >
> > >   var.faceGrad.constrain(0, where=m.exteriorFaces)
> > >
> > > only applies to the advection component. Where does it say that?
> > >
> > >
> > > In the code you sent, with
> > >
> > >   eq3 = TransientTerm() == DiffusionTerm(coeff=D)+
> convection(coeff=faceVelocity)
> > >
> > > the flux is
> > >
> > >   D \nabla \phi + \phi b \tanh(alpha*r) (pos-den)/r
> > >
> > > By constraining var.faceGrad to zero, you are saying that the boundary
> flux is
> > >
> > >   \phi b \tanh(alpha*r) (pos-den)/r
> > >
> > > This is not a conservative boundary condition.
> > >
> > > > On Aug 24, 2016, at 8:59 PM, Yun Tao <yun...@ucdavis.edu> wrote:
> > > >
> > > > Hi Dan,
> > > >
> > > > Wow. I did not expect that at all, thanks for that important
> information! I just tried searching for ways to implement the Robin BCs in
> FiPy. This site example <http://www.ctcms.nist.gov/
> fipy/examples/convection/generated/examples.convection.robin.html>
> appears to show that the var.faceGrad.constrain(0, where=m.exteriorFaces)
> command I mentioned earlier handles only the advection component, while, I
> presume, the diffusion component is subject to Neumann BCs by default. If
> that is so, then it's even more puzzling why having that line in my code
> blows up the solution, yet the solution seems well-behaved under just the
> Neumann BCs. Am I missing something else here?
> > > >
> > > > Thanks,
> > > > Yun
> > > >
> > > > On Wed, Aug 24, 2016 at 8:24 PM, Daniel Farrell <
> boyfarr...@gmail.com> wrote:
> > > > Hello Yun,
> > > >
> > > > I just briefly looked at the code. Seems like you are solving
> something like an advection diffusion problem. This might not help but just
> I case ...
> > > >
> > > > If you want a closed boundary you need to apply Robin boundary
> conditions because by definition the flux contains two components: one
> related to the diffusion process and one the advection process.
> > > >
> > > > For example, http://scicomp.stackexchange.com/a/10576/3691
> > > >
> > > > Dan
> > > >
> > > > On 24 Aug 2016, at 22:56, Yun Tao <yun...@ucdavis.edu> wrote:
> > > >
> > > >> Hi all,
> > > >>
> > > >> I'm experiencing a bizarre issue when trying to implement zero-flux
> external boundary condition when solving for transient solutions. My
> understanding is that it is the default setting in FiPy 3. Indeed, without
> specifying it, the solutions (attached) remains at unity throughout the
> simulation duration. However, when I manually tried to fix the exterior
> face gradient to zero with var.faceGrad.constrain(0,
> where=m.exteriorFaces), the solution began to blow up (as shown in the
> printed statements). Why does this happen? Is there a hidden conflict in
> conservation settings I should be careful of?
> > > >>
> > > >> Thanks,
> > > >> Yun
> > > >>
> > > >>
> > > >> --
> > > >> Yun Tao
> > > >> Postdoc
> > > >> Center for Infectious Disease Dynamics
> > > >> Pennsylvania State University
> > > >> State College, PA 16803
> > > >> <0flux_bc_fipylistserve.py>
> > > >> _______________________________________________
> > > >> fipy mailing list
> > > >> fipy@nist.gov
> > > >> http://www.ctcms.nist.gov/fipy
> > > >>  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy
> ]
> > > >
> > > > _______________________________________________
> > > > fipy mailing list
> > > > fipy@nist.gov
> > > > http://www.ctcms.nist.gov/fipy
> > > >   [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy
> ]
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Yun Tao
> > > > Postdoc
> > > > Center for Infectious Disease Dynamics
> > > > Pennsylvania State University
> > > > State College, PA 16803
> > > > _______________________________________________
> > > > fipy mailing list
> > > > fipy@nist.gov
> > > > http://www.ctcms.nist.gov/fipy
> > > >  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy
> ]
> > >
> > >
> > > _______________________________________________
> > > fipy mailing list
> > > fipy@nist.gov
> > > http://www.ctcms.nist.gov/fipy
> > >   [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
> > >
> > >
> > >
> > > --
> > > Yun Tao
> > > Postdoc
> > > Center for Infectious Disease Dynamics
> > > Pennsylvania State University
> > > State College, PA 16803
> > > <new_0flux_bc_fipylistserve.py>___________________________
> ____________________
> > > fipy mailing list
> > > fipy@nist.gov
> > > http://www.ctcms.nist.gov/fipy
> > >  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
> >
> >
> > _______________________________________________
> > fipy mailing list
> > fipy@nist.gov
> > http://www.ctcms.nist.gov/fipy
> >   [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
> >
> >
> >
> > --
> > Yun Tao
> > Postdoc
> > Center for Infectious Disease Dynamics
> > Pennsylvania State University
> > State College, PA 16803
> > _______________________________________________
> > fipy mailing list
> > fipy@nist.gov
> > http://www.ctcms.nist.gov/fipy
> >  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
>
>
> _______________________________________________
> fipy mailing list
> fipy@nist.gov
> http://www.ctcms.nist.gov/fipy
>   [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
>



-- 
Yun Tao
Postdoc
Center for Infectious Disease Dynamics
Pennsylvania State University
State College, PA 16803
_______________________________________________
fipy mailing list
fipy@nist.gov
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to