Modeling the Geometry

 

       Specifying the Element Type and
       Fluid Property

 

       Meshing

 

       Applying Boundary Conditions

 

       Running FLOTRAN

 

       Postprocessing


course  |   problem 1  |   problem 2  |        contact  |   home  |  


Engineering Analysis Project 2

ANSYS Parametric Design Language

Introduction

APDL is a scripting language that is run by ANSYS behind the interface. In APDL, you can have do-loops, vector, matrix operations, and so forth.

Creating a Macro File

To run macro definition file, type "*use, macroFileName.mac" or "macroFileName" in the command window. To write a macro definition file, you can use any texteditor but remember to save it as a .mac file.
Naming a Macro File
- File name cannot exceed 32 characters.
- File name cannot begin with a numeral.
Creating a Macro Within ANSYS
You can create a macro by three methods from within ANSYS

Creating a Macro File Within ANSYS

- Issuing the *CREATE command in the input window. Parameter values are not resolved and parameter names are written to the file.
- Using the *CFOPEN, *CFWRITE, and *CFCLOS commands. Parameter names are resolved to their current values and those values are written to the macro file.
- Choosing the Utility Menu>Macro>Create Macro menu item. This method opens a dialog box that can be used as a simple, multi-line editor for creating macros. Parameter values are not resolved and parameter names are written to the file.


Parameters

ANSYS uses two types of parameters: scalar and array. To assign a character string to parameter, a single quotes must enclose the string. Once parameteres are defined, user can use as an argument to any command in ANSYS.

Some Rules for Naming Parameters

- Name cannot be longer than 8 characters
- Name cannot begin with numbers
- Name cannot have '&'

- Avoid parameter names that match commonly used ANSYS labels, such as: Degree of freedom (DOF) labels (TEMP, UX, PRES, etc.)
Convenience labels (ALL, PICK, STAT, etc.) User-defined labels (such as those defined with the ETABLE command)
Array type field labels (such as CHAR, ARRAY, TABLE, etc.)
- Be aware that parameter names ARG1 through ARG9 and AR10 through AR99 are reserved for local parameters. Generally, local parameters are used in macros.
- Don't begin parameter names with an underscore (_). This is the convention reserved for parameters used by the GUI and ANSYS-supplied macros.


Commands for Defining Parameters

You can use *SET command, which is equiavlent to defining parameters from Utility Menu (Utility Menu-> Parameteres -> Scalar Parameters -> Scalar parameters) For example,

*SET, ABC, -24      !this define ABC to be equal to -24
*SET, QR, 1.79E-5 !this assign 1.79E-5 to QR

Those two commands are equivalent to using "=". For example,

ABC=-24
QR=1.79E-5

Accessors (Get Commands)

NSEL(N)      Status of node (-1 = unselected, 0 = undefined, 1 = selected)
ESEL(E)      Status of element (-1 = unselected, 0 = undefined, 1 = selected)
KSEL(K)      Status of keypoint (-1 = unselected, 0 = undefined, 1 = selected)
LSEL(L)       Status of line (-1 = unselected, 0 = undefined, 1 = selected)
ASEL(A)      Status of area (-1 = unselected, 0 = undefined, 1 = selected)
VSEL(V)      Status of volume (-1 = unselected, 0 = undefined, 1 = selected)

NX(N)           X-coordinate of node N in the active coordinate system
NY
(N)          Y-coordinate of node N in the active coordinate system
NZ(N)           Z-coordinate of node N in the active coordinate system
KX
(N)           X-coordinate of keypoint K in the active coordinate system
KY(N)          Y-coordinate of keypoint K in the active coordinate system
KZ(N)           Z-coordinate of keypoint K in the active coordinate system

Parametric Expressions

+            addition
-
            subtraction
*
            multiplication
/
            division
**
           exponential
<
           less-than comparison
>
           greater-than comparison


Skeleton File

finish
/clear

! note that text after exclamation mark is comment
!define the variable

*SET, ABC, 20
*SET, QR, 1.79E-5
*SET, FGh, -240

!define Keypoints
K,1,0,0,0 !keypoint 1 has coordinate (0,0,0)
K,2,0,0,1
K,3,0,1,0
K,4,1,0,0
K,5,1,1,0
K,6,0,1,1
K,7,1,0,1
K,8,1,1,1

