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

Default coefficient of ImplicitSourceTerm is 0 #512

Closed
guyer opened this issue Jul 20, 2017 · 1 comment · Fixed by #984
Closed

Default coefficient of ImplicitSourceTerm is 0 #512

guyer opened this issue Jul 20, 2017 · 1 comment · Fixed by #984
Projects

Comments

@guyer
Copy link
Member

guyer commented Jul 20, 2017

>>> import fipy as fp

>>> mesh = fp.Grid1D(nx=5)
>>> phi = fp.CellVariable(mesh=mesh)

>>> eq1 = fp.ImplicitSourceTerm(var=phi) == 3.
>>> phi.value = mesh.x
>>> eq1.solve()
python:1: StagnatedSolverWarning: The solver stagnated. Iterations: 1. Relative error: nan
  #!/bin/bash python.app

>>> print phi
[ nan  nan  nan  nan  nan]

>>> eq2 = fp.ImplicitSourceTerm(var=phi) == 3.
>>> phi.value = mesh.x
>>> eq2.solve()
>>> print phi
[ 3.  3.  3.  3.  3.]

Principle of least surprise says default coeff should be 1. Zero is useless.

@guyer
Copy link
Member Author

guyer commented Jul 20, 2017

While strictly not backward compatible, changing default coeff from 0 to 1 will not break anything that is not already broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Triage
  
Closed
Development

Successfully merging a pull request may close this issue.

1 participant