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()
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()
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()
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()
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()
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()
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()
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()
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()
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()
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()
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()
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()
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()
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()
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 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()
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()
def example_0(): from ibvpy.fets.fets_eval import FETSEval fets_sample = FETSEval(dof_r=[[-1., -1], [0.5, -1], [1, 1], [-1, 1]], geo_r=[[-1., -1], [0.5, -1], [1, 1], [-1, 1]], n_nodal_dofs=1) fe_domain = FEDomain() fe_pgrid = FERefinementGrid(domain=fe_domain, fets_eval=fets_sample) fe_grid = FEGrid(coord_max=(1., 1., 0.), level=fe_pgrid, shape=(2, 2), inactive_elems=[1], fets_eval=fets_sample) print('elem_dof_map') print(fe_domain.elem_dof_map) print('elem_X_map') print(fe_domain.elem_X_map) fe_child_domain = FERefinementGrid(parent=fe_pgrid, fets_eval=fets_sample, fine_cell_shape=(2, 2)) fe_child_domain.refine_elem((1, 1)) fe_child_domain.refine_elem((0, 1)) print(fe_child_domain.elem_dof_map) print(fe_child_domain.elem_X_map) print('n_dofs', fe_child_domain.n_dofs) for e_id, e in enumerate(fe_child_domain.elements): print('idx', e_id) print(e) from ibvpy.plugins.ibvpy_app import IBVPyApp ibvpy_app = IBVPyApp(ibv_resource=fe_domain) ibvpy_app.main()
def example_0(): from ibvpy.fets.fets_eval import FETSEval fets_sample = FETSEval(dof_r=[[-1., -1], [0.5, -1], [1, 1], [-1, 1]], geo_r=[[-1., -1], [0.5, -1], [1, 1], [-1, 1]], n_nodal_dofs=1) fe_domain = FEDomain() fe_pgrid = FERefinementGrid(domain=fe_domain, fets_eval=fets_sample) fe_grid = FEGrid(coord_max=(1., 1., 0.), level=fe_pgrid, shape=(2, 2), inactive_elems=[1], fets_eval=fets_sample) print 'elem_dof_map' print fe_domain.elem_dof_map print 'elem_X_map' print fe_domain.elem_X_map fe_child_domain = FERefinementGrid(parent=fe_pgrid, fets_eval=fets_sample, fine_cell_shape=(2, 2)) fe_child_domain.refine_elem((1, 1)) fe_child_domain.refine_elem((0, 1)) print fe_child_domain.elem_dof_map print fe_child_domain.elem_X_map print 'n_dofs', fe_child_domain.n_dofs for e_id, e in enumerate(fe_child_domain.elements): print 'idx', e_id print e from ibvpy.plugins.ibvpy_app import IBVPyApp ibvpy_app = IBVPyApp(ibv_resource=fe_domain) ibvpy_app.main()
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()
def example_2d(): from ibvpy.api import FEDomain, FERefinementGrid, FEGrid, TStepper as TS,\ BCDofGroup, RTraceDomainListField from ibvpy.core.tloop import TLoop, TLine from ibvpy.mesh.xfe_subdomain import XFESubDomain from ibvpy.mats.mats2D.mats2D_elastic.mats2D_elastic import MATS2DElastic from ibvpy.fets.fets2D.fets2D4q import FETS2D4Q #from fets_strong_weak_tf import FETSStrongWeakTF from fets_sw_sopu import FETSStrongWeakTFSOPU from ibvpy.fets.fets2D.fets2Dtf import FETS2DTF from ibvpy.mats.mats2D5.mats2D5_bond.mats2D_bond import MATS2D5Bond from ibvpy.fets.fets2D.fets2D4q import FETS2D4Q from ibvpy.fets.fets2D.fets2D4q8u import FETS2D4Q8U from ibvpy.fets.fets2D.fets2D4q9u import FETS2D4Q9U from ibvpy.fets.fets2D.fets2D4q12u import FETS2D4Q12U from ibvpy.fets.fets2D.fets2D4q16u import FETS2D4Q16U # from fets2D4qtf import FETS2D4QTF # from fets2D4q8utf import FETS2D4Q8UTF # from fets2D4q9utf import FETS2D4Q9UTF #fets_eval = FETS2D4Q(mats_eval = MATS2DElastic(E= 1.,nu=0.)) fets_eval = FETS2DTF(parent_fets = FETS2D4Q9U(), mats_eval = MATS2D5Bond(E_m = 30, nu_m = 0.3, E_f = 3, nu_f = 0.3, G = 8.)) fets_eval_sopu = FETS2DTF(parent_fets = FETS2D4Q(), mats_eval = MATS2D5Bond(E_m = 30, nu_m = 0.3, E_f = 3, nu_f = 0.3, G = 8.)) xfets_eval = FETSStrongWeakTFSOPU( parent_fets = fets_eval, sopu_fets = fets_eval_sopu, int_order = 5 ) # Discretization fe_domain = FEDomain() fe_level1 = FERefinementGrid( domain = fe_domain, fets_eval = fets_eval ) fe_grid1 = FEGrid( coord_max = (3.,2.,0.), shape = (15,10), 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 + 0.1 *Y - 1.501'] ) fe_xdomain2 = XFESubDomain( domain = fe_domain, fets_eval = xfets_eval, #fe_grid_idx_slice = fe_grid1[1,0], fe_grid_slice = fe_grid1['X - 0.1* Y - 2.201'] ) ts = TS( dof_resultants = True, sdomain = fe_domain, bcond_list = [BCDofGroup(var='u', value = .2, dims = [0], get_dof_method = fe_grid1.get_right_dofs ), BCDofGroup(var='u', value = 0., dims = [1], get_dof_method = fe_grid1.get_bottom_right_dofs ), BCDofGroup(var='u', value = 0., dims = [0], get_dof_method = fe_grid1.get_left_dofs ), BCDofGroup(var='u', value = 0., dims = [1], get_dof_method = fe_grid1.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 = 0, warp = True ), RTraceDomainListField(name = 'Displ matrix' , var = 'u_m', warp = True, warp_var = 'u_m'), RTraceDomainListField(name = 'Displ reinf' , var = 'u_f', warp = True, warp_var = 'u_f'), RTraceDomainListField(name = 'Strain matrix' , var = 'eps_m', warp = True, warp_var = 'u_m'), RTraceDomainListField(name = 'Strain reinf' , var = 'eps_f', warp = True, warp_var = 'u_f'), # RTraceDomainField(name = 'N0' , # var = 'N_mtx', idx = 0, # record_on = 'update') ] ) # # # Add the time-loop control tloop = TLoop( tstepper = ts, # tolerance = 1e-4, KMAX = 4, # debug = True, RESETMAX = 2, tline = TLine( min = 0.0, step = 1, max = 1.0 )) fe_xdomain.deactivate_sliced_elems() fe_xdomain2.deactivate_sliced_elems() # if enr: # #print "elements ",fe_xdomain.elements[0] # fe_xdomain.deactivate_sliced_elems() # #fe_xdomain2.deactivate_sliced_elems() # 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.rt_triangles # print "vtk points ", fe_xdomain.dots.vtk_X # print "vtk data ", fe_xdomain.dots.get_vtk_cell_data('blabla',0,0) # print 'ip_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_ls', fe_xdomain.dots.vtk_ls_values # print 'J_det ',fe_xdomain.dots.J_det_grid tloop.eval() # #ts.setup() from ibvpy.plugins.ibvpy_app import IBVPyApp ibvpy_app = IBVPyApp( ibv_resource = ts ) ibvpy_app.main()
return full_node_map #------------------------------------------------------------------ # UI - related methods #------------------------------------------------------------------ traits_view = View(Item('grid_cell_spec'), Item('refresh_button'), Item('node_map'), resizable=True, height=0.5, width=0.5) class MGridPntCell(MGridCell): ''' ''' class MGridDofCell(MGridCell): ''' ''' if __name__ == '__main__': mgc = MGridCell(grid_cell_spec=MGridCellSpec()) from ibvpy.plugins.ibvpy_app import IBVPyApp ibvpy_app = IBVPyApp(ibv_resource=mgc) ibvpy_app.main()
def example(): from ibvpy.api import ( TStepper as TS, RTraceGraph, 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.0 E_fiber = 1000000.0 stiffness_fiber = E_fiber * A_fiber d = 2 * sqrt(Pi) tau_max = 0.1 * d * Pi G = 1000 u_max = 0.023 f_max = 1 mats_eval = MATS1D5Bond( mats_phase1=MATS1DElastic(E=stiffness_fiber), mats_phase2=MATS1DElastic(E=10000), mats_ifslip=MATS1DPlastic(E=G, sigma_y=tau_max, K_bar=0.0, H_bar=0.0), mats_ifopen=MATS1DElastic(E=100000), ) alpha = -Pi / 2.0 fets_eval = FETS1D5t2L4ULRH(mats_eval=mats_eval, alpha=alpha) print "T_mtx", fets_eval.T_mtx def geo(points): T = np.array([[math.cos(alpha), math.sin(alpha)], [-math.sin(alpha), math.cos(alpha)]], dtype="f") return np.dot(points, T) domain = FEGrid(coord_max=(1.0, 0.2), shape=(1, 1), geo_transform=geo, 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 = [1], # slice = domain[ 0, :, 0, :]), BCSlice(var="u", value=0.0, dims=[0, 1], slice=domain[:, 0, :, 0]), BCSlice(var="u", value=f_max, dims=[0], slice=domain[:, -1, :, -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", warp=True, var="u", 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 "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()
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()
from ibvpy.mats.mats2D.mats2D_cmdm.mats2D_cmdm import \ MATS2DMicroplaneDamage from ibvpy.mats.matsXD.matsXD_cmdm import \ PhiFnStrainHardeningLinear, PhiFnStrainSoftening, \ PhiFnStrainHardening # from ibvpy.mats.mats2D5.mats2D5_cmdm.mats2D5_cmdm import \ # MATS2D5MicroplaneDamage # # from ibvpy.mats.mats3D.mats3D_elastic.mats3D_elastic import \ # MATS3DElastic # # from ibvpy.mats.matsXD.matsXD_cmdm.matsXD_cmdm_phi_fn import \ # PhiFnStrainHardeningLinear # # phi_fn = PhiFnStrainHardeningLinear(alpha=0.5, beta=0.7) # explorer = MATSExplore( # dim=MATS3DExplore(mats_eval=MATS3DElastic(E=30000., nu=0.2))) # phi_fn = PhiFnStrainHardeningLinear(alpha=0.5, beta=0.7) # phi_fn = PhiFnStrainHardening(Epp=1e-4, Efp=2e-4, Dfp=0.1, Elimit=8e-2) phi_fn = PhiFnStrainSoftening(Epp=1e-4, Efp=2e-4, h=1.0) mats_eval = MATS2DMicroplaneDamage(nu=0.3, n_mp=30, phi_fn=phi_fn) explorer = MATSExplore(dim=MATS2DExplore(mats_eval=mats_eval), n_steps=10) from ibvpy.plugins.ibvpy_app import IBVPyApp ibvpy_app = IBVPyApp(ibv_resource=explorer) ibvpy_app.main()
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()
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 = [ # 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 = '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()
def get_sig_norm(self, sctx, eps_app_eng): sig_eng, D_mtx = self.get_corr_pred(sctx, eps_app_eng, 0, 0, 0) return array([scalar_sqrt(sig_eng[0]**2 + sig_eng[1]**2)]) # Declare and fill-in the rte_dict - it is used by the clients to # assemble all the available time-steppers. # rte_dict = Trait(Dict) def _rte_dict_default(self): return { 'sig_app': self.get_sig_app, 'eps_app': self.get_eps_app, 'sig_norm': self.get_sig_norm, 'strain_energy': self.get_strain_energy } if __name__ == '__main__': #------------------------------------------------------------------------- # Example using the mats2d_explore #------------------------------------------------------------------------- from ibvpy.mats.mats_explore import MATSExplore, MATS2DExplore mats_eval = MATS2DConduction() mats_explore = MATSExplore(dim=MATS2DExplore(mats_eval=mats_eval)) mats_explore.tloop.eval() # mme.configure_traits( view = 'traits_view_begehung' ) from ibvpy.plugins.ibvpy_app import IBVPyApp ibvpy_app = IBVPyApp(ibv_resource=mats_explore) ibvpy_app.main()
def run(): #------------------------------------------------------------------------- # Example using the mats2d_explore #------------------------------------------------------------------------- from ibvpy.mats.mats2D.mats2D_explore import MATS2DExplore from ibvpy.mats.mats2D.mats2D_rtrace_cylinder import MATS2DRTraceCylinder from ibvpy.mats.mats2D.mats2D_cmdm.mats2D_cmdm_rtrace_Gf_mic import \ MATS2DMicroplaneDamageTraceGfmic, \ MATS2DMicroplaneDamageTraceEtmic, MATS2DMicroplaneDamageTraceUtmic from ibvpy.mats.mats2D.mats2D_cmdm.mats2D_cmdm_rtrace_Gf_mac import \ MATS2DMicroplaneDamageTraceGfmac, \ MATS2DMicroplaneDamageTraceEtmac, MATS2DMicroplaneDamageTraceUtmac from ibvpy.mats.mats2D.mats2D_cmdm.mats2D_cmdm import \ MATS2DMicroplaneDamage, MATS1DMicroplaneDamage from ibvpy.mats.matsXD.matsXD_cmdm import \ PhiFnGeneral, PhiFnStrainHardening from ibvpy.api import RTraceGraph, RTraceArraySnapshot from mathkit.mfn import MFnLineArray from numpy import array, hstack from ibvpy.mats.mats2D.mats2D_explorer_bcond import BCDofProportional from os.path import join ec = { # overload the default configuration 'bcond_list': [BCDofProportional(max_strain=1.0, alpha_rad=0.0)], 'rtrace_list': [ RTraceGraph(name='stress - strain', var_x='eps_app', idx_x=0, var_y='sig_app', idx_y=0, record_on='iteration'), ], } mats_eval = MATS2DMicroplaneDamage( n_mp=15, # mats_eval = MATS1DMicroplaneDamage( elastic_debug=False, stress_state='plane_stress', symmetrization='sum-type', model_version='compliance', phi_fn=PhiFnGeneral, ) # print 'normals', mats_eval._MPN # print 'weights', mats_eval._MPW fitter = MATSCalibDamageFn( KMAX=300, tolerance=5e-4, # 0.01, RESETMAX=0, dim=MATS2DExplore( mats_eval=mats_eval, explorer_config=ec, ), store_fitted_phi_fn=True, log=False) #------------------------------------------- # run fitter for entire available test data: #------------------------------------------- calibrate_all = False if calibrate_all: from matresdev.db.exdb.ex_run_table import \ ExRunClassExt # from matresdev.db.exdb.ex_composite_tensile_test import \ # ExCompositeTensileTest # ex = ExRunClassExt(klass=ExCompositeTensileTest) # for ex_run in ex.ex_run_list: # if ex_run.ready_for_calibration: # print 'FITTING', ex_run.ex_type.key # # 'E_c' of each test is different, therefore 'mats_eval' # # needs to be defined for each test separately. # # # E_c = ex_run.ex_type.E_c # nu = ex_run.ex_type.ccs.concrete_mixture_ref.nu # # # run calibration # # # fitter.ex_run = ex_run # fitter.dim.mats_eval.E = E_c # fitter.dim.mats_eval.nu = nu # fitter.init() # fitter.fit_response() else: test_file = join( simdb.exdata_dir, 'tensile_tests', 'dog_bone', # 'buttstrap_clamping', '2010-02-09_TT-10g-3cm-a-TR_TRC11', # 'TT11-10a-average.DAT' ) 'TT-10g-3cm-a-TR-average.DAT') #----------------------------------- # tests for 'BT-3PT-12c-6cm-TU_ZiE' #----------------------------------- # 'ZiE-S1': test series no. 1 (age = 11d) # # '2011-05-23_TT-12c-6cm-0-TU_ZiE', # 'TT-12c-6cm-0-TU-V2.DAT') # 'ZiE-S2': test series no. 2 (age = 9d) # # '2011-06-10_TT-12c-6cm-0-TU_ZiE', # 'TT-12c-6cm-0-TU-V2.DAT') #----------------------------------- # tests for 'BT-4PT-12c-6cm-TU_SH4' # tests for 'ST-12c-6cm-TU' (fresh) #----------------------------------- # @todo: add missing front strain information from Aramis3d testing # # '2012-04-12_TT-12c-6cm-0-TU_SH4-Aramis3d', # 'TT-12c-6cm-0-TU-SH4-V2.DAT') # '2012-02-14_TT-12c-6cm-0-TU_SH2', # 'TT-12c-6cm-0-TU-SH2-V2.DAT') # '2012-02-14_TT-12c-6cm-0-TU_SH2', # 'TT-12c-6cm-0-TU-SH2F-V3.DAT') # used for suco(!) # '2012-02-14_TT-12c-6cm-0-TU_SH2', # 'TT-12c-6cm-0-TU-SH2-V1.DAT') #----------------------------------- # tests for 'BT-3PT-6c-2cm-TU_bs' #----------------------------------- # barrelshell # # # TT-bs1 # '2013-05-17_TT-6c-2cm-0-TU_bs1', # 'TT-6c-2cm-0-TU-V3_bs1.DAT') # # TT-bs2 # '2013-05-21-TT-6c-2cm-0-TU_bs2', # 'TT-6c-2cm-0-TU-V1_bs2.DAT') # # TT-bs3 # '2013-06-12_TT-6c-2cm-0-TU_bs3', # 'TT-6c-2cm-0-TU-V1_bs3.DAT') # # TTb-bs4-Aramis3d # '2013-07-09_TTb-6c-2cm-0-TU_bs4-Aramis3d', # 'TTb-6c-2cm-0-TU-V2_bs4.DAT') #----------------------------------- # tests for 'TT-6c-2cm-90-TU' #----------------------------------- # # '2013-05-22_TTb-6c-2cm-90-TU-V3_bs1', # 'TTb-6c-2cm-90-TU-V3_bs1.DAT') # '2013-05-17_TT-6c-2cm-0-TU_bs1', # 'TT-6c-2cm-90-TU-V3_bs1.DAT') # test_file = join(simdb.exdata_dir, # 'tensile_tests', # 'buttstrap_clamping', # '2013-07-18_TTb-6c-2cm-0-TU_bs5', # 'TTb-6c-2cm-0-TU-V1_bs5.DAT') # # 'TTb-6c-2cm-0-TU-V3_bs5.DAT') # # test_file = join(simdb.exdata_dir, # 'tensile_tests', # 'buttstrap_clamping', # '2013-07-09_TTb-6c-2cm-0-TU_bs4-Aramis3d', # 'TTb-6c-2cm-0-TU-V2_bs4.DAT') #----------------------------------- # tests for 'TT-6g-2cm-0-TU' (ARG-1200-TU) #----------------------------------- # # test series no.1 # # test_file = join(simdb.exdata_dir, # 'tensile_tests', # 'dog_bone', # '2012-12-10_TT-6g-2cm-0-TU_bs', # 'TT-6g-2cm-0-V2.DAT') # test series no.3 # # test_file = join(simdb.exdata_dir, # 'tensile_tests', # 'buttstrap_clamping', # '2013-07-09_TTb-6g-2cm-0-TU_bs4-Aramis3d', # 'TTb-6g-2cm-0-TU-V1_bs4.DAT') # test series NxM_1 # # test_file = join(simdb.exdata_dir, # 'tensile_tests', # 'buttstrap_clamping', # '2014-04-30_TTb-6c-2cm-0-TU_NxM1', # 'TTb-6c-2cm-0-TU-V16_NxM1.DAT') #------------------------------------------------------------------ # set 'ex_run' of 'fitter' to selected calibration test #------------------------------------------------------------------ # ex_run = ExRun(data_file=test_file) fitter.ex_run = ex_run #------------------------------------------------------------------ # specify the parameters used within the calibration #------------------------------------------------------------------ # # get the composite E-modulus and Poisson's ratio as stored # in the experiment data base for the specified age of the tensile test # E_c = ex_run.ex_type.E_c print('E_c', E_c) # # use the value as graphically determined from the tensile test (= initial stiffness for tension) # E_c = 28000. # age, Em(age), and nu of the slab test or bending test determines the # calibration parameters. Those are used for calibration and are store in the 'param_key' # appendet to the calibration-test-key # age = 28 # E-modulus of the concrete matrix at the age of testing # NOTE: value is more relevant as compression behavior is determined by it in the bending tests and slab tests; # behavior in the tensile zone is defined by calibrated 'phi_fn' with the predefined 'E_m' # E_m = ex_run.ex_type.ccs.get_E_m_time(age) E_c = ex_run.ex_type.ccs.get_E_c_time(age) # use average E-modul from 0- and 90-degree direction for fitter in both directions # this yields the correct tensile behavior and returns the best average compressive behavior # # E_c = 22313.4 # alternatively use maximum E-modul from 90-direction also for 0-degree direction for fitting # this yields the correct tensile behavior also in the linear elastic regime for both directions corresponding to the # tensile test behavior (note that the compressive E-Modulus in this case is overestimated in 0-degree direction; minor influence # assumed as behavior is governed by inelastic tensile behavior and anisotropic redistrirbution; # # E_c = 29940.2 # E_c = 29100. # E_c = 22390.4 # E_c = 18709.5 E_c = 28700. # smallest value for matrix E-modulus obtained from cylinder tests (d=150mm) # E_m = 18709.5 # set 'nu' # @todo: check values stored in 'mat_db' # nu = 0.20 ex_run.ex_type.ccs.concrete_mixture_ref.nu = nu n_steps = 200 fitter.n_steps = n_steps fitter.format_ticks = True fitter.ex_run.ex_type.age = age print('age = %g used for calibration' % age) fitter.ex_run = ex_run # print 'E_m(age) = %g used for calibration' % E_m # fitter.dim.mats_eval.E = E_m print('E_c(age) = %g used for calibration' % E_c) fitter.dim.mats_eval.E = E_c print('nu = %g used for calibration' % nu) fitter.dim.mats_eval.nu = nu print('n_steps = %g used for calibration' % n_steps) max_eps = fitter.max_eps print('max_eps = %g used for calibration' % max_eps) #------------------------------------------------------------------ # set 'param_key' of 'fitter' to store calibration params in the name #------------------------------------------------------------------ # # param_key = '_age%g_Em%g_nu%g_nsteps%g' % (age, E_m, nu, n_steps) # param_key = '_age%g_Ec%g_nu%g_nsteps%g__smoothed' % (age, E_c, nu, n_steps, max_eps) param_key = '_age%g_Ec%g_nu%g_nsteps%g_smoothed' % (age, E_c, nu, n_steps) fitter.param_key = param_key print('param_key = %s used in calibration name' % param_key) #------------------------------------------------------------------ # run fitting procedure #------------------------------------------------------------------ # import pylab as p ax = p.subplot(111) fitter.mfn_line_array_target.mpl_plot(ax) p.show() fitter.init() fitter.fit_response() fitter.store() fitter.plot_trial_steps() return #--------------------------- # basic testing of fitter methods: #--------------------------- # set to True for basic testing of the methods: basic_tests = False if basic_tests: fitter.run_through() # fitter.tloop.rtrace_mngr.rtrace_bound_list[0].configure_traits() fitter.tloop.rtrace_mngr.rtrace_bound_list[0].redraw() last_strain_run_through = fitter.tloop.rtrace_mngr.rtrace_bound_list[ 0].trace.xdata[:] last_stress_run_through = fitter.tloop.rtrace_mngr.rtrace_bound_list[ 0].trace.ydata[:] print('last strain (run-through) value', last_strain_run_through) print('last stress (run-through) value', last_stress_run_through) fitter.tloop.reset() fitter.run_step_by_step() # fitter.tloop.rtrace_mngr.rtrace_bound_list[0].configure_traits() fitter.tloop.rtrace_mngr.rtrace_bound_list[0].redraw() last_strain_step_by_step = fitter.tloop.rtrace_mngr.rtrace_bound_list[ 0].trace.xdata[:] last_stress_step_by_step = fitter.tloop.rtrace_mngr.rtrace_bound_list[ 0].trace.ydata[:] print('last stress (step-by-step) value', last_stress_step_by_step) fitter.run_trial_step() fitter.run_trial_step() fitter.tloop.rtrace_mngr.rtrace_bound_list[0].redraw() strain_after_trial_steps = fitter.tloop.rtrace_mngr.rtrace_bound_list[ 0].trace.xdata[:] stress_after_trial_steps = fitter.tloop.rtrace_mngr.rtrace_bound_list[ 0].trace.ydata[:] print('stress after trial', stress_after_trial_steps) fitter.init() # fitter.mats2D_eval.configure_traits() lof = fitter.get_lack_of_fit(1.0) print('1', lof) lof = fitter.get_lack_of_fit(0.9) print('2', lof) # fitter.tloop.rtrace_mngr.configure_traits() fitter.run_trial_step() else: from ibvpy.plugins.ibvpy_app import IBVPyApp ibvpy_app = IBVPyApp(ibv_resource=fitter) ibvpy_app.main()
# x,y = - r * cos( phi ), r * sin( phi ) # return c_[ x,y ] # #fe_domain_arch_2d = FEGrid( geo_r = [[-1,-1 ], # [-1, 1 ], # [ 1,-1 ], # [ 1, 1 ]], # dof_r = [[-1,-1 ], # [-1, 1 ], # [ 1,-1 ], # [ 1, 1 ]], # shape = ( 10, 3 ), # geo_transform = arch_2d ) if __name__ == '__main__': from ibvpy.fets.fets_eval import FETSEval fets_eval = FETSEval(geo_r=[[-1, -1, -1], [-1, -1, 1], [-1, 1, -1], [-1, 1, 1], [1, -1, -1], [1, -1, 1], [1, 1, -1], [1, 1, 1]], dof_r=[[-1, 0, 0], [1, 0, 0], [0, 0, -1], [0, 0, 1], [0, -1, 0], [0, 1, 0]]) fe_domain_arch_3d = FEGrid(fets_eval=fets_eval, coord_max=(10., 1, 10.), shape=(10, 3, 10), geo_transform=arch_3d) from ibvpy.plugins.ibvpy_app import IBVPyApp ibvpy_app = IBVPyApp(ibv_resource=fe_domain_arch_3d) ibvpy_app.main()
def example_2d(): from ibvpy.api import FEDomain, FERefinementGrid, FEGrid, TStepper as TS, \ BCDofGroup, RTraceDomainListField from ibvpy.core.tloop import TLoop, TLine from ibvpy.mesh.xfe_subdomain import XFESubDomain from ibvpy.mats.mats2D.mats2D_elastic.mats2D_elastic import MATS2DElastic from ibvpy.mats.mats2D import MATS2DPlastic from ibvpy.fets.fets2D.fets2D4q import FETS2D4Q from ibvpy.fets.fets2D import FETS2D9Q from ibvpy.fets.fets2D.fets2D4q8u import FETS2D4Q8U from ibvpy.fets.fets_ls.fets_crack import FETSCrack #fets_eval = FETS2D4Q( mats_eval = MATS2DPlastic( E = 1., nu = 0. ) ) fets_eval = FETS2D4Q8U(mats_eval=MATS2DPlastic(E=1., nu=0.)) xfets_eval = FETSCrack(parent_fets=fets_eval, int_order=5, tri_subdivision=1) # Discretization fe_domain = FEDomain() fe_level1 = FERefinementGrid(domain=fe_domain, fets_eval=fets_eval) fe_grid1 = FEGrid(coord_max=(1., 1.), shape=(8, 8), fets_eval=fets_eval, level=fe_level1) #ls_function = lambda X, Y: X - Y - 0.13 ls_function = lambda X, Y: (X - 0.52)**2 + (Y - 0.72)**2 - 0.51**2 bls_function = lambda X, Y: -((X - 0.5)**2 + (Y - 0.21)**2 - 0.28**2) bls_function2 = lambda X, Y: -((X - 0.5)**2 + (Y - 0.21)**2 - 0.38**2) # design deficits: # - How to define a level set spanned over several fe_grids # (i.e. it is defined over the hierarchy of FESubDomains) # - Patching of subdomains within the FEPatchedGrid (FERefinementGrid) # - What are the compatibility conditions? # - What is the difference between FEGridLeveSetSlice # and FELSDomain? # FELSDomain is associated with a DOTS - Slice is not. # FEGrid has a multidimensional array - elem_grid # it can be accessed through this index. # it is masked by the activity map. The activity map can # be defined using slices and level sets. # the elems array enumerates the elements using the activity map. # in this way, the specialization of grids is available implicitly. # fe_xdomain = FELSDomain( domain=fe_domain, fets_eval=xfets_eval, fe_grid=fe_grid1, ls_function=ls_function, bls_function=bls_function, ) fe_tip_xdomain = FELSDomain( domain=fe_domain, fets_eval=xfets_eval, fe_grid=fe_xdomain, ls_function=bls_function, ) # deactivation must be done only after the dof enumeration has been completed fe_xdomain.deactivate_intg_elems_in_parent() fe_tip_xdomain.deactivate_intg_elems_in_parent() fe_xdomain.bls_function = bls_function2 fe_tip_xdomain.ls_function = bls_function2 # deactivation must be done only after the dof enumeration has been completed fe_xdomain.deactivate_intg_elems_in_parent() fe_tip_xdomain.deactivate_intg_elems_in_parent() # # General procedure: # 1) define the level sets with the boundaries # 2) use the bls to identify the tips of the level set # 3) use independent level sets to introduce indpendently junctions. # # get the extended dofs of the bls_elems and constrain it # cdofs = fe_tip_xdomain.elem_xdof_map.flatten() bc_list = [BCDof(var='u', dof=dof, value=0.0) for dof in cdofs] # construct the time stepper ts = TS( dof_resultants=True, sdomain=fe_domain, bcond_list=[ BCSlice( var='u', value=-0.1, dims=[1], slice=fe_grid1[:, 0, :, 0]), BCSlice( var='u', value=0., dims=[0], slice=fe_grid1[:, 0, :, 0]), BCSlice(var='u', value=0., dims=[0, 1], slice=fe_grid1[:, -1, :, -1]) ] + bc_list, 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), RTraceDomainListField(name='Displacement', var='u', idx=0, warp=True), # RTraceDomainField(name = 'N0' , # var = 'N_mtx', idx = 0, # record_on = 'update') ]) # do = 'print' if do == 'print': p = 'state' if p == 'grids': print('fe_xdomain.ls mask') print(fe_xdomain.ls_mask) print('fe_xdomain.idx mask') print(fe_xdomain.idx_mask) print('fe_xdomain.intg mask') print(fe_xdomain.intg_mask) print('fe_xdomain.xelems_mask') print(fe_xdomain.xelems_mask) print('fe_xdomain.xelems_grid_ix') print(fe_xdomain.xelems_grid_ix) print('fe_xdomain.ls_elem_grid') print(fe_xdomain.ls_elem_grid) print('fe_xdomain.ls_ielem_grid') print(fe_xdomain.ls_ielem_grid) print('fe_xdomain.intg_elem_grid') print(fe_xdomain.intg_elem_grid) print('fe_tip_xdomain.ls_mask`') print(fe_tip_xdomain.ls_mask) print('fe_tip_xdomain.intg_mask`') print(fe_tip_xdomain.intg_mask) print('fe_tip_xdomain.idx_mask`') print(fe_tip_xdomain.idx_mask) print('fe_tip_xdomain.xelems_mask') print(fe_tip_xdomain.xelems_mask) print('fe_tip_xdomain.xelems_grid_ix') print(fe_tip_xdomain.xelems_grid_ix) print('fe_tip_xdomain.ls_elem_grid') print(fe_tip_xdomain.ls_elem_grid) print('fe_tip_xdomain.ls_ielems_grid') print(fe_tip_xdomain.ls_ielem_grid) print('fe_tip_xdomain.intg_elem_grid') print(fe_tip_xdomain.intg_elem_grid) if p == 'maps': print('fe_xdomain.elem_dof_map') print(fe_xdomain.elem_dof_map) print('fe_tip_xdomain.elem_dof_map') print(fe_tip_xdomain.elem_dof_map) print('fe_xdomain.elems') print(fe_xdomain.elems) print('fe_tip_xdomain.elems') print(fe_tip_xdomain.elems) print('fe_xdomain.elem_X_map') print(fe_xdomain.elem_X_map) print('fe_tip_xdomain.elem_X_map') print(fe_tip_xdomain.elem_X_map) if p == 'fields': print("ls_values ", fe_xdomain.dots.dof_node_ls_values) print("tip ls_values ", fe_tip_xdomain.dots.dof_node_ls_values) print('intersection points ', fe_xdomain.ls_intersection_r) print('tip intersection points ', fe_tip_xdomain.ls_intersection_r) print("triangles ", fe_xdomain.dots.rt_triangles) print("vtk points ", fe_xdomain.dots.vtk_X) print("vtk data ", fe_xdomain.dots.get_vtk_cell_data('blabla', 0, 0)) print('ip_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_ls', fe_xdomain.dots.vtk_ls_values) print('J_det ', fe_xdomain.dots.J_det_grid) if p == 'state': # Add the time-loop control print('STATE: initial') print('fe_xdomain.dots.state_elem grid') print(fe_xdomain.dots.state_start_elem_grid) print('fe_tip_xdomain.dots.state_elem grid') print(fe_tip_xdomain.dots.state_start_elem_grid) print('fe_xdomain.dots.state_end_elem grid') print(fe_xdomain.dots.state_end_elem_grid) print('fe_tip_xdomain.dots.state_end_elem grid') print(fe_tip_xdomain.dots.state_end_elem_grid) fe_xdomain.dots.state_array[:] = 25.5 print('state_array 25', fe_xdomain.dots.state_array) fe_tip_xdomain.dots.state_array[:] = 58 bls_function3 = lambda X, Y: -((X - 0.5)**2 + (Y - 0.21)**2 - 0.58**2) fe_xdomain.bls_function = bls_function3 fe_tip_xdomain.ls_function = bls_function3 print('STATE: changed') print('fe_xdomain.dots.state_elem grid') print(fe_xdomain.dots.state_start_elem_grid) print('fe_tip_xdomain.dots.state_elem grid') print(fe_tip_xdomain.dots.state_start_elem_grid) print('fe_xdomain.dots.state_end_elem grid') print(fe_xdomain.dots.state_end_elem_grid) print('fe_tip_xdomain.dots.state_end_elem grid') print(fe_tip_xdomain.dots.state_end_elem_grid) print('state_array 25', fe_xdomain.dots.state_array.shape) print('state_array 25', fe_xdomain.dots.state_array[570:]) print('state_array 58', fe_tip_xdomain.dots.state_array.shape) elif do == 'ui': tloop = TLoop(tstepper=ts, debug=False, tolerance=1e-4, KMAX=3, RESETMAX=0, tline=TLine(min=0.0, step=1, max=1.0)) tloop.eval() from ibvpy.plugins.ibvpy_app import IBVPyApp ibvpy_app = IBVPyApp(ibv_resource=ts) ibvpy_app.main()
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()
def example_with_new_domain(): from ibvpy.api import \ TStepper as TS, RTraceDomainListField, TLoop, \ TLine, BCSlice from ibvpy.fets.fets2D.fets2D4q8u import FETS2D4Q8U from ibvpy.tmodel.mats3D.mats3D_cmdm import \ MATS3DMicroplaneDamage from ibvpy.tmodel.matsXD.matsXD_cmdm import PhiFnStrainSoftening # tmodel = MATS2DElastic(E=2,nu= .2, # stress_state= 'rotational_symetry') mats = MATS3DMicroplaneDamage(model_version='stiffness', E=34e3, nu=0.2, phi_fn=PhiFnStrainSoftening(G_f=0.001117, f_t=2.8968)) fets_eval = FETS2Drotsym(prototype_fets=FETS2D4Q8U(), mats_eval=mats) fets_eval.vtk_r *= 0.9 from ibvpy.mesh.fe_grid import FEGrid radius = sqrt(1. / pi) # f_i = (radius/2.)*2*pi # f_o = (radius)*2*pi # print 'f ',f_i,' ', f_o # Discretization fe_grid = FEGrid( # coord_min = (0.,radius/2.,0.), coord_max=(1., radius, 0.), shape=(20, 20), fets_eval=fets_eval) tstepper = TS(sdomain=fe_grid, bcond_list=[ BCSlice(var='u', value=0., dims=[0], slice=fe_grid[0, :, 0, :]), BCSlice(var='u', value=0., dims=[1], slice=fe_grid[0, 0, 0, 0]), BCSlice(var='u', value=1.e-3, dims=[0], slice=fe_grid[-1, :, -1, :]), ], rtrace_list=[ RTraceDomainListField(name='Stress', var='sig_app', idx=0, warp=True, record_on='update'), RTraceDomainListField(name='fracture_energy', var='fracture_energy', idx=0, warp=True, record_on='update'), RTraceDomainListField(name='Displacement', var='u', 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()
def __demo__(): from ibvpy.api import \ TStepper as TS, RTraceDomainListField, TLoop, \ TLine, BCSlice, FEDomain, FERefinementGrid, FEGrid from ibvpy.mats.mats2D.mats2D_elastic.mats2D_elastic import MATS2DElastic fets_eval = FETS2D4Q8U(mats_eval=MATS2DElastic()) fe_domain = FEDomain() r1 = FERefinementGrid(fets_eval=fets_eval, domain=fe_domain) r2 = FERefinementGrid(fets_eval=fets_eval, domain=fe_domain) # Discretization domain1 = FEGrid(coord_max=(3., 3.), shape=(10, 4), fets_eval=fets_eval, level=r1) domain2 = FEGrid(coord_min=(3., 0.), coord_max=(6., 3), shape=(10, 4), fets_eval=fets_eval, level=r2) ts = TS( dof_resultants=True, sdomain=[domain1, domain2], # fe_domain, bcond_list=[ # Fix the left edge of domain1 BCSlice(var='u', dims=[0, 1], value=0, slice=domain1[0, :, 0, :]), # Link the right edge of domain1 with the left edge of domain2 # # note that following arrays must have the same lengths: # slice and link_slice # dims, link_dims and link_coeffs must have the same lengths # VAR-1: # linking along the complete line between 'domain1' and 'domain2' # all nodes along the y-axis # (used linking of more nodes at once in 'BCSlice') # BCSlice(var='u', dims=[0, 1], value=0.0, slice=domain1[-1, :, -1, :], link_slice=domain2[0, :, 0, :], link_dims=[0, 1], link_coeffs=[1., 1.]), # VAR-2: # linking along individual points between 'domain1' and 'domain2' # (used linking of single nodes in 'BCSlice') # # BCSlice(var='u', dims=[0, 1], value=0.0, # slice=domain1[-1, -1, -1, -1], # link_slice=domain2[0, -1, 0, -1], # link_dims=[0, 1], # link_coeffs=[1., 1.]), # BCSlice(var='u', dims=[0, 1], value=0.0, # slice=domain1[-1, 0, -1, 0], # link_slice=domain2[0, 0, 0, 0], # link_dims=[0, 1], # link_coeffs=[1., 1.]), # Load the right edge of domain2 BCSlice(var='f', dims=[0], value=1, slice=domain2[-1, :, -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=False, tline=TLine(min=0.0, step=1.0, max=1.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()
def app(): avg_radius = 30 thickness = 50.0 # mm md = MATS2DScalarDamage(E=30.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_stress", stiffness="secant", # stiffness = "algorithmic", strain_norm=Rankine()) mdm = MATS2DMicroplaneDamage(E=30.0e3, nu=0.2, # epsilon_f = 12.0e-4, #test doubling the e_f # 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() stress_state="plane_strain", model_version='compliance', phi_fn=PhiFnStrainSoftening( G_f=0.124, f_t=3.3, md=0.0, h=12.5)) fets_eval = FETS2D4Q(mats_eval=mdm) # , ngp_r = 3, ngp_s = 3) fe_domain = FEDomain() fe_rgrid = FERefinementGrid(name='fe_grid1', fets_eval=fets_eval, domain=fe_domain) n_half = 30 n_el_x = n_half * 2 + 1 n_el_y = n_el_x / 10 # Discretization fe_grid = FEGrid(coord_max=(2000.0, 200.0, 0.), shape=(n_el_x, n_el_y), fets_eval=fets_eval, level=fe_rgrid) for i in range(0, n_el_y / 2): fe_grid.deactivate((n_half, i)) mf = MFnLineArray(xdata=array([0, 1]), ydata=array([0, 1])) # 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] loading_dofs = fe_grid[n_el_x / 2, -1, (0, -1), -1].dofs.flatten() 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), -1], dims=[1], time_function=mf.get_value, value= -0.5), ], rtrace_list=[RTraceGraph(name='Fi,right over u_right (iteration)' , var_y='F_int', idx_y_arr=loading_dofs, var_x='U_k', idx_x=loading_dof, transform_x='-x', transform_y='-y*%g' % thickness, 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=0.2)) tl.setup() # print avg_processor.C_mtx 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()
# xmax = sim_model.damage_function.xdata[-1] print 'xmax', xmax x = linspace(0, 3 * xmax, 1000) phi_fn = frompyfunc(phi_fn, 1, 1) y = phi_fn(x) p.plot(x, y, color='grey', linewidth=2) p.show() #------------------------------ # ui #------------------------------ if do == 'ui': from ibvpy.plugins.ibvpy_app import IBVPyApp app = IBVPyApp(ibv_resource=sim_model) # sim_model.tloop.eval() app.main() #------------------------------ # validation #------------------------------ if do == 'validation': from ibvpy.plugins.ibvpy_app import IBVPyApp app = IBVPyApp(ibv_resource=sim_model) from matresdev.db.exdb.ex_run import ExRun import pylab as p pickle_path = join(simdb.simdata_dir, 'pickle_files') png_path = join(simdb.simdata_dir, 'png_files')
def example_2d(): from ibvpy.api import FEDomain, FERefinementGrid, FEGrid, TStepper as TS, \ BCDofGroup, RTraceDomainListField from ibvpy.core.tloop import TLoop, TLine from ibvpy.mesh.xfe_subdomain import XFESubDomain from ibvpy.mats.mats2D.mats2D_elastic.mats2D_elastic import MATS2DElastic from ibvpy.mats.mats2D import MATS2DPlastic from ibvpy.fets.fets2D.fets2D4q import FETS2D4Q from ibvpy.fets.fets2D import FETS2D9Q from ibvpy.fets.fets2D.fets2D4q8u import FETS2D4Q8U from ibvpy.fets.fets_ls.fets_crack import FETSCrack #fets_eval = FETS2D4Q( mats_eval = MATS2DPlastic( E = 1., nu = 0. ) ) fets_eval = FETS2D4Q8U( mats_eval = MATS2DPlastic( E = 1., nu = 0. ) ) xfets_eval = FETSCrack( parent_fets = fets_eval, int_order = 5, tri_subdivision = 1 ) # Discretization fe_domain = FEDomain() fe_level1 = FERefinementGrid( domain = fe_domain, fets_eval = fets_eval ) fe_grid1 = FEGrid( coord_max = ( 1., 1. ), shape = ( 8, 8 ), fets_eval = fets_eval, level = fe_level1 ) #ls_function = lambda X, Y: X - Y - 0.13 ls_function = lambda X, Y: ( X - 0.52 ) ** 2 + ( Y - 0.72 ) ** 2 - 0.51 ** 2 bls_function = lambda X, Y:-( ( X - 0.5 ) ** 2 + ( Y - 0.21 ) ** 2 - 0.28 ** 2 ) bls_function2 = lambda X, Y:-( ( X - 0.5 ) ** 2 + ( Y - 0.21 ) ** 2 - 0.38 ** 2 ) # design deficits: # - How to define a level set spanned over several fe_grids # (i.e. it is defined over the hierarchy of FESubDomains) # - Patching of subdomains within the FEPatchedGrid (FERefinementGrid) # - What are the compatibility conditions? # - What is the difference between FEGridLeveSetSlice # and FELSDomain? # FELSDomain is associated with a DOTS - Slice is not. # FEGrid has a multidimensional array - elem_grid # it can be accessed through this index. # it is masked by the activity map. The activity map can # be defined using slices and level sets. # the elems array enumerates the elements using the activity map. # in this way, the specialization of grids is available implicitly. # fe_xdomain = FELSDomain( domain = fe_domain, fets_eval = xfets_eval, fe_grid = fe_grid1, ls_function = ls_function, bls_function = bls_function, ) fe_tip_xdomain = FELSDomain( domain = fe_domain, fets_eval = xfets_eval, fe_grid = fe_xdomain, ls_function = bls_function, ) # deactivation must be done only after the dof enumeration has been completed fe_xdomain.deactivate_intg_elems_in_parent() fe_tip_xdomain.deactivate_intg_elems_in_parent() fe_xdomain.bls_function = bls_function2 fe_tip_xdomain.ls_function = bls_function2 # deactivation must be done only after the dof enumeration has been completed fe_xdomain.deactivate_intg_elems_in_parent() fe_tip_xdomain.deactivate_intg_elems_in_parent() # # General procedure: # 1) define the level sets with the boundaries # 2) use the bls to identify the tips of the level set # 3) use independent level sets to introduce indpendently junctions. # # get the extended dofs of the bls_elems and constrain it # cdofs = fe_tip_xdomain.elem_xdof_map.flatten() bc_list = [ BCDof( var = 'u', dof = dof, value = 0.0 ) for dof in cdofs ] # construct the time stepper ts = TS( dof_resultants = True, sdomain = fe_domain, bcond_list = [BCSlice( var = 'u', value = -0.1, dims = [1], slice = fe_grid1[:, 0, :, 0] ), BCSlice( var = 'u', value = 0., dims = [0], slice = fe_grid1[:, 0, :, 0] ), BCSlice( var = 'u', value = 0., dims = [0, 1], slice = fe_grid1[:, -1, :, -1] ) ] + bc_list, 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 ), RTraceDomainListField( name = 'Displacement' , var = 'u', idx = 0, warp = True ), # RTraceDomainField(name = 'N0' , # var = 'N_mtx', idx = 0, # record_on = 'update') ] ) # do = 'print' if do == 'print': p = 'state' if p == 'grids': print 'fe_xdomain.ls mask' print fe_xdomain.ls_mask print 'fe_xdomain.idx mask' print fe_xdomain.idx_mask print 'fe_xdomain.intg mask' print fe_xdomain.intg_mask print 'fe_xdomain.xelems_mask' print fe_xdomain.xelems_mask print 'fe_xdomain.xelems_grid_ix' print fe_xdomain.xelems_grid_ix print 'fe_xdomain.ls_elem_grid' print fe_xdomain.ls_elem_grid print 'fe_xdomain.ls_ielem_grid' print fe_xdomain.ls_ielem_grid print 'fe_xdomain.intg_elem_grid' print fe_xdomain.intg_elem_grid print 'fe_tip_xdomain.ls_mask`' print fe_tip_xdomain.ls_mask print 'fe_tip_xdomain.intg_mask`' print fe_tip_xdomain.intg_mask print 'fe_tip_xdomain.idx_mask`' print fe_tip_xdomain.idx_mask print 'fe_tip_xdomain.xelems_mask' print fe_tip_xdomain.xelems_mask print 'fe_tip_xdomain.xelems_grid_ix' print fe_tip_xdomain.xelems_grid_ix print 'fe_tip_xdomain.ls_elem_grid' print fe_tip_xdomain.ls_elem_grid print 'fe_tip_xdomain.ls_ielems_grid' print fe_tip_xdomain.ls_ielem_grid print 'fe_tip_xdomain.intg_elem_grid' print fe_tip_xdomain.intg_elem_grid if p == 'maps': print 'fe_xdomain.elem_dof_map' print fe_xdomain.elem_dof_map print 'fe_tip_xdomain.elem_dof_map' print fe_tip_xdomain.elem_dof_map print 'fe_xdomain.elems' print fe_xdomain.elems print 'fe_tip_xdomain.elems' print fe_tip_xdomain.elems print 'fe_xdomain.elem_X_map' print fe_xdomain.elem_X_map print 'fe_tip_xdomain.elem_X_map' print fe_tip_xdomain.elem_X_map if p == 'fields': print "ls_values ", fe_xdomain.dots.dof_node_ls_values print "tip ls_values ", fe_tip_xdomain.dots.dof_node_ls_values print 'intersection points ', fe_xdomain.ls_intersection_r print 'tip intersection points ', fe_tip_xdomain.ls_intersection_r print "triangles ", fe_xdomain.dots.rt_triangles print "vtk points ", fe_xdomain.dots.vtk_X print "vtk data ", fe_xdomain.dots.get_vtk_cell_data( 'blabla', 0, 0 ) print 'ip_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_ls', fe_xdomain.dots.vtk_ls_values print 'J_det ', fe_xdomain.dots.J_det_grid if p == 'state': # Add the time-loop control print 'STATE: initial' print 'fe_xdomain.dots.state_elem grid' print fe_xdomain.dots.state_start_elem_grid print 'fe_tip_xdomain.dots.state_elem grid' print fe_tip_xdomain.dots.state_start_elem_grid print 'fe_xdomain.dots.state_end_elem grid' print fe_xdomain.dots.state_end_elem_grid print 'fe_tip_xdomain.dots.state_end_elem grid' print fe_tip_xdomain.dots.state_end_elem_grid fe_xdomain.dots.state_array[:] = 25.5 print 'state_array 25', fe_xdomain.dots.state_array fe_tip_xdomain.dots.state_array[:] = 58 bls_function3 = lambda X, Y:-( ( X - 0.5 ) ** 2 + ( Y - 0.21 ) ** 2 - 0.58 ** 2 ) fe_xdomain.bls_function = bls_function3 fe_tip_xdomain.ls_function = bls_function3 print 'STATE: changed' print 'fe_xdomain.dots.state_elem grid' print fe_xdomain.dots.state_start_elem_grid print 'fe_tip_xdomain.dots.state_elem grid' print fe_tip_xdomain.dots.state_start_elem_grid print 'fe_xdomain.dots.state_end_elem grid' print fe_xdomain.dots.state_end_elem_grid print 'fe_tip_xdomain.dots.state_end_elem grid' print fe_tip_xdomain.dots.state_end_elem_grid print 'state_array 25', fe_xdomain.dots.state_array.shape print 'state_array 25', fe_xdomain.dots.state_array[570:] print 'state_array 58', fe_tip_xdomain.dots.state_array.shape elif do == 'ui': tloop = TLoop( tstepper = ts, debug = False, tolerance = 1e-4, KMAX = 3, RESETMAX = 0, tline = TLine( min = 0.0, step = 1, max = 1.0 ) ) tloop.eval() from ibvpy.plugins.ibvpy_app import IBVPyApp ibvpy_app = IBVPyApp( ibv_resource = ts ) ibvpy_app.main()
def example_2d(): from ibvpy.mats.mats2D.mats2D_elastic.mats2D_elastic import MATS2DElastic from ibvpy.fets.fets2D.fets2D4q import FETS2D4Q from ibvpy.fets.fets2D.fets2D4q8u import FETS2D4Q8U from ibvpy.fets.fets2D.fets2D4q9u import FETS2D4Q9U from ibvpy.fets.fets2D.fets2D9q import FETS2D9Q fets_eval = FETS2D4Q(mats_eval=MATS2DElastic(E=1., nu=0.)) xfets_eval = FETSBimaterial(parent_fets=fets_eval, int_order=3, mats_eval=MATS2DElastic(E=1., nu=0.), mats_eval2=MATS2DElastic(E=5., nu=0.)) # Discretization fe_domain = FEDomain() fe_level1 = FERefinementGrid(domain=fe_domain, fets_eval=fets_eval) fe_grid1 = FEGrid(coord_max=(3., 1., 0.), shape=(3, 1), fets_eval=fets_eval, level=fe_level1) fe_xdomain = XFESubDomain( domain=fe_domain, fets_eval=xfets_eval, #fe_grid_idx_slice = fe_grid1[1,0], fe_grid_slice=fe_grid1['X - 1.5']) ts = TS( dof_resultants=True, sdomain=fe_domain, bcond_list=[ BCDofGroup(var='u', value=1., dims=[0], get_dof_method=fe_grid1.get_right_dofs), BCDofGroup(var='u', value=0., dims=[1], get_dof_method=fe_grid1.get_right_dofs), BCDofGroup(var='u', value=0., dims=[0, 1], get_dof_method=fe_grid1.get_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 = 0, warp = True ), RTraceDomainListField(name='Displacement', var='u', idx=0, warp=True), RTraceDomainListField(name='Strain', var='eps', idx=0, warp=True), # RTraceDomainField(name = 'N0' , # var = 'N_mtx', idx = 0, # record_on = 'update') ]) # # # Add the time-loop control tloop = TLoop( tstepper=ts, # tolerance = 1e-4, KMAX = 4, # debug = True, RESETMAX = 2, tline=TLine(min=0.0, step=1., max=1.0)) #print "elements ",fe_xdomain.elements[0] fe_xdomain.deactivate_sliced_elems() 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.rt_triangles print "vtk points ", fe_xdomain.dots.vtk_X print "vtk data ", fe_xdomain.dots.get_vtk_cell_data('blabla', 0, 0) print 'ip_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_ls', fe_xdomain.dots.vtk_ls_values print 'J_det ', fe_xdomain.dots.J_det_grid print tloop.eval() # #ts.setup() from ibvpy.plugins.ibvpy_app import IBVPyApp ibvpy_app = IBVPyApp(ibv_resource=ts) ibvpy_app.main()
def example_with_new_domain(): from ibvpy.api import \ TStepper as TS, RTraceGraph, RTraceDomainListField, TLoop, \ TLine, BCDof, IBVPSolve as IS from ibvpy.mats.mats2D.mats2D_elastic.mats2D_elastic import MATS2DElastic from ibvpy.api import BCDofGroup fets_eval = FETS2D4Qxfem(mats_eval = MATS2DElastic(E= 1.,nu=0.)) from ibvpy.mesh.fe_grid import FEGrid from ibvpy.mesh.fe_level_set_domain import FELevelSetDomain from mathkit.mfn.mfn_line.mfn_line import MFnLineArray # Discretization domain = FEGrid( coord_max = (1.,1.,0.), shape = (1, 1), fets_eval = fets_eval) mf1 = MFnLineArray( #xdata = arange(10), ydata = array([0.,0.1,0.2,0.3,0.3,]) ) mf2 = MFnLineArray( #xdata = arange(10), ydata = array([0., 0., 0., 0.,0.,0.1,0.2,0.3 ]) ) tstepper = TS( sdomain = domain, bcond_list = [ BCDofGroup( var='u', value = 0., dims = [0], get_dof_method = domain.get_left_dofs ), # BCDofGroup( var='u', value = 0., dims = [1], # get_dof_method = domain.get_top_dofs ), BCDofGroup( var='u', value = 0., dims = [1], get_dof_method = domain.get_bottom_left_dofs ), BCDofGroup( var='u', value = 1., dims = [0], time_function = mf1.get_value, get_dof_method = domain.get_right_dofs ), BCDofGroup( var='u', value = 1., dims = [1], time_function = mf2.get_value, get_dof_method = domain.get_right_dofs ) ], rtrace_list = [ # RTraceGraph(name = 'Fi,right over u_right (iteration)' , # var_y = 'F_int', idx_y = right_dof, # var_x = 'U_k', idx_x = right_dof, # record_on = 'update'), # RTraceDomainField(name = 'Stress' , # var = 'sig_app', idx = 0, # record_on = 'update'), RTraceDomainListField(name = 'Displacement' , var = 'u', idx = 0, record_on = 'update'), RTraceDomainListField(name = 'Strain' , var = 'eps', idx = 0, #position = 'int_pnts', record_on = 'update', warp = True), # RTraceDomainField(name = 'N0' , # var = 'N_mtx', idx = 0, # record_on = 'update') ] ) #import cProfile # Add the time-loop control #global tloop tloop = TLoop( tstepper = tstepper, tline = TLine( min = 0.0, step = 1., max = 10.0 ) ) # 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) 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()
def example_with_new_domain(): from ibvpy.api import \ TStepper as TS, RTraceDomainListField, TLoop, \ TLine, BCSlice from ibvpy.fets.fets2D.fets2D4q8u import FETS2D4Q8U from ibvpy.mats.mats3D.mats3D_cmdm import \ MATS3DMicroplaneDamage from ibvpy.mats.matsXD.matsXD_cmdm import PhiFnStrainSoftening # mats = MATS2DElastic(E=2,nu= .2, # stress_state= 'rotational_symetry') mats = MATS3DMicroplaneDamage(model_version='stiffness', E=34e3, nu=0.2, phi_fn=PhiFnStrainSoftening(G_f=0.001117, f_t=2.8968)) fets_eval = FETS2Drotsym(prototype_fets=FETS2D4Q8U(), mats_eval=mats) fets_eval.vtk_r *= 0.9 from ibvpy.mesh.fe_grid import FEGrid radius = sqrt(1. / pi) # f_i = (radius/2.)*2*pi # f_o = (radius)*2*pi # print 'f ',f_i,' ', f_o # Discretization fe_grid = FEGrid( # coord_min = (0.,radius/2.,0.), coord_max=(1., radius, 0.), shape=(20, 20), fets_eval=fets_eval) tstepper = TS(sdomain=fe_grid, bcond_list=[ BCSlice(var='u', value=0., dims=[0], slice=fe_grid[0, :, 0, :]), BCSlice(var='u', value=0., dims=[1], slice=fe_grid[0, 0, 0, 0]), BCSlice(var='u', value=1.e-3, dims=[0], slice=fe_grid[-1, :, -1, :]), ], rtrace_list=[ RTraceDomainListField(name='Stress', var='sig_app', idx=0, warp=True, record_on='update'), RTraceDomainListField(name='fracture_energy', var='fracture_energy', idx=0, warp=True, record_on='update'), RTraceDomainListField(name='Displacement', var='u', 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()
def app(): avg_radius = 10 thickness = 50.0 # mm md = MATS2DScalarDamage(E=30.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_stress", stiffness="secant", # stiffness = "algorithmic", strain_norm=Rankine()) mdm = MATS2DMicroplaneDamage(E=30.0e3, nu=0.2, model_version='compliance', phi_fn=PhiFnStrainSoftening( G_f=0.1, f_t=3.0, md=0.0, h=2. * avg_radius)) # mdm = MATS2DElastic() fets_eval = FETS2D4Q9U(mats_eval=mdm) fe_domain = FEDomain() fe_rgrid = FERefinementGrid(name='fe_grid1', fets_eval=fets_eval, domain=fe_domain) n_half = 10 n_el = n_half * 2 + 1 # Discretization fe_grid = FEGrid(coord_max=(200.0, 200.0, 0.), shape=(n_el, n_el), fets_eval=fets_eval, level=fe_rgrid) # numer of elements to deactivate from each side n_dact = 3 * n_half / 10 print n_dact for i in range(0, n_dact): fe_grid.deactivate((i, n_half)) for j in range(n_el - n_dact, n_el): fe_grid.deactivate((j, n_half)) Ps_fn = MFnLineArray(xdata=array([0, 0.5, 1 ]), ydata=array([0, 1., 1 ])) P_fn = MFnLineArray(xdata=array([0, 0.5, 1 ]), ydata=array([0, 0., 1 ])) # averaging function avg_processor = RTNonlocalAvg(avg_fn=QuarticAF(radius=avg_radius, correction=True)) bc_slice_up = fe_grid[:, -1, :, -1] print 'BC Up', bc_slice_up.elems.flatten() bc_slice_left = fe_grid[0, n_half + 1:, 0, :] print 'BC Left', bc_slice_left.elems.flatten() bc_slice_right = fe_grid[-1, 0:n_half, -1, :] print 'BC Right', bc_slice_right.elems.flatten() bc_slice_down = fe_grid[:, 0, (1, 2), 0] print 'BC Down', bc_slice_down.elems.flatten() bc_loading = fe_grid[0, 0, 0, 0] loading_dof_ps = bc_loading.dofs.flatten()[0] loading_dof_p = bc_loading.dofs.flatten()[1] print 'loading_dof_ps', loading_dof_ps print 'loading_dof_p', loading_dof_p print 'dofs right', bc_slice_right.dofs.flatten() print 'dofs down', bc_slice_down.dofs.flatten() redundant_dofs_left = fe_grid[0:n_dact, n_half, :-1, 1] print 'redundant dofs left' , redundant_dofs_left.dofs.flatten() redundant_dofs_right = fe_grid[n_el - n_dact:n_el, n_half, 1:, 1] print 'redundant dofs right' , redundant_dofs_right.dofs.flatten() aa_x = np.hstack((loading_dof_ps, np.unique(bc_slice_down.dofs[:, :, 0].flatten()), np.unique(bc_slice_right.dofs[:, :, 0].flatten()))) aa_y = np.hstack((loading_dof_p, np.unique(bc_slice_down.dofs[:, :, 1].flatten()), np.unique(bc_slice_right.dofs[:, :, 1].flatten()))) print 'aa_x', aa_x print 'aa_y', aa_y # delta measurement points p_a = fe_grid[2, 6, -1, -1] p_b = fe_grid[17, 6, -1, -1] p_c = fe_grid[17, 13, -1, -1] p_d = fe_grid[2, 13, -1, -1] print 'point A' , p_a.geo_nodes.flatten() print 'point B' , p_b.geo_nodes.flatten() print 'point C' , p_c.geo_nodes.flatten() print 'point D' , p_d.geo_nodes.flatten() link_right = BCSlice(var='u', value=0., dims=[0, 1], slice=bc_slice_right, link_slice=bc_loading, link_dims=[0, 1], link_coeffs=[1.]) link_down = BCSlice(var='u', value=0., dims=[0, 1], slice=bc_slice_down, link_slice=bc_loading, link_dims=[0, 1], link_coeffs=[1.]) ts = TS(sdomain=fe_grid, u_processor=avg_processor, bcond_list=[ # constraint for all left dofs in y-direction: link_right, link_down, # constraint for all left dofs in y-direction: BCSlice(var='u', slice=bc_slice_up, dims=[0, 1], value=0.), BCSlice(var='u', slice=bc_slice_left, dims=[0, 1], value=0.), BCSlice(var='u', slice=redundant_dofs_left, dims=[0, 1], value=0.), BCSlice(var='u', slice=redundant_dofs_right, dims=[0, 1], value=0.), BCSlice(var='f', slice=bc_loading, dims=[0], time_function=Ps_fn.get_value, value= -200), BCSlice(var='u', slice=bc_loading, dims=[1], time_function=P_fn.get_value, value= -0.05), ], rtrace_list=[ RTraceGraph(name='Ps' , var_y='F_int', idx_y_arr=aa_x, var_x='U_k', idx_x=loading_dof_ps, transform_x='-x', transform_y='-y*%g' % thickness, record_on='update'), RTraceGraph(name='P' , var_y='F_int', idx_y_arr=aa_y, var_x='U_k', idx_x=loading_dof_p, transform_x='-x', transform_y='-y*%g' % thickness, record_on='update'), RTraceGraph(name='Point A' , var_y='F_int', idx_y=p_a.dofs.flatten()[1], var_x='U_k', idx_x=p_a.dofs.flatten()[1], transform_x='-x', transform_y='-y*%g' % thickness, record_on='update'), RTraceGraph(name='Point B' , var_y='F_int', idx_y=p_b.dofs.flatten()[1], var_x='U_k', idx_x=p_b.dofs.flatten()[1], transform_x='-x', transform_y='-y*%g' % thickness, record_on='update'), RTraceGraph(name='Point C' , var_y='F_int', idx_y=p_c.dofs.flatten()[1], var_x='U_k', idx_x=p_c.dofs.flatten()[1], transform_x='-x', transform_y='-y*%g' % thickness, record_on='update'), RTraceGraph(name='Point D' , var_y='F_int', idx_y=p_d.dofs.flatten()[1], var_x='U_k', idx_x=p_d.dofs.flatten()[1], transform_x='-x', transform_y='-y*%g' % thickness, 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'), ] ) # Add the time-loop control # tl = TLoop(tstepper=ts, tolerance=5.0e-4, KMAX=200, tline=TLine(min=0.0, step=.05, max=0.7)) tl.eval() u_a = ts.rtrace_list[2].trace.xdata u_b = ts.rtrace_list[3].trace.xdata u_c = ts.rtrace_list[4].trace.xdata u_d = ts.rtrace_list[5].trace.xdata delta_r = (u_b + u_c) / 2 delta_l = (u_a + u_d) / 2 delta = (delta_l + delta_r) / 2 with open("4b.txt") as f: data = f.read() data = data.split('\n') x = [row.split(' ')[0] for row in data] y = [row.split(' ')[1] for row in data] fig = plt.figure() ax = fig.add_subplot(111) print ts.rtrace_list P = ts.rtrace_list[1].trace ax.set_title("Load-displacement diagramm") ax.set_xlabel(r'$\delta$ (mm)') ax.set_ylabel('P (N)') ax.plot(x, y, 'r--', label='Test Load Path 4b') ax.plot(delta, P.ydata, c='b', label='Simulation (MDM)') leg = ax.legend() plt.show() # # 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()
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()
def example_with_new_domain(): from ibvpy.api import \ TStepper as TS, MGridDomain, RTraceGraph, RTraceDomainField, TLoop, \ TLine, IBVPSolve as IS, DOTSEval from ibvpy.api import BCDofGroup from ibvpy.mats.mats1D5.mats1D5bond import MATS1D5Bond from ibvpy.mesh.mgrid_domain import MeshGridAdaptor from ibvpy.mesh.fe_grid import FEGrid from ibvpy.fets.fets1D5.fets1D52b4uLRH import FETS1D52B4ULRH from mathkit.mfn.mfn_line.mfn_line import MFnLineArray fets_eval = FETS1D52B4ULRH(mats_eval = MATS1D5Bond(Ef = 0., Af =0., Em = 0., Am = 0., bond_fn = MFnLineArray(xdata = [0.,1.], ydata = [0.,1.]))) # Tseval for a discretized line domain tseval = DOTSEval( fets_eval = fets_eval ) domain = FEGrid( coord_max = (1., 0.1, 0.0), #new domain shape = (2,1), n_nodal_dofs = 1, dof_r = [[-1,-1],[1,-1],[1,1],[-1,1]], geo_r = [[-1,-1],[1,-1],[1,1],[-1,1]]) ts = TS( tse = tseval, sdomain = domain, # conversion to list (square brackets) is only necessary for slicing of # single dofs, e.g "get_left_dofs()[0,1]" bcond_list = [BCDofGroup(var='u', value = 0.,dims = [0], get_dof_method = domain.get_top_dofs), # BCDofGroup(var='u', value = 0.,dims = [0], # get_dof_method = domain.get_bottom_left_dofs), # imposed displacement for all right dofs in y-direction: # BCDofGroup(var='f', value = -1., dims = [0], # get_dof_method = domain.get_bottom_left_dofs), BCDofGroup(var='f', value = 1./3., dims = [0], get_dof_method = domain.get_bottom_dofs )], rtrace_list = [ RTraceGraph(name = 'Internal Force - Displacement' , var_y = 'F_int', idx_y = domain.get_bottom_right_dofs()[0][0,0], var_x = 'U_k', idx_x = domain.get_bottom_right_dofs()[0][0,0]), RTraceDomainField(name = 'Stress' , #position = 'int_pnts', var = 'sig_app', idx = 0), RTraceDomainField(name = 'Displacement' , var = 'u', idx = 0), RTraceDomainField(name = 'Strain' , var = 'eps_app', idx = 0), RTraceDomainField(name = 'Slip' , var = 'slip', idx = 0), RTraceDomainField(name = 'Shear' , var = 'shear', idx = 0) # RTraceDomainField(name = 'N0' , # var = 'N_mtx', idx = 0, # record_on = 'update') ] ) # Add the time-loop control tloop = TLoop( tstepper = ts, DT = 1., tline = TLine( min = 0.0, max = 1.0 )) tloop.eval() # Put the whole stuff into the simulation-framework to map the # individual pieces of definition into the user interface. # from ibvpy.plugins.ibvpy_app import IBVPyApp app = IBVPyApp( ibv_resource = tloop ) app.main()
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()
def __demo__(): from ibvpy.api import \ TStepper as TS, RTraceGraph, RTraceDomainListField, TLoop, \ TLine, BCSlice, FEDomain, FERefinementGrid 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 fe_domain = FEDomain() r1 = FERefinementGrid(fets_eval = fets_eval, domain = fe_domain) r2 = FERefinementGrid(fets_eval = fets_eval, domain = fe_domain) # Discretization domain1 = FEGrid(coord_max = (3.,), shape = (3,), fets_eval = fets_eval, level = r1) domain2 = FEGrid(coord_min = (3.,), coord_max = (6.,), shape = (3,), fets_eval = fets_eval, level = r2) ts = TS(dof_resultants = True, sdomain = fe_domain, bcond_list = [BCSlice(var = 'u', dims = [0], value = 0, slice = domain1[0, 0]), BCSlice(var = 'u', dims = [0], value = 0, slice = domain1[-1, -1], link_slice = domain2[0, 0], link_coeffs = [1.]), BCSlice(var = 'f', dims = [0], value = 1, slice = domain2[-1, -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. # from ibvpy.plugins.ibvpy_app import IBVPyApp app = IBVPyApp(ibv_resource = tloop) app.main()
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()
return nu if __name__ == '__main__': sim_model = SimBT4PTDB(ccs_unit_cell_key='FIL-10-09_2D-05-11_0.00462_all0', calibration_test='TT-12c-6cm-0-TU-SH2F-V3', age=23) do = 'ui' # do = 'validation' # do = 'show_last_results' if do == 'ui': sim_model.tloop.eval() from ibvpy.plugins.ibvpy_app import IBVPyApp app = IBVPyApp(ibv_resource=sim_model) app.main() if do == 'param_study': # influence of the calibration test # param_list = [ 'TT-12c-6cm-TU-SH1F-V1', 'TT-12c-6cm-0-TU-SH2F-V2', 'TT-12c-6cm-0-TU-SH2F-V3' ] for param_key in param_list: run_key = 'f_w_diagram_x_olmyz-22211_Ec-28600_nu-025_tol-m_nsteps-20_' + param_key sim_model = SimFourPointBendingDB( ccs_unit_cell_key='FIL-10-09_2D-05-11_0.00462_all0', calibration_test=param_key,
def combined_fe2D4q_with_fe2D4q8u(): fets_eval_4u_conc = FETS2D4Q(mats_eval=MATS2DElastic(E=28500, nu=0.2)) fets_eval_4u_steel = FETS2D4Q(mats_eval=MATS2DElastic(E=210000, nu=0.25)) fets_eval_8u = FETS2D4Q8U(mats_eval=MATS2DElastic()) # Discretization fe_domain = FEDomain() fe_grid_level1 = FERefinementGrid(name='master grid', fets_eval=fets_eval_4u_conc, domain=fe_domain) fe_grid = FEGrid(level=fe_grid_level1, coord_max=(2., 6., 0.), shape=(11, 30), fets_eval=fets_eval_4u_conc) fe_grid_level2 = FERefinementGrid(name='refinement grid', parent=fe_grid_level1, fets_eval=fets_eval_4u_steel, fine_cell_shape=(1, 1)) # fe_grid_level1[ 5, :5 ].refine_using( fe_grid_level2 ) # 1. first get the slice for the level - distinguish it from the slice at the subgrid # this includes slicing in the subgrids. what if the subgrid does not exist? # # Each subgrid must hold its own slice within the level. The index operator fills # the grid [...] instanciates the whole grid and returns the instance of # FEGridLevelSlice. The expanded subgrid contains its constructor slice. # # 2. If the slice is within an existing slice no change in the FESubgrid is required # only the instance of the slice is returned. The FEGridLevelSlice goes always into # an expanded part of FEGrid. # # 3. If the slice does not fit into any existing slice - all domain with an intersection # of the existing slice must be constructed as well. # # 2. deactivate elements # 3. # BUT how to impose the boundary conditions on the particular refinement? The # slice has an attribute fe_grid_level2.refine_elem((5, 0)) fe_grid_level2.refine_elem((5, 1)) fe_grid_level2.refine_elem((5, 2)) fe_grid_level2.refine_elem((5, 3)) fe_grid_level2.refine_elem((5, 4)) fe_grid_level2.refine_elem((5, 5)) # apply the boundary condition on a subgrid # print fe_grid_level2.fe_subgrids fe_first_grid = fe_grid_level2.fe_subgrids[0] ts = TS( dof_resultants=True, sdomain=fe_domain, bcond_list=[ BCSlice(var='f', value=1., dims=[0], slice=fe_grid[:, -1, :, -1]), BCSlice(var='u', value=0., dims=[0, 1], slice=fe_first_grid[:, 0, :, 0]) ], rtrace_list=[ RTraceGraph(name='Fi,right over u_right (iteration)', var_y='F_int', idx_y=0, var_x='U_k', idx_x=1), RTraceDomainListField(name='Stress', var='sig_app', idx=0, warp=True), # RTraceDomainField(name = 'Displacement' , # var = 'u', idx = 0), # RTraceDomainField(name = 'N0' , # var = 'N_mtx', idx = 0, # record_on = 'update') ]) # Add the time-loop control tloop = TLoop(tstepper=ts, tline=TLine(min=0.0, step=1, max=1.0)) print tloop.eval() from ibvpy.plugins.ibvpy_app import IBVPyApp ibvpy_app = IBVPyApp(ibv_resource=tloop) ibvpy_app.main()
def run(): ''' Pull-Out test with epoxy-impregnated yarn. Publisched in Konrad, M., Chudoba, R., Tensile Behavior of Cementitous Composite Reinforced with Epoxy Impregnated Multifilament Yarns, Int. J. for Multiscale Computational Engineering, 7(2)115-133(2009) Parameters set in such a way that the Figure 18 gets reproduced. At the moment no yarn damage assumed. ''' from ibvpy.api import \ TStepper as TS, RTraceGraph, RTraceDomainListField, TLoop, \ TLine, IBVPSolve as IS, DOTSEval, BCSlice, FEGrid from ibvpy.fets.fets1D5.fets1D52l4uLRH import \ FETS1D52L4ULRH, MATS1DElastic, MATS1DPlastic, MATS1D5Bond from ibvpy.fets.fets1D5.fets1D52l6uLRH import FETS1D52L6ULRH from ibvpy.fets.fets1D5.fets1D52l8uLRH import FETS1D52L8ULRH from mathkit.mfn.mfn_line.mfn_line import \ MFnLineArray from math import sqrt, pi as Pi # Concrete parameters A_concrete = 30. * 30. # [mm^2] cross-sectional area of concrete E_concrete = 32000.0 # [MPa] E-Modulus of concrete stiffness_concrete = E_concrete * A_concrete # 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 # 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^2] - shear flow stiffness # Geometry L_e = 30. # [mm] - embedded length # Loading conditions u_max = 0.1 # f_max = 1200 # Material model construction mats_eval = MATS1D5Bond( mats_phase1 = MATS1DElastic( E = stiffness_fiber ), mats_phase2 = MATS1DElastic( E = stiffness_concrete ), mats_ifslip = MATS1DPlastic(E = G, sigma_y = T_max, K_bar = 0., H_bar = 0. ), mats_ifopen = MATS1DElastic( E = 0. )) # Finite element construction # fets_eval = FETS1D52L4ULRH( mats_eval = mats_eval ) # bilinear # fets_eval = FETS1D52L6ULRH( mats_eval = mats_eval ) #quadratic fets_eval = FETS1D52L6ULRH( mats_eval = mats_eval ) #cubic # Dicretization domain = FEGrid( coord_max = (L_e, L_e/5.), #shape = (16,1), # for bilinear #shape = (8,1), # for quadratic shape = (4,1), # for cubic fets_eval = fets_eval ) end_dof = domain[-1,0,-1,0 ].dofs[0,0,0] ts = TS( dof_resultants = True, sdomain = domain, bcond_list = [ # Matrix is fixed along the whole embedded length BCSlice( var='u', value = 0., dims = [0], slice = domain[0,0,0,-1] ), # Fixed fiber at the left end BCSlice( var='u', value = 0., dims = [0], slice = domain[0,0,0,0] ), # Fixed y-displacement - no crack opening BCSlice( var='u', value = 0., dims = [1], slice = domain[:,:,:,:] ), # Loading at the right end of the fiber BCSlice( var='u', value = u_max, dims = [0], slice = domain[-1,0,-1,0] ) ], 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' ), RTraceDomainListField(name = 'eps1', var = 'eps1' ), RTraceDomainListField(name = 'eps2', var = 'eps2' ), RTraceDomainListField(name = 'shear_flow', var = 'shear_flow' ), RTraceDomainListField(name = 'sig1', var = 'sig1' ), RTraceDomainListField(name = 'sig2', var = 'sig2' ), RTraceDomainListField(name = 'Displacement', var = 'u' ) ] ) # 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()
def run(): from ibvpy.api import \ TStepper as TS, RTraceGraph, RTraceDomainListField, TLoop, \ TLine, IBVPSolve as IS, DOTSEval, BCSlice, FEGrid, BCDofGroup,\ RTraceDomainListInteg from ibvpy.fets.fets1D5.fets1D52l4uLRH import \ FETS1D52L4ULRH, MATS1DElastic, MATS1DPlastic, MATS1D5Bond from ibvpy.fets.fets1D5.fets1D52l6uLRH import FETS1D52L6ULRH from ibvpy.fets.fets1D5.fets1D52l8uLRH import FETS1D52L8ULRH from ibvpy.fets.fets1D.fets1D2l import FETS1D2L from ibvpy.fets.fets2D.fets2Drotsym import FETS2Drotsym from ibvpy.fets.fets2D.fets2D4q import FETS2D4Q from ibvpy.fets.fets2D.fets2D4q8u import FETS2D4Q8U from ibvpy.fets.fets2D.fets2D4q9u import FETS2D4Q9U from ibvpy.fets.fets2D.fets2D4q12u import FETS2D4Q12U from ibvpy.mats.mats2D.mats2D_elastic.mats2D_elastic import MATS2DElastic from ibvpy.mats.mats3D.mats3D_cmdm.mats3D_cmdm import \ MATS3DMicroplaneDamage, PhiFnStrainSoftening from mathkit.mfn.mfn_line.mfn_line import \ MFnLineArray from math import sqrt, pi as Pi # Concrete parameters E_concrete = 32000.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.2e-2 # f_max = 1200 # Discretization fineness_x = 5 fineness_y = 5 # Material model construction mats_eval_bond = MATS1D5Bond( mats_phase1 = MATS1DElastic( E = stiffness_fiber ), mats_phase2 = MATS1DElastic( E = 0 ), mats_ifslip = MATS1DPlastic( E = G, sigma_y = T_max, K_bar = 0.,H_bar = 0.), # plastic function of slip #mats_ifslip = MATS1DElastic( E = G ), # elastic function of slip #mats_ifopen = MATS1DElastic( E = penalty_stiffness) mats_ifopen = MATS1DElastic(stress_strain_curve = MFnLineArray( ydata = [ -penalty_stiffness, 0., 0.], xdata = [ -1., 0.,1.] )) ) mats_eval_matrix = MATS3DMicroplaneDamage( model_version = 'stiffness', E = 32e3, nu = 0.2, phi_fn = PhiFnStrainSoftening( G_f = 42.e-3, #N/mm, f_t = 4.0 )#N/mm^2 ) # the values are from Dissertation of Stephan Voss <Ingenieurmodelle zum Tragverhalten textilbewehrtem Beton> # Finite element construction #fets_eval_bond = FETS1D52L4ULRH(mats_eval = mats_eval_bond ) #fets_eval_bond = FETS1D52L6ULRH(mats_eval = mats_eval_bond ) fets_eval_bond = FETS1D52L4ULRH(mats_eval = mats_eval_bond ) fets_eval_matrix = FETS2Drotsym( #parent_fets = FETS2D4Q8U(), #parent_fets = FETS2D4Q9U(), parent_fets = FETS2D4Q12U(), mats_eval = mats_eval_matrix) #fets_eval_matrix.parent_fets.vtk_r *= 0.99 # Discretization domain_bond = FEGrid( coord_min = (0., -L_e/5.), coord_max = (L_e, 0.), shape = (fineness_x*1,1), # Caution! the bond and the matrix should match! Test each time!!! fets_eval = fets_eval_bond ) domain_matrix1 = FEGrid( coord_min = (0.,0.001), 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 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), RTraceDomainListField(name = 'fracture_energy' , var = 'fracture_energy', idx = 0, warp = True, record_on = 'update'), RTraceDomainListInteg(name = 'Total fracture energy' , var = 'fracture_energy', idx = 0, warp = False, record_on = 'update') ] ) # Add the time-loop control tloop = TLoop( tstepper = ts, KMAX = 30, debug = False, tline = TLine( min = 0.0, step = 0.2, 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()
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()
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()
rtrace_list=[ RTraceGraph(name='strain 0 - stress 0', var_x='eps_app', idx_x=0, var_y='sig_app', idx_y=0, record_on='update') ]) # Put the time-stepper into the time-loop # tmax = 4.0 # tmax = 0.0006 n_steps = 100 tl = TLoop(tstepper=ts, DT=tmax / n_steps, KMAX=100, RESETMAX=0, tline=TLine(min=0.0, max=tmax)) # Put the whole stuff into the simulation-framework to map the # individual pieces of definition into the user interface. # tl.eval() from ibvpy.plugins.ibvpy_app import IBVPyApp app = IBVPyApp(tloop=tl) app.main()
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()
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()
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()
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()
def _get_shape(self): return len(self.elements) #------------------------------------------------------------------ # UI - related methods #------------------------------------------------------------------ traits_view = View(Item('source_domain@', show_label=False), Item('refresh_button', show_label=False), Item('ls_value', show_label=False), resizable=True, scrollable=True, height=0.5, width=0.5) if __name__ == '__main__': fe_domain = FEGrid(coord_min=(-2., -2., 0), coord_max=(2., 2., 0), shape=(10, 10), geo_r=[[-1, -1], [-1, 1], [1, 1], [1, -1]], dof_r=[[-1, -1], [-1, 1], [1, 1], [1, -1]]) ls_domain = FELevelSetDomain(source_domain=fe_domain, ls_function=lambda x, y: x**2 + y**2 - 1.) from ibvpy.plugins.ibvpy_app import IBVPyApp ibvpy_app = IBVPyApp(ibv_resource=ls_domain) ibvpy_app.main()