Introduction to Ansys APDL Programming — Easy Hand-on Bar Example of Learning APDL

The first Finite Element (FE) commercial software I learn is Ansys Workbench, and it is quite intuitive to me to get hand on it for the beautiful user interface, very powerful CAD software-SpaceClaim. Mesh setting and imposing boundary condition are also not that hard for me at the time, but when I first approach to APDL (ANSYS Parametric Design Language), it surprise me in a way that how Ansys code work in behind and makes me want to explore more about where Ansys started it.

Beautiful sunset at McGraw Tower, Cornell University

The quick outline of the hand-on APDL, MAPDL, involves following tasks:

After knowing the outline of the APDL, we can now start to devise the problem that we are going to tackle. For this tutorial, I am going to start with a bar question: with one fixed-ended boundary conditions and another has an applied load.

Applied a load on green side of the bar, and clamp another side of the bar (orange)
! Clear the previous result 
! Element type and material properties
ET, 1, 187 ! ElementType, 1, ElementTypeNumber
MP, EX, 1, 10E6 ! Material Properties: Young's Modulus
MP, NUXY, 1, .3 ! Material Properties: Poisson's ratio
! Geometry and element type
BLOCK, 0, 10, 0, 100, 0, 10
! Volumne mesh
! APPLY BOUNDARY CONDITION: Clamp one end (coordinate origin)
NSEL, S, LOC, Y, 0
D, ALL, ALL, 0
! APPLIED LOAD: Load on another end
NSEL, S, LOC, Y, 100 ! Select Y direction 100 side
NSEL, ALL, FY, 100 ! Select all points on the plane
FINISH ! Solution
! Post-processing
PLNSOL, U, SUM, 0, 1 ! Solve for displacement
Solution derived from the above code

One command that I found very useful if we import geometry (.IGES) file from SOLIDWORK or import Mesh file (.CDB) file from WORKBENCH, the node dimension might change. Therefore, it’s important for us to know the distance between the node, by using the command NDIST(P) we are able to manually select the nodes that we node and obtain the distance between them.

By using DIST(P) command, we are able to manually select the nodes and obtain the distance

Some useful tutorial links:

Thank you for your reading, I hope this helps a bit to your Ansys APDL study!



Home page of Johnny

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store