本文整理汇总了Python中fipy.variables.cellVariable.CellVariable.getOld方法的典型用法代码示例。如果您正苦于以下问题:Python CellVariable.getOld方法的具体用法?Python CellVariable.getOld怎么用?Python CellVariable.getOld使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fipy.variables.cellVariable.CellVariable
的用法示例。
在下文中一共展示了CellVariable.getOld方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TransientTerm
# 需要导入模块: from fipy.variables.cellVariable import CellVariable [as 别名]
# 或者: from fipy.variables.cellVariable.CellVariable import getOld [as 别名]
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)) + \
((mVar > 0.) * mVar * phase + anisotropySource)
from fipy.terms.implicitDiffusionTerm import ImplicitDiffusionTerm
temperatureEq = TransientTerm() == \
ImplicitDiffusionTerm(tempDiffusionCoeff) + \
(phase - phase.getOld()) / timeStepDuration
bench.stop('terms')
phase.updateOld()
temperature.updateOld()
phaseEq.solve(phase, dt=timeStepDuration)
temperatureEq.solve(temperature, dt=timeStepDuration)
steps = 10
bench.start()
for i in range(steps):
phase.updateOld()
temperature.updateOld()
示例2: Grid1D
# 需要导入模块: from fipy.variables.cellVariable import CellVariable [as 别名]
# 或者: from fipy.variables.cellVariable.CellVariable import getOld [as 别名]
from fipy.meshes.grid1D import Grid1D
mesh = Grid1D(nx = nx, dx = dx)
from fipy.variables.cellVariable import CellVariable
u = CellVariable(name="solution variable",
mesh=mesh,
value=0,hasOld=1)
from fipy.terms.implicitDiffusionTerm import ImplicitDiffusionTerm
from fipy.terms.transientTerm import TransientTerm
a=1
timeStepDuration = 0.01
steps=1000
eq= ImplicitDiffusionTerm(coeff=(a,a))+(u.getOld().getOld() - 2*u.getOld() + u) / timeStepDuration ** 2
from fipy.boundaryConditions.fixedValue import FixedValue
from fipy.boundaryConditions.fixedFlux import FixedFlux
from fipy.boundaryConditions.nthOrderBoundaryCondition import NthOrderBoundaryCondition
BCs = ( NthOrderBoundaryCondition(faces=mesh.getFacesRight(), value=0,order=2),
NthOrderBoundaryCondition(faces=mesh.getFacesRight(), value=1,order=3),
FixedValue(faces=mesh.getFacesLeft(), value=0),
FixedFlux(faces=mesh.getFacesLeft(), value=0))
from fipy import viewers
viewer = viewers.make(vars=(u))