## 3.9. Autodyn Utility Functions/Subroutines

Autodyn utility routines perform a variety of functions that can be used in user subroutines. We have already seen one in the previous section where the function IJKSET3 was used to determine the index of the node/element (I,J,K) in the current Part. Below are additional routines that may be of use:

FUNCTION IJKSET3 (3D only)
  Usage:

    IJKSET3(I,J,K)

  Purpose:

    Gets the IJK index of node/zone (`I`,`J`,`K`) relative to the current Part.

    Function IJKSETL(I,J,K) can also be used with the same effect.

FUNCTION IJSET (2D only)
  Usage:

    IJSET(I,J)

  Purpose:

    Gets the IJ index of node/zone (`I`,`J`) relative to the current Part

FUNCTION IJKSETS3 (3D only)
  Usage:

    IJKSETS3(I,J,K,N)

  Purpose:

    Gets the IJK index of node/zone (`I`,`J`,`K`) relative to all Parts, where `N` is the Part number (in order of definition, starting with 1). See How to Determine the Part Number from the Part Name for example of how to obtain Part number from a Part name.

FUNCTION IJSETS (2D only)
  Usage:

    IJSETS(N,I,J)

  Purpose:

    Gets the IJ index of node/zone (`I`,`J`) relative to all Parts, where `N` is the Part number (in order of definition, starting with 1). See How to Determine the Part Number from the Part Name for example of how to obtain Part number from a Part name.

SUBROUTINE IJANDK3 (inverse of IJKSET) – (3D only)
  Usage:

    CALL IJANDK3 (IJKIN,I,J,K) ; IJKIN is input, I,J, and K are output

  Purpose:

    Gets the `I`,`J`, and `K` indices for `IJK` relative to the current Part.

SUBROUTINE IANDJ (inverse of IJSET) – (2D only)
  Usage:

    CALL IANDJ (IJIN,I,J) ; `IJIN` is input, `I` and `J` are output

  Purpose:

    Gets the `I` and `J` indices for `IJ` relative to the current Part.

SUBROUTINE IJANDKS3 (inverse of IJKSETS) – (3D only)
  Usage:

    CALL IJANDKS3 (IJKSIN,I,J,K) ; `IJKSIN` is input, `I`,`J`, and `K` are output

  Purpose:

    Gets the `I`,`J`, and `K` indices for IJK relative to the all Parts.

SUBROUTINE IANDJS (inverse of IJSETS) – (2D only)
  Usage:

    CALL IANDJS (IJSIN,I,J,M,IJKL);`IJSIN` is input, `I`,`J`,`M` and `IJKL` are output

  Purpose:

    Gets the I and J indices for IJK relative to the all Parts. Also output is the Part number M and the local IJK for that Part.

FUNCTION GV
  Usage:

    GV (NV,IJK) / GV3(NV,IJK)

  Purpose:

    Gets the value of Part variable `NV` for the node `IJK` relative to current Part. See modules mdgrid and mdgrid3 for a list of values for `NV`.

FUNCTION GVS
  Usage:

    GVS (NV,IJKS) / GVS3(NV,IJKS)

  Purpose:

    Gets the value of Part variable `NV` for the node `IJKS` relative to all Parts. See module mdgrid for a list of values for `NV`.

SUBROUTINE PUTGVS
  Usage:

    CALL PUTGVS(NV,IJKS,VALUE) / CALL PUTGVS3(NV,IJKS,VALUE)

  Purpose:

    Puts (stores) the VALUE of Part variable `NV` for the node/zone `IJKS` (relative to all Parts) in the dynamic storage arrays.

FUNCTION GETV3 (3D only)
  Usage:

    GETV3 (NV,IJK,MODE)

  Purpose:

    This is a general function that gets the variable `NV` for zone `IJK` for the current Part. Depending on the value of `MODE` the following actions are taken:

    `MODE`=0 : gets zonal variable `NV` (calls GV)

    `MODE`>0 : gets multimaterial variable `NV` for MAT=`MODE`

    `MODE`<0 : gets volume weighted average over all materials for multimaterial variable `NV`

FUNCTION NPK
  Usage:

    NPK (NV,IJK) / NPK3 (NV,IJK)

  Purpose:

    Gets the value of integer Part variable `NV` for the node `IJK` relative to current Part. See module mdgrid for list of index values for `NV`. To be used instead of GV when the variable is an integer and not a real number.

FUNCTION NPKS
  Usage:

    NPKS (NV,IJKS) / NPKS3 (NV,IJKS)

  Purpose:

    Gets the value of integer Part variable `NV` for the node `IJKS` relative to all Parts. See module mdgrid for list of values for `NV`. To be used instead of GVS when the variable is an integer and not a real number.

SUBROUTINE PUTNPKS
  Usage:

    CALL PUTNPKS(NV,IJKS,NVALUE) / CALL PUTNPKS3(NV,IJKS,NVALUE)

  Purpose:

    Puts (stores) the integer `NVALUE` of Part variable `NV` for the node/zone `IJKS` (relative to all Parts) in the dynamic storage arrays. To be used instead of PUTGVS when the variable is an integer and not a real number.

