Skip to content

Commit

Permalink
Change default coefficient of ImplicitSourceTerm to 1 (#984)
Browse files Browse the repository at this point in the history
Fixes #512
  • Loading branch information
guyer authored Dec 13, 2023
1 parent 2764950 commit 0c88c9e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
13 changes: 13 additions & 0 deletions fipy/terms/implicitSourceTerm.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ class ImplicitSourceTerm(SourceTerm):
where :math:`S` is the `coeff` value.
"""

def __init__(self, coeff=1., var=None):
r"""
Parameters
----------
coeff : float or ~fipy.variables.cellVariable.CellVariable
Proportionality coefficient :math:`S` (default: 1)
var : ~fipy.variables.cellVariable.CellVariable
Variable :math:`\phi` that
:class:`~fipy.terms.implicitSourceTerm.ImplicitSourceTerm` is
implicit in.
"""
super(ImplicitSourceTerm, self).__init__(coeff=coeff, var=var)

def _getWeight(self, var, transientGeomCoeff=None, diffusionGeomCoeff=None):
"""
Test for a bug due to the sign operator not being updating
Expand Down
11 changes: 10 additions & 1 deletion fipy/terms/sourceTerm.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,18 @@ class SourceTerm(CellTerm):
.. attention:: This class is abstract. Always create one of its subclasses.
"""
def __init__(self, coeff=0., var=None):
r"""
Parameters
----------
coeff : float or ~fipy.variables.cellVariable.CellVariable
Coefficient of source (default: 0)
var : ~fipy.variables.cellVariable.CellVariable
Variable :math:`\phi` that
:class:`~fipy.terms.sourceTerm.SourceTerm` is implicit in.
"""
if self.__class__ is SourceTerm:
raise AbstractBaseClassError
CellTerm.__init__(self, coeff=coeff, var=var)
super(SourceTerm, self).__init__(coeff=coeff, var=var)

def _calcGeomCoeff(self, var):
self._checkCoeff(var)
Expand Down

0 comments on commit 0c88c9e

Please sign in to comment.