Dear Jon, Thanks for looking through the code and for the feedback and suggestions. I'll start from simple and see whether it could converge.
I just found out that there's a unit conversion mistake which causes extraordinary large organic matter concentration and leads the negative values in the first sweep. I remember that Crank-Nicolson is not suitable for non-linear pdes, unless the equations are linearized. So, with the sweeping method (that the equations are solved iteratively), does it mean that the systems of equations are linearized? I'm thinking whether Crank-Nicolson scheme could be used in my case with coupled reactions. Thanks a lot! Best regards, Rose On Tue, Jan 28, 2014 at 10:46 AM, Guyer, Jonathan E. Dr. < [email protected]> wrote: > > On Jan 27, 2014, at 4:34 PM, yuan wang <[email protected]> wrote: > > > I've already solved the previous problem. But now I have some new > problems. > > My research is about solving a series (about 10) of coupled nonlinear > partial differential equations. They are coupled in the reaction term > (implicit source and source term). The reaction is second order reaction, > which causes the non-linearity. Because of that, I need to solve them > iteratively. I use sweep to do that but could not get convergence out of > it. I'm not sure whether it's because of the mechanism set up is not > correct, or because I didn't use fipy correctly. Would you mind taking a > look at my code? Based on your experience, would that many pdes have good > convergence? > > Based on what you sent me offline, there's no fundamental reason that you > can't solve that many coupled equations, but solving steady state PDEs, > much less coupled steady state PDEs is challenging. It's likely that you'll > need to use something like Newton iterations, or relaxing the time > dependent equations in pseudo-time, or both, to achieve stable solutions. > > This is far too complicated a code to try to analyze off the cuff, but I > can make a couple of observations: > > Start with a *much* simpler system of equations; two or three reactions at > first, then gradually add more. There is no hope of figuring out such a > complicated system, particularly when you're still learning your way around > FiPy. > > Are all of the Sec[i].var concentration variables? Several of the > solutions have negative values after one sweep. If these are > concentrations, then something is wrong from the beginning and will never > recover. I would look carefully at your boundary conditions to ensure that > none of them are forcing unphysical (and inconsistent) solutions. > > ImplicitDiffusionTerm and DiffusionTerm are the same thing, so you're not > getting Crank-Nicholson when you add eqI and eqE. There's no real harm in > this, but there's no point, either. Just do the normal implicit equations. > _______________________________________________ > fipy mailing list > [email protected] > http://www.ctcms.nist.gov/fipy > [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] > -- Yuan (Rose) Wang PhD Candidate, Tufts University Cellphone: 617-699-8006
_______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
