Ejemplo n.º 1
0
    def example_1d():
        from ibvpy.mats.mats1D.mats1D_elastic.mats1D_elastic import MATS1DElastic
        from ibvpy.fets.fets1D.fets1D2l import FETS1D2L
        fets_eval = FETS1D2L(mats_eval=MATS1DElastic())
        # Discretization

        fe_domain = FEDomain()
        fe_level1 = FERefinementGrid(domain=fe_domain, fets_eval=fets_eval)

        fe_domain1 = FEGrid(coord_max=(3., 0., 0.),
                            shape=(3,),
                            level=fe_level1,
                            fets_eval=fets_eval)

        fe_child_domain = FERefinementGrid(parent_domain=fe_level1,
                                           fine_cell_shape=(2,))
        fe_child_domain.refine_elem((1,))

        ts = TS(domain=fe_domain,
                dof_resultants=True,
                sdomain=fe_domain,
                bcond_list=[BCDof(var='u', dof=0, value=0.),
                            BCDof(var='f', dof=3, value=1.)]
                )

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

        print tloop.eval()
Ejemplo n.º 2
0
def combined_fe2D4q_with_fe2D4q8u():

    fets_eval_4u = FETS2D4Q(mats_eval = MATS2DElastic(E= 1.,nu = 0.))
    fets_eval_8u = FETS2D4Q8U(mats_eval = MATS2DElastic())
    xfets_eval = FETSCrack(parent_fets = fets_eval_4u) # should be set automatically

    # Discretization
    fe_domain1 = FEGridDomain( coord_max = (2.,6.,0.), 
                               shape   = (1,3),
                               fets_eval = fets_eval_4u )

    fe_subdomain = FESubGridDomain( parent_domain = fe_domain1,
                                    #fets_eval = fets_eval_8u,
                                    fets_eval = fets_eval_4u,
                                    #fets_eval = xfets_eval,
                                    fine_cell_shape = (1,1) )
    
    fe_subdomain.refine_elem( (0,1) )
    elem = fe_subdomain.elements
    m_elem = fe_domain1.elements
    print "nodes ",elem[0]

    fe_domain  = FEDomainList( subdomains = [ fe_domain1 ] )

    ts = TS( dof_resultants = True,
             sdomain = fe_domain,
             bcond_list =  [BCDofGroup(var='u', value = 1., dims = [1],
                                       get_dof_method = fe_domain1.get_top_dofs ),
                            BCDofGroup(var='u', value = 0., dims = [1],
                                       get_dof_method = fe_domain1.get_bottom_dofs ),
                            BCDofGroup(var='u', value = 0., dims = [0],
                                       get_dof_method = fe_domain1.get_bottom_left_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 = 1, warp = True ),
                        RTraceDomainListField(name = 'Displ' ,
                             var = 'u', idx = 1, 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()
    print "nodes after",elem[0]
    from ibvpy.plugins.ibvpy_app import IBVPyApp
    ibvpy_app = IBVPyApp( ibv_resource = tloop )
    ibvpy_app.main()
Ejemplo n.º 3
0
    def example_1d():
        from ibvpy.mats.mats1D.mats1D_elastic.mats1D_elastic import MATS1DElastic
        from ibvpy.fets.fets1D.fets1D2l import FETS1D2L
        fets_eval = FETS1D2L(mats_eval=MATS1DElastic())
        # Discretization

        fe_domain = FEDomain()
        fe_level1 = FERefinementGrid(domain=fe_domain, fets_eval=fets_eval)

        fe_domain1 = FEGrid(coord_max=(3., 0., 0.),
                            shape=(3, ),
                            level=fe_level1,
                            fets_eval=fets_eval)

        fe_child_domain = FERefinementGrid(parent_domain=fe_level1,
                                           fine_cell_shape=(2, ))
        fe_child_domain.refine_elem((1, ))

        ts = TS(domain=fe_domain,
                dof_resultants=True,
                sdomain=fe_domain,
                bcond_list=[
                    BCDof(var='u', dof=0, value=0.),
                    BCDof(var='f', dof=3, value=1.)
                ])

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

        print tloop.eval()
Ejemplo n.º 4
0
    def eval( self ):
        '''Run the time loop.
        '''
        # 
        avg_processor = None
        if self.avg_radius > 0.0:
            avg_processor = RTNonlocalAvg( sd = self.fe_domain,
                                           avg_fn = QuarticAF( radius = self.avg_radius,
                                                               correction = True ) )

        ts = TS( u_processor = avg_processor,
                 dof_resultants = True,
                 sdomain = self.fe_domain,
                 bcond_list = self.bc_list,
                 rtrace_list = self.rt_list
                )

        # Add the time-loop control
        tloop = TLoop( tstepper = ts, KMAX = 300, tolerance = 1e-8,
                       debug = False,
                       verbose_iteration = False,
                       verbose_time = False,
                       tline = TLine( min = 0.0, step = self.step_size, max = 1.0 ) )

        tloop.eval()

        tloop.accept_time_step()

        self.plot_time_function()
        self.plot_tracers()
Ejemplo n.º 5
0
def ghost_bar( ):

    fets_eval = FETS1D2L( mats_eval = MATS1DElastic() ) 

    discr = ( 3, )
    # Discretization
    fe_domain1 = FEGrid( coord_min = (0,0,0),
                               coord_max = (2,0,0), 
                               shape   = discr,
                               inactive_elems = [0],
                               fets_eval = fets_eval )

    ts = TS( sdomain = fe_domain1,
             dof_resultants = True,
             bcond_list =  [ BCDof( var='u', value = 0., dof = 0 ),
                             BCDof( var='u', value = 0., dof = 3 ),
                             BCDof( var='f', value = 1., dof = 1 ) ],
            )

    # Add the time-loop control
    global tloop
    tloop = TLoop( tstepper = ts, tolerance = 1e-4, KMAX = 50,
                        tline  = TLine( min = 0.0,  step = 1.0, max = 1.0 ))

    print tloop.eval()
Ejemplo n.º 6
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
Ejemplo n.º 7
0
def screwed_chess_board( ):
    '''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'''
    
    mp = MATS2DElastic( E = 34.e3,
                        nu = 0.2 ) 

    fets_eval = FETS2D4Q(mats_eval = mp ) 
    #fets_eval = FETS2D4Q8U(mats_eval = mp ) 

    nx = 8
    ny = 8
    discr = ( nx, ny )
    inactive_elems = []
    for j in range( ny / 2 ):
        inactive_elems += [ i*2*ny+(j*2) for i in range( nx / 2 ) ] + \
                          [ (ny+1)+i*2*ny+(j*2) for i in range( nx / 2 ) ]
    load_dof = (ny+1) * 2 * (nx / 2) + ny
    # Discretization
    fe_domain1 = FEGrid( coord_min = (0,0,0),
                          coord_max = (2.,2.,0.), 
                          shape   = discr,
                          inactive_elems = inactive_elems,
                          fets_eval = fets_eval )

    ts = TS( sdomain = fe_domain1,
             dof_resultants = True,
             bcond_list =  [ BCDofGroup( var='u', value = 0., dims = [0,1],
                                         get_dof_method = fe_domain1.get_bottom_dofs ),
                             BCDofGroup( var='u', value = 0, dims = [0,1],
                                         get_dof_method = fe_domain1.get_top_dofs ), 
                             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 ), 
                             BCDof( var='f', value = 100., dof = load_dof ),
                             BCDof( var='f', value = 100., dof = load_dof+1 ),
                        ],
             rtrace_list =  [ RTraceDomainListField( name = 'Displacement', 
                                                     var = 'u', 
                                                     idx = 1, warp = False ),
                              RTraceDomainListField(name = 'Stress' ,
                              var = 'sig_app', idx = 0,
                              record_on = 'update',
                              warp = True),
                              ]             
            )

    # Add the time-loop control
    global tloop
    tloop = TLoop( tstepper = ts, tolerance = 1e-4, KMAX = 50,
                        tline  = TLine( min = 0.0,  step = 1.0, max = 1.0 ))

    tloop.eval()

    from ibvpy.plugins.ibvpy_app import IBVPyApp
    app = IBVPyApp( ibv_resource = tloop )
    app.main()      
Ejemplo n.º 8
0
def example_with_new_domain():    
    from ibvpy.api import \
        TStepper as TS, RTraceGraph, RTraceDomainListField, TLoop, \
        TLine, IBVPSolve as IS, DOTSEval
    from ibvpy.api import BCDofGroup
    from ibvpy.mats.mats1D5.mats1D5bond_elastic_frictional import MATS1D5Bond
    from ibvpy.mesh.fe_grid import FEGrid
    from mathkit.mfn.mfn_line.mfn_line import MFnLineArray
        
    fets_eval = FETS1D52B6ULRH(mats_eval = MATS1D5Bond(Ef = 17000.,
                                                    Af = 2.65e-6/4.,
                                                    Am = 2.65e-6/4.,
                                                    Em = 17000.,
                                                    tau_max = 8.23 * 2,
                                                    tau_fr = 8.23  * 2 ,
                                                    s_cr = 0.030e-3 * 10 )) 
    # Discretization

    domain = FEGrid( coord_max = (1.,.1,0.), #new domain
                           shape   = (1,1),
                           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 =  [BCDofGroup(var='u', value = 0.,dims = [0],
                               get_dof_method = domain.get_left_dofs),\
                      # imposed displacement for all right dofs in y-direction:
#                        BCDofGroup(var='u', value = 0., dims = [0],
#                            get_dof_method = domain.get_top_right_dofs ),
                        BCDofGroup(var='u', value = 1.e-3, dims = [0],
                            get_dof_method = domain.get_bottom_right_dofs )],
         rtrace_list =  [ RTraceGraph(name = 'Fi,right over u_right (iteration)' ,
                               var_y = 'F_int', idx_y = 1,
                               var_x = 'U_k', idx_x = 1),
                        RTraceDomainListField(name = 'Debonding' ,
                                var = 'debonding', 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,
             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()
Ejemplo n.º 9
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()
Ejemplo n.º 10
0
def example_with_new_domain():
    from ibvpy.api import \
        TStepper as TS, RTraceGraph, 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 = [ 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 ),
                     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()
Ejemplo n.º 11
0
    def example_3d():
        from ibvpy.mats.mats3D.mats3D_elastic.mats3D_elastic import MATS3DElastic
        from ibvpy.fets.fets3D.fets3D8h import FETS3D8H

        fets_eval = FETS3D8H(mats_eval=MATS3DElastic())

        fe_domain = FEDomain()
        fe_level1 = FERefinementGrid(domain=fe_domain, fets_eval=fets_eval)

        # Discretization
        fe_domain1 = FEGrid(coord_max=(2., 5., 3.),
                            shape=(2, 3, 2),
                            level=fe_level1,
                            fets_eval=fets_eval)

        fe_child_domain = FERefinementGrid(parent=fe_domain1,
                                           fine_cell_shape=(2, 2, 2))

        fe_child_domain.refine_elem((1, 1, 0))
        fe_child_domain.refine_elem((0, 1, 0))
        fe_child_domain.refine_elem((1, 1, 1))
        fe_child_domain.refine_elem((0, 1, 1))

        ts = TS(
            dof_resultants=True,
            sdomain=fe_domain,
            bcond_list=[
                BCDofGroup(var='f',
                           value=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()
Ejemplo n.º 12
0
def run():
    from ibvpy.api import \
        TStepper as TS, RTraceGraph, RTraceDomainListField, TLoop, \
        TLine, BCDof, IBVPSolve as IS, DOTSEval
    from ibvpy.mats.mats1D.mats1D_elastic.mats1D_elastic import MATS1DElastic
    from ibvpy.mats.mats1D.mats1D_damage.mats1D_damage import MATS1DDamage
    from ibvpy.fets.fets1D.fets1D2l import FETS1D2L

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

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

    right_dof = domain[-1, -1].dofs[0, 0, 0]

    ts = TS( nonlocal_avg = True,
             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 = right_dof, 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 ),
                    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
Ejemplo n.º 13
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())
Ejemplo n.º 14
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()
Ejemplo n.º 15
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()
Ejemplo n.º 16
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 = FERefinementLevelGrid( parent_domain = 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  = FEDomainList( 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()
Ejemplo n.º 17
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()
Ejemplo n.º 18
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))
Ejemplo n.º 19
0
    def example_3d():
        from ibvpy.mats.mats3D.mats3D_elastic.mats3D_elastic import MATS3DElastic
        from ibvpy.fets.fets3D.fets3D8h import FETS3D8H

        fets_eval = FETS3D8H(mats_eval=MATS3DElastic())

        fe_domain = FEDomain()
        fe_level1 = FERefinementGrid(domain=fe_domain, fets_eval=fets_eval)

        # Discretization
        fe_domain1 = FEGrid(coord_max=(2., 5., 3.),
                             shape=(2, 3, 2),
                             level=fe_level1,
                             fets_eval=fets_eval)

        fe_child_domain = FERefinementGrid(parent=fe_domain1,
                                            fine_cell_shape=(2, 2, 2))

        fe_child_domain.refine_elem((1, 1, 0))
        fe_child_domain.refine_elem((0, 1, 0))
        fe_child_domain.refine_elem((1, 1, 1))
        fe_child_domain.refine_elem((0, 1, 1))

        ts = TS(dof_resultants=True,
                 sdomain=fe_domain,
                 bcond_list=[BCDofGroup(var='f', value=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()
Ejemplo n.º 20
0
def example_with_new_domain():    
    from ibvpy.api import \
        TStepper as TS, RTraceGraph, RTraceDomainField, TLoop, \
        TLine, BCDofGroup, IBVPSolve as IS, DOTSEval
    from ibvpy.mats.mats1D.mats1D_elastic.mats1D_elastic import MATS1DElastic
    
    fets_eval = FETS1D2Lxfem(mats_eval = MATS1DElastic(E=10., A=1.))        

    # Tseval for a discretized line domain
    tseval  = DOTSEval( fets_eval = fets_eval )

    from ibvpy.mesh.fe_grid import FEGrid

    # Discretization
    domain = FEGrid( coord_max = (1.,0.,0.), 
                           shape   = (1,),
                           n_nodal_dofs = fets_eval.n_nodal_dofs,
                           dof_r = fets_eval.dof_r,
                           geo_r = fets_eval.geo_r)
                                                 
    ts = TS( tse = tseval,
             dof_resultants = True,
             sdomain = domain,
            bcond_list =  [ BCDofGroup( var='u', value = 0., dims = [0],
                                  get_dof_method = domain.get_left_dofs ),                                
                         BCDofGroup( var='u', value = 1., 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 = 0,
                               var_x = 'U_k', idx_x = 1),
                    RTraceDomainField(name = 'Stress' ,
                         var = 'sig_app', idx = 0),
                     RTraceDomainField(name = 'Displacement' ,
                                    var = 'u', idx = 0)
                      
                ]             
            )
    
    # 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()
Ejemplo n.º 21
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
Ejemplo n.º 22
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()
Ejemplo n.º 23
0
def test_bar4( ):
    '''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'''

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

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

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

    fe_domain3 = FEGrid( coord_min = (4.,0.,0.),  
                               coord_max = (6.,0.,0.), 
                               shape   = (2,),
                               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 ), (fets_eval, 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),
                             RTraceDomainListField( name = 'Displacement', var = 'u', idx = 0 )
                                   ]             
                )
    
    # 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
    app = IBVPyApp( ibv_resource = tloop )
    app.main()      
Ejemplo n.º 24
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()
Ejemplo n.º 25
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 =  [
#                              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()
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], slice = domain[0, -1, 0, 0, -1, 0], value = 0 ),
                  BCSlice( var = 'u', dims = [0, 1], slice = domain[0, 0, -1, 0, 0, -1], 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()
def app():

    mdm = MATS2DElastic()

    fets_eval = FETS2D4Q(mats_eval=mdm)

    fe_domain = FEDomain()

    fe_rgrid = FERefinementGrid(name='fe_grid1', fets_eval=fets_eval, domain=fe_domain)

    fe_grid = FEGrid(coord_max=(2.0, 1.0),
                      shape=(2, 1),
                      fets_eval=fets_eval,
                      level=fe_rgrid)

    for i in range(0, 1):
        fe_grid.deactivate((1, 0))

    ts = TS(sdomain=fe_grid,
             bcond_list=[
                         BCSlice(var='u', slice=fe_grid[-1, :, -1, :], dims=[0, 1], value=0.),
                         BCSlice(var='u', slice=fe_grid[0, 0, :-1, :], dims=[0, 1], value=0.),
                         BCSlice(var='u', slice=fe_grid[-1, 0, 0, -1], dims=[1],
                                 value= -1.0),
                        ],
            rtrace_list=[
                          RTraceDomainListField(name='Strain' ,
                                      var='eps_app', idx=0,
                                      record_on='update'),
                          RTraceDomainListField(name='Stress' ,
                                      var='sig_app', idx=0,
                                      record_on='update'),
                          RTraceDomainListField(name='Displacement' ,
                                      var='u', idx=1,
                                      record_on='update',
                                      warp=True)
                         ]
            )

    tl = TLoop(tstepper=ts,
                tolerance=5.0e-5,
                KMAX=200,
                tline=TLine(min=0.0, step=.1, max=0.1))

    tl.eval()

    from ibvpy.plugins.ibvpy_app import IBVPyApp
    ibvpy_app = IBVPyApp(ibv_resource=ts)
    ibvpy_app.main()
Ejemplo n.º 28
0
def L_shape( ):
    '''L-shaped domain constructed by deleting elements from the quadrangle'''
    
    mp = MATS2DElastic( E = 34.e3,
                        nu = 0.2 ) 

    fets_eval = FETS2D4Q(mats_eval = mp ) 

    discr = ( 3, 2 )
    # Discretization
    fe_domain1 = FEGrid( coord_min = (0,0,0),
                              coord_max = (2.,2.,0.), 
                              shape   = discr,
                              inactive_elems = [3,5],
                              fets_eval = fets_eval )

    ts = TS( sdomain = fe_domain1,
             dof_resultants = True,
             bcond_list =  [ BCDofGroup( var='u', value = 0., dims = [0,1],
                                         get_dof_method = fe_domain1.get_top_dofs ),
                             BCDofGroup( var='u', value = 0., dims = [0,1],
                                         get_dof_method = fe_domain1.get_left_dofs ),                                         
#                             BCDof( var='u', value = 0., dof = 20 ),
#                             BCDof( var='u', value = 0., dof = 21 ), 
#                             BCDof( var='u', value = 0., dof = 16 ), 
#                             BCDof( var='u', value = 0., dof = 17 ), 
                             BCDofGroup( var='f', value = -1, dims = [1],
                                         get_dof_method = fe_domain1.get_right_dofs ) 
                        ],
             rtrace_list =  [ RTraceDomainListField( name = 'Displacement', 
                                                     var = 'u', 
                                                     idx = 1, warp = False ),
                              RTraceDomainField(name = 'Stress' ,
                              var = 'sig_app', idx = 0,
                              record_on = 'update',
                              warp = True),
                              ]             
            )

    # Add the time-loop control
    global tloop
    tloop = TLoop( tstepper = ts, tolerance = 1e-4, KMAX = 50,
                        tline  = TLine( min = 0.0,  step = 1.0, max = 1.0 ))

    print tloop.eval()

    from ibvpy.plugins.ibvpy_app import IBVPyApp
    app = IBVPyApp( ibv_resource = tloop )
    app.main()      
Ejemplo n.º 29
0
    def _get_tloop(self):
        roof = self.fe_grid_roof
        column = self.fe_grid_column
        plate = self.fe_grid_plate

        ts = TS(
            sdomain=[roof, plate, column],
            dof_resultants=True,
            bcond_list=

            # boundary conditions
            #
            self.bc_roof_top_roof_low_link_list +
            self.bc_plate_column_link_list + self.bc_plate_roof_link_list +
            self.link_edge_list + self.bc_col_clamped_list +

            # loading
            #
            self.lc_g_list,
            rtrace_list=self.rtrace_list)

        # Add the time-loop control
        tloop = TLoop(tstepper=ts, tolerance=1e-4, tline=self.tline)
        self.edge_corner_1_dof = roof[0, 0, 0, 0, 0, 0].dofs
        self.edge_corner_2_dof = roof[-1, 0, -1, -1, 0, -1].dofs
        self.dof = roof[-1, 0, -1, -1, 0, -1].dofs[0][0][0]
        self.edge_roof_top = roof[:, -1, -1, :, -1, -1].dofs
        self.edge_roof_right = roof[-1, :, -1, -1, :, -1].dofs

        return tloop
Ejemplo n.º 30
0
    def _get_tloop(self):
        # self.fets.vtk_r *= 0.95

        roofs = self.fe_grid_roofs

        columns = self.fe_grid_columns

        r00, r10, r01, r11 = roofs

        self.corner_dof_r00 = r00[0, 0, 0, 0, 0, 0].dofs

        rtrace_list = self.rtrace_list

        ts = TS(
            sdomain=roofs + columns,
            dof_resultants=True,
            #                 bcond_list = self.wind_bc_list + self.displ_bc_list + self.link_bc_list,
            bcond_list=self.force_bc_list + self.displ_bc_list +
            self.link_bc_list,
            #                 bcond_list = self.displ_bc_list + self.link_bc_list,
            rtrace_list=rtrace_list)

        # Add the time-loop control
        tloop = TLoop(tstepper=ts, tolerance=1e-4, tline=self.tline)

        return tloop
Ejemplo 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 ))
Ejemplo n.º 32
0
    def _get_tloop(self):

        self.fets.vtk_r *= 0.95

        domain = self.fe_grid

        self.center_top_dof = domain[-1, -1, -1, -1].dofs

        # NOTE: additional line-loads at the edge of the roof need to be considered!

        #        upper_surface = domain[:, :, -1, :, :, -1]
        #        whole_domain = domain[:, :, :, :, :, :]

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

        #       w_z = domain[-1, -1, -1, -1].dofs[0]

        #       self.f_w_diagram = RTraceGraph( name = 'load - corner deflection',
        #                                           var_x = 'U_k', idx_x = w_z,
        #                                           var_y = 'time', idx_y = 0,
        #                                           record_on = 'update' )
        #        rtrace_list = self.rtrace_list#[ self.f_w_diagram ] + self.rtrace_list

        ts = TS(sdomain=[domain],
                dof_resultants=True,
                bcond_list=bcond_list,
                rtrace_list=self.rtrace_list)
        # Add the time-loop control
        tloop = TLoop(tstepper=ts, tolerance=1e-4, tline=self.tline)
        return tloop
Ejemplo n.º 33
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()
Ejemplo n.º 34
0
def __demo__():

    from ibvpy.api import \
        TStepper as TS, RTraceGraph, RTraceDomainListField, TLoop, \
        TLine, BCDof
    from ibvpy.mats.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=[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),
                         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()
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 ) )
    fets_eval = FETS1D2L( mats_eval = mats_eval )
    fets_eval.vtk_r *= 0.99

    # Discretization
    #
    domain = FEGrid( coord_max = ( length, 0., 0. ),
                     shape = ( 100, ),
                     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()
Ejemplo n.º 36
0
def run():
    fets_eval = FETS2D4Q( mats_eval = MATS2DElastic() )

    # Discretization
    fe_grid = FEGrid( coord_max = ( 10., 4., 0. ),
                      shape = ( 10, 3 ),
                      fets_eval = fets_eval )

    bcg = BCDofGroup( var = 'u', value = 0., dims = [0],
                   get_dof_method = fe_grid.get_left_dofs )
    bcg.setup( None )
    print 'labels', bcg._get_labels()
    print 'points', bcg._get_mvpoints()

    mf = MFnLineArray( #xdata = arange(10),
                       ydata = array( [0, 1, 2, 3] ) )

    right_dof = 2
    tstepper = TS( sdomain = fe_grid,
                   bcond_list = [ BCDofGroup( var = 'u', value = 0., dims = [0, 1],
                                               get_dof_method = fe_grid.get_left_dofs ),
                                 BCDofGroup( var = 'u', value = .005, dims = [1],
                                          time_function = mf.get_value,
                                          get_dof_method = fe_grid.get_right_dofs ) ],
            )

    # Add the time-loop control
    tloop = TLoop( tstepper = tstepper, KMAX = 300, tolerance = 1e-4,
                   tline = TLine( min = 0.0, step = 1.0, max = 1.0 ) )

    U_k = tloop.eval()
    print 'dir', tloop.rtrace_mngr.dir

    # RTrace should not contain backward link to RTraceMngr
    # The definition should be forward. 
    #

    rt1 = RTraceGraph( sd = tstepper.sdomain,
                       rmgr = tstepper.rtrace_mngr,
                       name = 'Fi,right over u_right (iteration)' ,
                       var_y = 'F_int', idx_y = right_dof,
                       var_x = 'U_k', idx_x = right_dof,
                       record_on = 'update' )
    print 'dir', rt1.dir
def demo2d():

    # Geometry
    #
    length = 1.0

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

    # Material and FE Formulation
    #
    lin_x_temperature = TemperatureLinFn( length = length, n_dims = 2, offset = 0.5 )
    fets_eval = FETS2D4Q8U( # use 2x2 integration scheme:
                           ngp_r = 3, ngp_s = 3,
                           mats_eval = MATS2DElastic( E = 30e3, 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()
Ejemplo n.º 38
0
def example_with_new_domain():
    from ibvpy.api import \
        TStepper as TS, RTraceGraph, RTraceDomainListField, TLoop, \
        TLine, BCDof, IBVPSolve as IS, DOTSEval

#    fets_eval = FETS2D4Q( mats_eval = MATS2DElastic( E = 1., nu = 0. ) )
#
#
#    # Discretization
#    fe_grid1 = FEGrid( coord_max = ( 1., 1., 0. ),
#                    shape = ( 1, 1 ),
#                    fets_eval = fets_eval )


    ts = TS( dof_resultants = True,
             sdomain = fe_grid1,
         # conversion to list (square brackets) is only necessary for slicing of 
         # single dofs, e.g "get_left_dofs()[0,1]"

         bcond_list = [
                        ],
         rtrace_list = [
#                        RTraceDomainListField( name = 'Stress' ,
#                         var = 'sig_app', idx = 0 ),
                         RTraceDomainListField( name = 'Displacement' ,
                                    var = 'u', idx = 0,
                                    warp = True ),
                ]
            )

    # Add the time-loop control
    tloop = TLoop( tstepper = ts, debug = True,
                   adap = ChangeBC(),
                   tline = TLine( min = 0.0, step = 1., max = 2.0 ) )

    print '---- result ----'
    print 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()
Ejemplo n.º 39
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))
Ejemplo n.º 40
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()
Ejemplo n.º 41
0
    def eval(self):
        
        mats = MATS2DElastic( E = 35000., nu = self.nu, stress_state  = "plane_strain" )
        
        fets_eval = FETS2D4Q( mats_eval = mats ) 
        
        domain = FEGrid( coord_max = ( self.edge_length,  self.edge_length, 0.), 
                         shape   = ( int( self.shape ), int( self.shape ) ),
                         fets_eval = fets_eval )

        upper_right_corner_dof = domain[-1,-1,-1,-1].dofs
        
        ts = TS(
                sdomain = domain,
        
        #        # simple shear test: clamped at left side loaded at right side
        #        bcond_list = [BCSlice( var = 'u', value = 0., dims = [0,1], slice = domain[0, 0, 0, :] ),
        #                      BCSlice( var = 'u', value = 0., dims = [0]  , slice = domain[0, 0,-1, :] ),
        #                      BCSlice( var = 'f', value = 1.0, dims = [1] , slice = domain[0, 0,-1, :] )],
        
                # shear test: fixed at 000, one support in x-direction at left top; load at top right
                bcond_list = [BCSlice( var = 'u', value = 0., dims = [0,1], slice = domain[0, 0, 0, 0] ),
                              BCSlice( var = 'u', value = 0., dims = [0]  , slice = domain[0, 0, 0,-1] ),
                              BCSlice( var = 'f', value = 1.0, dims = [1] , slice = domain[0, 0,-1,-1] )],

                rtrace_list = [ 
                                
                             RTraceDomainListField(name = 'Displacement' ,
                                            var = 'u', idx = 0, warp = True),
                             RTraceDomainListField(name = 'Stress' ,
                                            var = 'sig_app', idx = 0, warp = True, 
                                            record_on = 'update'),
                            ]             
                )
         
        # Add the time-loop control
        tloop = TLoop( tstepper = ts,
                       tline  = TLine( min = 0.0,  step = 1., max = 1.0 ) )                   
        
        tloop.eval()
        return tloop
Ejemplo n.º 42
0
    def _get_tloop(self):

        ts = TS(sdomain=self.fe_domain,
                dof_resultants=True,
                bcond_list=self.bc_list,
                rtrace_list=self.rtrace_list)

        # Add the time-loop control
        #
        tloop = TLoop(tstepper=ts, tolerance=1e-4, tline=self.tline)

        return tloop
Ejemplo n.º 43
0
    def eval(self):
        '''Run the time loop.
        '''
        #
        avg_processor = None
        if self.avg_radius > 0.0:
            avg_processor = RTNonlocalAvg(sd=self.fe_domain,
                                          avg_fn=QuarticAF(
                                              radius=self.avg_radius,
                                              correction=True))

        ts = TS(u_processor=avg_processor,
                dof_resultants=True,
                sdomain=self.fe_domain,
                bcond_list=self.bc_list,
                rtrace_list=self.rt_list)

        # Add the time-loop control
        tloop = TLoop(tstepper=ts,
                      KMAX=300,
                      tolerance=1e-8,
                      debug=False,
                      verbose_iteration=False,
                      verbose_time=False,
                      tline=TLine(min=0.0, step=self.step_size, max=1.0))

        tloop.eval()

        tloop.accept_time_step()

        self.plot_time_function()
        self.plot_tracers()
Ejemplo n.º 44
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 ))
Ejemplo n.º 45
0
def example_with_new_domain():
    from ibvpy.api import \
        TStepper as TS, RTraceGraph, RTraceDomainListField, TLoop, \
        TLine, BCDof, IBVPSolve as IS, DOTSEval
    from ibvpy.mats.mats1D.mats1D_elastic.mats1D_elastic import MATS1DElastic
    from ibvpy.fets.fets1D.fets1D2l import FETS1D2L

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

    # Discretization
    domain = FEGrid( coord_max = ( 2., 0., 0. ),
                           shape = ( 2, ),
                           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 = 1. )
                        ],
         rtrace_list = [RTraceDomainListField( name = 'Stress' ,
                         var = 'sig_app', idx = 0 ),
                         RTraceDomainListField( name = 'Displacement' ,
                                    var = 'u', idx = 0,
                                    warp = True ),
                ]
            )

    # Add the time-loop control
    tloop = TLoop( tstepper = ts, debug = True,
                   adap = ChangeBC(),
                   tline = TLine( min = 0.0, step = 1., max = 2.0 ) )

    print '---- result ----'
    print tloop.eval()
Ejemplo n.º 46
0
    def _get_tloop(self):

        roof = self.fe_disk_grid

        # self.bc_roof_deadweight + \
        bc_list = self.bc_fixed

        ts = TS(sdomain=[roof],
                dof_resultants=True,
                bcond_list=bc_list,
                rtrace_list=self.rtrace_list)

        # Add the time-loop control
        #
        tloop = TLoop(tstepper=ts, tolerance=1e-4, tline=self.tline)

        return tloop
Ejemplo n.º 47
0
    def _get_tloop(self):

        roof = self.fe_grid_roof

                  # self.bc_roof_deadweight + \
        bc_list = self.bc_roof_list + self.bc_outer_boundary + \
                  self.bc_fix_dofs_in_the_hollow

        ts = TS(sdomain = [ roof ],
                 dof_resultants = True,
                 bcond_list = bc_list,
                 rtrace_list = self.rtrace_list

               )

        # Add the time-loop control
        #

        tloop = TLoop(tstepper = ts,
                       tolerance = 1e-4,
                       tline = self.tline)

        return tloop
def run():
    from ibvpy.api import \
        TStepper as TS, RTraceGraph, RTraceDomainListField, TLoop, \
        TLine, IBVPSolve as IS, DOTSEval, BCSlice, FEGrid, BCDofGroup
    from ibvpy.fets.fets1D5.fets1D52l4uLRH import \
        FETS1D52L4ULRH, MATS1DElastic, MATS1DPlastic, MATS1D5Bond
    from ibvpy.fets.fets2D.fets2D4q import FETS2D4Q
    from ibvpy.mats.mats2D.mats2D_elastic.mats2D_elastic import MATS2DElastic
    from mathkit.mfn.mfn_line.mfn_line import \
        MFnLineArray
    from math import sqrt, pi as Pi

    # Concrete parameters
    E_concrete = 34000.0               # [MPa]  E-Modulus of concrete
    nu_concrete = 0.2                  # [-]    Poisson ratio

    # Yarn parameters
    A_epoxy  = 1.760                   # [mm^2] cross-sectional area of epoxy
    A_glass  = 0.896                   # [mm^2] cross-sectional area of glass
    A_yarn   = A_epoxy + A_glass       # [mm^2] cross-sectional area of yarn
    P_yarn   = sqrt( 4 * A_yarn * Pi ) # [mm] perimeter of the yarn
    E_yarn   = 17000.0                 # [MPa]  effective E-Modulus of the impregnated yarn
    stiffness_fiber   = E_yarn * A_yarn
    
    penalty_stiffness = 1.e6
    
    # Bond parameters
    tau_max  = 13.0             # [N/mm^2] - frictional shear stress
    T_max    = tau_max * P_yarn # [N/mm] - frictional shear flow
    s_crit   = 0.028            # [mm] - onset of inelastic slip
    G        = T_max / s_crit   # [N/mm] - shear flow stiffness
    
    # Geometry
    L_e      = 5.                            # [mm] - embedded length
    
    # Loading conditions
    u_max    = 0.3
    # f_max   = 1200
    
    # Discretization
    fineness_x = 4
    fineness_y = 4
    
    # Material model construction
    mats_eval_bond = MATS1D5Bond( mats_phase1 = MATS1DElastic( E = stiffness_fiber ),
                                  mats_phase2 = MATS1DElastic( E = 0 ),
                                  mats_ifslip = MATS1DElastic( E = G ),
                                  mats_ifopen = MATS1DElastic( E = penalty_stiffness))
    
    mats_eval_matrix = MATS2DElastic( E = E_concrete,
                                      nu = nu_concrete,
                                      stress_state="plane_strain")

    # Finite element construction
    fets_eval_bond = FETS1D52L4ULRH( mats_eval = mats_eval_bond )
    fets_eval_matrix = FETS2D4Q( mats_eval = mats_eval_matrix )

    # Discretization
    domain_bond = FEGrid( coord_min = (0., -L_e/5.),
                          coord_max = (L_e,  0.),
                          shape   = (fineness_x,1),
                          fets_eval = fets_eval_bond )
    
    domain_matrix1 = FEGrid( coord_max = (L_e, L_e),
                             shape   = (fineness_x,fineness_y),
                             fets_eval = fets_eval_matrix )
    
#    domain_matrix2 = FEGrid( coord_min = (L_e, 0.),
#                             coord_max = (L_e*2, L_e),
#                             shape   = (fineness_x,fineness_y),
#                             fets_eval = fets_eval_matrix )

    end_dof = domain_bond[-1,0,-1,0 ].dofs[0,0,0]
    ts = TS( dof_resultants = True,
             sdomain = [ domain_bond, domain_matrix1],#, domain_matrix2 ],
             bcond_list =  [                                
                            # Fixed fiber at the left end
                            BCSlice( var='u', value = 0., dims = [0],
                                     slice = domain_bond[0,0,0,0] ),

                            # Fixed y-displacement - no crack opening
                            BCSlice( var='u', value = 0., dims = [1],
                                     slice = domain_bond[:,0,:,0] ),
                                 
                            # Loading at the right end of the fiber
                            BCSlice( var='u', value = u_max, dims = [0],
                                     slice = domain_bond[-1,0,-1,0] ), 
                        
                            # Support the matrix in the horizontal direction
                            BCSlice( var='u', value = 0., dims = [0],
                                     slice = domain_matrix1[0,:,0,:]),
                                 
#                            # Support the matrix in the vertical direction
#                            BCSlice( var='u', value = 0., dims = [1],
#                                     slice = domain_matrix1[:,0,:,0]),
                        
#                            # Connect bond and matrix domains
#                            BCSlice( var='u', value = 0., dims = [0,1],
#                                     link_slice = domain_bond[:,-1,:,-1],
#                                     slice = domain_matrix1[:,0,:,0],
#                                     link_coeffs = [1.]),

                            BCDofGroup( var='u', value = 0., dims = [0,1],
                                        get_link_dof_method = domain_bond.get_top_dofs,
                                        get_dof_method = domain_matrix1.get_bottom_dofs,
                                        link_coeffs = [1.] ),
                                               
#                            # Connect two matrix domains
#                            BCSlice( var='u', value = 0., dims = [0,1],
#                                     slice = domain_matrix1[-1,:,-1,:],
#                                     link_slice = domain_matrix2[0,:,0,:],
#                                     link_coeffs = [1.]),
                                    
                        ],
         rtrace_list =  [ RTraceGraph(name = 'Fi,right over u_right (iteration)' ,
                               var_y = 'F_int', idx_y = end_dof,
                               var_x = 'U_k', idx_x = end_dof),
                          RTraceDomainListField(name = 'slip' ,
                                var = 'slip', idx = 0 ),
                          RTraceDomainListField(name = 'eps1' ,
                                var = 'eps1', idx = 0 ),
                          RTraceDomainListField(name = 'eps2' ,
                                var = 'eps2', idx = 0 ),
                          RTraceDomainListField(name = 'shear_flow' ,
                                var = 'shear_flow', idx = 0 ),
                          RTraceDomainListField(name = 'sig1' ,
                                var = 'sig1', idx = 0 ),
                          RTraceDomainListField(name = 'sig2' ,
                                var = 'sig2', idx = 0 ),
                          RTraceDomainListField(name = 'Displacement' ,
                                var = 'u', idx = 0), 
                          RTraceDomainListField(name = 'Stress' ,
                                var = 'sig_app', idx = 0)                   
                ] )
    
    # Add the time-loop control
    tloop = TLoop( tstepper = ts, KMAX = 30, debug = False,
                   tline  = TLine( min = 0.0,  step = 1.0, max = 1.0 ))
    
    print 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()
Ejemplo n.º 49
0
def app():
    avg_radius = 0.03

    md = MATS2DScalarDamage( E = 20.0e3,
                            nu = 0.2,
                            epsilon_0 = 1.0e-4,
                            epsilon_f = 8.0e-4,
                            #epsilon_f = 12.0e-4, #test doubling the e_f
                            stress_state = "plane_strain",
                            stiffness = "secant",
                            #stiffness  = "algorithmic",
                            strain_norm = Rankine() )

    mdm = MATS2DMicroplaneDamage( E = 20.0e3,
                                 nu = 0.2,
                                 #epsilon_f = 12.0e-4, #test doubling the e_f
                                 stress_state = "plane_strain",
                                model_version = 'compliance',
                                phi_fn = PhiFnStrainSoftening( 
                                                              G_f = 0.0014,
                                                              f_t = 2.0,
                                                              md = 0.0,
                                                              h = 2. * avg_radius ) )

#    mp = MATSProxy( mats_eval = mdm )
#    mp.varpars['epsilon_0'].switch = 'varied'
#    mp.varpars['epsilon_0'].spatial_fn = MFnNDGrid( shape = ( 8, 5, 1 ),
#                                    active_dims = ['x', 'y'],
#                                    x_mins = GridPoint( x = 0., y = 0. ),
#                                    x_maxs = GridPoint( x = length, y = heigth ) )
#    mp.varpars['epsilon_0'].spatial_fn.set_values_in_box( 500., [0, 0, 0], [0.2, 0.2, 0.] )
#    mp.varpars['epsilon_0'].spatial_fn.set_values_in_box( 500., [0.8, 0, 0], [1., 0.2, 0.] )
#    mp.varpars['epsilon_0'].spatial_fn.set_values_in_box( 50., [0., 0.46, 0], [1., 0.5, 0.] )


#    me = MATS2DElastic( E = 20.0e3,
#                       nu = 0.2,
#                       stress_state = "plane_strain" )

    fets_eval = FETS2D4Q( mats_eval = mdm )#, ngp_r = 3, ngp_s = 3)                                               

    n_el_x = 60
    # Discretization
    fe_grid = FEGrid( coord_max = ( .6, .15, 0. ),
                      shape = ( n_el_x, 15 ),
                      fets_eval = fets_eval )

    mf = MFnLineArray( xdata = array( [0, 1, 2 ] ),
                       ydata = array( [0, 3., 3.2 ] ) )

    #averaging function
    avg_processor = RTNonlocalAvg( avg_fn = QuarticAF( radius = avg_radius,
                                                       correction = True ) )

    loading_dof = fe_grid[n_el_x / 2, -1, 0, -1].dofs.flatten()[1]
    print 'loading_dof', loading_dof
    ts = TS( sdomain = fe_grid,
             u_processor = avg_processor,
             bcond_list = [
                        # constraint for all left dofs in y-direction:
                        BCSlice( var = 'u', slice = fe_grid[0, 0, 0, 0], dims = [0, 1], value = 0. ),
                        BCSlice( var = 'u', slice = fe_grid[-1, 0, -1, 0], dims = [1], value = 0. ),
                        BCSlice( var = 'u', slice = fe_grid[n_el_x / 2, -1, 0, -1], dims = [1],
                                time_function = mf.get_value,
                                value = -2.0e-5 ),
                        ],
             rtrace_list = [
                            RTraceGraph( name = 'Fi,right over u_right (iteration)' ,
                                      var_y = 'F_int', idx_y = loading_dof,
                                      var_x = 'U_k', idx_x = loading_dof,
                                      record_on = 'update' ),
                            RTraceDomainListField( name = 'Deformation' ,
                                           var = 'eps_app', idx = 0,
                                           record_on = 'update' ),
                            RTraceDomainListField( name = 'Deformation' ,
                                           var = 'sig_app', idx = 0,
                                           record_on = 'update' ),
                            RTraceDomainListField( name = 'Displacement' ,
                                           var = 'u', idx = 1,
                                           record_on = 'update',
                                           warp = True ),
                            RTraceDomainListField( name = 'fracture_energy' ,
                                           var = 'fracture_energy', idx = 0,
                                           record_on = 'update',
                                           warp = True ),
                            RTraceDomainListField( name = 'Damage' ,
                                        var = 'omega_mtx', idx = 0, warp = True,
                                        record_on = 'update' ),

    #                         RTraceDomainField(name = 'Stress' ,
    #                                        var = 'sig', idx = 0,
    #                                        record_on = 'update'),
    #                        RTraceDomainField(name = 'N0' ,
    #                                       var = 'N_mtx', idx = 0,
    #                                       record_on = 'update')
                        ]
            )

    # Add the time-loop control
    #
    tl = TLoop( tstepper = ts,
                tolerance = 5.0e-5,
                KMAX = 25,
                tline = TLine( min = 0.0, step = .5, max = 200.0 ) )
    tl.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
    ibvpy_app = IBVPyApp( ibv_resource = ts )
    ibvpy_app.main()
Ejemplo n.º 50
0
            #                        RTraceDomainListField(name = 'Deformation' ,
            #                                       var = 'eps', idx = 0,
            #                                       record_on = 'update'),
            RTraceDomainListField(name='Displacement',
                                  var='u',
                                  idx=0,
                                  warp=True),
            #                         RTraceDomainListField(name = 'Stress' ,
            #                                        var = 'sig', idx = 0,
            #                                        record_on = 'update'),
            #                        RTraceDomainListField(name = 'N0' ,
            #                                       var = 'N_mtx', idx = 0,
            #                                       record_on = 'update')
        ])

    # Add the time-loop control
    tloop = TLoop(tstepper=ts,
                  KMAX=4,
                  RESETMAX=0,
                  tolerance=1e-3,
                  tline=TLine(min=0.0, step=1.0, max=1.0))

    print 'u', 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()
