Exemplo n.º 1
0
    def arithmeticFaceValue(self):
        r"""
        Returns a `FaceVariable` whose value corresponds to the arithmetic interpolation
        of the adjacent cells:
            
        .. math::
        
           \phi_f = (\phi_1 - \phi_2) \frac{d_{f2}}{d_{12}} + \phi_2
           
        >>> from fipy.meshes import Grid1D
        >>> from fipy import numerix
        >>> mesh = Grid1D(dx = (1., 1.))
        >>> L = 1
        >>> R = 2
        >>> var = CellVariable(mesh = mesh, value = (L, R))
        >>> faceValue = var.arithmeticFaceValue[mesh.interiorFaces.value]
        >>> answer = (R - L) * (0.5 / 1.) + L
        >>> print numerix.allclose(faceValue, answer, atol = 1e-10, rtol = 1e-10)
        True
        
        >>> mesh = Grid1D(dx = (2., 4.))
        >>> var = CellVariable(mesh = mesh, value = (L, R))
        >>> faceValue = var.arithmeticFaceValue[mesh.interiorFaces.value]
        >>> answer = (R - L) * (1.0 / 3.0) + L
        >>> print numerix.allclose(faceValue, answer, atol = 1e-10, rtol = 1e-10)
        True

        >>> mesh = Grid1D(dx = (10., 100.))
        >>> var = CellVariable(mesh = mesh, value = (L, R))
        >>> faceValue = var.arithmeticFaceValue[mesh.interiorFaces.value]
        >>> answer = (R - L) * (5.0 / 55.0) + L
        >>> print numerix.allclose(faceValue, answer, atol = 1e-10, rtol = 1e-10)
        True
        """
        if not hasattr(self, '_arithmeticFaceValue'):
            from fipy.variables.arithmeticCellToFaceVariable import _ArithmeticCellToFaceVariable
            self._arithmeticFaceValue = _ArithmeticCellToFaceVariable(self)

        return self._arithmeticFaceValue
Exemplo n.º 2
0
    def arithmeticFaceValue(self):
        r"""
        Returns a `FaceVariable` whose value corresponds to the arithmetic interpolation
        of the adjacent cells:
            
        .. math::
        
           \phi_f = (\phi_1 - \phi_2) \frac{d_{f2}}{d_{12}} + \phi_2
           
        >>> from fipy.meshes import Grid1D
        >>> from fipy import numerix
        >>> mesh = Grid1D(dx = (1., 1.))
        >>> L = 1
        >>> R = 2
        >>> var = CellVariable(mesh = mesh, value = (L, R))
        >>> faceValue = var.arithmeticFaceValue[mesh.interiorFaces.value]
        >>> answer = (R - L) * (0.5 / 1.) + L
        >>> print numerix.allclose(faceValue, answer, atol = 1e-10, rtol = 1e-10)
        True
        
        >>> mesh = Grid1D(dx = (2., 4.))
        >>> var = CellVariable(mesh = mesh, value = (L, R))
        >>> faceValue = var.arithmeticFaceValue[mesh.interiorFaces.value]
        >>> answer = (R - L) * (1.0 / 3.0) + L
        >>> print numerix.allclose(faceValue, answer, atol = 1e-10, rtol = 1e-10)
        True

        >>> mesh = Grid1D(dx = (10., 100.))
        >>> var = CellVariable(mesh = mesh, value = (L, R))
        >>> faceValue = var.arithmeticFaceValue[mesh.interiorFaces.value]
        >>> answer = (R - L) * (5.0 / 55.0) + L
        >>> print numerix.allclose(faceValue, answer, atol = 1e-10, rtol = 1e-10)
        True
        """
        if not hasattr(self, '_arithmeticFaceValue'):
            from fipy.variables.arithmeticCellToFaceVariable import _ArithmeticCellToFaceVariable
            self._arithmeticFaceValue = _ArithmeticCellToFaceVariable(self)

        return self._arithmeticFaceValue