!define areas from keypoints
a,1,3,4,5
a,1,3,6,2
a,1,2,7,4
a,4,5,8,7
a,5,3,6,8
a,7,8,6,2
!define volume from area
va,all

! define the fluid material properties
FLDATA12,PROP,DENS,4
FLDATA13,VARY,DENS,0
FLDATA12,PROP,VISC,4
FLDATA13,VARY,VISC,0
FLDATA12,PROP,COND,0
FLDATA13,VARY,COND,0
FLDATA12,PROP,SPHT,0
FLDATA13,VARY,SPHT,0
!*
FLDATA7,PROT,DENS,AIR-SI
FLDATA8,NOMI,DENS,-1
FLDATA9,COF1,DENS,0
FLDATA10,COF2,DENS,0
FLDATA11,COF3,DENS,0
FLDATA7,PROT,VISC,AIR-SI
FLDATA8,NOMI,VISC,-1
FLDATA9,COF1,VISC,0
FLDATA10,COF2,VISC,0
FLDATA11,COF3,VISC,0
FLDATA12,PROP,IVIS
FLDATA7,PROT,COND,CONSTANT
FLDATA8,NOMI,COND,-1,
FLDATA9,COF1,COND,0
FLDATA10,COF2,COND,0
FLDATA11,COF3,COND,0
FLDATA7,PROT,SPHT,CONSTANT
FLDATA8,NOMI,SPHT,-1,
FLDATA9,COF1,SPHT,0
FLDATA10,COF2,SPHT,0
FLDATA11,COF3,SPHT,0
!
MPTEMP,,,,,,,,
MPTEMP,1,0
MPDATA,DENS,1,,1.23
MPTEMP,,,,,,,,
MPTEMP,1,0
MPDATA,VISC,1,,AirViscosity

!Define mesh element type
ET,1,FLUID142 !element type number 1, use fluid 142(3D)

!Define element size

LSEL,s,line,,ALL !select every line
LESIZE,ALL, , ,100,0.01,1, , ,1     !100elements of size 0.01 each
!you can look up commands in ANSYS library, just go to Help.

! Mesh the volume
MSHAPE,0,3d
MSHKEY,1
VMESH,ALL !volume mesh
MSHKEY,0

!Applying boundary conditions

DA,3,VX,10,1 ! applying velocity in x-dir = 10 on area 6
DA,3,VY,0,1
DA,3,VZ,0,1

DA,2,VX,0.0,1
DA,2,VY,0.0,1
DA,2,VZ,0.0,1

! no pressure on other areas
DA,1,PRES,0.0,1
DA,2,PRES,0.0,1
DA,3,PRES,0.0,1
DA,4,PRES,0.0,1

! solve
/SOL
ALLSEL
FLOCHECK,0
FLDATA1,SOLU,TRAN,0
FLDATA1,SOLU,FLOW,1
FLDATA1,SOLU,TEMP,0
FLDATA1,SOLU,TURB,0
FLDATA1,SOLU,COMP,0
FLDATA1,SOLU,VOF,0
FLDATA1,SOLU,SFTS,0
FLDATA1,SOLU,IVSH,0
FLDATA1,SOLU,SWRL,0
FLDATA1,SOLU,SPEC,0
FLDATA1,SOLU,ALE,0
FLDATA1,SOLU,RDSF,1
!*
/COM,Steady State Analysis,0
FLDATA2,ITER,EXEC,100,
FLDATA2,ITER,OVER,0,
FLDATA2,ITER,APPE,0,
FLDATA3,TERM,VX,0.01,
FLDATA3,TERM,VY,0.01,
FLDATA3,TERM,VZ,0.01,
FLDATA3,TERM,PRES,1e-007,
FLDATA3,TERM,TEMP,1e-008,
FLDATA3,TERM,ENKE,0.01,
FLDATA3,TERM,ENDS,0.01,
FLDATA5,OUTP,SUMF,10,
SOLVE

! Post-processing
/POST1
set,last !read the last set of input

More to come about postprocessing commands

 

 

 

 


Last update: Oct 9, 2004
Webmaster: Chanikarn Benjavitvilai