On Thu, Apr 11, 2013 at 1:08 PM, Raymond Smith <[email protected]> wrote:
> > I'm attempting to model the case of a constant overall current > (dis)charge. Because there is phase separation, and the reaction rate > depends on the concentration in the surface I'm modeling, there is > inhomogeneity in the reaction rate over the 2D surface. However, I'd like > the total rate integrated over the surface to be constant, achieved by > varying phi (assumed to be constant over the surface). > Hi Raymond, It's an interesting problem, but I'm not sure how to make it implicit. > > As of now, I'm doing this with a relatively naive approach of using > scipy.optimize.fsolve at each time step to find the value of the potential, > phi, which leads to the surface integral of dc/dt over the surface being > the desired value. This seems to work reasonably well, but the solvers are > implicit and that seems more like an explicit way to maintain the constraint > It is. I think you should consider the slowest converging non-linearity (or whatever the outer sweep loop is solving). If there is something that is slower than the constant current constraint then explicit is fine. It may only be worth addressing the issue if If the constant current constraint is the actual bottleneck. You might be able to check this by observing the residuals of each equation along with a residual or error for the constant current constraint. > I was wondering if there's a smoother way to incorporate this sort of > integral constraint. > Is there a way to include the constant current constraint as a Lagrange multiplier in the free energy or something like that? Then the constraint would be built into the PDEs in a more fundamental way. Just a thought, no idea whether it is viable. I worry that it would actually make the system a DAE, and I'm not sure (a) > if FiPy's integrators are designed to handle that and (b) how to interact > with them if they are. > You can pose any terms that you like in a FiPy equation (including time, space or the dependent variable in non-linear ways), but the user has to make the choice about explicit versus implicit and whether to use fixed point sweeps or Newton sweeps for the non-linear solutions. Cheers, -- Daniel Wheeler
_______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