Ejemplo n.º 51
0
    def _get_tloop(self):

        #--------------------------------------------------------------
        # ts
        #--------------------------------------------------------------

        mid_zone_spec = self.mid_zone_specmn_fe_grid
        load_zone_spec = self.load_zone_specmn_fe_grid
        outer_zone_spec = self.outer_zone_specmn_fe_grid

        if self.elstmr_flag:
            # ELSTRMR TOP SURFACE
            # dofs at elastomer top surface (used to integrate the force)
            #
            elastomer = self.elstmr_fe_grid
            elstmr_top_dofs_z = elastomer[:, :, -1, :, :,
                                          -1].dofs[:, :, 2].flatten()
            load_dofs_z = np.unique(elstmr_top_dofs_z)
            print 'load_dofs_z', load_dofs_z
        else:
            # LINE LOAD TOP OF LOAD ZONE
            # dofs at center line of the specmn load zone (used to integrate the force)
            # note slice index in x-direction is only valid for load_zone_shape_x = 2 !
            #
            load_zone_spec_topline_dofs_z = load_zone_spec[
                0, :, -1, -1, :, -1].dofs[:, :, 2].flatten()
            load_dofs_z = np.unique(load_zone_spec_topline_dofs_z)
            print 'load_dofs_z', load_dofs_z

        # SUPPRT LINE
        # dofs at support line of the specmn (used to integrate the force)
        #
        outer_zone_spec_supprtline_dofs_z = outer_zone_spec[
            -1, :, 0, -1, :, 0].dofs[:, :, 2].flatten()
        supprt_dofs_z = np.unique(outer_zone_spec_supprtline_dofs_z)
        print 'supprt_dofs_z', supprt_dofs_z

        # CENTER DOF (used for tracing of the displacement)
        #
        center_bottom_dof = mid_zone_spec[0, 0, 0, 0, 0, 0].dofs[0, 0, 2]
        print 'center_bottom_dof', center_bottom_dof

        # THIRDPOINT DOF (used for tracing of the displacement)
        # dofs at center middle of the laod zone at the bottom side
        #
        # NOTE: slice index in x-direction is only valid for load_zone_shape_x = 2 !
        thirdpoint_bottom_dof = load_zone_spec[0, 0, 0, -1, 0, 0].dofs[0, 0, 2]
        print 'thirdpoint_bottom_dof', thirdpoint_bottom_dof

        # force-displacement-diagram (CENTER)
        #
        self.f_w_diagram_center = RTraceGraph(
            name='displacement_elasttop (center) - force',
            var_x='U_k',
            idx_x=center_bottom_dof,
            var_y='F_int',
            idx_y_arr=load_dofs_z,
            record_on='update',
            transform_x='-x * 1000',  # %g * x' % ( fabs( w_max ),),
            # due to symmetry the total force sums up from four parts of the beam (2 symmetry axis):
            #
            transform_y='-4000. * y')

        # force-displacement-diagram_supprt (SUPPRT)
        #
        self.f_w_diagram_supprt = RTraceGraph(
            name='displacement_supprtline (center) - force',
            var_x='U_k',
            idx_x=center_bottom_dof,
            var_y='F_int',
            idx_y_arr=supprt_dofs_z,
            record_on='update',
            transform_x='-x * 1000',  # %g * x' % ( fabs( w_max ),),
            # due to symmetry the total force sums up from four parts of the beam (2 symmetry axis):
            #
            transform_y='4000. * y')

        # force-displacement-diagram (THIRDPOINT)
        #
        self.f_w_diagram_thirdpoint = RTraceGraph(
            name='displacement_elasttop (thirdpoint) - force',
            var_x='U_k',
            idx_x=thirdpoint_bottom_dof,
            var_y='F_int',
            idx_y_arr=load_dofs_z,
            record_on='update',
            transform_x='-x * 1000',  # %g * x' % ( fabs( w_max ),),
            # due to symmetry the total force sums up from four parts of the beam (2 symmetry axis):
            #
            transform_y='-4000. * y')

        ts = TS(
            sdomain=self.fe_domain,
            bcond_list=self.bc_list,
            rtrace_list=[
                self.f_w_diagram_center,
                self.f_w_diagram_thirdpoint,
                self.f_w_diagram_supprt,
                RTraceDomainListField(name='Displacement',
                                      var='u',
                                      idx=0,
                                      warp=True),
                #                             RTraceDomainListField(name = 'Stress' ,
                #                                            var = 'sig_app', idx = 0, warp = True,
                #                                            record_on = 'update'),
                #                             RTraceDomainListField(name = 'Strain' ,
                #                                        var = 'eps_app', idx = 0, warp = True,
                #                                        record_on = 'update'),
                #                             RTraceDomainListField(name = 'Damage' ,
                #                                        var = 'omega_mtx', idx = 0, warp = True,
                #                                        record_on = 'update'),
                RTraceDomainListField(name='max_omega_i',
                                      warp=True,
                                      var='max_omega_i',
                                      idx=0,
                                      record_on='update'),
                #                             RTraceDomainListField(name = 'IStress' ,
                #                                            position = 'int_pnts',
                #                                            var = 'sig_app', idx = 0,
                #                                            record_on = 'update'),
                #                             RTraceDomainListField(name = 'IStrain' ,
                #                                            position = 'int_pnts',
                #                                            var = 'eps_app', idx = 0,
                #                                            record_on = 'update'),
            ])

        # Add the time-loop control
        tloop = TLoop(tstepper=ts,
                      KMAX=50,
                      tolerance=self.tolerance,
                      RESETMAX=0,
                      tline=TLine(min=0.0, step=self.tstep, max=self.tmax),
                      ord=self.ord)

        return tloop
