You guys are the best! I implemented the boundary condition using an ImplicitSourceTerm (as described here: http://osdir.com/ml/python.fipy/2008-07/msg00014.html ) and my solution is absolutely spot-on. Even when using lower grid resolution. THANK YOU SO MUCH!
Here some proof: http://imgur.com/j7YuD This is again not the solution of \varphi for a given time but the convolution of \varphi with a weighting distribution over time. On Wed, Jun 6, 2012 at 6:01 PM, Daniel Wheeler <[email protected]> wrote: > On Tue, Jun 5, 2012 at 12:59 PM, Matej Svejda <[email protected]> wrote: >>> OK. My comments still stand. The discrepancies do not have the appearance >>> of a "bad" solution, but rather that they are not solutions to the same >>> equation and/or boundary conditions. >>> >>> Are you solving the same equation and boundary conditions? How do you know? >> >> So the equation I am trying to solve is: >> >> \frac{1}{D_r} * \frac{\partial \varphi(\alpha, t)}{\partial t} = >> \frac{\partial^2 \varphi(\alpha, t)}{\partial \alpha^2} + >> \frac{\partial}{\partial \alpha} (\frac{1}{K * T} * \frac{\partial >> H(\alpha, t)}{\partial \alpha} * \varphi(\alpha, t)) >> >> Where D_r, K, T are constants. My FiPy equation is: >> >> equation = TransientTerm(coeff = (1. / self.p.Dr)) == \ >> DiffusionTerm() + ExponentialConvectionTerm(coeff = (1 / (self.p.K * >> self.p.temp)) * H.getFaceGrad()) >> > > Matej, The equation looks good. > >> The boundary conditions of my problem are: >> \varphi(\alpha, 0) = p_0(\alpha) >> \varphi(-\frac{\pi}{2}, 0) = \varphi(\frac{\pi}{2}, 0) = 0 >> >> Where p_0 is a known function. >> >> In FiPy I represent them as: >> >> prob.setValue(self._p_zero(alpha - math.pi / 2)) >> boundaries = (FixedValue(faces=alphaMesh.getFacesRight(), value=0.0), \ >> FixedValue(faces=alphaMesh.getFacesLeft(), value=0.0)) > > Read the FAQ here > <http://www.ctcms.nist.gov/fipy/documentation/FAQ.html#i-can-t-get-the-fixedvalue-or-fixedflux-boundary-condition-objects-to-work-right-what-do-i-do-now>. > I'm concerned that maybe the boundary conditions are not working as > you might expect in version 2.1. We have since corrected some issues > by implementing the boundary conditions in a different way. This may > or may not be the issue. > > Another thing is that H.getFaceGrad() does not see the boundary > condition (again this is something that has been corrected in the > upcoming release). One way to get round this in version 2.1 is to make > the centers of the end cells the boundaries of the domain and use > source terms to set the value of \varphi to zero in these end cells > using a really large implicit source term just for the end cells. This > will avoid all the boundary issues. Try that and see if it helps. > > Good luck. > > -- > 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 ]
