4.8.3.41. GET_RFLEX_NODEIPOS
The Get_rflex_nodeipos subroutine returns the initial position data of a selected node with respect to the reference frame of RFlex body. This is an auxiliary subroutine for MODAL_FORCE.
Language type |
Subroutine |
FORTRAN |
call get_rflex_nodeipos (ifbody, NodeSeqId, pos, errflg) |
C/C++ |
get_rflex_nodeipos (ifbody, NodeSeqId, pos, &errflg) |
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. |
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. |
Pos |
double[3] |
An array of double precision type. The array size is 3. This argument is the initial position output of a selected node with respect to the reference frame of RFlex body. |
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.
|
#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;
}
}