Ejemplo n.º 52
0
    ts = TS( dof_resultants = True,
             sdomain = fe_domain,
             bcond_list =  [BCDofGroup(var='f', value = 1., dims = [0],
                                       get_dof_method = fe_grid1.get_top_dofs ),
                            BCDofGroup(var='u', value = 0., dims = [0,1],
                                       get_dof_method = fe_grid1.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 = False ),
#                             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.setup()
    
    from ibvpy.plugins.ibvpy_app import IBVPyApp
    ibvpy_app = IBVPyApp( ibv_resource = tloop )
    ibvpy_app.main()
        
Ejemplo n.º 53
0
def example():
    from ibvpy.api import \
        TStepper as TS, RTDofGraph, RTraceDomainListField, TLoop, \
        TLine, IBVPSolve as IS, DOTSEval, BCSlice
    from ibvpy.mesh.fe_grid import FEGrid
    from mathkit.mfn import MFnLineArray

    stiffness_concrete = 34000 * 0.03 * 0.03
    A_fiber = 1.
    E_fiber = 1.
    stiffness_fiber = E_fiber * A_fiber

    d = 2 * sqrt(Pi)
    tau_max = 0.1 * d * Pi
    G = 100
    u_max = 0.023
    f_max = 0.2
    mats_eval = MATS1D5Bond(mats_phase1=MATS1DElastic(E=stiffness_fiber),
                            mats_phase2=MATS1DElastic(E=0),
                            mats_ifslip=MATS1DPlastic(E=G,
                                                      sigma_y=tau_max,
                                                      K_bar=0.,
                                                      H_bar=0.),
                            mats_ifopen=MATS1DElastic(E=0))

    fets_eval = FETS1D52L4ULRH(mats_eval=mats_eval)
    domain = FEGrid(coord_max=(1., 0.2),
                    shape=(16, 1),
                    fets_eval=fets_eval)

    end_dof = domain[-1, 0, -1, 0].dofs[0, 0, 0]
    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=[
                BCSlice(var='u', value=0., dims=[0],
                        slice=domain[:, :, :, -1]),
                BCSlice(var='u', value=0., dims=[1],
                        slice=domain[:, :, :, :]),
                BCSlice(var='f', value=f_max, dims=[0],
                        slice=domain[-1, 0, -1, 0])
            ],
            rtrace_list=[RTDofGraph(name='Fi,right over u_right (iteration)',
                                    var_y='F_int', idx_y=end_dof,
                                    var_x='U_k', idx_x=end_dof),
                         RTraceDomainListField(name='slip',
                                               var='slip', idx=0),
                         RTraceDomainListField(name='eps1',
                                               var='eps1', idx=0),
                         RTraceDomainListField(name='eps2',
                                               var='eps2', idx=0),
                         RTraceDomainListField(name='shear_flow',
                                               var='shear_flow', idx=0),
                         RTraceDomainListField(name='sig1',
                                               var='sig1', idx=0),
                         RTraceDomainListField(name='sig2',
                                               var='sig2', idx=0),
                         RTraceDomainListField(name='Displacement',
                                               var='u', idx=0)
                         ])

    # Add the time-loop control
    tloop = TLoop(tstepper=ts, KMAX=30, debug=False,
                  tline=TLine(min=0.0, step=0.1, max=1.0))

    print(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()
Ejemplo n.º 54
0
def example_with_new_domain():
    from ibvpy.api import \
        TStepper as TS, RTraceDomainListField, TLoop, TLine

    from ibvpy.tmodel.mats2D5.mats2D5_bond.mats2D_bond import MATS2D5Bond
    from ibvpy.api import BCDofGroup
    from ibvpy.fets.fets2D.fets2D4q import FETS2D4Q
    fets_eval = FETS2DTF(parent_fets=FETS2D4Q(),
                         mats_eval=MATS2D5Bond(E_m=30, nu_m=0.2,
                                               E_f=10, nu_f=0.1,
                                               G=10.))

    from ibvpy.mesh.fe_grid import FEGrid
    from mathkit.mfn import MFnLineArray

    # Discretization
    fe_grid = FEGrid(coord_max=(10., 4., 0.),
                     n_elems=(10, 3),
                     fets_eval=fets_eval)

    mf = MFnLineArray(  # xdata = arange(10),
        ydata=array([0, 1, 2, 3]))

    tstepper = TS(sdomain=fe_grid,
                  bcond_list=[BCDofGroup(var='u', value=0., dims=[0, 1],
                                         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],
                                         time_function=mf.get_value,
                                         get_dof_method=fe_grid.get_right_dofs)],
                  rtrace_list=[
                      #                     RTDofGraph(name = 'Fi,right over u_right (iteration)' ,
                      #                               var_y = 'F_int', idx_y = right_dof,
                      #                               var_x = 'U_k', idx_x = right_dof,
                      #                               record_on = 'update'),
                      #                         RTraceDomainListField(name = 'Stress' ,
                      #                         var = 'sig_app', idx = 0,
                      #                         #position = 'int_pnts',
                      #                         record_on = 'update'),
                      #                     RTraceDomainListField(name = 'Damage' ,
                      #                                    var = 'omega', idx = 0,
                      #                                    record_on = 'update',
                      #                                    warp = True),
                      RTraceDomainListField(name='Displ matrix',
                                            var='u_m', idx=0,
                                            record_on='update',
                                            warp=True),
                      RTraceDomainListField(name='Displ reinf',
                                            var='u_f', idx=0,
                                            record_on='update',
                                            warp=True),

                      #                    RTraceDomainListField(name = 'N0' ,
                      #                                      var = 'N_mtx', idx = 0,
                      # record_on = 'update')
                  ]
                  )

    # Add the time-loop control
    #global tloop
    tloop = TLoop(tstepper=tstepper, KMAX=300, tolerance=1e-4,
                  tline=TLine(min=0.0, step=1.0, max=1.0))

    #import cProfile
    #cProfile.run('tloop.eval()', 'tloop_prof' )
    print(tloop.eval())
    #import pstats
    #p = pstats.Stats('tloop_prof')
    # p.strip_dirs()
    # print 'cumulative'
    # p.sort_stats('cumulative').print_stats(20)
    # print 'time'
    # p.sort_stats('time').print_stats(20)

    # Put the whole thing 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()
Ejemplo n.º 55
0
def test_bar4():
    '''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'''

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

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

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

    fe_domain3 = FEGrid(coord_min=(4., 0., 0.),
                        coord_max=(6., 0., 0.),
                        shape=(2, ),
                        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),
                    (fets_eval, 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),
                RTraceDomainListField(name='Displacement', var='u', idx=0)
            ])

    # 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
    app = IBVPyApp(ibv_resource=tloop)
    app.main()
