On 20 February 2014 01:48, Daniel Wheeler <[email protected]> wrote:
> It depends on the boundary condition. If you have natural boundary > conditions, the values should be -1, but with fixed value, the values > are -3. This is because the distance to the edge is dx / 2. > Perfect, I checked the math and that works out nicely. As we said before, in the simple diffusion case the Jacobian comes directly from the linear system coefficients, so I can get the Jacobian directly from term.matrix.matrix (which is a scipy csr_matrix in my case) and then divide through by mesh.cellVolumes. > It's > sometimes not apparent that you've made a mistake because the solution > will often converge anyway. > Yes, I've been seeing that, but it's worth pointing out that convergence appears to suffer noticeably if you get it wrong; even just at the boundary nodes. It manifests (for me) in the form of the ODE integrator requiring very small timesteps. For interest's sake I'm using the CVODE routine (from the SUNDIALS package from LLNL), with the GMRES linear solver with a user-supplied J*v function. This is why I've been after the Jacobian. I have a tremendously non-linear reactive system (combustion) with pre-existing code that is currently being solved in CVODE, and I'm "tacking on" a thermal well using FiPy. It appears that my test cases are now all working. The apparent speed of this unholy union seems worse than using the FiPy solver directly, but it's apples & oranges because CVODE calculates timesteps based on error tolerances, whereas with fipy (at least in the examples I've been building from) the timeDuration is being explicitly specified. Qualitatively, I would estimate that the speed of both methods would lie in a similar order of magnitude once the time step error tolerances are matched in both (I could store the sequence of timesteps from the CVODE run, and then feed that to the FiPy time-stepping loop, one per "solve" instruction, and then compare run-times; but I'm not going to bother for now). Thank you very much for your time.
_______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
