Skip to content

Commit

Permalink
Change default coefficient of ImplicitSourceTerm to 1
Browse files Browse the repository at this point in the history
Fixes #512
  • Loading branch information
guyer committed Dec 7, 2023
1 parent fcf3dfb commit cbc0b38
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
12 changes: 12 additions & 0 deletions fipy/terms/implicitSourceTerm.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ 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
Proportiounality coefficient :math:`S` (default: 1)
var : ~fipy.variables.cellVariable.CellVariable
Variable :math:`\phi` that
:class:`~fipy.terms.sourcTerm.SourceTerm` is implicit in.
"""
super(self, ImplicitSourceTerm).__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
9 changes: 9 additions & 0 deletions fipy/terms/sourceTerm.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ 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.term.Term` is
implicit in.
"""
if self.__class__ is SourceTerm:
raise AbstractBaseClassError
CellTerm.__init__(self, coeff=coeff, var=var)
Expand Down

0 comments on commit cbc0b38

Please sign in to comment.