Exemplo n.º 1
0
    def _get_fe_domain_structure(self):
        '''Root of the domain hierarchy
        '''
        elem_length = self.length / float(self.shape)

        fe_domain = FEDomain()

        fe_m_level = FERefinementGrid(name='matrix domain',
                                      domain=fe_domain,
                                      fets_eval=self.fets_m)

        fe_grid_m = FEGrid(name='matrix grid',
                           coord_max=(self.length, ),
                           shape=(self.shape, ),
                           level=fe_m_level,
                           fets_eval=self.fets_m,
                           geo_transform=self.geo_transform)

        fe_fb_level = FERefinementGrid(name='fiber bond domain',
                                       domain=fe_domain,
                                       fets_eval=self.fets_fb)

        fe_grid_fb = FEGrid(coord_min=(0., length / 5.),
                            coord_max=(length, 0.),
                            shape=(self.shape, 1),
                            level=fe_fb_level,
                            fets_eval=self.fets_fb,
                            geo_transform=self.geo_transform)

        return fe_domain, fe_grid_m, fe_grid_fb, fe_m_level, fe_fb_level
Exemplo n.º 2
0
 def setUp(self):
     '''
     Construct the FEDomain with one FERefinementGrids (2,2) 
     '''
     self.domain1 = FEDomain()
     self.fets_eval = FETS2D4Q(mats_eval=MATS2DElastic())
     self.d1 = FERefinementGrid(name='d1', domain=self.domain1)
     self.g1 = FEGrid(coord_max=(1., 1., 0.),
                      shape=(2, 2),
                      fets_eval=self.fets_eval,
                      level=self.d1)
Exemplo n.º 3
0
    def example_2d():
        from ibvpy.mats.mats2D.mats2D_elastic.mats2D_elastic import MATS2DElastic
        from ibvpy.fets.fets2D.fets2D4q import FETS2D4Q

        fets_eval = FETS2D4Q(mats_eval=MATS2DElastic(E=2.1e5))

        # Discretization
        fe_domain1 = FEGrid(coord_max=(2., 5., 0.),
                            shape=(10, 10),
                            fets_eval=fets_eval)

        fe_subgrid1 = FERefinementLevel(parent=fe_domain1,
                                        fine_cell_shape=(1, 1))

        print 'children'
        print fe_domain1.children

        fe_subgrid1.refine_elem((5, 5))
        fe_subgrid1.refine_elem((6, 5))
        fe_subgrid1.refine_elem((7, 5))
        fe_subgrid1.refine_elem((8, 5))
        fe_subgrid1.refine_elem((9, 5))

        fe_domain = FEDomain(subdomains=[fe_domain1])

        ts = TS(dof_resultants=True,
                sdomain=fe_domain,
                bcond_list=[BCDofGroup(var='f', value=0.1, dims=[0],
                                       get_dof_method=fe_domain1.get_top_dofs),
                            BCDofGroup(var='u', value=0., dims=[0, 1],
                                       get_dof_method=fe_domain1.get_bottom_dofs),
                            ],
                rtrace_list=[RTraceGraph(name='Fi,right over u_right (iteration)',
                                         var_y='F_int', idx_y=0,
                                         var_x='U_k', idx_x=1),
                             RTraceDomainListField(name='Stress',
                                                   var='sig_app', idx=0, warp=True),
                             #                           RTraceDomainField(name = 'Displacement' ,
                             #                                        var = 'u', idx = 0),
                             #                                 RTraceDomainField(name = 'N0' ,
                             #                                              var = 'N_mtx', idx = 0,
                             # record_on = 'update')

                             ]
                )

        # Add the time-loop control
        tloop = TLoop(tstepper=ts,
                      tline=TLine(min=0.0, step=1, max=1.0))
#
        print tloop.eval()
        from ibvpy.plugins.ibvpy_app import IBVPyApp
        ibvpy_app = IBVPyApp(ibv_resource=tloop)
        ibvpy_app.main()
Exemplo n.º 4
0
 def _set_sdomain(self, value):
     if isinstance(value, FEGrid):
         # construct FERefinementGrid and FEDomain
         self._sdomain = FEDomain()
         fe_rgrid = FERefinementGrid(domain=self._sdomain,
                                     fets_eval=value.fets_eval)
         value.level = fe_rgrid
     elif isinstance(value, FERefinementGrid):
         # construct FEDomain
         self._sdomain = FEDomain()
         value.domain = self._sdomain
     elif isinstance(value, list):
         self._sdomain = FEDomain()
         for d in value:
             if isinstance(d, FEGrid):
                 fe_rgrid = FERefinementGrid(domain=self._sdomain,
                                             fets_eval=d.fets_eval)
                 d.level = fe_rgrid
             elif isinstance(d, FESubDomain):
                 d.domain = self._sdomain
             else:
                 raise TypeError, 'The list can contain only FEGrid or FERefinementGrid'
     else:
         self._sdomain = value
