4.8.3.56. GET_RFLEX_STRAINSHAPE

The GET_RFLEX_STRAINSHAPE subroutine returns the strain shapes. GET_RFLEX_ STRAINSHAPE is an auxiliary subroutine for MODAL_FORCE or MODAL_FORCE_EXT.

Table 4.157 Function Name

Language type

Subroutine

FORTRAN

call get_rflex_strainshape(ifbody, ModeId, NodeSqeId, fTopBot, PhiE, errflg)

C/C++

get_rflex_strainshape(ifbody, ModeId, NodeSeqId, fTopBot, PhiE, &errflg))

Table 4.158 Parameter information

Variable Name

Size

Description

ifbody

int

Sequential id of RFlex body defined in RecurDyn/Solver.

ModeId

int

Number of selected modes.

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 reffered.

1: Top, 2: Bottom

PhiE

double[6]

A strain tensor (Exx,Eyy,Ezz,Exy,Eyz,Ezx)

Errflg

int

Error flag.

If the result of this argument is -1 (means TRUE in Fortran logical value), there’s no error. The others means there’s an error.

Listing 4.78 Fortran code for GET_RFLEX_STRAINSHAPE
 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
       double precision Stress144(11),Strain144(11)

 C----USER STATEMENT
       INTEGER ierr,i
       integer itemp,Node144SeqID
       integer, pointer::ModeIds(:)
       double precision, pointer::MCoord(:)
       double precision, pointer::StressShape144(:)
       double precision, pointer::StrainShape144(:)
       double precision ShapeData(6)

 c     Allocate memory
       allocate(ModeIds(1:nmode))
       allocate(StressShape144(1:nmode*6))
       allocate(StrainShape144(1:nmode*6))
       allocate(MCoord(1:nmode))

 c     Get Node Seq. Id
       call get_rflex_nodeseqid(ifbody,144,Node144SeqID,ierr)

 c     Get Stress/Strain shape data and Modal coordinate data
       call get_rflex_modeid(ifbody,ModeIds,ierr)
       call get_rflex_mcoor(ifbody,MCoord,ierr)
       do i=1, nmode
        call get_rflex_stressshape(ifbody,ModeIds(i),Node144SeqID,1,
       &                              ShapeData,ierr)
         StressShape144((i-1)*6+1)=ShapeData(1)
         StressShape144((i-1)*6+2)=ShapeData(2)
         StressShape144((i-1)*6+3)=ShapeData(3)
         StressShape144((i-1)*6+4)=ShapeData(4)
         StressShape144((i-1)*6+5)=ShapeData(5)
         StressShape144((i-1)*6+6)=ShapeData(6)
         call get_rflex_strainshape(ifbody,ModeIds(i),Node144SeqID,1,
       &                              ShapeData,ierr)
         StrainShape144((i-1)*6+1)=ShapeData(1)
         StrainShape144((i-1)*6+2)=ShapeData(2)
         StrainShape144((i-1)*6+3)=ShapeData(3)
         StrainShape144((i-1)*6+4)=ShapeData(4)
         StrainShape144((i-1)*6+5)=ShapeData(5)
         StrainShape144((i-1)*6+6)=ShapeData(6)
       enddo

 c     Initialization
       do i=1, 6
         Stress144(i)=0.0d0
         Strain144(i)=0.0d0
       enddo

 c     Computing Stress/Strain
       do i=1, nmode
         Stress144(1)=Stress144(1)+StressShape144((i-1)*6+1)*MCoord(i)
         Stress144(2)=Stress144(2)+StressShape144((i-1)*6+2)*MCoord(i)
         Stress144(3)=Stress144(3)+StressShape144((i-1)*6+3)*MCoord(i)
         Stress144(4)=Stress144(4)+StressShape144((i-1)*6+4)*MCoord(i)
         Stress144(5)=Stress144(5)+StressShape144((i-1)*6+5)*MCoord(i)
         Stress144(6)=Stress144(6)+StressShape144((i-1)*6+6)*MCoord(i)
         Strain144(1)=Strain144(1)+StrainShape144((i-1)*6+1)*MCoord(i)
         Strain144(2)=Strain144(2)+StrainShape144((i-1)*6+2)*MCoord(i)
         Strain144(3)=Strain144(3)+StrainShape144((i-1)*6+3)*MCoord(i)
         Strain144(4)=Strain144(4)+StrainShape144((i-1)*6+4)*MCoord(i)
         Strain144(5)=Strain144(5)+StrainShape144((i-1)*6+5)*MCoord(i)
         Strain144(6)=Strain144(6)+StrainShape144((i-1)*6+6)*MCoord(i)
       enddo

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

       deallocate(ModeIds)
       deallocate(MCoord)
       deallocate(StressShape144)
       deallocate(StrainShape144)

       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
       double precision Stress144(11),Strain144(11)

       result(2) = Stress144(1)
       result(3) = Strain144(1)

       RETURN
       END
Listing 4.79 C/C++ code for GET_RFLEX_STRAINSHAPE
 #include "stdafx.h"
 #include "DllFunc.h"
 #include "math.h"

 using namespace rd_syscall;

 double Stress144[11];
 double Strain144[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 i;
     int ierr;
     int itemp,Node144SeqID;
     int *ModeIds=NULL;
     double *StressShape144=NULL;
     double *StrainShape144=NULL;
     double *MCoord=NULL;

     // Allocate memory
     ModeIds=new int[nmode];
     StressShape144=new double[nmode*6];
     StrainShape144=new double[nmode*6];
     MCoord=new double[nmode];

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

     // Get Stress/Strain shape data and Modal coordinate data
     get_rflex_modeid(ifbody,ModeIds,&ierr);
     get_rflex_mcoor(ifbody,MCoord,&ierr);
     for(i=0;i<nmode;i++)
     {
         // Stress shape
         get_rflex_stressshape(ifbody,ModeIds[i],Node144SeqID,1,&StressShape144[i*6],&ierr);
         // Strain shape
         get_rflex_strainshape(ifbody,ModeIds[i],Node144SeqID,1,&StrainShape144[i*6],&ierr);
     }

     // Initialization
     for(i=0;i<6;i++)
     {
         Stress144[i]=0.0;
         Strain144[i]=0.0;
     }

     // Computing Stress/Strain
     for(i=0;i<nmode;i++)
     {
         Stress144[0]+= StressShape144[i*6+0]*MCoord[i];
         Stress144[1]+= StressShape144[i*6+1]*MCoord[i];
         Stress144[2]+= StressShape144[i*6+2]*MCoord[i];
         Stress144[3]+= StressShape144[i*6+3]*MCoord[i];
         Stress144[4]+= StressShape144[i*6+4]*MCoord[i];
         Stress144[5]+= StressShape144[i*6+5]*MCoord[i];
         Strain144[0]+= StrainShape144[i*6+0]*MCoord[i];
         Strain144[1]+= StrainShape144[i*6+1]*MCoord[i];
         Strain144[2]+= StrainShape144[i*6+2]*MCoord[i];
         Strain144[3]+= StrainShape144[i*6+3]*MCoord[i];
         Strain144[4]+= StrainShape144[i*6+4]*MCoord[i];
         Strain144[5]+= StrainShape144[i*6+5]*MCoord[i];
     }

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

     delete [] ModeIds;
     delete [] StressShape144;
     delete [] StrainShape144;
     delete [] MCoord;
 }

 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];
 }