FORTRAN example 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