usnistgov / fipy

FiPy is a Finite Volume PDE solver written in Python
http://pages.nist.gov/fipy/en/latest
Other
504 stars 148 forks source link

Uncaught Exception from the no-flux steady-state diffusion example #952

Closed guyer closed 6 months ago

guyer commented 11 months ago

Discussed in https://github.com/usnistgov/fipy/discussions/951

Originally posted by **CalebDmArcher** September 18, 2023 I am trying the last example from [examples/diffusion/mesh1D.py](https://www.ctcms.nist.gov/fipy/examples/diffusion/generated/examples.diffusion.mesh1D.html) which is the "Fully implicit solutions are not without their pitfalls, particularly in steady state..." section. The code of the steady-state part got the error "RuntimeError: Factor is exactly singular" which comes from the code `DiffusionTerm(coeff=D).solve(var=phi)`. Is it because the latest version of the library can catch and raise exceptions for the cases where there can be more than one solution for the PDE?
guyer commented 11 months ago

Some solvers, e.g., PETSc, are willing to return one of the infinite possible solutions. Others, e.g., SciPy, raise an exception.

The example should be more robust.

guyer commented 6 months ago

Fixed by #1015