def run_bending3pt_mic_odf(*args, **kw): bt = BendingTestModel( n_e_x=1, n_e_y=1, n_e_z=1, k_max=500, mats_eval_type='microplane damage (eeq)' #mats_eval_type='microplane damage (eeq)' #mats_eval_type='microplane damage (odf)' # mats_eval_type='elastic' ) E_c = 28000 # MPa f_ct = 3.0 # MPa epsilon_0 = f_ct / E_c # [-] print(bt.mats_eval_type) bt.mats_eval.trait_set( # stiffness='algorithmic', epsilon_0=epsilon_0, epsilon_f=epsilon_0 * 10) bt.w_max = 0.001 bt.tline.step = 0.005 bt.cross_section.h = 1 bt.geometry.L = 1 bt.loading_scenario.trait_set(loading_type='monotonic') bt.record = { # 'Pw': Vis2DFW(bc_right=right_x_s, bc_left=left_x_s), # 'slip': Vis2DField(var='slip'), 'strain': Vis3DTensorField(var='eps_ab'), 'stress': Vis3DTensorField(var='sig_ab'), 'damage': Vis3DTensorField(var='phi_ab'), } w = BMCSWindow(sim=bt) # bt.add_viz2d('load function', 'load-time') # bt.add_viz2d('F-w', 'load-displacement') viz_stress = Viz3DTensorField(vis3d=bt.hist['strain']) viz_strain = Viz3DTensorField(vis3d=bt.hist['stress']) viz_damage = Viz3DTensorField(vis3d=bt.hist['damage']) w.viz_sheet.add_viz3d(viz_stress) w.viz_sheet.add_viz3d(viz_strain) w.viz_sheet.add_viz3d(viz_damage) w.viz_sheet.monitor_chunk_size = 1 w.run() time.sleep(10) w.offline = False # w.finish_event = True w.configure_traits()
class PullOutAxiSym(Simulator): tree_node_list = tr.List([]) def _tree_node_list_default(self): return [ self.tline, self.geometry, self.cross_section, self.m_ifc, self.m_steel, self.m_concrete, ] def _update_node_list(self): self.tree_node_list = [ self.tline, self.geometry, self.cross_section, self.m_ifc, self.m_steel, self.m_concrete, ] u_max = tr.Float(BC=True, auto_set=False, enter_set=True) '''Radius of the pullout test ''' cross_section = tr.Instance(CrossSection, report=True, desc='cross section parameters') def _cross_section_default(self): return CrossSection() geometry = tr.Instance( Geometry, report=True, desc='geometry parameters of the boundary value problem') def _geometry_default(self): return Geometry() n_x = tr.Int(20, MESH=True, auto_set=False, enter_set=True, symbol='n_\mathrm{E}', unit='-', desc='number of finite elements along the embedded length') n_y_concrete = tr.Int( 1, MESH=True, auto_set=False, enter_set=True, symbol='n_\mathrm{E}', unit='-', desc='number of finite elements along concrete radius') n_y_steel = tr.Int(1, MESH=True, auto_set=False, enter_set=True, symbol='n_\mathrm{E}', unit='-', desc='number of finite elements along steel radius') xd_steel = tr.Property(depends_on=itags_str) @tr.cached_property def _get_xd_steel(self): dx = self.geometry.L_x r_steel = self.cross_section.R_f return XDomainFEGridAxiSym(coord_min=(0, 0), coord_max=(dx, r_steel), shape=(self.n_x, self.n_y_steel), integ_factor=2 * np.pi, fets=FETS2D4Q()) m_steel = tr.Instance(MATS3DElastic) def _m_steel_default(self): return MATS3DElastic(E=200000, nu=0.3) xd_concrete = tr.Property(depends_on=itags_str) @tr.cached_property def _get_xd_concrete(self): r_steel = self.cross_section.R_f print('len', self.geometry.L_x) dx = self.geometry.L_x r_concrete = self.cross_section.R_m return XDomainFEGridAxiSym(coord_min=(0, r_steel), coord_max=(dx, r_concrete), shape=(self.n_x, self.n_y_concrete), integ_factor=2 * np.pi, fets=FETS2D4Q()) m_concrete = tr.Instance(MATS3DElastic) def _m_concrete_default(self): return MATS3DElastic(E=30000, nu=0.2) xd_ifc = tr.Property(depends_on=itags_str) @tr.cached_property def _get_xd_ifc(self): return XDomainFEInterface(I=self.xd_steel.mesh.I[:, -1], J=self.xd_concrete.mesh.I[:, 0], fets=FETS1D52ULRH(), integ_factor=self.cross_section.P_b) m_ifc = tr.Instance(MATS1D5DPCumPress) def _m_ifc_default(self): return MATS1D5DPCumPress(E_T=10000, E_N=1000000, gamma=55.0, K=11.0, tau_bar=4.2, S=0.005, r=1.0, c=2.8, m=0.175, algorithmic=True) # omega_fn_type='li', domains = tr.Property(depends_on=itags_str) @tr.cached_property def _get_domains(self): print('domains reconstructed') return [ (self.xd_steel, self.m_steel), (self.xd_concrete, self.m_concrete), (self.xd_ifc, self.m_ifc), ] right_x_s = tr.Property(depends_on=itags_str) @tr.cached_property def _get_right_x_s(self): return BCSlice(slice=self.xd_steel.mesh[-1, :, -1, :], var='u', dims=[0], value=self.u_max) right_x_c = tr.Property(depends_on=itags_str) @tr.cached_property def _get_right_x_c(self): return BCSlice(slice=self.xd_concrete.mesh[0, :, 0, :], var='u', dims=[0], value=0) left_x_s = tr.Property(depends_on=itags_str) @tr.cached_property def _get_left_x_s(self): return BCSlice(slice=self.xd_steel.mesh[0, :, 0, :], var='f', dims=[0], value=0) bc_y_0 = tr.Property(depends_on=itags_str) @tr.cached_property def _get_bc_y_0(self): return BCSlice(slice=self.xd_steel.mesh[:, -1, :, -1], var='u', dims=[1], value=0) f_lateral = tr.Float(0, auto_set=False, enter_set=True, BC=True) bc_lateral_pressure_dofs = tr.Property(depends_on=itags_str) @tr.cached_property def _get_bc_lateral_pressure_dofs(self): tf = MFnLineArray(xdata=[0, 1], ydata=[1, 1]) mesh_slice = self.xd_concrete.mesh[:, -1, :, -1] dofs = np.unique(mesh_slice.dofs[:, :, 1].flatten()) return [ BCDof(dof=dof, var='f', value=self.f_lateral, time_function=tf) for dof in dofs ] bc = tr.Property(depends_on=itags_str) @tr.cached_property def _get_bc(self): self.bc_lateral_pressure_dofs return [self.right_x_s, self.right_x_c, self.bc_y_0] + \ self.bc_lateral_pressure_dofs # record = { 'Pw': Vis2DFW(bc_right='right_x_s', bc_left='left_x_s'), 'Pw2': Vis2DFW(bc_right='right_x_c', bc_left='left_x_s'), 'slip': Vis2DField(var='slip'), 'shear': Vis2DField(var='shear'), 'omega': Vis2DField(var='omega'), 's_pi': Vis2DField(var='s_pi'), 's_el': Vis2DField(var='s_el'), 'alpha': Vis2DField(var='alpha'), 'z': Vis2DField(var='z'), 'strain': Vis3DTensorField(var='eps_ab'), 'stress': Vis3DTensorField(var='sig_ab'), #----------------------------- 'damage': Vis3DStateField(var='omega_a'), #------------ # 'kinematic hardening': Vis3DStateField(var='z_a') } def get_window(self): fw = Viz2DFW(name='Pw', vis2d=self.hist['Pw']) fw2 = Viz2DFW(name='Pw2', vis2d=self.hist['Pw2']) fslip = Viz2DField(name='slip', vis2d=self.hist['slip']) fshear = Viz2DField(name='shear', vis2d=self.hist['shear']) fomega = Viz2DField(name='omega', vis2d=self.hist['omega']) fs_pi = Viz2DField(name='s_pi', vis2d=self.hist['s_pi']) fs_el = Viz2DField(name='s_el', vis2d=self.hist['s_el']) falpha = Viz2DField(name='alpha', vis2d=self.hist['alpha']) fz = Viz2DField(name='z', vis2d=self.hist['z']) w = BMCSWindow(sim=self) w.viz_sheet.viz2d_list.append(fw) w.viz_sheet.viz2d_list.append(fw2) w.viz_sheet.viz2d_list.append(fslip) w.viz_sheet.viz2d_list.append(fs_el) w.viz_sheet.viz2d_list.append(fs_pi) w.viz_sheet.viz2d_list.append(fshear) w.viz_sheet.viz2d_list.append(fomega) w.viz_sheet.viz2d_list.append(falpha) w.viz_sheet.viz2d_list.append(fz) strain_viz = Viz3DTensorField(vis3d=self.hist['strain']) w.viz_sheet.add_viz3d(strain_viz) stress_viz = Viz3DTensorField(vis3d=self.hist['stress']) w.viz_sheet.add_viz3d(stress_viz) return w tree_view = ui.View( ui.Item('u_max'), ui.Item('n_x'), ui.Item('n_y_steel'), ui.Item('n_y_concrete'), ui.Item('f_lateral'), )
class PullOut2D(Simulator): tree_node_list = tr.List([]) def _tree_node_list_default(self): return [ self.tline, self.m_ifc, self.m_steel, self.m_concrete, ] def _update_node_list(self): self.tree_node_list = [ self.tline, self.m_ifc, self.m_steel, self.m_concrete, ] n_x = tr.Float(1, auto_set=False, enter_set=True, MESH=True) L_x = tr.Float(1, auto_set=False, enter_set=True, GEO=True) r_steel = tr.Float(1, auto_set=False, enter_set=True, GEO=True) r_concrete = tr.Float(5, auto_set=False, enter_set=True, GEO=True) perimeter = tr.Float(5, auto_set=False, enter_set=True, GEO=True) xd_steel = tr.Property(depends_on=itags_str) @tr.cached_property def _get_xd_steel(self): return XDomainFEGrid(coord_min=(0, 0), coord_max=(self.L_x, self.r_steel), shape=(self.n_x, 1), integ_factor=1, fets=FETS2D4Q()) m_steel = tr.Property(depends_on=itags_str) @tr.cached_property def _get_m_steel(self): return MATS2DElastic(E=200000, nu=0.3) xd_concrete = tr.Property(depends_on=itags_str) @tr.cached_property def _get_xd_concrete(self): return XDomainFEGrid(coord_min=(0, self.r_steel), coord_max=(self.L_x, self.r_concrete), shape=(self.n_x, 1), integ_factor=1, fets=FETS2D4Q()) m_concrete = tr.Property(depends_on=itags_str) @tr.cached_property def _get_m_concrete(self): return MATS2DElastic(E=30000, nu=0.2) xd_ifc = tr.Property(depends_on=itags_str) @tr.cached_property def _get_xd_ifc(self): return XDomainFEInterface(I=self.xd_steel.mesh.I[:, -1], J=self.xd_concrete.mesh.I[:, 0], fets=FETS1D52ULRH(), integ_factor=self.perimeter) m_ifc = tr.Property(depends_on=itags_str) @tr.cached_property def _get_m_ifc(self): return MATS1D5DPCumPress(E_T=1000, E_N=100000, algorithmic=True) # omega_fn_type='li', domains = tr.Property(depends_on=itags_str) @tr.cached_property def _get_domains(self): print('domains reconstructed') return [ (self.xd_steel, self.m_steel), (self.xd_concrete, self.m_concrete), (self.xd_ifc, self.m_ifc), ] u_max = tr.Float(BC=True, auto_set=False, enter_set=True) '''Radius of the pullout test ''' right_x_s = tr.Property(depends_on=itags_str) @tr.cached_property def _get_right_x_s(self): return BCSlice(slice=self.xd_steel.mesh[-1, :, -1, :], var='u', dims=[0], value=self.u_max) right_x_c = tr.Property(depends_on=itags_str) @tr.cached_property def _get_right_x_c(self): return BCSlice(slice=self.xd_concrete.mesh[0, :, 0, :], var='u', dims=[0], value=0) left_x_s = tr.Property(depends_on=itags_str) @tr.cached_property def _get_left_x_s(self): return BCSlice(slice=self.xd_steel.mesh[0, :, 0, :], var='f', dims=[0], value=0) bc_y_0 = tr.Property(depends_on=itags_str) @tr.cached_property def _get_bc_y_0(self): return BCSlice(slice=self.xd_steel.mesh[:, -1, :, -1], var='u', dims=[1], value=0) f_lateral = tr.Float(0, auto_set=False, enter_set=True, BC=True) bc_lateral_pressure_dofs = tr.Property(depends_on=itags_str) @tr.cached_property def _get_bc_lateral_pressure_dofs(self): tf = MFnLineArray(xdata=[0, 1], ydata=[1, 1]) mesh_slice = self.xd_concrete.mesh[:, -1, :, -1] dofs = np.unique(mesh_slice.dofs[:, :, 1].flatten()) return [ BCDof(dof=dof, var='f', value=self.f_lateral, time_function=tf) for dof in dofs ] bc = tr.Property(depends_on=itags_str) @tr.cached_property def _get_bc(self): self.bc_lateral_pressure_dofs return [self.right_x_s, self.right_x_c, self.bc_y_0] + \ self.bc_lateral_pressure_dofs record = { 'Pw': Vis2DFW(bc_right='right_x_s', bc_left='left_x_s'), 'Pw2': Vis2DFW(bc_right='right_x_c', bc_left='left_x_s'), 'slip': Vis2DField(var='slip'), 'shear': Vis2DField(var='shear'), 'omega': Vis2DField(var='omega'), 's_pi': Vis2DField(var='s_pi'), 's_el': Vis2DField(var='s_el'), 'alpha': Vis2DField(var='alpha'), 'z': Vis2DField(var='z'), 'strain': Vis3DTensorField(var='eps_ab'), 'stress': Vis3DTensorField(var='sig_ab'), # 'damage': Vis3DStateField(var='omega_a'), # 'kinematic hardening': Vis3DStateField(var='z_a') } def get_window(self): fw = Viz2DFW(name='Pw', vis2d=self.hist['Pw']) fw2 = Viz2DFW(name='Pw2', vis2d=self.hist['Pw2']) fslip = Viz2DField(name='slip', vis2d=self.hist['slip']) fshear = Viz2DField(name='shear', vis2d=self.hist['shear']) fomega = Viz2DField(name='omega', vis2d=self.hist['omega']) fs_pi = Viz2DField(name='s_pi', vis2d=self.hist['s_pi']) fs_el = Viz2DField(name='s_el', vis2d=self.hist['s_el']) falpha = Viz2DField(name='alpha', vis2d=self.hist['alpha']) fz = Viz2DField(name='z', vis2d=self.hist['z']) w = BMCSWindow(sim=self) w.viz_sheet.viz2d_list.append(fw) w.viz_sheet.viz2d_list.append(fw2) w.viz_sheet.viz2d_list.append(fslip) w.viz_sheet.viz2d_list.append(fs_el) w.viz_sheet.viz2d_list.append(fs_pi) w.viz_sheet.viz2d_list.append(fshear) w.viz_sheet.viz2d_list.append(fomega) w.viz_sheet.viz2d_list.append(falpha) w.viz_sheet.viz2d_list.append(fz) # strain_viz = Viz3DTensorField(vis3d=s.hist['strain']) # w.viz_sheet.add_viz3d(strain_viz) # stress_viz = Viz3DTensorField(vis3d=s.hist['stress']) # w.viz_sheet.add_viz3d(stress_viz) return w
m = MATS3DDesmorat() m = MATS2DElastic(E=1, nu=0) left_y = BCSlice(slice=xdomain.mesh[0, :, 0, :], var='u', dims=[1], value=0) left_x = BCSlice(slice=xdomain.mesh[0, :, 0, :], var='u', dims=[0], value=-1) right_x = BCSlice(slice=xdomain.mesh[-1, :, -1, :], var='u', dims=[0], value=0.0) m = TStepBC( domains=[(xdomain, m)], bc=[left_x, right_x, left_y], record={ 'strain': Vis3DTensorField(var='eps_ab'), # 'damage': Vis3DStateField(var='omega_a'), # 'kinematic hardening': Vis3DStateField(var='z_a') }) s = m.sim s.tloop.k_max = 1000 s.tline.step = 0.1 s.tloop.verbose = True s.run() print('area', thickness) F_ti = s.hist.F_t print('left') print(np.sum(F_ti[-1, right_x.dofs])) print('right') print(np.sum(F_ti[-1, left_x.dofs]))
left_y = BCSlice(slice=xd1.mesh[0, 0, 0, 0], var='u', dims=[1], value=0) left_x = BCSlice(slice=xd1.mesh[0, :, 0, :], var='u', dims=[0], value=-0) right_x = BCSlice(slice=xd1.mesh[-1, :, -1, :], var='u', dims=[0], value=u_0) bc1 = [left_y, left_x, right_x] m = TStepBC( domains=[ (xd1, m1), (xd2, m2), (xd12, MATS1D5Elastic(E_s=10000000, E_n=1000000)), ], bc=bc1, # + bc2, ) m.hist.vis_record = { 'strain': Vis3DTensorField(var='eps_ab'), 'stress': Vis3DTensorField(var='sig_ab'), # 'damage': Vis3DStateField(var='omega_a'), # 'kinematic hardening': Vis3DStateField(var='z_a') } s = m.sim s.tloop.verbose = True s.tloop.k_max = 1000 s.tline.step = 0.1 s.tstep.fe_domain.serialized_subdomains xd12.hidden = True s.run() time.sleep(3)
var='u', dims=[0], value=0) left_x_s = BCSlice(slice=xd_steel_1.mesh[0, :, 0, :], var='f', dims=[0], value=0) bc1 = [right_x_c, right_x_s] s = Simulator( domains=[(xd_steel_1, m_steel), (xd_concrete_2, m_concrete), (xd12, m_interface), ], bc=bc1, # + bc2, record={ 'Pw': Vis2DFW(bc_right=right_x_s, bc_left=left_x_s), 'slip': Vis2DField(var='slip'), 'strain': Vis3DTensorField(var='eps_ab'), 'stress': Vis3DTensorField(var='sig_ab'), 'damage': Vis3DTensorField(var='phi_ab'), # 'kinematic hardening': Vis3DStateField(var='z_a') } ) xd12.hidden = True s.tloop.k_max = 1000 s.tline.step = 0.005 s.tstep.fe_domain.serialized_subdomains fw = Viz2DFW(name='Pw', vis2d=s.hist['Pw']) fslip = Viz2DField(name='slip', vis2d=s.hist['slip']) w = BMCSWindow(sim=s)
class PullOutAxiSym(Simulator): tree_node_list = tr.List([]) def _tree_node_list_default(self): return [ self.tline, self.m_ifc, self.m_steel, self.m_concrete, ] def _update_node_list(self): self.tree_node_list = [ self.tline, self.m_ifc, self.m_steel, self.m_concrete, ] xd_steel = tr.Property() @tr.cached_property def _get_xd_steel(self): return XDomainFEGrid(coord_min=(0, 0), coord_max=(dx, r_steel), shape=(n_x, 1), integ_factor=1, fets=FETS2D4Q()) m_steel = tr.Property() @tr.cached_property def _get_m_steel(self): return MATS2DElastic(E=200000, nu=0.3) xd_concrete = tr.Property() @tr.cached_property def _get_xd_concrete(self): return XDomainFEGrid(coord_min=(0, r_steel), coord_max=(dx, r_concrete), shape=(n_x, n_y), integ_factor=1, fets=FETS2D4Q()) m_concrete = tr.Property() @tr.cached_property def _get_m_concrete(self): return MATS2DElastic(E=30000, nu=0.2) xd_ifc = tr.Property() @tr.cached_property def _get_xd_ifc(self): return XDomainFEInterface( I=self.xd_steel.mesh.I[:, -1], J=self.xd_concrete.mesh.I[:, 0], fets=FETS1D52ULRH(), integ_factor=0.5 ) m_ifc = tr.Property() @tr.cached_property def _get_m_ifc(self): return MATS1D5DPCumPress( E_N=1000000, algorithmic=True) # omega_fn_type='li', domains = tr.Property() @tr.cached_property def _get_domains(self): print('domains reconstructed') return [ (self.xd_steel, self.m_steel), (self.xd_concrete, self.m_concrete), (self.xd_ifc, self.m_ifc), ] right_x_s = tr.Property(depends_on=itags_str) @tr.cached_property def _get_right_x_s(self): return BCSlice(slice=self.xd_steel.mesh[-1, :, -1, :], var='u', dims=[0], value=u_max) right_x_c = tr.Property(depends_on=itags_str) @tr.cached_property def _get_right_x_c(self): return BCSlice(slice=self.xd_concrete.mesh[0, :, 0, :], var='u', dims=[0], value=0) left_x_s = tr.Property(depends_on=itags_str) @tr.cached_property def _get_left_x_s(self): return BCSlice(slice=self.xd_steel.mesh[0, :, 0, :], var='f', dims=[0], value=0) bc = tr.Property(depends_on=itags_str) @tr.cached_property def _get_bc(self): return [self.right_x_s, self.right_x_c] record = { 'Pw': Vis2DFW(bc_right='right_x_s', bc_left='left_x_s'), 'Pw2': Vis2DFW(bc_right='right_x_c', bc_left='left_x_s'), 'slip': Vis2DField(var='slip'), 'shear': Vis2DField(var='shear'), 'omega': Vis2DField(var='omega'), 's_pi': Vis2DField(var='s_pi'), 's_el': Vis2DField(var='s_el'), 'alpha': Vis2DField(var='alpha'), 'z': Vis2DField(var='z'), 'strain': Vis3DTensorField(var='eps_ab'), 'stress': Vis3DTensorField(var='sig_ab'), # 'damage': Vis3DStateField(var='omega_a'), # 'kinematic hardening': Vis3DStateField(var='z_a') } def get_window(self): fw = Viz2DFW(name='Pw', vis2d=self.hist['Pw']) fw2 = Viz2DFW(name='Pw2', vis2d=self.hist['Pw2']) fslip = Viz2DField(name='slip', vis2d=self.hist['slip']) fshear = Viz2DField(name='shear', vis2d=self.hist['shear']) fomega = Viz2DField(name='omega', vis2d=self.hist['omega']) fs_pi = Viz2DField(name='s_pi', vis2d=self.hist['s_pi']) fs_el = Viz2DField(name='s_el', vis2d=self.hist['s_el']) falpha = Viz2DField(name='alpha', vis2d=self.hist['alpha']) fz = Viz2DField(name='z', vis2d=self.hist['z']) w = BMCSWindow(sim=self) w.viz_sheet.viz2d_list.append(fw) w.viz_sheet.viz2d_list.append(fw2) w.viz_sheet.viz2d_list.append(fslip) w.viz_sheet.viz2d_list.append(fs_el) w.viz_sheet.viz2d_list.append(fs_pi) w.viz_sheet.viz2d_list.append(fshear) w.viz_sheet.viz2d_list.append(fomega) w.viz_sheet.viz2d_list.append(falpha) w.viz_sheet.viz2d_list.append(fz) strain_viz = Viz3DTensorField(vis3d=s.hist['strain']) w.viz_sheet.add_viz3d(strain_viz) stress_viz = Viz3DTensorField(vis3d=s.hist['stress']) w.viz_sheet.add_viz3d(stress_viz) return w