# 2.1.3 OBTAINING THE Abaqus OUTPUT DIRECTORY NAME Products: Abaqus/Standard Abaqus/Explicit # References • “User subroutines: overview,” Section 18.1.1 of the Abaqus Analysis User’s Guide • “UWAVE and UEXTERNALDB,” Section 4.1.27 of the Abaqus Verification Guide # Overview Utility routines GETOUTDIR and VGETOUTDIR can be called from any Abaqus/Standard or Abaqus/Explicit user subroutine, respectively, to obtain the output directory of the current job. # Interface ```txt character*256 OUTDIR ... CALL GETOUTDIR( OUTDIR, LENOUTDIR ) CALL VGETOUTDIR( OUTDIR, LENOUTDIR ) ... ``` # Variables returned from the utility routine # OUTDIR Character string to receive the value of the output directory name. # LENOUTDIR Length of the character string OUTDIR. # 2.1.4 OBTAINING PARALLEL PROCESSES INFORMATION Products: Abaqus/Standard Abaqus/Explicit # References • “Parallel execution: overview,” Section 3.5.1 of the Abaqus Analysis User’s Guide • “VUSDFLD,” Section 4.1.39 of the Abaqus Verification Guide # Overview Several different utility routines are available to provide detailed information about your parallel processes. # GETNUMCPUS and VGETNUMCPUS (obtain the number of processes) Utility routine GETNUMCPUS can be called from any Abaqus/Standard user subroutine. GETNUMCPUS returns the number of MPI processes. Utility routine VGETNUMCPUS can be called from any Abaqus/Explicit user subroutine in a domainparallel run. VGETNUMCPUS provides the number of processes used for the parallel run. # Interface CALL GETNUMCPUS( NUMPROCESSES )CALL VGETNUMCPUS( NUMPROCESSES ):· # Variable returned from the utility routine # NUMPROCESSES Number of processes specified for the analysis. # GETRANK and VGETRANK (obtain the process number) Utility routine GETRANK can be called from any Abaqus/Standard user subroutine. GETRANK returns the rank of the MPI process from which the function is called. For example, in a hybrid MPI and thread parallel execution scheme, multiple threads may all return the rank of their parent MPI process (see “Parallel execution in Abaqus/Standard,” Section 3.5.2 of the Abaqus Analysis User’s Guide). Utility routine VGETRANK can be called from any Abaqus/Explicit user subroutine in a domain-parallel run. VGETRANK provides the individual process rank (see “Parallel execution in Abaqus/Explicit,” Section 3.5.3 of the Abaqus Analysis User’s Guide). # Interface ```txt CALL GETRANK( KPROCESSNUM ) CALL VGETRANK( KPROCESSNUM ) ... ``` # Variable returned from the utility routine # KPROCESSNUM Process number or rank. A process number is either zero or a positive integer. # GETNUMTHREADS (obtain the number of threads) Utility routine GETNUMTHREADS can be called from any Abaqus user subroutine. It returns the number of threads in a process. In a hybrid parallel execution mode, there will be several Abaqus MPI processes, each having several threads. # Interface ```cpp Fortran: #include integer numThreads numThreads = GETNUMTHREADS() C++: #include int numThreads = GETNUMTHREADS(); ``` # get\_thread\_id You can determine the ID of the thread you are in by calling the utility function get\_thread\_id. The returned ID is an integer that Abaqus assigns to each of its threads. The main thread will have the ID=0, and each subsequent thread will have an ID of 1, 2, 3, 4, ..., N. This function can be called from any Abaqus user subroutine and from both the Fortran and C/C++ codes. # Interface ```txt FOTRAN: #include INTEGER myThreadID myThreadID = get_thread_id() C++: #include int myThreadID = get_thread_id() ``` # Variable returned from the utility routine thread\_id Current thread ID, an integer. # GETCOMMUNICATOR (Fortran) Utility function GETCOMMUNICATOR can be called from any Abaqus user subroutine. GETCOMMUNICATOR returns a communicator that Abaqus defines for its worker processes, similar to MPI\_COMM\_WORLD. In Fortran its type is an INTEGER. The communicator thus obtained can be used for subsequent MPI communication routines. In a nonparallel run, when the MPI subsystem is not initialized, communicators do not exist and GET\_COMMUNICATOR() will return 0. Another way of testing is to call the MPI\_Initialized(flag) function. This function will set the flag to 1 if MPI has been initialized. # Interface ```cpp #include integer ABA_COMM_WORLD ``` ```txt ABA_COMM_WORLD = GETCOMMUNICATOR() if (ABA_COMM_WORLD.ne.0) then ...do some parallel work, using MPI ... else ...do some work in a single process ... end if ``` # Variable returned from the utility routine # INTEGER Communicator handle identifier of type INTEGER. In a non-MPI run, the value returned will be zero. # get\_communicator (C++) Utility function get\_communicator can be called from any Abaqus user subroutine. get\_communicator returns a communicator that Abaqus defines for its worker processes. In C++ this function is called get\_communicator() and returns a value of the type MPI\_Comm. The communicator thus obtained can be used for subsequent MPI communication routines. In a nonparallel run, when the MPI subsystem is not initialized, communicators do not exist and get\_communicator() will return 0. Another way of testing is to call the MPI\_Initialized(flag) function. This function will set the flag to 1 if MPI has been initialized. # Interface ```c #include MPI_Comm ABA_COMM_WORLD = get_communicator() if (ABA_COMM_WORLD) { ... do some parallel work, using MPI ... } else{ ...do some work in a single process ... } ``` # Variable returned from the utility routine # MPI\_Comm Communicator handle of type MPI\_Comm. In a non-MPI run, the value returned will be zero. # 2.1.5 OBTAINING PART INFORMATION Products: Abaqus/Standard Abaqus/Explicit # References • “User subroutines: overview,” Section 18.1.1 of the Abaqus Analysis User’s Guide • “Defining an assembly,” Section 2.10.1 of the Abaqus Analysis User’s Guide • “Pure bending of a cylinder: CAXA elements,” Section 1.3.33 of the Abaqus Verification Guide # Overview Several utility routines are available to allow you to obtain information about your part instances. Utility routines GETPARTINFO and VGETPARTINFO can be called from any Abaqus/Standard or Abaqus/Explicit user subroutine, respectively, to retrieve the part instance name and original node or element number corresponding to an internal node or element number. Utility routines GETINTERNAL and VGETINTERNAL can be called from any Abaqus/Standard or Abaqus/Explicit user subroutine, respectively, to retrieve the internal node or element number corresponding to a part instance name and original node or element number. The part file (jobname.prt) must be available. The expense of calling these routines is not trivial, so minimal use of them is recommended. GETPARTINFO and VGETPARTINFO (obtain part instance information given global node/element number) # Interface ```txt CHARACTER*80 CPNAME ... CALL GETPARTINFO(INTNUM, JTYP, CPNAME, LOCNUM, JRCD) or CALL VGETPARTINFO(INTNUM, JTYP, CPNAME, LOCNUM, JRCD) ``` # Variables to be provided to the utility routine # INTNUM The internal (global) node or element number to be looked up. # JTYP An integer flag indicating whether INTNUM is a node or element number. Set JTYP=0 to look up a node number, and set JTYP=1 to look up an element number. # Variables returned from the utility routine # CPNAME The name of the part instance that contains INTNUM. An empty part instance name indicates that the node or element is at the assembly level and is not included in any part instance. # LOCNUM The part-local node or element number corresponding to INTNUM. # JRCD Return code (0–no error, 1–error). # GETINTERNAL and VGETINTERNAL (obtain global node/element number given part instance information ) # Interface ```txt CHARACTER*80 CPNAME ... CALL GETINTERNAL(CPNAME, LOCNUM, JTYP, INTNUM, JRCD) or CALL VGETINTERNAL(CPNAME, LOCNUM, JTYP, INTNUM, JRCD) ``` # Variables to be provided to the utility routine # CPNAME The name of the part instance that contains LOCNUM. # LOCNUM The part-local node or element number to be looked up. # JTYP An integer flag indicating whether LOCNUM is a node or element number. Set JTYP=0 to look up a node number, and set JTYP=1 to look up an element number. # Variables returned from the utility routine # INTNUM The internal (global) node or element number corresponding to LOCNUM in part instance CPNAME. # JRCD Return code (0–no error, 1–error). # 2.1.6 OBTAINING MATERIAL POINT INFORMATION IN AN Abaqus/Standard ANALYSIS # Product: Abaqus/Standard # References • “UVARM,” Section 1.1.58 • “USDFLD,” Section 1.1.53 • “UDMGINI,” Section 1.1.26 • “Damage and failure of a laminated composite plate,” Section 1.1.14 of the Abaqus Example Problems Guide • “USDFLD,” Section 4.1.24 of the Abaqus Verification Guide • “UVARM,” Section 4.1.26 of the Abaqus Verification Guide # Overview Utility routine GETVRM can be called from either user subroutine UVARM, UDMGINI, or USDFLD to access material integration point information. # Interface DIMENSION ARRAY(15), JARRAY(15) CHARACTER\*3 FLGRAY(15) CALL GETVRM('VAR',ARRAY,JARRAY,FLGRAY,JRCD,JMAC,JMATYP,MATLAYO, LACCFLA) # Variables to be provided to the utility routine # VAR Output variable key from the table in “Abaqus/Standard output variable identifiers,” Section 4.2.1 of the Abaqus Analysis User’s Guide. The applicable keys are listed in the output table as being available for results file output at the element integration points; e.g., S for stress. # JMAC Variable that must be passed into the GETVRM utility routine. The calling user subroutine provides this variable. # JMATYP Variable that must be passed into the GETVRM utility routine. The calling user subroutine provides this variable. # MATLAYO Variable that must be passed into the GETVRM utility routine. The calling user subroutine provides this variable. # LACCFLA Variable that must be passed into the GETVRM utility routine. The calling user subroutine provides this variable. # Variables returned from the utility routine # ARRAY Real array containing individual components of the output variable. # JARRAY Integer array containing individual components of the output variable. # FLGRAY Character array containing flags corresponding to the individual components. Flags will contain either YES, NO, or N/A (not applicable). # JRCD Return code (0 – no error, 1 – output request error or all components of output request are zero). # Available output variable keys Only output variable keys that are valid for results file output are available for use with GETVRM. In general, if a key corresponds to a collective output variable, rather than an individual component, it can be used with GETVRM. For example, S for the stress tensor can be used, whereas any individual component of stress, say S11, cannot be used. The collective output variable keys are distinguished from their individual components by the fact that they have a bullet ( ) in the .fil column in the tables in “Abaqus/Standard output variable identifiers,” Section 4.2.1 of the Abaqus Analysis User’s Guide. Output variable keys that cannot be used with GETVRM are listed later in this section. You will be returned ARRAY, JARRAY, and FLGRAY, which correspond to the real-valued components, integer-valued components, and the flags associated with the request VAR, respectively. If any array component is not applicable for a given request, its value will be returned as the initialized value: 0.0 in ARRAY, 0 in JARRAY, and N/A in FLGRAY. The error flag JRCD=1 is returned from GETVRM any time a request key is not recognized, the request is not valid (such as requesting transverse shear stress for a shell element that uses thin shell theory), or all of the output components requested are zero; otherwise, JRCD=0. # Ordering of returned components The components for a request are written as follows. Single index components (and requests without components) are returned in positions 1, 2, 3, etc. Double index components are returned in the