## Posts

Showing posts from October, 2017

### 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 more time finessing the initial areas and r…

### 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, ,3

*dim, MyDisp, ,3
nwplan…

### 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
wrfull, 1
solve
finish
save

Extract & Export Stiffness Matrix
With the file.full file of the FEM mo…

### 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

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
*vget, ndata(1,3), node, 1, u, x