Ejemplo n.º 1
0
    def set_boundary_conditions(self, mesh):
        ## here, mesh is a Mesh (Who) object
        displacement = field.getField('Displacement')
        if config.dimension() == 2:
            ## left boundary
            self.leftBoundaryCondition = \
                 bdycondition.DirichletBC(displacement,
                                          'x',
                                          equation.getEquation('Force_Balance'),
                                          'x',
                                          profile.ConstantProfile(0),
                                          'left'
                                          )
            self.leftBoundaryCondition.add_to_mesh('left', mesh.path())

            ## right boundary
            self.rightBoundaryCondition = \
                 bdycondition.DirichletBC(displacement,
                                          'x',
                                          equation.getEquation('Force_Balance'),
                                          'x',
                                          profile.ConstantProfile(0),
                                          'right'
                                          )
            self.rightBoundaryCondition.add_to_mesh('right', mesh.path())

            ## top boundary
            self.topBoundaryCondition = \
                 bdycondition.DirichletBC(displacement,
                                          'y',
                                          equation.getEquation('Force_Balance'),
                                          'y',
                                          profile.ConstantProfile(0),
                                          'top'
                                          )
            self.topBoundaryCondition.add_to_mesh('top', mesh.path())

            ## bottom boundary
            self.bottomBoundaryCondition = \
                 bdycondition.DirichletBC(displacement,
                                          'y',
                                          equation.getEquation('Force_Balance'),
                                          'y',
                                          profile.ConstantProfile(0),
                                          'bottom'
                                          )
            self.bottomBoundaryCondition.add_to_mesh('bottom', mesh.path())
Ejemplo n.º 2
0
 def checkFlux(self, interactive):
     flux = self.fluxwidget.get_value()
     self.nslots = flux.divergence_dim()
     if len(self.profileset) > self.nslots:
         self.profileset = self.profileset[:self.nslots]
     elif len(self.profileset) < self.nslots:
         self.profileset += [profile.ConstantProfile(0.0)]*\
                            (self.nslots-len(self.profileset))
     self.show()
     self.widgetChanged(1, interactive)