$ MSC v 70.5 Stiffness Matrix Equilibrium Check DMAP for SOL 103

$ This DMAP will perform a stiffness matrix equilibrium check on the
$ G, N, F and A-set free-free stiffness matrices in RF 103. The check
$ is made by multiplying the stiffness matrix by a set of 6 rigid body
$ displacement vectors which should produce 6 force vectors of zero
$ magnitude for all DOF's. Presence of nonzero forces of large magnitude
$ indicates a problem with the stiffness matrix due to, for example, 
$ grounding of some DOF's.

$ If the G, N, F and A-sets are all unique, then output for all sets is
$ obtained. However, the following applies:

$ 1) If there are no MPC's or rigid elements then the G and N-sets are 
$    identical and no output is generated for the N-set.

$ 2) If there are no SPC's then the N and F-sets are identical and no
$    output is generated for the F-set.

$ 3) If there are no omitted DOF's than the F and A-sets are identical
$    and no output is generated for the A-set.

$ There are 3 forms of force output from this DMAP (all of which should
$ be zero if the stiffness matrix is perfectly clean):

$ (1) All Forces: Output of forces on all DOF's exceeding a user 
$     specified filter (FILTERA) for all 6 rigid body displacement  
$     vectors. This Nx6 matrix is printed out (where N = no. of DOF's).

$ (2) Normalized Forces: Above output normalized by dividing the forces 
$     for a DOF by the diagonal stiffness for that DOF. This avoids 
$     scaling problems in interpreting All Forces. Output of forces on  
$     all DOF's exceeding a user specified filter (FILTERN) for all 6 
$     rigid body displacement vectors is produced. This Nx6 matrix is  
$     printed out depending on a parameter described below.

$ (3) Forces Summed: The resultants of the individual DOF forces is 
$     produced by premutliplying the All Force matrix by the transpose of 
$     the rigid body displacement matrix. This 6x6 matrix is printed out  
$     depending on a parameter described below. 

$ The order that the above is printed out is: (3), (1), (2) for each of
$ the displacement sets

$ Parameters used (default values in parentheses can be overriden on Bulk
$ Data PARAM cards) are:

$  FILTERA: Filter for printing All Forces,          default=1.0E-2
$  FILTERN: Filter for printing Norm'd Forces,       default=1.0E-5
$  NORMG  : Print G-set Norm'd Forces if > 0,        default=0 (no print)
$  NORMN  : Print N-set Norm'd Forces if > 0,        default=0 (no print)
$  NORMF  : Print F-set Norm'd Forces if > 0,        default=0 (no print)
$  NORMA  : Print A-set Norm'd Forces if > 0,        default=0 (no print)
$  SUMG   : Print G-set Forces Summed if > 0,        default=1 (print)
$  SUMN   : Print N-set Forces Summed if > 0,        default=1 (print)
$  SUMF   : Print F-set Forces Summed if > 0,        default=1 (print)
$  SUMA   : Print A-set Forces Summed if > 0,        default=1 (print)
$  EQUILPT: Grid Pt about which R.B. vectors calc'd, default=0 (basic origin)

$ DMAP PROGRAMMER'S NOTE: IF DEFAULTS FOR FILTERA AND/OR FILTERN ARE TO
$ BE CHANGED, THEY MUST BE CHANGED IN 2 PLACES IN THIS DMAP; IN SUBDMAP
$ SEKR AND IN SUBDMAP SEKMR

$ There are several places in this DMAP where 2 uses of the module
$ DIAGONAL are made where 1 use should have sufficed. This is due to
$ an error in the MSC DIAGONAL module that has been reported.

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
COMPILE SUBDMAP=SEKR,SOUIN=MSCSOU,NOREF,NOLIST

ALTER 2

  TYPE DB,BGPDTS,CSTMS                                   $
  TYPE PARM,,RS,Y,FILTERA,FILTERN                        $ 
  FILTERA=1.0E-2                                         $
  FILTERN=1.0E-5                                         $

ALTER 12

$ Perform G-set equilibrium check

  VECPLOT, ,BGPDTS,EQEXINS,CSTMS,,,,/
           RBGL/V,Y,EQUILPT=0//4                         $ CREATE RBGL
  TRNSP    RBGL/RBGLT                                    $ 
                                                          
  MPYAD    KGG,RBGLT,/KPHIG                              $ ALL FORCES

  PARAM    //'NOP'/V,Y,SUMG=1                            $ FORCES SUMMED
  IF (SUMG = 1) THEN                                     $
    MPYAD    RBGL,KPHIG,/KPHG6                           $ 
    MESSAGE  //'KPHG6 is G-set Forces Summed'/           $
    MATPRN   KPHG6//                                     $
  ENDIF 

  MESSAGE  //'KPHIG is All Forces for the G-set'/        $ PRINT G-set
  MATGPR   GPLS,USET,SILS,KPHIG//'G'///V,Y,FILTERA       $ ALL FORCES 
                                                         
  PARAM    //'NOP'/V,Y,NORMG=0                           $ FORCES NORM'D
  IF (NORMG = 1) THEN                                    $ 
    DIAGONAL KGG/KGGD/'SQUARE'/1.0                       $ NEED FOR MSC
    DIAGONAL KGGD/KGGDM1/'SQUARE'/-1.0                   $ DIAGONAL ERR. 
    MPYAD    KGGDM1,KPHIG,/KPHIGN/                       $ 
    MESSAGE  //'KPHIGN is G-set Normalized Forces'/    $ 
    MATGPR   GPLS,USET,SILS,KPHIGN//'G'///V,Y,FILTERN    $  
  ENDIF
                                                         
$ Perform N-set equilibrium check if there are any M-set DOF's

  IF (NOMSET > 0) THEN                                   $
 
    VEC      USET/VGN/'G'/'N'/'COMP'                     $ 
    PARTN    RBGL,VGN,/RBNN,,,/1                         $
    TRNSP    RBNN/RBNNT                                  $
                                                         
    MPYAD    KNN,RBNNT,/KPHIN/                           $ ALL FORCES

    PARAM    //'NOP'/V,Y,SUMN=1                          $ FORCES SUMMED
    IF (SUMN = 1) THEN                                   $
      MPYAD    RBNN,KPHIN,/KPHN6                         $ 
      MESSAGE  //'KPHN6 is N-set Forces Summed'/         $
      MATPRN   KPHN6//                                   $
    ENDIF 

    MESSAGE  //'KPHIN is All Forces for the N-set'/      $ PRINT N-set
    MATGPR   GPLS,USET,SILS,KPHIN//'N'///V,Y,FILTERA     $ ALL FORCES 
                                                         
    PARAM    //'NOP'/V,Y,NORMN=0                         $ FORCES NORM'D
    IF (NORMN = 1) THEN                                  $ 
      DIAGONAL KNN/KNND/'SQUARE'/1.0                     $ NEED FOR MSC
      DIAGONAL KNND/KNNDM1/'SQUARE'/-1.0                 $ DIAGONAL ERR. 
      MPYAD    KNNDM1,KPHIN,/KPHINN/                     $ 
      MESSAGE  //'KPHINN is N-set Normalized Forces'/    $ 
      MATGPR   GPLS,USET,SILS,KPHINN//'N'///V,Y,FILTERN  $ 
    ENDIF                                                $
                                                         
  ELSE                                                   $

    MESSAGE  //'************************************'/   $
    MESSAGE  //'N-set CHECK NOT DONE (SAME AS G-set)'/   $
    MESSAGE  //'************************************'/   $

  ENDIF                                                  $

ALTER 15

$ Perform F-set equilibrium check if there are any S-set DOF's

  IF (NOSSET > 0) THEN                                   $
 
    VEC      USET/VGF/'G'/'F'/'COMP'                     $ 
    PARTN    RBGL,VGF,/RBFF,,,/1                         $
    TRNSP    RBFF/RBFFT                                  $
                                                         
    MPYAD    KFF,RBFFT,/KPHIF/                           $ ALL FORCES

    PARAM    //'NOP'/V,Y,SUMF=1                          $ FORCES SUMMED
    IF (SUMF = 1) THEN                                   $
      MPYAD    RBFF,KPHIF,/KPHF6                         $ 
      MESSAGE  //'KPHF6 is F-set Forces Summed'/         $
      MATPRN   KPHF6//                                   $
    ENDIF 

    MESSAGE  //'KPHIF is All Forces for the F-set'/      $ PRINT F-set
    MATGPR   GPLS,USET,SILS,KPHIF//'F'///V,Y,FILTERA     $ ALL FORCES 
                                                         
    PARAM    //'NOP'/V,Y,NORMF=0                         $ FORCES NORM'D
    IF (NORMF = 1) THEN                                  $ 
      DIAGONAL KFF/KFFD/'SQUARE'/1.0                     $ NEED FOR MSC
      DIAGONAL KFFD/KFFDM1/'SQUARE'/-1.0                 $ DIAGONAL ERR. 
      MPYAD    KFFDM1,KPHIF,/KPHIFN/                     $ 
      MESSAGE  //'KPHIFN is F-set Normalized Forces'/    $ 
      MATGPR   GPLS,USET,SILS,KPHIFN//'F'///V,Y,FILTERN  $ 
    ENDIF                                                $
                                                         
  ELSE                                                   $

    MESSAGE  //'************************************'/   $
    MESSAGE  //'F-set CHECK NOT DONE (SAME AS N-set)'/   $
    MESSAGE  //'************************************'/   $

  ENDIF                                                  $
  
ALTER 92

  CALL    DBSTORE RBGL,,,,//1/1/'     '/0/               $ STORE RBGL

ENDALTER

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$ Perform A-set check, depending on parameters

COMPILE SUBDMAP=SEKMR,SOUIN=MSCSOU,NOREF,NOLIST

ALTER 2

  TYPE PARM,,RS,Y,FILTERA,FILTERN                         $ 
  FILTERA=1.0E-2                                          $
  FILTERN=1.0E-5
                                          $
ALTER 46

  CALL     DBFETCH /RBGL,,,,/1/1/0/0/0                   $ FETCH RBGL 

$ Perform A-set equilibrium check if there are any O-set DOF's

  IF (NOOSET > 0) THEN                                   $
 
    VEC      USET/VGA/'G'/'A'/'COMP'                     $ 
    PARTN    RBGL,VGA,/RBAA,,,/1                         $
    TRNSP    RBAA/RBAAT                                  $ 
                                                         
    MPYAD    KAA,RBAAT,/KPHIA/                           $ ALL FORCES

    PARAM    //'NOP'/V,Y,SUMA=1                          $ FORCES SUMMED
    IF (SUMA = 1) THEN                                   $
      MPYAD    RBAA,KPHIA,/KPHA6                         $ 
      MESSAGE  //'KPHA6 is A-set Forces Summed'/         $
      MATPRN   KPHA6//                                   $
    ENDIF 

    MESSAGE  //'KPHIA is All Forces for the A-set'/      $ PRINT A-set
    MATGPR   GPLS,USET,SILS,KPHIA//'A'///V,Y,FILTERA     $ ALL FORCES 
                                                         
    PARAM    //'NOP'/V,Y,NORMA=0                         $ FORCES NORM'D
    IF (NORMA = 1) THEN                                  $ 
      DIAGONAL KAA/KAAD/'SQUARE'/1.0                     $ NEED FOR MSC
      DIAGONAL KAAD/KAADM1/'SQUARE'/-1.0                 $ DIAGONAL ERR. 
      MPYAD    KAADM1,KPHIA,/KPHIAN/                     $ 
      MESSAGE  //'KPHIAN is A-set Normalized Forces'/    $    
      MATGPR   GPLS,USET,SILS,KPHIAN//'A'///V,Y,FILTERN  $ 
    ENDIF
                                                
  ELSE                                                   $

    MESSAGE  //'************************************'/   $
    MESSAGE  //'A-set CHECK NOT DONE (SAME AS F-set)'/   $
    MESSAGE  //'************************************'/   $

  ENDIF                                                  $

ENDALTER

$ End equilibrium check DMAP