コード例 #1
0
ファイル: TestDirichletBC.py プロジェクト: jjle/pylith
  def _initialize(self):
    """
    Initialize DirichletBC boundary condition.
    """
    from spatialdata.spatialdb.SimpleDB import SimpleDB
    dbInitial = SimpleDB()
    dbInitial.inventory.label = "TestDirichletBC tri3"
    dbInitial.inventory.iohandler.inventory.filename = "data/tri3_disp.spatialdb"
    dbInitial.inventory.iohandler._configure()
    dbInitial._configure()

    from pylith.bc.DirichletBC import DirichletBC
    bc = DirichletBC()
    bc.inventory.label = "bc"
    bc.inventory.bcDOF = [1]
    bc.inventory.dbInitial = dbInitial
    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)

    # Setup field
    from pylith.topology.Field import Field
    field = Field(mesh)
    field.newSection(field.VERTICES_FIELD, cs.spaceDim())
    
    return (mesh, bc, field)
コード例 #2
0
  def _initialize(self):
    """
    Initialize DirichletBC boundary condition.
    """
    from spatialdata.spatialdb.SimpleDB import SimpleDB
    dbInitial = SimpleDB()
    dbInitial.inventory.label = "TestDirichletBC tri3"
    dbInitial.inventory.iohandler.inventory.filename = "data/tri3_disp.spatialdb"
    dbInitial.inventory.iohandler._configure()
    dbInitial._configure()

    from pylith.bc.DirichletBC import DirichletBC
    bc = DirichletBC()
    bc.inventory.label = "bc"
    bc.inventory.bcDOF = [1]
    bc.inventory.dbInitial = dbInitial
    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)

    # Setup field
    from pylith.topology.Field import Field
    field = Field(mesh)
    field.newSection(field.VERTICES_FIELD, cs.spaceDim())
    
    return (mesh, bc, field)
コード例 #3
0
ファイル: TestDirichletBC.py プロジェクト: jjle/pylith
  def test_configure(self):
    """
    Test constructor.
    """
    from spatialdata.spatialdb.SimpleDB import SimpleDB
    db = SimpleDB()
    db.inventory.label = "simple database"
    db._configure()

    from spatialdata.spatialdb.TimeHistory import TimeHistory
    th = TimeHistory()
    th._configure()

    from pylith.bc.DirichletBC import DirichletBC
    bc = DirichletBC()
    bc.inventory.label = "abc"
    bc.inventory.dbInitial = db
    bc.inventory.dbRate = db
    bc.inventory.dbChange = db
    bc.inventory.thChange = th    
    bc._configure()
    return
コード例 #4
0
  def test_configure(self):
    """
    Test constructor.
    """
    from spatialdata.spatialdb.SimpleDB import SimpleDB
    db = SimpleDB()
    db.inventory.label = "simple database"
    db._configure()

    from spatialdata.spatialdb.TimeHistory import TimeHistory
    th = TimeHistory()
    th._configure()

    from pylith.bc.DirichletBC import DirichletBC
    bc = DirichletBC()
    bc.inventory.label = "abc"
    bc.inventory.dbInitial = db
    bc.inventory.dbRate = db
    bc.inventory.dbChange = db
    bc.inventory.thChange = th    
    bc._configure()
    return