<commit_before>      MODULE BeamElement

      USE GlobalDataFun
      IMPLICIT NONE

      PRIVATE

      PUBLIC

      CONTAINS
      
      
      SUBROUTINE ElementMatrx(Nuu0,Nuuu,Nrr0,Nrrr,hhp,Stif,cet,&
                              w,node_elem,nelem,norder,dof_node,elk,elf)

      REAL(ReKi),INTENT(IN)::Nuu0(:),Nuuu(:),Nrr0(:),Nrrr(:)
      REAL(ReKi),INTENT(IN)::hhp(:,:),Stif(:,:),cet
      REAL(ReKi),INTENT(IN)::w(:)
      INTEGER,INTENT(IN)::node_elem,nelem,norder,dof_node

      REAL(ReKi),INTENT(OUT),ALLOCATABLE::elk(:,:),elf(:)      

      REAL(ReKi),ALLOCATABLE::Fc_elem(:,:),Fd_elem(:,:),Oe_elem(:,:,:)
      REAL(ReKi),ALLOCATABLE::Pe_elem(:,:,:),Qe_elem(:,:,:),Se_elem(:,:,:)
      REAL(ReKi)::E10(3),RR0(3,3),kapa(3),E1(3)
      REAL(ReKi)::Fc(6),Fd(6),Oe(6,6),Pe(6,6),Qe(6,6)

      INTEGER::i,j,k,m,n,temp_id1,temp_id2
      