Ejemplo n.º 56
0
def example_with_new_domain():
    from ibvpy.api import \
        TStepper as TS, RTraceGraph, RTraceDomainListField, \
        RTraceDomainListInteg, TLoop, \
        TLine, BCDof, IBVPSolve as IS, DOTSEval
    from ibvpy.mats.mats2D.mats2D_elastic.mats2D_elastic import MATS2DElastic
    from ibvpy.mats.mats2D.mats2D_sdamage.mats2D_sdamage import MATS2DScalarDamage

    from ibvpy.api import BCDofGroup

    mats_eval = MATS2DElastic()
    fets_eval = FETS2D4Q(mats_eval=mats_eval)
    #fets_eval = FETS2D4Q(mats_eval = MATS2DScalarDamage())

    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=(10., 4., 0.),
                     shape=(10, 3),
                     fets_eval=fets_eval)

    bcg = BCDofGroup(var='u',
                     value=0.,
                     dims=[0],
                     get_dof_method=fe_grid.get_left_dofs)
    bcg.setup(None)
    print 'labels', bcg._get_labels()
    print 'points', bcg._get_mvpoints()

    mf = MFnLineArray(  # xdata = arange(10),
        ydata=array([0, 1, 2, 3]))

    right_dof = 2
    tstepper = TS(
        sdomain=fe_grid,
        bcond_list=[
            BCDofGroup(var='u',
                       value=0.,
                       dims=[0, 1],
                       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=[1],
                       time_function=mf.get_value,
                       get_dof_method=fe_grid.get_right_dofs)
        ],
        rtrace_list=[
            RTraceGraph(name='Fi,right over u_right (iteration)',
                        var_y='F_int',
                        idx_y=right_dof,
                        var_x='U_k',
                        idx_x=right_dof,
                        record_on='update'),
            RTraceDomainListField(name='Stress',
                                  var='sig_app',
                                  idx=0,
                                  position='int_pnts',
                                  record_on='update'),
            #                     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='Strain energy',
                                  var='strain_energy',
                                  idx=0,
                                  record_on='update',
                                  warp=False),
            RTraceDomainListInteg(name='Integ strain energy',
                                  var='strain_energy',
                                  idx=0,
                                  record_on='update',
                                  warp=False),
            #                    RTraceDomainListField(name = 'N0' ,
            #                                      var = 'N_mtx', idx = 0,
            # record_on = 'update')
        ])

    # Add the time-loop control
    #global tloop
    tloop = TLoop(tstepper=tstepper,
                  KMAX=300,
                  tolerance=1e-4,
                  tline=TLine(min=0.0, step=1.0, max=1.0))

    #import cProfile
    #cProfile.run('tloop.eval()', 'tloop_prof' )
    # print tloop.eval()
    #import pstats
    #p = pstats.Stats('tloop_prof')
    # p.strip_dirs()
    # print 'cumulative'
    # p.sort_stats('cumulative').print_stats(20)
    # print 'time'
    # p.sort_stats('time').print_stats(20)

    tloop.eval()
    # Put the whole thing 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()
