本文整理汇总了Python中sheardisp_soln.AnalyticalSoln类的典型用法代码示例。如果您正苦于以下问题:Python AnalyticalSoln类的具体用法?Python AnalyticalSoln怎么用?Python AnalyticalSoln使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AnalyticalSoln类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
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
示例2: setUp
def setUp(self):
"""
Setup for test.
"""
TestQuad4.setUp(self)
run_pylith(ShearApp, GenerateDB)
self.outputRoot = "sheardisp"
self.soln = AnalyticalSoln()
return
示例3: setUp
def setUp(self):
"""
Setup for test.
"""
TestTri3.setUp(self)
run_pylith()
self.outputRoot = "sheardisp"
self.soln = AnalyticalSoln()
return
示例4: 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 sheardisp_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 = "shear_disp.spatialdb"
io._configure()
io.write(data)
return
示例5: run
def run(self):
"""
Generate the database.
"""
from sheardisp_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 == "y":
xyz = numpy.array([[-40.0e+3, 0.0, 0.0],
[+40.0e+3, 0.0, 0.0]], dtype=numpy.float64)
ic = 1
elif component == "x":
xyz = numpy.array([[0.0, -40.0e+3, 0.0],
[0.0, +40.0e+3, 0.0]], dtype=numpy.float64)
ic = 0
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 = "shear_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
示例6: TestShearDisp
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
示例7: setUp
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
示例8: setUp
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(ShearApp, GenerateDB, nprocs=2)
self.outputRoot = "sheardispnoslip"
self.soln = AnalyticalSoln()
return
示例9: setUp
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
示例10: setUp
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
示例11: setUp
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(ShearApp, GenerateDB, nprocs=3)
self.outputRoot = "frictionnoslip"
self.soln = AnalyticalSoln()
return
示例12: setUp
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
示例13: setUp
def setUp(self):
"""
Setup for test.
"""
TestTri3.setUp(self)
self.mesh = {'ncells': 142*4,
'ncorners': 3,
'nvertices': 317,
'spaceDim': 2,
'tensorSize': 3}
self.nverticesO = self.mesh['nvertices']
self.mesh['nvertices'] += 3
self.faultMesh = {'nvertices': 5,
'spaceDim': 2,
'ncells': 2*2,
'ncorners': 2}
run_pylith()
self.outputRoot = "sheardispnosliprefine"
self.soln = AnalyticalSoln()
return
示例14: setUp
def setUp(self):
"""
Setup for test.
"""
TestTet4.setUp(self)
self.mesh = {'ncells-elastic': 1266*8,
'ncells-viscoelastic': 1276*8,
'ncorners': 4,
'nvertices': 4016,
'spaceDim': 3,
'tensorSize': 6}
self.nverticesO = self.mesh['nvertices']
self.mesh['nvertices'] += 36
self.faultMesh = {'nvertices': 57,
'spaceDim': 3,
'ncells': 80,
'ncorners': 3}
run_pylith()
self.outputRoot = "sheardispnosliprefine"
self.soln = AnalyticalSoln()
return
示例15: setUp
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