Sie sind auf Seite 1von 22

March 21st , 2002

Do Loops Extra! Extra! Training How can PADT Help? PADT Events ANSYS Focus Archives Subscribe / Unsubscribe

March 21st , 2002

DO Loops Program Flow


For those who use APDL, the ANSYS command-line language, DO loops and IF-THEN logic is essential for controlling program flow. If you only use the GUI (M enu Picks) consider adding DO Loops to begin learning ANSYS macro-writing. If you have a repetitive task, using a DO loop can result in a huge time savings:

Case Study:
Apply many different uniform temperatures to a bi-metallic strip and store each solution.

Geometry:

Input File or Equivalent M enu Picks Save as bistrip.db

Boundary Conditions: Apply uniform temperatures from 100, 110, 120 . . . 200. The two strips are bonded together by the geometry, so they share nodes. Fix the Lines at the Left End Input File or Equivalent M enu Picks

Approach:
A) B) C) D) Develop model for single temperature using GUI Build DO Loop M acro Run M acro Review Results

March 21st , 2002

A) Develop working model for single temperature using GUI 1. Build your model using provided input files (1 and 2) or menu picks (1 and 2). 2. Verify that your model solves correctly MENU PICKS /Solution > Solve - Current LS OK Postprocessor > Plot Results > Contour Plot - Nodal Solution Translation USUM OK

INPUT COMMANDS /SOLU SOLVE /POST1 PLNSOL,U,SUM

3.

Save model to bistrip.db

March 21st , 2002

B) Build DO Loop Macro To utilize DO loops you must use APDL (ANSYS Parametric Design Language) a.k.a. macros, a.k.a. scripts. We will take advantage of one of the simplest of macros: Resume from a .db file Perform a single operation Solve. Although you can type *DO commands into the ANSYS input window, here we will use a small macro to implement the DO loop. This DO loop will repeat the TUNIF and SOLVE commands. We will now build the "macro" needed to implement *DO. 1. 2. Open a text editor select one that doesnt store hidden formatting charaters. Copy the following template: fini /clear RESUM E,bistrip,db *DO, icount,1,10,1 /Solu TUNIF,100+icount* 10 TIM E,icount Solve *ENDDO

!resumes saved database !counts on variable icount from 1 to 10 times !switches to solution processor !GUTS -- the action looped on sets new uniform temperature !Note how it uses the varible icount !solve with the new temperature settings !Go back and begin next loop on variable icount

3. Save as bistrip.mac. Note that saving any text file with extension .mac automatically creates a macro such that by simply typing the filename, such as bistrip at the ANSYS command line will cause ANSYS to check for the bistrip.mac file and read it as a series of input commands. ANSYS checks the working directory, the installation/docu directory and any directory specified by the /PSEARCH command for .mac files.

C) Run Macro 1. Inside a fresh session of ANSYS type bistrip at the command line.

March 21st , 2002

D) Review Results 1. General Postprocessor > Results Summary. You should see a listing similar to this:

2. General Postprocessor > Read Results - By Time/Freq . . .Select Time=5 which corresponds to the 150F case 3. General Postprocessor > Plot Results > Contour Plots - Nodal Solution > Deflection > USUM It should look like this:

March 21st , 2002

4. Review each of the 10 results in the results set -- or use Time History PostProcessing to summarize the results!

Now that you have BISTRIP.M AC, use it as a template to write other macros needing DO loops or to automate any task. As you build a library of macros your ANSYS productivity will greatly increase!

BONUS TIP! Variable values are stored within a database. Therefore if you resume a database within a loop, the variable that is being looped on (i or icount, for example) will no longer be defined! This will cause errors. If you ever need to resume a database withouth changing current variable values, utilize the PARSAV and PARRES commands!

To Table of Contents
March 21st , 2002

/PREP7 BLC4,0,0,3,.1 BLC4,0,.1,3,.05 AGLUE,all ET,1,42 ESIZE,.05*2 LSEL,S,,,2,4,2 LSEL,A,,,9,10 LESIZE,ALL,.05/3,,,,,,,0 /NUM BER,1 /PNUM ,M AT,1 AM ESH,1 M AT,2 AM ESH,3 !M aterial Properties M PTEM P,,,,,,,, M PTEM P,1,0 M PDATA,EX,1,,12e6 M PDATA,PRXY,1,,.3 M PDATA,EX,2,,20e6 M PDATA,PRXY,2,,.29 M PDATA,ALPX,2,,8e-6 M PDATA,ALPX,1,,3e-5

March 21st , 2002

./SOLUTION TUNIF,100 LSEL,s,,,4,10,6 DL,all,,all ALLSEL

March 21st , 2002

Preprocessor > Modeling - Create > Areas - Recangle > By 2 Corners WP X WP Y Width Height APPLY WP X WP Y Width Height OK 0 .1 3 .05 0 0 3 .1

Preprocessor > Operate > Booleans - Glue > Areas PICK ALL

Preprocessor > Element Type > Add/Edit/Delete ADD Structural - Solid - Quad 4node - 42 OK

