# POST-PROCCESSING # start_time = datetime.now() # Sets axis for visualization window xmin, xmax, ymin, ymax = pos.axisscale(COORD, nn) # Plot displacement solution pos.plotdis(IBC, UG, nodes, nn, xmin, xmax, ymin, ymax) # Generates displacement solution to be post-processed via Gmesh pos.gmeshpost(IBC, nn, UG) nomfile1 = '../MESHUTIL/' + name + '.msh' nomfileH = '../MESHUTIL/' + name + 'H.msh' nomfileV = '../MESHUTIL/' + name + 'V.msh' nomfileF = '../MESHUTIL/' + name + 'F.msh' shu.copy(nomfile1, nomfileH) shu.copy(nomfile1, nomfileV) shu.copy(nomfile1, nomfileF) # Scatters nodal displacements over the elements # and plots strain solution. (Activate if required.) # # Scatter displacements over the elements UU = pos.scatter(DME, UG, ne, neq, elements) # Generates points inside the elements and computes strain solution EG, XS = pos.strainGLO(IELCON, UU, ne, COORD, elements) # Plot strain solution pos.plotstrain(EG, XS, xmin, xmax, ymin, ymax) end_time = datetime.now() print('Duration for post processing: {}'.format(end_time - start_time)) print('Program terminated succesfully!') plt.show()
# Solves the system UG = np.linalg.solve(KG, RHSG) if not(np.allclose(np.dot(KG, UG), RHSG)): print("The system is not in equilibrium!") end_time = datetime.now() print('Duration for system solution: {}'.format(end_time - start_time)) #%% # POST-PROCCESSING # start_time = datetime.now() UC = pos.complete_disp(IBC, nodes, UG) pos.plot_disp(UC, nodes, elements) # Scatter displacements over the elements UU = pos.scatter(DME, UG, ne, neq, elements) pos.gmeshpost(IBC, nn, UG, folder=folder) # Generates points inside the elements and computes strain solution E_nodes, S_nodes = pos.strain_nodes(IELCON, UU, ne, COORD, elements, mats) pos.plot_strain(E_nodes, nodes, elements) pos.plot_stress(S_nodes, nodes, elements, plt_type="pcolor") eigs1, eigs2, vecs1, vecs2 = pos.principal_dirs(S_nodes) tri = pos.mesh2tri(nodes, elements) pos.tri_plot(tri, eigs1, title=r"Maximum stress: $\sigma_1$") plt.quiver(nodes[:, 1], nodes[:, 2], vecs1[:,0], vecs1[:,1], pivot="middle", headwidth=1.5, headlength=2.5) end_time = datetime.now() print('Duration for post processing: {}'.format(end_time - start_time)) print('Program terminated succesfully!') plt.show()