本文整理汇总了Python中esys.escript.linearPDEs.LinearPDE.applyOperator方法的典型用法代码示例。如果您正苦于以下问题:Python LinearPDE.applyOperator方法的具体用法?Python LinearPDE.applyOperator怎么用?Python LinearPDE.applyOperator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类esys.escript.linearPDEs.LinearPDE
的用法示例。
在下文中一共展示了LinearPDE.applyOperator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: whereZero
# 需要导入模块: from esys.escript.linearPDEs import LinearPDE [as 别名]
# 或者: from esys.escript.linearPDEs.LinearPDE import applyOperator [as 别名]
#
msk = whereZero(domain.getX()[0]) * [1.0, 1.0]
#
# set the normal stress components on face elements.
# faces tagged with 21 get the normal stress [0,-press0].
#
# now the pressure is set to zero for x0 coordinates equal 1. (= right face)
press = whereZero(FunctionOnBoundary(domain).getX()[0] - 1.0) * pres0 * [1.0, 0.0]
# assemble the linear system:
mypde = LinearPDE(domain)
k3 = kronecker(domain)
k3Xk3 = outer(k3, k3)
mypde.setValue(
A=mu * (swap_axes(k3Xk3, 0, 3) + swap_axes(k3Xk3, 1, 3)) + lame * k3Xk3, Y=[0, -g * rho], y=press, q=msk, r=[0, 0]
)
mypde.setSymmetryOn()
mypde.getSolverOptions().setVerbosityOn()
# use direct solver (default is iterative)
# mypde.getSolverOptions().setSolverMethod(SolverOptions.DIRECT)
# mypde.getSolverOptions().setPreconditioner(SolverOptions.AMG)
# solve for the displacements:
u_d = mypde.getSolution()
mypde.applyOperator(u_d)
# get the gradient and calculate the stress:
g = grad(u_d)
stress = lame * trace(g) * kronecker(domain) + mu * (g + transpose(g))
# write the hydrostatic pressure:
saveVTK("result.vtu", displacement=u_d, pressure=trace(stress) / domain.getDim())