当前位置: 首页>>代码示例>>Python>>正文


Python CellVariable.__init__方法代码示例

本文整理汇总了Python中fipy.variables.cellVariable.CellVariable.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python CellVariable.__init__方法的具体用法?Python CellVariable.__init__怎么用?Python CellVariable.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fipy.variables.cellVariable.CellVariable的用法示例。


在下文中一共展示了CellVariable.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from fipy.variables.cellVariable import CellVariable [as 别名]
# 或者: from fipy.variables.cellVariable.CellVariable import __init__ [as 别名]
    def __init__(self, distanceVar, bulkVar, rateConstant):
        CellVariable.__init__(self, mesh = distanceVar.getMesh())

        self.distanceVar = self._requires(distanceVar)
        self.bulkVar = self._requires(bulkVar)
        self.rateConstant = rateConstant
        self.dt = 0
开发者ID:regmi,项目名称:fipy,代码行数:9,代码来源:adsorbingSurfactantEquation.py

示例2: __init__

# 需要导入模块: from fipy.variables.cellVariable import CellVariable [as 别名]
# 或者: from fipy.variables.cellVariable.CellVariable import __init__ [as 别名]
    def __init__(self, faceVariable, mesh = None):
        if not mesh:
            mesh = faceVariable.getMesh()

        CellVariable.__init__(self, mesh, hasOld = 0)
    
        self.faceVariable = self._requires(faceVariable)
开发者ID:calbaker,项目名称:FiPy-2.1.3,代码行数:9,代码来源:addOverFacesVariable.py

示例3: __init__

# 需要导入模块: from fipy.variables.cellVariable import CellVariable [as 别名]
# 或者: from fipy.variables.cellVariable.CellVariable import __init__ [as 别名]
    def __init__(self, mesh, name = '', value = 0., unit = None, hasOld = 0, narrowBandWidth = 1e+10):
        """
        Creates a `distanceVariable` object.

        :Parameters:
          - `mesh`: The mesh that defines the geometry of this variable.
          - `name`: The name of the variable.
	  - `value`: The initial value.
	  - `unit`: the physical units of the variable
          - `hasOld`: Whether the variable maintains an old value.
          - `narrowBandWidth`: The width of the region about the zero level set
            within which the distance function is evaluated.

        """
        CellVariable.__init__(self, mesh, name = name, value = value, unit = unit, hasOld = hasOld)
        self._markStale()
        self.narrowBandWidth = narrowBandWidth

        self.cellToCellDistances = MA.filled(self.mesh._getCellToCellDistances(), 0)
        self.cellNormals = MA.filled(self.mesh._getCellNormals(), 0)      
        self.cellAreas = MA.filled(self.mesh._getCellAreas(), 0)
##         self.cellToCellDistances = numerix.array(MA.array(self.mesh._getCellToCellDistances()).filled(0))
##         self.cellNormals = numerix.array(MA.array(self.mesh._getCellNormals()).filled(0))       
##         self.cellAreas = numerix.array(MA.array(self.mesh._getCellAreas()).filled(0))
        self.cellToCellIDs = numerix.array(self.mesh._getCellToCellIDsFilled())
        self.adjacentCellIDs = self.mesh._getAdjacentCellIDs()
        self.exteriorFaces = self.mesh.getExteriorFaces()
        self.cellFaceIDs = self.mesh._getCellFaceIDs()
开发者ID:regmi,项目名称:fipy,代码行数:30,代码来源:distanceVariable.py

示例4: __init__