Preprocessor > Meshing - Size Cntrls > Global - Size SIZE Element edge Length NDIV No. of element division OK .05*2 0

Preprocessor > Meshing - Size Cntrls > Lines - Picked Lines Select lines 2,4,9,10 OK SIZE Element edge length .05/3

Utility Menu > PlotCrtls > Numbering Elem / Attrib numbering [/NUM] Numbering shown with OK Material Numbers Color only

Preprocessor > Meshing - Mesh > Areas - Free

March 21st , 2002

Select area 1 OK Preprocessor > Define > Default Attribs [MAT] Material number 2

Preprocessor > Meshing - Mesh > Areas - Free Select area 3 OK Preprocessor > Material Props > Material Models . . . Material Model Number 1 Structural Linear Elastic Isotropic EX PRXY OK Strutural Thermal Expansion Coef Isotropic ALPX 8e-6 Material New Model Define Material ID 12E6 .3

Material Model Number 2 Structural Linear Elastic Isotropic EX PRXY OK Strutural Thermal Expansion Coef Isotropic ALPX 5e-5 Material Exit 7E6 .29

March 21st , 2002

Solution > Loads -- Apply > Temperature > Uniform Temp ... 100 OK Solution > Loads -- Apply > Displacement > On Lines Pick lines 4 and 10 OK Leave as ALL DOF Displacement Value - Constatnt value defaults to 0 OK

March 21st , 2002

Extra! Extra! What's New . . .


X-PSD Speed up your PSD runs! 3-D Printing with Dimension ANSYS Users Conference 2002 Archives
ANSYS Focus is a periodical publication provided by Phoenix Analysis & Design Technologies (PADT).

March 21st , 2002

X-PSD Speed up your PSD runs!


xPSD for ANSYS BETA TESTING NOW!
One of the most important types of mechanical simulation is the prediction of a system's behavior due to random vibration. Almost every type of machinery, from computer circuit cards to satellite subassemblies, undergoes some type of random vibration and it is the job of the analyst to determine if the system can stand up to that loading. xPSD is a tool from PADT that allows a user to take the results from a standard modal analysis and conduct fast and flexible studies on the behavior of the structure under just such loading. xPSD uses the "large mass method" to capture the modal response of a system to random vibration expressed in terms of a Power Spectral Density (PSD) input. The user can quickly specify many different PSD input curves and extract the response of the system. The goal of the tool is to provide a simple but fast and accurate way for users to carry out PSD analysis. In fact, on a typical model (300,000 DOF's, 200+ modes) nodal response and 1 sigma values can be calculated in a matter of minutes. The first version of the tool, xPSD for ANSYS, works with the latest version of the ANSYS general purpose FE code and has the following features:

Supports Single Base Excitation Utilizes a Standard Modal Analysis (with large mass) as Input Stores modal information in efficient binary file that is an order of magnitude smaller than the equivalent *.RST modal result file. Solves in minutes or seconds User can request displacement, velocity, acceleration or component stress response at any node User can request "1 Sigma" displacement, velocity, acceleration or component stress information for the entire model or for sub-components of the model Response curves can be output for display in ANSYS or a spreadsheet "1 Sigma" results can be output for contour display in ANSYS Entire process can be run from within ANSYS, interactively or in batch.

March 21st , 2002

Input PSD and output request controlled by simple text file

This initial release was developed specifically to address the immediate needs of one of PADT's large aerospace customers. It is aimed at delivering the capabilities listed above with to the user community as soon as possible and does not have a lot of "bells and whistles". Future releases will include:

Graphical User Interface Direct output to an ANSYS *.RST file Multiple point force excitation One or more statistical approximations for the "1 Sigma" invariant stress values (principal and Von Mises stresses) Support for other FE solvers and generic modal results User requested enhancements

PADT has found this tool to be very useful and has resulted in significant productivity gains on our own internal and external analysis projects. If you would like to learn more, please take advantage of the following links:
xPSD Frequently Asked Questions (FAQ) xPSD BETA Request Form PADT is currently offering demonstration CD's to qualified potential customers. These fully functional versions of the tool require ANSYS Mechanical 5.7 or better and Windows NT. xPSD Brochure in PDF format xPSD On-Line Tutorial Even if you do not have a demo version, reading through the tutorial will give a good overview of how easy and powerful this tool is.

If you have any questions about xPSD please contact us.

Back to List of Articles

March 21st , 2002

3-D Printing with Dimension


Introducing Dimension
Functional 3D Printing that is Affordable

Just Click Print


Any other 3D printer costs about twice as much. Now you can test form, fit, function and as many design iterations as you like - with functional ABS parts. Simply connect Dimension to your network. Load Catalyst software. Insert the self-loading material cartridges and follow the display panel prompts. That's it. At $29,900, the Dimension 3D printer represents a major price breakthrough - with proven Stratasys 3D printing technology.

Strong ABS Parts Produced in Your Office

March 21st , 2002

