本文整理汇总了Python中spatialdata.units.Nondimensional.Nondimensional类的典型用法代码示例。如果您正苦于以下问题:Python Nondimensional类的具体用法?Python Nondimensional怎么用?Python Nondimensional使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Nondimensional类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _initialize
def _initialize(self, mesh, integrator):
"""
Initialize integrator.
"""
dt = 2.3
from spatialdata.units.Nondimensional import Nondimensional
normalizer = Nondimensional()
normalizer._configure()
from pyre.units.time import s
integrator.initialize(totalTime=0.0*s, numTimeSteps=1,
normalizer=normalizer)
integrator.timeStep(dt)
# Setup fields
from pylith.topology.SolutionFields import SolutionFields
fields = SolutionFields(mesh)
fields.add("residual", "residual")
fields.add("disp(t+dt)", "displacement")
fields.add("disp(t)", "displacement")
fields.add("disp(t-dt)", "displacement")
fields.add("velocity(t)", "velocity")
fields.add("acceleration(t)", "acceleration")
fields.solutionName("disp(t+dt)")
residual = fields.get("residual")
residual.newSection(residual.VERTICES_FIELD, mesh.coordsys().spaceDim())
residual.allocate()
fields.copyLayout("residual")
residual.zero()
return fields
开发者ID:jjle,项目名称:pylith,代码行数:33,代码来源:TestElasticityExplicitLgDeform.py
示例2: setUp
def setUp(self):
"""
Setup mesh and associated field.
"""
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()
self.mesh = importer.read(debug=False, interpolate=False)
self.field = Field(self.mesh)
self.field.allocate()
return
开发者ID:jjle,项目名称:pylith,代码行数:26,代码来源:TestMeshField.py
示例3: __init__
def __init__(self):
"""
Constructor.
"""
self.availableFields = \
{'vertex': \
{'info': ["vertex info"],
'data': ["vertex data 1",
"vertex data 2"]},
'cell': \
{'info': ["cell info"],
'data': ["cell data"]}}
filename = "data/twohex8.txt"
from pylith.meshio.MeshIOAscii import MeshIOAscii
iohandler = MeshIOAscii()
iohandler.inventory.filename = filename
from spatialdata.geocoords.CSCart import CSCart
iohandler.inventory.coordsys = CSCart()
iohandler._configure()
from spatialdata.units.Nondimensional import Nondimensional
normalizer = Nondimensional()
normalizer._configure()
mesh = iohandler.read(debug=False, interpolate=False)
from pylith.topology.Fields import Fields
fields = Fields(mesh)
self.mesh = mesh
self.fields = fields
return
开发者ID:rishabhdutta,项目名称:pylith,代码行数:33,代码来源:TestOutputManagerMesh.py
示例4: setUp
def setUp(self):
from pylith.meshio.MeshIOAscii import MeshIOAscii
iohandler = MeshIOAscii()
filename = "data/twohex8.txt"
from spatialdata.units.Nondimensional import Nondimensional
normalizer = Nondimensional()
normalizer._configure()
from spatialdata.geocoords.CSCart import CSCart
iohandler.inventory.filename = filename
iohandler.inventory.coordsys = CSCart()
iohandler._configure()
mesh = iohandler.read(debug=False, interpolate=False)
from pylith.topology.SolutionFields import SolutionFields
fields = SolutionFields(mesh)
name = "disp(t)"
fields.add(name, "displacement")
fields.solutionName(name)
field = fields.get(name)
field.subfieldAdd("displacement", mesh.dimension(), field.VECTOR)
field.subfieldsSetup()
field.newSection(field.VERTICES_FIELD, mesh.dimension())
field.allocate()
self.mesh = mesh
self.fields = fields
self.normalizer = normalizer
return
开发者ID:youngsolar,项目名称:pylith,代码行数:31,代码来源:TestOutputSolnSubset.py
示例5: setUp
def setUp(self):
"""
Setup mesh and associated field.
"""
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()
self.mesh = importer.read(debug=False, interpolate=False)
from pylith.topology.SolutionFields import SolutionFields
fields = SolutionFields(self.mesh)
fields.add("disp t+dt", "displacement")
fields.solutionName("disp t+dt")
solution = fields.solution()
solution.newSection(solution.VERTICES_FIELD, self.mesh.dimension())
solution.allocate()
solution.zero()
self.fields = fields
self.jacobian = Jacobian(solution)
return
开发者ID:panzhengyang,项目名称:pylith,代码行数:32,代码来源:TestJacobian.py
示例6: _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
示例7: 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
示例8: test_dimensionalize
def test_dimensionalize(self):
dim = Nondimensional()
dim._configure()
scale = 8.0*meter
value = 0.25
valueE = 2.0*meter
self.assertEqual(valueE, dim.dimensionalize(value, scale))
return
开发者ID:geodynamics,项目名称:spatialdata,代码行数:10,代码来源:TestNondimensional.py
示例9: setUp
def setUp(self):
from spatialdata.units.Nondimensional import Nondimensional
normalizer = Nondimensional()
normalizer._configure()
normalizer.setTimeScale(2.0*second)
tstep = TimeStep()
tstep._configure()
tstep.preinitialize()
tstep.initialize(normalizer)
self.tstep = tstep
return
开发者ID:geodynamics,项目名称:pylith,代码行数:12,代码来源:TestTimeStep.py
示例10: _initialize
def _initialize(self):
"""
Initialize DirichletBoundary boundary condition.
"""
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)
from spatialdata.spatialdb.SimpleDB import SimpleDB
db = SimpleDB()
db.inventory.label = "TestDirichletBoundary tri3"
db.inventory.iohandler.inventory.filename = "data/tri3_disp.spatialdb"
db.inventory.iohandler._configure()
db._configure()
from spatialdata.spatialdb.SimpleDB import SimpleDB
dbRate = SimpleDB()
dbRate.inventory.label = "TestDirichletBoundary tri3"
dbRate.inventory.iohandler.inventory.filename = "data/tri3_vel.spatialdb"
dbRate.inventory.iohandler._configure()
dbRate._configure()
from pylith.bc.DirichletBoundary import DirichletBoundary
bc = DirichletBoundary()
bc.inventory.output._configure()
bc.inventory.output.writer._configure()
bc.inventory.label = "bc"
bc.inventory.bcDOF = [1]
bc.inventory.dbInitial = db
bc.inventory.dbRate = dbRate
bc._configure()
bc.preinitialize(mesh)
bc.initialize(totalTime=0.0, numTimeSteps=1, normalizer=normalizer)
# Setup field
from pylith.topology.Field import Field
field = Field(mesh)
field.newSection(field.VERTICES_FIELD, cs.spaceDim())
return (mesh, bc, field)
开发者ID:jjle,项目名称:pylith,代码行数:53,代码来源:TestDirichletBoundary.py
示例11: testNormalizer
def testNormalizer(self):
"""
Test normalizer().
"""
from spatialdata.units.Nondimensional import Nondimensional
normalizer = Nondimensional()
normalizer._configure()
self.material.normalizer(normalizer)
# No test of result.
return
开发者ID:youngsolar,项目名称:pylith,代码行数:13,代码来源:TestMaterial.py
示例12: setUp
def setUp(self):
from spatialdata.units.Nondimensional import Nondimensional
normalizer = Nondimensional()
normalizer._configure()
normalizer.setTimeScale(0.5*year)
tstep = TimeStepUser()
tstep._configure()
tstep.filename = "data/timesteps.txt"
tstep.preinitialize()
tstep.initialize(normalizer)
self.tstep = tstep
return
开发者ID:youngsolar,项目名称:pylith,代码行数:13,代码来源:TestTimeStepUser.py
示例13: test_densityScale
def test_densityScale(self):
dim = Nondimensional()
dim._configure()
dim.setDensityScale(2.0*kilogram/meter**3)
self.assertEqual(1.0*meter, dim.lengthScale())
self.assertEqual(1.0*pascal, dim.pressureScale())
self.assertEqual(1.0*second, dim.timeScale())
self.assertEqual(2.0*kilogram/meter**3, dim.densityScale())
return
开发者ID:geodynamics,项目名称:spatialdata,代码行数:10,代码来源:TestNondimensional.py
示例14: test_temperatureScale
def test_temperatureScale(self):
dim = Nondimensional()
dim._configure()
dim.setTemperatureScale(2.0*kelvin)
self.assertEqual(1.0*meter, dim.lengthScale())
self.assertEqual(1.0*pascal, dim.pressureScale())
self.assertEqual(1.0*second, dim.timeScale())
self.assertEqual(2.0*kelvin, dim.temperatureScale())
return
开发者ID:geodynamics,项目名称:spatialdata,代码行数:10,代码来源:TestNondimensional.py
示例15: setUp
def setUp(self):
"""
Setup time step object.
"""
normalizer = Nondimensional()
normalizer._configure()
tstep = TimeStepUniform()
tstep._configure()
tstep.preinitialize()
tstep.verifyConfiguration()
tstep.initialize(normalizer)
self.tstep = tstep
return
开发者ID:geodynamics,项目名称:pylith,代码行数:14,代码来源:TestTimeStepUniform.py
示例16: test_constructor
def test_constructor(self):
dim = Nondimensional()
dim._configure()
self.assertEqual(1.0*meter, dim.lengthScale())
self.assertEqual(1.0*pascal, dim.pressureScale())
self.assertEqual(1.0*second, dim.timeScale())
self.assertEqual(1.0*kilogram/meter**3, dim.densityScale())
self.assertEqual(1.0*kelvin, dim.temperatureScale())
return
开发者ID:geodynamics,项目名称:spatialdata,代码行数:11,代码来源:TestNondimensional.py
示例17: _getMesh
def _getMesh(self):
"""
Get mesh from file.
"""
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)
return mesh
开发者ID:youngsolar,项目名称:pylith,代码行数:21,代码来源:TestSubMesh.py
示例18: _initialize
def _initialize(self, mesh, integrator):
"""
Initialize integrator.
"""
dt = 2.3
from spatialdata.units.Nondimensional import Nondimensional
normalizer = Nondimensional()
normalizer._configure()
from pyre.units.time import s
integrator.initialize(totalTime=0.0*s, numTimeSteps=1,
normalizer=normalizer)
integrator.timeStep(dt)
# Setup fields
from pylith.topology.SolutionFields import SolutionFields
fields = SolutionFields(mesh)
fields.add("residual", "residual")
fields.add("disp(t+dt)", "displacement")
fields.add("disp(t)", "displacement")
fields.add("disp(t-dt)", "displacement")
fields.add("velocity(t)", "velocity")
fields.add("acceleration(t)", "acceleration")
fields.solutionName("disp(t+dt)")
residual = fields.get("residual")
spaceDim = mesh.coordsys().spaceDim()
lengthScale = normalizer.lengthScale()
residual.subfieldAdd("displacement", spaceDim, residual.VECTOR, lengthScale.value);
residual.subfieldAdd("lagrange_multiplier", spaceDim, residual.VECTOR);
residual.subfieldsSetup();
residual.setupSolnChart();
residual.setupSolnDof(spaceDim);
residual.allocate();
residual.zeroAll();
fields.copyLayout("residual")
return fields
开发者ID:geodynamics,项目名称:pylith,代码行数:40,代码来源:TestElasticityExplicitLgDeform.py
示例19: test_adjustTopology
def test_adjustTopology(self):
"""
Test adjustTopology().
WARNING: This is not a rigorous test of adjustTopology() because we
neither set the input fields or verify the results.
"""
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)
fault = FaultCohesiveKin()
fault.inventory.matId = 10
fault.inventory.faultLabel = "fault"
fault.inventory.faultEdge = "fault_edge"
fault._configure()
nvertices = fault.numVerticesNoMesh(mesh)
firstFaultVertex = 0
firstLagrangeVertex = nvertices
firstFaultCell = 2*nvertices
fault.adjustTopology(mesh, firstFaultVertex, firstLagrangeVertex,
firstFaultCell)
# We should really add something here to check to make sure things
# actually initialized correctly
return
开发者ID:rishabhdutta,项目名称:pylith,代码行数:38,代码来源:TestFaultCohesiveKin.py
示例20: _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
注:本文中的spatialdata.units.Nondimensional.Nondimensional类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论