ANSYS Classic APDL Programming

Source: Internet
Author: User

Some of the experience in using Ansys is summarized in the following:

Understanding of some key concepts in 1.ANSYS; Parametric programming language (APDL) Parametric programming language (Apdl:ansys parametric  design  Language) Essentially consists of a programming language section similar to FORTRAN77 and more than 1000 ans ys commands. The programming language section, like other programming languages, has parameters, array expressions, functions, process controls (loops and branches), repetitive commands, abbreviations, macros, and user programs. The standard an SYS program is run by more than 1000 commands, which can be written into programs written in the programming language, the parameters of which can be assigned values, or they can be assigned by means of the result or parameter of an expression. From the functional aspects of the ANSYS command, they correspond to the defined geometric models in ANSYS analysis, the partitioning of cell meshes, the definition of materials, the addition of loads and boundary conditions, the control and execution of solutions, and the results of post-processing calculations.   Users can use the programming language to organize the ANSYS command, to write a parameterized user program, so as to achieve the whole process of finite element analysis, namely, the establishment of parameterized CAD model, parametric grid division and control, parametric material definition, parametric load and boundary condition definition, Parametric analysis control and solution and parametric post-processing.   macro is a command combination with some special functions, essentially a parameterized user applet that can be handled as a command of Ansy s, with input parameters or no input parameters. The   abbreviation is an alternative name for a command or macro, which corresponds to the existence of one by one of the substituted command or macro, which is exactly the same in an SYS, but the abbreviation is more user-friendly, easier to remember and less prone to hitting the keyboard. The Ansys tool bar is a good example of abbreviations. The user interface Design language (UIDL) standard Ansys Interactive graphical interface can drive ANSYS commands, provide various input parameter interfaces and control switches for commands, and allow the user to perform finite element analysis on a graphics-driven level, making the process intuitive and easy. User graphical interface Design language (UIDL) is to write or transform the Ansys graphical interface of the dedicated design language, the main completion of the following three graphical interface design: Main Menu system and menu item dialog box and Pick dialog box Help system   through the user Interface Design language (UIDL), The user can expand the ANSYS function at the same time to establish a corresponding graphics-driven interface, such as in the main menu to add menu items, design the corresponding dialog box, pick the dialog box, to achieve the input of parameters and other program operation control, while providing the corresponding online help, so that the operator can easily obtain system help. User program characteristics (UPFS) User programFeatures (UPFS) provide users with rich FORTRAN77 User program development subroutines and functions that users use to extend the functionality of Ansys from the source code level of the development program. Using these subroutines and functions, write the user-function source code program, recompile and connect to the Fortran or C + + compilers that match the ANSYS version requirements, and generate the user version of the ANSYS program. In addition, external command capabilities are available that allow users to create shared libraries that can be leveraged by Ansys. Users can develop functional programs that develop user subroutines to extract data from an ANSYS database or to write data to an ANSYS database. The seed program can be compiled and connected to Ansys, at which time Ansys provides 10 database operation commands, which can be run in any module of ANSYS if handled as an external command; Use the sub-program provided by ANSYS to define various types of loads, including BF or BFE loads, pressure loads, convection loads, heat fluxes and charge densities; Using the sub-program provided by ANSYS to define various material properties, including plasticity, creep, expansion, visco-plasticity, super-elastic, layer element failure criterion, etc. The sub-program provided by ANSYS is used to define the new unit and adjust the node direction matrix. Using the subroutine provided by Ansys to modify or control the elements in the ANSYS unit library; Create user optimizer using Uerop; The ANSYS program is called as a subroutine in the user program. Ansys Data Interface Ansys Program has a large number of design analysis data in the process of analysis, part of the runtime in the memory of the computer, part of the file in the form of storage in the working directory. In addition to text files such as log files and error files, other files are binary files that are written in different formats, such as: database files, result files, modal result files, cell matrix files, sub-structure matrix files, diagonal stiffness matrix files, reduced displacement matrix files, Reduce the frequency matrix file and the complete stiffness-quality matrix file and so on. The ANSYS Data interface describes the format of each binary file in detail, and then introduces subroutines or functions that extract various data from these data files, thus enabling read-write and modification of binary data. Obviously, it satisfies the user the following three basic needs: inspect or observe the process data or the result data, control or revise the calculation by modifying the data file of Ansys, extract the result data for analysis and processing. The ANSYS Data interface provides two transformation and delivery commands for model and database information, namely Cdread and Cdwri TE, which reads a model and database file information that conforms to the ANSYS read-in or write-out format into the ANSYS database, which is the opposite. Also, in order to reduce the time of conversion or transfer, improve efficiency, and provide the redirect degree of freedom Mapping relationship and other database codesuch as/dflab, Nblock, Eblock, en, and so on. This function greatly improves the transfer and transformation of model data between ANSYS and other finite element programs, and also facilitates the storage or transfer between machines after the code of the Ansys own database files. The ANSYS Data interface also describes the format of graphics files to help users convert Ansys graphics files into other formats, such as AI.   (1) geometric model and finite element model

