Professional Documents
Culture Documents
APDL
APDL
Presentation Topics
Introduction
What is APDL? What can you do with APDL? Features of APDL Advantages and Disadvantages of APDL
z z z z z z z z
APDL Basics B i Parametric Modeling Importing/Exporting data in/out of ANSYS C t Customized i d menus and d toolbars t lb Storing macros Encrypting macros M Macro example l Consulting examples:
APDL is a scripting p g language g g used to automate and customize tasks in ANSYS APDL combines ANSYS commands with FORTRAN-like functions APDL is used to do many of the operations done by user-subroutines in other FE codes Create parametric models to quickly evaluate design changes Create macros to automate complex or often-repeated tasks Import and export data to external files Perform scalar, vector, and matrix operations Create simple customized menus and toolbar items Macros, if-then-else branching, do-loops, and scalar, vector, and matrix operations. Macros are APDL routines Virtually all ANSYS commands can be used in APDL
Computer Aided Engineering Associates, Inc. 3
Features of APDL
Automation
Create g geometry y with a new set of dimensions ( (Parametric Modeling) g) Calculate the volume of all selected elements Convert structural temperatures to heat transfer temperatures Write all of the max. and min. stress/strain components p for the selected element set to a file Calculate the maximum difference in stress over a range of load steps Move the selected nodes and elements by offset values Import shell elements, nodes, and thickness values from an external file Create component sets from node or element lists in an external file
Customization
Create simple input and output menus (*ASK, *MSG, Multipro) Create customized toolbar items to perform common tasks
Computer Aided Engineering Associates, Inc. 4
z z
Price: No extra cost: Included with all ANSYS products Rapid Learning Curve:
Rapid learning curve, primarily devoted to learning ANSYS commands. Can use the jobname.log file to get the ANSYS command equivalent to your menu picks picks. Interpreted (not compiled) so effects of modifications are immediately realizable. APDL Programmers Guide ANSYS Commands Reference CAEA S Seminar: i ANSYS C Customization i i and dP Programming i (APDL) Specially p y compiled p version of ANSYS is not required q
G d Documentation: Good D t ti
Other:
Limited Customization:
Only simple input and message menus can be generated generated. Can be slow for complex operations on large models. User subroutines are generally much faster faster.
Speed:
Scalar Parameters
OR *SET,parameter,value
(example: *SET,A1,12.98)
Array Parameters
Scalar Functions
10
Array Functions
11
*IF statements
Same functionality as IF statements in FORTRAN *IF, *ENDIF,*ELSEIF, and *ELSE commands can be used to perform logical branching operations Syntax: *IF, VAL1, Oper1, VAL2, AND / OR, VAL3, Oper2, VAL4, THEN
12
*DO loops
Same functionality y as *DO loops p in FORTRAN *DO, parameter, ival, fval, inc
Sample Format: *DO, i, 1, 7, 2 *DO, j, 1, 20 n, (i-1)*20 +j, 0.1*j, i-1 *ENDDO ENDDO *ENDDO
*DOWHILE loops
*DOWHILE, parameter Loops repeatedl repeatedly thro through gh the ne next t *ENDDO command as long as parameter is true (greater than zero)
Computer Aided Engineering Associates, Inc. 13
14
15
File > Read input from (input file name) Command Line: /input,filename,ext Utility Menu > Macro > Execute Macro Use a macro command format: filename.mac
16
Parametric Modeling
Parametric models can be generated to rapidly determine the effect of a design g modification
Recommended procedure:
Create a first pass at a model using parameters for design variables Copy the jobname jobname.log log file to another file name to be used as your parametric input file. Modify the design parameters in the input file Read the input file into ANSYS to solve the new analysis with the design changes
Example: Parametric Plate Model length = 20 width = 5 thick = 0.25 /prep7 rect,0,length,0,width r,1,thick
17
Import p data into ANSYS from an external file using g *VREAD, , *TREAD Export data to an external file from ANSYS using *VWRITE, *MWRITE
Example: Importing data with *VREAD idim = 5 jdim = 2 *dim,aa,,idim,jdim *vread vread,aa(1,1),read2,txt,,KJI,1,jdim,idim aa(1 1) read2 txt KJI 1 jdim idim (2f4.0)
File: read2.txt 11 12 21 22 31 32 41 42 51 52
Copyright 2002 Computer Aided Engineering Associates, Inc.
18
19
20
PTCREATE.MAC: Macro to create and mesh a bracket w1 = 3 w2 = 1 /prep7 rect 0 w1 0 1 rect,0,w1,0,1 rect,0,w2,0,5 aadd,all
21
Storing macros
Macros can be stored in a macro directory and accessed with either _ environment variable or the /PSEARCH the ANSYS_MACROLIB command. Macro files are searched in the following order:
1 ANSYS docu 1. docu directory 2. ANSYS_MACROLIB environment variable (if defined) 3. Users home directory or the directory specified with the /PSEARCH command (if d fi d Utilit defined: Utility M Menu > M Macro > M Macro S Search hP Path) th) 4. Local working directory
22
Encrypting macros
Use the /ENCRYPT command to assign the password and the encrypted macro name Use the /DECRYPT command to enter the password and run the macro
Encrypted Macro EPTCREATE.MAC /DECRYPT,PASSWORD 01 dvg0 01_dvg0 02%WIaIl 03y\!maY%i:#Vp 04i#\KU)b?}Zkp 0CT9FPdX1/? 0DYHLl@ /DECRYPT
Example: Encrypt Macro PTCREATE.MAC /ENCRYPT,pass99,eptcreate,mac /nopr /PREP7 rect,0,w1,0,1 rect,0,w2,0,5 esize,.25 amesh,all /gopr /ENCRYPT
Copyright 2002 Computer Aided Engineering Associates, Inc.
23
Sample Macro
Macro SXYZ.mac: Calculates any stress component at any coordinate in the model
Macro Call: SXYZ, 0.19, 0.14, 0 , x (Calculate the SX Stress at X = 0.19, Y = 0.14, and Z = 0 using averaged nodal stresses)
24
! Usage: sxyz,X,Y,Z,comp ! where: X= x coord. (undef. geom.) ! Y y coord. Y= d ! Z= z coord. ! comp= stress component ! (x,y,z,1,etc. Use eqv as default) /nopr *get,ar20,active,,rout ! If user is in /POST1 proceed *if,ar20,eq,31,then ! Turn off warning messages /uis,msgpop,3 ! ! Set up the path path,path1,2,, ! Define two path points ppath,1,,arg1,arg2,arg3 pp , ,, g , g , g ppath,2,,arg1+.0001,arg2+.0001,arg3 ! ! Map the result onto the path *get,artype,parm,arg4,type ,a type,eq,0,t e *if,artype,eq,0,then arg4= eqv *endif
Copyright 2002 Computer Aided Engineering Associates, Inc.
pdef,S%arg4%,s,%arg4%,avg ! ! Get the result from the first point on the path *get,ar21,path,,item,s%arg4%,pathpt,1 ! ! Print the result *msg msg,ui,arg4,arg1,arg2,arg3,ar21 ui arg4 arg1 arg2 arg3 ar21 The averaged stress S%C at X= %g, Y= %g, Z= %g & %/ is %g ! ! Turn warning messages back on /uis msgpop 2 /uis,msgpop,2 ! *else ! ! Print warning message if user is not in /post1 *msg ui *msg,ui *** You need to be in /POST1 to run SXYZ *** *endif /gopr
25
26
Input Parameters
27
Geometric Variations
28
29
30
31
What is a Stent ?
z z z z
A balloon expanded stent is a small, latticed, metal scaffold that is introduced into y your blood vessel on a balloon catheter. The doctor maneuvers the catheter into the blocked artery and inflates the balloon. Inflation causes the stent to expand and press against the vessel wall. Once the balloon has been deflated and withdrawn, the stent stays in place permanently, holding the blood vessel open and improving blood flow.
32
33
Sample parameters, including the option for the analysis to email results back to the user!
nrep = 6 arep = 0.25 isymm = 2 twall = 0.0055 crpid = 0. desid = 3.0 cdivs = 6 ldivs = 4 issiz = 6 gsfac = 1. 1 numsub = 30 ores = 5 mailit = 1 ! no. of circum. repeating sections ! no. of repeating sections modeled ! 1=no symmetry, 2=symmetry ! wall thickness (inch) ! crimped inner diameter of stent (mm) g expanded p inner diameter of stent ( (mm) ) ! design ! line divisions on circum .boundary lines ! line divisions on long. boundary lines ! smart sizing parameter ! global element sizing factor ! starting number of substeps in each LS ! frequency of writing results ! e-mail results files: 0=no, 1=yes
34
3-D ANSYS model developed through extrusion and coordinate transformation automatically in APDL. APDL
2D Geometry From Parametric a a et c Model ode Cylindrical 3D Mesh with target g surface
Flat 3D Mesh
35
36
Automated Postprocessing
37
Deployed Device
Copyright 2002 Computer Aided Engineering Associates, Inc.
38
39