def notched_bended_beam(): fets_eval_4u = FETS2D4Q(mats_eval=MATS2DScalarDamage()) fets_eval_cracked = FETSLSEval(parent_fets=fets_eval_4u) # Discretization fe_domain1 = FEGrid(coord_max=(5., 2., 0.), shape=(3, 2), fets_eval=fets_eval_4u) fe_child_domain = FERefinementGrid(parent_domain=fe_domain1, fets_eval=fets_eval_cracked, fine_cell_shape=(1, 1)) crack_level_set = lambda X: X[0] - 2.5 fe_child_domain.refine_elem((1, 0), crack_level_set) dots = fe_child_domain.new_dots() fe_domain = FEDomainList(subdomains=[fe_domain1]) fe_domain_tree = FEDomainTree(domain_list=fe_domain) ts = TS( dof_resultants=True, sdomain=[fe_domain1, fe_child_domain], bcond_list=[ BCDofGroup(var='u', value=0., dims=[0, 1], get_dof_method=fe_domain1.get_left_dofs), BCDofGroup(var='u', value=0., dims=[0, 1], get_dof_method=fe_domain1.get_right_dofs), BCDofGroup(var='f', value=-1., dims=[1], get_dof_method=fe_domain1.get_top_dofs), ], rtrace_list=[ # RTDofGraph(name = 'Fi,right over u_right (iteration)' , # var_y = 'F_int', idx_y = 0, # var_x = 'U_k', idx_x = 1), # RTraceDomainListField(name = 'Stress' , # var = 'sig_app', idx = 0, warp = True ), # RTraceDomainField(name = 'Displacement' , # var = 'u', idx = 0), # RTraceDomainField(name = 'N0' , # var = 'N_mtx', idx = 0, # record_on = 'update') # ]) # Add the time-loop control tloop = TLoop(tstepper=ts, tline=TLine(min=0.0, step=1, max=1.0)) print(tloop.eval())
def notched_bended_beam(): fets_eval_4u = FETS2D4Q( mats_eval = MATS2DScalarDamage() ) fets_eval_cracked = FETSLSEval( parent_fets = fets_eval_4u ) # Discretization fe_domain1 = FEGrid( coord_max = (5.,2.,0.), shape = (3,2), fets_eval = fets_eval_4u ) fe_child_domain = FERefinementGrid( parent_domain = fe_domain1, fets_eval = fets_eval_cracked, fine_cell_shape = (1,1) ) crack_level_set = lambda X: X[0] - 2.5 fe_child_domain.refine_elem( (1,0), crack_level_set ) dots = fe_child_domain.new_dots() fe_domain = FEDomainList( subdomains = [ fe_domain1 ] ) fe_domain_tree = FEDomainTree( domain_list = fe_domain ) ts = TS( dof_resultants = True, sdomain = [ fe_domain1, fe_child_domain ], bcond_list = [BCDofGroup(var='u', value = 0., dims = [0,1], get_dof_method = fe_domain1.get_left_dofs ), BCDofGroup(var='u', value = 0., dims = [0,1], get_dof_method = fe_domain1.get_right_dofs ), BCDofGroup(var='f', value = -1., dims = [1], get_dof_method = fe_domain1.get_top_dofs ), ], rtrace_list = [ # RTraceGraph(name = 'Fi,right over u_right (iteration)' , # var_y = 'F_int', idx_y = 0, # var_x = 'U_k', idx_x = 1), # RTraceDomainListField(name = 'Stress' , # var = 'sig_app', idx = 0, warp = True ), # RTraceDomainField(name = 'Displacement' , # var = 'u', idx = 0), # RTraceDomainField(name = 'N0' , # var = 'N_mtx', idx = 0, # record_on = 'update') # ] ) # Add the time-loop control tloop = TLoop( tstepper = ts, tline = TLine( min = 0.0, step = 1, max = 1.0 )) print tloop.eval()
def _get_fe_domain( self ): # Discretization fe_domain = FEDomain() fe_rgrid = FERefinementGrid( domain = fe_domain, fets_eval = self.fets ) # SIDE EFFECT - illegal. The component of FEDomain should # only be reachable through the FEDomain - this is to be # implemented - for now, there is a property # getting the fe_grid object but assurring that fe_domain # has been constructed first self._fe_grid = FEGrid( level = fe_rgrid, coord_min = ( -1.0, -1.0, -1.0 ), coord_max = ( 1.0, 1.0, 1.0 ), geo_transform = self.orig_sheet, shape = ( self.shape_xy, self.shape_xy, self.shape_z ), fets_eval = self.fets ) fe_child_grid = FERefinementGrid( parent = fe_rgrid, fets_eval = self.fets_fold, fine_cell_shape = ( 1, 1, 1 ) ) fold_dof = self.fold_dof side_dof = self.n_dofs_xy - 1 for i in range( side_dof ): fe_child_grid.refine_elem( ( i, fold_dof, 0 ) ) for i in range( fold_dof ): fe_child_grid.refine_elem( ( fold_dof, i, 0 ) ) for i in range( fold_dof + 1, side_dof ): fe_child_grid.refine_elem( ( fold_dof, i, 0 ) ) return fe_domain
def _get_fe_domain( self ): fets_4u = FETS3D8H( mats_eval = MATS3DElastic( E = 10, initial_strain = fold_strain ) ) # Discretization fe_domain = FEDomain() fe_rgrid = FERefinementGrid( domain = fe_domain, fets_eval = self.fets ) fe_grid = FEGrid( level = fe_rgrid, coord_min = ( -1.0, -1.0, -1.0 ), coord_max = ( 1.0, 1.0, 1.0 ), geo_transform = self.orig_sheet, shape = ( self.shape_x, self.shape_y, self.shape_z ), fets_eval = self.fets ) fe_child_grid = FERefinementGrid( parent = fe_rgrid, fets_eval = fets_4u, fine_cell_shape = ( 1, 1, 1 ) ) for i in range( 1 ): fe_child_grid.refine_elem( ( 1, i, 0 ) ) return fe_domain
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 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()