On Jun 6, 2012, at 10:13 PM, Daniel Farrell wrote:

> I am trying to solve an extension of the Beer-Lambert law that includes the 
> non-zero reflectivity of surfaces and the multiple reflections that therefore 
> occur inside. I took some inspiration from Daniel's recent blog post, 
> http://matforge.org/wd15/blog/LightPropogation.
> 
> The differential equations are here, http://i.imgur.com/p2Xqx.png which has 
> the analytical solution, http://i.imgur.com/xcgL8.png.
> 
> I have an issue with setting the boundary conditions correctly: I don't know 
> how to tell Fipy to take the face value of the dependent variable in the 
> constrained. This is the script I have been working on, 
> http://gist.github.com/2886086.
> 
> The incorrect boundary conditions cause a spike in the calculation. See the 
> solution http://i.imgur.com/2PlNE.png for A=0, B=0 i.e. which should 
> reproduce the Beer-Lambert law. Things get particularly bad when A=0 and B=1, 
> http://i.imgur.com/dHWu0.png.
> 
> What's the best way to set-up this problem in Fipy?

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. 

These changes resolve the massive deviation for the B=1 case, but there's still 
a spike at the right-hand boundary. I don't know what causes that, but maybe 
Wheeler does. I suspect it has something to do with the ouflow condition (or 
lack thereof) on the ExponentialConvectionTerm, but I really don't know.
_______________________________________________
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