4.8.3.58. GET_RFLEX_NSTRAIN

The GET_RFLEX_NSTRAIN subroutine returns the nodal strain. GET_RFLEX_ NSTRAIN is an auxiliary subroutine for MODAL_FORCE or MODAL_FORCE_EXT.

Table 4.161 Function Name

Language type

Subroutine

FORTRAN

call get_rflex_nstrain(ifbody, NodeSqeId, fTopBot, refmk, strain, errflg)

C/C++

get_rflex_nstrain(ifbody, NodeSeqId, fTopBot, refmk, strain, &errflg))

Table 4.162 Parameter information

Variable Name

Size

Description

ifbody

int

Sequential id of RFlex body defined in RecurDyn/Solver.

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.

fTopBot

int

If the RFI file has shell type element and all surface types (Top and Bottom) of the strain shapes, then this argument is referred.

1: Top, 2: Bottom

refmk

int

Reference marker ID.

strain

double[11]

1~6th data : Strain tensor (Exx,Eyy,Ezz,Exy,Eyz,Ezx)

7~9th data : Principal strain

10th data : Intensity strain

11th data : Von-mises strain

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.80 Fortran code for GET_RFLEX_NSTRAIN
 C---- SUB. MODAL_FORCE
       SUBROUTINE MODAL_FORCE
     &          (ID,TIME,UPAR,NPAR,IFBODY,POS,VEL,ACC,
     &           NMODE,NNODE,NMODALLOAD,MODALLOADS,
     &           JFLAG,IFLAG,RESULT)
       implicit none
 C---- TO EXPORT * SUBROUTINE
       !DEC$ ATTRIBUTES DLLEXPORT,C::MODAL_FORCE

 C---- INCLUDE SYSTEM CALL
       INCLUDE 'SYSCAL.F'

       INTEGER ID, NPAR, IFBODY
       DOUBLE PRECISION TIME, UPAR(*), POS(12), VEL(6), ACC(6)
       INTEGER NMODE, NNODE, NMODALLOAD
       DOUBLE PRECISION MODALLOADS(6+NMODE, NMODALLOAD)
       LOGICAL JFLAG, IFLAG
       DOUBLE PRECISION RESULT[REFERENCE](6+NMODE)

       common/Stress_Strain_result/ Stress144,Strain144,Stress144_3nref,
     &                              Strain144_3nref
       double precision Stress144(11),Strain144(11)
       double precision Stress144_3nref(11),Strain144_3nref(11)

 C----USER STATEMENT
       INTEGER ierr,i
       integer itemp,Node144SeqID, Node143SeqID, Node582SeqID
       double precision StressShape144(6),StrainShape144(6)

       call get_rflex_nodeseqid(ifbody,144,Node144SeqID,ierr)
       call get_rflex_nodeseqid(ifbody,143,Node143SeqID,ierr)
       call get_rflex_nodeseqid(ifbody,582,Node582SeqID,ierr)

       call get_rflex_nstress(ifbody,Node144SeqID,1,0,Stress144,ierr)
       call get_rflex_nstrain(ifbody,Node144SeqID,1,0,Strain144,ierr)
       call get_rflex_nstress_3nref(ifbody,Node144SeqID,1,Node144SeqID,
     &        Node143SeqID,Node582SeqID,Stress144_3nref,ierr)
       call get_rflex_nstrain_3nref(ifbody,Node144SeqID,1,Node144SeqID,
     &        Node143SeqID,Node582SeqID,Strain144_3nref,ierr)

       call get_rflex_stressshape(ifbody,7,Node144SeqID,1,StressShape144,ierr)
       call get_rflex_strainshape(ifbody,7,Node144SeqID,1,StrainShape144,ierr)

       do i=1, 6+nmode
         result(i)=0.0d0
       enddo

       RETURN
       END

 SUBROUTINE REQUEST_USUB(time,upar,npar,iflag,result)
 C---- TO EXPORT * SUBROUTINE
       !DEC$ ATTRIBUTES DLLEXPORT,C::REQUEST_USUB

 C---- INCLUDE SYSTEM CALL
       INCLUDE 'SYSCAL.F'
       double precision time,upar(*)
       integer npar,iflag
       double precision result(8)

       common/Stress_Strain_result/ Stress144,Strain144,Stress144_3nref,
     &                              Strain144_3nref
       double precision Stress144(11),Strain144(11)
       double precision Stress144_3nref(11),Strain144_3nref(11)

       result(2) = Stress144(1)
       result(3) = Strain144(1)
       result(4) = Stress144_3nref(1)
       result(6) = Strain144_3nref(1)

       RETURN
       END
Listing 4.81 C/C++ code for GET_RFLEX_NSTRAIN
 #include "stdafx.h"
 #include "DllFunc.h"
 #include "math.h"
 using namespace rd_syscall;

 // Global variables for saving Stress and Strain data
 double Stress144[11];
 double Strain144[11];
 double Stress144_3nref[11];
 double Strain144_3nref[11];

 ModalForce_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)
 {
 // User Statement
 int ierr;
 int itemp,Node144SeqID, Node143SeqID, Node582SeqID;
 double StressShape144[6],StrainShape144[6];

 // Saved Node Seq. ID
 get_rflex_nodeseqid(ifbody,144,&Node144SeqID,&ierr);
 get_rflex_nodeseqid(ifbody,143,&Node143SeqID,&ierr);
 get_rflex_nodeseqid(ifbody,582,&Node582SeqID,&ierr);

 // Saved Node stress/strain
 // Assumption : All following used nodes (Node ID:144,143,582)
 //                must be defined a Output node set in RFlex body edit mode.
 get_rflex_nstress(ifbody,Node144SeqID,1,0,Stress144,&ierr);
 errmes(ierr,"MForce",id,"hyc_usub_test");
 get_rflex_nstrain(ifbody,Node144SeqID,1,0,Strain144,&ierr);
 errmes(ierr,"MForce",id,"hyc_usub_test");
 get_rflex_nstress_3nref(ifbody,Node144SeqID,1,Node144SeqID,Node143SeqID,Node582SeqID,
 Stress144_3nref,&ierr);
 errmes(ierr,"MForce",id,"hyc_usub_test");
 get_rflex_nstrain_3nref(ifbody,Node144SeqID,1,Node144SeqID,Node143SeqID,Node582SeqID,
 Strain144_3nref,&ierr);
 errmes(ierr,"MForce",id,"hyc_usub_test");

 // Get stress shape
 // Check 1st mode/stress shape data
 get_rflex_stressshape(ifbody,7,Node144SeqID,1,StressShape144,&ierr);

 // Get strain shape
 // Check 1st mode/strain shape data
 get_rflex_strainshape(ifbody,7,Node144SeqID,1,StrainShape144,&ierr);

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

 // Adding plot USUB/Request
 ModalForce_API void __cdecl request_usub(double time, double upar[], int npar, int iflag, double result[8])
 {
   result[1]=Stress144[0];
   result[2]=Strain144[0];
   result[3]=Stress144_3nref[0];
   result[5]=Strain144_3nref[0];
 }