#include "stdafx.h" #include "DllFunc.h" #include <stdio.h> FILE* NodeVELwrite;
RecurDynV8R3_UserSubRoutineWizard9_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 the ground inertia marker. (Output, Size: nonde * 6)
// User Statement int errflg =0 , ifinish = 0; int nodeseq = 0; double vel[6],tvel[3],rvel[3];
if (iflag) { for(int k = 0 ; k <nonde ; k++) { NodeVELwrite=fopen("RFlexNodeVEL_C.txt","w"); fprintf(NodeVELwrite,"RFlex Node%d Velocity \n",nodarr[k]);
for (int i = 0; i<6 ;i++) { vel[i]=0.0; } for (int i = 0; i<3 ;i++) { tvel[i]=0.0; rvel[i]=0.0; }
get_rflex_nodeseqid(ifbody,nodarr[k],&nodeseq,&errflg); get_rflex_nodevel(ifbody,nodeseq,NULL,0,vel,&errflg); get_rflex_nodetvel(ifbody,nodeseq,NULL,0,tvel,&errflg); get_rflex_nodervel(ifbody,nodeseq,NULL,0,rvel,&errflg);
fprintf(NodeVELwrite,"USING GET_RFLEX_NODEVEL \n"); fprintf(NodeVELwrite,"INITIAL TRANSLATIONAL VELOCITY \n"); fprintf(NodeVELwrite,"VX = %20.10e\n",vel[0]); fprintf(NodeVELwrite,"VY = %20.10e\n",vel[1]); fprintf(NodeVELwrite,"VZ = %20.10e\n\n",vel[2]); fprintf(NodeVELwrite,"INITIAL ROTATIONAL VELOCITY \n"); fprintf(NodeVELwrite,"WX = %20.10e\n",vel[3]); fprintf(NodeVELwrite,"WY = %20.10e\n",vel[4]); fprintf(NodeVELwrite,"WZ = %20.10e\n\n",vel[5]);
fprintf(NodeVELwrite,"USING GET_RFLEX_NODETVEL \n"); fprintf(NodeVELwrite,"INITIAL TRANSLATIONAL VELOCITY \n"); fprintf(NodeVELwrite,"VX = %20.10e\n",tvel[0]); fprintf(NodeVELwrite,"VY = %20.10e\n",tvel[1]); fprintf(NodeVELwrite,"VZ = %20.10e\n\n",tvel[2]);
fprintf(NodeVELwrite,"USING GET_RFLEX_NODERVEL \n"); fprintf(NodeVELwrite,"INITIAL ROTATIONAL VELOCITY \n"); fprintf(NodeVELwrite,"WX = %20.10e\n",rvel[0]); fprintf(NodeVELwrite,"WY = %20.10e\n",rvel[1]); fprintf(NodeVELwrite,"WZ = %20.10e\n\n",rvel[2]);
} } for(int i=0;i<6*nonde;i++) { result[i] = 0.0; } } |