## Posts

Showing posts from 2017

### Weld Analysis with Ansys

Figure 1: Equivalent Stress of White Paper Model
There are many software out there now that does weld analysis. Among others...
For fatigue type analysis, there are: FE-Safe (Verity Method) & Ncode (Volvo Method)
For static type analysis, there are: FEWeld & EDRMedeso

A good reference classic book is Blodgett's Design of Welded Structures. This book is a real gem. Here are two links to a short write-up by the same author et al: Design for Welding & Welded Connections

White Paper
I came across this really good white paper by Weaver Engineering that had a worked example comparing both hand calculation to their software along with in depth discussions. The example was detailed enough to be replicated. This is a great stepping stone when following the crawl-walk-run philosophy.

A critical step in setting up the model is highlighted in Figure 2. Nodal Forces has to be computed for later post processing and "Save MAPDL db" is required for later named …

### MAC with Ansys for Measurement Locations

Where should the accelerometers be placed? - Test Person Test People are tough to work with! I was one before so I would know. Have a bit of sympathy for them though as they could be frantically troubleshooting equipment in the middle of no-where or spend countless hours rolling-and-unrolling cables.

Goal of Measurement Points Selection
OK, we have a model with natural frequencies and mode shapes. If your company is well endowed, this is a simple question with pretest software like FEMtools or some other software that optimizes the MAC matrix. This would also help with correlation later. Generally speaking, the software will maximize the diagonal matrix while minimize the off diagonal matrix values. Loosely defined, this means the modes are relatively unique (mathematically speaking) for the chosen measurement locations.

Poor Man's Method for Picking Measurement Locations
Alternately, we can pick measurement locations by hand based on past experience and liberal use of engineering …

### DesignXplorer Design Point Alternative Save

Solving for many cases with small variations using DesignXplorer is quite convenient. After setting up an initial model, a parameter could be defined in SpaceClaim or elsewhere. The solution for multiple design points are then generated as I sip on my beer (legally at home).

As shown in this YouTube Video, the output parameters are single values like natural frequency, displacements and other maximum or minimum of available solution results. Unfortunately if you are interested in more complicated items that aren't easily available through the user defined results or *GET commands, how do you capture that output parameter?

One way would be to retain all design point results for later post processing but that would be overkill especially since I'll have to go into everyone of them to extract out the information which is a pain.

Alternately, a post-processing APDL script could be written to extract out key information at each run. An example would be the mode shape of a beam. Wi…

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

*vfun, nkeep(1,1), comp, ndata(1,2)
*vfun, nkeep(1,2), comp, ndata(1,3)
*stat, nkeep

q=UX(N)
This is equivalent to the above *get, q, node, N, u, x
Other succinct functions can be found here.

/PLOPTS, DATE, 0
Thi…

### Mesh Convergence Study

In a previous post, I mentioned mesh convergence study is not done as often it should. I've been reminding myself to be careful in reporting stress results using sanity checks. A nagging question persists in my mind: "How much should the mesh be refined before calling it good? Is a factor of 2 good enough?"

A presentation here at Ruhr-Universität Bochum is quite interesting. It presented a linear Richardson Extrapolation being:
fex = fn+ k(fm - fn) where...
fexis the exact solution
fm is the solution at mesh size m
fn is the solution at mesh size n
k is what I'll call Richardson Extrapolation Factor:

k = (mα) / (mα - nα)
where α=2 for linear elements and α=3 for quadratic elements. To plot this factor k relative to the reduction factor (n/m) in Figure 1:

Figure 1: Richardson Extrapolation Factor
It is interesting that for quadratic elements, with a mesh size reduction by a factor of two, the factor is 114.3%. Hypothetically, wouldn't it be great if, for example, on…

### Do you double-click?

In Ansys Mechanical, there are a lot of drop-down selections. Instead of clicking on the down arrow, try double-clicking on the current selection. The selection would cycle to what's next on the list.

