Esempio n. 1
0
    def setUp(self):

        self.fets_eval = FETS1D2L(mats_eval = MATS1DElastic(E=10.))        
    
        # Discretization
        self.fe_domain1 = FEGrid( coord_max = (3.,0.,0.), 
                                   shape   = (3,),
                                   fets_eval = self.fets_eval )
    
        self.fe_domain2 = FEGrid( coord_min = (3.,0.,0.),  
                                   coord_max = (6.,0.,0.), 
                                   shape   = (3,),
                                   fets_eval = self.fets_eval )
    
        self.fe_domain3 = FEGrid( coord_min = (3.,0.,0.),  
                                   coord_max = (6.,0.,0.), 
                                   shape   = (3,),
                                   fets_eval = self.fets_eval )
            
        self.ts = TS( dof_resultants = True,
                      sdomain = [ self.fe_domain1, self.fe_domain2 , self.fe_domain3 ],
                 bcond_list =  [BCDof(var='u', dof = 0, value = 0.),
                                BCDof(var='u', dof = 4, link_dofs = [3], link_coeffs = [1.],
                                      value = 0. ),
                                BCDof(var='f', dof = 7, value = 1,
                                          link_dofs = [2], link_coeffs = [2] ) ],
                 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
        self.tloop = TLoop( tstepper = self.ts,
                            tline  = TLine( min = 0.0,  step = 1, max = 1.0 ))
Esempio n. 2
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
Esempio n. 3
0
def test_bar2():
    '''Clamped bar composed of two linked bars loaded at the right end
    [00]-[01]-[02]-[03]-[04]-[05]-[06]-[07]-[08]-[09]-[10]
    [11]-[12]-[13]-[14]-[15]-[16]-[17]-[18]-[19]-[20]-[21]
    u[0] = 0, u[5] = u[16], R[-1] = R[21] = 10
    '''
    fets_eval = FETS1D2L(mats_eval=MATS1DElastic(E=10., A=1.))

    # Discretization
    fe_domain1 = FEGrid(coord_max=(10., 0., 0.),
                        shape=(10, ),
                        n_nodal_dofs=1,
                        dof_r=fets_eval.dof_r,
                        geo_r=fets_eval.geo_r)

    fe_domain2 = FEGrid(coord_min=(10., 0., 0.),
                        coord_max=(20., 0., 0.),
                        shape=(10, ),
                        n_nodal_dofs=1,
                        dof_r=fets_eval.dof_r,
                        geo_r=fets_eval.geo_r)

    ts = TS(iterms=[(fets_eval, fe_domain1), (fets_eval, fe_domain2)],
            dof_resultants=True,
            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))
    u = tloop.eval()
    print 'u', u
    #
    # '---------------------------------------------------------------'
    # 'Clamped bar composed of two linked bars control displ at right'
    # 'u[0] = 0, u[5] = u[16], u[21] = 1'
    # Remove the load and put a unit displacement at the right end
    # Note, the load is irrelevant in this case and will be rewritten
    #
    ts.bcond_list = [
        BCDof(var='u', dof=0, value=0.),
        BCDof(var='u', dof=5, link_dofs=[16], link_coeffs=[1.], value=0.),
        BCDof(var='u', dof=21, value=1.)
    ]
    # system solver
    u = tloop.eval()
    print 'u', u
Esempio n. 4
0
 def _get_fe_grid_column(self):
     return FEGrid(coord_min=(0.0, 0.0, 0.0),
                   coord_max=(1.0, 1.0, 1.0),
                   geo_transform=self.column,
                   shape=(self.n_elems_col_xy, self.n_elems_col_xy,
                          self.n_elems_col_z),
                   fets_eval=self.fe_column)
Esempio n. 5
0
 def _get_fe_grid_roof(self):
     return FEGrid(coord_min=(0.0, 0.0, 0.0),
                   coord_max=(1.0, 1.0, 1.0),
                   geo_transform=self.hp_shell,
                   shift_array=self.shift_array,
                   shape=(self.n_elems_xy, self.n_elems_xy, self.n_elems_z),
                   fets_eval=self.fe_roof)
Esempio n. 6
0
 def _get_fe_disk_grid(self):
     fe_grid = FEGrid(coord_min=(-1, -1),
                      coord_max=(1, 1),
                      geo_transform=self.geo_disk,
                      shape=(self.n_elems, self.n_elems),
                      fets_eval=self.fets_disk)
     return fe_grid
