4.1. Procedure for Using APDL Math

Typically, four steps are followed when using APDL Math.

  1. Create the matrices.

    Matrices and vectors can be created by one of the following methods:

    • Generate matrices and vectors directly using APDL (*DIM, *SET, etc.).

    • Mechanical APDL generates the matrices and vectors for you. These may come from a prior solution or may have been generated using the WRFULL command. The matrices are obtained from the .full, .emat, .sub, .mode or .rst files.

    • Use external sources provided in Harwell-Boeing or Matrix Market format.

  2. Read the matrices into APDL Math.

    Once the files are available, you may import them into APDL Math using *DMAT for dense matrices, *SMAT for sparse matrices, and *VEC for vectors.

  3. Manipulate the matrices.

    You can use the linear matrix operators *MULT and *AXPY to combine specified matrices and, thus, create other matrices. You may also modify the contents of matrices directly by using APDL expressions; for example, "A(3,2)=6.4".

    Additionally, you can use these steps to modify the matrices using standard APDL operations:

    1. Export the matrix via *EXPORT,,APDL.

    2. Modify the matrix using standard APDL operations such as *SET, *MOPER, *VFUN, *DO, etc.

    3. Re-import the matrix back into APDL Math via *DMAT,,,IMPORT,APDL (or *VEC,,,IMPORT,APDL for a vector).

  4. Use the matrices.

    The modified matrices may be used in standard Mechanical APDL solutions, solved in APDL Math, or exported for use in an external application, as follows.

    • Use in standard Mechanical APDL solutions:

      • The simplest approach is to export the matrix as a superelement (*EXPORT,,SUB) for use in any analysis.

    • Solve in APDL Math:

      • Identify the solver to be used with *LSENGINE.

      • Factor the matrix with *LSFACTOR.

      • Solve for the unknowns with LSSOLVE.

      • Once you do these steps, you can use *ITENGINE to use a PCG algorithm to find new solutions to a perturbed matrix (for instance, for parametric or sensitivity studies).

    • Export for use in an external application using *EXPORT with the Harwell-Boeing or Matrix Market formats.