General Mechanical

General Mechanical

Topics related to Mechanical Enterprise, Motion, Additive Print and more.

How to measure angle of deformation or rotation in ansys apdl ?

    • rahultk1
      Subscriber

      I need to find degree of rotation between two vertebraes. Previous queries were all asked  for workbench. In the classic version, how do we measure it ? My elements are solid185

    • sk_cheah
      Subscriber

      You could try a Google search for "ansys euler angle". A possible way is to define a coordinate using NWPLAN  & CSWPLA from 3 nodes, then extract the angles via *GET, par, CDSY, N, ANG, xy for example for THXY rotation. With two coordinates, you could work on getting the relative rotation matrix via dot product described here


       


      Kind regards, 
      Jason

    • rahultk1
      Subscriber

       Hi Jason,


      Thanks for the prompt reply. I followed your advice and defined a local CWS on top of a vertebrae, and after extracting using *GET, the angles are showing same before and after the simulation. Maybe i am not able to grasp properly and i use GUI, still a novice learner yet. Below are the codes and a sample pic of the model. 


      NWPLAN,-1,  157797,  157800,  157798


      CSWPLA,11,2,1,1,


      *get, par, CDSY, 11, ang, xy


      *get, par, CDSY, 11, ang, yz


      *get, par, CDSY, 11, ang, zx

    • sk_cheah
      Subscriber

      Your code needs to be modified a bit to capture all 3 different angles.


      *get, parXY, cdsy, 11, ang, xy
      *get, parYZ, cdsy, 11, ang, yz
      *get, parZX, cdsy, 11, ang, zx

      Next, you could try UPGEOM to have the nodes be at their deformed position before applying the same method. 


       


      Kind regards,
      Jason

    • rahultk1
      Subscriber

      Hi Jason,


      sorry, that too didn't work. I am getting the same values.


       


      .

    • sk_cheah
      Subscriber

      Did you solve your model and use UPGEOM before extracting the angles again? Below is a sample code that shows initial rotation of 45 degrees and final rotation of 50 degrees. 


      !%%  Example of extracting angles with NWPLAN & UPGEOM

      /filname, file ! defined for RST file name later
      tol=0.01
      *dim, cs0, array, 3,1 ! stores 3 node numbers for axis
      *dim, rot0, array, 3,1 ! rotation angles before
      *dim, rot1, array, 3,1 ! rotation anglse after

      ! simple block
      /prep7
      block, -0.5,0.5, -0.5,0.5, 1,2
      mp, ex, 1, 1e9
      mp, dens, 1, 1
      et, 1, 185
      esize, 0.25
      vmesh, all
      et,2,21, 0 ! mass 21 for pivot point
      r,2, tol,tol,tol, tol,tol,tol
      *get, nmax, node, 0, count
      type, 2
      real, 2
      n, nmax+1, 0, 0, 0.5
      e, nmax+1

      ! node numbers used to define coordinates
      nsel, s, loc, z, 2-tol, 2+tol
      nsel, r, loc, x, -0.5-tol, -0.5+tol
      nsel, r, loc, y, -0.5-tol, -0.5+tol
      *get, cs0(1), node, 0, num, min
      nsel, s, loc, z, 2-tol, 2+tol
      nsel, r, loc, x, 0.5-tol, 0.5+tol
      nsel, r, loc, y, -0.5-tol, -0.5+tol
      *get, cs0(2), node, 0, num, min
      nsel, s, loc, z, 2-tol, 2+tol
      nsel, r, loc, x, -0.5-tol, -0.5+tol
      nsel, r, loc, y, 0.5-tol, 0.5+tol
      *get, cs0(3), node, 0, num, min

      ! face that connects to pivot point
      nsel, s, loc, z, 1-tol, 1+tol
      cm, botface, node
      alls

      ! rotate block
      local, 11, 0, 0, 0, 0.5
      local, 12, 0, 0, 0, 0.5, 0,45,0 ! rotates 45deg about X axis
      csys, 11
      vtran, 12, all,,,,0,1 ! moves block to new coordinate

      ! connects face to pivot point
      et, 3, 173, ! conta173
      et,4,170 ! targe170
      keyo,4,2,1 ! Don't fix the pilot node
      keyo,4,4,0 ! Activate all DOF's due to large deformation
      keyo,3,12,5 ! Bonded Contact
      keyo,3,4,2 ! Rigid CERIG style load
      keyo,3,2,2 ! MPC style contact
      cmsel, s, botface
      esln
      type, 3
      real, 3
      esurf

      type, 4
      real, 3
      tshap, pilo
      e, nmax+1

      ! get angles before solution
      alls
      nwplan, 100, cs0(1), cs0(2), cs0(3)
      cswpla, 100, 0
      *get, rot0(1), cdsy, 100, ang, xy
      *get, rot0(2), cdsy, 100, ang, yz
      *get, rot0(3), cdsy, 100, ang, zx

      ! display angles as originally prescribed
      *stat, rot0

      ! solves with another 5 degrees added
      /solu
      csys,0
      antype, static
      alls
      nlgeom, on
      d, nmax+1, ux, 0
      d, nmax+1, uy, 0
      d, nmax+1, uz, 0
      d, nmax+1, rotz, 0
      d, nmax+1, rotx, 0.087266462599716 ! rotate by x axis again (0.08726 radians = 5degrees)
      d, nmax+1, roty, 0
      solve

      /post1
      set, last
      *get, substepnum, active, 0, set, sbst
      /prep7
      alls
      upgeom, 1, 1, substepnum, file, rst ! updates geometry
      nwplan, 101, cs0(1), cs0(2), cs0(3)
      cswpla, 101, 0
      *get, rot1(1), cdsy, 101, ang, xy
      *get, rot1(2), cdsy, 101, ang, yz
      *get, rot1(3), cdsy, 101, ang, zx

      ! display angles after rotation
      *stat, rot1

       


      Kind regards,
      Jason

    • rahultk1
      Subscriber

      Hi Jason,


      Thanks for the code. I could solve my problem. I didn't defined another co-ordinate system after solving. Therefore,it was showing the same values.


      regards


      Rahul

Viewing 6 reply threads
  • The topic ‘How to measure angle of deformation or rotation in ansys apdl ?’ is closed to new replies.