4.8.3.42. GET_RFLEX_NODEPOS

GET_RFLEX_NODEPOS subroutine returns a position vector and an orientation matrix for a node of RFlex body. This is an auxiliary subroutine for Modal_Force_Ext.

Table 4.129 Function Name

Language type

Subroutine

FORTRAN

call get_rflex_nodepos(ifbody, NodeSeq, MKID, nMK, POS, ErrFlg)

C/C++

get_rflex_nodepos (ifbody, NodeSeq, MKID, nMK, POS, &ErrFlg)

Table 4.130 Parameter information

Variable Name

Size

Description

ifbody

int

Sequential id of RFlex body defined in RecurDyn/Solver. This is a related argument with the 5th argument of Modal_Force_Ext subroutine.

MKID

int[2]

An array of integer type. Each value should be zero or a marker id. 1st value is defined as base marker. 2nd value is defined as reference marker.

nMK

int

An integer variable for considering base and reference marker. If nMK is 0, then the subroutine returns a global position vector and an orientation matrix of NodeSeq. If nMK is 1, then the subroutine calculates a position vector considering base marker. If nMK is 2, then the subroutine calculates a position vector considering base and reference marker.

Pos

double[12]

An array of double precision type. The array size must be 12. First 3 values mean a position vector. The last 9 values mean an orientation matrix.

Errflg

int

Error flag.
If the result of this argument is -1 (means TRUE in Fortran logical value), there is no error.
The others mean that there is an error.
Listing 4.69 C/C++ code for GET_RFLEX_NODEPOS
 #include "stdafx.h"
 #include "DllFunc.h"
 #include <stdio.h>
 FILE* NodePOSwrite;

 RecurDyn_UserSubRoutineWizard8_API void __cdecl modal_force_ext
 (int id, double time, double upar[], int npar, int ifbody, int nodarr[], int nonde, int jflag, int iflag, double result[])
 {
   using namespace rd_syscall;
   // Parameter Information
   //   id     : Modal force sequential identification. (Input)
   //   time   : Simulation time of RD/Solver. (Input)
   //   upar   : Parameters defined by user. (Input)
   //   npar   : Number of user parameters. (Input)
   //   ifbody : RFLEX Body sequential ID. (Input)
   //   nodarr : Node ID array of input node set. (Input)
   //   nonde  : Number of node of node set. (Input)
   //   jflag  : When RD/Solver evaluates a Jacobian, the flag is true. (Input)
   //   iflag  : When RD/Solver initializes arrays, the flag is true. (Input)
   //   result : Returned nodal force vector. Acting point of the nodal force is each center of each node.
   //            Reference frame of each force vector must be Ground.InertiaMarker. (Output, Size: nonde * 6)

   // User Statement
   int errflg =0 , ifinish = 0;
   int nodeseq = 0;
   double pos[12],tpos[3],rpos[9];

   if (iflag)
   {
       for(int k = 0 ; k <nonde ; k++)
       {
         NodePOSwrite=fopen("RFlexNodePos_C.txt","w");
         fprintf(NodePOSwrite,"RFlex Node%d Position \n",nodarr[k]);

         for (int i = 0; i<12 ;i++) { pos[i]=0.0; }
         for (int i = 0; i<9 ;i++) { rpos[i]=0.0; }
         for (int i = 0; i<2 ;i++) { tpos[i]=0.0; }

         get_rflex_nodeseqid(ifbody,nodarr[k],&nodeseq,&errflg);
         get_rflex_nodepos(ifbody,nodeseq,NULL,0,pos,&errflg);
         get_rflex_nodetpos(ifbody,nodeseq,NULL,0,tpos,&errflg);
         get_rflex_noderpos(ifbody,nodeseq,0,rpos,&errflg);

         fprintf(NodePOSwrite,"USING GET_RFLEX_NODEPOS \n");
         fprintf(NodePOSwrite,"INITIAL NODE POSITION \n");
         fprintf(NodePOSwrite,"X = %20.10e\n",pos[0]);
         fprintf(NodePOSwrite,"Y = %20.10e\n",pos[1]);
         fprintf(NodePOSwrite,"Z = %20.10e\n\n",pos[2]);
         fprintf(NodePOSwrite,"Orientation Matrix \n");
         fprintf(NodePOSwrite,"%20.10e  %20.10e  %20.10e\n",pos[3],pos[6],pos[9]);
         fprintf(NodePOSwrite,"%20.10e  %20.10e  %20.10e\n",pos[4],pos[7],pos[10]);
         fprintf(NodePOSwrite,"%20.10e  %20.10e  %20.10e\n\n",pos[5],pos[8],pos[11]);


         fprintf(NodePOSwrite,"USING GET_RFLEX_NODETPOS \n");
         fprintf(NodePOSwrite,"INITIAL NODE POSITION \n");
         fprintf(NodePOSwrite,"X = %20.10e\n",tpos[0]);
         fprintf(NodePOSwrite,"Y = %20.10e\n",tpos[1]);
         fprintf(NodePOSwrite,"Z = %20.10e\n\n",tpos[2]);

         fprintf(NodePOSwrite,"USING GET_RFLEX_NODERPOS \n");
         fprintf(NodePOSwrite,"Orientation Matrix \n");
         fprintf(NodePOSwrite,"%20.10e  %20.10e  %20.10e\n",rpos[0],rpos[3],rpos[6]);
         fprintf(NodePOSwrite,"%20.10e  %20.10e  %20.10e\n",rpos[1],rpos[4],rpos[7]);
         fprintf(NodePOSwrite,"%20.10e  %20.10e  %20.10e\n\n",rpos[2],rpos[5],rpos[8]);

       }
   }
   for(int i=0;i<6*nonde;i++)
   {
       result[i] = 0.0;
   }
 }