PROBLEM mechanical # self-descriptive READ_MESH tensile-test.msh # lengths are in mm # material properties, E and nu are "special" variables for the mechanical problem E = 200e3 # [ MPa = N / mm^2 ] nu = 0.3 # boundary conditions, fixed and Fx are "special" keywords for the mechanical problem # the names "left" and "right" should match the physical names in the .geo BC left fixed BC right Fx=10e3 # [ N ] # we can now solve the problem, after this keyword the results will be available for output SOLVE_PROBLEM # essentially we are done by now, we have to write the expected results # 1. a VTK file to be post-processed in ParaView with # a. the displacements [u,v,w] as a vector # b. the von Mises stress sigma as a scalar # c. the six components of the stress tensor as six scalars WRITE_MESH tensile-test.vtk VECTOR u v w sigma sigmax sigmay sigmaz tauxy tauyz tauzx PRINT "1. post-processing view written in tensile-test.vtk" # 2. the displacement vector at the center of the specimen PRINT "2. displacement in x at origin: " u(0,0,0) "[ mm ]" PRINT " displacement in y at (0,10,0): " v(0,10,0) "[ mm ]" PRINT " displacement in z at (0,0,2.5):" w(0,0,2.5) "[ mm ]" # 3. the principal stresses at the center PRINT "3. principal stresses at origin: " %.4f sigma1(0,0,0) sigma2(0,0,0) sigma3(0,0,0) "[ MPa ]" # 4. the reaction at the left surface COMPUTE_REACTION left RESULT R_left PRINT "4. reaction at left surface: " R_left "[ N ]" # 5. stress concentrations at a sharp edge PRINT "5. stress concentrations at x=55, y=10, z=2.5 mm" PRINT "von Mises stress:" sigma(55,10,2.5) "[ MPa ]" PRINT "Tresca stress:" sigma1(55,10,2.5)-sigma3(55,10,2.5) "[ MPa ]" PRINT "stress tensor:" PRINT %.1f sigmax(55,10,2.5) tauxy(55,10,2.5) tauzx(55,10,2.5) PRINT %.1f tauxy(55,10,2.5) sigmay(55,10,2.5) tauyz(55,10,2.5) PRINT %.1f tauzx(55,10,2.5) tauyz(55,10,2.5) sigmaz(55,10,2.5)