4.8.3.52. GET_RFLEX_RMODESHAPE

The Get_rflex_rmodeshape subroutine returns the rotational mode shape of a selected mode and a selected node. This is an auxiliary subroutine for MODAL_FORCE.

Table 4.149 Function Name

Language type

Subroutine

FORTRAN

call get_rflex_rmodeshape (ifbody, ModeId, NodeSeqID, Phi_r , errflg)

C/C++

get_rflex_rmodeshape (ifbody, ModeId, NodeSeqID, Phi_r, &errflg)

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

ModeId

int

Mode sequential id. The mode sequential id can be checked in the property page of RFlex body.

NodeSeqID

int

Node sequential id defined in RecurDyn/Solver. A node id should be converted to the node sequential id using the Get_rflex_nodeseqid auxiliary function.

Phi_r

double[3]

An array of double precision type. The array size is 3. This argument is the rotational mode shape of a selected mode and a selected node.

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

 Get_rflex_nodeseqid_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;
   int nodeid;
   int nodeseqid;
   double nodeIpos[3];
   double tmodeshape[3];
   double rmodeshape[3];
   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];
     get_rflex_modeid(ifbody,SelectedModeIds,&ierr);

     for(i=0;i<npar;i++)
     {
       nodeid = int(upar[i]);
       fprintf(ForDebug,"*** RFLEX Node ID : %d \n",nodeid);

       // Transfer node seq id
       get_rflex_nodeseqid(ifbody,nodeid,&nodeseqid,&ierr);
       if(ierr != 0)
       {
         fprintf(ForDebug,"   This node Id %d doesn't exist in RFI file.\n",nodeid);
         break;
       }
       fprintf(ForDebug,"    Node Seq. Id : %d (only use in solver) \n",nodeseqid);

       // Node initial position
       fprintf(ForDebug,"    Initial position vector w.r.t RFLEX Body ref. frame \n");
       get_rflex_nodeipos(ifbody,nodeseqid,nodeIpos,&ierr);
       fprintf(ForDebug,"    %20.10e %20.10e %20.10e \n",nodeIpos[0],nodeIpos[1],nodeIpos[2]);


       // Mode Shape
       fprintf(ForDebug,"    mode shape (TX,TY,TZ,RX,RY,RZ) \n");
       for(j=0;j<nmode;j++)
       {
         get_rflex_tmodeshape(ifbody,SelectedModeIds[j],nodeseqid,tmodeshape,&ierr);
         get_rflex_rmodeshape(ifbody,SelectedModeIds[j],nodeseqid,rmodeshape,&ierr);
         fprintf(ForDebug,"    Mode id : %d, %20.10e %20.10e %20.10e %20.10e %20.10e %20.10e \n",
           SelectedModeIds[j],tmodeshape[0],tmodeshape[1],tmodeshape[2],rmodeshape[0],rmodeshape[1],rmodeshape[2]);
       }
     }

     fclose(ForDebug);
   }

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