Skip to content

Commit 6236076

Browse files
authored
Fix explanation for no-flux steady-state failure (#1015)
* Fix explanation for no-flux steady-state failure * Skip test on Trilinos Trilinos actually manages to get the correct answer somehow
1 parent 8cd1eb4 commit 6236076

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

examples/diffusion/mesh1D.py

+12-6
Original file line numberDiff line numberDiff line change
@@ -720,24 +720,30 @@
720720
721721
and solve the steady-state problem
722722
723-
>>> DiffusionTerm(coeff=D).solve(var=phi) #doctest: +PYSPARSE_SOLVER
723+
>>> try:
724+
... DiffusionTerm(coeff=D).solve(var=phi)
725+
... except:
726+
... pass
724727
>>> if __name__ == '__main__':
725728
... viewer.plot()
726729
>>> from fipy import input
727730
>>> if __name__ == '__main__':
728-
... input("No-flux - stead-state failure. \
731+
... input("No-flux - steady-state failure. \
729732
... Press <return> to proceed...")
730733
731-
>>> print(numerix.allclose(phi, 0.0)) #doctest: +PYSPARSE_SOLVER
732-
True
734+
>>> print(numerix.allclose(phi, 0.2, atol=1e-5)) # doctest: +NOT_TRILINOS_SOLVER
735+
False
733736
734737
.. image:: /figures/examples/diffusion/mesh1D-noflux_steady_fail.*
735738
:width: 90%
736739
:align: center
737740
:alt: (failed) steady-state solution for no-flux boundary conditions
738741
739-
we find that the value is uniformly zero! What happened to our no-flux boundary
740-
conditions?
742+
Depending on the solver, we find that the value may be uniformly zero,
743+
infinity, or NaN, or the solver may just fail!
744+
What happened to our no-flux boundary conditions?
745+
Trilinos actually manages to get the correct solution, but this should not
746+
be relied on; this problem has an infinite number of solutions.
741747
742748
The problem is that in the implicit discretization of :math:`\nabla\cdot(D\nabla\phi) = 0`,
743749

fipy/solvers/__init__.py

+6
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,12 @@ def _import_mesh_matrices(suite):
190190
test=lambda: solver_suite != 'pyamgx',
191191
why="the PyAMGX solver is being used.",
192192
skipWarning=True)
193+
194+
register_skipper(flag='NOT_TRILINOS_SOLVER',
195+
test=lambda: solver_suite not in ['trilinos', 'no-pysparse'],
196+
why="the Trilinos solvers are being used.",
197+
skipWarning=True)
198+
193199
del register_skipper
194200

195201
_log.info("Solver suite is %s", solver_suite)

0 commit comments

Comments
 (0)