Ejemplo n.º 57
0
def app():
    avg_radius = 0.03

    md = MATS2DScalarDamage(E=20.0e3,
                            nu=0.2,
                            epsilon_0=1.0e-4,
                            epsilon_f=8.0e-4,
                            #epsilon_f = 12.0e-4, #test doubling the e_f
                            stress_state="plane_strain",
                            stiffness="secant",
                            #stiffness  = "algorithmic",
                            strain_norm=Rankine())


#    me = MATS2DElastic( E = 20.0e3,
#                       nu = 0.2,
#                       stress_state = "plane_strain" )

    fets_eval = FETS2D4Q(mats_eval=md)#, ngp_r = 3, ngp_s = 3)                                               

    n_el_x = 60
    # Discretization
    fe_grid = FEGrid(coord_max=(.6, .15, 0.),
                      shape=(n_el_x, 15),
                      fets_eval=fets_eval)

    mf = MFnLineArray(xdata=array([0, 1, 2, 7, 8 , 28]),
                       ydata=array([0, 3., 3.2, 3.3, 3.32, 3.72 ]))

    #averaging function
    avg_processor = RTNonlocalAvg(avg_fn=QuarticAF(radius=avg_radius,
                                                       correction=True))

    ts = TS(sdomain=fe_grid,
             u_processor=avg_processor,
             bcond_list=[
                        # constraint for all left dofs in y-direction:
                        BCSlice(var='u', slice=fe_grid[0, 0, 0, 0], dims=[0, 1], value=0.),
                        BCSlice(var='u', slice=fe_grid[-1, 0, -1, 0], dims=[1], value=0.),
                        BCSlice(var='u', slice=fe_grid[n_el_x / 2, -1, 0, -1], dims=[1],
                                time_function=mf.get_value,
                                value= -2.0e-5),
                        ],
             rtrace_list=[
    #                        RTDofGraph(name = 'Fi,right over u_right (iteration)' ,
    #                                  var_y = 'F_int', idx_y = right_dof,
    #                                  var_x = 'U_k', idx_x = right_dof,
    #                                  record_on = 'update'),
                            RTraceDomainListField(name='Deformation' ,
                                           var='eps_app', idx=0,
                                           record_on='update'),
                            RTraceDomainListField(name='Displacement' ,
                                           var='u', idx=1,
                                           record_on='update',
                                           warp=True),
                            RTraceDomainListField(name='Damage' ,
                                           var='omega', idx=0,
                                           record_on='update',
                                           warp=True),
    #                         RTraceDomainField(name = 'Stress' ,
    #                                        var = 'sig', idx = 0,
    #                                        record_on = 'update'),
    #                        RTraceDomainField(name = 'N0' ,
    #                                       var = 'N_mtx', idx = 0,
    #                                       record_on = 'update')
                        ]
            )

    # Add the time-loop control
    #
    tl = TLoop(tstepper=ts,
                tolerance=5.0e-4,
                KMAX=100,
                tline=TLine(min=0.0, step=.25, max=10.0))
    tl.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
    ibvpy_app = IBVPyApp(ibv_resource=ts)
    ibvpy_app.main()
