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

underRelaxation doesn't work on coupled equations #971

Open
guyer opened this issue Oct 20, 2023 · 0 comments
Open

underRelaxation doesn't work on coupled equations #971

guyer opened this issue Oct 20, 2023 · 0 comments

Comments

@guyer
Copy link
Member

guyer commented Oct 20, 2023

As observed in #970, when using PETSc, Trilinos, or PySparse solvers,

>>> m = Grid1D(nx=3)
>>> v0 = CellVariable(mesh=m, value=0.)
>>> v1 = CellVariable(mesh=m, value=1.)
>>> eq0 = TransientTerm(var=v0) - DiffusionTerm(coeff=1., var=v0) - DiffusionTerm(coeff=2., var=v1)
>>> eq1 = TransientTerm(var=v1) - DiffusionTerm(coeff=3., var=v0) - DiffusionTerm(coeff=4., var=v1)
>>> eq = eq0 & eq1
>>> eq.sweep(dt=1., underRelaxation=0.5)

raises

Traceback (most recent call last):
  Cell In[4], line 7
    eq.sweep(dt=1., underRelaxation=0.5)
  File ~/Documents/research/FiPy/fipy/fipy/terms/term.py:220 in sweep
    solver._applyUnderRelaxation(underRelaxation=underRelaxation)
  File ~/Documents/research/FiPy/fipy/fipy/solvers/solver.py:112 in _applyUnderRelaxation
    self.matrix.putDiagonal(numerix.asarray(self.matrix.takeDiagonal()) / underRelaxation)
  File ~/Documents/research/FiPy/fipy/fipy/matrices/petscMatrix.py:264 in putDiagonal
    self.put(vector, ids, ids)
  File ~/Documents/research/FiPy/fipy/fipy/matrices/offsetSparseMatrix.py:23 in put
    SparseMatrix.put(self, vector, id1 + self.mesh.numberOfCells * self.equationIndex, id2 + self.mesh.numberOfCells * self.varIndex)
  File ~/Documents/research/FiPy/fipy/fipy/matrices/petscMatrix.py:708 in put
    vector, id1, id2 = self._m2m.globalVectorAndIDs(vector, id1, id2, overlapping)
  File ~/Documents/research/FiPy/fipy/fipy/matrices/sparseMatrix.py:271 in globalVectorAndIDs
    id1, id2, mask = self._getStencil(id1, id2, overlapping)
  File ~/Documents/research/FiPy/fipy/fipy/matrices/sparseMatrix.py:309 in _getStencil
    id2 = self.globalOverlappingColIDs[id2]
IndexError: index 6 is out of bounds for axis 0 with size 6

Note

It works with SciPy.

@guyer guyer changed the title underRelaxation doesn't work on coupled equations with PETSc, Trilinos, or PySparse solvers underRelaxation doesn't work on coupled equations Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant