本文整理汇总了Python中spatialdata.units.Nondimensional.Nondimensional.lengthScale方法的典型用法代码示例。如果您正苦于以下问题:Python Nondimensional.lengthScale方法的具体用法?Python Nondimensional.lengthScale怎么用?Python Nondimensional.lengthScale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spatialdata.units.Nondimensional.Nondimensional
的用法示例。
在下文中一共展示了Nondimensional.lengthScale方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_densityScale
# 需要导入模块: from spatialdata.units.Nondimensional import Nondimensional [as 别名]
# 或者: from spatialdata.units.Nondimensional.Nondimensional import lengthScale [as 别名]
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
示例2: test_temperatureScale
# 需要导入模块: from spatialdata.units.Nondimensional import Nondimensional [as 别名]
# 或者: from spatialdata.units.Nondimensional.Nondimensional import lengthScale [as 别名]
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
示例3: test_constructor
# 需要导入模块: from spatialdata.units.Nondimensional import Nondimensional [as 别名]
# 或者: from spatialdata.units.Nondimensional.Nondimensional import lengthScale [as 别名]
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
示例4: _initialize
# 需要导入模块: from spatialdata.units.Nondimensional import Nondimensional [as 别名]
# 或者: from spatialdata.units.Nondimensional.Nondimensional import lengthScale [as 别名]
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