Altan, I'm stumped by this right now. I might look into again in the future. Cheers.
On Mon, Jun 18, 2012 at 11:27 AM, Allawala, Altan <[email protected]>wrote: > Thanks for your response, Daniel. > > On Mon, Jun 18, 2012 at 10:18 AM, Daniel Wheeler < > [email protected]> wrote: > >> On Fri, Jun 15, 2012 at 12:26 AM, Allawala, Altan < >> [email protected]> wrote: >> >>> >>> Spot on. There are exactly three conditions: that Phi goes to zero at >>> -/+ infinity and that Phi=1 at x=0. I've taken on-board your explanation >>> about why we still need to specify four. And this is where it gets >>> interesting: >>> >>> In the code I sent you, I had broken up the triple derivative by placing >>> a single inside a double (ie: convection term inside a diffusion term). In >>> the code that you sent, it was the other way around (ie: a diffusion term >>> inside a convection term). I >>> >> >> Not really following you here. >> > > In my code, the DEs are: > > eqn1 = (0 == UpwindConvectionTerm(coeff = [[1]], var=psi) > > - DiffusionTerm(coeff = 1, var=phi) > + ImplicitSourceTerm(coeff = x, var=psi)) > eqn2 = (ImplicitSourceTerm(coeff = 1, var=phi) == > UpwindConvectionTerm(coeff = [[1]], var = psi)) > > > In your code, the DEs are: > > > eqn1 = (0 == UpwindConvectionTerm(coeff = [[1]], var=phi) > - UpwindConvectionTerm(coeff = [[1]], var=psi) > + ImplicitSourceTerm(coeff = x, var=phi)) > > eqn2 = ImplicitSourceTerm(coeff=1, var=psi) == DiffusionTerm(coeff=[[1]], > var=phi) > > (Our phi's and psi's are switched of course.) > > Both your approach and mine should be completely equivalent ways of > splitting up the triple derivative into convection and derivative terms. > But they're giving different answers. > > For example, one could express the differential equation d(phi)^3/dx^3 = 1 > in FiPy either as: > > eqn1 = (DiffusionTerm(coeff = 1, var=psi) == 1.) > eqn2 = (UpwindConvectionTerm(coeff = [[1]], var = phi) == > ImplicitSourceTerm(coeff = 1, var=psi)) > > or else as: > > eqn1 = (UpwindConvectionTerm(coeff = [[1]], var = psi) == 1.) > eqn2 = (DiffusionTerm(coeff = 1, var=phi) == ImplicitSourceTerm(coeff = 1, > var=psi)) > > In the first case, it amounts to placing the convection term inside of the > diffusion term whereas in the second case it is the diffusion term being > placed inside the convection term. Both are identical once the different > boundary conditions have been accounted for. The same principle applies for > the difference between our codes. > > >> >>> would have thought that they would be identical. But strangely enough, >>> they give different results - neither of which match the correct output >>> from Mathematica. >>> >>> >> In the code I sent you, the three boundary conditions were satisfied. Is >> the solution still wrong even though the boundary conditions are satisfied? >> > > Yes, the solution is still wrong. I've attached the correct solution. > >> >> >>> >>>> >>> Yes I had swapped around Psi and Phi in the equation that I'd written. >>> My bad. In addition, the coefficient in front of the third (last) term >>> should have been only x, not x^2. I made the amendment to the code that you >>> provided and it made no qualitative. >>> >> >> I see a slight difference. The curve for psi does not have multiple >> changes in gradient. How does the fipy solution differ from the mathematica >> solution? The residual is tiny and the boundary conditions seem to be >> satisfied at least for the code that I am running. >> > > The Mathematica output is attached. (FiPy's output seems to perhaps > resemble a translated form of this.) > >> > > -- >> 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 ] > > -- Daniel Wheeler
_______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
