Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix explanation for no-flux steady-state failure #1015

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions examples/diffusion/mesh1D.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,24 +720,30 @@

and solve the steady-state problem

>>> DiffusionTerm(coeff=D).solve(var=phi) #doctest: +PYSPARSE_SOLVER
>>> try:
... DiffusionTerm(coeff=D).solve(var=phi)
... except:
... pass
>>> if __name__ == '__main__':
... viewer.plot()
>>> from fipy import input
>>> if __name__ == '__main__':
... input("No-flux - stead-state failure. \
... input("No-flux - steady-state failure. \
... Press <return> to proceed...")

>>> print(numerix.allclose(phi, 0.0)) #doctest: +PYSPARSE_SOLVER
True
>>> print(numerix.allclose(phi, 0.2, atol=1e-5)) # doctest: +NOT_TRILINOS_SOLVER
False

.. image:: /figures/examples/diffusion/mesh1D-noflux_steady_fail.*
:width: 90%
:align: center
:alt: (failed) steady-state solution for no-flux boundary conditions

we find that the value is uniformly zero! What happened to our no-flux boundary
conditions?
Depending on the solver, we find that the value may be uniformly zero,
infinity, or NaN, or the solver may just fail!
What happened to our no-flux boundary conditions?
Trilinos actually manages to get the correct solution, but this should not
be relied on; this problem has an infinite number of solutions.

The problem is that in the implicit discretization of :math:`\nabla\cdot(D\nabla\phi) = 0`,

Expand Down
6 changes: 6 additions & 0 deletions fipy/solvers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,12 @@ def _import_mesh_matrices(suite):
test=lambda: solver_suite != 'pyamgx',
why="the PyAMGX solver is being used.",
skipWarning=True)

register_skipper(flag='NOT_TRILINOS_SOLVER',
test=lambda: solver_suite not in ['trilinos', 'no-pysparse'],
why="the Trilinos solvers are being used.",
skipWarning=True)

del register_skipper

_log.info("Solver suite is %s", solver_suite)
Expand Down
Loading