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


Python FieldVariable.set_data_from_qp方法代码示例

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


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

示例1: nodal_stress

# 需要导入模块: from sfepy.discrete import FieldVariable [as 别名]
# 或者: from sfepy.discrete.FieldVariable import set_data_from_qp [as 别名]
def nodal_stress(out, pb, state, extend=False, integrals=None):
    '''
    Calculate stresses at nodal points.
    '''

    # Point load.
    mat = pb.get_materials()['Load']
    P = 2.0 * mat.get_data('special', 'val')[1]

    # Calculate nodal stress.
    pb.time_update()

    if integrals is None: integrals = pb.get_integrals()

    stress = pb.evaluate('ev_cauchy_stress.ivn.Omega(Asphalt.D, u)', mode='qp',
                         integrals=integrals, copy_materials=False)
    sfield = Field.from_args('stress', nm.float64, (3,),
                             pb.domain.regions['Omega'])
    svar = FieldVariable('sigma', 'parameter', sfield,
                         primary_var_name='(set-to-None)')
    svar.set_data_from_qp(stress, integrals['ivn'])

    print('\n==================================================================')
    print('Given load = %.2f N' % -P)
    print('\nAnalytical solution')
    print('===================')
    print('Horizontal tensile stress = %.5e MPa/mm' % (-2.*P/(nm.pi*150.)))
    print('Vertical compressive stress = %.5e MPa/mm' % (-6.*P/(nm.pi*150.)))
    print('\nFEM solution')
    print('============')
    print('Horizontal tensile stress = %.5e MPa/mm' % (svar()[0]))
    print('Vertical compressive stress = %.5e MPa/mm' % (-svar()[1]))
    print('==================================================================')
    return out
开发者ID:clazaro,项目名称:sfepy,代码行数:36,代码来源:its2D_3.py

示例2: nodal_stress

# 需要导入模块: from sfepy.discrete import FieldVariable [as 别名]
# 或者: from sfepy.discrete.FieldVariable import set_data_from_qp [as 别名]
def nodal_stress(out, pb, state, extend=False, integrals=None):
    """
    Calculate stresses at nodal points.
    """

    # Point load.
    mat = pb.get_materials()["Load"]
    P = 2.0 * mat.get_data("special", "val")[1]

    # Calculate nodal stress.
    pb.time_update()

    if integrals is None:
        integrals = pb.get_integrals()

    stress = pb.evaluate("ev_cauchy_stress.ivn.Omega(Asphalt.D, u)", mode="qp", integrals=integrals)
    sfield = Field.from_args("stress", nm.float64, (3,), pb.domain.regions["Omega"])
    svar = FieldVariable("sigma", "parameter", sfield, primary_var_name="(set-to-None)")
    svar.set_data_from_qp(stress, integrals["ivn"])

    print "\n=================================================================="
    print "Given load = %.2f N" % -P
    print "\nAnalytical solution"
    print "==================="
    print "Horizontal tensile stress = %.5e MPa/mm" % (-2.0 * P / (nm.pi * 150.0))
    print "Vertical compressive stress = %.5e MPa/mm" % (-6.0 * P / (nm.pi * 150.0))
    print "\nFEM solution"
    print "============"
    print "Horizontal tensile stress = %.5e MPa/mm" % (svar()[0][0])
    print "Vertical compressive stress = %.5e MPa/mm" % (-svar()[0][1])
    print "=================================================================="
    return out
开发者ID:logansorenson,项目名称:sfepy,代码行数:34,代码来源:its2D_3.py


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