shape=(1,), fets_eval=fets_eval ) ts = TS(sdomain=domain, dof_resultants=True ) tloop = TLoop(tstepper=ts, tline=TLine(min=0.0, step=1, max=1.0)) '''Clamped bar loaded at the right end with unit displacement [00]-[01]-[02]-[03]-[04]-[05]-[06]-[07]-[08]-[09]-[10] 'u[0] = 0, u[10] = 1''' domain.coord_max = (10, 0, 0) domain.shape = (10,) ts.bcond_list = [BCDof(var='u', dof=0, value=0.), BCDof(var='u', dof=10, value=1.)] ts.rtrace_list = [RTDofGraph(name='Fi,right over u_right (iteration)', var_y='F_int', idx_y=10, var_x='U_k', idx_x=10)] u = tloop.eval() # expected solution u_ex = array([0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.], dtype=float) difference = sqrt(norm(u - u_ex)) print('difference') # compare the reaction at the left end F = ts.F_int[0] print(F)
fets_eval = FETS1D2L(mats_eval = MATS1DElastic(E=10., A=1.)) # Discretization domain = FEGrid( coord_max = (10.,0.,0.), shape = (1,), fets_eval = fets_eval ) ts = TS( sdomain = domain, dof_resultants = True ) tloop = TLoop( tstepper = ts, tline = TLine( min = 0.0, step = 1, max = 1.0 )) domain.coord_max = (10,0,0) domain.shape = (10,) bc_left = BCSlice( var = 'u', value = 0., slice = domain[ 0, 0] ) bc_right = BCSlice( var = 'u', value = 1., slice = domain[1:,:] ) ts.bcond_list = [ bc_left, bc_right ] # ts.bcond_list = [BCDof(var='u', dof = 0, value = 0.), # BCDof(var='u', dof = 1, link_dofs = [2], link_coeffs = [0.5] ), # BCDof(var='u', dof = 2, link_dofs = [3], link_coeffs = [1.] ), # BCDof(var='u', dof = 3, value = 1. ) ] ts.rtrace_list = [ RTraceGraph(name = 'Fi,right over u_right (iteration)' , var_y = 'F_int', idx_y = 10, var_x = 'U_k', idx_x = 10) ] u = tloop.eval() print 'u',u
if __name__ == "__main__": fets_eval = FETS1D2L(mats_eval=MATS1DElastic(E=10.0)) # Discretization domain = FEGrid(coord_max=(10.0, 0.0, 0.0), shape=(1,), fets_eval=fets_eval) ts = TS(sdomain=domain, dof_resultants=True) tloop = TLoop(tstepper=ts, debug=False, tline=TLine(min=0.0, step=1, max=1.0)) """Clamped bar loaded at the right end with unit displacement [00]-[01]-[02]-[03]-[04]-[05]-[06]-[07]-[08]-[09]-[10] 'u[0] = 0, u[10] = 1""" domain.coord_max = (1, 0, 0) domain.shape = (3,) ts.bcond_list = [ BCDof(var="u", dof=0, value=0.0), BCDof(var="u", dof=1, link_dofs=[2], link_coeffs=[0.5]), BCDof(var="u", dof=3, value=1.0), ] ts.rtrace_list = [ RTraceGraph(name="Fi,right over u_right (iteration)", var_y="F_int", idx_y=3, var_x="U_k", idx_x=3) ] u = tloop.eval() # expected solution print "u", u # compare the reaction at the left end F = ts.F_int[-1]
fets_eval = FETS1D2L(mats_eval=MATS1DElastic(E=10.)) # Discretization domain = FEGrid(coord_max=(10., 0., 0.), shape=(1, ), fets_eval=fets_eval) ts = TS(sdomain=domain, dof_resultants=True) tloop = TLoop(tstepper=ts, debug=False, tline=TLine(min=0.0, step=1, max=1.0)) '''Clamped bar loaded at the right end with unit displacement [00]-[01]-[02]-[03]-[04]-[05]-[06]-[07]-[08]-[09]-[10] 'u[0] = 0, u[10] = 1''' domain.coord_max = (1, 0, 0) domain.shape = (3, ) ts.bcond_list = [ BCDof(var='u', dof=0, value=0.), BCDof(var='u', dof=1, link_dofs=[2], link_coeffs=[0.5]), BCDof(var='u', dof=3, value=1.) ] ts.rtrace_list = [ RTDofGraph(name='Fi,right over u_right (iteration)', var_y='F_int', idx_y=3, var_x='U_k', idx_x=3) ] u = tloop.eval() # expected solution