本文整理汇总了Python中pylith.feassemble.Quadrature.Quadrature类的典型用法代码示例。如果您正苦于以下问题:Python Quadrature类的具体用法?Python Quadrature怎么用?Python Quadrature使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Quadrature类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_initialize
def test_initialize(self):
"""
Test initialize().
"""
# No quadrature
output = OutputManager()
output.inventory.writer.inventory.filename = "test.vtk"
output.inventory.writer._configure()
output._configure()
dataProvider = TestProvider()
output.preinitialize(dataProvider)
output.initialize(self.normalizer)
# With quadrature
from pylith.feassemble.FIATLagrange import FIATLagrange
from pylith.feassemble.Quadrature import Quadrature
cell = FIATLagrange()
cell.inventory.dimension = 3
cell.inventory.degree = 2
cell.inventory.order = 2
cell._configure()
quadrature = Quadrature()
quadrature.inventory.cell = cell
quadrature._configure()
output = OutputManager()
output.inventory.writer.inventory.filename = "test.vtk"
output.inventory.writer._configure()
output._configure()
dataProvider = TestProvider()
output.preinitialize(dataProvider)
output.initialize(self.normalizer, quadrature)
return
开发者ID:rishabhdutta,项目名称:pylith,代码行数:34,代码来源:TestOutputManagerMesh.py
示例2: _preinitialize
def _preinitialize(self):
"""
Setup mesh and integrator and preinitialize integrator.
"""
from spatialdata.units.Nondimensional import Nondimensional
normalizer = Nondimensional()
normalizer._configure()
# Setup mesh
cs = CSCart()
cs.inventory.spaceDim = 2
cs._configure()
from pylith.meshio.MeshIOAscii import MeshIOAscii
importer = MeshIOAscii()
importer.inventory.filename = "data/tri3.mesh"
importer.inventory.coordsys = cs
importer._configure()
mesh = importer.read(debug=False, interpolate=False)
# Setup material
from pylith.feassemble.FIATSimplex import FIATSimplex
cell = FIATSimplex()
cell.inventory.dimension = 2
cell.inventory.degree = 1
cell.inventory.order = 1
cell._configure()
from pylith.feassemble.Quadrature import Quadrature
quadrature = Quadrature()
quadrature.inventory.cell = cell
quadrature._configure()
from spatialdata.spatialdb.SimpleDB import SimpleDB
from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
iohandler = SimpleIOAscii()
iohandler.inventory.filename = "data/elasticplanestrain.spatialdb"
iohandler._configure()
db = SimpleDB()
db.inventory.label = "elastic plane strain"
db.inventory.iohandler = iohandler
db._configure()
from pylith.materials.ElasticPlaneStrain import ElasticPlaneStrain
material = ElasticPlaneStrain()
material.inventory.label = "elastic plane strain"
material.inventory.id = 0
material.inventory.dbProperties = db
material.inventory.quadrature = quadrature
material._configure()
from pylith.meshio.OutputMatElastic import OutputMatElastic
material.output = OutputMatElastic()
material.output._configure()
material.output.writer._configure()
# Setup integrator
integrator = ElasticityImplicitLgDeform()
integrator.preinitialize(mesh, material)
return (mesh, integrator)
开发者ID:rishabhdutta,项目名称:pylith,代码行数:58,代码来源:TestElasticityImplicitLgDeform.py
示例3: test_preinitialize
def test_preinitialize(self):
"""
Test preinitialize().
WARNING: This is not a rigorous test of initialize() because we
don't verify the results.
"""
from pylith.feassemble.FIATSimplex import FIATSimplex
cell = FIATSimplex()
cell.inventory.dimension = 2
cell.inventory.order = 1
cell.inventory.degree = 1
cell._configure()
from pylith.feassemble.Quadrature import Quadrature
quadrature = Quadrature()
quadrature.inventory.cell = cell
quadrature.inventory.minJacobian = 1.0e-4
quadrature._configure()
from spatialdata.spatialdb.SimpleDB import SimpleDB
from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
iohandler = SimpleIOAscii()
iohandler.inventory.filename = "data/matinitialize.spatialdb"
iohandler._configure()
db = SimpleDB()
db.inventory.label = "material properties"
db.inventory.iohandler = iohandler
db._configure()
from pylith.materials.ElasticPlaneStrain import ElasticPlaneStrain
material = ElasticPlaneStrain()
material.inventory.quadrature = quadrature
material.inventory.dbProperties = db
material.inventory.label = "my material"
material.inventory.id = 54
material._configure()
from spatialdata.geocoords.CSCart import CSCart
cs = CSCart()
cs.inventory.spaceDim = 2
cs._configure()
from spatialdata.units.Nondimensional import Nondimensional
normalizer = Nondimensional()
normalizer._configure()
from pylith.meshio.MeshIOAscii import MeshIOAscii
importer = MeshIOAscii()
importer.inventory.filename = "data/twoelems.mesh"
importer.inventory.coordsys = cs
importer._configure()
mesh = importer.read(debug=False, interpolate=False)
material.preinitialize(mesh)
# No test of result.
return
开发者ID:youngsolar,项目名称:pylith,代码行数:58,代码来源:TestMaterial.py
示例4: test_minJacobian
def test_minJacobian(self):
"""
Test minJacobian().
"""
minJacobian = 4.0e-02;
q = Quadrature()
q.minJacobian(minJacobian)
self.assertAlmostEqual(minJacobian, q.minJacobian(), places=5)
return
开发者ID:jjle,项目名称:pylith,代码行数:9,代码来源:TestMeshQuadrature.py
示例5: test_checkConditioning
def test_checkConditioning(self):
"""
Test checkConditioning().
"""
q = Quadrature()
flag = False # default
self.assertEqual(flag, q.checkConditioning())
flag = True
q.checkConditioning(flag)
self.assertEqual(flag, q.checkConditioning())
flag = False
q.checkConditioning(flag)
self.assertEqual(flag, q.checkConditioning())
return
开发者ID:jjle,项目名称:pylith,代码行数:18,代码来源:TestMeshQuadrature.py
示例6: test_lagrange3D
def test_lagrange3D(self):
"""
Test setup of quadrature for Lagrange cells for a 3-D problem.
"""
spaceDim = 3
cell = FIATLagrange()
cell.inventory.dimension = 3
cell._configure()
quadrature = Quadrature()
quadrature.inventory.cell = cell
quadrature._configure()
quadrature.preinitialize(spaceDim)
self.assertEqual(3, quadrature.cellDim())
self.assertEqual(spaceDim, quadrature.spaceDim())
self.assertEqual(8, quadrature.numBasis())
return
开发者ID:jjle,项目名称:pylith,代码行数:19,代码来源:TestMeshQuadrature.py
示例7: test_simplex2D
def test_simplex2D(self):
"""
Test setup of quadrature for simplex cells for a 2-D problem.
"""
spaceDim = 2
cell = FIATSimplex()
cell.inventory.dimension = 2
cell._configure()
quadrature = Quadrature()
quadrature.inventory.cell = cell
quadrature._configure()
quadrature.preinitialize(spaceDim)
self.assertEqual(2, quadrature.cellDim())
self.assertEqual(spaceDim, quadrature.spaceDim())
self.assertEqual(3, quadrature.numBasis())
return
开发者ID:jjle,项目名称:pylith,代码行数:19,代码来源:TestMeshQuadrature.py
示例8: test_initialize
def test_initialize(self):
"""
Test constructor.
"""
spaceDim = 2
from pylith.feassemble.FIATSimplex import FIATSimplex
cell = FIATSimplex()
cell.inventory.dimension = 2
cell.inventory.degree = 2
cell.inventory.order = 2
cell._configure()
from pylith.feassemble.Quadrature import Quadrature
quadrature = Quadrature()
quadrature.inventory.cell = cell
quadrature._configure()
quadrature.preinitialize(spaceDim)
quadrature.initialize()
filter = CellFilterAvg()
filter._configure()
filter.initialize(quadrature)
return
开发者ID:panzhengyang,项目名称:pylith,代码行数:24,代码来源:TestCellFilterAvg.py
示例9: _initialize
def _initialize(self):
"""
Initialize AbsorbingDampers boundary condition.
"""
from spatialdata.spatialdb.SimpleDB import SimpleDB
db = SimpleDB()
db.inventory.label = "TestAbsorbingDampers tri3"
db.inventory.iohandler.inventory.filename = \
"data/elasticplanestrain.spatialdb"
db.inventory.iohandler._configure()
db._configure()
from pylith.feassemble.FIATSimplex import FIATSimplex
cell = FIATSimplex()
cell.inventory.dimension = 1
cell.inventory.degree = 1
cell.inventory.order = 1
cell._configure()
from pylith.feassemble.Quadrature import Quadrature
quadrature = Quadrature()
quadrature.inventory.cell = cell
quadrature._configure()
from pylith.bc.AbsorbingDampers import AbsorbingDampers
bc = AbsorbingDampers()
bc.inventory.quadrature = quadrature
bc.inventory.db = db
bc.inventory.id = 0
bc.inventory.label = "bc"
bc._configure()
from spatialdata.geocoords.CSCart import CSCart
cs = CSCart()
cs.inventory.spaceDim = 2
cs._configure()
from spatialdata.units.Nondimensional import Nondimensional
normalizer = Nondimensional()
normalizer._configure()
from pylith.meshio.MeshIOAscii import MeshIOAscii
importer = MeshIOAscii()
importer.inventory.filename = "data/tri3.mesh"
importer.inventory.coordsys = cs
importer._configure()
mesh = importer.read(debug=False, interpolate=False)
bc.preinitialize(mesh)
bc.initialize(totalTime=0.0, numTimeSteps=1, normalizer=normalizer)
bc.timeStep(0.01)
# Setup fields
from pylith.topology.SolutionFields import SolutionFields
fields = SolutionFields(mesh)
fields.add("residual", "residual")
fields.add("dispIncr(t->t+dt)", "displacement")
fields.add("disp(t)", "displacement")
fields.add("disp(t-dt)", "displacement")
fields.add("velocity(t)", "velocity")
fields.solutionName("dispIncr(t->t+dt)")
residual = fields.get("residual")
residual.newSection(residual.VERTICES_FIELD, cs.spaceDim())
residual.allocate()
residual.zero()
fields.copyLayout("residual")
return (mesh, bc, fields)
开发者ID:rishabhdutta,项目名称:pylith,代码行数:69,代码来源:TestAbsorbingDampers.py
示例10: _initialize
def _initialize(self):
"""
Initialize fault.
"""
dt = 2.4
from spatialdata.units.Nondimensional import Nondimensional
normalizer = Nondimensional()
normalizer._configure()
# Setup mesh
cs = CSCart()
cs.inventory.spaceDim = 2
cs._configure()
from pylith.meshio.MeshIOAscii import MeshIOAscii
importer = MeshIOAscii()
importer.inventory.filename = "data/tri3.mesh"
importer.inventory.coordsys = cs
importer._configure()
mesh = importer.read(debug=False, interpolate=False)
# Setup quadrature
from pylith.feassemble.FIATSimplex import FIATSimplex
cell = FIATSimplex()
cell.inventory.dimension = 1
cell.inventory.degree = 1
cell.inventory.order = 1
cell._configure()
from pylith.feassemble.Quadrature import Quadrature
quadrature = Quadrature()
quadrature.inventory.cell = cell
quadrature._configure()
# Setup rupture info
from spatialdata.spatialdb.SimpleDB import SimpleDB
from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
ioTractions = SimpleIOAscii()
ioTractions.inventory.filename = "data/tri3_initialtractions.spatialdb"
ioTractions._configure()
dbTractions = SimpleDB()
dbTractions.inventory.iohandler = ioTractions
dbTractions.inventory.label = "initial tractions"
dbTractions._configure()
from pylith.faults.TractPerturbation import TractPerturbation
tract = TractPerturbation()
tract.inventory.dbInitial = dbTractions
tract._configure()
ioFriction = SimpleIOAscii()
ioFriction.inventory.filename = "data/tri3_staticfriction.spatialdb"
ioFriction._configure()
dbFriction = SimpleDB()
dbFriction.inventory.iohandler = ioFriction
dbFriction.inventory.label = "friction"
dbFriction._configure()
from pylith.friction.StaticFriction import StaticFriction
friction = StaticFriction()
friction.inventory.label = "Static friction"
friction.inventory.dbProperties = dbFriction
friction._configure()
# Setup fault
fault = FaultCohesiveDyn()
fault.inventory.output.inventory.writer._configure()
fault.inventory.output._configure()
fault.inventory.matId = 10
fault.inventory.faultLabel = "fault"
fault.inventory.upDir = [0, 0, 1]
fault.inventory.faultQuadrature = quadrature
fault.inventory.tract = tract
fault.inventory.friction = friction
fault._configure()
nvertices = fault.numVerticesNoMesh(mesh)
firstFaultVertex = 0
firstLagrangeVertex = nvertices
firstFaultCell = 2*nvertices
fault.adjustTopology(mesh, firstFaultVertex, firstLagrangeVertex,
firstFaultCell)
from pylith.topology.topology import MeshOps_nondimensionalize
MeshOps_nondimensionalize(mesh, normalizer)
fault.preinitialize(mesh)
fault.timeStep(dt)
fault.verifyConfiguration()
from pyre.units.time import s
fault.initialize(totalTime=0.0*s, numTimeSteps=1, normalizer=normalizer)
# Setup fields
from pylith.topology.SolutionFields import SolutionFields
fields = SolutionFields(mesh)
fields.add("residual", "residual")
fields.add("dispIncr(t->t+dt)", "displacement_increment")
fields.add("disp(t)", "displacement")
fields.add("velocity(t)", "velocity")
fields.solutionName("dispIncr(t->t+dt)")
residual = fields.get("residual")
#.........这里部分代码省略.........
开发者ID:geodynamics,项目名称:pylith,代码行数:101,代码来源:TestFaultCohesiveDyn.py
示例11: test_initialize
def test_initialize(self):
"""
Test initialize().
"""
cell = FIATSimplex()
cell.inventory.dimension = 2
cell.inventory.order = 1
cell._configure()
scalarType = None
from pylith.utils.utils import sizeofPylithScalar
if 8 == sizeofPylithScalar():
scalarType = numpy.float64
elif 4 == sizeofPylithScalar():
scalarType = numpy.float32
else:
raise ValueError("Unknown size for PylithScalar.")
verticesE = numpy.array([ [-1.0, -1.0],
[+1.0, -1.0],
[-1.0, +1.0] ])
quadPtsE = numpy.array( [[-1.0/3.0, -1.0/3.0]], dtype=scalarType )
quadWtsE = numpy.array( [2.0], dtype=scalarType )
# Compute basis functions and derivatives at quadrature points
basisE = numpy.zeros( (1, 3), dtype=scalarType)
basisDerivE = numpy.zeros( (1, 3, 2), dtype=scalarType)
iQuad = 0
for x in quadPtsE:
basisE[iQuad] = numpy.array([N0(x), N1(x), N2(x)], dtype=scalarType).reshape( (3,) )
deriv = numpy.array([[N0p(x), N0q(x)], [N1p(x), N1q(x)], [N2p(x), N2q(x)]], dtype=scalarType)
basisDerivE[iQuad] = deriv.reshape((1, 3, 2))
iQuad += 1
quadrature = Quadrature()
quadrature.inventory.cell = cell
quadrature._configure()
quadrature.preinitialize(spaceDim=2)
quadrature.initialize()
self.assertEqual(2, quadrature.cellDim())
self.assertEqual(2, quadrature.spaceDim())
self.assertEqual(3, quadrature.numBasis())
self.assertEqual(1, quadrature.numQuadPts())
from pylith.utils.utils import TestArray_checkScalar
self.failUnless(TestArray_checkScalar(basisE.ravel(), quadrature.basis()))
self.failUnless(TestArray_checkScalar(basisDerivE.ravel(), quadrature.basisDerivRef()))
self.failUnless(TestArray_checkScalar(quadPtsE.ravel(), quadrature.quadPtsRef()))
self.failUnless(TestArray_checkScalar(quadWtsE.ravel(), quadrature.quadWts()))
quadrature.initializeGeometry()
return
开发者ID:jjle,项目名称:pylith,代码行数:55,代码来源:TestMeshQuadrature.py
示例12: _initialize
def _initialize(self):
"""
Initialize fault.
"""
dt = 2.4
from spatialdata.units.Nondimensional import Nondimensional
normalizer = Nondimensional()
normalizer._configure()
# Setup mesh
cs = CSCart()
cs.inventory.spaceDim = 2
cs._configure()
from pylith.meshio.MeshIOAscii import MeshIOAscii
importer = MeshIOAscii()
importer.inventory.filename = "data/tri3.mesh"
importer.inventory.coordsys = cs
importer._configure()
mesh = importer.read(debug=False, interpolate=False)
# Setup quadrature
from pylith.feassemble.FIATSimplex import FIATSimplex
cell = FIATSimplex()
cell.inventory.dimension = 1
cell.inventory.degree = 1
cell.inventory.order = 1
cell._configure()
from pylith.feassemble.Quadrature import Quadrature
quadrature = Quadrature()
quadrature.inventory.cell = cell
quadrature._configure()
# Setup earthquake source
from spatialdata.spatialdb.SimpleDB import SimpleDB
from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
ioFinalSlip = SimpleIOAscii()
ioFinalSlip.inventory.filename = "data/tri3_finalslip.spatialdb"
ioFinalSlip._configure()
dbFinalSlip = SimpleDB()
dbFinalSlip.inventory.iohandler = ioFinalSlip
dbFinalSlip.inventory.label = "final slip"
dbFinalSlip._configure()
ioSlipTime = SimpleIOAscii()
ioSlipTime.inventory.filename = "data/tri3_sliptime.spatialdb"
ioSlipTime._configure()
dbSlipTime = SimpleDB()
dbSlipTime.inventory.iohandler = ioSlipTime
dbSlipTime.inventory.label = "slip time"
dbSlipTime._configure()
from pylith.faults.StepSlipFn import StepSlipFn
slipfn = StepSlipFn()
slipfn.inventory.dbSlip = dbFinalSlip
slipfn.inventory.dbSlipTime = dbSlipTime
slipfn._configure()
# Setup fault
fault = FaultCohesiveKin()
fault.inventory.output.inventory.writer._configure()
fault.inventory.output._configure()
fault.inventory.matId = 10
fault.inventory.faultLabel = "fault"
fault.inventory.upDir = [0, 0, 1]
fault.inventory.faultQuadrature = quadrature
fault._configure()
eqsrc = fault.eqsrcs.components()[0]
eqsrc.inventory.originTime = 1.23*second
eqsrc.inventory.slipfn = slipfn
eqsrc._configure()
nvertices = fault.numVerticesNoMesh(mesh)
firstFaultVertex = 0
firstLagrangeVertex = nvertices
firstFaultCell = 2*nvertices
fault.adjustTopology(mesh, firstFaultVertex, firstLagrangeVertex,
firstFaultCell)
fault.preinitialize(mesh)
fault.timeStep(dt)
fault.verifyConfiguration()
from pyre.units.time import s
fault.initialize(totalTime=0.0*s, numTimeSteps=1, normalizer=normalizer)
# Setup fields
from pylith.topology.SolutionFields import SolutionFields
fields = SolutionFields(mesh)
fields.add("residual", "residual")
fields.add("dispIncr(t->t+dt)", "displacement_increment")
fields.add("disp(t)", "displacement")
fields.solutionName("dispIncr(t->t+dt)")
residual = fields.get("residual")
residual.subfieldAdd("displacement", cs.spaceDim(), residual.VECTOR)
residual.subfieldAdd("lagrange_multiplier", cs.spaceDim(), residual.VECTOR)
residual.subfieldsSetup()
residual.setupSolnChart()
residual.setupSolnDof(cs.spaceDim())
fault.setupSolnDof(residual)
#.........这里部分代码省略.........
开发者ID:rishabhdutta,项目名称:pylith,代码行数:101,代码来源:TestFaultCohesiveKin.py
示例13: _initialize
def _initialize(self):
"""
Initialize fault.
"""
dt = 2.4
from spatialdata.units.Nondimensional import Nondimensional
normalizer = Nondimensional()
normalizer._configure()
# Setup mesh
cs = CSCart()
cs.inventory.spaceDim = 2
cs._configure()
from pylith.meshio.MeshIOAscii import MeshIOAscii
importer = MeshIOAscii()
importer.inventory.filename = "data/tri3.mesh"
importer.inventory.coordsys = cs
importer._configure()
mesh = importer.read(debug=False, interpolate=False)
# Setup quadrature
from pylith.feassemble.FIATSimplex import FIATSimplex
cell = FIATSimplex()
cell.inventory.dimension = 1
cell.inventory.degree = 1
cell.inventory.order = 1
cell._configure()
from pylith.feassemble.Quadrature import Quadrature
quadrature = Quadrature()
quadrature.inventory.cell = cell
quadrature._configure()
# Setup impulses
from spatialdata.spatialdb.SimpleDB import SimpleDB
from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
ioImpulseAmp = SimpleIOAscii()
ioImpulseAmp.inventory.filename = "data/tri3_impulses.spatialdb"
ioImpulseAmp._configure()
dbImpulseAmp = SimpleDB()
dbImpulseAmp.inventory.iohandler = ioImpulseAmp
dbImpulseAmp.inventory.label = "impulse amplitude"
dbImpulseAmp._configure()
# Setup fault
fault = FaultCohesiveImpulses()
fault.inventory.output.inventory.writer._configure()
fault.inventory.output._configure()
fault.inventory.matId = 10
fault.inventory.faultLabel = "fault"
fault.inventory.upDir = [0, 0, 1]
fault.inventory.faultQuadrature = quadrature
fault.inventory.dbImpulseAmp = dbImpulseAmp
fault._configure()
nvertices = fault.numVerticesNoMesh(mesh)
firstFaultVertex = 0
firstLagrangeVertex = nvertices
firstFaultCell = 2*nvertices
fault.adjustTopology(mesh, firstFaultVertex, firstLagrangeVertex,
firstFaultCell)
fault.preinitialize(mesh)
fault.timeStep(dt)
fault.verifyConfiguration()
from pyre.units.time import s
fault.initialize(totalTime=0.0*s, numTimeSteps=1, normalizer=normalizer)
# Setup fields
from pylith.topology.SolutionFields import SolutionFields
fields = SolutionFields(mesh)
fields.add("residual", "residual")
fields.add("dispIncr(t->t+dt)", "displacement_increment")
fields.add("disp(t)", "displacement")
fields.solutionName("dispIncr(t->t+dt)")
residual = fields.get("residual")
residual.newSection(residual.VERTICES_FIELD, cs.spaceDim())
residual.allocate()
residual.zero()
fields.copyLayout("residual")
return (mesh, fault, fields)
开发者ID:jjle,项目名称:pylith,代码行数:82,代码来源:TestFaultCohesiveImpulses.py
注:本文中的pylith.feassemble.Quadrature.Quadrature类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论