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()
Beispiel #2
0
            Bx_mtx[2, i * 2 + 1] = dNx_mtx[0, i]
        return Bx_mtx


#----------------------- example with the new domain --------
if __name__ == '__main__':
    from ibvpy.api import \
        TStepper as TS, RTraceGraph, RTraceDomainListField, TLoop, \
        TLine, BCDofGroup

    #from lib.mats.mats2D.mats_cmdm2D.mats_mdm2d import MACMDM
    from ibvpy.mats.mats2D.mats2D_sdamage.mats2D_sdamage import MATS2DScalarDamage
    #from ibvpy.mats.mats2D.mats2D_elastic.mats2D_elastic import MATS2DElastic
    from ibvpy.mesh.fe_grid import FEGrid

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

    # Discretization
    #
    domain = FEGrid(coord_max=(3., 3., 0.), shape=(3, 3), fets_eval=fets_eval)
    print 'n_dofs', domain.n_dofs

    right_dof = 2
    ts = TS(
        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.,
Beispiel #3
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()
Beispiel #4
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 = 20  # 60
    # Discretization
    fe_grid = FEGrid(coord_max=(.6, .15, 0.),
                     shape=(n_el_x, n_el_x / 4),
                     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-4),
        ],
        rtrace_list=[
            RTDofGraph(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=200,
               tline=TLine(min=0.0, step=.1, 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
    ibvpy_app = IBVPyApp(ibv_resource=ts)
    ibvpy_app.main()