This is convenient when I want to create multiples of an object (e.g. contacts or bolt pretension) with the only difference being the named selection. After setting up the first object as I like it, I then Right-Mouse-Button "Duplicate" and double-click on the named selection to cycle through the named selection. This of course only works if the named selection was already created as part of the workflow that is named sequentially (e.g. bolt1, bolt2, bolt3... (or) fric1a, fric1b, fric2a, fric2b...)

Double-clicking also works for a slew of drop-downs in Analysis Settings.

p/s: Creating an ACT script would be more efficient but the conventional/lazy way above could be faster if future projects would rarely need it.

### Unintended Interference

If you're not careful, you'll end up like me with unintended interference. The problem can be illustrated with a pin and hole-part assembly. Three identical geometry assemblies are created. From left to right, firstly a Tet mesh, then two others of different Hex mesh controls (Figure 1). Though the pin has the same diameter as the hole diameter, there may be interference in the model due to geometry discretization.

Figure 1: Identical Geometry but Different Mesh
The difference in results are clear from the contact pressure shown in Figure 2:
Figure 2: Contact Pressure at Frictionless Contacts
The coarse Tet mesh does not 'curve' well (Figure 3) thus bumping into each other. The interference in the second assembly with hex mesh is less acute but still present (Figure 4). The third assembly with hex mesh with nodes of both the pin and hole aligned has no interference (Figure 5) hence almost no pressure.

Figure 3: End View Tet Mesh Shows Interference at Hole
Figure 4: End…

### Increasing Number of Iteration per Substep

Recently I came across a problem where the large deflection solution that has Body-to-Body beam connection that wouldn't converge. Ansys bisected at the maximum number of  iterations (26) and then halved the load step again... and again...

The trick was to add a command snippet in the solve section:

...with the following text containing NEQIT to increase the maximum number of iterations per substep :
neqit, 75

and VOILA! It Solves!

### Harmonic MSUP Using the Multiple SOLVE Method

Triangle Wave by Fourier Series*
In the Ansys APDL documentation of Mode-Superposition Harmonic Analysis and other Verification Manual documentation (e.g. VM76VM149), only load step file method was described. Personally, I favor Multiple Solve Method instead because you can vary the loads for different frequencies. This could come in handy for different loads at various engine orders or rotating unbalance force. Or say if you have the Fourier coefficients of the periodic force of irregular form (e.g. triangle wave), the steady state response can be computed.

The APDL script below replicates VM183 but uses the Multiple Solve Method. Do let me know if you could recommend ways to improve the script.

Script
!!   Modified from VM183 to use Multiple SOLVE Method
!!   Results should be identical to VM183
! Author: Sze Kwan (Jason) Cheah
! Modified: August 27, 2017
! Disclaimer: Use at own risk!

/PREP7
ANTYPE, MODAL        ! MODE - FREQUENCY ANALYSIS
MODOPT, LANB,2,,,
ET,1,COMBIN40,,,2    …

### Text List of Named Selections

PADT's script on writing out named selections to a text file in the ACT Console did not work for me when I copied-and-pasted it into the ACT console. Perhaps it was meant to be used with Linux OS? I tweaked the code a little for my Windows 10, Ansys WB 18.1. Here's my take:

a = ExtAPI.DataModel.AnalysisList[0]  #Get the first Analysis if multiple are present
workingdir = a.WorkingDir
path = workingdir.split("\\")

#Put the output file in the "user_files" directory for the project.
slashes = '\\'
userdir = slashes.join(path[:len(path)-4])+'\\user_files'

#Use the name of the system in case the snippet is
#used on multiple independent systems in the project.
system_name=a.Name
system_name.replace(' ','_')
model = ExtAPI.DataModel.Project.Model
nsels = model.NamedSelections  #Get the list of Named Selections

if nsels:
f = open("%s\\%s_named_selections_checked.txt"%(userdir,system_name), "w")
for child in nsels.Children:
…

### Craig Bampton Method

In a previous post, the Craig-Bampton (CB) substructuring method was used in Ansys to simplify a part for reuse. To learn more about what Ansys does in the background, I did some reading up. Here are some good resources:

Resources