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


Python axialdisp_soln.AnalyticalSoln类代码示例

本文整理汇总了Python中axialdisp_soln.AnalyticalSoln的典型用法代码示例。如果您正苦于以下问题:Python AnalyticalSoln类的具体用法?Python AnalyticalSoln怎么用?Python AnalyticalSoln使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: run

  def run(self):
    """
    Generate the database.
    """
    # Domain
    x = numpy.arange(-4000.0, 4000.1, 500.0)
    y = numpy.arange(-4000.0, 4000.1, 500.0)
    z = numpy.arange(-6000.0,    0.1, 500.0)
    nxpts = x.shape[0]
    nypts = y.shape[0]
    nzpts = z.shape[0]

    xx = numpy.tile(x, (1,nypts*nzpts))
    yy = numpy.tile(y, (nxpts,nzpts)).transpose()
    zz = numpy.tile(z, (nxpts*nypts,1)).transpose()

    xyz = numpy.zeros( (nxpts*nypts*nzpts, 3), dtype=numpy.float64)
    xyz[:,0] = numpy.ravel(xx)
    xyz[:,1] = numpy.ravel(yy)
    xyz[:,2] = numpy.ravel(zz)

    from axialdisp_soln import AnalyticalSoln
    soln = AnalyticalSoln()
    disp = soln.displacement(xyz)

    from spatialdata.geocoords.CSCart import CSCart
    cs = CSCart()
    cs.inventory.spaceDim = 3
    cs._configure()
    data = {'points': xyz,
            'coordsys': cs,
            'data_dim': 3,
            'values': [{'name': "displacement-x",
                        'units': "m",
                        'data': numpy.ravel(disp[:,0])},
                       {'name': "displacement-y",
                        'units': "m",
                        'data': numpy.ravel(disp[:,1])},
                       {'name': "displacement-z",
                        'units': "m",
                        'data': numpy.ravel(disp[:,2])}]}

    from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
    io = SimpleIOAscii()
    io.inventory.filename = "axial_disp.spatialdb"
    io._configure()
    io.write(data)
    return
开发者ID:jjle,项目名称:pylith,代码行数:48,代码来源:axialdisp_gendb.py

示例2: setUp

 def setUp(self):
   """
   Setup for test.
   """
   TestQuad4.setUp(self)
   run_pylith()
   self.outputRoot = "axialdisp"
   self.soln = AnalyticalSoln()
   return
开发者ID:youngsolar,项目名称:pylith,代码行数:9,代码来源:TestAxialDisp.py

示例3: setUp

  def setUp(self):
    """
    Setup for test.
    """
    TestTri3.setUp(self)
    run_pylith(AxialApp, GenerateDB)
    self.outputRoot = "axialdisp"

    self.soln = AnalyticalSoln()
    return
开发者ID:geodynamics,项目名称:pylith,代码行数:10,代码来源:TestAxialDisp.py

示例4: run

  def run(self):
    """
    Generate the database.
    """
    from axialdisp_soln import AnalyticalSoln
    soln = AnalyticalSoln()

    from spatialdata.geocoords.CSCart import CSCart
    cs = CSCart()
    cs.inventory.spaceDim = 3
    cs._configure()

    from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
    io = SimpleIOAscii()

    for component in ["x","y","z"]:
      if component == "x":
        xyz = numpy.array([[-40.0e+3, 0.0, 0.0],
                           [+40.0e+3, 0.0, 0.0]], dtype=numpy.float64)
        ic = 0
      elif component == "y":
        xyz = numpy.array([[0.0, -40.0e+3, 0.0],
                           [0.0, +40.0e+3, 0.0]], dtype=numpy.float64)
        ic = 1
      elif component == "z":
        xyz = numpy.array([[0.0, 0.0, -40.0e+3],
                           [0.0, 0.0,   0.0]], dtype=numpy.float64)
        ic = 2
      disp = soln.displacement(xyz)

      io.inventory.filename = "axial_disp%s.spatialdb" % component
      io._configure()
      data = {'points': xyz,
              'coordsys': cs,
              'data_dim': 1,
              'values': [{'name': "displacement-%s" % component,
                          'units': "m",
                          'data': numpy.ravel(disp[0,:,ic])},
                         ]}
      io.write(data)
    
    return
开发者ID:geodynamics,项目名称:pylith,代码行数:42,代码来源:axialdisp_gendb.py

示例5: TestAxialDisp

class TestAxialDisp(TestQuad4):
  """
  Test suite for testing pylith with 2-D axial extension.
  """

  def setUp(self):
    """
    Setup for test.
    """
    TestQuad4.setUp(self)
    run_pylith()
    self.outputRoot = "axialdisp"
    if has_vtk():
      self.reader = VTKDataReader()
      self.soln = AnalyticalSoln()
    else:
      self.reader = None
    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:jjle,项目名称:pylith,代码行数:41,代码来源:TestAxialDisp.py

示例6: run

  def run(self):
    """
    Generate the database.
    """
    # Domain
    x = numpy.arange(-4000.0, 4000.1, 1000.0)
    y = numpy.arange(-4000.0, 4000.1, 1000.0)
    npts = x.shape[0]

    xx = x * numpy.ones( (npts, 1), dtype=numpy.float64)
    yy = y * numpy.ones( (npts, 1), dtype=numpy.float64)
    xy = numpy.zeros( (npts**2, 2), dtype=numpy.float64)
    xy[:,0] = numpy.ravel(xx)
    xy[:,1] = numpy.ravel(numpy.transpose(yy))

    from axialdisp_soln import AnalyticalSoln
    soln = AnalyticalSoln()
    disp = soln.displacement(xy)

    from spatialdata.geocoords.CSCart import CSCart
    cs = CSCart()
    cs.inventory.spaceDim = 2
    cs._configure()
    data = {'points': xy,
            'coordsys': cs,
            'data_dim': 2,
            'values': [{'name': "displacement-x",
                        'units': "m",
                        'data': numpy.ravel(disp[0,:,0])},
                       {'name': "displacement-y",
                        'units': "m",
                        'data': numpy.ravel(disp[0,:,1])}]}

    from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
    io = SimpleIOAscii()
    io.inventory.filename = "axial_disp.spatialdb"
    io._configure()
    io.write(data)
    return
开发者ID:panzhengyang,项目名称:pylith,代码行数:39,代码来源:axialdisp_gendb.py

示例7: setUp

 def setUp(self):
   """
   Setup for test.
   """
   TestQuad4.setUp(self)
   run_pylith()
   self.outputRoot = "axialdisp"
   if has_vtk():
     self.reader = VTKDataReader()
     self.soln = AnalyticalSoln()
   else:
     self.reader = None
   return
开发者ID:jjle,项目名称:pylith,代码行数:13,代码来源:TestAxialDisp.py


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