# 需要导入模块: from fipy.variables.cellVariable import CellVariable [as 别名]
# 或者: from fipy.variables.cellVariable.CellVariable import __init__ [as 别名]
    def __init__(self, value = 0., distanceVar = None, name = 'surfactant variable', hasOld=False):
        """

        A simple 1D test:

           >>> from fipy.meshes.grid1D import Grid1D
           >>> mesh = Grid1D(dx = 1., nx = 4)
           >>> from fipy.models.levelSet.distanceFunction.distanceVariable \\
           ...     import DistanceVariable
           >>> distanceVariable = DistanceVariable(mesh = mesh, 
           ...                                     value = (-1.5, -0.5, 0.5, 941.5))
           >>> surfactantVariable = SurfactantVariable(value = 1, 
           ...                                         distanceVar = distanceVariable)
           >>> print numerix.allclose(surfactantVariable, (0, 0., 1., 0))
           1

        A 2D test case:

           >>> from fipy.meshes.grid2D import Grid2D
           >>> mesh = Grid2D(dx = 1., dy = 1., nx = 3, ny = 3)
           >>> distanceVariable = DistanceVariable(mesh = mesh,
           ...                                     value = (1.5, 0.5, 1.5,
           ...                                              0.5,-0.5, 0.5,
           ...                                              1.5, 0.5, 1.5))
           >>> surfactantVariable = SurfactantVariable(value = 1, 
           ...                                         distanceVar = distanceVariable)
           >>> print numerix.allclose(surfactantVariable, (0, 1, 0, 1, 0, 1, 0, 1, 0))
           1

        Another 2D test case:

           >>> mesh = Grid2D(dx = .5, dy = .5, nx = 2, ny = 2)
           >>> distanceVariable = DistanceVariable(mesh = mesh, 
           ...                                     value = (-0.5, 0.5, 0.5, 1.5))
           >>> surfactantVariable = SurfactantVariable(value = 1, 
           ...                                         distanceVar = distanceVariable)
           >>> print numerix.allclose(surfactantVariable, 
           ...                  (0, numerix.sqrt(2), numerix.sqrt(2), 0))
           1

        :Parameters:
          - `value`: The initial value.
          - `distanceVar`: A `DistanceVariable` object.
          - `name`: The name of the variable.
          
        """


        CellVariable.__init__(self, mesh = distanceVar.getMesh(), name = name, hasOld=False)

        self.distanceVar = self._requires(distanceVar)
        self.value = distanceVar.getCellInterfaceAreas() * value / self.mesh.getCellVolumes()

        if hasOld:
            self.old = self.copy()
        else:
            self.old = None

        self.interfaceSurfactantVariable = None
开发者ID:calbaker,项目名称:FiPy-2.1.3,代码行数:61,代码来源:surfactantVariable.py

示例5: __init__

# 需要导入模块: from fipy.variables.cellVariable import CellVariable [as 别名]
# 或者: from fipy.variables.cellVariable.CellVariable import __init__ [as 别名]
    def __init__(self, distanceVar):
        """
        Creates an `_InterfaceAreaVariable` object.

        :Parameters:
          - `distanceVar` : A `DistanceVariable` object.

        """
        CellVariable.__init__(self, distanceVar.mesh, hasOld=False)
        self.distanceVar = self._requires(distanceVar)
开发者ID:LWhitson2,项目名称:fipy,代码行数:12,代码来源:interfaceAreaVariable.py

示例6: __init__

# 需要导入模块: from fipy.variables.cellVariable import CellVariable [as 别名]
# 或者: from fipy.variables.cellVariable.CellVariable import __init__ [as 别名]
 def __init__(self, distribution, dx = 1., nx = None, offset = 0.):
     r"""
     Produces a histogram of the values of the supplied distribution.
     
     :Parameters:
         
         - `distribution`: The collection of values to sample.
         - `dx`: the bin size
         - `nx`: the number of bins
         - `offset`: the position of the first bin
     """
     CellVariable.__init__(self, mesh = Grid1D(dx = dx, nx = nx) + (offset,))
     self.distribution = self._requires(distribution)
开发者ID:LWhitson2,项目名称:fipy,代码行数:15,代码来源:histogramVariable.py

示例7: __init__

# 需要导入模块: from fipy.variables.cellVariable import CellVariable [as 别名]
# 或者: from fipy.variables.cellVariable.CellVariable import __init__ [as 别名]
    def __init__(self, mesh, name = '', value = 0., unit = None, hasOld = 0):
        """
        Creates a `distanceVariable` object.

        :Parameters:
          - `mesh`: The mesh that defines the geometry of this variable.
          - `name`: The name of the variable.
	  - `value`: The initial value.
	  - `unit`: the physical units of the variable
          - `hasOld`: Whether the variable maintains an old value.

        """
        CellVariable.__init__(self, mesh, name = name, value = value, unit = unit, hasOld = hasOld)
        self._markStale()
开发者ID:LWhitson2,项目名称:fipy,代码行数:16,代码来源:distanceVariable.py

示例8: __init__

