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


Python AnalyticalSoln.stress方法代码示例

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


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

示例1: TestShearDisp

# 需要导入模块: from sheardisp_soln import AnalyticalSoln [as 别名]
# 或者: from sheardisp_soln.AnalyticalSoln import stress [as 别名]
class TestShearDisp(TestTet4):
  """
  Test suite for testing pylith with 2-D shear extension.
  """

  def setUp(self):
    """
    Setup for test.
    """
    TestTet4.setUp(self)
    run_pylith()
    self.outputRoot = "sheardisp"

    self.soln = AnalyticalSoln()
    return


  def calcDisplacements(self, vertices):
    """
    Calculate displacement field given coordinates of vertices.
    """
    return self.soln.displacement(vertices)


  def calcStateVar(self, name, vertices, cells):
    """
    Calculate state variable.
    """
    ncells = self.mesh['ncells']
    pts = numpy.zeros( (ncells, 3), dtype=numpy.float64)
    if name == "total_strain":
      stateVar = self.soln.strain(pts)
    elif name == "stress":
      stateVar = self.soln.stress(pts)
    else:
      raise ValueError("Unknown state variable '%s'." % name)

    return stateVar
开发者ID:youngsolar,项目名称:pylith,代码行数:40,代码来源:TestShearDisp.py

示例2: TestFaultsIntersectNoSlip

