#compute new velocity Uo[:] = Uo + Uoo * dt #compute new dispalacement U[:] = U + Uo * dt # dispalacement boundary condition imposition U[DDL_U_Bloc] = 0. U[DDL_V_Bloc] = 0. U[DDL_W_Bloc] = 0. # out sigma mises, and displacement for # paraview eatch nb_inc_out increment if not inc % nb_inc_out: # compute sigma mises SigMis[:]=((Stress[0::6]-Stress[1::6])**2+\ (Stress[0::6]-Stress[2::6])**2+\ (Stress[1::6]-Stress[2::6])**2+\ 6*(Stress[3::6]**2+\ Stress[4::6]**2+\ Stress[5::6]**2)) # out outvar.vtk(XYZ_Noeud[0:n, :], IN_Tri_Ini, SigMis, U.reshape((n, 3)), inc) t += dt inc += 1 #-------------------------------------------------------------------------------
n_C_ext = np.array(Ind_Noeud_Front[0:Nb_Noeud_Front[0]]) n_C_int = np.array(Ind_Noeud_Front[Nb_Noeud_Front[0]:]) T = np.zeros(n) T[n_C_ext] = T1 T[n_C_int] = T2 DDL_bloc = np.hstack([n_C_ext, n_C_int]) DDL_bloc = np.unique(DDL_bloc) DDL_Tot = np.array(range(n)) DDL_Libre = np.setdiff1d(DDL_Tot, DDL_bloc) b = -(MK[:, DDL_bloc] * T[DDL_bloc]) MK = MK[DDL_Libre, :] MK = MK[:, DDL_Libre] #solve the linear problem T[DDL_Libre] = spsolve(MK, b[DDL_Libre]) #T[DDL_Libre]=gmres(MK,b[DDL_Libre])[0] #------------------------------------------------------------------------------- # write the result : print '\n--------------------------------------------------------------------------------\n' print 'write result to vtk format for paraview' outvar.vtk(XY_Noeud, Tri, T, None, 0) #-------------------------------------------------------------------------------
UV[DDL_V_y_1] = 0. UV[DDL_V_y_1] = 0. DDL_bloc = np.hstack([DDL_U_y_0, DDL_V_y_0, DDL_U_y_1, DDL_V_y_1]) DDL_bloc = np.unique(DDL_bloc) DDL_Tot = np.array(range(2 * n)) DDL_Libre = np.setdiff1d(DDL_Tot, DDL_bloc) b = -(MK[:, DDL_bloc] * UV[DDL_bloc]) MK = MK[DDL_Libre, :] MK = MK[:, DDL_Libre] #solve the linear problem UV[DDL_Libre] = spsolve(MK, b[DDL_Libre]) #UV[DDL_Libre]=gmres(MK,b[DDL_Libre])[0] Strain = B * UV Stress = C * Strain Stress = Stress.reshape((np.size(Stress, 0) / 3, 3)) UV = UV.reshape((np.size(UV, 0) / 2, 2)) #------------------------------------------------------------------------------- # write the result : print '\n--------------------------------------------------------------------------------\n' print 'write result to vtk format for paraview' outvar.vtk(XY_Noeud, Tri, Stress, UV, 0) #-------------------------------------------------------------------------------
T1 = 0 T2 = 1 T = np.zeros(n) T[n_C_ext] = T1 T[n_C_int] = T2 DDL_bloc = np.hstack([n_C_ext, n_C_int]) DDL_bloc = np.unique(DDL_bloc) DDL_Tot = np.array(range(n)) DDL_Libre = np.setdiff1d(DDL_Tot, DDL_bloc) b = -(MK[:, DDL_bloc] * T[DDL_bloc]) MK = MK[DDL_Libre, :] MK = MK[:, DDL_Libre] #solve the linear problem T[DDL_Libre] = spsolve(MK, b[DDL_Libre]) #T[DDL_Libre]=gmres(MK,b[DDL_Libre])[0] #------------------------------------------------------------------------------- # write the result : print '\n--------------------------------------------------------------------------------\n' print 'write result to vtk format for paraview' outvar.vtk(XYZ_Noeud, IN_Tet, T, None, 0) #-------------------------------------------------------------------------------
UVP[DDL_V_x_0]=0. UVP[DDL_V_y_0]=0. UVP[DDL_V_y_1]=0. UVP[DDL_U_c_int]=0. UVP[DDL_V_c_int]=0. DDL_bloc=np.hstack([DDL_U_x_0,DDL_V_x_0,DDL_V_y_0,DDL_V_y_1,DDL_U_c_int,DDL_V_c_int]) DDL_bloc=np.unique(DDL_bloc) DDL_Tot=np.array(range(3*n)) DDL_Libre=np.setdiff1d(DDL_Tot,DDL_bloc) b=-(MK[:,DDL_bloc]*UVP[DDL_bloc]) MK=MK[DDL_Libre,:] MK=MK[:,DDL_Libre] #solve the linear problem UVP[DDL_Libre]=spsolve(MK,b[DDL_Libre]) #UVP[DDL_Libre]=gmres(MK,b[DDL_Libre])[0] UVP=UVP.reshape((np.size(UVP,0)/3,3)) #------------------------------------------------------------------------------- # write the result : print '\n--------------------------------------------------------------------------------\n' print 'write result to vtk format for paraview' outvar.vtk(XY_Noeud,Tri,UVP[:,2],UVP[:,[0,1]],0) #-------------------------------------------------------------------------------
UVW[DDL_W_z_1]=0. DDL_bloc=np.hstack([DDL_U_z_0,DDL_V_z_0,DDL_W_z_0,DDL_V_z_1,DDL_U_z_1,DDL_W_z_1]) DDL_bloc=np.unique(DDL_bloc) DDL_Tot=np.array(range(3*n)) DDL_Libre=np.setdiff1d(DDL_Tot,DDL_bloc) b=-(MK[:,DDL_bloc]*UVW[DDL_bloc]) MK=MK[DDL_Libre,:] MK=MK[:,DDL_Libre] #solve the linear problem UVW[DDL_Libre]=spsolve(MK,b[DDL_Libre]) #UVW[DDL_Libre]=gmres(MK,b[DDL_Libre])[0] Strain=B*UVW Stress=C*Strain; Stress=Stress.reshape(Stress.shape[0]/6,6) UVW=UVW.reshape((UVW.shape[0]/3,3)) #------------------------------------------------------------------------------- # write the result : print '\n--------------------------------------------------------------------------------\n' print 'write result to vtk format for paraview' outvar.vtk(XYZ_Noeud,IN_Tet,Stress,UVW,0) #-------------------------------------------------------------------------------