!      CALL NodalRelRot(Nuu0,node_elem,nelem,norder,dof_node,Nrr0)
!      CALL NodalRelRot(Nuuu,node_elem,nelem,norder,dof_node,Nrrr)

      DO i=1,node_elem
          CALL NodalDataAt0(node_elem,nelem,norder,dof_node,i,hhp,Nuu0,E10)
          CALL NodalData(Nuuu,Nrrr,Nuu0,Nrr0,E10,hhp,&
                         &node_elem,nelem,norder,dof_node,E1,RR0,kapa,Stif)
          CALL ElasticForce(E1,RR0,kapa,Stif,cet,Fc,Fd,Oe,Pe,Qe)
          Fc_elem(i,1:6) = Fc(1:6)
          Fd_elem(i,1:6) = Fd(1:6)
          Oe_elem(i,1:6,1:6) = Oe(1:6,1:6)
          Pe_elem(i,1:6,1:6) = Pe(1:6,1:6)
          Qe_elem(i,1:6,1:6) = Qe(1:6,1:6)
          Se_elem(i,1:6,1:6) = Stif(1:6,1:6)
      ENDDO

      DO i=1,node_elem
          DO j=1,6
              temp_id1 = (i-1)*dof_node+j
              DO k=1,6
                  temp_id2 = (i-1)*dof_node+k
                  elk(temp_id1,temp_id2) = w(i)*Qe_elem(i,j,k)*Jac
              ENDDO
          ENDDO
      ENDDO

      DO i=1,node_elem
          DO j=1,node_elem
              DO k=1,6
                  temp_id1=(i-1)*dof_node+k
                  DO m=1,6
                      temp_id2=(i-1)*dof_node+m
                      elk(temp_id1,temp_id2)=elk(temp_id1,temp_id2)+w(i)*Pe_elem(i,k,m)*hhp(j,i)
                      elk(temp_id1,temp_id2)=elk(temp_id1,temp_id2)+w(j)*Oe_elem(j,k,m)*hhp(i,j)
                  ENDDO
              ENDDO
          ENDDO
      ENDDO

      DO i=1,node_elem
          DO j=1,node_elem
              DO k=1,6
                  temp_id1=(i-1)*dof_node+k
                  DO m=1,6
                      temp_id2=(j-1)*dof_node+m
                      DO n=1,node_elem
                          elk(temp_id1,temp_id2)=elk(temp_id1,temp_id2)+w(n)*hhp(i,n)*Se_elem(n,k,m)*hhp(j,n)/Jac
                      ENDDO
                  ENDDO
              ENDDO
          ENDDO
      ENDDO

      DO i=1,node_elem
          DO j=1,6
              temp_id1 = (i-1)*dof_node+j
              elf(temp_id1) = -w(i)*Fd_elem(i,j)*Jac
              DO m=1,node_elem
                  elf(temp_id1) = elf(temp_id1)-w(m)*hhp(i,m)*Fc_elem(m,j)
              ENDDO
          ENDDO
      ENDDO

      END SUBROUTINE ElementMatrix


     

      SUBROUTINE InertialForce(m00,mEta,rho,vvv,aaa,Fi,Mi,Gi,Ki)

      REAL(ReKi),INTENT(IN)::m00,mEta(:),rho(:,:)
      REAL(ReKi),INTENT(IN)::vvv(:),aaa(:)
      REAL(ReKi),INTENT(OUT)::Fi(6),Mi(6,6),Gi(6,6),Ki(6,6)

      REAL(ReKi)::beta(3),gama(3),nu(3),epsi(3,3),mu(3,3)
      REAL(ReKi)::ome(3),omd(3),tempV(3),tempA(3)

      ! Prepare
      ome(:) = vvv(4:6)
      omd(:) = aaa(4:6)
      tempV(:) = vvv(1:3)
      tempA(:) = aaa(1:3)

      beta = MATMUL(Tilde(ome),mEta)
      gama = MATMUL(rho,ome)
      nu = MATMUL(rho,omd)

      !Compute Fi
      Fi(1:3)= m00*tempA+MATMUL(Tilde(omd),mEta)+MATMUL(Tilde(ome),beta)
      Fi(4:6) = MATMUL(Tilde(mEta,tempA) + nu + MATMUL(Tilde(ome),gama) <commit_msg>added some comments as an example -- PLEASE ADD MORE<commit_after>MODULE BeamElement

      USE GlobalDataFun
      IMPLICIT NONE

      PRIVATE

      PUBLIC

      CONTAINS
      
      
      SUBROUTINE ElementMatrx(Nuu0,Nuuu,Nrr0,Nrrr,hhp,Stif,cet,&
                              w,node_elem,nelem,norder,dof_node,elk,elf)

      REAL(ReKi),INTENT(IN)::Nuu0(:),Nuuu(:),Nrr0(:),Nrrr(:)
      REAL(ReKi),INTENT(IN)::hhp(:,:),Stif(:,:),cet
      REAL(ReKi),INTENT(IN)::w(:)
      INTEGER,INTENT(IN)::node_elem,nelem,norder,dof_node

      REAL(ReKi),INTENT(OUT),ALLOCATABLE::elk(:,:),elf(:)      

      REAL(ReKi),ALLOCATABLE::Fc_elem(:,:),Fd_elem(:,:),Oe_elem(:,:,:)
      REAL(ReKi),ALLOCATABLE::Pe_elem(:,:,:),Qe_elem(:,:,:),Se_elem(:,:,:)
      REAL(ReKi)::E10(3),RR0(3,3),kapa(3),E1(3)
      REAL(ReKi)::Fc(6),Fd(6),Oe(6,6),Pe(6,6),Qe(6,6)

      INTEGER::i,j,k,m,n,temp_id1,temp_id2
      
!      CALL NodalRelRot(Nuu0,node_elem,nelem,norder,dof_node,Nrr0)
!      CALL NodalRelRot(Nuuu,node_elem,nelem,norder,dof_node,Nrrr)

      DO i=1,node_elem
          CALL NodalDataAt0(node_elem,nelem,norder,dof_node,i,hhp,Nuu0,E10)
          CALL NodalData(Nuuu,Nrrr,Nuu0,Nrr0,E10,hhp,&
                         &node_elem,nelem,norder,dof_node,E1,RR0,kapa,Stif)
          CALL ElasticForce(E1,RR0,kapa,Stif,cet,Fc,Fd,Oe,Pe,Qe)
          Fc_elem(i,1:6) = Fc(1:6)
          Fd_elem(i,1:6) = Fd(1:6)
          Oe_elem(i,1:6,1:6) = Oe(1:6,1:6)
          Pe_elem(i,1:6,1:6) = Pe(1:6,1:6)
          Qe_elem(i,1:6,1:6) = Qe(1:6,1:6)
          Se_elem(i,1:6,1:6) = Stif(1:6,1:6)
      ENDDO

      DO i=1,node_elem
          DO j=1,6
              temp_id1 = (i-1)*dof_node+j
              DO k=1,6
                  temp_id2 = (i-1)*dof_node+k
                  elk(temp_id1,temp_id2) = w(i)*Qe_elem(i,j,k)*Jac
              ENDDO
          ENDDO
      ENDDO

      DO i=1,node_elem
          DO j=1,node_elem
              DO k=1,6
                  temp_id1=(i-1)*dof_node+k
                  DO m=1,6
                      temp_id2=(i-1)*dof_node+m
                      elk(temp_id1,temp_id2)=elk(temp_id1,temp_id2)+w(i)*Pe_elem(i,k,m)*hhp(j,i)
                      elk(temp_id1,temp_id2)=elk(temp_id1,temp_id2)+w(j)*Oe_elem(j,k,m)*hhp(i,j)
                  ENDDO
              ENDDO
          ENDDO
      ENDDO

      DO i=1,node_elem
          DO j=1,node_elem
              DO k=1,6
                  temp_id1=(i-1)*dof_node+k
                  DO m=1,6
                      temp_id2=(j-1)*dof_node+m
                      DO n=1,node_elem
                          elk(temp_id1,temp_id2)=elk(temp_id1,temp_id2)+w(n)*hhp(i,n)*Se_elem(n,k,m)*hhp(j,n)/Jac
                      ENDDO
                  ENDDO
              ENDDO
          ENDDO
      ENDDO

      DO i=1,node_elem
          DO j=1,6
              temp_id1 = (i-1)*dof_node+j
              elf(temp_id1) = -w(i)*Fd_elem(i,j)*Jac
              DO m=1,node_elem
                  elf(temp_id1) = elf(temp_id1)-w(m)*hhp(i,m)*Fc_elem(m,j)
              ENDDO
          ENDDO
      ENDDO

      END SUBROUTINE ElementMatrix


     

      SUBROUTINE InertialForce(m00,mEta,rho,vvv,aaa,Fi,Mi,Gi,Ki)

!------------------------------------------------------------------------------
!   INPUT VARIABLES
!------------------------------------------------------------------------------

      REAL(ReKi),INTENT(IN)::m00      ! this variable is 
      REAL(ReKi),INTENT(IN)::mEta(:)  ! this variable is 
      REAL(ReKi),INTENT(IN)::rho(:,:) ! this variable is 
      REAL(ReKi),INTENT(IN)::vvv(:)   ! this variable is
      REAL(ReKi),INTENT(IN)::aaa(:)   ! this variable is
      REAL(ReKi),INTENT(OUT)::Fi(6),Mi(6,6),Gi(6,6),Ki(6,6)

!------------------------------------------------------------------------------ 
!   LOCAL VARIABLES
!------------------------------------------------------------------------------

      REAL(ReKi)::beta(3),gama(3),nu(3),epsi(3,3),mu(3,3)
      REAL(ReKi)::ome(3),omd(3),tempV(3),tempA(3)

!------------------------------------------------------------------------------ 
!   LOGIC
!------------------------------------------------------------------------------

      ! Prepare
      ome(:) = vvv(4:6)
      omd(:) = aaa(4:6)
      tempV(:) = vvv(1:3)
      tempA(:) = aaa(1:3)

      beta = MATMUL(Tilde(ome),mEta)
      gama = MATMUL(rho,ome)
      nu = MATMUL(rho,omd)

      !Compute Fi
      Fi(1:3) = m00*tempA + MATMUL(Tilde(omd),mEta) + MATMUL(Tilde(ome),beta)
      Fi(4:6) = MATMUL(Tilde(mEta,tempA) + nu + MATMUL(Tilde(ome),gama) 
{'fraction_non_alphanumeric': 0.2188479151602796, 'fraction_numerical': 0.04025066281031574, 'mean_word_length': 1.7793034159410583, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '319158', 'n_tokens_mistral': 3727, 'n_tokens_neox': 3541, 'n_words': 324}