# 需要导入模块: from sheardisp_soln import AnalyticalSoln [as 别名]
# 或者: from sheardisp_soln.AnalyticalSoln import stress [as 别名]
class TestFaultsIntersectNoSlip(TestTet4):
  """
  Test suite for testing pylith with shear slip on two faults.
  """

  def setUp(self):
    """
    Setup for test.
    """
    TestTet4.setUp(self)
    self.nverticesO = self.mesh['nvertices']

    # Fault x
    self.mesh['nvertices'] += 8
    self.faultMeshX = {'nvertices': 19,
                       'spaceDim': 3,
                       'ncells': 20,
                       'ncorners': 3}

    # Fault y
    self.mesh['nvertices'] += 2
    self.faultMeshY = {'nvertices': 9,
                       'spaceDim': 3,
                       'ncells': 8,
                       'ncorners': 3}
    run_pylith()
    self.outputRoot = "faultsintersectnoslip"

    self.soln = AnalyticalSoln()
    return


  def test_fault_info(self):
    """
    Check fault information.
    """
    if not self.checkResults:
      return

    from pylith.tests.Fault import check_vertex_fields
    fields = ["normal_dir", "final_slip", "slip_time"]

    self.fault = "x"
    filename = "%s-faultx_info.h5" % self.outputRoot
    check_vertex_fields(self, filename, self.faultMeshX, fields)

    self.fault = "y"
    filename = "%s-faulty_info.h5" % self.outputRoot
    check_vertex_fields(self, filename, self.faultMeshY, fields)

    return


  def test_fault_data(self):
    """
    Check fault information.
    """
    if not self.checkResults:
      return

    from pylith.tests.Fault import check_vertex_fields
    fields = ["slip"]

    filename = "%s-faultx.h5" % self.outputRoot
    self.fault = "x"
    check_vertex_fields(self, filename, self.faultMeshX, fields)

    filename = "%s-faulty.h5" % self.outputRoot
    self.fault = "y"
    check_vertex_fields(self, filename, self.faultMeshY, fields)

    return


  def calcDisplacements(self, vertices):
    """
    Calculate displacement field given coordinates of vertices.
    """
    return self.soln.displacement(vertices)


  def calcStateVar(self, name, vertices, cells):
    """
    Calculate state variable.
    """
    ncells = self.mesh['ncells']
    pts = numpy.zeros( (ncells, 3), dtype=numpy.float64)
    if name == "total_strain":
      stateVar = self.soln.strain(pts)
    elif name == "stress":
      stateVar = self.soln.stress(pts)
    else:
      raise ValueError("Unknown state variable '%s'." % name)

    return stateVar


  def calcFaultField(self, name, vertices):
    """
    Calculate fault info.
#.........这里部分代码省略.........
开发者ID:panzhengyang,项目名称:pylith,代码行数:103,代码来源:TestFaultsIntersectNoSlip.py

示例3: TestShearDispNoSlip

# 需要导入模块: from sheardisp_soln import AnalyticalSoln [as 别名]
# 或者: from sheardisp_soln.AnalyticalSoln import stress [as 别名]
class TestShearDispNoSlip(TestTet4):
  """
  Test suite for testing pylith with 2-D shear extension.
  """

  def setUp(self):
    """
    Setup for test.
    """
    TestTet4.setUp(self)
    self.nverticesO = self.mesh['nvertices']
    self.mesh['nvertices'] += 8
    self.faultMesh = {'nvertices': 19,
                      'spaceDim': 3,
                      'ncells': 20,
                      'ncorners': 3}
    run_pylith()
    self.outputRoot = "sheardispnoslip"

    self.soln = AnalyticalSoln()
    return


  def test_fault_info(self):
    """
    Check fault information.
    """
    if not self.checkResults:
      return

    filename = "%s-fault_info.h5" % self.outputRoot
    fields = ["normal_dir", "final_slip", "slip_time"]

    from pylith.tests.Fault import check_vertex_fields
    check_vertex_fields(self, filename, self.faultMesh, fields)

    return


  def test_fault_data(self):
    """
    Check fault information.
    """
    if not self.checkResults:
      return

    filename = "%s-fault.h5" % self.outputRoot
    fields = ["slip"]

    from pylith.tests.Fault import check_vertex_fields
    check_vertex_fields(self, filename, self.faultMesh, fields)

    return


  def calcDisplacements(self, vertices):
    """
    Calculate displacement field given coordinates of vertices.
    """
    return self.soln.displacement(vertices)


  def calcStateVar(self, name, vertices, cells):
    """
    Calculate state variable.
    """
    ncells = self.mesh['ncells']
    pts = numpy.zeros( (ncells, 3), dtype=numpy.float64)
    if name == "total_strain":
      stateVar = self.soln.strain(pts)
    elif name == "stress" or name == "cauchy_stress":
      stateVar = self.soln.stress(pts)
    else:
      raise ValueError("Unknown state variable '%s'." % name)

    return stateVar


  def calcFaultField(self, name, vertices):
    """
    Calculate fault info.
    """

    normalDir = (+1.0, 0.0, 0.0)
    finalSlip = 0.0
    slipTime = 0.0

    nvertices = self.faultMesh['nvertices']

    if name == "normal_dir":
      field = numpy.zeros( (1, nvertices, 3), dtype=numpy.float64)
      field[0,:,0] = normalDir[0]
      field[0,:,1] = normalDir[1]
      field[0,:,2] = normalDir[2]

    elif name == "final_slip":
      field = numpy.zeros( (1, nvertices, 3), dtype=numpy.float64)
      field[0,:,0] = finalSlip
      
    elif name == "slip_time":
#.........这里部分代码省略.........
开发者ID:rishabhdutta,项目名称:pylith,代码行数:103,代码来源:TestShearDispNoSlip.py

示例4: TestShearDispNoSlipRefine

# 需要导入模块: from sheardisp_soln import AnalyticalSoln [as 别名]
# 或者: from sheardisp_soln.AnalyticalSoln import stress [as 别名]
class TestShearDispNoSlipRefine(TestHex8):
  """
  Test suite for testing pylith with 2-D shear extension.
  """

  def setUp(self):
    """
    Setup for test.
    """
    TestHex8.setUp(self)
    self.mesh = {'ncells-elastic': 180*8,
                 'ncells-viscoelastic': 180*8,
                 'ncorners': 8,
                 'nvertices': 3591,
                 'spaceDim': 3,
                 'tensorSize': 6}
    self.nverticesO = self.mesh['nvertices']
    self.mesh['nvertices'] += 44
    self.faultMesh = {'nvertices': 65,
                      'spaceDim': 3,
                      'ncells': 48,
                      'ncorners': 4}

    run_pylith()
    self.outputRoot = "sheardispnosliprefine"

    self.soln = AnalyticalSoln()
    return


  def test_fault_info(self):
    """
    Check fault information.
    """
    if not self.checkResults:
      return

    filename = "%s-fault_info.h5" % self.outputRoot
    fields = ["normal_dir", "final_slip", "slip_time"]

    from pylith.tests.Fault import check_vertex_fields
    check_vertex_fields(self, filename, self.faultMesh, fields)

    return


  def test_fault_data(self):
    """
    Check fault information.
    """
    if not self.checkResults:
      return

    filename = "%s-fault.h5" % self.outputRoot
    fields = ["slip"]

    from pylith.tests.Fault import check_vertex_fields
    check_vertex_fields(self, filename, self.faultMesh, fields)

    return


  def calcDisplacements(self, vertices):
    """
    Calculate displacement field given coordinates of vertices.
    """
    return self.soln.displacement(vertices)


  def calcStateVar(self, name, vertices, cells):
    """
    Calculate state variable.
    """
    ncells = self.mesh['ncells']
    pts = numpy.zeros( (ncells, 3), dtype=numpy.float64)
    if name == "total_strain":
      stateVar = self.soln.strain(pts)
    elif name == "stress":
      stateVar = self.soln.stress(pts)
    else:
      raise ValueError("Unknown state variable '%s'." % name)

    return stateVar


  def calcFaultField(self, name, vertices):
    """
    Calculate fault info.
    """

    normalDir = (-1.0, 0.0, 0.0)
    finalSlip = 0.0
    slipTime = 0.0

    nvertices = self.faultMesh['nvertices']

    if name == "normal_dir":
      field = numpy.zeros( (1, nvertices, 3), dtype=numpy.float64)
      field[0,:,0] = normalDir[0]
      field[0,:,1] = normalDir[1]
#.........这里部分代码省略.........
开发者ID:youngsolar,项目名称:pylith,代码行数:103,代码来源:TestShearDispNoSlipRefine.py

示例5: TestShearDispFriction

# 需要导入模块: from sheardisp_soln import AnalyticalSoln [as 别名]
# 或者: from sheardisp_soln.AnalyticalSoln import stress [as 别名]
class TestShearDispFriction(TestTri3):
  """
  Test suite for testing pylith with 2-D shear extension.
  """

  def setUp(self):
    """
    Setup for test.
    """
    TestTri3.setUp(self)
    self.nverticesO = self.mesh['nvertices']
    self.mesh['nvertices'] += 1
    self.faultMesh = {'nvertices': 3,
                      'spaceDim': 2,
                      'ncells': 2,
                      'ncorners': 2}
    run_pylith()
    self.outputRoot = "sheardispfriction"

    self.soln = AnalyticalSoln()
    return


  def test_fault_info(self):
    """
    Check fault information.
    """
    if not self.checkResults:
      return

    filename = "%s-fault_info.h5" % self.outputRoot
    fields = ["strike_dir", "normal_dir", "traction_initial","friction_coefficient","cohesion"]

    from pylith.tests.Fault import check_vertex_fields
    check_vertex_fields(self, filename, self.faultMesh, fields)

    return


  def test_fault_data(self):
    """
    Check fault information.
    """
    if not self.checkResults:
      return

    filename = "%s-fault.h5" % self.outputRoot
    fields = ["slip"]

    from pylith.tests.Fault import check_vertex_fields
    check_vertex_fields(self, filename, self.faultMesh, fields)

    return


  def calcDisplacements(self, vertices):
    """
    Calculate displacement field given coordinates of vertices.
    """
    return self.soln.displacement(vertices)


  def calcStateVar(self, name, vertices, cells):
    """
    Calculate state variable.
    """
    ncells = self.mesh['ncells']
    pts = numpy.zeros( (ncells, 3), dtype=numpy.float64)
    if name == "total_strain":
      stateVar = self.soln.strain(pts)
    elif name == "stress":
      stateVar = self.soln.stress(pts)
    else:
      raise ValueError("Unknown state variable '%s'." % name)

    return stateVar


  def calcFaultField(self, name, vertices):
    """
    Calculate fault info.
    """

    strikeDir = (-1.0, 0.0)
    normalDir = (0.0, 1.0)
    initialTraction = (0.0, -100.0e+6)
    frictionCoefficient = 1.0

    nvertices = self.faultMesh['nvertices']

    if name == "strike_dir":
      field = numpy.zeros( (1, nvertices, 2), dtype=numpy.float64)
      field[0,:,0] = strikeDir[0]
      field[0,:,1] = strikeDir[1]

    elif name == "normal_dir":
      field = numpy.zeros( (1, nvertices, 2), dtype=numpy.float64)
      field[0,:,0] = normalDir[0]
      field[0,:,1] = normalDir[1]

#.........这里部分代码省略.........
开发者ID:youngsolar,项目名称:pylith,代码行数:103,代码来源:TestShearDispFriction.py

示例6: TestFrictionNoSlip

# 需要导入模块: from sheardisp_soln import AnalyticalSoln [as 别名]
# 或者: from sheardisp_soln.AnalyticalSoln import stress [as 别名]
class TestFrictionNoSlip(TestHex8):
    """
  Test suite for testing pylith with 2-D shear extension.
  """

    def setUp(self):
        """
    Setup for test.
    """
        TestHex8.setUp(self)
        self.nverticesO = self.mesh["nvertices"]
        self.mesh["nvertices"] += 10
        self.faultMesh = {"nvertices": 21, "spaceDim": 3, "ncells": 12, "ncorners": 4}

        run_pylith()
        self.outputRoot = "frictionnoslip"

        self.soln = AnalyticalSoln()
        return

    def test_fault_info(self):
        """
    Check fault information.
    """
        if not self.checkResults:
            return

        filename = "%s-fault_info.h5" % self.outputRoot
        fields = ["normal_dir", "strike_dir", "static_coefficient", "traction_initial"]

        from pylith.tests.Fault import check_vertex_fields

        check_vertex_fields(self, filename, self.faultMesh, fields)

        return

    def test_fault_data(self):
        """
    Check fault information.
    """
        if not self.checkResults:
            return

        filename = "%s-fault.h5" % self.outputRoot
        fields = ["slip"]

        from pylith.tests.Fault import check_vertex_fields

        check_vertex_fields(self, filename, self.faultMesh, fields)

        return

    def calcDisplacements(self, vertices):
        """
    Calculate displacement field given coordinates of vertices.
    """
        return self.soln.displacement(vertices)

    def calcStateVar(self, name, vertices, cells):
        """
    Calculate state variable.
    """
        ncells = self.mesh["ncells"]
        pts = numpy.zeros((ncells, 3), dtype=numpy.float64)
        if name == "total_strain":
            stateVar = self.soln.strain(pts)
        elif name == "stress":
            stateVar = self.soln.stress(pts)
        else:
            raise ValueError("Unknown state variable '%s'." % name)

        return stateVar

    def calcFaultField(self, name, vertices):
        """
    Calculate fault info.
    """

        normalDir = (-1.0, 0.0, 0.0)
        strikeDir = (0.0, -1.0, 0.0)

        staticCoef = 0.6
        initialTraction = (0.0, 0.0, -100.0e6)

        nvertices = self.faultMesh["nvertices"]

        if name == "normal_dir":
            field = numpy.zeros((1, nvertices, 3), dtype=numpy.float64)
            field[0, :, 0] = normalDir[0]
            field[0, :, 1] = normalDir[1]
            field[0, :, 2] = normalDir[2]

        elif name == "strike_dir":
            field = numpy.zeros((1, nvertices, 3), dtype=numpy.float64)
            field[0, :, 0] = strikeDir[0]
            field[0, :, 1] = strikeDir[1]
            field[0, :, 2] = strikeDir[2]

        elif name == "static_coefficient":
            field = staticCoef * numpy.ones((1, nvertices, 1), dtype=numpy.float64)
#.........这里部分代码省略.........
开发者ID:panzhengyang,项目名称:pylith,代码行数:103,代码来源:TestFrictionNoSlip.py

示例7: TestFrictionNoSlipHalo

# 需要导入模块: from sheardisp_soln import AnalyticalSoln [as 别名]
# 或者: from sheardisp_soln.AnalyticalSoln import stress [as 别名]
class TestFrictionNoSlipHalo(TestHex8):
  """
  Test suite for testing pylith with 2-D shear extension.
  """

  def setUp(self):
    """
    Setup for test.
    """
    TestHex8.setUp(self)
    self.nverticesO = self.mesh['nvertices']
    self.mesh['nvertices'] += 21
    self.faultMesh = {'nvertices': 34,
                      'spaceDim': 3,
                      'ncells': 23,
                      'ncorners': 4}

    run_pylith()
    self.outputRoot = "frictionnoslip_halo"

    self.soln = AnalyticalSoln()
    return


  def test_fault_info(self):
    """
    Check fault information.
    """
    if not self.checkResults:
      return

    filename = "%s-fault_info.h5" % self.outputRoot
    fields = ["static_coefficient"]

    from pylith.tests.Fault import check_vertex_fields
    check_vertex_fields(self, filename, self.faultMesh, fields)

    return


  def test_fault_data(self):
    """
    Check fault information.
    """
    if not self.checkResults:
      return

    filename = "%s-fault.h5" % self.outputRoot
    fields = ["slip"]

    from pylith.tests.Fault import check_vertex_fields
    check_vertex_fields(self, filename, self.faultMesh, fields)

    return


  def calcDisplacements(self, vertices):
    """
    Calculate displacement field given coordinates of vertices.
    """
    return self.soln.displacement(vertices)


  def calcStateVar(self, name, vertices, cells):
    """
    Calculate state variable.
    """
    ncells = self.mesh['ncells']
    pts = numpy.zeros( (ncells, 3), dtype=numpy.float64)
    if name == "total_strain":
      stateVar = self.soln.strain(pts)
    elif name == "stress":
      stateVar = self.soln.stress(pts)
    else:
      raise ValueError("Unknown state variable '%s'." % name)

    return stateVar


  def calcFaultField(self, name, vertices):
    """
    Calculate fault info.
    """

    normalDir = (-1.0, 0.0, 0.0)
    strikeDir = (0.0, -1.0, 0.0)

    staticCoef  = 0.6
    initialTraction = (0.0,0.0,-100.0e+6)

    nvertices = self.faultMesh['nvertices']


    if name == "static_coefficient":
      field = staticCoef*numpy.ones( (1, nvertices, 1), dtype=numpy.float64)
      
    elif name == "slip":
      field = numpy.zeros( (1, nvertices, 3), dtype=numpy.float64)

    else:
#.........这里部分代码省略.........
开发者ID:youngsolar,项目名称:pylith,代码行数:103,代码来源:TestFrictionNoSlipHalo.py


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