Specifications: Catalyst Softw are: STL File Import Part Orientation Multiple Parts Queue Management Material Status Status Reports via e-Mail Dimension 3D Printer: TCP/IP 100/10 base T 8" x 8" x 12" Build Volume 0.010" in or 0.013" Layer Thickness 27" x 36" Desktop Footprint 41" High 110 VAC, 60 Hz or 220VAC ,50 Hz No facility requirements Material: ABS Plastic White, blue, yellow, black, red, green Custom colors available Stored in Auto load Cartridge

For more information: www.dimensionprinting.com

Contact PADT for Details and a Demonstration


Phoenix Analysis & Design Technologies 1465 N Fiesta Blvd, Suite 107 Gilbert AZ, 85233 480.813.4884 V 480.813.4807 F 1.800.293.PADT

"We Bring Dimension to Your Ideas" www.padtinc.com

Back to List of Articles

March 21st , 2002

Whether its one of our regularly-scheduled classes in our training room or a customized class tailored to your specifications and location, you can be assured that the training you receive will have immediate, positive results on your capabilities in design, analysis, and product and process improvement.

See the upcoming schedule below. Or, learn more about how training at PADT can save you time and money. (Or drop an e-mail to Ted Harris!)
Month Start End March 21 22 25 26 27 28 April 1 3 4 5 8 10 11 11 15 17 18 19 22 23 24 26 29 30 May 2 3 6 8 9 10 13 15 16 17 20 22 23 24 28 30 Class Design Opt. and Probabilistic Design Flotran II Intro to ANSYS, II Intro to ANSYS, I Heat Transfer Basic Nonlinearities Designspace Intro to ANSYS, I Intro to Customization Dynamics Intro to Electromagnetics ANSYS/LS-DYNA Intro to MEMS Intro to ANSYS, I Heat Transfer Basic Nonlinearities Dynamics Intro to ANSYS, I Advanced Nonlinearities Flotran I Course No. 701 602 102 101 301 201 103 101 801 203 401 501 901 101 301 201 203 101 202 601 Location LAX Gilbert ANSYS West Gilbert LAX Gilbert LAX LAX Gilbert Gilbert Gilbert Gilbert Gilbert Gilbert Gilbert LAX ANSYS West ANSYS West Gilbert LAX

March 21st , 2002

Subscribe / Unsubscribe
The ANSYS Focus is a periodical published by PADT. It contains information about ANSYS products and services provided by PADT. Freely distribute the ANSYS Focus in its entirety. Subscribe to ANSYS Focus by sending an e-mail to focus@padtinc.com with the Subscribe as the subject

Unsubscribe to ANSYS Focus by sending an e-mail to focus@padtinc.com with Unsubscribe as the subject.

For administration questions please e-mail Rod Scholl.

Contribute
Send in your contribution! Articles, and information helpful to the user are welcomed and encouraged. E-mail Rod Scholl. (Sheldon this means you!) ANSYS Focus is a periodical publication provided by Phoenix Analysis & Design Technologies (PADT).

March 21st , 2002

Next in Focus
ANSYS Focus is a periodical publication provided by Phoenix Analysis & Design Technologies (PADT).

The Nitty-Gritty
PHOENIX ANALYS IS AND DES IGN TECHNOLOGIES (PADT) MAKES NO REPRES ENTATIONS ABOUT THE S UITABILITY OF THE INFORMATION CONTAINED IN THES E DOCUMENTS AND RELATED GRAPHICS FOR ANY PURPOS E. ALL S UCH DOCUMENTS AND RELATED GRAPHICS ARE PROVIDED "AS IS " WITHOUT WARRANTY OF ANY KIND AND ARE S UBJECT TO CHANGE WITHOUT NOTICE. THE ENTIRE RIS K ARIS ING OUT OF THEIR US E REMAINS WITH THE RECIPIENT. IN NO EVENT, INCLUDING INACCURATE INFORMATION, S HALL PADT BE LIABLE FOR ANY DIRECT, CONS EQUENTIAL, INCIDENTAL, S PECIAL, PUNITIVE OR OTHER DAMAGES WHATS OEVER (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOS S OF BUS INES S PROFITS , BUS INES S INTERRUPTION, OR LOS S OF BUS INES S INFORMATION), EVEN IF PADT HAS BEEN ADVIS ED OF THE POS S IBILITY OF S UCH DAMAGES . THE VIEWS EXPRES S ED IN THE ANS YS FOCUS ARE S OLEY PHOENIX ANALYS IS AND DES IGN TECHNOLOGIES AND NOT THOS E OF ANS YS , INC.

ANSYS Focus is a periodical publication provided by Phoenix Analysis & Design Technologies (PADT).

March 21st , 2002

The Focus Archives

The Focus Archives


Date Issue Title Size 641 KB 3/21/02 Do Loops 2/25/02 Using Beams in ANSYS 831 KB 1/31/02 Rigid Regions 762 KB The Focus is a periodical publication provided by Phoenix Analysis & Design Technolgies, Inc. [PADT Home]

http://www.padtinc.com/docs/focus/ (1 of 2) [3/26/2002 4:51:33 PM]

The Focus Archives

http://www.padtinc.com/docs/focus/ (2 of 2) [3/26/2002 4:51:33 PM]