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

coupled convection-diffusion always treated as Upwind #233

Closed
guyer opened this issue Sep 19, 2014 · 4 comments
Closed

coupled convection-diffusion always treated as Upwind #233

guyer opened this issue Sep 19, 2014 · 4 comments
Labels

Comments

@guyer
Copy link
Member

guyer commented Sep 19, 2014

Since committing r4462, my PV code no longer solves with trunk. I will attempt to distill a test case, but I suspect that the problem is in trunk/fipy/terms/residualTerm.py

Imported from trac ticket #329, created by guyer on 04-21-2011 at 08:02, last modified: 04-23-2011 at 11:23

@guyer
Copy link
Member Author

guyer commented Sep 19, 2014

Actually, have several trunk test failures, too, but only on my Mac

fipy version 2.2-dev4483
numpy version 1.5.0.dev8716
pysparse version 1.2-dev213
PyTrilinos version 4.3
scipy version 0.8.0.dev7086
matplotlib version 1.0.0
gist is not installed
mpi4py version 1.2.2
enthought.mayavi version 3.3.2.dev-r25434



==================================================================h4. 
FAIL: Doctest: fipy.terms.term.Term._test
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/doctest.py", line 2131, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for fipy.terms.term.Term._test
  File "/Users/guyer/Documents/research/FiPy/trunk/fipy/terms/term.py", line 406, in _test

----------------------------------------------------------------------
File "/Users/guyer/Documents/research/FiPy/trunk/fipy/terms/term.py", line 530, in fipy.terms.term.Term._test
Failed example:
print solver.matrix.__class__
Expected nothing
Got:
<class 'fipy.matrices.pysparseMatrix._PysparseMeshMatrix'>
----------------------------------------------------------------------
File "/Users/guyer/Documents/research/FiPy/trunk/fipy/terms/term.py", line 531, in fipy.terms.term.Term._test
Failed example:
print numpyMatrix
Expected nothing
Got:
[[ 1.  0.  0.]
[ 0.  1.  0.]
[ 0.  0.  1.]]
----------------------------------------------------------------------
File "/Users/guyer/Documents/research/FiPy/trunk/fipy/terms/term.py", line 532, in fipy.terms.term.Term._test
Failed example:
print parallel.procID > 0 or numerix.allequal(numpyMatrix, [[1, -1, 0], 
[-1, 2, -1], 
[0, -1, 1]])
Expected:
True
Got:
False
----------------------------------------------------------------------
File "/Users/guyer/Documents/research/FiPy/trunk/fipy/terms/term.py", line 536, in fipy.terms.term.Term._test
Failed example:
print parallel.procID > 0 or numerix.allequal(solver.RHSvector, [0, 0, 0])
Expected:
True
Got:
False


==================================================================
FAIL: Doctest: fipy.terms.binaryTerm._BinaryTerm._test
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/doctest.py", line 2131, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for fipy.terms.binaryTerm._BinaryTerm._test
  File "/Users/guyer/Documents/research/FiPy/trunk/fipy/terms/binaryTerm.py", line 108, in _test

----------------------------------------------------------------------
File "/Users/guyer/Documents/research/FiPy/trunk/fipy/terms/binaryTerm.py", line 116, in fipy.terms.binaryTerm._BinaryTerm._test
Failed example:
print var
Expected:
[ 1.  1.  1.]
Got:
[ 0.  0.  0.]
----------------------------------------------------------------------
File "/Users/guyer/Documents/research/FiPy/trunk/fipy/terms/binaryTerm.py", line 120, in fipy.terms.binaryTerm._BinaryTerm._test
Failed example:
print numerix.allequal(matrix.numpyArray, [[ 2, -2,  0],
[-2,  4, -2],
[ 0, -2,  2]])
Expected:
True
Got:
False
----------------------------------------------------------------------
File "/Users/guyer/Documents/research/FiPy/trunk/fipy/terms/binaryTerm.py", line 130, in fipy.terms.binaryTerm._BinaryTerm._test
Failed example:
print var
Expected:
[ 0.  0.  0.  0.  0.  0.]
Got:
[ 1.  1.  1.  1.  1.  1.]
----------------------------------------------------------------------
File "/Users/guyer/Documents/research/FiPy/trunk/fipy/terms/binaryTerm.py", line 132, in fipy.terms.binaryTerm._BinaryTerm._test
Failed example:
print CellVariable(mesh=m, value=RHSvector).globalValue
Expected:
[ 0.  0.  0.  0.  0.  0.]
Got:
[ 1.  1.  1.  1.  1.  1.]
----------------------------------------------------------------------
File "/Users/guyer/Documents/research/FiPy/trunk/fipy/terms/binaryTerm.py", line 134, in fipy.terms.binaryTerm._BinaryTerm._test
Failed example:
print numerix.allequal(matrix.numpyArray, [[ 2,-2, 0, 0, 0, 0.],
[-2, 4,-2, 0, 0, 0.],
[ 0,-2, 4,-2, 0, 0.],
[ 0, 0,-2, 4,-2, 0.],
[ 0, 0, 0,-2, 4,-2.],
[ 0, 0, 0, 0,-2, 2.]])
Expected:
True
Got:
False
----------------------------------------------------------------------
File "/Users/guyer/Documents/research/FiPy/trunk/fipy/terms/binaryTerm.py", line 153, in fipy.terms.binaryTerm._BinaryTerm._test
Failed example:
print numerix.allequal(eq0.matrix.numpyArray, [[ 2, -2,  0],
[-2,  4, -2],
[ 0, -2,  2]])
Expected:
True
Got:
False

Trac comment by guyer on 04-22-2011 at 13:40

@guyer
Copy link
Member Author

guyer commented Sep 19, 2014

Those failures are because _prepareLinearSystem is called with var=None and _BinaryTerm.var is indeterminate under those circumstances. So, the issue is that the test is bad (_prepareLinearSystem(var=A, ...) and _prepareLinearSystem(var=B, ...) are successfully tested elsewhere). We should probably check that the residual is right, since that should not depend on which Variable is used, right?

So, why is solar failing?

Trac comment by guyer on 04-22-2011 at 17:48

@guyer
Copy link
Member Author

guyer commented Sep 19, 2014

_CoupledBinaryTerm._buildAndAddMatrices() calls uncoupledTerm._getTransientGeomCoeff(var) and uncoupledTerm._getDiffusionGeomCoeff(var) for every block of the matrix (see trunk/fipy/terms/coupledBinaryTerm.py@4496#L116), but var is a _CoupledCellVariable, so transientGeomCoeff and diffusionGeomCoeff are always None, which causes PowerLawConvectionTerm and ExponentialConvectionTerm to always be upwind. It presumably messes up ImplicitSourceTerms, too.

Introduced a test for this in r4496

Trac comment by guyer on 04-23-2011 at 06:29

@guyer
Copy link
Member Author

guyer commented Sep 19, 2014

Fixed in r4497.

The Mac test failures at trunk/fipy/terms/term.py@4462#L530 and at trunk/fipy/terms/binaryTerm.py@4497#L116 are a separate issue and have been filed as issue #238.

Trac comment by guyer on 04-23-2011 at 11:23

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

No branches or pull requests

2 participants