4.8.3.24. GET_RFLEX_ACC

The GET_RFLEX_ACC subroutine returns RFlex Body acceleration. GET_RFLEX_ACC is an auxiliary subroutine for MODAL_FORCE_EXT.

Table 4.93 Function Name

Language type

Subroutine

FORTRAN

call get_rflex_acc(ifbody, acc, errflg)

C/C++

get_rflex_acc(ifbody, acc, &errflg))

Table 4.94 Parameter information

Variable Name

Size

Description

ifbody

int

Sequential id of RFlex body defined in RecurDyn/Solver.

acc

double[6]

An array of double precision type. The array size must be 6. First 3 values mean a translational acceleration vector, and remain values mean a rotational acceleration vector. This value is calculated with respect to global reference frame.

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.51 C/C++ code for GET_RFLEX_ACC
 #include "stdafx.h"
 #include "DllFunc.h"
 #include <stdio.h>
 FILE* ACCwrite;
 double pretime;
 UserSubRoutineWizard7_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;
   double acc[6];

   if (iflag)
   {
       VELwrite=fopen("RFlexBodyAcc_C.txt","w");
       fprintf(ACCwrite,"RFlex Body Acceleration \n");
   }

   if(!jflag && ACCwrite!= NULL && pretime !=time)
   {
       for (int i = 0; i<6 ;i++)
       {
         acc[i]=0.0;
       }
       get_rflex_acc(ifbody,pos,&errflg);
       fprintf(ACCwrite,"TIME = %20.10e \n",time);
       fprintf(ACCwrite,"Translational Acceleration \n");
       fprintf(ACCwrite,"TAX = %20.10e\n",acc[0]);
       fprintf(ACCwrite,"TAY = %20.10e\n",acc[1]);
       fprintf(ACCwrite,"TAZ = %20.10e\n",acc[2]);
       fprintf(ACCwrite,"Rotational Acceleration \n");
       fprintf(ACCwrite,"RAX = %20.10e\n",acc[3]);
       fprintf(ACCwrite,"RAY = %20.10e\n",acc[4]);
       fprintf(ACCwrite,"RAZ = %20.10e\n",acc[5]);
   }

   getfinishflag(&ifinish);
   if(ifinish)
   {
       fclose(ACCwrite);
   }

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

 }