Skip to main content

APDL Math Example

I read about APDL Math a few years ago with much intrigue. A very interesting write-up about it can be found here. What stood out to me was the possibility of computing modal sensitivity relative to different variables similar to what SOL 200 offers in NASTRAN for optimization.

Web Resources
Ansys Help Document: The commands are documented though the available examples are limited
PADT Blog Post: Eric's article gives a good overview of the capabilities
Ansys Knowledge Resource #2025879: Additional guidance in usage.
PADT Blog Post [Edit: Sept 12, 2017]: Awesome post! Results back in 'User Ordering'!
AnsysTips Blog Post [Edit: Oct 11, 2017]: Export Stiffness Matrix

Unfortunately, that's about all I could find anywhere.

APDL Math Example Overview
DOF ordering is not addressed here. I have not yet figured out a good way to do it yet so please share if you can convert to the 'user ordering' all in one shot.

Please see the script on how the solution was performed. The secret sauce is to first export mass and stiffness matrix before computing the natural frequency and mode shapes.
! Extract mass and stiffness matrix
*smat, k0, D, import, full, model0.full, stiff
*smat, m0, D, import, full, model0.full, mass

!!! solves modal
antype, modal
modopt, lanb, 10
*eigen, k0, m0, , eigV0, eigM0

To gain an understanding of it's usage, I wrote up a simple script to compute the natural frequencies of a simple plate. After which, the modal sensitivity is calculated via matrix multiplication to estimate the new natural frequency assuming a 1% increase in modulus of elasticity for all elements. Two methods are used. Richardson & Mannan (RM) has a squared relationship:

In "Modal Analysis Theory and Testing" book by Heylen, Lammens & Sas (HLS), they show it inversely proportional to natural frequency:

In the example script, both sensitivities were used as linear gradients to extrapolate linearly to the 'modified' natural frequency that has a 1% increase in stiffness. The results are shown in the table below.

Natural Frequency Comparison

Computed errors were less than 20% which isn't great by most measures. The derivation of both sensitivities notes accuracy drawbacks due to many approximations. Despite the errors, sensitivities values can be computed quickly and can be extremely useful in structural modifications and aid redesign.

The APDL script can be downloaded here:
sensitivity_v2.inp [link]
FromWB.dat [link]

sensitivity_v2.inp calls FromWB.dat to create a simple Workbench generated geometry.

Related post on exporting stiffness matrix using APDL Math: Link


Post a Comment

Popular posts from this blog

ANSYS User Defined Results

There is an abundant of options in ANSYS classic when one wishes to post process results. ANSYS workbench default pull down menu post processing options are more limited but they can still be accessed via the User Defined Results. One way not commonly used but can come in handy is as follows: Zeroth: Under Analysis Settings, there is "Output Controls" where you can toggle to "Yes" what you would like to save before the solution starts. This is like OUTRES in APDL. Output Controls First: After solving the model, click on Solution in the tree to highlight it. Solution Second: Click on Worksheet in the toolbar. Worksheet Third: In the worksheet, you will see list of results that are saved. Right click on it to create the User Defined Results. Create User Defined Results So here we have it. You could of look up the different expressions in the help document but I find this method of accessing the results convenient.  Example: Aspec

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 Syntax Highlighting editor

Notepad++ with APDL User Defined Language The editor of my choice is Notepad++  with the available User Defined Language Files for APDL . You can install it without administrative privileges via the zip file. The best part of it is, it's FREE! After installing Notepad++, go to "Language>Define Your Language..." then "Import" the XML file downloaded from the above link. Remember to restart Notepad++ so that the language changes will take into effect. Opening up any *.inp or *.ans files should automatically switch highlighting to APDL. I made some minor edits. Here's my XML file: LINK . I also heard Sublime Text and  Ultraedit  has more advance features but they aren't (totally) free.