예제 #1
0
  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
예제 #2
0
    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
  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