Ansys User Programmable Features (UPFs) .
Ansys User Programmable Features (UPFs) .
Ansys User Programmable Features (UPFs) .
Go to the Next Chapter Go to the Table of Contents for This Manual. Chapter 1 * Chapter 2 * Chapter 3 * Appendix A
To read information into or fetch information from the ANSYS database, you can create subroutines and either link them into the ANSYS program or use them in the external command feature (see Appendix A for more information
about external commands). If you link these subroutines into ANSYS, you are lilmited to 10 database access commands. Such commands, created through either method, operate at all levels of ANSYS operation, including the begin, preprocessor, general postprocessor, time-history postprocessor, and solution levels. For more information about accessing the ANSYS database, see Chapter 2. ANSYS provides a set of routines you can use to specify various types of loads, including BF or BFE loads, pressures, convections, heat fluxes, and charge densities. These routines are described under section 1.7. Another set of UPF routines enables you to define the following material properties: plasticity, creep, swelling law, viscoplasticity, hyperelasticity, and layered element failure criteria. To see inputs and outputs for these routines, see section 1.6. Several sets of UPFs enable you to define new elements and to adjust the nodal orientation matrix. See section 1.3 for more information. Another group of UPFs enables you to modify and monitor existing elements. For details, see section 1.5. You can customize UPF userop to create a custom design optimization routine. For more information, see section 1.12. You can call the ANSYS program as a subroutine in a program you've written. To learn how, see section 1.8.
The ANSYS program. The UPF subroutines themselves. Study the UPF subroutines before customizing them, and make sure that you fully understand the subroutines, as well as any applicable functions. Unless you review them carefully, a few UPF subroutines may seem like a maze with many logic paths to consider. You may have to set special variables correctly in order to run your customized ANSYS program without errors. Even if you have in-depth knowledge of the ANSYS input and your desired outputs, you still need to ensure that everything that
needs to be done in the UPF subroutines is done properly in your custom version. FORTRAN 77. Besides knowing how to write FORTRAN 77 subroutines, you must be sure that the level of the FORTRAN 77 compiler is as least as high as the level mentioned in your ANSYS installation manual. You also need to know what to do should the computer abort the program due to an arithmetic error, a file read error, a memory access error, and so on. The mathematics of the phenomenon you're planning to include.
Important
UPFs aren't available in certain data center environments or on some hardware configurations, such as machines using parallel processing for element formulation. For additional information, consult your ANSYS installation manual or your on-site ANSYS system support person Carefully consider whether you wish to use UPFs, especially if you are linking them into ANSYS (rather than into a shared library for use as external commands). When you add your own routines to ANSYS by either method, you're creating a customized, site-dependent version of the program. ANSYS, Inc. considers the use of UPFs a non-standard use of the program, one that the ANSYS Quality Assurance verification testing program doesn't cover. Therefore, you're responsible for verifying that the results produced are accurate and that your customizations don't adversely affect other, standard areas of the ANSYS program. Although the flexibility that UPFs offer can be highly attractive, UPF usage is a complicated process that can introduce errors. Consider what you want your customizations to accomplish. You may be able to customize ANSYS more easily and safely with macros than with UPFs.
For other guidelines for non-standard uses of the ANSYS program, see Chapter 6 of the ANSYS Advanced Analysis Techniques Guide.
Does the capability you want already exist in the ANSYS program? Remember, a capability may not be obvious at first, especially to a novice ANSYS user.
Does your proposed subroutine fit into the ANSYS program architecture and specifications? For example, you can't program a user element that has more than 32 degrees of freedom per node or more than 20 nodes per element.
Use your experience and judgment to answer these questions. If you need help to do so, consult your ANSYS Support Distributor. If you can respond "no" to both questions, then the user routine you're planning will be both useful and feasible.
If you have a UNIX version of ANSYS, the source code for the UPF routines resides in directory /ansys55/customize/user. If you're running the ANSYS program under Windows NT or Windows 95, the UPF source code resides in directory \ansys55\custom\user\intel.
Most of the user routines have at least simple functionality, so print out the routines of interest before you start programming. All source routines are concatenated onto file user.f or user.for. Delete the routines you don't want and make appropriate changes to the others.
Keep in mind that the instance described above is just an example. Compilers from different vendors may construct the symbols differently. Please consult the manuals for your specific compiler for information on how to call FORTRAN subroutines from C functions.
9. Test the changes with a series of increasingly complex problems for which you already know the answers.
After you make your changes to the user routines supplied on your ANSYS distribution medium, you can either
Link your routines into shared libraries (as discussed starting in Appendix A). Compile and link your custom routines into the ANSYS program itself. This is discussed for UNIX systems in 1.1.9 and for Windows systems in 1.1.10. You may need super-user or root privileges to run the procedure that does the linking.
The ANSCUSTOM procedure compiles all FORTRAN files (files ending with .F) and all C files (files ending with .c) in the current working directory. The procedure then loads all object files (files ending with .o) along with the default ANSYS objects and libraries in /ansys55/customize/user/platform (where platform is a directory that uniquely identifies the hardware platform version). The new executable file created will be named ansys.e55t and will reside in the current directory. FORTRAN files are assumed to be FORTRAN 77 (some extensions are allowed), and C files are assumed to be ANSI C. Chapter 1 of the ANSYS Installation and Configuration Guide for UNIX lists the compilers you'll need to use UPFs.
2. Copy the following files from \ansys55\custom\user\platform to your working directory: anscust.bat, makefile, and any user routines you plan to modify. If you're running Windows 95, also copy filefcomp.bat. 3. Run the procedure ANSCUST. This procedure compiles all FORTRAN files (files ending with .F) and all C files (files ending with .c) in the current working directory. The procedure then loads all object files (files ending with .obj), along with the default ANSYS objects and libraries (in \ansys55\custom\user\platform ). The executable file created will be named ansys.exe and will reside in the current working directory. The executable will be named ansys.exe and will reside in the current working directory. Windows 95 Users Only: Set the environment variable ANSYS55_DIR to the root ANSYS directory, as shown below:
SET ANSYS55_DIR=C:\ANSYS55
If you installed the program in a directory other than c:\ansys55, you'll also need to modify the ANSYS55_DIR variable in the makefile. Important-Be sure to answer "no" when the linking procedure asks, "Do you want to overwrite it (current executable)?" If your answer isn't "no," all other ANSYS program users will also get your changes.
Issuing the USRCAL command Choosing menu path Main Menu>Preprocessor>Loads>-Load Step Opts>Other>User Routines or Main Menu>Solution>-Load Step Opts>Other>User Routines.
To activate or deactivate the routines, issue the command USRCAL,Rnam1,...Rnam9, where Rnam1 and Rnam9 are the names of specific routines. You can specify up to
nine routines with one USRCALcommand, or you can issue multiple USRCAL commands. Issue the command USRCAL,NONE to deactivate all valid user subroutines. To list the status of the routines, issue the command USRCAL,STAT. For a list of the user routines that the USRCAL command (or its equivalent menu paths) affects, see the USRCAL command description in the ANSYS Commands Reference. If you don't activate the UPFs in this manner, standard ANSYS logic will be used by default. For instance, when you apply a convection load, standard ANSYS logic is the default even if you have a user convection routine linked in. The user convection routine must be activated by the USRCAL command or its menu equivalent.
the standard version and on the customized version. Input for these problems is also available on your ANSYS distribution medium. Always remember: your last step, a series of steps, or even your concept may be wrong. Proceed in clear steps, and verify your work as often as possible. Keep intermediate versions of your modified source code on backup media. Note-If you contact your site's ANSYS system support person or any ANSYS, Inc. representative about the performance of a custom version of ANSYS, always tell him or her explicitly that you're using a user programmable feature. If you feel that an error exists in an unrelated feature of the ANSYS program, demonstrate the suspected error in an non-customized, production version of the program before you report the error to an ANSYS. Inc. representative.
MonLevel is the level for timing monitoring. PrintLevel is the level for enter/exit printout, and SumLevel is the level at which the timing sum is output. Each of these arguments can be any value between 0 and 9 (default is 0). You can use the /TRACK command to identify which section of code is causing the program to abort. For example, to flag up to eight levels of subroutines to determine when the program logic enters and leaves them, you would issue the command /TRACK,,8.
1.1.14.2 Debugging Elements and Solutions The /DEBUG command generates debugging at various points in the output. You can specify one of three formats for /DEBUG: solution debug format, element debug format, and general debug format. 1.1.14.2.1 Solution Debug Format Issue the command using this format:
/DEBUG,-1,F1,F2,F3,F4,F5,F6,F7,F8,F9
Choose One of These Values 1 (provides basic solution control debugging) 1 (provides transient debugging using Newmark constants) 2 (provides transient debugging using velocities and accelerations) 1 (provides element matrix debugging and prints matrix + load vectors)
F3
2 (provides element matrix debugging with load vectors only) 3 (provides element matrix debugging with matrix diagonals and load vectors) 1 (provides auto time stepping debugging) 1 (provides multifield debugging) 1 (provides arc-length debugging) 1 (provides basic Newton-Raphson debugging) 2 (provides Newton-Raphson debugging and prints out-of-balance forces or incremental displacement or each DOF) 3 (provides Newton-Raphson debugging and prints applied loads and n-r restoring force for each DOF) 1,2 (provides displacement vector debugging with displacement pointers)
F4 F5 F6
F7
F8
2 (provides displacement vector debugging with incremental displacement) 3 (provides displacement vector debugging with contact database) 1 (provides temporary programmer debugging)
F9
1.1.14.2.2 Element Debug Format Issue the command using this format:
/DEBUG,-3,G1,G2,G3,G4,G5,G6,G7,G8,G9
For This
Argument G1 G2
1 (provides basic element pass debugging) 1 (provides element displacement and coordinate debugging) 1 (provides element matrix debugging and prints matrix + load vectors) 2 (provides element matrix debugging with load vectors only) 3 (provides element matrix debugging with matrix diagonals and load vectors) 1 (provides element load information debugging) 1 (provides element real constant debugging) 1 (provides element saved variable debugging) 1 (provides element material property debugging with linear material properties) 2 (provides element material property debugging with nonlinear properties) 1,2 (provides element nonlinear debugging with plasticity)
G3
G4 G5 G6 G7
G8
2 (provides element nonlinear debugging with large deformation) 3 (provides element nonlinear debugging with contact database) 1 (provides temporary programmer debugging)
G9
1.1.14.2.3 General Debug Format Issue the command using this format:
/DEBUG,H1,H2,,H4,H5
H1
2 (provides input line (character)) 3 (provides input line (decoded)) 1 (provides wavefront reordering and element checking debugging)
H2 2 (provides meshing debugging) 1 (provides nodal coordinate system transformation debugging) H4 H5 2 (provides displacement updating debugging) 1 (provides pre-element debugging, element characteristics debugging, and element field load debugging)
You must follow the EBLOCK command with a valid format statement defining five element attributes, followed by Nnodes. Nnodes are the node numbers associated with
this element. Use commas to separate the node numbers, (don't use blanks) and enclose the string of node numbers in parentheses. The element attributes are:
Elnum The element number. Mat The material number. Real The real constants associated with this element. Type The element type number. Esys The system of coordinates this element uses.
The EBLOCK command can indicate multiple element lines in the file. The value EBLOCK returns will either be 0 (if the command executes successfully), or a negative element number if an error occurs.
Ncoord is the number of coordinates defined for this node. The default for Ncoord is 3 and the maximum value is 6. The default coordinate values are the X, Y, and Z coordinates, and the other values are THXY, THYZ, and THZX. Normally, you specify one NBLOCK command for each line of nodal data. The value NBLOCK returns will be either 0 (if the command executes successfully) or a negative node number if an error occurs.
The descriptions of the routines or functions within this chapter describe both the input arguments and output arguments. Argument information includes the argument's type, size and intent.
Argument type is one of the following: int - integer dp - double precision log - logical chr - character dcp - double precision complex
Argument size is one of the following: sc - scalar variable ar(n) - array variable of length n func - functional return value
Argument intent is one of the following: in - input argument out - output argument inout - both an input and an output argument
2-D or 3-D geometry Degree-of-freedom set Symmetric or unsymmetric matrix Number of nodes Number of body loads (for example, temperatures) Number of surface loads (for example, pressures) Number of real constants Number of variables to be saved Number of rows in element matrices Linear or nonlinear element.
Routines uel100 through uel105 calculate the element matrices (stiffness, specific heat, etc.), the element load vector (force, heat flow, etc.), and any element output quantities. The element printout also is generated, and the variables to be saved are calculated and stored in the results file. Other user routines available for manipulating element information include the following:
Routines uep100 through uep105 provide printed output of line elements. The general ANSYS postprocessor, POST1, calls the subroutines, or you can call them using uel100 through uel105. Routine usertr allows access to the nodal transformations. Routine userac describes some of the data handling.
see include deck elccmt for - error flag (set to 1 if error) the validity of keyopt values may be checked
1.3.3.1 Subroutines uec101 through uec105 The input and output arguments for subroutines uec101, uec102, uec103, uec104, and uec105 is identical to the uec100 subroutine listed above.
1.3.4.1 Subroutines uex101 through uex105 The source code for subroutines uex101, uex102, uex103, uex104, and uex105 is identical to the code for subroutine uex100 listed above.
1.3.5 Subroutine uel100 (Computing Element Matrices, Load Vectors, and Results)
subroutine uel100 (elem,ielc,elmdat,eomask,nodes,locsvr,kelreq, x kelfil,nr,xyz,u,kelout,zs,zass,damp,gstif,zsc,zscnr,elvol,elmass, x center,elener,edindx,lcerst) --- general lumped mass is demonstrated -------------------------------*** primary function: 1. compute element matrices, load vectors, and results *** secondary functions: 2. maintain element solution data
c c c c c c c *** user programmable functions may not be used in parallel processing *** c c *** Notice - This file contains ANSYS Confidential information *** c c *** ansys(r) copyright(c) 1971,78,82,83,85,87,89,92,94-97 c *** ansys, inc. c c input arguments: c elem (int,sc,in) - element label (number) c ielc (int,ar(IELCSZ),in) - array of element type characteristics c (IELCSZ = array size, defined in echprm) c elmdat (int,ar(10),in) - array of element data c eomask (int,sc,in) - bit pattern for element output c (see outpcm) c nodes (int,ar(nnod),in) - array of element node numbers c (nnod = number of nodes; 1 in this case) c locsvr (int,sc,in) - location of the saved variables c on file .esav for this element c kelreq (int,ar(10),in) - matrix and load vector form requests c (indices for kelreq are given with output c arguments below) c kelfil (int,ar(10),in) - keys indicating incoming matrices and c load vectors (indices for kelfil are the c same as given for kelreq with output c arguments below) c nr (int,sc,in) - matrix and load vector size c xyz (dp,ar(6,nnod),in) - nodal coordinates (orig) and rotation angle
c u (dp,ar(nr,5),in) c c output arguments: c kelout (int,ar(10),out) c c below, c later) c zs (dp,ar(nr,nr),inout)(kelreq(1)) c zass (dp,ar(nr,nr),inout)(kelreq(2)) c damp (dp,ar(nr,nr),inout)(kelreq(3)) c gstif (dp,ar(nr,nr),inout)(kelreq(4)) c zsc (dp,ar(nr),out) (kelreq(5)) c zscnr (dp,ar(nr),out) (kelreq(6)) c (kelreq(7)) c elvol (dp,sc,out c elmass (dp,sc,out) c center (dp,ar(3),out) c elener (dp,ar(5),out) c edindx (int,ar(20),out) c lcerst (int,sc,inout) c
element nodal solution values keys indicating created matrices and load vectors (indices for kelout are the same as for kelreq as well as kelin and kelout stiffness/conductivity matrix mass matrix damping/specific heat matrix stress stiffness matrix applied f vector n-r restoring f vector or imaginary f vector element volume element mass centroid location element energies element result data file indexes position on result file
c c *** primary function: produce printed output for user elements c used typically only for line elements c c *** ansys(r) copyright(c) 1971,78,82,83,85,87,89,92,94-97 c *** ansys, inc. c *** Notice - This file contains ANSYS Confidential information *** c c ********** this subroutine is provided for user information ********* c *** user programmable features may not be used in parallel processing ***
c c input arguments: c iott (int,sc,in) c ielc (int,ar(150),in) c elem (int,sc,in) c nodes (int,ar(2),in) c mat (int,sc,in) c kept (int,sc,in) c ept (dp,ar(*),in) c kemn (int,sc,in) c emn (dp,ar(*),in) c kems (int,sc,in) c ems (dp,ar(*),in) c kens (int,sc,in) c ens (dp,ar(*),in) c keel (int,sc,in) c eel (dp,ar(*),in) c keth (int,sc,in) c c eth (dp,ar(*),in) c kenl (int,sc,in) present c enl (dp,ar(*),in) c kepl (int,sc,in) c epl (dp,ar(*),in) c kecr (int,sc,in) c ecr (dp,ar(*),in) c c output arguments: c none
output unit number element characteristics element number node numbers material number key to print temperatures element pseudo-node temperatures key to print misc. non-summed data misc. non-summable data record key to print mmisc. summed data misc. summed data key to print nodal stresses nodal sresses at an element key to print nodal elastic strain element nodal elastic strains key to print thermal,initial, and swelling strains - nodal thermal strains at an element - key set if any nonlinear materials element nonlinear table key to print nodal plastic strains nodal plastic strains key to print nodal creep strains nodal creep strains
c c c c c c c c c c c c c c
node tr
(int,sc,in) - node number being acted upon (dp,ar(32,32),inout) - nodal to global orientation matrix
output arguments: variable (typ,siz,intent) description tr (dp,ar(32,32),inout) - nodal to global orientation matrix tr is a matrix that is already defined based on the degrees of freedom selected. it does not normally need to be changed. it may be printed out here to study. its functional size is nr by nr, where nr is the number of degrees of freedom in the element
subroutine nminfo (ielc,rname) c *** primary function: set element reference names c *** secondary functions: none c c *** Notice - This file contains ANSYS Confidential information *** c c input arguments: c variable (typ,siz,intent) description c ielc (int,ar(150),inout) - element characteristic vector c rname (chr,sc,in) - 8 character reference name c c output arguments: c variable (typ,siz,intent) description c ielc (int,ar(150),inout) - element characteristic vector with c element name encoded c
(int,ar(10),in) (int,sc,in)
- index for svr for this element (see - the set number in this index = 1 - structural svrs = 2 - thermal/electric/fluid svrs = 3 - magnetic svrs = 4 - nonlinear svrs = 5 - plasticity svrs = 6 - creep svrs = 7 - coupled svrs = 8 - user svrs - number of dp words expected in this set - number of dp words in this set - data in this set
(int,sc,inout)
1.4.5 Subroutine svpidx (Writing the Saved Variable Element Index to a File)
subroutine svpidx (locsvr,svindx) c *** primary function: write the svr element index onto file c *** secondary functions: update the locsvr pointer to next element c c *** Notice - This file contains ANSYS Confidential information *** c c input arguments: c variable (typ,siz,intent) description c locsvr (int,sc,inout) - pointer to start of svr for element c svindx (int,ar(10),in) - index to svr for this element c c output arguments: c locsvr (int,sc,inout) - pointer to start of svr for next element
c prop (dp,ar(nprop),in) - current mat props c propo (dp,ar(nprop),inout)- previous material properties c krvro (int,sc,in) c = 0 - real constants are used by this element, and the old c values(rvro) have been saved; or the element does not c use real constants. Any change of real constants c causes all matrices to be reformed. c = 1 - real constants are used by this element and the old c values(rvro) have been saved. However, any change c of real constants will cause the run to terminate, c because the results would be too unpredictable. c (e.g. gap elements) c = 2 - element is nonlinear, so do not bother to check c = 3 - real constants are used by this element, and the old c values(rvro) have been saved. However, no checking is c done in this routine because of needed customized logic. c = 4 - real constants are used by this element, but the old c values(rvro) have not been saved because it was c decided not to use this much storage. therefore, no check c can be made to determine if matrices should be reformed. c (e.g. 100 layer elements) c = 5 - real constants are used by this element, but the old c values(rvro) have not been saved because the real c constants have no effect on matrix formulation. c (e.g. acoustic elements) c rvr (dp,ar(*),in) - current real constants c rvro (dp,ar(*),inout) - previous real constants c amodo (dp,sc,inout) - previous value of mode c asymo (dp,sc,inout) - previous value of isym c c output arguments: c propo (dp,ar(nprop),inout)- current material properties c rvro (dp,ar(*),inout) - current real constants c amodo (dp,sc,inout) - current value of mode c asymo (dp,sc,inout) - current value of isym c kelin (int,ar(10),out) - keys indicating matrices to form c
1.4.7 Subroutine subrd (Reading Element Load Data for a Substructure Generation Run)
subroutine subrd (iel,key,nd,vect,ka) c *** primary function: read element load data from file for substructure c generation run c *** secondary functions: none c c *** Notice - This file contains ANSYS Confidential information *** c c input arguments: c iel (int,sc,in) - element number c key (int,sc,in) - type of load data c = 1 temperature c = 2 fluences c = 3 heat generation rates
c c c c c c c c c c c c c c c c c c c c
nd
(int,sc,in)
current densities pressures film coefficients bulk temperatures extra displacement shapes thermal strains(eptho in el42) thermal flux (as in el55) initial strains(epino in el01) magnetic virtual displacements calculated source field(hsn in el96) element load vector copy - do not scale(tempev in el42) first load step only - number of data items - array of load data - load activation key = 0 no load for this data = 1 load is active
= 4 =10 =11 =12 =13 =14 =15 =16 =17 =18 =20 =30
1.4.8 Subroutine subwrt (Writing an Element Load Vector to a File for a Substructure Generation Run)
subroutine subwrt (iel,nvect,key,nd,vect,ref) c *** primary function: write element load vect to file for substructure c generation run c *** secondary functions: none c c *** Notice - This file contains ANSYS Confidential information *** c c input arguments: c iel (int,sc,in) - element number c nvect (int,sc,in) - number of load vectors c (current load step number) c key (int,sc,in) - type of load vect c = 1 temperature c = 2 fluences c = 3 heat generation rates c = 4 current densities c =10 pressures c =11 film coefficients c =12 bulk temperatures c =13 extra displacement shapes c =14 thermal strains(eptho in el42) c =15 thermal flux (as in el55) c =16 initial strains(epino in el01) c =17 magnetic virtual displacements c =18 calculated source field(hsn in el96) c =20 element load vector c =30 copy - do not scale(tempev in el42) c nd (int,sc,in) - number of vect items c vect (dp,ar(nd),in) - array of load data c ref (dp,sc,in) - reference value for zero load
c c
c integer lp(3) c data lp /1,10,13/ c call propev (elem,mat,lp(1),tem,prop(1),3) c c *** Notice - This file contains ANSYS Confidential information *** c c c c c c input arguments: iel (int,sc,in) mtr (int,sc,in) lp (int,ar(n),in) - element number - material number(input quantity mat, mat comma - keys for which specific value is requested each group must be in ascending order (ex,ey,ez, etc)
c c c c c c c c c c c c c c c c c c c
if negative, a required property if zero, leave prop term unchanged EX = 1, EY = 2, EZ = 3, NUXY= 4, NUYZ= 5, NUXZ= 6, GXY = 7, GXZ = 9, ALPX=10, ALPY=11, ALPZ=12, DENS=13, MU =14, DAMP=15, KYY =17, KZZ =18, RSVX=19, RSVY=20, RSVZ=21, C =22, HF =23, EMIS=25, ENTH=26, LSST=27, PRXY=28, PRYZ=29, PRXZ=30, MURX=31, MURZ=33, PERX=34, PERY=35, PERZ=36, MGXX=37, MGYY=38, MGZZ=39, EGYY=41, EGZZ=42, TGXX=43, TGYY=44, TGZZ=45, SONC=46, (see chapter 2 of the elements volume of the user's manual for a detailed description)) tem n (dp,sc,in) (int,sc,in)
- temperature at which to evaluate material - number of properties to be evaluated. (20 maximum) If n = 1, use prope1 instead. - values of material property
1.4.12 Subroutine pstevl (Evaluating EX, NUXY, GXY, ALPX, and DENS at Element Temperature)
subroutine pstev1 (elem,matin,tem,prop) c *** primary function: to evaluate material properites for 1-d elements c c *** Notice - This file contains ANSYS Confidential information *** c c input arguments: c elem (int,sc,in) - element number (for anserr) c matin (int,sc,in) - material reference number c if negative, no required properties c tem (dp,sc,in) - temperature for evaluation c c output arguments: c prop (dp,ar(5),out) - material properties: ex,nuxy,gxy,alpx,dens c
1.4.13 Function gtplop (Retrieving the Start Point for Plastic Data)
function gtplop (mat,plopt) c *** primary function: get the plasticity option c *** secondary function: return the virtual starting address for the data c (see nlpropcheck for similar logic) c c *** Notice - This file contains ANSYS Confidential information *** c c input arguments: c mat (int,sc,in) - material reference number c c output arguments: c plopt (int,sc,out) - plasticity option: c 1 bkin c 2 mkin c 3 miso c 4 biso c 5 aniso c 6 dp c 7 anand c 12 melas c 100 user c gtplop (int,sc,out) - virtual starting position of the data c
1.4.14 Function gtcrop (Retrieving the Start Position for Creep Data)
function gtcrop (mat,cropt) c *** primary function: get the creep options
c *** secondary function: return the virtual starting address for the data c (see nlpropcheck for similar logic) c c *** Notice - This file contains ANSYS Confidential information *** c c input arguments: c mat (int,sc,in) - material reference number c c output arguments: c cropt (int,sc,out) - creep option: c 10000*(irrad+1) + 1000*(secondary+1) + c (primary+1) c where: c primary - primary creep (constant C6) c secondary - secondary creep (constant C12) c irrad - irradation induced (constant C66) c see creep table documentation c (TB command) c gtcrop (int,sc,out) - virtual starting position of the data c
1.4.15 Function gtswop (Retrieving the Start Position for Swelling Data)
function gtswop (mat,swopt) c *** primary function: get the swelling option c *** secondary function: return the virtual starting address for the data c (see nlpropcheck for similar logic) c c *** Notice - This file contains ANSYS Confidential information *** c c input arguments: c mat (int,sc,in) - material reference number c c output arguments: c swopt (int,sc,out) - swelling option: c 10000*(irrad+1) + 1000*(secondary+1) + c (primary+1) c where: c primary - primary swelling (constant C6) c secondary - secondary swelling (constant C12) c irrad - irradation induced (constant C66) c see swelling table documentation (TB command) c gtswop (int,sc,out) - virtual starting position of the data
subroutine tbuser (mat,numitm,tbprop) c *** primary function: return the tb data for the user table c c *** Notice - This file contains ANSYS Confidential information *** c c input arguments: c mat (int,sc,in) - material property number c numitm (int,sc,in) - the number of data items requested c c output arguments: c tbprop (dp,ar(numitm),out) - array of tb data
c c c c
et
(dp,sc,out)
c elem (int,sc,in) c intpt (int,sc,in) c mat (int,sc,in) c kstart (int,sc,in) table c epswel (dp,sc,inout) c epel (dp,sc,inout) c e (dp,sc,in) c fluen (dp,sc,in) c dfluen (dp,sc,in) c tem (dp,sc,in) c dtem (dp,sc,in) c usvr (dp,ar(*),inout) usersw) c c output arguments: c epel (dp,sc,inout) c epswel (dp,sc,inout) c usvr (dp,ar(*),inout) c
element number (label) element integration point number material reference number virtual starting address of the data swell strain at previous substep elastic strain elastic young'S MODULUS fluence at the end of this substep fluence increment over this substep temperature at the end of this substep temperature increment over this substep user-defined state variables (for
- elastic strain adjusted for swelling inc - updated swelling strain - updated user-defined state variables
c input arguments: c variable (typ,siz,intent) c elem (int,sc,in) c iout (int,sc,in) c nbsvr (int,sc,in) c bsvr (dp,ar(nbsvr),in) c nnrsvr (int,sc,in) c nrsvr (dp,ar(nnrsvr),in) c npsvr (int,sc,in) c psvr (dp,ar(npsvr),in) c ncsvr (int,sc,in) c csvr (dp,ar(ncsvr),in) c nusvr (int,sc,in) variables c usvr (dp,ar(nusvr),in) c nnode (int,sc,in) c nodes (int,ar(nnode),in) c xyz (dp,ar(6,nnode),in) c vol (dp,sc,in) c leng (dp,sc,in) c time (dp,sc,in) c timinc (dp,sc,in) c nutot (int,sc,in) c utot (dp,ar(nutot),in) c maxdat (int,sc,in) c c c output arguments: c variable (typ,siz,intent) c numdat (int,sc,out) udbdat c udbdat (dp,ar(maxdat),out) end c
description - element number - output unit number - number of basic element variables - basic element variables - number of nonlinear element variables - nonlinear element variables - number of plasticity element variables - plasticity element variables - number of creep element variables - creep element variables - number of user-supplied element user-supplied element variables number of nodes node numbers nodal coordinates and rotations (virgin) element volume (or area if 2-d) element length (beams,spars,etc) current time current sub step time increment length of dof solution vector utot solution vector size of user output array (3 x nnode) actually, = ielc(nmnmup)
description - number of user output items in array - user output items to be placed at the of the nmisc record
1.4.23 Subroutine eldwrn (Writing Element Nonsummable Miscellaneous Data to the Results File)
subroutine eldwrn (elem,ielc,lcerst,edindx,nudb,udbdat,nval,value, x ndval) c *** primary function: output element nonsummable miscellaneous data c to result file c *** Notice - This file contains ANSYS Confidential information *** c input arguments: c elem (int,sc,in) c ielc (int,ar(IELCSZ),in) c c lcerst (int,sc,inout) c edindx (int,ar(25),inout)c nudb (in,sc,in) c udbdat (dp,ar(*),in) c nval (int,sc,in) c c ielc(NMNMIS), c as c c value (dp,ar(ndval),in) c ndval (int,sc,in) than c element number element characteristic vector defined in elccmt pointer to results file position index to results file data size of what the user wants to add what the user wants to add the total number of values to be output(does not include nudb) this should -always- be unless there is a variable number, in the layered shell elements. output values dimension of value - must be no less ielc(NMNMIS) + ielc(NMNMUP)
c *** Notice - This file contains ANSYS Confidential information *** c c ref(old): eqn. 20(transposed),rankin and brogan, jpvt,108(1986)165-174. c ref(new): eqn. (b.4), simo and vu-quoc, cmame, 58 (1986), 79-116 c c variable descriptions: c input: c rot - rotation pseudovector c output: c tr - transformation matrix corresponding to rot c
c c c c c
v1 = cos(v1/2) + 1/2*w1, w1 = 2*sin(v1/2)*e1 v2 = cos(v2/2) + 1/2*w2, w2 = 2*sin(v2/2)*e2 v21 = v2*v1 = cos(v21/2) + 1/2*w21 (quarternion multiplication) w1 =: v21 (w1 is updated)
c c c c c c
(dp,ar(ndat),out) - pressures at this iteration (dp,ar(ndat),out) - pressure at end of this load step (int,sc,out) - flag if pressure exist = 0 - no pressure = 1 - yes pressure
c c c c c c c c c c c c c c c c c c c
typ=int,dp,log,chr,dcp
siz=sc,ar(n),func
intent=in,out,inout
input arguments: variable (typ,siz,intent) iel (int,sc,in) ielc (int,ar(IELCSZ),in) nnod (int,sc,in) nodes (int,ar(nnod),in) ndat (int,sc,in) begdat (dp,ar(ndat),in) output arguments: dat (dp,ar(ndat),out) enddat (dp,ar(ndat),out) iexist (int,sc,out)
description - element number - array of element type characteristics - number of nodes in the nodes array - list of nodes - number of data items to get - data at the beginning of this load step - data at this time point - data at end of this load step - flag if heat generation exist = 0 - no heat generation = 1 - yes heat generation
Computing load vectors for frequency domain logic Storing element output that users supply Modifying the orientation of material properties and stresses Modifying the orientation of material properties and stresses of layers within an element Performing a user-defined operation on a parameter for the COMBIN7 and COMBIN37 elements. Providing a user-defined initial thickness for SHELL181. Providing a user-defined initial strain for SHELL181. Providing a user-defined fictive temperature relationship for VISCO88 and VISCO99. Provides visco-elastic computation in the stiffness pass for VISCO88 and VISCO99.
1.5.1 Subroutine userfd (Computing the Complex Load Vector for Frequency Domain Logic)
subroutine userfd (nr,kpeak,kcbrm,kpfor,ktrsur,isur, x cd,cm,ct,cb,do,doext,aread,alenv,nuxy,faclen,conac,fluidt,visc, x dprtem,watmot,xyzup,tr,accel,puvel,u,zass, x forl,zsc,zsc2,pdyn,holdwv) c *** primary function: compute complex load vector for frequency domain logic c *** secondary functions: none c -- accessed with keyopt(12) = 2 c c *** ansys(r) copyright(c) 1971,78,82,83,85,87,89,92,94-97 c *** ansys, inc. c *** Notice - This file contains ANSYS Confidential information *** c c input arguments: c nr (int,sc,in) - matrix size c kpeak (int,sc,in) - keyopt for wave combinations c kcbrm (int,sc,in) - key for reduced matrices/cable option c kpfor (int,sc,in) - keyopt for wave printout c ktrsur (int,sc,in) - keyopt for surface treatment(unfinished) c isur (int,sc,in) - surface flag c cd (dp,sc,in) - normal drag coefficient (real constant) c cm (dp,sc,in) - inertial coefficient (real constant) c ct (dp,sc,in) - tangential drag coefficient (real constant) c cb (dp,sc,in) - buoyancy coefficient (real constant) c do (dp,sc,in) - outside diameter of pipe c doext (dp,sc,in) - outside diameter of insulation c aread (dp,sc,in) - area of displaced water c alenv (dp,sc,in) - length of element c nuxy (dp,sc,in) - poisson'S RATIO c faclen (dp,sc,in) - wetted fraction of pipe c conac (dp,sc,in) - added mass per unit length c fluidt (dp,sc,in) - fluid temperature c visc (dp,sc,in) - viscosity c dprtem (int,sc,in) - size of water motion table c watmot (dp,ar(1278),in) - water motion table c xyzup (dp,ar(3,2),in) - updated coordinates c tr (dp,ar(3,3),in) - local to global transformation matrix c accel (dp,ar(3),in) - acceleration vector c puvel (int,sc,in) - index for velocities in u matrix c u (dp,ar(nr,5),in - displacements and velocities c zass (dp,ar(nr,nr),in) - mass matrix c forl (dp,ar(12),inout) - force vector in element coordinates c zsc (dp,ar(nr),inout) - real load vector for frequency domain c zsc2 (dp,ar(nr),inout) - complex load vector for frequency domain c c output arguments: c forl (dp,ar(12),inout) - force vector in element coordinates c zsc (dp,ar(nr),inout) - real load vector for frequency domain c zsc2 (dp,ar(nr),inout) - complex load vector for frequency domain c pdyn (dp,ar(2),out) - dynamic pressure c holdwv (dp,ar(60),out) - wave information held for printout c
c maxdat (int,sc,in) c c output arguments: c variable (typ,siz,intent) c numdat (int,sc,out) udbdat c ielc(NMNMUP) c number c c udbdat (dp,ar(maxdat),out) end c c
- size of user output array (3 x nnode) description - number of user output items in array (maximum size of numdat is which is usually three times the of nodes. - user output items to be placed at the of the nmisc record
1.5.4 Subroutine usanly (Modifying Orientation of Material Properties and Stresses of Layers)
subroutine usanly (vn,vref,elem,thick,xyzctr,ln,bsangl) c c user written routine to modify orientation of material properties c and stresses of layers within an element ************************** c applicable to shell91,99, and solid46 c accessed with keyopt(4) c c *** ansys(r) copyright(c) 1971,78,82,83,85,87,89,92,94-97 c *** ansys, inc. c *** Notice - This file contains ANSYS Confidential information *** c c **** warning *** do not change any arguments other than bsangl. c if you do, your results are probably wrong. c input(do not change)--c vn = vector normal to element c vref = unit vector orienting element, essentially edge i-j c elem = element number c thick = thickness of layer ln at this point (see note below) c xyzctr = location of element centroid or integration point c ln = layer number c c output--c bsangl = output from this subroutine. it represents the angle(s) c between vref and the desired orientation of the layer. c it may have the default orientation coming in to useran. c c this angle does not affect the angle given in the printout. c users may want to add their own angle printout in usanly. c c also, this angle does not affect the angle shown using the c layplot or laylist commands c c use 1 angle for 2-d elements and shells c use 3 angles for 3-d solids c c the programmer of usanly can base their logic on the location c of the point in space, or an element attributes, such as thick c
1.5.5 Subroutine userrc (Performing User Operations on COMBIN7 and COMBIN37 Parameters)
c c c c *** ansys(r) copyright(c) 1971,78,82,83,85,87,89,92,94-97 c *** ansys, inc. c *** Notice - This file contains ANSYS Confidential information *** c c input arguments: c variable (typ,siz,intent) description c elem (int,sc,in) - element number c ireal (int,sc,in) - element real constant number subroutine userrc (elem,ireal,type,nusvr,usvr,parm,parmld, x c1,c2,c3,c4,fcon) primary function: user operation on parameter for combin7 and combin37 accessed with keyopt(9) = 1
c type (int,sc,in) - element type number c nusvr (int,sc,in) - number of user-supplied element variables c usvr (dp,ar(nusvr),inout) - user-supplied element variables c parm (dp,sc,in) - current value of the paramater c parmld (dp,sc,in) - value of the parameter at previous time ste c c1 (dp,sc,in) - real constant c1 c c2 (dp,sc,in) - real constant c2 c c3 (dp,sc,in) - real constant c3 c c4 (dp,sc,in) - real constant c4 c c output arguments: c variable (typ,siz,intent) description c usvr (dp,ar(nusvr),inout) - user-supplied element variables c may be sent .rst file with usereo c fcon (dp,sc,out) - result of calculation c c either c1 or c3 must be nonzero for this logic to be accessed, c
c *** Notice - This file contains ANSYS Confidential information *** c c c c c c c c c c *** ansys(r) copyright(c) 1971,78,82,83,85,87,89,92,94-97 *** ansys, inc. typ=int,dp,log,chr,dcp input arguments: variable (typ,siz,intent) prs (dp,ar(5),in) rvrp (dp,ar(11),in) angle (dp,sc,in) ex (dp,sc,in) nuxy (dp,sc,in) siz=sc,ar(n) intent=in,out,inout
description pressure vector real constants(see elements manual) subtended angle Young's modulus Poisson's ratio description rotation caused by internal pressure on elbow element
*** ansys(r) copyright(c) 1971,78,82,83,85,87,89,92,94-97 *** ansys, inc. typ=int,dp,log,chr,dcp siz=sc,ar(n) intent=in,out,inout
c input arguments: c variable (typ,siz,intent) description c elem (int,sc,in) - User element number c nr (int,sc,in) - number of rows in element matrix c ls (int,ar(nr),in) - Dof Index vector for this element matrix c zs (dp,ar(nr,nr,4),inout)- K,M,C,SS matrices for this element c zsc (dp,ar(nr,2),inout) - Element load vector and N-R correction vec c uelm (dp,ar(nr,5),in) - Nodal displacements for this element c ielc (int,ar(150),in) - Element type characteristics c nodes (int,ar(*),in) - Nodes for this element c edof (int,ar(*),in) - Dofs per node for this element c elmdat (int,ar(10),in) - Element data for this element c xyzang (dp,ar(6,*),in) - X,Y,Z,THXY,THYZ,THZX for each element node c lenu (int,sc,in) - Length of global displacement vector c output arguments: c zs (dp,ar(nr,nr,4),inout)- K,M,C,SS matrices for this element c zsc (dp,ar(nr,2),inout) - Element load vector and N-R correction vec c WARNING: any CHANGES to these (or any other) arguments will have a direc c impact on the solution, possibly giving meaningless results. The normal c usage of this routine is simply monitor what is happening.
$ numDomIntPts, curCoords, thickness) ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c c *** primary function: get the user defined thickness c c *** ansys(r) copyright(c) 1998 c *** ansys, inc. c c input arguments c =============== c Variable (type,sz,i/o) description c elemId (int,sc,i) element number c elemType (int,sc,i) element TYPE (181 etc.) c matId (int,sc,i) material number c realId (int,sc,i) real constant set number c numDomIntPts (int,sc,i) number of integration points c curCoords (dp,ar(3,numDomIntPts),i) c current coordinates c c output arguments c ================ c thickness (dp,ar(3,numDomIntPts),o) c thickness at the integration points c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c c --- parameters c #include "impcom.inc" EXTERNAL erhandler c c --- argument list c INTEGER elemId, elemType, numDomIntPts, matId, realId DOUBLE PRECISION curCoords(3,numDomIntPts), $ thickness (numDomIntPts) c c --- local variables c INTEGER i cc COMMON /dummyIniThick/ errFlag ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c --- B E G I N C O D I N G c c --- author of UTHICK.F should remove the following error message c and any unnecessary flags. c CALL erhandler ('uthick', 5000, 2, 'ANSYS, Inc.-supplied $ version of UTHICK has been used. This $ works with the COMMENTED EXAMPLE input $ attached with uthick.F', 0.d0, ' ') c c --- linearly varying thickness for the cantilever model in the c commented example; thick(x=0) = 0.1, thick(x=10) = 0.05 c DO i=1,numDomIntPts thickness(i) = 0.1d0*(1.d0-curCoords(1,i)/20.d0)
END DO c 990 c RETURN END ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc ccccccccccccc c c C O M M E N T E D I N P U T F I L E T O B E U S E D W I T H c c T H E A N S Y S S U P P L I E D U T H I C K c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc ccccccccccccc c!/batch,list c!/verify,ev181-57s c!/title,ev181-57s, Variable thickness shell with UTHICK c!/nolist c!/nopr c!/out,scratch c! c!/prep7 c! c!!!!!!! STANDARD USE OF SHELL 181 with Variable Thickness !!!!! c! c!*dim,thick,,10 c!thick(1) = 0.0975 c!thick(2) = 0.0925 c!thick(3) = 0.0875 c!thick(4) = 0.0825 c!thick(5) = 0.0775 c!thick(6) = 0.0725 c!thick(7) = 0.0675 c!thick(8) = 0.0625 c!thick(9) = 0.0575 c!thick(10)= 0.0525 c! c!*dim,lnodes,,11 c!*dim,unodes,,11 c! c!*do,i,1,11 c! x = (i-1)*1.0 c! n,i,x c! n,i+11,x,1.0 c! lnodes(i) = i c! unodes(i) = i+11 c!*enddo c! c!et,1,181 c!mp,ex,1,1000 c!mp,nuxy,1,0.3 c! c!*do,i,1,10 c! r,i,thick(i) c! real,i CONTINUE
c! e,lnodes(i),lnodes(i+1),unodes(i+1),unodes(i) c!*enddo c! c!!!!!!! USE OF SHELL 181 with Variable Thickness Through UTHICK !!!!! c! c!*dim,l2nod,,11 c!*dim,u2nod,,11 c!*do,i,1,11 c! x = (i-1)*1.0 c! n,i+22,x,2.0 c! n,i+33,x,3.0 c! l2nod(i) = i+22 c! u2nod(i) = i+33 c!*enddo c! c!et,2,181 c!keyopt,2,9,1 c!r,11 c!type,2 c!real,11 c! c!*do,i,1,10 c! e,l2nod(i),l2nod(i+1),u2nod(i+1),u2nod(i) c!*enddo c! c!/out c!elist c!etlist c!/out,scratch c! c!nsel,s,loc,x, c!d,all,ux c!d,all,uz c!d,all,rotx c!d,all,rotz c!d,all,roty c! c!nsel,s,loc,y c!d,all,uy c! c!nsel,s,loc,y,2.0 c!d,all,uy c! c!nsel,s,loc,x,10.0 c!f,all,my,0.004 c!alls c!fini c! c!/solu c!outres,all,all c!nlgeom,on c!solc,on c!nsubst,10,,5 c!eqslv,sparse c!solve c!fini c!
c!/post1 c!set,last c!nsel,s,loc,x,10.0 c!/out c!/com c!/com, ------------------------------------------------------c!/com, | Results of Node # 11 and 22 are from the standard use c!/com, | of SHELL181; the results of Node # 33 and 44 are c!/com, | obtained by using UTHICK (keyopt 9 = 1) and should c!/com, | match the results of node # 11 and 22 c!/com, ------------------------------------------------------c!/com c!prdi c!/out,scratch c!finish c! c!/delete,ev181-57s.emat c!/delete,ev181-57s.err c!/delete,ev181-57s.esav c!/delete,ev181-57s.osav c!/delete,ev181-57s.log c!/delete,ev181-57s.mntr c!/delete,ev181-57s.rst c!/delete,ev181-57s.full c!/golist c!/exit,nosave
| | | |
c curSecPt (int,sc,i) current point through the thickness in the c current layer c numDirect (int,sc,i) number of direct stress comp c (s_xx,s_yy,s_zz) c numShear (int,sc,i) number of shear stress comp c (s_xy,s_yz,s_zx) c curCoords (dp,ar(3),i) current coordinates c tLocation (dp,sc,i) normalized thickness location c (shell elements only) c -1 = bottom or first sec pt c +1 = top or last sec pt c 0 = mid surface c c output arguments c ================ c iniData (dp,ar(numDirect+numShear),o) c user input stress values c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c c --- parameters c #include "impcom.inc" EXTERNAL erhandler c c --- argument list c INTEGER elemId, elemType, matId, curIntPt, curLayer, $ curSecPt, numDirect, numShear DOUBLE PRECISION curCoords(3), tLocation, basis(3,3), $ iniData(numDirect+numShear) c c --- local variables c INTEGER i,j,k DOUBLE PRECISION dummy (4,5,10) cc COMMON /dummyIniDat/ dummy,errFlag ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c --- B E G I N C O D I N G c c --- author of USTRESS.F should remove the data statement, error msgs c and any unnecessary flags. The data you define here does not c necessarily have to be done with data statement c DATA (((dummy(i,j,k),i=1,4),j=1,5),k=1,2) / $ -0.1200E+02, -0.1249E+01, 0.0000E+00, -0.4003E-04, $ -0.7202E+01, -0.7495E+00, 0.0000E+00, 0.4515E-04, $ 0.1924E-04, -0.6599E-03, 0.0000E+00, 0.1729E-03, $ 0.7202E+01, 0.7481E+00, 0.0000E+00, 0.3007E-03, $ 0.1200E+02, 0.1247E+01, 0.0000E+00, 0.3859E-03, $ -0.1200E+02, 0.3359E+00, 0.0000E+00, 0.1337E-02, $ -0.7201E+01, 0.2019E+00, 0.0000E+00, 0.7683E-03, $ 0.1732E-03, 0.8891E-03, 0.0000E+00, -0.8421E-04, $ 0.7201E+01, -0.2001E+00, 0.0000E+00, -0.9367E-03, $ 0.1200E+02, -0.3341E+00, 0.0000E+00, -0.1505E-02/ DATA (((dummy(i,j,k),i=1,4),j=1,5),k=3,4) /
$ $ $ $ $ $ $ $ $ $
-0.1200E+02, -0.9424E-01, 0.0000E+00, -0.7202E+01, -0.5653E-01, 0.0000E+00, 0.4304E-03, 0.2657E-04, 0.0000E+00, 0.7202E+01, 0.5659E-01, 0.0000E+00, 0.1200E+02, 0.9429E-01, 0.0000E+00, -0.1200E+02, 0.3043E-01, 0.0000E+00, -0.7200E+01, 0.1827E-01, 0.0000E+00, 0.6953E-03, 0.3727E-04, 0.0000E+00, 0.7201E+01, -0.1820E-01, 0.0000E+00, 0.1200E+02, -0.3036E-01, 0.0000E+00, DATA (((dummy(i,j,k),i=1,4),j=1,5),k=5,6) / $ -0.1200E+02, -0.1066E-01, 0.0000E+00, $ -0.7200E+01, -0.6225E-02, 0.0000E+00, $ 0.8873E-03, 0.4321E-03, 0.0000E+00, $ 0.7201E+01, 0.7089E-02, 0.0000E+00, $ 0.1200E+02, 0.1153E-01, 0.0000E+00, $ -0.1200E+02, 0.4769E-02, 0.0000E+00, $ -0.7197E+01, 0.2935E-02, 0.0000E+00, $ 0.9262E-03, 0.1837E-03, 0.0000E+00, $ 0.7199E+01, -0.2568E-02, 0.0000E+00, $ 0.1200E+02, -0.4402E-02, 0.0000E+00, DATA (((dummy(i,j,k),i=1,4),j=1,5),k=7,8) / $ -0.1199E+02, -0.2508E-02, 0.0000E+00, $ -0.7195E+01, -0.1396E-02, 0.0000E+00, $ 0.7471E-03, 0.2729E-03, 0.0000E+00, $ 0.7197E+01, 0.1941E-02, 0.0000E+00, $ 0.1199E+02, 0.3054E-02, 0.0000E+00, $ -0.1198E+02, 0.3654E-02, 0.0000E+00, $ -0.7191E+01, 0.2247E-02, 0.0000E+00, $ 0.2508E-03, 0.1354E-03, 0.0000E+00, $ 0.7191E+01, -0.1976E-02, 0.0000E+00, $ 0.1199E+02, -0.3383E-02, 0.0000E+00, DATA (((dummy(i,j,k),i=1,4),j=1,5),k=9,10) / $ -0.1198E+02, -0.4337E-02, 0.0000E+00, $ -0.7186E+01, -0.2616E-02, 0.0000E+00, $ -0.6408E-03, -0.3430E-04, 0.0000E+00, $ 0.7185E+01, 0.2547E-02, 0.0000E+00, $ 0.1198E+02, 0.4269E-02, 0.0000E+00, $ -0.1197E+02, -0.1326E-02, 0.0000E+00, $ -0.7181E+01, -0.8506E-03, 0.0000E+00, $ -0.1444E-02, -0.1371E-03, 0.0000E+00, $ 0.7178E+01, 0.5763E-03, 0.0000E+00, $ 0.1196E+02, 0.1052E-02, 0.0000E+00, c i = 0 j = 0 k = 0 c
-0.1560E-02, -0.9405E-03, -0.1124E-04, 0.9180E-03, 0.1537E-02, 0.9459E-03, 0.5991E-03, 0.7890E-04, -0.4413E-03, -0.7882E-03/ -0.4662E-03, -0.3059E-03, -0.6545E-04, 0.1750E-03, 0.3353E-03, 0.2606E-03, 0.1814E-03, 0.6259E-04, -0.5620E-04, -0.1354E-03/ -0.3990E-04, -0.3183E-04, -0.1972E-04, -0.7612E-05, 0.4584E-06, 0.2321E-03, 0.1487E-03, 0.2362E-04, -0.1015E-03, -0.1849E-03/ 0.2315E-03, 0.1461E-03, 0.1810E-04, -0.1099E-03, -0.1953E-03, 0.7206E-03, 0.4404E-03, 0.2012E-04, -0.4002E-03, -0.6803E-03/
IF (curIntPt.EQ.1 .AND. curLayer.EQ.1 .AND. curSecPt.EQ.1) THEN CALL erhandler ('ustress', 5000, 2, 'ANSYS, Inc.-supplied $ version of USTRESS has been used. This $ works with the COMMENTED EXAMPLE input $ attached with ustress.F', 0.d0, ' ') END IF c iniData(1) = dummy(1,curSecPt,elemId) iniData(2) = dummy(2,curSecPt,elemId)
iniData(3) = dummy(3,curSecPt,elemId) iniData(4) = dummy(4,curSecPt,elemId) c 990 c RETURN END ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc cccccccccccccccc c c C O M M E N T E D I N P U T F I L E T O B E U S E D W I T H c c T H E A N S Y S S U P P L I E D U S T R E S S c ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc cccccccccccccccc c!/batch,list c!/PREP7 c! c!et,1,181 c!keyopt,1,10,1 c!r,1,1.0 c! c!mp,ex,1,1000 c!mp,nuxy,1,0.3 c! c!NBLOCK,6,SOLID c!(3i8,6e16.9) c! 23 0 0 0.000000000E+00 c! 24 0 0 9.90525175 0.000000000E+00 -1.18849741 c! 25 0 0 0.999933795 0.000000000E+00-1.162898000E-02 c! 26 0 0 1.99930664 0.000000000E+00-4.697524623E-02 c! 27 0 0 2.99754302 0.000000000E+00-0.106378219 c! 28 0 0 3.99406599 0.000000000E+00-0.189702267 c! 29 0 0 4.98830170 0.000000000E+00-0.296924624 c! 30 0 0 5.97967935 0.000000000E+00-0.427972294 c! 31 0 0 6.96762690 0.000000000E+00-0.582764249 c! 32 0 0 7.95157929 0.000000000E+00-0.761199170 c! 33 0 0 8.93097304 0.000000000E+00-0.963156159 c! 34 0 0 9.90524927 1.00000034 -1.18850710 c! 35 0 0 0.000000000E+00 0.999997689 c! 36 0 0 8.93097042 1.00000026 -0.963168610 c! 37 0 0 7.95157631 1.00000006 -0.761213374 c! 38 0 0 6.96762465 1.00000006 -0.582779590 c! 39 0 0 5.97967659 1.00000004 -0.427988151 c! 40 0 0 4.98830027 0.999999775 -0.296940984 c! 41 0 0 3.99406429 1.00000056 -0.189719078 c! 42 0 0 2.99754103 0.999999100 -0.106393013 c! 43 0 0 1.99930796 1.00000069 -4.699745205E-02 c! 44 0 0 0.999931339 1.00000098 -1.163438631E-02 c!N,R5.3,LOC, -1, c!N,R5.1,LOC, -1, c! c!EBLOCK,18,SOLID c!(18i7) CONTINUE
c! 1 1 1 1 0 0 0 0 4 0 23 25 44 35 c! 1 1 1 2 0 0 0 0 4 0 25 26 43 44 c! 1 1 1 3 0 0 0 0 4 0 26 27 42 43 c! 1 1 1 4 0 0 0 0 4 0 27 28 41 42 c! 1 1 1 5 0 0 0 0 4 0 28 29 40 41 c! 1 1 1 6 0 0 0 0 4 0 29 30 39 40 c! 1 1 1 7 0 0 0 0 4 0 30 31 38 39 c! 1 1 1 8 0 0 0 0 4 0 31 32 37 38 c! 1 1 1 9 0 0 0 0 4 0 32 33 36 37 c! 1 1 1 10 0 0 0 0 4 0 33 24 34 36 c! -1 c!EN,R5.1,ATTR, -1, c! c!nsel,s,loc,x, c!d,all,ux c!d,all,uz c!d,all,rotx c!d,all,rotz c!d,all,roty c! c!nsel,s,loc,y c!d,all,uy c!nall c! c!fini c! c!/solu c! c!nlgeom,on c!solcontrol,on c!nropt,full,,off c!lnsrch,off c!nsubst,1 c!outres,all,all c!cnvtol,f,,,,1.0e-4 c!cnvtol,m,,,,1.0e-4 c!eqslv,sparse c!solve c! c!/post1 c!set,last c!pres,s c!prdi ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc cccccccccccccccc
c c c ***** notice- this routine contains ansys, inc. confidential information **** c c *** ansys(r) copyright(c) 1971,78,82,83,85,87,89,92,94-97 c *** ansys, inc. c c input arguments: c veinpt (dp,ar(95),in) - viscoelastic input data c ncomp (int,sc,in) - number of components (4 or 6) c tem (dp,sc,in) - temperature c dtem (dp,sc,in) - incremental temperature c ex (dp,sc,in) - bulk modulus at infinite time c gxy (dp,sc,in) - shear modulus at infinite time c smcm (dp,ar(ncomp,ncomp),in) - material matrix for shear modulus c bmcm (dp,ar(ncomp,ncomp),in) - material matrix for bulk modulus
c epsl (dp,ar(ncomp),in) - strain for previous iteration c epst (dp,ar(ncomp),in) - total strain for current iteration c tref (dp,sc,in) - reference temperature c c output arguments: c eex (dp,sc,out) - effective bulk modulus c egxy (dp,sc,out) - effective shear modulus c phil (dp,sc,inout) - previous shift factor c zil (dp,sc,inout) - previous pseudo time c g1l (dp,ar(ncomp,10),out) - recursive shear relaxation c g2l (dp,ar(ncomp,10),out) - recursive bulk relaxation c hsm (dp,ar(10),out) - recursive shear relaxation c hbm (dp,ar(10),out) - recursive bulk relaxation c ftl (dp,sc,inout) - previous fictive temperature c dftl (dp,ar(10),out) - incremental fictive temperature c tvc (dp,sc,inout) - total volume change c dvc (dp,sc,out) - incremental volume change c dsig (dp,ar(ncomp),out) - stress change c rsig (dp,ar(ncomp),out) - stress relaxation c cm (dp,ar(ncomp,ncomp),out)- total material matrix c kerr (int,sc,out) - error key c c argument of convenience: c cml (dp,ar(ncomp,ncomp),none)- no value (used only to avoid simplify c logic due to variable array sizes)
Writing your own plasticity, creep, or swelling laws Updating the nonlinear strain history for a user-defined material Checking material data you've defined Computing the derivatives of the strain energy density "W" with respect to its invariants Controlling hygrothermal growth.
Note-If you write a material behavior routine using any of the ANSYS commands MPDATA, MPDELE, TB, or TBDELE, be aware that these commands interpret the string "_MATL" to mean the current active material when it appears in their MAT field. The "_MATL" is used in conjunction with the library (LIB) option of the MPREAD and MPWRITE commands. MPWRITE inserts "_MATL" in lieu of the specified material number as these commands are written to the material library file. This occurs only when you use the LIB option. When ANSYS reads a material
library file written in this format, it interprets "_MATL" to mean the currently active material (as defined by the MAT,MAT command). Don't use the "_MATL" string outside the scope of the MPREAD command.
c d (dp,ar(ncomp,ncomp),in)- elastic stress-strain matrix c ktform (int,sc,in) - request key for tangent matrix formation c (=1, form tangent =0, do not form) c c timval (dp,sc,in) - current time value c timinc (dp,sc,in) - time increment over this substep c c tem (dp,sc,in) - temperature at the end of this substep c dtem (dp,sc,in) - temperature increment over this substep c toffst (dp,sc,in) - temperature offset from absolute zero c flu (dp,sc,in) - fluence at the end of this substep c dflu (dp,sc,in) - fluence increment over this substep c c epel (dp,ar(ncomp),inout)- modified total strain (trial strain) c epel = eptot - eppl - eptherm - ... c if a large strain analysis, epel is c rotation neutralized and is the hencky c (i.e. log) strain c eppl (dp,ar(ncomp),inout)- plastic strain from previous substep c c statev (dp,ar(ncomp,6),inout)- state variables from previous substep c usvr (dp,ar(nuval,nintp),inout)- additional state variables from c previous equilibrium iteration (saved c if the nsvr command is used) c c epeq (dp,sc,inout) - effective plastic strain from prev substep c plwork (dp,sc,inout) - accumulated plastic work from prev substep c c output arguments: c variable (type,size,intent) description c c epel (dp,ar(ncomp),inout)- elastic strain c eppl (dp,ar(ncomp),inout)- updated plastic strain c c statev (dp,ar(ncomp,6),inout)- updated state variables c usvr (dp,ar(nuval,nintp),inout)- updated additional state variables c c epeq (dp,sc,inout) - updated effective plastic strain c plwork (dp,sc,inout) - updated accumulated plastic work c c sigepl (dp,sc,out) - stress value on stress-strain curve at epeq c sigrat (dp,sc,out) - ratio of trial stress to yield stress c depeq (dp,sc,out) - increment in plastic strain (equivalent) c (used for auto time stepping - time step c is reduced if it exceeds .05) c c dt (dp,ar(ncomp,ncomp),out)- material tangent modulus c c fortran parameters (to be defined by the user): c variable (type) description c numinp (int) - number of data items in the user-defined c data table (tbdat commands) c nuval (int) - number of additional state variables per c integration point
c nintp (int) c c c note: nuval x nintp c c internal variables: c variable (type,size) c b (dp,ar(6,6)) c c (dp,ar(6,12)) c con (dp,sc) c deppl (dp,ar(6)) c dfds (dp,ar(6)) c dlamb (dp,sc) c ep (dp,ar(6)) c epshfo (dp,ar(6)) surf) c epshft (dp,ar(6)) c et (dp,sc) c h (dp,sc) strain) c n2 (int,sc) c seqtr (dp,sc) c sigtr (dp,ar(6)) c sigy (dp,sc) c vect (dp,ar(6)) c
- maximum number of integration points of an element to be used with this routine (14 is the maximum) = nstv(on nsvr command); cannot exceed 840! description - 2nd derivative of the yield function - part of deff - temporary variable - plastic strain increment - derivative of the yield function (normal) - plastic multiplier - shifted strain - initial shift strain (center of the yield - shift strain (center of the yield surface) - tangent modulus (stress/total strain) - plastic tangent modulus (stress/plastic ncomp squared, ncomp*ncomp equivalent (von mises) trial stress trial stress yield stress temporary vector
c (useful for initializing state variables c to a non-zero value) c kfsteq (int,sc,in) - 1 if first equilibrium iteration of a c substep, 0 otherwise c c c e (dp,sc,in) - elastic young'S MODULUS c posn (dp,sc,in) - poisson'S RATIO c d (dp,ar(ncomp,ncomp),in)- elastic stress-strain matrix c proptb (dp,ar(72),in) - material properties input on tb commands c c timval (dp,sc,in) - current time value c timinc (dp,sc,in) - time increment over this substep c tem (dp,sc,in) - temperature at the end of this substep c dtem (dp,sc,in) - temperature increment over this substep c toffst (dp,sc,in) - temperature offset from absolute zero c fluen (dp,sc,in) - fluence at the end of this substep c dfluen (dp,sc,in) - fluence increment over this substep c c epel (dp,ar(ncomp),inout)- elastic strain c epcrp (dp,ar(ncomp),inout)- creep strain from previous substep c statev (dp,ar(ncomp*5+2),inout)- state variables from previous substep c usvr (dp,ar(nuval,nintp),inout)- additional state variables from c previous equilibrium iteration (saved c if the nsvr command is used) c c c output arguments: c variable (type,size,intent) description c c epel (dp,ar(ncomp),inout)- elastic strain adjusted for creep increment c epcrp (dp,ar(ncomp),inout)- updated creep strain c statev (dp,ar(ncomp*5+2),inout)- updated state variables c usvr (dp,ar(nuval,nintp),inout)- updated additional state variables c delcr (dp,sc,out) - equivalent creep strain increment (used c for creep ratio calculation) c c fortran parameters (to be defined by the user): c variable (type) description c nuval (int) - number of additional state variables per c integration point c nintp (int) - maximum number of integration points of c an element to be used with this routine c (14 is the maximum) c note: nuval x nintp = nstv(on nsvr command); cannot exceed 840! c c internal variables: c variable (type,size) description c con (dp,sc) - temporary variable c del (dp,ar(6)) - creep strain increments c epet (dp,sc) - equivalent elastic strain (before creep) c ept (dp,ar(6)) - total strain c eptot (dp,sc) - equivalent total strain, elastic + creep c sigen (dp,sc) - equivalent stress (before creep) c temabs (dp,sc) - temperature on the absolute scale
subroutine uservp (elem,mat,kfirst,kfsteq,g,prop,timval,timinc, x tem,toffst,delepn,svrn,svri,usvr,epeln,epeli,strn,stri,depdt, x cee,eta,norm) c c *** primary function: update the nonlinear strain history for a c user-defined material for the viscoxxx elements c *** secondary functions: compute the material tangent terms c accessed with tb,user and keyopt(1) = 1 c c *** Notice - This file contains ANSYS Confidential information *** c c c *** ansys(r) copyright(c) 1971,78,82,83,85,87,89,92,94-97 c *** ansys, inc. c c input arguments: c variable (type,size,intent) description c c elem (int,sc,in) - element number (label) c mat (int,sc,in) - material reference number c kfirst (int,sc,in) - 1 if first time through, 0 otherwise c (useful for initializing state variables c to a non-zero value) c kfsteq (int,sc,in) - 1 if first equilibrium iteration of a c substep, 0 otherwise c c g (dp,sc,in) - shear modulus c prop (dp,ar(13),in) - linear material property array c (ex,ey,ez, gxy,gyz,gxz, nuxy,nuyz,nuxz, c alpx,alpy,alpz, dens) c c timval (dp,sc,in) - current time value c timinc (dp,sc,in) - time increment over this substep c c tem (dp,sc,in) - temperature at the end of this substep c toffst (dp,sc,in) - temperature offset from absolute zero c c delepn (dp,ar(3,3),in) - hencky strain increment over the substep c c svrn (dp,sc,in) - state variable from previous substep c svri (dp,sc,inout) - state variable from previous iteration c usvr (dp,ar(*),inout) - additional state variables from previous c iteration (saved if the nsvr command is c used) c c epeln (dp,ar(3,3),in) - elastic strain from previous substep c epeli (dp,ar(3,3),inout) - elastic strain from previous iteration c c strn (dp,ar(3,3),in) - stress from previous substep c stri (dp,ar(3,3),inout) - stress from previous iteration c c depdt (dp,sc,inout) - effective inelastic deformation rate c (d(deppl)/dt) from previous iteration c c output arguments: c variable (type,size,intent) description c
c c c c c c c c c c c c c c c c c c c c c c c
- updated state variable - updated additional state variables - updated elastic strain - updated stress - effective inelastic deformation rate - scalar linearization modulus (see below) - radial return factor (see below) - direction of plastic flow
fortran parameters (to be defined by the author): variable (type) description numinp (int) - number of data items in the user-defined data table (tbdat commands) nuval (int) - number of additional state variables per integration point nintp (int) - maximum number of integration points of an element to be used with this routine (8 is the maximum) note: nuval x nintp cannot exceed 840!
1.6.6 Subroutine usrmooeny (Computing Derivatives of Strain Energy Density with Respect to Invariants)
subroutine usrmooney (mat,xnu,xiii,ndf,wi,wij,wini,pi,pij,prs,bm) c c *** primary function: c
c this is a user subroutine to compute the derivatives of the c strain energy density 'W' with respect to its invariants. c the user can modify this subroutine in order to incorporate c their own material law. c accessed with keyopt(7) = 1 and tb,mooney c c *** Notice - This file contains ANSYS Confidential information *** c c *** ansys(r) copyright(c) 1971,78,82,83,85,87,89,92,94-97 c *** ansys, inc. c c *** comments: c c by definition, a material is said to be hyperelastic, if there c exists a strain energy density function, which is a scalar c function of one of the strain or deformation tensors, whose c derivative with respect to a strain component determines the c corresponding stress component. c c these strain energy density functions are functions of c invariants of strain tensors and a set of constants determined c in the laboratory tests. the user can specify their own form c of the strain energy density functions in terms of the invariants c of the cauchy-green tensors and a number of laboratory-determined c constants. c c in this subroutine the user is provided with (1) the invariants c 'XIII' of the cauchy-green strain tensor and (2) a flag 'NDF' c identifying the dimensionality of the problem. c c the subroutine first computes the distortion-only invariants c 'XJJJ'. the material constants that were specified by the user c through the 'TB' table are now put into local variables, e.g., c 'AI' and 'BI' in the mooney-rivlin example. the user then c defines the expression for the strain energy density function. c the term of 'W' involving 'BM' must remain intact; the c user will have their own expression for the first part of 'W', c e.g., terms involving constants 'AI' and 'BI' of the example of the c mooney-rivlin material. the expression for the distortion-based c pressure 'PRS' remains the same. 'PRS' along with 'BM' control c the degree of incompressibility of the material. c c the user will have to find the expressions for the derivatives c of 'W' (derivatives of 'PRS' remaining the same), i.e., 'WI' c and 'WIJ'. the subroutine returns the values of 'WINI', 'WI', c 'WIJ', 'PRS', 'PI', 'PIJ' and 'BM'. c c ---------------------------------------------------------------------c c input arguments: c xiii (dp,ar(3),in) - invariants of the cauchy-green tensor c mat (int,sc,in) - material reference number c xnu (dp,sc,in) - input possions ratio c ndf (int,sc,in) - dimensionality of the problem c (2 for plane strain) c (3 for 3d/axisymmetric) c
c output arguments: c wi (dp,ar(3),out) - first derivatives of strain energy density c with respect to invariants c wij (dp,ar(3,3),out) - second derivatives of strain energy density c with respect to invariants c wini (dp,sc,out) - strain energy density c c pi (dp,ar(3),out) - first derivatives of pressure c with respect to invariants c pij (dp,ar(3,3),out) - second derivatives of pressure c with respect to invariants c prs (dp,sc,out) - pressure c bm (dp,sc,out) - bulk modulus c c ---------------------------------------------------------------------c c definitions : c -------------------------------------------c wi(1) = d(w)/d(xiii(1)) c wi(2) = d(w)/d(xiii(2)) c wi(3) = d(w)/d(xiii(3)) c c wij(1,1) = d**2(w)/d(xiii(1))*d(xiii(1)) c wij(1,2) = d**2(w)/d(xiii(1))*d(xiii(2)) c wij(1,3) = d**2(w)/d(xiii(1))*d(xiii(3)) c c wij(2,2) = d**2(w)/d(xiii(2))*d(xiii(2)) c wij(2,3) = d**2(w)/d(xiii(2))*d(xiii(3)) c wij(3,3) = d**2(w)/d(xiii(3))*d(xiii(3)) c -------------------------------------------c pi(1) = d(prs)/d(xiii(1)) c pi(2) = d(prs)/d(xiii(2)) c pi(3) = d(prs)/d(xiii(3)) c c pij(1,1) = d**2(prs)/d(xiii(1))*d(xiii(1)) c pij(1,2) = d**2(prs)/d(xiii(1))*d(xiii(2)) c pij(1,3) = d**2(prs)/d(xiii(1))*d(xiii(3)) c c pij(2,2) = d**2(prs)/d(xiii(2))*d(xiii(2)) c pij(2,3) = d**2(prs)/d(xiii(2))*d(xiii(3)) c pij(3,3) = d**2(prs)/d(xiii(3))*d(xiii(3)) c -------------------------------------------c
c c *** ansys(r) copyright(c) 1971,78,82,83,85,87,89,92,94-97 c *** ansys, inc. c *** Notice - This file contains ANSYS Confidential information *** c c input arguments: c elem (int,sc,in) - element number c time (dp,sc,in) - time c msci (dp,sc,in) - moisture content c dmsci (dp,sc,in) - change of moisture content c mscr (dp,ar(3),in) - input material properties for growth c c output arguments: c mscra (dp,ar(3),out) - output material properties for growth c
1.6.8 Subroutine usermu (Supplying a Friction Coefficient for CONTAC48 and CONTAC49)
subroutine usermu (elem,type,mat,area,gap,loc,fn,nusvr,usvr, x time,timinc,vel,temp,stat,oldst,prevst,oldmu,prevmu,mu) c c *** primary function: user supplied coefficient of friction c called only by contac48,49 c accessed by keyopt(9) > 0 c c *** Notice - This file contains ANSYS Confidential information *** c c c *** ansys(r) copyright(c) 1971,78,82,83,85,87,89,92,94-97 c *** ansys, inc. c c input arguments: c variable (typ,siz,intent) description c elem (int,sc,in) - element number c type (int,sc,in) - element type number c mat (int,sc,in) - material number c area (dp,sc,in) - element area (contac49) or length c (contac48) c gap (dp,sc,in) - present gap or penetration c loc (dp,ar(2),in) - location of the contact node projected c to the target surface - in dimenc sionless element coordinates c fn (dp,sc,in) - current contact force normal to the target c plane c nusvr (int,sc,in) - number of user-supplied element c variables c usvr (dp,ar(nusvr),in) - user-supplied element variables c time (dp,sc,in) - current time c timinc (dp,sc,in) - current substep time increment c vel (dp,ar(2),in) - contact node velocity components in c the target plane c temp (dp,sc,in) - average temperature c oldst (int,sc,in) - status of previous time step
c c c c c c c c c c c c c c c c c c
(3,4: open; 2: closed and sliding; (1: closed and stuck) status of previous iteration (3,4: open; 2: closed and sliding; (1: closed and stuck) current status (3,4: open; 2: closed and stickslide status undetermined) friction coefficient used in the previous time step friction coefficient used in the previous iteration
C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C
input arguments: variable (typ,siz,intent) dudx (dp,sc,in) dudy (dp,sc,in) dudz (dp,sc,in) dvdx (dp,sc,in) dvdy (dp,sc,in) dvdz (dp,sc,in) dwdx (dp,sc,in) dwdy (dp,sc,in) dwdz (dp,sc,in) u (dp,sc,in) v (dp,sc,in) w (dp,sc,in) x (dp,sc,in) y (dp,sc,in) z (dp,sc,in) kGeom (int,sc,in) Vis (dp,sc,in) Temp (dp,sc,in) Tref (dp,sc,in) Pres (dp,sc,in) Pref (dp,sc,in) Cf (dp,ar(4),in) Mfrac (dp,ar(6),in) DfNSpec (int,sc,in) Time (dp,sc,in) output arguments: variable (typ,siz,intent) VisNew (dp,sc,out)
description velocity gradient component velocity gradient component velocity gradient component velocity gradient component velocity gradient component velocity gradient component velocity gradient component velocity gradient component velocity gradient component velocity component velocity component velocity component position component position component position component analysis type old viscosity temperature reference temperature pressure reference pressure input coefficients species mass fractions defined number of species time description new viscosity
c *** Notice - This file contains ANSYS Confidential information *** c typ=int,dp,log,chr,dcp siz=sc,ar(n) intent=in,out,inout
c c c c c c c c
input arguments: variable (typ,siz,intent) kcomp (int,sc,in) ep (dp,ar(6),in) posn (dp,sc,in) output arguments: egen (dp,func,out)
description - number of components of strain - the strain components - poisson's ratio - the combined strain value
Setting custom values for scalar fields (temperatures, heat fluxes, etc.) Changing element pressure information Changing information about element face convection surfaces Changing information about element face heat flux surfaces Changing information about element face convection surfaces Changing information about element face convection surfaces Changing information about element face charge density surfaces.
Activate these routines by issuing the USRCAL command or by choosing an equivalent menu path.
c typ=int,dp,log,chr,dcp siz=sc,ar(n) intent=in,out,inout c c input arguments: c variable (typ,siz,intent) description c key (int,sc,in) - type of data desired c = 1 temperatures c = 2 fluences c = 3 heat generation rates c = 4 moisture contents c = 5 magnetic virtual displacements c iel (int,sc,in) - element number c ielc (int,ar(IELCSZ),in) - array of element type characteristics c nnod (int,sc,in) - number of nodes c nodes (int,ar(nnod),in) - list of nodes c time (dp,sc,in) - time of current substep c defalt (dp,sc,in) - default value (e.g. tunif) c nd (int,sc,in) - size of dat array c dat (dp,ar(nd),inout) - array of data as normally computed by element c as selected by key c c output arguments: c variable (typ,siz,intent) description c dat (dp,ar(nd),inout) - array of data passed back to element c this data represents values at the end c of the load step c c the input argument dat may be used in one of three ways: c 1. it may be simply passed thru c 2. it may be used as a flag(e.g. if dat(1) = -3.0, use c a certain set of logic) c 3. it may be completely ignored and instead defined with new logic c
c input arguments: c variable (typ,siz,intent) description c ielc (int,ar(IELCSZ),in) - array of element type characteristics c ielem (int,sc,in) - element number for operation. c time (dp,sc,in) - time of current substep c ndat (int,sc,in) - number of pressure items for this element c dat (dp,ar(ndat),inout) - the element pressure vector c (has input values for each corner c of each face) c c output arguments: c variable (typ,siz,intent) description c dat (dp,ar(ndat),inout) - the element pressure vector c (defines input values for each corner c of each face) c c the input array dat may be used in one of three ways: c 1. it may be simply passed thru c 2. it may be used as a flag(e.g. if dat(1) = -3.0, use c a certain set of logic) c 3. it may be completely ignored and instead defined with new logic
c c c c c c c c c c c c c c c c c c c c c c c c the c c c
variable (typ,siz,intent) description hc (dp,ar(ndat),inout) - film coefficients (defines input values for each corner of each face) tb (dp,ar(ndat),inout) - bulk temperature (defines input values for each corner of each face) the input arguments hc and tb may be used in one of three ways: 1. they may be simply passed thru. 2. they may be used as a flag(e.g. if hc(2) = -3.0, use a certain set of logic). 3. they may be completely ignored. and instead redefined with new logic this routine is called during each substep of each load step. it is called for each equilibrium iteration. it is called once per element. it is called only during the heat flow load vector formulation stage, and not during the heat flow evaluation stage. the call to get the standard ansys input convection surfaces is made just before entering this routine, so this information is available to be modified, if desired. velocity-dependent film coefficients can be computed by inputting velocity as the input film coefficient or bulk temperature or by inputting the velocity as a function of location in space. routine could then compute the effective film coefficient. this
1.7.4 Subroutine userfx (Changing Element Face Heat Flux Surface Information)
subroutine userfx (ielc,ielem,time,nr,u, ndat,dat) c *** primary function: change element face heat flux surface info c c in order to activate this user programmable feature, c the user must enter the usrcal command. c c this routine is called during each substep of each load step. c it is called for each equilibrium iteration. c it is called once per element. it is called only during the heat c flow load vector formulation stage, and not during the heat flow c evaluation stage. c the call to get the standard ansys input heat flux surfaces c is made just before entering this routine, so this information is c available to be modified, if desired. c c *** ansys(r) copyright(c) 1971,78,82,83,85,87,89,92,94-97 c *** ansys, inc. c c input arguments: c variable (typ,siz,intent) description c ielc (int,ar(IELCSZ),in) - array of element type characteristics
c c c c c c c c c c c c c c c c c c c c c c c
- element number for operation. - time of current substep - number of nodal temperatures of the element (dp,ar(nr),in) - vector of most recent values of the temperatures (int,sc,in) - number of data points per element (dp,ar(ndat),inout) - fluxes (has input values for each corner of each face)
output arguments: variable (typ,siz,intent) description dat (dp,ar(ndat),inout) - fluxes (defines input values for each corner of each face) the input argument dat may be used in one of three ways: 1. they may be simply passed thru. 2. they may be used as a flag(e.g. if dat(2) = -3.0, use a certain set of logic). 3. they may be completely ignored. and instead redefined with new logic
1.7.5 Subroutine userch (Changing Element Face Charge Density Surface Information)
subroutine userch (ielc,ielem,time,nr,u, ndat,dat) c *** primary function: change element face charge density surface info c c in order to activate this user programmable feature, c the user must enter the usrcal command. c c this routine is called during each substep of each load step. c it is called once per element. it is called only during the heat c flow load vector formulation stage, and not during the heat flow c evaluation stage. c the call to get the standard ansys input charge densities of surfaces c is made just before entering this routine, so this information is c available to be modified, if desired. c c *** ansys(r) copyright(c) 1971,78,82,83,85,87,89,92,94-97 c *** ansys, inc. c c input arguments: c variable (typ,siz,intent) description c ielc (int,ar(IELCSZ),in) - array of element type characteristics c ielem (int,sc,in) - element number for operation. c time (dp,sc,in) - time of current substep c nr (int,sc,in) - number of nodal temperatures c of the element c u (dp,ar(nr),in) - vector of most recent values of the
c c c c c c c c c c c c c c
ndat dat
output arguments: variable (typ,siz,intent) description dat (dp,ar(ndat),inout) - fluxes the input argument dat may be used in one of three ways: 1. they may be simply passed thru. 2. they may be used as a flag(e.g. if dat(2) = -3.0, use a certain set of logic). 3. they may be completely ignored. and instead redefined with new logic
c object/library: c current - acel c *** Notice - This file contains ANSYS Confidential information *** c *** ansys(r) copyright(c) 1971,78,82,83,85,87,89,92,94-97 c *** ansys, inc. c c c c c c c c c vc c c input arguments: key (int,sc,in) - Key 0 1 2 3 4 5 to desired acceleration components Translational acceleration Angular Velocity Angular Acceleration Angular Velocity around C.G. Angular Acceleration arount C.G. C.G. Location in global coord. system
NOTE: elem
Only key=1 for spin softening is currently implemented (int,sc,in) - Element number - Return value as given by key
This section presents examples of how two of the load customization UPFs, the usercv subroutine and the useracel subroutine, can affect analysis results. 1.7.7.1 Example of Using usercv Below is an example of using the usercv subroutine. First, here is the ANSYS input for the example:
/bat,list /prep7 /title,test of velocity-dependent film coefficient /com default logic (triggered with usrcal,usercv) will set the /com film coefficient in SURF19 to the velocity in FLUID66 et,1,66 keyo,1,9,1 et,2,19,1,, ,1,1 keyo,2,8,2 et,3,55 r,1,1,1,,1 mp,dens,,1 mp,kxx,,11 mp,mu,,0.01 n,1 n,4,100 fill n,11, ,5 n,12,30,5 n,13,30,8 n,14, ,8 type,1 e,1,2 egen,3,1,-1 type,2 e,11,12,2 type,3 e,11,12,13,14 elist,all noor fini ! flag to save values ! temp DOF, no midside nodes, has extra node ! flag for convection surface
Now, look at the results from this example analysis (shown below). Note that the FLOW RATE magnitude for FLUID66 matches the HFILM for SURF19.
***** uelEMENT SOLUTION ***** LOAD STEP= 2 SUBSTEP = 1 TIME = CUM. ITER.= 2.0000 3
uel= 1 NODES= 1 2 0.00000E+00 FLOW RATE= -4.4721 HT COND RATE= 128.60 0.00000E+00 HT TRANSP RATE= 0.00000E+00 FRICTION FACTOR= 0.100000E-01 0.00000E+00 HFILM= 0.00000E+00 uel= 2 NODES= 2 3 0.00000E+00 FLOW RATE= -4.4721 HT COND RATE= -80.801 0.00000E+00 HT TRANSP RATE= 0.00000E+00 FRICTION FACTOR= 0.100000E-01 0.00000E+00 HFILM= 0.00000E+00 uel= 3 NODES= 3 4 0.00000E+00 FLOW RATE= -4.4721 HT COND RATE= -80.801 0.00000E+00 HT TRANSP RATE= 0.00000E+00 FRICTION FACTOR= 0.100000E-01 0.00000E+00 HFILM= 0.00000E+00
0 FLUID66
0 MAT=
RE=
0 FLUID66
0 MAT=
RE=
0.00000E+00 0.00000E+00
0 FLUID66
0 MAT=
RE=
0.00000E+00
*** WARNING *** CP= 0.800 TIME= 17:23:49 ANSYS,INC.-supplied version of coding for USERCV has been used. Using getvel66, the velocity from node 2 is 0.4472E+01 uel= 30.000 VOLUME= TAVG= 6.9801 4 SURFACE NODES= 11 12 EXTRA NODE= 2 MAT= 1 AREA=
30.000 8.7381
*** WARNING *** CP= 0.800 TIME= 17:23:49 ANSYS,INC.-supplied version of coding for USERCV has been used. uel= 5 NODES= -0.2753 11 13 14 MAT= PLANE55 -0.6346 0.6917 12 1 VOL= 90.00 3.029
TF(X,Y,SUM)=
! define FAST component ! define SLOW component ! turn on spin softening ! define parameter for use in useracel ! define parameter for use in useracel elements will be stationary
/title, /title,
BASE CASE - STANDARD VERSION DEMONSTRATE USE OF useracuel(useracuel HAS BEEN LINKED IN AND USED)
Suppose that you ran this example problem using the standard ANSYS product. You'd receive the following output information:
*** FREQUENCIES FROM BLOCK LANCZOS ITERATION *** MODE FREQUENCY (HERTZ) 1 287.3798632612 2 287.3798632612 3 287.3798632612 4 869.2433944257 5 869.2433944257 6 869.2433944259
Now, suppose that you re-run the problem after linking in and using the useracel subroutine. Your new results should look like those shown below:
*** FREQUENCIES FROM BLOCK LANCZOS ITERATION *** MODE FREQUENCY (HERTZ) 1 239.2841196099 2 276.1423760135 3 287.3798632612 4 854.5488768013 5 865.5931519918 6 869.2433944258
If you're running ANSYS on a UNIX system (but not under Windows 95 or Windows NT), you also can call the ANSYS program as a subroutine in a program you've written. To do so, use the following:
subroutine ansys
For multiple calls to subroutine ANSYS, you must open and close standard input in the calling routine. (Usually, input and output are FORTRAN units 5 and 6, respectively.) The calling routine can't use the database access routines. But, other user programmable features can use the database access routines freely.
2. Link the routine into the ANSYS program. 3. Issue the ANSYS command /UCMD to define a name for a custom command that calls and executes your routine. Use the command format shown below:
/UCMD,Cmd,SRNUM
Cmd is the name for your new command. It can contain any number of characters, but only the first four are significant. The name you specify can't conflict with the name of any ANSYS command or the names of any other commands or macros. SRNUM is the number of the routine your command should call; that is, a value between 01 and 10. For example, suppose that you create and link in a user routine for a parabolic distribution of pressure, and you name that routine user01. Issuing the command shown below creates a new command, PARB, that when issued calls your parabolic pressure distribution routine:
/UCMD,PARB,1
To make these "custom command" routines available in all your ANSYS sessions, include the /UCMD commands in your start-up file (START.ANS). You also can use /UCMD to remove a custom command. To do so, simply use a blank value for Cmd, as shown below:
/UCMD,,1
This command removes the PARB command. To list all user-defined command names, issue the command /UCMD,STAT.
C c c c c c c c c c c c c c c c c c c c c c c c c c
\*******************************************************************/ input arguments: variable (typ,siz,intent) intin (int,ar(12),in) dpin (dp,ar(12),in) ch4in (ch*4,ar(12),in) ch8in (ch*8,ar(12),in) description integers from command line double precision from command line upper case 4 characters from command as input 8 characters from command
If the usage had been set up with a /ucmd,aaaa,1 , user01 could be activated by the command aaaa,ln,6,all where ln = lab4in(2) 6 = intin(3) all = lab4in(4) output arguments: none user01 (int,sc,out) - result code (should be zero) (which is ignored for now)
************************************************************** intin(2), dpin(2), ch4in(2), and ch8in(2) are all representations of the contents of the second field on the command line (the field after the command label) ************************************************************** external integer wrinqr wrinqr
integer user01,intin(12), iott double precision dpin(12) character*4 ch4in(12) character*8 ch8in(12) c iott = wrinqr(2) c c c c c c c ***** user'S CODE IS INSERTED HERE ***** write (iott,2000) 2000 format (//' ***** CALL TO ANSYS,INC DUMMY USER01
*****'//)
***** do not return this result code in a real user routine user01 = -654321 ***** instead return a zero ***** user01 = 0 return end
c *** primary function: user routine number 02 c --- This demonstration offsets selected nodes with the command: c usr2,dx,dy,dz c *** ansys(r) copyright(c) 1998 c *** ansys, inc. c *** Notice - This file contains ANSYS Confidential information *** c c c c c c c c c c c c c c c c c /*******************************************************************\ | see user01 for additional information on user routines | \*******************************************************************/ input arguments: variable (typ,siz,intent) intin (int,ar(12),in) dpin (dp,ar(12),in) ch4in (ch*4,ar(12),in) ch8in (ch*8,ar(12),in) output arguments: none user02 (int,sc,out) description integers from command line double precision from command line upper case 4 characters from command as input 8 characters from command
************************************************************** intin(2), dpin(2), ch4in(2), and ch8in are all representations of the contents of the second field on the command line (the field after the command label) ************************************************************** external integer wrinqr,ndinqr,ndgxyz,ndpxyz,erhandler wrinqr,ndinqr,ndgxyz
integer user02,intin(12), iott, maxnp,i,ksel double precision dpin(12),xyz(3) character*4 ch4in(12) character*8 ch8in(12) #include "ansysdef.inc" maxnp = ndinqr (0,DB_MAXDEFINED) do i = 1,maxnp ksel = ndgxyz (i,xyz(1)) if (ksel .eq. 1) then xyz(1) = xyz(1) + dpin(2) xyz(2) = xyz(2) + dpin(3) xyz(3) = xyz(3) + dpin(4) call ndpxyz (i,xyz(1)) endif enddo c ***** write to output file iott = wrinqr(WR_OUTPUT) write (iott,2000) 2000 format (/' NODE OFFSET COMPLETE ***** write to GUI window ***** '/) *****
x c
call erhandler ('user02',3000, 2,'NODE OFFSET COMPLETE',0.0d0,' ') ***** user02 = 0 return end required return value *****
character*4 character*8
ch4in(12) ch8in(12)
#include "ansysdef.inc" #include "stack.inc" c c c c c Get nodal xyz locations and calculate standard deviation of x coordinates, y coordinates, & z coordinates get number of currently selected nodes numnp = ndinqr (0,DB_NUMSELECTED) if (numnp .le. 0) go to 999 c allocate memory for x, y, & z coordinates of nodes xcptr = HeapAllocPtr(numnp,'XCoords ',HEAP_DOUBLE,hXcptr) ycptr = HeapAllocPtr(numnp,'YCoords ',HEAP_DOUBLE,hYcptr) zcptr = HeapAllocPtr(numnp,'ZCoords ',HEAP_DOUBLE,hZcptr) loop through all selected nodes i=1 node = 0 xmean = 0.0d0 ymean = 0.0d0 zmean = 0.0d0 node = ndnext(node) if (node .gt. 0) then c c get xyz coordinates ksel = ndgxyz (node,xyz(1)) store this node's dstack(xcptr + i) dstack(ycptr + i) dstack(zcptr + i) while xmean ymean zmean xyz coordinates = xyz(1) = xyz(2) = xyz(3)
10
we're looping, accumulate sums to calculate means = xmean + xyz(1) = ymean + xyz(2) = zmean + xyz(3)
c c
increment index i = i + 1 loop back up for next selected node goto 10 endif
c c
node = 0, at the end of node list calculate mean of xyz coordinates xmean = xmean / numnp ymean = ymean / numnp
zmean = zmean / numnp c calculate standard deviation for xyz coordinates sodx = 0 sody = 0 sodz = 0 do i=1, numnp sodx = sodx + (dstack(xcptr+i) - xmean)**2 sody = sody + (dstack(ycptr+i) - ymean)**2 sodz = sodz + (dstack(zcptr+i) - zmean)**2 enddo stdxyz(1) = sqrt(sodx / (numnp-1)) stdxyz(2) = sqrt(sody / (numnp-1)) stdxyz(3) = sqrt(sodz / (numnp-1)) c ***** write to output file ***** iott = wrinqr(WR_OUTPUT) write (iott,2000) stdxyz(1),stdxyz(2),stdxyz(3) 2000 format (/' STD FOR X COORDINATES:',G12.5,/, X ' STD FOR Y COORDINATES:',G12.5,/, X ' STD FOR Z COORDINATES:',G12.5) ***** write to GUI window ***** call erhandler ('user03',5000,2, x 'STD FOR X COORDINATES: %G %/ STD FOR Y x COORDINATES: %G %/ STD FOR Z COORDINATES: %G',stdxyz(1),' ') release dynamically allocated memory call HeapDealloc(hXcptr) call HeapDealloc(hYcptr) call HeapDealloc(hZcptr) 999 ***** required return value user03 = 0 return end *****
c *** primary function: user routine number 03. Gives example of c Heap usage c c *** ansys(r) copyright(c) 1971,78,82,83,85,87,89,92,94-97 c *** ansys, inc. c *** Notice - This file contains ANSYS Confidential information *** c c /*******************************************************************\ c | see user01 for additional information on user routines | c \*******************************************************************/ c c input arguments: c variable (typ,siz,intent) description c intin (int,ar(12),in) - integers from command line c dpin (dp,ar(12),in) - double precision from command line c ch4in (ch*4,ar(12),in) - upper case 4 characters from command c ch8in (ch*8,ar(12),in) - as input 8 characters from command c c output arguments: none c user03 (int,sc,out) - result code (should be zero) c (which is ignored for now) c c ************************************************************** c intin(2), dpin(2), ch4in(2), and ch8in are all representations c of the contents of the second field on the command line c (the field after the command label) c ************************************************************** c
c *** Notice - This file contains ANSYS Confidential information *** c Prolog is not CONFIDENTIAL INFORMATION c c c c c c c c c c typ=int,dp,log,chr,dcp input arguments: variable (typ,siz,intent) Node (int,sc,in) Label (ch*4,sc,in) output arguments: variable (typ,siz,intent) GetStackDisp (int,sc,out) siz=sc,ar(n) intent=in,out,inout
description - Node Number (User) - DOF Label (Upper Case) 'UX ','UY ','TEMP','VOLT','ROTY', etc description - status/pointer = 0 - data not valid
c access c c Value c
> 0 - dstack pointer to data for fast (dp,sc,out) see comments below - Solution value for Node,Label
example usage:
c external GetStackDisp c#include "stack.inc" (only if dstack(ptr) form is used) c integer GetStackDisp, ptr, Node2 c double precision Value c c c ptr = GetStackDisp (Node2,'UY ',Value)
c c c c c c c c c c
nPoints
(int,sc,in) - Number of evaluation points *** from ElInterp *** ebest (int,ar(nPoints),in) - Element(s) containing points elcord (dp,ar(3,nPoints),in) - Element coordinates *** from ElResultStrt *** TypeData (int,sc,in) - Data type code Loc (int,sc,in) - Start of selected data nVal (int,sc,in) - Number of results per point output arguments: Result (dp,ar(nvar,nPoints),out) - Array of results
c primary function: Find element numbers containing xyz points c secondary functions: Find element coordinates of these points c object/library: upf c *** Notice - This file contains ANSYS Confidential information *** c (Prolog is not CONFIDENTIAL INFORMATION) c typ=int,dp,log,chr,dcp siz=sc,ar(n) intent=in,out,inout
c input arguments: c variable (typ,siz,intent) c nPoints (int,sc,in) group) c xyzPoints(dp,ar(3,nPoints),in)c tolInside(dp,sc,in) c c tolOutside(dp,sc,in) c 0.25) c output arguments: c variable (typ,siz,intent) c ebest (int,ar(nPoints),out) c elcord (dp,ar(3,nPoints),out)
description Number of points to find (do in one XYZ coordinates of each point Tolerance for point inside element (0.0d0 defaults to 1.0d-4) Maximum distance outside to be associated with an element (0.0d0 defaults to description - Best element number for each point - Element coordinates of the point
Issue the USRCAL command (or use an equivalent menu path) to activate or deactivate these routines.
User Subroutine Is Called UAnBeg At ANSYS start-up USolBeg Before solution ULdBeg Before a load step USsBeg Before a substep UltBeg Before an iteration UltFin After an iteration USsFin After a substep ULdFin After a load step USolFin After solution UAnFin At the end of an ANSYS run
Subroutines USSBeg, UItBeg, UItFin and USSFin default to reading a command macro file from the current working directory whose name is subroutine.mac (i.e., ussfin.mac is read by USSFin.F). No user action to relink the ANSYS program is required for the command macro to be read except that the calling subroutine must be activated by the USRCAL command. The design of the command reading ability of these subroutines is limited to APDL parameter setting commands (*GET, *SET, a=value, etc) and testing for general ANSYS commands is limited. Commands which are known to work include *DIM,*STAT. Commands which require another line (*MSG, *VWRITE) are not allowed. Other commands which are known to not work are the solution loading commands (D, F, SFE, etc). If these capabilties are required, the user will need to create a Fortran subroutine and link this subroutine into ANSYS, as described in Section 1.1. While parameter substitution into commands is not permitted, USSBeg, etc. were designed to be used in conjunction with dynamic tables and parameter substitution from the user subroutine. As an example, consider an ANSYS table defined as d5 = f(par1), If d5 contains values of displacement as a function of PAR1, then d5 may be used as a constraint, as
*dim,d5,table,10,1,1,PAR1 d5(1)=0,.1,.25, /solu d,5,ux,%d5%
Modify the value of PAR1 in USSBeg.MAC and the constraint on node 5, ux can then be modified in the middle of a load step.
The following is an example of a valid input that may be read by USSBeg, UItBeg, UItFin and USSFin.
/COM, SAMPLE ussfin.mac a=5 b=nx(1) *get,c,active,solu,Time,cpu *dim,array,,6 array(1) = 1 array(2) = 2 array(3) = 3 array(4) = 4 array(5) = 5 array(6) = 6 *vleng,3 *vfun,array(4),copy,array(1) *stat *stat,array(1) array(1)= nnode = ndinqr(0,14) *dim,array,,nnode *vget,array(1),NODE,1,NSEL *stat,array(1) array(1)= /eof
/COM, COMMANDS BELOW THIS LINE ARE KNOWN TO NOT WORK p,1,6,2000 d,1,uy,.1 *msg,note THIS IS A TEST MESSAGE *vwrite,array(1) (/ b = ,f10.4) ! commands DO NOT work
Link a user routine within the ANSYS program. Run a stand-alone optimization program using the ANSYS optimization "save" file, Jobname.OPT.
This chapter describes both methods. You can find additional information on design optimization techniques and procedures in Chapter 1 of the ANSYS Advanced Analysis Techniques Guide.
For information about the kopusr variable and the userop routine, see the next section.
c**************************************************************************** **** c incoming arguments: * c * c * c Iott is the ansys output unit * c * c Nterm is passed back to routine opterm. You should set this variable * c as follows: * c nterm = 0 if optimization looping should stop * c nterm - 1 if optimization looping should continue * c * c**************************************************************************** **** c contents of optimization common block cmopt: c (only variables that are of interest or useful are documented) c c cmopt variable descriptions c --------------------------c c dopspr - (not used - spares) c dv(I) - design vector, I = 1 to maxdv c iopspr - (not used - spares) c kconv - convergence flag (kconv = 0 indicates convergence) c kopusr - flag choosing optimizer (0 = ansys, 1 = user-supplied opt) c (issuing the command optype,user sets kopusr = 1) c lopt - incrementing lopt iteration counter c maxdv - maximum number of design variables allowed in ansys c optimization (= 60) c maxpar - maximum number of parameters allows in ansys c optimization (= 400) c maxopt - maximum number of design sets allowed in optimization c (= 130) c nobj - flag for objective function defined (0=no, 1=yes) c ntdv - total number of design variables c ntsv - total number of state variables c numopt - total number of design sets c nsets - highest design set number c setnum(1) - the actual design set number of the ith design set c oplim(j,I) - Lower limit (j=1) and upper limit (j=2) of ith c optimization parameter (opvar). (I = 1 to 160.) c The state variables are stored first, then the c design variables, and then the objective function c optol(I) - tolerance of ith optimization parameter (opvar) c (I = 1 to 160.) c The state variables are stored first, then the
c c c c c c C c c c c
design variables. optvar(I,j) - The ith parameter of the jth design set (I = 1 to maxpar, j = 1 to maxopt) The state variables are stored first, then the design variables, then the objective function, and finally all remaining scalar parameter values. maxusr - user-specified, maximum allowed optimization iterations on the opuser command opus(I) - user-specified, double precision parameters on the opuser command (I = 1,8) objtol - objective function tolerance
When you finish customizing the userop routine, you relink it using either of the methods described in section 1.1.8 and in the ANSYS Installation and Configuration Guide for UNIX or in the ANSYS Installation and Configuration Guide for Windows . You must include the cmopt common block in your routine, to allow it to pass common data (such as design variables, state variables, and objective function values) to and from the ANSYS program.
! looping begins
1.12.3.1 Example of User Input for Optimization The commented example below shows you sample ANSYS command input for design optimization, done with a user-customized version of the userop routine:
c!!!---c!!! --c!!! --c!!! --c c c c c c minimize y = x1**2 + x2**2 subject to: 1 < x1 < 10 1 < x2 < 10 g = x1 - x2 > 1 ! ! ! ! ! ! use batch mode initial value for dv x1 initial value for dv x2 enter the ANSYS preprocessor define function y define function g
c c c c c c c c c c c
finish /opt opvar,x1,dv,1,10 opvar,x2,dv,1,10 opvar,y,obj,,,1 opvar,g,sv,1 optype,user opuser,10,1.1,2.0 opexe oplist,all finish
! ! ! ! ! ! ! ! ! !
finish prep finish preprocessing define first dv (range 1 to 10) define second dv (range 1 to 10) define objective function (tol = 1) define state variable (lower limit 1) user user-defined optimization logic define user opt. Modifiers (max iterations=10) execute userop routine list results
! ! ! !
jobname.opt written for use by user-supplied program run the user-supplied program read results of user-supplied program from jobname.out looping begins
The OPSAVE and OPRESU commands write data to and read data from Jobname.OPT, and they also pass data to and from your custom optimization program.
anext annam bestsave bestset con1 con2 delfst delgr dvloop facexp facfst faclst factq fstfst fstpnt gradq(I) grdfst grdlst grdpnt grdtyp icongr
Analysis file extension Analysis file name Key to save the best database and results file Number of the current best optimization set Minimum parameter value Maximum parameter value Forward difference for first order optimization (delta on opfrst) Forward difference for gradient optimization tool (delta on opgrad) Indicates how to treat design variables on the loop file Fractional exponent for factorial optimization First design set number in the range of factored sets Last design set number in the range of factored sets Factor applied to penalty functions (first order optimization only) First design set number in the range of first order sets Reference design set number for first order optimization Vector saved for first order optimization First design set number in the range of gradient sets Last design set number in the range of gradient sets Reference design set number for gradient evaluation Reference design set type (best, last, or number) for gradient Key for selecting conjugate direction method Exponent that controls the resolution (sharpness) of the unconstrained objective ilamda function (in first order optimization) inopt Reserved for internal ANSYS use iobjxp Reserved for internal ANSYS use iopexe(I) Executable keys indicating which method or tool was run isvxp Reserved for internal ANSYS use jobnam Current name for file creation or use kconv Convergence flag (kconv = 0 indicates convergence) kfit1 Reserved for internal ANSYS use kfit2 Reserved for internal ANSYS use kopusr Flag choosing optimizer (0 = ansys, 1 = user optimization) kwght Reserved for internal ANSYS use labx(k) Current parameter names loopct Incrementing loop counter (for *GET command) lpot Maximum number of design loops (from OPRUN command) looptl Total number of optimization loops executed (using all methods) loptlp Saved value of lopt variable after each execution
maxfac Maximum allowed number of loops for factorial optimization analysis maxfst Maximum allowed number of iterations for first order optimization maxinf Maximum allowed sequential infeasible solutions (subp) maxrnd Maximum allowed number of iterations for random optimization maxsub Maximum allowed number of iterations for sub. prom. approx. mxpmrs Used for restart purposes (to reset mxparm in parmcm) nbest0 Best design set this first order evaluation nfeas Desired number of feasible solutions (random optimization) ninfes Counter for consecutive infeasible solutions nmswps The number of sweep evaluations to be made in each design variable dir. nobj Number of objective functions (must be 1) noqv Reserved for internal ANSYS use nrandm Reserved for internal ANSYS use nsqv Reserved for internal ANSYS use nsets Current number of sets that were made ntdv Total number of design variables ntfdf Finite difference counter for first order optimization ntline Line search counter for first order optimization ntmax Maximum number of parameters that have ever been defined ntsv Total number of state variables numopt Total number of design sets opam Random settings (related to routine VRAND) opdir Optimization file directory opext Optimization file extension opnam Optimization file name optlab All labels used in optimization (optimization labels and extras) optlab(I) Optimization labels optol(I) Tolerance optvar(I,j) Ith parameter of the jth design set opus(n) User parameters specified on OPUSER command (n = 1:8) psobj0 Best unconstrained objective value this first order evaluation rdfrom Indicates where to begin reading the analysis file (0 = top, 1 = after /Prep7) refobj Reference objective function for first order optimization savoutunit Saved output unit number seed Reserved for internal ANSYS use setnum(I) Set numbers sizeq Line search step size sq(j) Vector saved for first order optimization
Reserved for internal ANSYS use Indicates which type of parameters to save during looping First design set number in the range of sweep sets Last design set number in the range of sweep sets Reference design set number for sweep evaluation Reference design set type (best, last, or number) for sweep Reserved for internal ANSYS use Current scalar parameter values
The starting location for the array(s) in the Heap memory area is also returned. Where leng (argument 1) is the number of array words needed:
C8Label (argument 2) is a character*8 block name. HEAP_xxx (argument 3) is the word size based on integer words. (The HEAP_xxx definitions are parameters in the ansysdef.inc common). Handle (argument 4) is returned as the block number. The block number is used to deallocate the space. Ptr (the function result) is the starting location of the data space, minus 1.
You must include the ansysdef.inc common to get the parameter values of HEAP_INTEGER, HEAP_DOUBLE, HEAP_COMPLEX, and HEAP_REAL. 4. Use the arrays. You must include the common stack.inc in the routines accessing the Heap space. You can find stack.inc on the ANSYS distribution medium. The location of the first data entry for the array depends on the type of numbers in the array:
If the Array Contains The First Data Entry Begins at istack(ptri+1) Integer numbers Double precision numbers dstack(ptrdp+1) cstack(ptrcp+1) Complex numbers rstack(ptrr+1) Real numbers
5. If one routine allocates Heap space and another routine uses the space, you need to pass only the "handle" to the second routine. You also must include the stack common, just as you did in Step 4. TheHeapGetPtr function can retrieve the starting location minus 1, as follows:
ptri =HeapGetPtr(iHandle) ptrdp =HeapGetPtr(dHandle) ptrcp =HeapGetPtr(cHandle) ptrr =HeapGetPtr(rHandle)
This location is the same as the location described in Step 4. 6. Deallocate the stack space using the HeapDealloc subroutine, as follows: For integer numbers:
call HeapDealloc(iHandle)
call HeapDealloc(rHandle)
The next few pages provide input and output listings for the memory management routines. For an example, see the section "Function user03 (Demonstrates Using Heap Memory)," which appears earlier in this chapter.
c object/library:
c *** Notice - This file contains ANSYS Confidential information *** c c c c c c c c c input arguments: nValues (int,sc,in) c16Label (ch*16,sc,in) flagAlloc(int,sc,in) output arguments: hHeapHandle (int,sc,out) HeapAllocPtr (int,sc,out) - Number of Values needed in Block - 16 character name for the Block - Flags describing this block (See ANSYSDEF and heapcom for more information) - Handle (Block number) for this block - Pointer to this data block (Use Ptr+i) for reference to ith value in the block
c object/library:
c *** Notice - This file contains ANSYS Confidential information *** c c c c Note: See heapcom.inc for information on use of Heap - Handle (Block number) for this block
function HeapGetPtr (hHandle) c primary function: return pointer for an existing handle
c keywords: integer function for heap pointer return c object/library: c current - heap c *** Notice - This file contains ANSYS Confidential information *** c c c c c c NOTE: See heapcom.inc for documentation on heap usage - A heap handle - The corresponding pointer
c *** Notice - This file contains ANSYS Confidential information *** c c c c c c input arguments: label8 (chr*8,sc,in) labl4 (chr*4,sc,in) nxyz (int,ar(3),in) names (chr*8,ar(3),in) output arguments: none the name of the parameter to create 'TABL' or 'ARRA' or 'CHAR' the dimensions of the array Names for x,y,z directions in table
c c c c c c c c c c c c
input arguments: label8 (chr*8,sc,in) nval subc lvl (int,sc,in) (dp,ar(3),in) (int,sc,in)
- the name of the parameter (must be upper case, left justified) - the number of subscripts (0,scaler) - values for the subscripts (if any) - 0,1 no error output 2, report error -1, set kerr flag with no anserr call - the value of the parameter (may be a packed character*8 - error flag (0,ok -1,output is packed 0=ok, 1=error, 2=error but TINY is used
nval
(int,sc,in)i
subc (dp,ar(3),in)
c should c c c c c The c c c c c c c c c was c c c c value (dp,sc,in) c c c c c c for c this c the c c c output arguments: c kerr (int,sc,out) c c c c
setting "y(5,8)=987", then "nval" (arg 3) be set to 2 and "subc" should be set to 5.0, 8.0, 0.0, and "value" (arg 5) should be 987.0. Remember subroutine "pardef" is only storing a data value of "label8" or "label8(x,y,z)". proper dimensions were set by a "*dim" command. Please note that although the values of "subc" should be double precision, subroutine "pardef" uses the intrinsic "nint" (nearest integer) function to get and use the integer equivalent. You should also note the "nval" (arg 3) and "subc" (arg 4) must fall within the range that set with a "*dim" or "*set" command or an error will occur. - the value for this parameter (should be a packed character*8 if ctype=1. To pack a char into a dp variable use "call chtodp(ch8,dp)". To unpack a dp variable into a char use "call dptoch(dp,ch8)" ) Value is the data value that is to be stored "label8" (arg 1). If "ctype=1" (arg 2) then value would be a "packed character" data from "chtodp" Ansys function. - error flag (0=ok, 1=error) kerr is an integer error flag that is returned to the calling subroutine. Any non zero number would indicate an error was detected in subroutine "pardef"
Note-For a demonstration of parameter processing, see the examples based on the useracel routine in this manual. You can find examples in section 1.7.7.
The erhandler routine displays output messages (notes, warnings, and errors). The runcmd function lets you issue an ANSYS command from within a user routine.
The GetStackDisp routine retrieves current displacement values. The /UNDO command writes an "undo" file at critical points as a user routine executes. The /HOLD command allows you to synchronize multiple tasks in ANSYS. The /TRACK function enables you to do program tracing and timing.
For further descriptions of erhandler and /TRACK, see Chapter 3, "Subroutines for Users' Convenience." For details about the GetStackDisp function, see section 1.10.2.
ON, to write the undo file OFF, to prevent the undo file from being written PROMPT, to have ANSYS ask permission before writing the file STATUS, to restore the file as it existed after executing the last command issued before the /UNDO command.
Issue the /HOLD command to synchronize tasks in ANSYS. The ANSYS program can synchronize tasks at the end of each results file set. The command format is:
Filename is the eight-character name of a message file. If the named file exists, the ANSYS program reads a command from the file and then deletes the file. TimeInterval is the length of time, in seconds, that ANSYS waits before trying to read the message file again. Timeout is the maximum length of time, in seconds, that ANSYS can wait between attempts to read the file.
The descriptions of the database access routines or functions within this chapter describe both the input arguments and output arguments. Argument information includes the argument's type, size and intent.
Argument type is one of the following: int - integer dp - double precision log - logical chr - character dcp - double precision complex
Argument size is one of the following: sc - scalar variable ar(n) - array variable of length n func - functional return value
Argument intent is one of the following: in - input argument out - output argument inout - both an input and an output argument
c c c c c c c c c c c
siz=sc,ar(n),func
intent=in,out,inout
description - the last node number used = 0 - use for initial value - the next selected node number = 0 - no more nodes
2.4.2 ndprev Function (Getting the Number of the Previous Selected Node)
function ndprev (next) c *** primary function: get the number of the previous selected node c c *** Notice - This file contains ANSYS Confidential information *** c c typ=int,dp,log,chr,dcp siz=sc,ar(n),func intent=in,out,inout c c input arguments: c variable (typ,siz,intent) description c next (int,sc,in) - the next node number used c = 0 - use for initial value c c output arguments: c ndprev (int,func,out) - the previous selected node number c = 0 - no more nodes c
2.4.3 ndnxdf Function (Getting the Number of the Next Defined Node)
function ndnxdf (next) c *** primary function: get the number of the next defined node c c *** Notice - This file contains ANSYS Confidential information *** c c typ=int,dp,log,chr,dcp siz=sc,ar(n),func intent=in,out,inout c c input arguments: c variable (typ,siz,intent) description c next (int,sc,in) - the last node number used c = 0 - use for initial value c c output arguments: c ndnxdf (int,func,out) - the next defined node number c = 0 - no more nodes c
ksel
(int,sc,in)
description - node number = 0 - all nodes < 0 - do not delete CPs and CEQNs (merge/offset/compress) - type of operation to be performed. ksel = 0 - delete node. = 1 - select node. =-1 - unselect node. = 2 - invert select status of
2.4.6 elprev Function (Getting the Number of the Previous Selected Element)
function elprev (prev) c *** primary function: get the number of the previous selected element c c *** Notice - This file contains ANSYS Confidential information *** c c typ=int,dp,log,chr,dcp siz=sc,ar(n),func intent=in,out,inout c c input arguments: c variable (typ,siz,intent) description c prev (int,sc,in) - the last element used c = 0 - use for initial value c c output arguments: c elprev (int,func,out) - the previous selected element c = 0 - no more elements c
2.4.7 elnxdf Function (Getting the Number of the Next Defined Element)
function elnxdf (next) c *** primary function: get the number of the next defined element c c *** Notice - This file contains ANSYS Confidential information *** c c typ=int,dp,log,chr,dcp siz=sc,ar(n),func intent=in,out,inout c c input arguments: c variable (typ,siz,intent) description c next (int,sc,in) - the last element used c = 0 - use for initial value c c output arguments: c elnxdf (int,func,out) - the next defined element c = 0 - no more elements c
c c c c c c c c c
ksel
(int,sc,in)
- type of operation to be performed. = 0 - delete element. = 1 - select element. =-1 - unselect element. = 2 - invert select status for element
c c c c c c c c c c c c c c c c c c c c c on c
= -11, = -12, =-101, =-102, =-103, =-104, =-105, =-106, =-107, =-108, =-109, =-110, =-111, =-112, =-113, =-114, =-115, =-116,
to to to to to to to to to
node data record angle record attached elements attached couplings attacted constraint equations nodal stresses specified disp'S specified forces x/y/z record
pointer to nodal temperatures pointer to nodal heat generations pointer to calculated displacements
c c
c input arguments: c variable (typ,siz,intent) c node (int,sc,in) c vctn (dp,ar(6),in) c c kcrot (int,sc,in) nodal c c c output arguments: none.
description - node number - array of 3 nodal coordinates and 3 nodal rotation angles. - local coordinate system in which the coordinates and angles are defined
2.5.4 ndgall Function (Getting the XYZ/Rotation Coordinates Vector for a Node)
function ndgall (node,xyz) c *** primary function: get x,y,z,rotx,roty,rotz vector for a node. c c *** Notice - This file contains ANSYS Confidential information *** c c input arguments: c node (int,sc,in) - node number for operation. c c output arguments: c ndgall (int,sc,out) - status of node. c 0=node is undefined. c -1=node is unselected. c 1=node is selected. c xyz (dp,ar(6),out) - vector containing x,y,z,rotx,roty,rotz c
2.5.5 ndspgt Subroutine (Getting the Nodal Solution for a Node of an Element)
subroutine ndspgt (node,dofs,ndof,nrot,xyzang,nuvect,unode) c *** primary function: get the nodal solution for a node of an element c
c *** Notice - This file contains ANSYS Confidential information *** c c input arguments: c node (int,sc,in) - The node number c dofs (int,sc,in) - The dofs to retrieve for the node. c dof = degree of freedom c This is an integer representation using c bit pattern logic of the dof or the dof c set. This is normally done using the c parameters defined in echprm. Then c you could use dofs = UX + UY in the c calling routine, for example. c ndof (int,sc,in) - The number of node dofs (1, 2 or 3). c nrot (int,sc,in) - Key to rotate dofs from nodal to global c coordinate systems. c if 0, none. if 2, 2-d. if 3, 3-d c if > 0, dof set must include and only c include all terms of the vector (e.g. c UX,UY,UZ, or AX,AY,AZ). c xyzang (dp,ar(6),in) - The xyz virgin node coordinates c (including angles). Not used if c nrot = 0 or ndof < 2. c nuvect (int,sc,in) - Number of vectors to retrieve. Can vary c between 1 and 5. Normally 1 is what is c wanted. Other vectors include previous c values and/or velocities. See elucom for c all possibilites. Contents are analysis c type dependent. c c output arguments: c unode (dp,ar(ndof,nuvect),out) - Element nodal solution vectors in c the global coordinate system. c
c typ=int,dp,log,chr,dcp siz=sc,ar(n),func intent=in,out,inout c c input arguments: c variable (typ,siz,intent) description c ielem (int,sc,in) - element number c should be zero for key=11, DB_NUMDEFINED, c DB_NUMSELECTED, or DB_MAXDEFINED c key (int,sc,in) - information flag. c = DB_SELECTED - return select status: c elmiqr = 0 - element is undefined. c =-1 - element is unselected. c = 1 - element is selected. c = DB_NUMDEFINED - return number of defined elements c = DB_NUMSELECTED - return number of selected elements c = DB_MAXDEFINED - return maximum element number used c = DB_MAXRECLENG - return maximum record length c (int words) c = 2 - return length (int words) c = 3 - return layer number c (for cross reference files return number of entities) c = 4 - return address of first data word c = 5 - return length (in record type units) c = 6 - return compressed record number. c = 11 - return void percent (integer) c = 16 - return location of next record c (this increments the next record count) c = 18 - return type of file. c elmiqr = 0 - integer c = 1 - double precision c = 2 - real c = 3 - complex c = 4 - character*8 c = 7 - index c = 19 - return virtual type of file. c elmiqr = 0 - fixed length (4.4 form) c = 1 - indexed variable length (layer data) c = 2 - xref data tables c = 3 - bitmap data (for 32 data item packed records) c = 4 - data tables (three dimensional arrays) c = -1 - material number etc. (see elmcmx) c =-101 - pointer to element integers etc. (see elmcmx) c c output arguments: c elmiqr (int,func,out) - the returned value of elmiqr is based on c setting of key. c #include "impcom.inc" c external vminqr,virtrd integer vminqr c integer elmiqr, ielem, key, j, iloc(2) c
c c c c c use) c c c c c c c c c c c c c c c c
elmdat
(int,ar(10),in) - element attributes. elmdat(1) - material number (2) - element type (3) - real constant number (4) - element number (obsolete, do not (5) (6) - coordinate system number - death flag if 0 - alive if 1 - dead (7) - solid model reference (8) - 100*shape + specific shape (9) - reserved (10) - p element include flag if 0 - include if 1 - exclude - number of nodes for this element. - node numbers for this element.
nnod nodes
(int,sc,in) (int,ar(*),in)
c = 5 - return length (int words) c = 6 - return compressed record number. c = 11 - return void percent (integer) c = 16 - return location of next record c (this increments the next record count) c = 18 - return type of file. c etyiqr = 0 - integer c = 1 - double precision c = 2 - real c = 3 - complex c = 4 - character*8 c = 7 - index c = 19 - return virtual type of file. c etyiqr = 0 - fixed length (4.4 form) c = 1 - indexed variable length c (layer data) c = 2 - xref data tables c = 3 - bitmap data (for 32 data c item packed records) c = 4 - data tables (three c dimensional arrays) c = -n, return element characteristic n from etycom for element c type itype. c n is correlated to the parameter names in echprm. c see elccmt for definitions of element characteristics. c note- this will not overwrite the current setting of c etycom. c c output arguments: c etyiqr (int,func,out) - the returned value of etyiqr is based on c setting of key.
c c c c c c
ielx
(int,ar(*),out)
element type. > 0 - number of data items on selected element type. - element type data. see elccmt for description of data.
c *** Notice - This file contains ANSYS Confidential information *** c c typ=int,dp,log,chr,dcp siz=sc,ar(n),func intent=in,out,inout c c input arguments: c variable (typ,siz,intent) description c iott (int,sc,in) - printout file c ielc (int,ar(150),inout) - input element characteristics c in positions 1 to 20. c (itype, jstif, keyopts, etc.) c c output arguments: c elcdn (chr,sc,out) - element descriptive name as character c string c ielc (int,ar(150),inout) - output element characteristics c in positions 21 to 150. c (kdim, ishap, idegen, etc.) c see elccmt for a full list
c c c c
kerr
(int,sc,out)
c EX = 1, EY = 2, EZ = 3, NUXY= 4, NUYZ= 5, NUXZ= 6, GXY = 7, GYZ = 8 c GXZ = 9, ALPX=10, ALPY=11, ALPZ=12, DENS=13, MU =14, DAMP=15, KXX =16 c KYY =17, KZZ =18, RSVX=19, RSVY=20, RSVZ=21, C =22, HF =23, VISC=24 c EMIS=25, ENTH=26, LSST=27, PRXY=28, PRYZ=29, PRXZ=30, MURX=31, MURY=32 c MURZ=33, PERX=34, PERY=35, PERZ=36, MGXX=37, MGYY=38, MGZZ=39, EGXX=40 c EGYY=41, EGZZ=42, TGXX=43, TGYY=44, TGZZ=45, SONC=46, c ORTH=54, CABL=55, RIGI=56 c HGLS=57, BM =58, QRAT=59, REFT=60, PLAS=61, CREE=62, FAIL=63, BH =64 c PIEZ=65, SWEL=66, WATE=67, CONC=68, PFLO=69, ANEL=70, ACOU=71, EVIS=72 c USER=73, NL =74, HYPE=75, NNEW=76, MOON=77, OGDE=78, SUTH=79, WIND=80 c (see mpinit for uncommented code) c c key (int,sc,in) - key as to the information needed c about material property. c = DB_SELECTED - return select status: c mpinqr = 0 - material prop is undefined. c = 1 - material prop is selected. c = DB_NUMDEFINED - return number of defined material properties c = DB_MAXDEFINED - return highest material property number defined c = DB_MAXRECLENG - return maximum record length (dp words) c = 2 - return length (dp words) c = 3 - return number of temp. values c = 11 - return void percent (integer) c c output arguments: c mpinqr (int,func,out) - returned value of mpinqr is based on c setting of key. c
c GXZ = 9, ALPX=10, ALPY=11, ALPZ=12, DENS=13, MU =14, DAMP=15, KXX =16 c KYY =17, KZZ =18, RSVX=19, RSVY=20, RSVZ=21, C =22, HF =23, VISC=24 c EMIS=25, ENTH=26, LSST=27, PRXY=28, PRYZ=29, PRXZ=30, MURX=31, MURY=32 c MURZ=33, PERX=34, PERY=35, PERZ=36, MGXX=37, MGYY=38, MGZZ=39, EGXX=40 c EGYY=41, EGZZ=42, TGXX=43, TGYY=44, TGZZ=45, SONC=46, c ORTH=54, CABL=55, RIGI=56 c HGLS=57, BM =58, QRAT=59, REFT=60, PLAS=61, CREE=62, FAIL=63, BH =64 c PIEZ=65, SWEL=66, WATE=67, CONC=68, PFLO=69, ANEL=70, ACOU=71, EVIS=72 c USER=73, NL =74, HYPE=75, NNEW=76, MOON=77, OGDE=78, SUTH=79, WIND=80 c (see mpinit for uncommented code) c c output arguments: c mpget (int,func,out) - number of temperature values c temp (dp,ar(mpget),out) - vector of the temperature values c prop (dp,ar(mpget),out) - vector of the property values c
c PIEZ=65, SWEL=66, WATE=67, CONC=68, PFLO=69, ANEL=70, ACOU=71, EVIS=72 c USER=73, NL =74, HYPE=75, NNEW=76, MOON=77, OGDE=78, SUTH=79, WIND=80 c (see mpinit for uncommented code) c c ntab (int,sc,in) - number of entries in the table c (1 to 100) c tem (dp,ar(ntab),in) - temperature vector (ascending) c prp (dp,ar(ntab),in) - property vector c c output arguments: c none. c
function csyiqr (ncsy,key) c *** primary function: get information about a coordinate system c *** secondary functions: none c c *** Notice - This file contains ANSYS Confidential information *** c c typ=int,dp,log,chr,dcp siz=sc,ar(n),func intent=in,out,inout c c input arguments: c variable (typ,siz,intent) description c ncsy (int,sc,in) - coordinate system reference number c should be zero for key= DB_NUMDEFINED c or DB_MAXDEFINED c key (int,sc,in) - information flag. c = DB_SELECTED - return status: c csyiqr = 0 - coordinate system is not defined c -1 - coordinate system is not selected c 1 - coordinate system is selected c = DB_NUMDEFINED - number of defined coordinate systems c = DB_MAXDEFINED - maximum coordinate system reference c number used. c c output arguments: c csyiqr (int,func,out) - the returned value of csyiqr is based on c setting of key. c
c csydpx(1-9) - transformation matrix c (10-12) - origin (XC, YC, ZC) c (13-14) - coordinate system parameters cparm c cparm2 c (15) - spare c (16-18) - defining angles c csyinx (int,ar(6),out) c csyinx(1-2) - theta, phi singularity keys c (3) - coordinate system type icdsys c (csyinx(4) is inout) (4) - coordinate system number csyact c (5) - spare c (6) - spare c csyget (int,func,out) - status of coordinate system c = 0 - coordinate system exists c = 1 - coordinate system doesn't exist c
c c
none
c = DB_SELECTED - return select status c cpinqr = 1 - coupled set is selected c = 0 - coupled set in undefined c =-1 - coupled set in unseleted c = DB_NUMDEFINED - return number of defined coupled sets c = DB_NUMSELECTED - return number of selected coupled sets c = DB_MAXDEFINED - return the number of the highest numbered c coupled set c = DB_MAXRECLENG - return length of largest coupled set record c (max record length) c = 2 - return length (data units) c = 3 - return layer number c = 4 - return address of first data word c = 11 - return void percent (integer) c = 16 - return location of next record c c output arguments: c cpinqr (int,func,out) - the returned value of cpinqr is based on c setting of key c
c c c c c c c c c c c c c c c
input arguments: variable (typ,siz,intent) description ncp (int,sc,in) - coupled set number n (int,sc,in) - number of nodes in coupled set ieqn (int,ar(n+2),in) - info for storage ieqn(1:n) - list of coupled nodes ieqn(n+1) - degree of freedom label for set (ieqn(n+2) is inout) ieqn(n+2) - number of nodes in coupled set (copy of n) output arguments: ieqn(n+2) (int,sc,inout) - number of nodes in coupled set (another copy of n)
c c c c c c c c c c set c c c c c c c c c c on c c
DB_MAXRECLENG - return select status ceinqr = 1 - equation is selected = 0 - equation is undefined =-1 - equation is unselected = DB_NUMDEFINED - return number of defined contraint equations = DB_NUMSELECTED - return number of selected contraint equations = DB_MAXDEFINED - return number of highest numbered constraint equation defined = DB_MAXRECLENG - return length of longest contraint equation = DB_SELECTED = 2 = 3 = 4 = 11 = 16 = -1 (max record length) return length (data units) return layer number address of first data word return void percent (integer) return location of next record return master dof for this eqn - the returned value of ceinqr is based setting of key
c *** Notice - This file contains ANSYS Confidential information *** c input arguments: c nce (int,sc,in) - constraint equation set number c n (int,sc,in) - number of degrees of freedom in set c ieqn (int,ar(n+1),in) - integer info c ieqn(1:n) - node*32+dof for each dof in set c ieqn(n+1) - number of dof in set (copy of n above) c deqn (dp,ar(n+1),in) - dp info c deqn(1:n) - coefficients of each dof in set c deqn(n+1) - constant term c output arguments: none
c input arguments: c variable (typ,siz,intent) description c node (int,sc,in) - node number for inquire. c key (int,sc,in) - key as to the information needed c = 1 - return constraint mask c = DB_MAXDEFINED, c DB_NUMDEFINED - return number of nodal constraints c NOTE: both DB_MAXDEFINED and c DB_NUMDEFINED produce the same c functionality c c output arguments: c disiqr (int,func,out) - the returned value of disiqr is based on
subroutine disput (node,idf,value) c *** primary function: store a constraint at a node. c *** secondary functions: none. c c *** Notice - This file contains ANSYS Confidential information *** c c typ=int,dp,log,chr,dcp siz=sc,ar(n),func intent=in,out,inout c c input arguments: c variable (typ,siz,intent) description c node (int,sc,in) - node number c idf (int,sc,in) - reference number of DOF: (1-32) c UX = 1, UY = 2, UZ = 3, ROTX= 4, ROTY= 5, ROTZ= 6, AX = 7, AY = 8 c AZ = 9, VX =10, VY =11, VZ =12 c PRES=19, TEMP=20, VOLT=21, MAG =22, ENKE=23, ENDS=24 c EMF =25, CURR=26 (missing entries are spares) c c value (dp,ar(2),in) - (real,imag) values for constraint c c output arguments: c none. c
function foriqr (node,key) c *** primary function: get information about nodal loads. c c *** Notice - This file contains ANSYS Confidential information *** c c typ=int,dp,log,chr,dcp siz=sc,ar(n),func intent=in,out,inout c c input arguments: c variable (typ,siz,intent) description c node (int,sc,in) - number of node being inquired about. c should be 0 for key=DB_MAXDEFINED or c DB_NUMDEFINED c key (dp,sc,in) - key as to information needed c = 1 - return force mask for node c = DB_MAXDEFINED, c DB_NUMDEFINED - return number of nodal loadings c in model c NOTE: both DB_MAXDEFINED and DB_NUMDEFINED c produce the same functionality c c output arguments: c foriqr (int,func,out) - the returned value of foriqr is based on c
= 4 - this node has a loading for this (dp,ar(4),out) value(1-2) - (real,imag) values of present value(3-4) - (real,imag) values of previous
c c c c c
description - node number should be zero for key=2 - key for operation = 1 - return temperature status ntpiqr = 0 - node has no temperature constraint defined = 1 - node has a temperature constraint defined = 2 - return total number of nodal temperatures defined in model - the returned value of ndinqr is based
c c
temp
(dp,ar(2),out)
c should be 0 for key=2 c key (int,sc,in) - key for operation c = 1 - return whether node has a heat generation rate c defined c nhgiqr = 0 - no heat generation defined for node c = 1 - heat generation is defined for node c = 2 - return total number of nodal heat generation c rates defined in model c c output arguments: c nhgiqr (int,func,out) - the returned value of nhgiqr is based on c
function nfuget (node,fluen) c *** primary function: get specified nodal fluence. c *** Notice - This file contains ANSYS Confidential information *** c c typ=int,dp,log,chr,dcp siz=sc,ar(n),func intent=in,out,inout c c input arguments: c variable (typ,siz,intent) description c node (int,sc,in) - node number c c output arguments: c nfuget (int,func,out) - fluence status of node. c = 0 - node has no fluence constraint c = 1 - node has a fluence constaint c fluen (dp ,ar(2),out) - the nodal fluences (new,old).
description - node number should be zero for key=2 (int,sc,in) - key for operation = 1 - return nodal current status: ndciqr = 0 - no current density defined for this = 1 - node has a current density defined = 2 - total number of nodal current densities defined on model
include a set of general routines that perform utility-type functions, a set of routines supporting vector functions, a set of routines supporting matrix functions, and routines supporting message processing options.
Argument type is one of the following: int - integer dp - double precision log - logical chr - character dcp - double precision complex
Argument size is one of the following: sc - scalar variable ar(n) - array variable of length n func - functional return value
Argument intent is one of the following: in - input argument out - output argument inout - both an input and an output argument
ch8
(ch*8,sc,out)
c = WR_SUPCOLHEADER - column header supress key keylab c = WR_SUPCOLMAX - column maximum supress key keysum c c output arguments: c wrinqr (int,func,out) - the value corresponding to key
co 0=message needs pick or keyboard before removal co 1=message stays up untill replaced by another message co nomore display any more messages (ER_NOMOREMSG) co 0=display messages co 1=display discontinue message and stop displaying co eropen - 0=errors file is closed (ER_FILEOPEN) co 1=errors file is opened co ikserr - 0=if interactive do not set keyerr (ER_INTERERROR) c - 1=if interactive set keyerr (used by mesher and tessalation) co kystat - flag to bypass keyopt tests in the elcxx routines (ER_KEYOPTTEST) c associated with status/panel info inquiries. c 0=do not bypass keyopt tests c 1=perform all keyopt tests co mxr4r5 - mixed rev4-rev5 input logic (*do,*if,*go,*if-go) (ER_MIXEDREV) c (used in chkmix called from rdmac) c 1=rev5 found (*do,*fi-then-*endif) c 2=rev4 found (*go,:xxx,*if,....,:xxx) c 3=warning printed. do not issue any more. co mshkey - cpu intensive meshing etc. this will cause (ER_MESHING) c "nertim (11)" to be set to -1 for "notes", 1 for "warnings", c and 0 for "errors". checking of this key is done in "anserr". c 0=not meshing or cpu intensive c 1=yes, meshing or cpu intensive co syerro - systop error code. read by anserr if set. (18) co opterr - 0=no error in main ansys during opt looping (ER_OPTLOOPING) c 1=an error has happened in main ansys during opt looping co flowrn - flag used by "floqa" as to list floqa.ans (20) c 0=list "floqa.ans" c 1="floqa.ans" has been listed. do not list again. co espare - spare integer variables c c --- end of information from errcom c c output arguments: c erinqr (int,sc,out) - value corresponding to key c #include "impcom.inc" c integer key, erinqr
c c c c
c *** Notice - This file contains ANSYS Confidential information *** c c c c c c c c c c c c c c c c c c c c c c typ=int,dp,log,chr,dcp input arguments: variable (typ,siz,intent) filein (ch*16,sc,in) siz=sc,ar(n) intent=in,out,inout
msgid
(int,sc,in)
msglvl
(int,sc,in)
messg dperr
(ch*256,sc,in) (dp,ar(*),in)
description - Filename used for character portion of message ID (this is the file name of the file which contains the source for this routine) - Numeric portion of the message ID 1 - 9999, unique for each erhandler call in the FILE. Recommend using a sequence, similar to format conventions, i.e., 3010, 3020, 3030 - level of error (same as anserr) 0=no label (used for u/i pop-ups) -1=no label (used for u/i pop-ups) timed as a note message 1=note, 2=warning, 3=error, 4=fatal - error message to display. use keywords of %i %g %c %/ for formating (same as anserr) - vector of data to display. contains both integer and double precision data.
c c cherr c characters c
(same as anserr) (ch*(*),ar(*),in) - vector of character data to display max length of character data is 32 vector element. (same as anserr)
c xval (dp,sc,in) table c ax (dp,ar(*),in) c ay (dp,ar(*),in) c nmax (int,sc,in) c c output arguments: c yval (dp,sc,out) table c kyoff (int,sc,out) c c c
- value of x with which to go into the - table of x values, in ascending order - table of y values - maximum table size allowed - value of y which comes back from the - xval status flag = 0 - xval in x range = 1 - xval less than minimum x = 2 - xval greater than maximum x
c c c c c c c c c c c c c
untrapped xox error anserr fatal error possible full disk possible corrupted or missing file Error in VM routines (corrupt db?) unauthorized code section entered unable to open x11 server quit signal failure to get signal in max time (syhold) >32 - system dependent error output arguments: none
14 15 16 17 18 21 25 30 31
3.3.3 vmax Function (Retrieving the Maximum Vector Value at a Given Location)
function vmax (v,n,locmax) c *** primary function: return the max value and location in a vector c *** Notice - This file contains ANSYS Confidential information *** c c c c c c input arguments: v (dp,ar(n),in) n (int,sc,in) output arguments: locmax (int,sc,out) vmax (dp,sc,out) - vector v - length of vector v - location of max value in vector v - max value in vector v
3.3.4 lastv Function (Retrieving the Position of the Last Nonzero Term in a Double Precision Vector)
function lastv (v,n) c *** primary function: find position of last non-zero term in a d.p. vector c c input arguments: c v (dp,ar(n),in) - vector V c n (int,sc,in) - the number of items in the vector C c output arguments: lastv (dp,sc,out) - the position of the last non-zero term
subroutine vzero (v,n) c *** primary function: initialize a vector to zero c *** Notice - This file contains ANSYS Confidential information *** c c c c c input arguments: v (dp,ar(n),inout) n (int,sc,in) output arguments: v (dp,ar(n),inout) - vector to zero out - number of words to zero out - zeroed vector
c c c c c
c c c
(int,sc,in)
3.3.15 vamb Subroutine (Gets a Third Vector by Subtracting One Vector from Another)
subroutine vamb (a,b,c,n) c *** primary function: subtract vector b from vector a to get vector c c *** Notice - This file contains ANSYS Confidential information *** c c c c c c input arguments: a (dp,ar(n),in) b (dp,ar(n),in) n (int,sc,in) output arguments: c (dp,ar(n),out) - vector a - vector b - length of vectors a,b,c - vector c
c c c
(int,sc,in)
c c c
(dp,ar(3),in)
c *** Notice - This file contains ANSYS Confidential information *** c c input arguments: c variable (typ,siz,intent) description c node (int,sc,in) - node number for operation. c c output arguments: c variable (typ,siz,intent) description c ndgxyz (int,sc,out) - status of node. c 0=node is undefined. c -1=node is unselected. c 1=node is selected. c xyz (dp,ar(3),out) - vector containing x,y,z
- product vector w
c *** Notice - This file contains ANSYS Confidential information *** c c c c c c c c input arguments: a (dp,ar(nr,nc),in) - matrix a v (dp,ar(nc),inout) - vector v nr (int,sc,in) - number of rows in matrix a *** nr limited to 60 *** nc (int,sc,in) - number of columns to multiply in matrix a output arguments: v (dp,ar(nr),inout) - product, stored in vector v
nc
(int,sc,in)
- product matrix c
3.4.6 maat Subroutine (Changing a Matrix Value via Addition, Multiplication, and Transposition)
subroutine maat(a,c, nc,n, con) c primary function: does con*a*at and sums the result onto c (a is a vector) c *** Notice - This file contains ANSYS Confidential information *** c c c c c c c c c typ=int,dp,log,chr,dcp input arguments: a (dp,ar(*),in) c nc n con siz=sc,ar(n) intent=in,out,inout
- vector to be multiplied by itself to generate an nxn square matrix (a by a-transposed) (dp,ar(nc,*),inout) - matrix to be accumulated onto (int,sc,in) - number of rows in the c matrix (int,sc,in) - size of square matrix (dp,sc,in) - multiplier on above square matrix
c output arguments: c c (dp,ar(nc,*),inout) - matrix to be accumulated onto c only the lower triangular matrix is done c Note: this routine is usually followed by matsym,
3.4.7 matsym Subroutine (Filling the Lower Triangle from the Upper Triangle)
subroutine matsym (a,nd,n) c primary function: fill upper triangle from lower triangle c *** Notice - This file contains ANSYS Confidential information *** c c c c c c typ=int,dp,log,chr,dcp siz=sc,ar(n) intent=in,out,inout its lower triangular part upper triangular part of the a matrix to be processed
input arguments: a (dp,ar(nd,*),inout) - matrix to have copied to its nd (int,sc,in) - number of rows n (int,sc,in) - size of matrix
c output arguments: c a (dp,ar(nd,*),inout) - matrix that has its lower triangular part c copied to its upper triangular part
c *** Notice - This file contains ANSYS Confidential information *** c input arguments: c a (dp,ar(na,na),inout) c c c na (int,sc,in) c c (dp,ar(nc,nnew),in) c nnew)) c nc (int,sc,in) c nold (int,sc,in) c 64 c nnew (int,sc,in) c size). c 64 matrix to be pre and post multiplied (part operated on must be square(nold x nold) and symmetric) first dimension of the a matrix matrix to pre and post multiply a by (part used may be rectangular(nold x first dimension of the c matrix size of part of 'A' matrix that is to be processed(input size). maximum = size of part of 'A' matrix that results from this operation(output maximum =
c output arguments: c a (dp,ar(na,na),inout) resulting matrix c (still square(nnew x nnew) and symmetric).
c input arguments: c variable (typ,siz,intent) description c zs (dp,ar(nz,nz),inout) - matrix to be transformed c tr (dp,ar(ntr,ntr),in) - transformation matrix c nz (int,sc,in) - dimensioned size of zs matrix c ntr (int,sc,in) - dimensioned size of tr matrix c nrow (int,sc,in) - number of rows of zs matrix to transform c irot (int,sc,in) - block size to transform(size of tr matrix) c c c output arguments: variable (typ,siz,intent) description zs (dp,ar(nz,nz),inout) - transformed matrix
description - matrix to be solved or inverted second dimension must be at least: n + abs(nc) first dimension of the a matrix number of equations number of additional columns. if nc = +n or -n, invert n x n matrix and put result in the n+1 to 2xn columns. if nc is 0 or negative, nc will be reset n and then symeqn will set up identity matrix after the input matrix, where the result of the inversion will be put. if nc is positive and less than n, do a
c output arguments: c variable (typ,siz,intent) description c a (dp,ar(nd,*),inout) - results or inverted matrix. c starts in column n+1. c note: original information is destroyed. c c example 1: Solve three simultaneous linear equations: c call symeqn (a(1,1),3,3,1) c calling routine has a dimensioned as a(3,4) c each equation has its 3 coefficents in the first 3 columns, c and the constant term is in the fourth column. c solution is in fourth column. c c example 2: Invert a 3x3 matrix: c call symeqn (a(1,1),3,3,-3) c calling routine has a dimensioned as a(3,6) c input matrix was input in first 3 columns c output matrix in ouput in last 3 columns
c c c c c c
k n m
3.5.5 msgdit Subroutine (Conditionally Printing Messages and a Transposed Integer Matrix)
subroutine msgdit (msg,k,n,m) c *** primary function: write text & transposed integer matrix to output if c 10th debug key is greater than or equal to 3 c c At source development, you may wish conditionally to print-out messages, c scalars, vectors or matrices to monitor the code. Once the program c runs OK, there is no need for these print-outs. This feature can be achieved c with the programmers debug utilities. c c To invoke this utility insert the following line in ANSYS input deck: c c /DEBUG,,, ,,, ,,, ,3
c c *** Notice - This file contains ANSYS Confidential information *** c c input arguments: c variable (typ,siz,intent) description c msg (ch*256,sc,in) - message to print c k (int,ar,in) - integer matrix to print c n (int,sc,in) - row size of vector c m (int,sc,in) - column size of vector c c output arguments: c none
c runs OK, there is no need for these print-outs. This feature can be achieved c with the programmers debug utilities. c c To invoke this utility insert the following line in ANSYS input deck: c c /DEBUG,,, ,,, ,,, ,3 c c *** Notice - This file contains ANSYS Confidential information *** c c input arguments: c variable (typ,siz,intent) description c msg (ch*256,sc,in) - message to print c r (dp,sc,in) - real to print c c output arguments: c none
c *** primary function: write text & real matrix to output if 10th debug key c is greater than or equal to 3 c c At source development, you may wish conditionally to print-out messages, c scalars, vectors or matrices to monitor the code. Once the program c runs OK, there is no need for these print-outs. This feature can be achieved c with the programmers debug utilities. c c To invoke this utility insert the following line in ANSYS input deck: c c /DEBUG,,, ,,, ,,, ,3 c c *** Notice - This file contains ANSYS Confidential information *** c c input arguments: c variable (typ,siz,intent) description c msg (ch*256,sc,in) - message to print c r (dp,ar,in) - real matrix to print c n (int,sc,in) - row size of vector c m (int,sc,in) - column size of vector c c output arguments: c none
3.5.10 msgdrt Subroutine (Conditionally Printing Messages and Real Transposed Matrices)
subroutine msgdrt (msg,r,n,m) c *** primary function: write text & real transposed matrix to output if 10th c debug key is greater than or equal to 3 c c At source development, you may wish conditionally to print-out messages, c scalars, vectors or matrices to monitor the code. Once the program c runs OK, there is no need for these print-outs. This feature can be achieved c with the programmers debug utilities. c c To invoke this utility insert the following line in ANSYS input deck: c c /DEBUG,,, ,,, ,,, ,3 c c *** Notice - This file contains ANSYS Confidential information *** c c input arguments: c variable (typ,siz,intent) description c msg (ch*256,sc,in) - message to print c r (dp,ar,in) - real matrix to print c n (int,sc,in) - row size of vector c m (int,sc,in) - column size of vector c c output arguments: c none
c c