Geometric model refers to the geometrical information of the model, and the embodiment in Ansys is the key point (KeyPoint), surface (area), body (volume) and so on. The finite element model refers to the information used in finite element calculation, and it is often confused with the key points, faces and bodies, which are nodes (node) and units (units). The real finite element calculation is the node and the unit, not the so-called Key point (KeyPoint), etc., the key point is to create the finite element model of the geometry information only.

(2) to be continued ... Summary of SELECTION commands in 2.APDL

In the process of using APDL programming, whether it is geometric modeling, meshing, solving, calculating, post-processing, etc., the common pattern is to select the phase
object, and then apply some ANSYS-defined operations to the object. Most often, the most skillful operation is the choice (select),
Select, line, polygon, body, node, cell, etc. to apply the object of operation, the usual choice way is:

<1>. Select by number of entities

including given its specific number, or sequence of numbers (the linear sequence: its start, end, step), in the corresponding command in the APDL to specify parameters such as Vmax,vmin;

Common command flow has *sel, (where * represents K,n A V E L, etc.)

<2>. Select by dependency relationship (attached to)

  Ansys are related, Low-dimensional objects are attached to high-level objects, such as the key point is dependent on the line, face, body, nodes attached to the unit.

The common command flow has *sl* (where the previous * represents the object to be selected, and the next * represents the attached object)

<3>. Select via location

This method is included in the parameters of the *sel command.

<4>. Selection by material properties, unit type

This is also a convenient way to do this in the command flow by specifying the parameters of the *sel.

/span>

S: Select a collection from the collection of objects that contain all of the same type.

R: Select a collection from the currently selected collection of objects.

U: Deselect a collection from the currently selected collection of objects.
A: Select a collection from the collection that contains all of the same types to incorporate into the current collection.

PS: These options are available under the GUI.

3. How to extract data from a database

&NBSP;

/span>

<1>. *get and *vget commands, where *get is a command that extracts scalar parameters, and *vget is a command that extracts information from a database in bulk.

<2>. an equivalent embedded extraction function;

<3>.Object Information Query function; The query function for extracting database information in Ansys is **INQR (where * * represents kp,ls,ar,vl,nd, sub-
Do not represent key points, lines, polygons, bodies, nodes, etc.), but the query function corresponding to the unit is ELMIQR.
<4>. Use the/inquire function to query system Information , including path, working directory, working file name, etc.

4. Common templates for some operationsFor example, geometric modeling, dividing grids, solving and setting, post-processing, etc. are all done with a few lines of APDL, and they are very similar. Therefore the total
knot Some templates to facilitate programming.
Some of the geometric modeling programs:
... ...
Dividing grids:

1. Asel, 2! Select Faces

SMRT,3      !网格尺寸

mshape,1,2d! Grid type
mshkey,0! Grid generation Mode
Amesh,all! Dividing grids
Solving:
... ...
Post-processing:
... ...
not to Be continued

ANSYS Classic APDL Programming

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.