예제 #1
0
    def example_1d():
        from ibvpy.tmodel.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())
예제 #2
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()
예제 #3
0
    def example_1d():
        from ibvpy.api import FEDomain, FERefinementGrid, FEGrid, TStepBC as TS, \
            BCDofGroup, RTraceDomainListField, TLoop, TLine
        from ibvpy.mesh.xfe_subdomain import XFESubDomain
        from ibvpy.tmodel.mats1D.mats1D_elastic.mats1D_elastic import MATS1DElastic
        from ibvpy.fets.fets1D.fets1D2l import FETS1D2L
        from ibvpy.fets.fets1D.fets1D2l3u import FETS1D2L3U
        from ibvpy.fets.fets_ls.fets_crack import FETSCrack
        fets_eval = FETS1D2L(mats_eval=MATS1DElastic(E=1.))  #, A=1.))
        #xfets_eval = fets_eval # use the same element for the enrichment
        xfets_eval = FETSCrack(parent_fets=fets_eval)
        # Discretization

        fe_domain = FEDomain()
        fe_level1 = FERefinementGrid(domain=fe_domain, fets_eval=fets_eval)
        fe_grid1 = FEGrid(coord_max=(4., 0., 0.),
                          shape=(4, ),
                          fets_eval=fets_eval,
                          level=fe_level1)

        enr = True
        if enr:
            fe_xdomain = XFESubDomain(
                domain=fe_domain,
                fets_eval=xfets_eval,
                fe_grid_slice=fe_grid1['(X - 2) **2 - 0.5 '])
            fe_xdomain.deactivate_sliced_elems()

        print('elem_dof_map', fe_xdomain.elem_dof_map)

        fe_domain = FEDomain()
        fe_level1 = FERefinementGrid(domain=fe_domain, fets_eval=fets_eval)
        fe_grid1 = FEGrid(coord_max=(4 * 3.14, 0., 0.),
                          shape=(8, ),
                          fets_eval=fets_eval,
                          level=fe_level1)

        enr = True
        if enr:
            fe_xdomain = XFESubDomain(domain=fe_domain,
                                      fets_eval=xfets_eval,
                                      fe_grid_slice=fe_grid1['cos(X) - 0.5'])
            fe_xdomain.deactivate_sliced_elems()

        print('elem_dof_map2', fe_xdomain.elem_dof_map)
예제 #4
0
                      resizable=True)), ))

    traits_view = tree_view


