本文整理汇总了Python中sheardisp_soln.AnalyticalSoln类的典型用法代码示例。如果您正苦于以下问题:Python AnalyticalSoln类的具体用法?Python AnalyticalSoln怎么用?Python AnalyticalSoln使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AnalyticalSoln类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
开发者ID:panzhengyang,项目名称:pylith,代码行数:25,代码来源:TestFaultsIntersectNoSlip.py
示例2: setUp
def setUp(self):
"""
Setup for test.
"""
TestQuad4.setUp(self)
run_pylith(ShearApp, GenerateDB)
self.outputRoot = "sheardisp"
self.soln = AnalyticalSoln()
return
开发者ID:geodynamics,项目名称:pylith,代码行数:9,代码来源:TestShearDisp.py
示例3: setUp
def setUp(self):
"""
Setup for test.
"""
TestTri3.setUp(self)
run_pylith()
self.outputRoot = "sheardisp"
self.soln = AnalyticalSoln()
return
开发者ID:youngsolar,项目名称:pylith,代码行数:9,代码来源:TestShearDisp.py
示例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
开发者ID:panzhengyang,项目名称:pylith,代码行数:42,代码来源:sheardisp_gendb.py
示例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
开发者ID:rishabhdutta,项目名称:pylith,代码行数:42,代码来源:sheardisp_gendb.py
示例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
开发者ID:youngsolar,项目名称:pylith,代码行数:38,代码来源:TestShearDisp.py
示例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
开发者ID:panzhengyang,项目名称:pylith,代码行数:14,代码来源:TestFrictionNoSlip.py
示例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
开发者ID:geodynamics,项目名称:pylith,代码行数:16,代码来源:TestShearDispNoSlip.py
示例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
开发者ID:rishabhdutta,项目名称:pylith,代码行数:16,代码来源:TestShearDispNoSlip.py
示例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
开发者ID:youngsolar,项目名称:pylith,代码行数:16,代码来源:TestShearDispFriction.py
示例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
开发者ID:geodynamics,项目名称:pylith,代码行数:17,代码来源:TestFrictionNoSlip.py
示例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
开发者ID:youngsolar,项目名称:pylith,代码行数:17,代码来源:TestFrictionNoSlipHalo.py
示例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
开发者ID:panzhengyang,项目名称:pylith,代码行数:21,代码来源:TestShearDispNoSlipRefine.py
示例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
开发者ID:rishabhdutta,项目名称:pylith,代码行数:22,代码来源:TestShearDispNoSlipRefine.py
示例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
开发者ID:youngsolar,项目名称:pylith,代码行数:23,代码来源:TestShearDispNoSlipRefine.py
示例16: TestShearDispFriction
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,代码行数:101,代码来源:TestShearDispFriction.py
示例17: TestFaultsIntersectNoSlip
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,代码行数:101,代码来源:TestFaultsIntersectNoSlip.py
示例18: TestFrictionNoSlip
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,代码行数:101,代码来源:TestFrictionNoSlip.py
示例19: TestShearDispNoSlip
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,代码行数:101,代码来源:TestShearDispNoSlip.py
示例20: TestShearDispNoSlipRefine
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,代码行数:101,代码来源:TestShearDispNoSlipRefine.py
注:本文中的sheardisp_soln.AnalyticalSoln类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论