Ejemplo n.º 58
0
def xtest_L_shaped():
    '''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'''

    mp = MATS2DScalarDamage(
        E=34.e3,
        nu=0.2,
        epsilon_0=59.e-6,
        epsilon_f=3.2e-3,
        #epsilon_f = 3.2e-1,
        #stiffness  = "algorithmic",
        strain_norm_type='Mises')

    #    mp = MATS2DElastic( E = 34.e3,
    #                        nu = 0.2 )
    fets_eval = FETS2D4Q(mats_eval=mp)

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

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

    fe_domain3 = FEGrid(coord_min=(1., 1., 0),
                        coord_max=(2., 2., 0.),
                        shape=discr,
                        n_nodal_dofs=fets_eval.n_nodal_dofs,
                        dof_r=fets_eval.dof_r,
                        geo_r=fets_eval.geo_r)

    ts = TS(
        iterms=[(fets_eval, fe_domain1), (fets_eval, fe_domain2),
                (fets_eval, fe_domain3)],
        dof_resultants=True,
        bcond_list=[
            BCDofGroup(var='u',
                       value=0.,
                       dims=[0, 1],
                       get_dof_method=fe_domain1.get_bottom_dofs),
            BCDofGroup(var='u',
                       value=0.,
                       dims=[0, 1],
                       get_dof_method=fe_domain3.get_left_dofs,
                       get_link_dof_method=fe_domain2.get_right_dofs,
                       link_coeffs=[1.]),
            BCDofGroup(var='u',
                       value=0.,
                       dims=[0, 1],
                       get_dof_method=fe_domain2.get_bottom_dofs,
                       get_link_dof_method=fe_domain1.get_top_dofs,
                       link_coeffs=[1.]),
            BCDofGroup(var='u',
                       value=0.0004,
                       dims=[1],
                       get_dof_method=fe_domain3.get_right_dofs)
        ],
        rtrace_list=[
            RTraceDomainListField(name='Displacement', var='u', idx=1),
            RTraceDomainListField(name='Damage',
                                  var='omega',
                                  idx=0,
                                  record_on='update',
                                  warp=True),
            #                              RTraceDomainListField(name = 'Stress' ,
            #                              var = 'sig_app', idx = 0,
            #                              record_on = 'update',
            #                              warp = False),
            #                              RTraceDomainListField(name = 'Strain' ,
            #                              var = 'eps_app', idx = 0,
            #                              record_on = 'update',
            #                              warp = False),
        ])

    # Add the time-loop control
    global tloop
    tloop = TLoop(tstepper=ts,
                  tolerance=1e-4,
                  KMAX=50,
                  tline=TLine(min=0.0, step=0.2, max=1.0))

    tloop.eval()
    #    import cProfile
    #    cProfile.run('tloop.eval()', 'tloop_prof' )
    #
    #    import pstats
    #    p = pstats.Stats('tloop_prof')
    #    p.strip_dirs()
    #    print 'cumulative'
    #    p.sort_stats('cumulative').print_stats(20)
    #    print 'time'
    #    p.sort_stats('time').print_stats(20)

    from ibvpy.plugins.ibvpy_app import IBVPyApp
    app = IBVPyApp(ibv_resource=tloop)
    app.main()
