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


Python CellVariable.getFaceGrad方法代码示例

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


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

示例1: CellVariable

# 需要导入模块: from fipy.variables.cellVariable import CellVariable [as 别名]
# 或者: from fipy.variables.cellVariable.CellVariable import getFaceGrad [as 别名]
    temperature = CellVariable(
        name='temperature',
        mesh=mesh,
        value=initialTemperature,
        hasOld=1
        )

    bench.stop('variables')

    bench.start()

    from fipy.tools import numerix
    mVar = phase - 0.5 - kappa1 / numerix.pi * \
        numerix.arctan(kappa2 * temperature)

    phaseY = phase.getFaceGrad().dot((0, 1))
    phaseX = phase.getFaceGrad().dot((1, 0))
    psi = theta + numerix.arctan2(phaseY, phaseX)
    Phi = numerix.tan(N * psi / 2)
    PhiSq = Phi**2
    beta = (1. - PhiSq) / (1. + PhiSq)
    betaPsi = -N * 2 * Phi / (1 + PhiSq)
    A = alpha**2 * c * (1.+ c * beta) * betaPsi
    D = alpha**2 * (1.+ c * beta)**2
    dxi = phase.getFaceGrad()._take((1, 0), axis = 1) * (-1, 1)
    anisotropySource = (A * dxi).getDivergence()
    from fipy.terms.transientTerm import TransientTerm
    from fipy.terms.explicitDiffusionTerm import ExplicitDiffusionTerm
    from fipy.terms.implicitSourceTerm import ImplicitSourceTerm
    phaseEq = TransientTerm(tau) == ExplicitDiffusionTerm(D) + \
        ImplicitSourceTerm(mVar * ((mVar < 0) - phase)) + \
开发者ID:ghorn,项目名称:Eg,代码行数:33,代码来源:anisotropy.py

示例2: Grid2D

# 需要导入模块: from fipy.variables.cellVariable import CellVariable [as 别名]
# 或者: from fipy.variables.cellVariable.CellVariable import getFaceGrad [as 别名]
sweeps=10

from fipy.meshes.grid2D import Grid2D
mesh = Grid2D(nx=N, ny=N, dx=dL, dy=dL)

from fipy.variables.cellVariable import CellVariable

u = CellVariable(mesh=mesh, name='X velocity')
v = CellVariable(mesh=mesh, name='Y velocity')

from fipy.variables.vectorFaceVariable import VectorFaceVariable
velocity = VectorFaceVariable(mesh=mesh)

Xhat=(1,0)
Yhat=(0,1)
velocity=u.getFaceGrad().dot(Xhat) * Xhat + v.getFaceGrad().dot(Yhat) * Yhat

from fipy.terms.implicitDiffusionTerm import ImplicitDiffusionTerm

diffTerm=ImplicitDiffusionTerm(coeff=viscosity)

from fipy.terms.exponentialConvectionTerm import ExponentialConvectionTerm

convTerm = ExponentialConvectionTerm(coeff = velocity,diffusionTerm = diffTerm)

eq1= diffTerm - u * u.getGrad().dot(Xhat) - v * u.getGrad().dot(Yhat)
eq2= velocity.getDivergence()
#eq2= u.getGrad() + v.getGrad()
eq2=u.getFaceGrad().dot(Xhat) * Xhat + v.getFaceGrad().dot(Yhat) * Yhat
eq2= u.getGrad().dot(Xhat) + v.getGrad().dot(Yhat)
eq2= ImplicitDiffusionTerm(1) + u.getGrad().dot(Xhat) + v.getGrad().dot(Yhat)
开发者ID:ghorn,项目名称:Eg,代码行数:33,代码来源:vlakkeplaat.py


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