4.8.3.34. GET_RFLEX_INVVARN5
The Get_rflex_invvarn5 subroutine returns the invariant variable N5 of a selected RFlex body. This is an auxiliary subroutine for MODAL_FORCE.
Language type |
Subroutine |
FORTRAN |
call get_rflex_invvarn5(ifbody, modeid, invvarn5, errflg) |
C/C++ |
get_rflex_invvarn5(ifbody, modeid, invvarn5, &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. |
modeid |
int |
Selected mode sequential id. The user can get the selected mode sequential id using the Get_rflex_modeid auxiliary function. |
invvarn5 |
double[3] |
An array of double precision type. The array size must be 3. This argument is the invariant variable N5 of a selected RFlex body.
Invariant variable N5 : :math:`{{zeta }_{n4}}=sumlimits_{p=1}^{nnode}{{{m}_{p}}{{{mathbf{{tilde{d}}’}}}_{p0}}mathbf{tilde{Phi }}_{Tp}^{j}}+sumlimits_{p=1}^{nnode}{{{{mathbf{{I}’}}}_{p}}mathbf{tilde{Phi }}_{Rp}^{j}},text{ }j=text{1,}nmode,text{ (3}times 1text{)}times nmode`
Where,
\(m_p\) is a lumped mass on the \(p\) node and \(\mathbf{\Phi }_{Tp}^{j}\) is a translational mode shape vector (3x1) of \(p\) node and \(j\) mode.
\(\mathbf{\Phi }_{Rp}^{j}\) is a rotational mode shape vector (3x1) of \(p\) node and \(j\) mode.
\(nmode\) is a number of selected modes.
|
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_invvarm_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,k,ierr;
double InvVarM1;
double InvVarM2[3];
double InvVarM3[9];
double *InvVarN1;
double *InvVarN2;
double *InvVarN3;
double *InvVarN4;
double *InvVarN5;
double *InvVarN6;
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");
// allocate memory
SelectedModeIds = new int[nmode];
InvVarN1 = new double[3*nmode];
InvVarN2 = new double[9*nmode];
InvVarN3 = new double[9*nmode];
InvVarN4 = new double[9*nmode*nmode];
InvVarN5 = new double[3*nmode];
InvVarN6 = new double[3*nmode*nmode];
// get Mode Ids (Selected modes)
get_rflex_modeid(ifbody,SelectedModeIds,&ierr);
// Call auxiliary functions (Get Invariant Variables)
get_rflex_invvarm1(ifbody,&InvVarM1,&ierr);
get_rflex_invvarm2(ifbody,InvVarM2,&ierr);
get_rflex_invvarm3(ifbody,InvVarM3,&ierr);
for(i=0;i<nmode;i++)
{
get_rflex_invvarn1(ifbody,SelectedModeIds[i],&(InvVarN1[3*i]),&ierr);
get_rflex_invvarn2(ifbody,SelectedModeIds[i],&(InvVarN2[9*i]),&ierr);
get_rflex_invvarn3(ifbody,SelectedModeIds[i],&(InvVarN3[9*i]),&ierr);
get_rflex_invvarn5(ifbody,SelectedModeIds[i],&(InvVarN5[3*i]),&ierr);
for(j=0;j<nmode;j++)
{
get_rflex_invvarn4(ifbody,SelectedModeIds[i],SelectedModeIds[j],&(InvVarN4[9*nmode*i+9*j]),&ierr);
get_rflex_invvarn6(ifbody,SelectedModeIds[i],SelectedModeIds[j],&(InvVarN6[3*nmode*i+3*j]),&ierr);
}
}
// Write Invariant variable M1
fprintf(ForDebug,"*** Invariant Variable M1\n");
fprintf(ForDebug," %20.10e \n", InvVarM1);
fprintf(ForDebug,"\n\n");
// Write Invariant variable M2
fprintf(ForDebug,"*** Invariant Variable M2\n");
fprintf(ForDebug," %20.10e %20.10e %20.10e \n", InvVarM2[0],InvVarM2[1],InvVarM2[2]);
fprintf(ForDebug,"\n\n");
// Write Invariant variable M3
fprintf(ForDebug,"*** Invariant Variable M3\n");
fprintf(ForDebug," %20.10e %20.10e %20.10e \n", InvVarM3[0],
InvVarM3[1],InvVarM3[2]);
fprintf(ForDebug," %20.10e %20.10e %20.10e \n", InvVarM3[3],
InvVarM3[4],InvVarM3[5]);
fprintf(ForDebug," %20.10e %20.10e %20.10e \n", InvVarM3[6],
InvVarM3[7],InvVarM3[8]);
fprintf(ForDebug,"\n\n");
// Write Invariant variable N1
fprintf(ForDebug,"*** Invariant Variable N1\n");
for(i=0;i<nmode;i++)
{
fprintf(ForDebug," Mode ID : %d (Selected mode)\n",SelectedModeIds[i]);
fprintf(ForDebug," %20.10e %20.10e %20.10e \n", InvVarN1[3*i+0],InvVarN1[3*i+1],InvVarN1[3*i+2]);
}
fprintf(ForDebug,"\n\n");
// Write Invariant variable N2
fprintf(ForDebug,"*** Invariant Variable N2\n");
for(i=0;i<nmode;i++)
{
fprintf(ForDebug," Mode ID : %d (Selected mode)\n",SelectedModeIds[i]);
fprintf(ForDebug," %20.10e %20.10e %20.10e \n", InvVarN2[9*i+0],InvVarN2[9*i+1],InvVarN2[9*i+2]);
fprintf(ForDebug," %20.10e %20.10e %20.10e \n", InvVarN2[9*i+3],InvVarN2[9*i+4],InvVarN2[9*i+5]);
fprintf(ForDebug," %20.10e %20.10e %20.10e \n", InvVarN2[9*i+6],InvVarN2[9*i+7],InvVarN2[9*i+8]);
}
fprintf(ForDebug,"\n\n");
// Write Invariant variable N3
fprintf(ForDebug,"*** Invariant Variable N3\n");
for(i=0;i<nmode;i++)
{
fprintf(ForDebug," Mode ID : %d (Selected mode)\n",SelectedModeIds[i]);
fprintf(ForDebug," %20.10e %20.10e %20.10e \n", InvVarN3[9*i+0],InvVarN3[9*i+1],InvVarN3[9*i+2]);
fprintf(ForDebug," %20.10e %20.10e %20.10e \n", InvVarN3[9*i+3],InvVarN3[9*i+4],InvVarN3[9*i+5]);
fprintf(ForDebug," %20.10e %20.10e %20.10e \n", InvVarN3[9*i+6],InvVarN3[9*i+7],InvVarN3[9*i+8]);
}
fprintf(ForDebug,"\n\n");
// Write Invariant variable N4
fprintf(ForDebug,"*** Invariant Variable N4\n");
for(i=0;i<nmode;i++)
{
for(j=0;j<nmode;j++)
{
fprintf(ForDebug," 1st Mode ID : %d / 2nd Mode ID : %d \n",SelectedModeIds[i],SelectedModeIds[j]);
fprintf(ForDebug," %20.10e %20.10e %20.10e \n",InvVarN4[9*nmode*i+9*j+0],InvVarN4[9*nmode*i+9*j+1],InvVarN4[9*nmode*i+9*j+2]);
fprintf(ForDebug," %20.10e %20.10e %20.10e \n",InvVarN4[9*nmode*i+9*j+3],InvVarN4[9*nmode*i+9*j+4],InvVarN4[9*nmode*i+9*j+5]);
fprintf(ForDebug," %20.10e %20.10e %20.10e \n",InvVarN4[9*nmode*i+9*j+6],InvVarN4[9*nmode*i+9*j+7],InvVarN4[9*nmode*i+9*j+8]);
}
}
fprintf(ForDebug,"\n\n");
// Write Invariant variable N5
fprintf(ForDebug,"*** Invariant Variable N5\n");
for(i=0;i<nmode;i++)
{
fprintf(ForDebug," Mode ID : %d \n",SelectedModeIds[i]);
fprintf(ForDebug," %20.10e %20.10e %20.10e \n", InvVarN5[3*i+0],InvVarN5[3*i+1],InvVarN5[3*i+2]);
}
fprintf(ForDebug,"\n\n");
// Write Invariant variable N6
fprintf(ForDebug,"*** Invariant Variable N6\n");
for(i=0;i<nmode;i++)
{
for(j=0;j<nmode;j++)
{
fprintf(ForDebug," 1st Mode ID : %d / 2nd Mode ID : %d \n",SelectedModeIds[i],SelectedModeIds[j]);
fprintf(ForDebug," %20.10e %20.10e %20.10e \n", InvVarN6[3*nmode*i+3*j],InvVarN6[3*nmode*i+3*j+1],
InvVarN6[3*nmode*i+3*j+2]);
}
}
fprintf(ForDebug,"\n\n");
// Deallocate memory
delete [] SelectedModeIds;
delete [] InvVarN1;
delete [] InvVarN2;
delete [] InvVarN3;
delete [] InvVarN4;
delete [] InvVarN5;
delete [] InvVarN6;
fclose(ForDebug);
}
for(i=0;i<6+nmode;i++)
{
result[i] = 0.0;
}
}