Esempio n. 7
0
def example_with_new_domain():
    from ibvpy.api import \
        TStepper as TS, RTDofGraph, RTraceDomainListField, TLoop, \
        TLine, BCDof, IBVPSolve as IS, DOTSEval
    from ibvpy.mats.mats1D.mats1D_elastic.mats1D_elastic import MATS1DElastic

    fets_eval = FETS1D2L3U(mats_eval=MATS1DElastic(E=10.))

    from ibvpy.mesh.fe_grid import FEGrid

    # Discretization
    domain = FEGrid(coord_max=(3., ),
                    shape=(3, ),
                    fets_eval=fets_eval)

    ts = TS(dof_resultants=True,
            sdomain=domain,
            # conversion to list (square brackets) is only necessary for slicing of
            # single dofs, e.g "get_left_dofs()[0,1]"
            #         bcond_list =  [ BCDof(var='u', dof = 0, value = 0.)     ] +
            #                    [ BCDof(var='u', dof = 2, value = 0.001 ) ]+
            #                    [ )     ],
            bcond_list=[BCDof(var='u', dof=0, value=0.),
                        #                        BCDof(var='u', dof = 1, link_dofs = [2], link_coeffs = [0.5],
                        #                              value = 0. ),
                        #                        BCDof(var='u', dof = 2, link_dofs = [3], link_coeffs = [1.],
                        #                              value = 0. ),
                        BCDof(var='f', dof=6, value=1,
                              # link_dofs = [2], link_coeffs = [2]
                              )],
            rtrace_list=[RTDofGraph(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),
                         RTraceDomainListField(name='Displacement',
                                               var='u', idx=0),
                         RTraceDomainListField(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('---- result ----')
    print(tloop.eval())
    print(ts.F_int)
    print(ts.rtrace_list[0].trace.ydata)

    # Put the whole stuff into the simulation-framework to map the
    # individual pieces of definition into the user interface.
    #
    from ibvpy.plugins.ibvpy_app import IBVPyApp
    app = IBVPyApp(ibv_resource=tloop)
    app.main()
Esempio n. 8
0
 def _get_fe_grid_columns(self):
     return [
         FEGrid(coord_min=(0.0, 0.0, 0.0),
                coord_max=(1.0, 1.0, 1.0),
                geo_transform=column,
                shape=(1, 1, 1),
                fets_eval=self.fe_column) for column in self.columns
     ]
Esempio n. 9
0
    def _get_specmn_fe_grid(self):
        fe_grid = FEGrid(coord_max=(1, 1, 1),
                         shape=(self.shape_x, self.shape_y, self.shape_z),
                         level=self.specmn_fe_level,
                         geo_transform=self.barel_shell_geo,
                         fets_eval=self.specmn_fets)

        return fe_grid
Esempio n. 10
0
 def setUp(self):
     '''
     Construct the FEDomain with two FERefinementGrids (2,2) 
     '''
     self.domain1 = FEDomain()
     self.fets_eval = FETS2D4Q(mats_eval=MATS2DElastic())
     self.d1 = FERefinementGrid(name='d1', domain=self.domain1)
     g1 = FEGrid(coord_max=(1., 1., 0.),
                 shape=(2, 2),
                 fets_eval=self.fets_eval,
                 level=self.d1)
     self.d2 = FERefinementGrid(name='d2', domain=self.domain1)
     g2 = FEGrid(coord_min=(1., 0., 0.),
                 coord_max=(2., 1., 0.),
                 shape=(2, 2),
                 fets_eval=self.fets_eval,
                 level=self.d2)
Esempio n. 11
0
 def _get_buttstrap_clamp_fe_grid(self):
     fe_grid = FEGrid(coord_min=(0, 0),
                      coord_max=(1, 1),
                      level=self.buttstrap_clamp_fe_level,
                      geo_transform=self.buttstrap_clamp_geo,
                      shape=(1, self.buttstrap_ne_y),
                      fets_eval=self.buttstrap_fets)
     return fe_grid
Esempio n. 12
0
 def _get_friction_fe_grid(self):
     fe_grid = FEGrid(coord_min=(0, 0),
                      coord_max=(1, 1),
                      level=self.friction_fe_level,
                      geo_transform=self.friction_geo,
                      shape=(self.friction_ne_x, self.friction_ne_y),
                      fets_eval=self.friction_fets)
     return fe_grid
Esempio n. 13
0
 def setUp(self):
     '''
     Construct the FEDomain with one FERefinementGrids (2,2) 
     '''
     self.fets_eval = FETS3D8H()
     self.grid = FEGrid(coord_max=(1., 1., 1.),
                        shape=(1, 1, 1),
                        fets_eval=self.fets_eval)
Esempio n. 14
0
 def _get_domain(self):
     # Number of elements
     n_e_x = 20
     # Element definition
     domain = FEGrid(coord_max=(self.L_x, ),
                     shape=(n_e_x, ),
                     fets_eval=self.fets_eval)
     return domain
Esempio n. 15
0
 def _get_specmn_fe_grid(self):
     # only a quarter of the beam is simulated due to symmetry:
     fe_grid = FEGrid(coord_min=(self.sym_elstmr_length, 0., 0.),
                      coord_max=(self.sym_specmn_length, self.sym_width,
                                 self.thickness),
                      shape=(self.shape_x, self.shape_y, self.shape_z),
                      level=self.specmn_fe_level,
                      fets_eval=self.specmn_fets)
     return fe_grid
Esempio n. 16
0
def notched_bended_beam():

    fets_eval_4u = FETS2D4Q(mats_eval=MATS2DScalarDamage())
    fets_eval_cracked = FETSLSEval(parent_fets=fets_eval_4u)

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

    fe_child_domain = FERefinementGrid(parent_domain=fe_domain1,
                                       fets_eval=fets_eval_cracked,
                                       fine_cell_shape=(1, 1))

    crack_level_set = lambda X: X[0] - 2.5

    fe_child_domain.refine_elem((1, 0), crack_level_set)
    dots = fe_child_domain.new_dots()

    fe_domain = FEDomainList(subdomains=[fe_domain1])
    fe_domain_tree = FEDomainTree(domain_list=fe_domain)

    ts = TS(
        dof_resultants=True,
        sdomain=[fe_domain1, fe_child_domain],
        bcond_list=[
            BCDofGroup(var='u',
                       value=0.,
                       dims=[0, 1],
                       get_dof_method=fe_domain1.get_left_dofs),
            BCDofGroup(var='u',
                       value=0.,
                       dims=[0, 1],
                       get_dof_method=fe_domain1.get_right_dofs),
            BCDofGroup(var='f',
                       value=-1.,
                       dims=[1],
                       get_dof_method=fe_domain1.get_top_dofs),
        ],
        rtrace_list=[
            #                              RTDofGraph(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())
Esempio n. 17
0
    def _get_fe_grid(self):

        elem_length = self.length / float(self.shape)

        fe_grid = FEGrid(coord_max=(self.length, ),
                         shape=(self.shape, ),
                         level=self.fe_grid_level,
                         fets_eval=self.fets)
        return fe_grid
Esempio n. 18
0
 def _get_fe_grid_roofs(self):
     return [
         FEGrid(coord_min=(0.0, 0.0, 0.0),
                coord_max=(1.0, 1.0, 1.0),
                geo_transform=hp_shell,
                shape=(self.n_elems_xy_quarter, self.n_elems_xy_quarter,
                       self.n_elems_z),
                fets_eval=self.fe_roof) for hp_shell in self.hp_shells
     ]
Esempio n. 19
0
def run_example():
    from ibvpy.api import \
        TStepper as TS, RTraceGraph, RTraceDomainListField, \
        RTraceDomainListInteg, TLoop, \
        TLine, BCDof, IBVPSolve as IS, DOTSEval
    from ibvpy.mats.mats2D.mats2D_conduction.mats2D_conduction import MATS2DConduction

    from ibvpy.api import BCDofGroup
    fets_eval = FETS2D4Q4T(mats_eval=MATS2DConduction(k=1.))

    print fets_eval.vtk_node_cell_data

    from ibvpy.mesh.fe_grid import FEGrid
    from ibvpy.mesh.fe_refinement_grid import FERefinementGrid
    from ibvpy.mesh.fe_domain import FEDomain
    from mathkit.mfn import MFnLineArray

    # Discretization
    fe_grid = FEGrid(coord_max=(1., 1., 0.), shape=(2, 2), fets_eval=fets_eval)

    tstepper = TS(
        sdomain=fe_grid,
        bcond_list=[
            BCDofGroup(var='u',
                       value=0.,
                       dims=[0],
                       get_dof_method=fe_grid.get_left_dofs),
            #                                   BCDofGroup( var='u', value = 0., dims = [1],
            # get_dof_method = fe_grid.get_bottom_dofs ),
            BCDofGroup(var='u',
                       value=.005,
                       dims=[0],
                       get_dof_method=fe_grid.get_top_right_dofs)
        ],
        rtrace_list=[
            #                     RTraceDomainListField(name = 'Damage' ,
            #                                    var = 'omega', idx = 0,
            #                                    record_on = 'update',
            #                                    warp = True),
            #                     RTraceDomainListField(name = 'Displacement' ,
            #                                    var = 'u', idx = 0,
            #                                    record_on = 'update',
            #                                    warp = True),
            #                    RTraceDomainListField(name = 'N0' ,
            #                                      var = 'N_mtx', idx = 0,
            # record_on = 'update')
        ])

    print tstepper.setup()
    return
    # Add the time-loop control
    tloop = TLoop(tstepper=tstepper,
                  debug=False,
                  tline=TLine(min=0.0, step=1.0, max=1.0))

    tloop.eval()
Esempio n. 20
0
 def _get_elstmr_fe_grid(self):
     x_max = self.sym_elstmr_length
     y_max = self.width / 2.
     z_max = self.thickness + self.elstmr_thickness
     fe_grid = FEGrid(coord_min=(0, 0, self.thickness),
                      coord_max=(x_max, y_max, z_max),
                      level=self.elstmr_fe_level,
                      shape=(self.mid_shape_x, self.shape_y, 1),
                      fets_eval=self.elstmr_fets)
     return fe_grid
Esempio n. 21
0
 def _get_elstmr_fe_grid(self):
     fe_grid = FEGrid(coord_min=(self.sym_mid_zone_specmn_length -
                                 self.sym_elstmr_length, 0.,
                                 self.thickness),
                      coord_max=(self.sym_mid_zone_specmn_length +
                                 self.sym_elstmr_length, self.sym_width,
                                 self.thickness + self.elstmr_thickness),
                      level=self.elstmr_fe_level,
                      shape=(self.load_zone_shape_x, self.shape_y, 1),
                      fets_eval=self.elstmr_fets)
     return fe_grid
Esempio n. 22
0
 def _get_supprt_fe_grid(self):
     return FEGrid(
         coord_min=(0, 0, 0),
         coord_max=(1, 1, 1),
         level=self.supprt_fe_level,
         # use shape (2,2) in order to place support in the center of the steel support
         # corresponding to 4 elements of the slab mesh
         #
         shape=(self.shape_supprt_x, self.shape_supprt_x, 1),
         geo_transform=self.geo_supprt,
         fets_eval=self.supprt_fets)
Esempio n. 23
0
def demo3d():

    # Geometry
    #
    length = 1.0

    from ibvpy.fets.fets3D import FETS3D8H, FETS3D8H20U, FETS3D8H27U, FETS3D8H20U
    from ibvpy.mats.mats3D import MATS3DElastic

    # Material and FE Formulation
    #
    lin_x_temperature = TemperatureLinFn(length=length, n_dims=3, offset=0.5)
    fets_eval = FETS3D8H20U(mats_eval=MATS3DElastic(
        E=30e3, nu=0.2, initial_strain=lin_x_temperature))
    fets_eval.vtk_r *= 0.99

    # Discretization
    #
    domain = FEGrid(coord_max=(length, length, length),
                    shape=(6, 3, 3),
                    fets_eval=fets_eval)

    bcond_list = [
        BCSlice(var='u',
                dims=[0, 1, 2],
                slice=domain[0, 0, 0, 0, 0, 0],
                value=0),
        BCSlice(var='u',
                dims=[0, 1],
                slice=domain[0, 0, -1, 0, 0, -1],
                value=0),
        BCSlice(var='u', dims=[0], slice=domain[0, -1, 0, 0, -1, 0], value=0),
    ]
    rtrace_list = [
        sig_trace, eps_trace, eps0_trace, eps1t_trace, max_p_sig_trace, u_trace
    ]
    for rtrace in rtrace_list:
        rtrace.position = 'int_pnts'
        rtrace.warp = False

    corner_dof = domain[-1, -1, -1, -1, -1, -1].dofs[0, 0, 2]

    ts = TS(sdomain=domain, bcond_list=bcond_list, rtrace_list=rtrace_list)

    # Time integration
    #

    tloop = TLoop(tstepper=ts, tline=TLine(min=0.0, step=3, max=1.0))
    tloop.eval()

    # Postprocessing
    #
    app = IBVPyApp(ibv_resource=tloop)
    app.main()
Esempio n. 24
0
    def setUp(self):
        self.fets_eval = FETS1D2L(mats_eval=MATS1DElastic(E=10.))

        # Discretization
        self.domain = FEGrid(coord_max=(10., 0., 0.),
                             shape=(1, ),
                             fets_eval=self.fets_eval)

        self.ts = TS(sdomain=self.domain, dof_resultants=True)
        self.tloop = TLoop(tstepper=self.ts,
                           tline=TLine(min=0.0, step=1, max=1.0))
Esempio n. 25
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()
Esempio n. 26
0
    def _get_fe_grid_roof(self):
        hp_shell = GeoHPShell(thickness = 0.6)

        square_to_circle = GeoSquare2Circle(post_transform = hp_shell,
                                             circle_radius = 0.15,
                                             #Scircle_center = [4.0, 4.0, 0.0],
                                             square_edge = 0.6)
        fe_grid = FEGrid(coord_min = (-1.0, -1.0, 0.0),
                          coord_max = (1.0, 1.0, 1.0),
                          geo_transform = square_to_circle,
                          shape = (self.n_elems_xy, self.n_elems_xy, self.n_elems_z),
                          fets_eval = self.fe_roof)

        mid_idx = self.mid_idx
        idx_min, idx_max = self.idx_min, self.idx_max
        print 'idx_min', idx_min
        print 'idx_max', idx_max
        interior_elems = fe_grid[ idx_min:idx_max, idx_min:idx_max, :, :, :, : ].elems
        fe_grid.inactive_elems = list(interior_elems)
        print 'elems', interior_elems
        return fe_grid
Esempio n. 27
0
def __demo__():

    from ibvpy.api import \
        TStepper as TS, RTDofGraph, RTraceDomainListField, TLoop, \
        TLine, BCDof
    from ibvpy.tmodel.mats1D.mats1D_elastic.mats1D_elastic import MATS1DElastic

    fets_eval = FETS1D2L(mats_eval=MATS1DElastic(E=10.))
    from ibvpy.mesh.fe_grid import FEGrid

    # Discretization
    domain = FEGrid(coord_max=(3., ), shape=(3, ), fets_eval=fets_eval)

    ts = TS(dof_resultants=True,
            sdomain=domain,
            bcond_list=[
                BCDof(var='u', dof=0, value=0.),
                BCDof(
                    var='f',
                    dof=3,
                    value=1,
                )
            ],
            rtrace_list=[
                RTDofGraph(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),
                RTraceDomainListField(name='Displacement',
                                      var='u',
                                      idx=0,
                                      warp=True),
                RTraceDomainListField(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=0.5, max=1.0))

    print('---- result ----')
    print(tloop.eval())
    print(ts.F_int)
    print(ts.rtrace_list[0].trace.ydata)

    # Put the whole stuff into the simulation-framework to map the
    # individual pieces of definition into the user interface.
    #
    app = IBVPyApp(ibv_resource=tloop)
    app.main()
Esempio n. 28
0
def demo1d():

    # Geometry
    #
    length = 1.0

    # Material and FE Formulation
    #
    from ibvpy.fets.fets1D import FETS1D2L, FETS1D2L3U
    from ibvpy.mats.mats1D import MATS1DElastic

    mats_eval = MATS1DElastic(E=100.,
                              initial_strain=TemperatureLinFn(length=length,
                                                              n_dims=1,
                                                              offset=0.5))
    fets_eval = FETS1D2L3U(mats_eval=mats_eval)
    fets_eval.vtk_r *= 0.99

    # Discretization
    #
    domain = FEGrid(coord_max=(length, 0., 0.),
                    n_elems=(10, ),
                    fets_eval=fets_eval)

    bcond_list = [
        BCSlice(var='u', dims=[0], slice=domain[0, 0], value=0),
        #BCSlice( var = 'u', dims = [0], slice = domain[-1, -1], value = 0 )
    ]

    ts = TS(sdomain=domain,
            bcond_list=bcond_list,
            rtrace_list=[sig_trace, eps_trace, eps0_trace, eps1t_trace])

    # Time integration
    #
    tloop = TLoop(tstepper=ts, tline=TLine(min=0.0, step=1, max=1.0))

    tloop.eval()

    # Postprocessing
    #
    legend = []
    plot_sig(eps_trace, 'eps', legend)
    plot_sig(eps0_trace, 'eps0', legend)
    plot_sig(eps1t_trace, 'eps1t', legend)
    p.legend(legend)
    p.show()
Esempio n. 29
0
def demo2d():

    # Geometry
    #
    length = 1.0

    from ibvpy.fets.fets2D import FETS2D4Q, FETS2D4Q8U, FETS2D4Q12U
    from ibvpy.mats.mats2D import MATS2DElastic

    # Material and FE Formulation
    #
    lin_x_temperature = TemperatureLinFn(length=length, n_dims=2)
    fets_eval = FETS2D4Q12U(mats_eval=MATS2DElastic(
        E=30e5, nu=0.2, initial_strain=lin_x_temperature))
    fets_eval.vtk_r *= 0.99

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

    bcond_list = [
        BCSlice(var='u', dims=[0, 1], slice=domain[0, 0, 0, 0], value=0),
        BCSlice(var='u', dims=[1], slice=domain[0, -1, 0, -1], value=0),
    ]
    rtrace_list = [sig_trace, eps_trace, eps0_trace, eps1t_trace, u_trace]
    ts = TS(
        sdomain=domain,
        bcond_list=bcond_list,
        rtrace_list=rtrace_list,
    )

    # Time integration
    #
    tloop = TLoop(tstepper=ts, tline=TLine(min=0.0, step=1, max=1.0))
    tloop.eval()

    # Postprocessing
    #
    app = IBVPyApp(ibv_resource=tloop)
    app.main()
Esempio n. 30
0
    def test_rg_addition(self):
        '''Check numbering after addition of FERefinementGrid
        Add another FERefinementGrid (2,2) as a child of grid 1
        Check the n_dofs of FEDomain to verify the re-enumeration 
        Check the elem_dof_map of the grid 3. 
        '''
        d3 = FERefinementGrid(name='d3', parent=self.d1)
        g3 = FEGrid(coord_max=(1., 1., 0.),
                    shape=(2, 2),
                    fets_eval=self.fets_eval,
                    level=d3)
        n_dofs = self.domain1.n_dofs
        #check the n_dofs of the domain after addition
        self.assertEqual(n_dofs, 54)
        #check elem_dof_map of added subdomain
        elem_dof_map = d3.elem_dof_map

        edm = [
            36, 37, 42, 43, 44, 45, 38, 39, 38, 39, 44, 45, 46, 47, 40, 41, 42,
            43, 48, 49, 50, 51, 44, 45, 44, 45, 50, 51, 52, 53, 46, 47
        ]

        for e_, e_ex_ in zip(elem_dof_map.flatten(), edm):
            self.assertEqual(e_, e_ex_)
Esempio n. 31
0
    def setUp(self):

        self.fets_eval = FETS1D2L(mats_eval=MATS1DElastic(E=10.))

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

        self.fe_domain2 = FEGrid(coord_min=(3., 0., 0.),
                                 coord_max=(6., 0., 0.),
                                 shape=(3, ),
                                 fets_eval=self.fets_eval)

        self.fe_domain3 = FEGrid(coord_min=(3., 0., 0.),
                                 coord_max=(6., 0., 0.),
                                 shape=(3, ),
                                 fets_eval=self.fets_eval)

        self.ts = TS(
            dof_resultants=True,
            sdomain=[self.fe_domain1, self.fe_domain2, self.fe_domain3],
            bcond_list=[
                BCDof(var='u', dof=0, value=0.),
                BCDof(var='u',
                      dof=4,
                      link_dofs=[3],
                      link_coeffs=[1.],
                      value=0.),
                BCDof(var='f', dof=7, value=1, link_dofs=[2], link_coeffs=[2])
            ],
            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
        self.tloop = TLoop(tstepper=self.ts,
                           tline=TLine(min=0.0, step=1, max=1.0))
Esempio n. 32
0
from mathkit.matrix_la.coo_mtx import COOSparseMtx
from mathkit.matrix_la.dense_mtx import DenseMtx
import unittest

from ibvpy.api import TStepper as TS, RTraceGraph, RTraceDomainField, TLoop, TLine, BCDof, IBVPSolve as IS, DOTSEval
from ibvpy.mats.mats1D.mats1D_elastic.mats1D_elastic import MATS1DElastic

from ibvpy.mesh.fe_grid import FEGrid
from ibvpy.fets.fets1D.fets1D2l import FETS1D2L

if __name__ == "__main__":

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

    # Discretization
    domain = FEGrid(coord_max=(10.0, 0.0, 0.0), shape=(1,), fets_eval=fets_eval)

    ts = TS(sdomain=domain, dof_resultants=True)
    tloop = TLoop(tstepper=ts, debug=False, tline=TLine(min=0.0, step=1, max=1.0))

    """Clamped bar loaded at the right end with unit displacement
    [00]-[01]-[02]-[03]-[04]-[05]-[06]-[07]-[08]-[09]-[10]
    'u[0] = 0, u[10] = 1"""

    domain.coord_max = (1, 0, 0)
    domain.shape = (3,)
    ts.bcond_list = [
        BCDof(var="u", dof=0, value=0.0),
        BCDof(var="u", dof=1, link_dofs=[2], link_coeffs=[0.5]),
        BCDof(var="u", dof=3, value=1.0),
    ]
 
#-------------------------
# element type:
#-------------------------
if element_type == 'linear':
    fets_eval = FETS2D4Q( mats_eval = cmdm ) 
elif element_type == 'quadratic':
    fets_eval = FETS2D9Q( mats_eval = cmdm) 


#-------------------------
# Discretization
#-------------------------

domain = FEGrid( coord_max = (length,height,0.), 
                 shape   = shape,
                 fets_eval = fets_eval )


#-------------------------
# ts: 
#-------------------------

# alternative way to get the top/bottom middle dof using slicing of FEGrid:
# i.e. get the element which is placed right for the center and then get the lower left node

#bottom_middle_dof = domain[shape[0]/2, 0, 0, 0].dofs[0,0,1]
#top_middle_dof    = domain[shape[0]/2,-1, 0,-1].dofs[0,0,1]

top_middle_dofs, top_middle_dof_points = domain.get_top_middle_dofs()
top_middle_dof = top_middle_dofs[0,1]
Esempio n. 34
0
class TestMultiDomain( unittest.TestCase):
    '''
    Test functionality connected with kinematic constraints 
    on multiple domains.
    '''
    def setUp(self):

        self.fets_eval = FETS1D2L(mats_eval = MATS1DElastic(E=10.))        
    
        # Discretization
        self.fe_domain1 = FEGrid( coord_max = (3.,0.,0.), 
                                   shape   = (3,),
                                   fets_eval = self.fets_eval )
    
        self.fe_domain2 = FEGrid( coord_min = (3.,0.,0.),  
                                   coord_max = (6.,0.,0.), 
                                   shape   = (3,),
                                   fets_eval = self.fets_eval )
    
        self.fe_domain3 = FEGrid( coord_min = (3.,0.,0.),  
                                   coord_max = (6.,0.,0.), 
                                   shape   = (3,),
                                   fets_eval = self.fets_eval )
            
        self.ts = TS( dof_resultants = True,
                      sdomain = [ self.fe_domain1, self.fe_domain2 , self.fe_domain3 ],
                 bcond_list =  [BCDof(var='u', dof = 0, value = 0.),
                                BCDof(var='u', dof = 4, link_dofs = [3], link_coeffs = [1.],
                                      value = 0. ),
                                BCDof(var='f', dof = 7, value = 1,
                                          link_dofs = [2], link_coeffs = [2] ) ],
                 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
        self.tloop = TLoop( tstepper = self.ts,
                            tline  = TLine( min = 0.0,  step = 1, max = 1.0 ))
        

    def test_bar2( self ):
        '''Clamped bar composed of two linked bars loaded at the right end
        [00]-[01]-[02]-[03]-[04]-[05]-[06]-[07]-[08]-[09]-[10]
        [11]-[12]-[13]-[14]-[15]-[16]-[17]-[18]-[19]-[20]-[21]
        u[0] = 0, u[5] = u[16], R[-1] = R[21] = 10
        '''

        self.fe_domain1.set( coord_min = (0,0,0), coord_max = (10,0,0), shape = (10,) )
        self.fe_domain2.set( coord_min = (10,0,0), coord_max = (20,0,0), shape = (10,) )
        self.ts.set( sdomain = [ self.fe_domain1, self.fe_domain2 ], 
                     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 ) ] )
        
        u = self.tloop.eval()

        # expected solution
        u_ex = array([0., 1., 2., 3., 4., 5., 5., 5., 5., 5., 5., 
                      5., 5., 5., 5., 5., 5., 6., 7., 8., 9.,10.],
                      dtype = float )
        for u_, u_ex_ in zip( u, u_ex ):
            self.assertAlmostEqual( u_, u_ex_ )

        return
        # @todo - reactivate this test. 
        #
        # '---------------------------------------------------------------'
        # 'Clamped bar composed of two linked bars control displ at right'
        # 'u[0] = 0, u[5] = u[16], u[21] = 1'
        # Remove the load and put a unit displacement at the right end
        # Note, the load is irrelevant in this case and will be rewritten
        #
        self.ts.bcond_list =  [BCDof(var='u', dof = 0, value = 0.),
                               BCDof(var='u', dof = 5, link_dofs = [16], link_coeffs = [1.],
                                      value = 0. ),
                               BCDof(var='u', dof = 21, value = 1. ) ]
        # system solver
        u = self.tloop.eval()
        # expected solution
        u_ex = array([0.,   1/10.,  2/10. , 3/10. , 4/10. , 5/10., 5/10. , 5/10. , 
                      5/10. , 5/10.,  5/10.,  5/10.,  5/10.,  5/10.,  5/10.,
                      5/10.,  5/10.,  6/10.,  7/10.,  8/10.,  9/10.,  1. ],
                      dtype = float )
        for u_, u_ex_ in zip( u, u_ex ):
            self.assertAlmostEqual( u_, u_ex_ )
        #

    def test_bar4( self ):
        '''Clamped bar 3 domains, each with 2 elems (displ at right end)
        [0]-[1]-[2] [3]-[4]-[5] [6]-[7]-[8]
        u[0] = 0, u[2] = u[3], u[5] = u[6], u[8] = 1'''

        self.fe_domain1.set( coord_min = (0,0,0), coord_max = (2,0,0), shape = (2,) )
        self.fe_domain2.set( coord_min = (2,0,0), coord_max = (4,0,0), shape = (2,) )
        self.fe_domain3.set( coord_min = (4,0,0), coord_max = (6,0,0), shape = (2,) )

        self.ts.set( sdomain = [ self.fe_domain1, self.fe_domain2, self.fe_domain3 ],  
                     dof_resultants = True,
                     bcond_list =  [BCDof(var='u', dof = 0, value = 0.),
                                     BCDof(var='u', dof = 2, link_dofs = [3], link_coeffs = [1.],
                                           value = 0. ),
                                     BCDof(var='u', dof = 5, link_dofs = [6], link_coeffs = [1.],
                                           value = 0. ),
                                     BCDof(var='u', dof = 8, value = 1 )  ],
                        rtrace_list =  [ RTraceGraph(name = 'Fi,right over u_right (iteration)' ,
                                       var_y = 'F_int', idx_y = 0,
                                       var_x = 'U_k', idx_x = 1),
                                       ]
                        ) 
        # system solver
        u = self.tloop.eval()
        # expected solution
        u_ex = array([0., 1/6.,  1/3., 1/3., 1/2. , 2/3., 2/3.,  5/6.,  1. ],
                      dtype = float )
        for u_, u_ex_ in zip( u, u_ex ):
            self.assertAlmostEqual( u_, u_ex_ )
        #

        
    def test_bar5( self ):
        '''Clamped bar with 4 elements. Elements 2-4 are reinforced
        with another bar with 3 elements
        [0]-[1]-[2]-[3]-[4]
            [5]-[6]-[7]
        u[0] = 0, u[1] = u[5], u[3] = u[7], u[4] = 1
            '''      
        self.fe_domain1.set( coord_min = (0,0,0), coord_max = (4,0,0), shape = (4,) )
        self.fe_domain2.set( coord_min = (1,0,0), coord_max = (3,0,0), shape = (2,) )
        self.ts.set( sdomain = [ self.fe_domain1, self.fe_domain2 ], 
                     bcond_list = [ BCDof(var='u', dof = 0, value = 0.),
                                   BCDof(var='u', dof = 5, link_dofs = [1], link_coeffs = [1.], value = 0. ),
                                   BCDof(var='u', dof = 7, link_dofs = [3], link_coeffs = [1.], value = 0. ),
                                   BCDof(var='u', dof = 4, value = 1 ) ] )
        
        u = self.tloop.eval()
        # expected solution
        u_ex = array([0., 1/3.,  0.5,
                      2/3.,  1.,
                      1/3.,  0.5,         2/3.],
                      dtype = float )
        for u_, u_ex_ in zip( u, u_ex ):
            self.assertAlmostEqual( u_, u_ex_ )
    
    def test_bar6( self ):
        '''Clamped bar with 4 elements. Elements 2-4 are reinforced 
        with another bar with 1 element linked proportianally
        [0]-[1]-[2]-[3]-[4]
              [5]-[6]
        u[0] = 0, u[1] = u[5], u[3] = u[7], u[4] = 1'''
        self.fe_domain1.set( coord_min = (0,0,0), coord_max = (4,0,0), shape = (4,) )
        self.fe_domain2.set( coord_min = (1.5,0,0), coord_max = (2.5,0,0), shape = (1,) )
        self.ts.set( sdomain = [ self.fe_domain1, self.fe_domain2 ], 
                     bcond_list = [ BCDof(var='u', dof = 0, value = 0.),
                                   BCDof(var='u', dof = 5, link_dofs = [1,2], link_coeffs = [.5,.5] ),
                                   BCDof(var='u', dof = 6, link_dofs = [2,3], link_coeffs = [.5,.5] ),
                                   BCDof(var='u', dof = 4, value = 1 ) ] )
        u = self.tloop.eval()
        # expected solution
        u_ex = array([-0.,  0.3, 0.5 , 0.7 , 1. ,  0.4,  0.6], dtype = float )
        for u_, u_ex_ in zip( u, u_ex ):
            self.assertAlmostEqual( u_, u_ex_ )
    
    def test_bar7( self ):
        '''Two clamped beams link in parallel
        and loaded by force at right end
        [5]-[6]-[7]-[8]-[9]
        [0]-[1]-[2]-[3]-[4]
        u[5] = u[0], u[0] = 0, u[4] = u[9], R[4] = 1'''
        self.fe_domain1.set( coord_min = (0,0,0), coord_max = (4,0,0), shape = (4,) )
        self.fe_domain2.set( coord_min = (0,0,0), coord_max = (4,0,0), shape = (4,) )
        self.ts.set( sdomain = [ self.fe_domain1, self.fe_domain2 ],
                     bcond_list = [BCDof(var='u', dof = 0, value = 0.),
                                   BCDof(var='u', dof = 5, link_dofs = [0], link_coeffs = [1.] ),
                                   BCDof(var='u', dof = 4, link_dofs = [9], link_coeffs = [0.5] ),
                                   BCDof(var='f', dof = 4, value = 1 ),
                                   BCDof(var='f', dof = 9, value = 1 ) ] )

        u = self.tloop.eval()  
        # expected solution
        u_ex = array([-0. , 0.06, 0.12,  0.18,  0.24,  0.,
                      0.12,  0.24 , 0.36,  0.48],
                      dtype = float )

        for u_, u_ex_ in zip( u, u_ex ):
            self.assertAlmostEqual( u_, u_ex_ )
Esempio n. 35
0
fineness_bond = 6
#fineness_no_bond = 2
bond_length = 0.005     #all lengths in meter
#no_bond_length = 0.001 
width = 0.005
height = width
 
fets_reinf = FETS1D52B4ULRH(mats_eval = MATS1D5Bond(Ef = 17000., #MN/m2
                                                    Af = 2.65e-6/4.,
                                                    Am = 0.,
                                                    Em = 0.,
                                                    tau_max = 10.5, #10
                                                    tau_fr = 10.5,
                                                    s_cr = 0.03e-2 ))        
fe_domain1 = FEGrid( coord_min = (0.,-0.0003, 0.),
                     coord_max = (bond_length, 0. ,0.), 
                     shape   = ( fineness_bond *  1 ,1 ),
                     fets_eval = fets_reinf )

# characteristic element size
concrete = MATS3DMicroplaneDamage( model_version = 'stiffness',
                                   E = 34e3,
                                   nu = 0.2,
                                   phi_fn = PhiFnStrainSoftening( f_t = 2.8968,
                                                                  G_f = 0.001117, 
                                                                  h =  bond_length / fineness_bond )
                                   )

fets_eval_mdm = FETS3D8H( mats_eval = concrete )

fets_eval2 = fets_eval_mdm
fets_eval2.vtk_r *= 0.8
Esempio n. 36
0
#    x,y = - r * cos( phi ), r * sin( phi ) 
#    return c_[ x,y ]


# The 'coord_max'-coordinates of FEGrid
# are derived in the method arch2d and 
# automatically considered in the transformation
length = 1.
height = 1.

# 100 linear elements
shape = (4*20,1)

# Discretization
domain = FEGrid( coord_max = (length,height,0.), 
                 shape   = shape,
                 fets_eval = fets_eval,
                 geo_transform = arch_2d )
#
#right_dofs, right_dof_r = domain.get_right_dofs()
#right_dof = right_dofs[0,0]
#print 'right_dof',right_dof

top_middle_dofs, top_middle_dof_r = domain.get_top_middle_dofs()
# dof in global y-direction
top_middle_dof = top_middle_dofs[0,1]
print 'top_middle_dofs',top_middle_dofs
print 'top_middle_dof' ,top_middle_dof

top_dofs, top_dof_r = domain.get_top_dofs()
# dof in global y-direction
print 'fets_eval.n_e_dofs' , fets_eval.n_e_dofs
Esempio n. 37
0
def example_with_new_domain():    
    from ibvpy.api import \
        TStepper as TS, MGridDomain, RTraceGraph, RTraceDomainField, TLoop, \
        TLine, IBVPSolve as IS, DOTSEval
    from ibvpy.api import BCDofGroup
    from ibvpy.mats.mats1D5.mats1D5bond import MATS1D5Bond
    from ibvpy.mesh.mgrid_domain import MeshGridAdaptor
    from ibvpy.mesh.fe_grid import FEGrid
    from ibvpy.fets.fets1D5.fets1D52b4uLRH import FETS1D52B4ULRH
    from mathkit.mfn.mfn_line.mfn_line import MFnLineArray
    
    fets_eval = FETS1D52B4ULRH(mats_eval = MATS1D5Bond(Ef = 0., Af =0.,
                                                       Em = 0., Am = 0.,
                                                       bond_fn = MFnLineArray(xdata = [0.,1.],
                                                                              ydata = [0.,1.])))        

    # Tseval for a discretized line domain
    tseval  = DOTSEval( fets_eval = fets_eval )
 
    domain = FEGrid( coord_max = (1., 0.1, 0.0), #new domain
                           shape   = (2,1),
                           n_nodal_dofs = 1,
                           dof_r =  [[-1,-1],[1,-1],[1,1],[-1,1]],           
                           geo_r =  [[-1,-1],[1,-1],[1,1],[-1,1]])
    
                            
    ts = TS( tse = tseval,
         sdomain = domain,
         # conversion to list (square brackets) is only necessary for slicing of 
         # single dofs, e.g "get_left_dofs()[0,1]"
         bcond_list =  [BCDofGroup(var='u', value = 0.,dims = [0],
                               get_dof_method = domain.get_top_dofs),
#                        BCDofGroup(var='u', value = 0.,dims = [0],
#                               get_dof_method = domain.get_bottom_left_dofs),
                      # imposed displacement for all right dofs in y-direction:
#                        BCDofGroup(var='f', value = -1., dims = [0],
#                                get_dof_method = domain.get_bottom_left_dofs),
                        BCDofGroup(var='f', value = 1./3., dims = [0],
                                get_dof_method = domain.get_bottom_dofs )],
         
                            
         rtrace_list =  [ RTraceGraph(name = 'Internal Force - Displacement' ,
                                var_y = 'F_int', idx_y = domain.get_bottom_right_dofs()[0][0,0],
                                var_x = 'U_k', idx_x = domain.get_bottom_right_dofs()[0][0,0]),
                        RTraceDomainField(name = 'Stress' ,
                                #position = 'int_pnts',
                                var = 'sig_app', idx = 0),
                        RTraceDomainField(name = 'Displacement' ,
                                var = 'u', idx = 0),
                        RTraceDomainField(name = 'Strain' ,
                                var = 'eps_app', idx = 0),
                        RTraceDomainField(name = 'Slip' ,
                                var = 'slip', idx = 0),
                        RTraceDomainField(name = 'Shear' ,
                                var = 'shear', idx = 0)       
                                
#                             RTraceDomainField(name = 'N0' ,
#                                          var = 'N_mtx', idx = 0,
#                                          record_on = 'update')
                      
                ]             
            )
    
    # Add the time-loop control
    tloop = TLoop( tstepper = ts,
             DT = 1.,
             tline  = TLine( min = 0.0,  max = 1.0 ))
    
    tloop.eval()    
    # Put the whole stuff into the simulation-framework to map the
    # individual pieces of definition into the user interface.
    #
    from ibvpy.plugins.ibvpy_app import IBVPyApp
    app = IBVPyApp( ibv_resource = tloop )
    app.main()
Esempio n. 38
0
 
#-------------------------
# element type:
#-------------------------
if element_type == 'linear':
    fets_eval = FETS2D4Q( mats_eval = cmdm ) 
elif element_type == 'quadratic':
    fets_eval = FETS2D9Q( mats_eval = cmdm) 


#-------------------------
# Discretization
#-------------------------

domain = FEGrid( coord_max = (length,height,0.), 
                 shape   = shape,
                 fets_eval = fets_eval )

# OSOLET: Use individual domains instead for notched specimen. 
# For a notched beam deactivate the center element at the bottom of the beam:
# domain.deactivate( (shape[0]/2,0) )
# Note: For the center element an odd numer is necessary for n_elem[0].
#       For the center loading at top an even numkber is necessary.
       

#-------------------------
# ts: 
#-------------------------

#right_dofs = domain[0, 0, 0, 0].dofs[0,0,0]
#print 'right_dofs', right_dofs
Esempio n. 39
0

#-------------------------
# Discretization:
#-------------------------

# The 'coord_max'-coordinates of FEGrid
# are derived in the method arch2d and 
# automatically considered in the transformation
# therefore the values define here do not effect 
# the calculation
length = 1.
height = 1.

domain = FEGrid( coord_max = (length,height,0.), 
                 shape   = shape,
                 fets_eval = fets_eval,
                 geo_transform = arch_2d )


#-------------------------
# ts: 
#-------------------------

# Depends on the choice of loading specified in the calculation 
# parameters defined above ('symmetric' or 'asymmetric' loading):

# --- (single displacement at top of the arc)    
if loading_type == 'symmetric':
    # get dofs corresponding to the loading case:
    top_middle_dofs, top_middle_dof_points = domain.get_top_middle_dofs()
    # dof in global y-direction:
Esempio n. 40
0
from ibvpy.api import \
    TStepper as TS, RTraceGraph, RTraceDomainField, TLoop, \
    TLine, BCDof, IBVPSolve as IS, DOTSEval
from ibvpy.mats.mats1D.mats1D_elastic.mats1D_elastic import MATS1DElastic

from ibvpy.bcond.bc_slice import BCSlice
from ibvpy.mesh.fe_grid import FEGrid
from ibvpy.fets.fets1D.fets1D2l import FETS1D2L

if __name__ == '__main__':
    
    fets_eval = FETS1D2L(mats_eval = MATS1DElastic(E=10., A=1.))        
    
    # Discretization
    domain = FEGrid( coord_max = (10.,0.,0.), 
                     shape   = (1,),
                     fets_eval = fets_eval )
    
    ts = TS( sdomain = domain,
                  dof_resultants = True
                        )
    tloop = TLoop( tstepper = ts,
                        tline  = TLine( min = 0.0,  step = 1, max = 1.0 ))
    
        
    domain.coord_max = (10,0,0)
    domain.shape = (10,)
    bc_left  = BCSlice( var = 'u', value = 0., slice = domain[ 0, 0] )
    bc_right = BCSlice( var = 'u', value = 1., slice = domain[1:,:] )
    ts.bcond_list =  [ bc_left, bc_right ]
Esempio n. 41
0
# Geometric transformation
#
def arch_2d( points ):
    x = points[:,0]
    y = points[:,1]
    l = x[-1] - x[0]
    R = 10.
    phi = x / l * pi
    r = R + y
    x,y = - r * cos( phi ), r * sin( phi ) 
    return c_[ x,y ]

# Discretization
domain = FEGrid( coord_max = (length,height,0.), 
                       shape   = (10,5),
#                       shape   = (5,2),
                       fets_eval = fets_eval,
                       geo_transform = arch_2d )

#
right_dofs, right_dof_r = domain.get_right_dofs()
right_dof = right_dofs[0,0]
print 'right_dof',right_dof                         
tstepper = TS( sdomain = domain,
     bcond_list =  [ BCDofGroup( var='u', value = 0., dims = [0,1],
                              get_dof_method = domain.get_left_dofs ),
                     BCDofGroup( var='u', value = 0.01125, dims = [0],
                              get_dof_method = domain.get_right_dofs ) ],
     rtrace_list =  [
                 RTraceGraph(name = 'Fi,right over u_right (iteration)' ,
                             var_y = 'F_int', idx_y = right_dof,