本文整理汇总了Python中sfepy.discrete.Problem.save_ebc方法的典型用法代码示例。如果您正苦于以下问题:Python Problem.save_ebc方法的具体用法?Python Problem.save_ebc怎么用?Python Problem.save_ebc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfepy.discrete.Problem
的用法示例。
在下文中一共展示了Problem.save_ebc方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_save_ebc
# 需要导入模块: from sfepy.discrete import Problem [as 别名]
# 或者: from sfepy.discrete.Problem import save_ebc [as 别名]
def test_save_ebc(self):
from sfepy.discrete import (FieldVariable, Integral,
Equation, Equations, Problem)
from sfepy.discrete.conditions import Conditions, EssentialBC
from sfepy.terms import Term
name = op.join(self.options.out_dir,
op.splitext(op.basename(__file__))[0])
integral = Integral('i', order=1)
u = self.variables['u']
v = FieldVariable('v', 'test', u.field, primary_var_name='u')
p = self.variables['p']
q = FieldVariable('q', 'test', p.field, primary_var_name='p')
regions = self.problem.domain.regions
omega = regions['Omega']
# Problem.save_ebc() requires to have equations defined.
t1 = Term.new('dw_lin_elastic(v, u)',
integral, omega, v=v, u=u)
t2 = Term.new('dw_laplace(q, p)', integral, omega, q=q, p=p)
eq = Equation('aux', t1 + t2)
eqs = Equations([eq])
pb = Problem('test', equations=eqs, auto_solvers=False)
all_ebcs = []
all_ebcs.append(EssentialBC('fix_u1', regions['RightFix'],
{'u.all' : nm.array([0.0, 1.0])}))
all_ebcs.append(EssentialBC('fix_u2', regions['LeftStrip'],
{'u.0' : 0.0, 'u.1' : 1.0}))
all_ebcs.append(EssentialBC('fix_p1', regions['LeftFix'],
{'p.all' : 0.0}))
all_ebcs.append(EssentialBC('fix_p2', regions['RightStrip'],
{'p.0' : 0.0}))
ebcs = Conditions(all_ebcs)
pb.time_update(ebcs=ebcs)
pb.save_ebc(name + '_ebcs_f.vtk', ebcs=ebcs, force=True)
pb.save_ebc(name + '_ebcs.vtk', ebcs=ebcs, default=-1, force=False)
return True