## Posts

Showing posts from October, 2017

### Defining Ansys Superelement SUB File Manually

Photo by  James Owen  on  Unsplash A surprisingly popular blog-post written here is Exporting Stiffness Matrix from Ansys . A sensible follow up question is what can one do with the exported stiffness matrix? In a recent Xansys Forum post, a question was raised on how we can edit the stiffness matrix of a superelement and use it for our model.  An approach presented below is to first create a superelement that has the same number of DOF and nodal location that will serve as a template. An APDL script can then be written to edit the stiffness matrix entries as desired before exporting to a new superelement *.SUB file for use in future models. The self-contained script below demonstrates this.  /prep7 et ,1, 185 mp , ex, 1, 200e3 mp , prxy, 1, 0.33 w = 0.1 ! single element (note nodal locations) n , 1, w, -w, -w n , 2, w, w, -w n , 3, -w, w, -w n , 4, -w, -w, -w n , 5, w, -w, w n , 6, w, w, w n , 7, -w, w, w n , 8, -w, -w, w e , 1, 2, 3, 4, 5, 6, 7, 8 /solu antype , substr     ! analy

### SpaceClaim - Eye

The Original  Eye * SpaceClaim has a pretty neat feature of being able to import pictures. This comes in useful when trying to compare a picture of a part cross-section to the CAD. Rough dimensional analysis can be done. To take it a step further, the model could be updated so that the contours match the cross section picture. Other uses for it is to help 'inspire' CAD when the models are created from scratch. More accurate proportions and curvatures could be represented in the model. An example of which is shown below where the  vitreous humor and  crystalline lens of a  Wikipedia  picture was approximated. The Scary Eye We could insert the picture here: Insert Picture File here With the picture imported, it could be used as a background image for tracing splines to recreate key features. For example, two areas were recreated here: Adding Splines to Create Areas Another view of the model: Areas at Different Plane from Picture Given a bit m

### Ansys Euler Angle Calculation

Tait-Brian Angles Z-X'-Y''  * After a simulation is complete, it is sometimes useful to know how much the overall object is rotated and translated. This is true especially for rigid body objects. While simple in 2D, it gets more complicated for 3D rotations. Euler angles always makes my head spin. A rotating reference frame? *   Ansys uses the Z-X'-Y'' sequence  for defining the coordinate system but there is also the *GET command to extract the Euler Angles of a Local Coordinate System. So let's say you have 3 nodes on a rigid beam that has been rotated and translated in 3D space. One could do it the hard way by starting with the general definition of R in the Rotation Matrices and go in reverse to get the angles with some fun scripting in your math package of choice. Or... the easy way: define a local coordinate system using NWPLAN at the deformed nodes at each result time step and use the *GET command to extract angles. *dim , MyAngles,

### Export Stiffness Matrix from Ansys

It is sometimes useful to extract the mass and stiffness matrix from Ansys.     *SMAT, MatK, D, IMPORT, FULL, file.full, STIFF       *PRINT, matk, matk, txt Exporting mass matrix would be similar:       *SMAT, MatM, D, import, full, file.full, MASS The above script uses APDL Math to get the job done. (Please see previous post for another example). The ordering of the matrix is unfortunately not concurrently exported. To verify the sequencing is as expected, we will work to replicate a truss example in the  Finite Element Trusses course notes by Bob Greenlee. Figure 1: Truss Problem Setup Model Creation Script to create model: /prep7 !! Creates Model to reflect course notes ! Properties et ,1,1  mp , ex, 1, 29.5e6 r , 1, 1 ! Geometry n ,1 $n ,2, 40$  n ,3, 40, 30 $n ,4, 0, 30 e ,1,2$  e ,2,3 $e ,1,3$  e ,3,4 ! Boundary Conditions d ,1,ux,0 $d ,1,uy,0 d ,2,uy,0 d ,4,ux,0$  d ,4,uy,0 f ,2,fx,20e3 f ,3,fy,-25e3 ! solves /solu eqslv , sparse

### Ansys APDL - Some Neat Commands

For those starting out, here's a few commands I find pretty neat. If you're not familiar with them, it's worth checking out. NDNEXT & ELNEXT When looping through a bunch of nodes or elements, this provide some convenience.   /post1     cmsel , s, NodesOfInterest     *get , ncount, node, 0, count     *dim , uxsave,, ncount, 2     nnow = 0     *do ,ct,1,ncount        nnow = ndnext(nnow)       uxsave(ct, 1) = nnow        *get, uxsave(ct, 2), node, nnow, u, x       *enddo   *stat , uxsave Alternately, one could instead use fancier commands:  *VGET with *VMASK   cmsel , s, NodesOfInterest   *get , nmx, node,, num, max    *get , ncount, node,, count      *dim , ndata,, nmx, 3   *dim , nkeep,, ncount, 2       *vget , ndata(1,1), node, 1, nsel   *vfill ,ndata(1,2),ramp,1,1   *vmask , ndata(1,1)    *vget , ndata(1,3), node, 1, u, x       *vmask , ndata(1,1)   *vfun , nkeep(1,1), comp, ndata(1,2)    *vmask , ndata(1,1)   *vfun , nkeep(1,2), comp,