SUBROUTINE GET_ELEM_VAR
  Usage:

    CALL GET_ELEM_VAR(INDEX_ELEM,INDEX_LAYER)

  Purpose:

    `INDEX_ELEM` is the current global element number normally available via ELEM_NOW. `INDEX_LAYER` is the current element layer for the current element. For solid elements this number has to be set to 0 or 1 else the local storage of variables is not properly retrieved. Copies the data from main storage into local vector RVL (real data), IVL (integer data) accessible via

        USE mdvar_all

    To find the index of the variable in these vectors see Autodyn Variable Listings. See also Unstructured Solvers/Elements for more information.

SUBROUTINE PUT_ELEM_VAR
  Usage:

    CALL PUT_ELEM_VAR(INDEX_ELEM,INDEX_LAYER)

  Purpose:

    `INDEX_ELEM` is the current global element number normally available via ELEM_NOW. `INDEX_LAYER` is the current element layer for the current element. For solid elements this number has to be set to 0 or 1 else the local storage of variables is not properly retrieved. Copies the data to main storage from local vector RVL (real data), IVL (integer data) accessible via

        USE mdvar_all

    To find the index of the variable in these vectors see Autodyn Variable Listings. See also Unstructured Solvers/Elements for more information.

SUBROUTINE GET_NODE_VAR
  Usage:

    CALL GET_NODE_VAR(INDEX_NODE,INDEX_MATERIAL)

  Purpose:

    `INDEX_NODE` is the current global node number which can be retrieved via ELEM_NOW (see Access to Nodal Variables for NBS Tetrahedral Elements) `INDEX_MATERIAL` is normally set to either 0 or 1. For NBS nodes, this indicates the material that is being referred to on this specific node (see the example Access to Nodal Variables for NBS Tetrahedral Elements). Copies the data from main storage into local vector RVL (real data), IVL (integer data) accessible via

        USE mdvar_all

    To find the index of the variable in these vectors see Autodyn Variable Listings. See also Unstructured Solvers/Elements for more information.

SUBROUTINE PUT_NODE_VAR
  Usage:

    CALL PUT_NODE_VAR(INDEX_NODE,INDEX_MATERIAL)

  Purpose:

    `INDEX_NODE` is the current global node number which can be retrieved via ELEM_NOW (see Access to Nodal Variables for NBS Tetrahedral Elements) `INDEX_MATERIAL` is normally set to either 0 or 1. For NBS nodes, this indicates the material that is being referred to on this specific node (see the example Access to Nodal Variables for NBS Tetrahedral Elements). Copies the data to main storage from local vector RVL (real data), IVL (integer data) accessible via

        USE mdvar_all

    To find the index of the variable in these vectors see Autodyn Variable Listings. See also Unstructured Solvers/Elements for more information.

SUBROUTINE GETMLT
  Usage:

    CALL GETMLT(IJK,0) / GETMLT3(IJK,0)

  Purpose:

    Gets the individual cell values of the multi-material variables for each material in the cell for the node `IJK`. See Accessing Multiple Material Data – All IJK Solvers for more information.

SUBROUTINE PUTMLT
  Usage:

    CALL PUTMLT(IJK,0) / PUTMLT3(IJK,0)

  Purpose:

    Stores the updated cell values of the multi-material variables for each material in the cell for the node `IJK`. See Accessing Multiple Material Data – All IJK Solvers for more information.

SUBROUTINE ADQUIT
  Usage:

    CALL ADQUIT ('Message to be displayed')

    CALL ADQUIT (TEXT) ; `TEXT` is a declared text string

  Purpose:

    Terminates Autodyn execution immediately.

  Example:

        CALL ADQUIT ('Error #1 in routine EXEOS')

SUBROUTINE GETYON
  Usage:

    CALL GETYON (YON, 'Question')

    CALL GETYON (YON, TEXT) ; `TEXT` is a declared text string

  Purpose:

    Presents a question in the message area and awaits a yes/no answer. `YON` is the answer (`Y` or `N`, no other input is accepted). Maximum text length is 80 characters.

  Example:

        CHARACTER*1 YON
        CALL GETYON (YON, 'Stop run - are you sure?')
        IF (YON=='Y') STOP

SUBROUTINE USR_MESSAG
  Usage:

    CALL USR_MESSAG ('message to be displayed')

    CALL USR_MESSAG (TEXT) ; `TEXT` is a declared text string

  Purpose:

    Displays a message in the message window.

SUBROUTINE USR_ERROR
  Usage:

    CALL USR_ERROR (‘title’,'message to be displayed')

    CALL USR_ERROR (TITLE,TEXT) ; `TITLE`, `TEXT` are declared text strings

  Purpose:

    Displays a message in the message window.

  Example:

        CALL USR_ERROR (‘Warning !’,’Inconsistent strength model parameters’)

Release 18.2 - © ANSYS, Inc. All rights reserved.