Changeset 2727 for trunk

Show
Ignore:
Timestamp:
08/21/2008 12:37:16 PM (5 months ago)
Author:
wd15
Message:

added a residualFn argument to justResidualVector in term to enable customization of the returned residual

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/fipy/terms/term.py

    r2605 r2727  
    191191        return residual 
    192192 
    193     def justResidualVector(self, var, solver=None, boundaryConditions=(), dt=1., underRelaxation=None): 
     193    def justResidualVector(self, var, solver=None, boundaryConditions=(), dt=1., underRelaxation=None, residualFn=None): 
    194194        r""" 
    195195        Builds and the `Term`'s linear system once. This method 
     
    207207        """ 
    208208        solver, matrix, RHSvector = self._prepareLinearSystem(var, solver, boundaryConditions, dt) 
     209 
     210        print 'RHSvector',RHSvector 
    209211         
    210212        if underRelaxation is not None: 
    211213            matrix, RHSvector = self._applyUnderRelaxation(matrix, var, RHSvector, underRelaxation) 
    212214 
    213         return self._calcResidualVector(var, matrix, RHSvector) 
     215        residualFn = residualFn or self._calcResidual 
     216        residual = residualFn(var, matrix, RHSvector) 
     217         
     218        return residual 
    214219 
    215220    def _verifyCoeffType(self, var):