Exemplo n.º 5
0
def combined_fe2D4q_with_fe2D4q8u():

    fets_eval_4u_conc = FETS2D4Q(mats_eval=MATS2DElastic(E=28500, nu=0.2))
    fets_eval_4u_steel = FETS2D4Q(mats_eval=MATS2DElastic(E=210000, nu=0.25))
    fets_eval_8u = FETS2D4Q8U(mats_eval=MATS2DElastic())

    # Discretization
    fe_domain = FEDomain()

    fe_grid_level1 = FERefinementGrid(name='master grid',
                                      fets_eval=fets_eval_4u_conc,
                                      domain=fe_domain)

    fe_grid = FEGrid(level=fe_grid_level1,
                     coord_max=(2., 6., 0.),
                     shape=(11, 30),
                     fets_eval=fets_eval_4u_conc)

    fe_grid_level2 = FERefinementGrid(name='refinement grid',
                                      parent=fe_grid_level1,
                                      fets_eval=fets_eval_4u_steel,
                                      fine_cell_shape=(1, 1))

    # fe_grid_level1[ 5, :5 ].refine_using( fe_grid_level2 )
    # 1. first get the slice for the level - distinguish it from the slice at the subgrid
    #    this includes slicing in the subgrids. what if the subgrid does not exist?
    #
    #    Each subgrid must hold its own slice within the level. The index operator fills
    #    the grid [...] instanciates the whole grid and returns the instance of
    #    FEGridLevelSlice. The expanded subgrid contains its constructor slice.
    #
    # 2. If the slice is within an existing slice no change in the FESubgrid is required
    #    only the instance of the slice is returned. The FEGridLevelSlice goes always into
    #    an expanded part of FEGrid.
    #
    # 3. If the slice does not fit into any existing slice - all domain with an intersection
    #    of the existing slice must be constructed as well.
    #
    # 2. deactivate elements
    # 3.
    # BUT how to impose the boundary conditions on the particular refinement? The
    # slice has an attribute

    fe_grid_level2.refine_elem((5, 0))
    fe_grid_level2.refine_elem((5, 1))
    fe_grid_level2.refine_elem((5, 2))
    fe_grid_level2.refine_elem((5, 3))
    fe_grid_level2.refine_elem((5, 4))
    fe_grid_level2.refine_elem((5, 5))

    # apply the boundary condition on a subgrid
    #
    print fe_grid_level2.fe_subgrids
    fe_first_grid = fe_grid_level2.fe_subgrids[0]

    ts = TS(
        dof_resultants=True,
        sdomain=fe_domain,
        bcond_list=[
            BCSlice(var='f', value=1., dims=[0], slice=fe_grid[:, -1, :, -1]),
            BCSlice(var='u',
                    value=0.,
                    dims=[0, 1],
                    slice=fe_first_grid[:, 0, :, 0])
        ],
        rtrace_list=[
            RTraceGraph(name='Fi,right over u_right (iteration)',
                        var_y='F_int',
                        idx_y=0,
                        var_x='U_k',
                        idx_x=1),
            RTraceDomainListField(name='Stress',
                                  var='sig_app',
                                  idx=0,
                                  warp=True),
            #                             RTraceDomainField(name = 'Displacement' ,
            #                                        var = 'u', idx = 0),
            #                                 RTraceDomainField(name = 'N0' ,
            #                                              var = 'N_mtx', idx = 0,
            #                                              record_on = 'update')
        ])

    # Add the time-loop control
    tloop = TLoop(tstepper=ts, tline=TLine(min=0.0, step=1, max=1.0))

    print tloop.eval()
    from ibvpy.plugins.ibvpy_app import IBVPyApp
    ibvpy_app = IBVPyApp(ibv_resource=tloop)
    ibvpy_app.main()
Exemplo n.º 6
0
 def _get_fe_domain(self):
     return FEDomain()
Exemplo n.º 7
0
        TLine
    from ibvpy.mats.mats1D.mats1D_elastic.mats1D_elastic import MATS1DElastic

    fets_eval = FETS1D2L(mats_eval=MATS1DElastic(E=10., A=1.))

    # Discretization
    fe_domain1 = FEGrid(coord_max=(10., 0., 0.),
                        shape=(10,),
                        fets_eval=fets_eval)

    fe_domain2 = FEGrid(coord_min=(10., 0., 0.),
                        coord_max=(20., 0., 0.),
                        shape=(10,),
                        fets_eval=fets_eval)

    fe_domain = FEDomain(subdomains=[fe_domain1, fe_domain2])
    ts = TS(dof_resultants=True,
            sdomain=fe_domain,
            bcond_list=[BCDof(var='u', dof=0, value=0.),
                        BCDof(
                            var='u', dof=5, link_dofs=[16], link_coeffs=[1.], value=0.),
                        BCDof(var='f', dof=21, value=10)],
            rtrace_list=[RTraceGraph(name='Fi,right over u_right (iteration)',
                                     var_y='F_int', idx_y=0,
                                     var_x='U_k', idx_x=1),
                         ]
            )

    # Add the time-loop control
    tloop = TLoop(tstepper=ts, tline=TLine(min=0.0, step=1, max=1.0))
Exemplo n.º 8
0
     BCSlice, TStepper as TS, TLoop, TLine, RTDofGraph
from ibvpy.rtrace.rt_domain_list_field import RTraceDomainListField
from ibvpy.mesh.fe_grid import FEGrid
from ibvpy.mesh.fe_refinement_grid import FERefinementGrid
from ibvpy.mesh.fe_domain import FEDomain

from ibvpy.mesh.fe_spring_array import FESpringArray
from ibvpy.fets.fets1D.fets1D2l import FETS1D2L
from ibvpy.mats.mats1D import MATS1DElastic

if __name__ == '__main__':

    fets_eval = FETS1D2L( mats_eval = MATS1DElastic( E = 1 ) )

    # Discretization
    fe_domain = FEDomain()

    fe_patch_left = FERefinementGrid( name = 'left',
                                     fets_eval = fets_eval,
                                     domain = fe_domain )

    fe_grid_left = FEGrid( level = fe_patch_left,
                      coord_min = ( 0., ),
                      coord_max = ( 1., ),
                      shape = ( 1, ),
                      fets_eval = fets_eval )

    fe_patch_right = FERefinementGrid( name = 'refinement grid',
                                       fets_eval = fets_eval,
                                       domain = fe_domain )