Ejemplo n.º 59
0
                       dims=[1],
                       get_dof_method=domain.get_bottom_left_dofs),
            BCDofGroup(var='u',
                       value=0.002,
                       dims=[0],
                       get_dof_method=domain.get_right_dofs)
        ],
        rtrace_list=[
            #                         RTDofGraph(name = 'Fi,right over u_right (iteration)' ,
            #                               var_y = 'F_int', idx_y = right_dof,
            #                               var_x = 'U_k', idx_x = right_dof),
            #                         RTraceDomainField(name = 'Stress' ,
            #                         var = 'sig_app', idx = 0,
            #                         record_on = 'update'),
            RTraceDomainListField(name='Displacement', var='u', idx=0),
            #                             RTraceDomainField(name = 'N0' ,
            #                                          var = 'N_mtx', idx = 0,
            #                                          record_on = 'update')
        ])

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

    tl.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=tl)
    app.main()
Ejemplo n.º 60
0
from numpy import array, sqrt
from scipy.linalg import norm

if __name__ == '__main__':
    fets_eval = FETS1D2L(mats_eval=MATS1DElastic(E=10.))

    # 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))

    '''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 = (10, 0, 0)
    domain.shape = (10,)
    ts.bcond_list = [BCDof(var='u', dof=0, value=0.),
                     BCDof(var='u', dof=10, value=1.)]
    ts.rtrace_list = [RTDofGraph(name='Fi,right over u_right (iteration)',
                                 var_y='F_int', idx_y=10,
                                 var_x='U_k', idx_x=10)]

    u = tloop.eval()
    # expected solution