4.8.3.38. GET_RFLEX_MODEID

The Get_rflex_modeid subroutine returns selected Mode Sequential IDs to RFlex body. This is an auxiliary subroutine for MODAL_FORCE.

Table 4.121 Function Name

Language type

Subroutine

FORTRAN

call get_rflex_modeid(ifbody, ModeIDs , errflg)

C/C++

get_rflex_modeid(ifbody, ModeIDs , &errflg)

Table 4.122 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.

ModeIDs

int*

An array of integer type. This array size must be the number of selected mode (=”nmode”) in the property page of RFlex body. This is a related argument with the 9th argument of the MODAL_FORCE subroutine.

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.65 C/C++ code for GET_RFLEX_MODEID
 #include "stdafx.h"
 #include "DllFunc.h"
 #include <stdio.h>

 Get_rflex_modeid_API void __cdecl modal_force
   (int id, double time, double upar[], int npar, int ifbody, double pos[12],
   double vel[6], double acc[6], int nmode, int nnode, int nModalLoad, double *ModalLoads,
   int jflag, int iflag, double *result)
 {

   using namespace rd_syscall;
   // Parameter Information
   //     id: MFORCE ID (Input)
   //   time: Simulation time of RD/Solver (Input)
   //   upar: Parameters defined by user (Input)
   //   npar: Number of user parameters (Input)
   //   ifbody : RFLEX body seq ID (Input)
   //   pos : Position(1~3) and Orientation matrix (4~12) w.r.t Ground.InertiaMarker (Input)
   //   vel : Velocity vector w.r.t. Ground.InertiaMarker (Input)
   //   acc : Acceleration vector w.r.t Ground.InertiaMarker (Input)
   //   nmode : No of selected mode (Input)
   //   nnode : No of node (Input)
   //   nModalLoad : No of selected modal load cases (Input)
   //   ModalLoads : Modal-force vector (Input, size : [(6+nmode) x nModalLoad] )
   //   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 modal force vector (Output, Size : [6+nmode] )

   int i,j,ierr;
   double eigen;
   double frq;
   int *SelectedModeIds;

   FILE* ForDebug;

   if(iflag)
   {

     ForDebug=fopen("CprogramDebug.txt","w");
     fprintf(ForDebug,"*** C program \n");

     // RFLEX Information
     fprintf(ForDebug,"*** RFLEX Information\n");
     fprintf(ForDebug,"    RFLEX body seq. Id = %d\n",ifbody);
     fprintf(ForDebug,"    No. selected mode = %d\n",nmode);
     fprintf(ForDebug,"    No. Modal Load Case = %d\n",nModalLoad);
     fprintf(ForDebug,"    No. Node(Grid) = %d\n",nnode);
     fprintf(ForDebug,"    No. User Parameter (USUB) = %d\n",npar);
     fprintf(ForDebug,"\n\n");

 // selected mode information
     SelectedModeIds = new int[nmode];
 fprintf(ForDebug,"*** Selected mode ids\n   ");
     get_rflex_modeid(ifbody,SelectedModeIds,&ierr);

     for(i=0;i<nmode;i++)
     {
       fprintf(ForDebug," %d ",SelectedModeIds[i]);
     }
     fprintf(ForDebug,"\n\n");

     // Eigenvalues & Frequency
     fprintf(ForDebug,"*** Eigenvalues and Frequency\n");
     for(i=0;i<nmode;i++)
     {
       get_rflex_frq(ifbody,SelectedModeIds[i],&frq,&eigen,&ierr);
       fprintf(ForDebug,"    Mode ID : %d, Eigenvalue : %20.10e,
 frequency : %20.10e\n",SelectedModeIds[i],eigen,frq);
     }
     fprintf(ForDebug,"\n\n");

     fclose(ForDebug);
   }

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