if __name__ == '__main__':

    from ibvpy.mesh.fe_grid import FEGrid
    from ibvpy.mesh.fe_domain import FEDomain
    from ibvpy.fets.fets1D.fets1D2l import FETS1D2L
    from ibvpy.api import \
        TStepper as TS, RTDofGraph, TLoop, \
        TLine
    from ibvpy.tmodel.mats1D.mats1D_elastic.mats1D_elastic import MATS1DElastic

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

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

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

    fe_domain = FEDomain(subdomains=[fe_domain1, fe_domain2])
    ts = TS(dof_resultants=True,
            sdomain=fe_domain,
            bcond_list=[
예제 #5
0
    def example_1d():
        fets_eval = FETS1D2L3U(mats_eval=MATS1DElastic(E=20.))
        xfets_eval = FETSCrack(parent_fets=fets_eval, int_order=2)

        # Discretization

        fe_domain = FEDomain()
        fe_level1 = FERefinementGrid(domain=fe_domain, fets_eval=fets_eval)
        fe_grid1 = FEGrid(coord_max=(2., 0., 0.),
                          shape=(2, ),
                          fets_eval=fets_eval,
                          level=fe_level1)

        enr = True
        if enr:
            fe_xdomain = XFESubDomain(
                domain=fe_domain,
                fets_eval=xfets_eval,
                #fe_grid_idx_slice = fe_grid1[1,0],
                fe_grid_slice=fe_grid1['X  - .75'])
            fe_xdomain.deactivate_sliced_elems()

        ts = TS(
            dof_resultants=True,
            sdomain=fe_domain,
            bcond_list=[
                BCSlice(var='u',
                        value=-1. / 2.,
                        dims=[0],
                        slice=fe_grid1[0, 0]),
                BCSlice(var='u', value=0., dims=[0], slice=fe_grid1[-1, -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='eps',
                                      idx=0,
                                      warp=True),
                RTraceDomainListField(name='Displacement',
                                      var='u',
                                      idx=0,
                                      warp=True),
                #                                     RTraceDomainField(name = 'N0' ,
                #                                                  var = 'N_mtx', idx = 0,
                #                                                  record_on = 'update')
            ])
        #
        #        # Add the time-loop control
        tloop = TLoop(tstepper=ts,
                      debug=True,
                      tolerance=1e-4,
                      RESETMAX=0,
                      tline=TLine(min=0.0, step=1, max=1.0))

        #print "elements ",fe_xdomain.elements[0]
        if enr:
            print('parent elems ', fe_xdomain.fe_grid_slice.elems)
            print('parent dofs ', fe_xdomain.fe_grid_slice.dofs)
            print("dofmap ", fe_xdomain.elem_dof_map)
            print("ls_values ", fe_xdomain.dots.dof_node_ls_values)
            print('intersection points ', fe_xdomain.fe_grid_slice.r_i)  #
            print("triangles ", fe_xdomain.dots.int_division)
            print('ip_coords', fe_xdomain.dots.ip_coords)
            print('ip_weigths', fe_xdomain.dots.ip_weights)
            print('ip_offset ', fe_xdomain.dots.ip_offset)
            print('ip_X_coords', fe_xdomain.dots.ip_X)
            print('ip_ls', fe_xdomain.dots.ip_ls_values)
            print('vtk_X ', fe_xdomain.dots.vtk_X)
            print('vtk triangles ', fe_xdomain.dots.rt_triangles)
            print("vtk data ",
                  fe_xdomain.dots.get_vtk_cell_data('blabla', 0, 0))
            print('vtk_ls', fe_xdomain.dots.vtk_ls_values)
            print('J_det ', fe_xdomain.dots.J_det_grid)

        tloop.eval()

        from ibvpy.plugins.ibvpy_app import IBVPyApp
        ibvpy_app = IBVPyApp(ibv_resource=ts)
        ibvpy_app.main()
예제 #6
0
def example_with_new_domain():
    from ibvpy.api import \
        TStepper as TS, RTDofGraph, RTraceDomainListField, TLoop, \
        TLine, BCDof, IBVPSolve as IS, DOTSEval
    from ibvpy.tmodel.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()
예제 #7
0
        interior_bc = fe_grid[1, 1, 1:, 1:]

        bcond_list = [
            BCSlice(var='u', dims=[0, 1], slice=fe_grid[:, 0, :, 0],
                    value=0.0),
            BCSlice(var='u',
                    dims=[0, 1],
                    slice=interior_bc,
                    link_slice=fe_grid[1, 0, 0, 0],
                    link_coeffs=[0],
                    value=0.0),
            BCSlice(var='f', dims=[1], slice=fe_grid[0, -1, :, -1], value=1.0)
        ]

    else:
        fets_eval_1d = FETS1D2L(mats_eval=MATS1DElastic())
        fe_grid = FEGrid(name='fe_grid1',
                         coord_max=(4., ),
                         shape=(4, ),
                         fets_eval=fets_eval_1d)

        interior_elems = fe_grid[1:3, :].elems
        interior_bc = fe_grid[1:2, 1:]

        bcond_list = [
            BCSlice(var='u', dims=[0], slice=fe_grid[0, 0], value=0.0),
            BCSlice(var='u',
                    dims=[0],
                    slice=interior_bc,
                    link_slice=fe_grid[0, 0],
                    link_coeffs=[0],
예제 #8
0
 def _mats_eval_default(self):
     return MATS1DElastic()