Elastic Beam Problem without using ANSYS GUI
With this tutorial I'll start a new series of tutorials that I explain how to use Ansys Parametric Design Language (APDL) to create and analyze finite element simulation models. Using APDL, instead of graphical interface may help you significantly if you are want to run your simulation with varying parameters, e.g. optimization, reliability or sensitivity analyses.
Well, I'll start with the simple cantilever beam problem that we may assume the beam remains in elastic.
Before starting to create a simulation model, at least for the beginners of computational mechanics; it's worth to remind that this process has three major phases;
- Pre-prossesing
It is the phase that you (1) create your geometric model, (2) define constitutive parameters, (3) discretize (mesh) the FE model, (4) define boundary conditions, (5) analysis settings and etc.
Started by /PREP7 command in APDL.
- Solution
Its name tells what it is; software tries to approach a solution for defined problem here using a spectrum of solution tools. Modern finite element codes do not require (even allow) too much user intervention in solution step.
Started by /SOLU command in APDL.
- Post-processing
In this phase, software provides a set of tools to retrieve obtained solution results, visualize and plot them.
Started by /POST1 OR /POST26 (time-history) command in APDL.
I'll start with the element definition. Here, we need only one type of element formulation. I strongly recommend you to take a glance at ANSYS Element Reference which you can find detailed information about each element type formulation.
In this problem, BEAM188 element formulation is appropriate to define mechanical problem. Detailed information can be found in Theory Reference. Material Properties will include Young's modulus and Poisson's ratio for structural steel; 200E+09 and 0.3 respectively. Beam section is a 0.1 m x 0.1 m rectangular section and the length is 3 meters.
You can copy and paste following commands to ANSYS Mechanical GUI Command Line and see results interactively. However, the last part that we export results to a text file will not respond to command line; can be called only in batch mode. You can either create an input file contains these command in order and call this file using operating system's terminal.
in Linux I've used;
/usr/ansys_inc/v182/ansys/bin/ansys182 -b -i /home/moyilmaz/Desktop/tutorials/cantilever/cantilever.inp -dir /home/moyilmaz/Desktop/tutorials/cantilever/ -j cantilever_beam
So, the structure should be like
"ansys executable path" -b (calls in batch mode) -i (specifies input file) "path to input file" -dir (specifies directory) "path to working directory" -j "ansys jobname"
1. Adding a new element type
ET,1,BEAM188
2. Adding new keypoints
K,1,0,0,0
K,2,3,0,0
3. Adding a straight line between keypoints
LSTR,1,2
4. Section data input
SECTYPE, 1, BEAM, RECT, SEC1, 5
SECOFFSET, CENT
SECDATA,0.1,0.1,0,0,0,0,0,0,0,0,0,0
5. Material data input
MPTEMP,1,0
MPDATA,EX,1,,200E9
MPDATA,PRXY,1,,0.3
6. Select Line 1
LSEL, , , ,1
7. Set mesh attributes for the selected line
LATT,1, ,1, , , ,1
8. Set mesh size for the selected line
LESIZE,1,.25, , , , , , ,1
9. Discretize the selected line
LMESH,1
10. Select the node in X=0 plane for applying boundary condition
NSEL,S,LOC,X,0
11. Apply fixed restraint
D,ALL,ALL
12. Select the node in X=3 for applying point load
NSEL,S,LOC,X,3
12. Apply the load
F,ALL,FY,-10
13. Select all nodes and elements
ALLSEL
Solution commands
14. Solve the present load case
/SOLU
SOLVE,1
Post-processing commands
15. Plot displaced structure
/POST1
PLDISP,0
16. Define a result parameter and assign the sum-displacement of Node 2
*GET,RES_1,NODE,2,U,SUM
17. Open a blank text file for output
*CFOPEN,output.out
18. Write the result parameter
*VWRITE, 'DMAX:', RES_1
(A6, g16.8)
19. Close the file
*CFCLOSE
Following MATLAB code solves the problem using the analytical approach of beam theory.
b = 0.1;
h = 0.1;
P = 10;
l = 3;
E = 200e9;
I = b*h^3/12;
x = linspace(0,l,20);
v = zeros(1,numel(x));
for i = 1:numel(x)
v(i) = P*x(i)^2/(6*E*I)*(3*l-x(i));
end
plot(x,-v)





Comments
Post a Comment