# 需要导入模块: from fipy.variables.cellVariable import CellVariable [as 别名]
# 或者: from fipy.variables.cellVariable.CellVariable import __init__ [as 别名]
    def __init__(self, ionVar = None, distanceVar = None, depositionRate = None, metalIonMolarVolume = None):
        """
        Creates a `_MetalIonSourceVariable` object.

        :Parameters:
          - `ionVar` : The metal ion concentration.
          - `distanceVar` : A `DistanceVariable` object.
          - `depositionRate` : The deposition rate.
          - `metalIonMolarVolume` : Molar volume of the metal ions.
       
        """
        
        CellVariable.__init__(self, distanceVar.getMesh(), hasOld = 0)
        self.ionVar = self._requires(ionVar)
        self.distanceVar = self._requires(distanceVar)
        self.depositionRate = self._requires(depositionRate)
        self.metalIonMolarVolume = metalIonMolarVolume
开发者ID:calbaker,项目名称:FiPy-2.1.3,代码行数:19,代码来源:metalIonSourceVariable.py

示例9: __init__

# 需要导入模块: from fipy.variables.cellVariable import CellVariable [as 别名]
# 或者: from fipy.variables.cellVariable.CellVariable import __init__ [as 别名]
 def __init__(self, rateConstant = None, distanceVar = None):
     CellVariable.__init__(self, mesh = distanceVar.getMesh())
     self.distanceVar = self._requires(distanceVar)
     self.rateConstant = rateConstant
开发者ID:calbaker,项目名称:FiPy-2.1.3,代码行数:6,代码来源:surfactantBulkDiffusionEquation.py

示例10: __init__

# 需要导入模块: from fipy.variables.cellVariable import CellVariable [as 别名]
# 或者: from fipy.variables.cellVariable.CellVariable import __init__ [as 别名]
 def __init__(self, var, name=""):
     CellVariable.__init__(self, mesh=var.mesh, name=name, rank=var.rank + 1)
     self.var = self._requires(var)
开发者ID:Rhys314,项目名称:fipy,代码行数:5,代码来源:leastSquaresCellGradVariable.py

示例11: __init__

# 需要导入模块: from fipy.variables.cellVariable import CellVariable [as 别名]
# 或者: from fipy.variables.cellVariable.CellVariable import __init__ [as 别名]
 def __init__(self, var = None, name = ''):
     CellVariable.__init__(self, mesh = mesh.getFineMesh(), name = name)
     self.var = self._requires(var)
开发者ID:ghorn,项目名称:Eg,代码行数:5,代码来源:inputGold.py

示例12: __init__

# 需要导入模块: from fipy.variables.cellVariable import CellVariable [as 别名]
# 或者: from fipy.variables.cellVariable.CellVariable import __init__ [as 别名]
 def __init__(self, var, name=''):
     CellVariable.__init__(self, mesh=var.mesh, name=name, elementshape=(var.mesh.dim,) + var.shape[:-1])
     self.var = self._requires(var)
     self.faceGradientContributions = _FaceGradContributions(self.var)
开发者ID:usnistgov,项目名称:fipy,代码行数:6,代码来源:gaussCellGradVariable.py

示例13: __init__

# 需要导入模块: from fipy.variables.cellVariable import CellVariable [as 别名]
# 或者: from fipy.variables.cellVariable.CellVariable import __init__ [as 别名]
 def __init__(self, mesh, name = '', hasOld = 0):
     if self.__class__ is NoiseVariable:
         raise NotImplementedError, "can't instantiate abstract base class"
         
     CellVariable.__init__(self, mesh = mesh, name = name, hasOld = hasOld)
     self.scramble()
开发者ID:regmi,项目名称:fipy,代码行数:8,代码来源:noiseVariable.py

示例14: __init__

# 需要导入模块: from fipy.variables.cellVariable import CellVariable [as 别名]
# 或者: from fipy.variables.cellVariable.CellVariable import __init__ [as 别名]
 def __init__(self, surfactantVar):
     CellVariable.__init__(self, name = surfactantVar.name + "_interface", mesh = surfactantVar.mesh)
     self.surfactantVar = self._requires(surfactantVar)
开发者ID:LWhitson2,项目名称:fipy,代码行数:5,代码来源:surfactantVariable.py

示例15: __init__

# 需要导入模块: from fipy.variables.cellVariable import CellVariable [as 别名]
# 或者: from fipy.variables.cellVariable.CellVariable import __init__ [as 别名]
 def __init__(self, modVar):
     CellVariable.__init__(self, mesh = modVar.getMesh())
     self.modVar = self._requires(modVar)
开发者ID:calbaker,项目名称:FiPy-2.1.3,代码行数:5,代码来源:modularVariable.py


注:本文中的fipy.variables.cellVariable.CellVariable.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。