4.8.3.40. GET_RFLEX_NODEACC

Get_Rflex_Nodeacc subroutine returns an acceleration vector for a node of RFlex body. This is an auxiliary subroutine for Modal_Force_Ext.

Table 4.125 Function Name

Language type

Subroutine

FORTRAN

call get_rflex_nodeacc(integer, integer, integer, integer, double precision, integer)

C/C++

get_rflex_nodeacc (int ifbody, int NodeSeq, int MKID[2], int nMK, int ACC[6], int *ErrFlg)

Table 4.126 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 subroutine.

NodeSeq

int

Node sequential id defined in RecurDyn/Solver. This is a related argument with the 6th 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.

Acc

double[6]

An array of double precision type. The array size must be 6. First 3 values mean a relative acceleration vector. The last 3 values mean a relative angular acceleration vector.

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.67 C/C++ code for GET_RFLEX_NODEACC
 #include "stdafx.h"
 #include "DllFunc.h"
 #include <stdio.h>
 FILE* NodeACCwrite;

 RecurDyn_UserSubRoutineWizard10_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 acc[6],tacc[3],racc[3];

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

         for (int i = 0; i<6 ;i++) { acc[i]=0.0; }
         for (int i = 0; i<3 ;i++) { tacc[i]=0.0; racc[i]=0.0; }

         get_rflex_nodeseqid(ifbody,nodarr[k],&nodeseq,&errflg);
         get_rflex_nodeacc(ifbody,nodeseq,NULL,0,acc,&errflg);
         get_rflex_nodetacc(ifbody,nodeseq,NULL,0,tacc,&errflg);
         get_rflex_noderacc(ifbody,nodeseq,NULL,0,racc,&errflg);

         fprintf(NodeACCwrite,"USING GET_RFLEX_NODEACC \n");
         fprintf(NodeACCwrite,"INITIAL TRANSLATIONAL ACCELERATION \n");
         fprintf(NodeACCwrite,"TAX = %20.10e\n",acc[0]);
         fprintf(NodeACCwrite,"TAY = %20.10e\n",acc[1]);
         fprintf(NodeACCwrite,"TAZ = %20.10e\n\n",acc[2]);
         fprintf(NodeACCwrite,"INITIAL ROTATIONAL ACCELERATION \n");
         fprintf(NodeACCwrite,"RAX = %20.10e\n",acc[3]);
         fprintf(NodeACCwrite,"RAY = %20.10e\n",acc[4]);
         fprintf(NodeACCwrite,"RAZ = %20.10e\n\n",acc[5]);

         fprintf(NodeACCwrite,"USING GET_RFLEX_NODETACC \n");
         fprintf(NodeACCwrite,"INITIAL TRANSLATIONAL ACCELERATION \n");
         fprintf(NodeACCwrite,"TAX = %20.10e\n",tacc[0]);
         fprintf(NodeACCwrite,"TAY = %20.10e\n",tacc[1]);
         fprintf(NodeACCwrite,"TAZ = %20.10e\n\n",tacc[2]);

         fprintf(NodeACCwrite,"USING GET_RFLEX_NODERACC \n");
         fprintf(NodeACCwrite,"INITIAL ROTATIONAL ACCELERATION \n");
         fprintf(NodeACCwrite,"RAX = %20.10e\n",racc[0]);
         fprintf(NodeACCwrite,"RAY = %20.10e\n",racc[1]);
         fprintf(NodeACCwrite,"RAZ = %20.10e\n\n",racc[2]);

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