32       logical add,fixed,user,quadratic
    34       character*1 type,typeboun(*)
    36       character*20 labmpc(*),label
    38       integer ikforc(*),ilforc(*),nodeforc(2,*),ndirforc(*),itr,idirref,
    39      &  iamforc(*),idim,ier,matz,nodeact,linc,lend,lstart,nnodes,
    40      &  nforc,nforc_,ntrans,inotr(2,*),rig(*),ipompc(*),nodempc(3,*),
    41      &  nmpc,nmpc_,mpcfree,ikmpc(*),ilmpc(*),iponoel(*),inoel(3,*),
    42      &  iponoelmax,kon(*),ipkon(*),ne,iponor(2,*),knor(*),nforcold,
    43      &  i,node,index,ielem,j,indexe,indexk,nam,iamplitude,idir,
    44      &  irotnode,nk,nk_,newnode,idof,id,mpcfreenew,k,isector,ndepnodes,
    45      &  idepnodes(80),l,iexpnode,indexx,irefnode,imax,isol,mpcfreeold,
    46      &  nod,impc,istep,nodeboun(*),ndirboun(*),ikboun(*),ilboun(*),
    47      &  nboun,nboun_,iamboun(*),nmethod,iperturb,nrhs,ipiv(3),info,m,
    48      &  mi(*),idefforc(*),nedge
    50       real*8 xforc(*),trab(7,*),coefmpc(*),xnor(*),val,co(3,*),dot,
    51      &  thicke(mi(3),*),pi,xboun(*),xnoref(3),dmax,d(3,3),e(3,3,3),
    52      &  alpha,q(3),w(3),xn(3),a(3,3),a1(3),a2(3),dd,
c1,c2,c3,ww,c(3,3),
    53      &  vold(0:mi(2),*),e1(3),e2(3),t1(3),b(3,3),x(3),y(3),fv1(3),
    54      &  fv2(3),z(3,3),xi1,xi2,xi3,u(3,3),r(3,3)
    56       data d /1.,0.,0.,0.,1.,0.,0.,0.,1./
    57       data e /0.,0.,0.,0.,0.,-1.,0.,1.,0.,
    58      &        0.,0.,1.,0.,0.,0.,-1.,0.,0.,
    59      &        0.,-1.,0.,1.,0.,0.,0.,0.,0./
    72          if(node.gt.iponoelmax) 
then    73             if(ndirforc(i).gt.3) 
then    74                write(*,*) 
'*WARNING: in gen3dforc: node ',i,
    76                write(*,*) 
'       belong to a beam nor shell'    77                write(*,*) 
'       element and consequently has no'    78                write(*,*) 
'       rotational degrees of freedom'    84             if(ndirforc(i).gt.3) 
then    85                write(*,*) 
'*WARNING: in gen3dforc: node ',i,
    87                write(*,*) 
'       belong to a beam nor shell'    88                write(*,*) 
'       element and consequently has no'    89                write(*,*) 
'       rotational degrees of freedom'    97          if((lakon(ielem)(4:4).eq.
'6').or.
    98      &      (lakon(ielem)(4:4).eq.
'8')) 
then   106          if((lakon(ielem)(4:4).eq.
'6').or.
   107      &      (lakon(ielem)(4:5).eq.
'15')) 
then   115          indexk=iponor(2,indexe+j)
   116          if(nam.gt.0) iamplitude=iamforc(i)
   120          if(rig(node).ne.0) 
then   122                if(rig(node).lt.0) 
then   123                   write(*,*) 
'*ERROR in gen3dforc: in node ',node
   124                   write(*,*) 
'       a rotational DOF is loaded;'   125                   write(*,*) 
'       however, the elements to which'   126                   write(*,*) 
'       this node belongs do not have'   127                   write(*,*) 
'       rotational DOFs'   133                call forcadd(irotnode,k,val,nodeforc,
   134      &              ndirforc,xforc,nforc,nforc_,iamforc,
   135      &              iamplitude,nam,ntrans,trab,inotr,co,
   136      &              ikforc,ilforc,isector,add,user,idefforc,
   137      &              ipompc,nodempc,nmpc,ikmpc,ilmpc,labmpc)
   146             if((idir.gt.3).and.((nmethod.eq.4).and.(iperturb.gt.1)))
then   151                if(lakon(ielem)(7:7).eq.
'L') 
then   153                      ndepnodes=ndepnodes+1
   154                      idepnodes(ndepnodes)=knor(indexk+k)
   157                elseif(lakon(ielem)(7:7).eq.
'B') 
then   159                      ndepnodes=ndepnodes+1
   160                      idepnodes(ndepnodes)=knor(indexk+k)
   165      &           
'*ERROR in gen3dboun: a rotational DOF was applied'   167      &           
'*      to node',node,
' without rotational DOFs'   178                      call nident(ikmpc,idof,nmpc,id)
   180                         if(ikmpc(id).eq.idof) 
then   182                            call mpcrem(impc,mpcfree,nodempc,nmpc,
   183      &                       ikmpc,ilmpc,labmpc,coefmpc,ipompc)
   194                   write(*,*) 
'*ERROR in rigidbodies: increase nk_'   201                   write(*,*) 
'*ERROR in rigidbodies: increase nk_'   206                   call knotmpc(ipompc,nodempc,coefmpc,irefnode,
   208      &                 labmpc,nmpc,nmpc_,mpcfree,ikmpc,ilmpc,nk,nk_,
   209      &                 nodeboun,ndirboun,ikboun,ilboun,nboun,nboun_,
   210      &                 idepnodes,typeboun,co,xboun,istep,k,ndepnodes,
   221                if(ndepnodes.eq.3) 
then   226                         w(l)=w(l)+vold(l,nod)
   238                         w(l)=w(l)+vold(l,nod)
   252                   dd=(co(1,nod)-q(1))**2
   253      &              +(co(2,nod)-q(2))**2
   254      &              +(co(3,nod)-q(3))**2
   255                   if(dd.lt.1.d-20) cycle
   257      &             ((co(1,nod)+vold(1,nod)-q(1)-w(1))**2
   258      &             +(co(2,nod)+vold(2,nod)-q(2)-w(2))**2
   259      &             +(co(3,nod)+vold(3,nod)-q(3)-w(3))**2)/dd)
   261                alpha=alpha/ndepnodes
   276                      a2(l)=vold(l,nod)-w(l)
   280                   if(dd.lt.1.d-10) cycle
   285                   xn(1)=xn(1)+(a1(2)*a2(3)-a1(3)*a2(2))
   286                   xn(2)=xn(2)+(a1(3)*a2(1)-a1(1)*a2(3))
   287                   xn(3)=xn(3)+(a1(1)*a2(2)-a1(2)*a2(1))
   290                         a(l,m)=a(l,m)+a1(l)*a1(m)
   297                      a(l,m)=a(l,m)/ndepnodes
   299                   xn(l)=xn(l)/ndepnodes
   305                call dgesv(m,nrhs,a,m,ipiv,xn,m,info)
   307                   write(*,*) 
'*ERROR in gen3dforc:'   308                   write(*,*) 
'       singular system of equations'   318                   xn(l)=dasin(dd/alpha)*xn(l)/dd
   323                ww=dsqrt(xn(1)*xn(1)+xn(2)*xn(2)+xn(3)*xn(3))
   326                if(ww.gt.1.d-10) 
then   342      &                  c2*(e(k,1,l)*xn(1)+e(k,2,l)*xn(2)+
   343      &                  e(k,3,l)*xn(3))+c3*xn(k)*xn(l)
   350                   vold(l,irefnode)=w(l)
   351                   vold(l,irotnode)=xn(l)
   354                vold(1,iexpnode)=alpha-1.d0
   377                         y(l)=x(l)+vold(l,nod)-w(l)
   381                            c(l,m)=c(l,m)+x(l)*x(m)
   382                            b(l,m)=b(l,m)+x(l)*y(m)
   391                   call dgesv(m,nrhs,c,m,ipiv,b,m,info)
   393                      write(*,*) 
'*ERROR in gen3dforc:'   394                      write(*,*) 
'       singular system of equations'   405                         u(l,m)=b(l,1)*r(1,m)+b(l,2)*r(2,m)+
   418                   call rs(m,m,u,w,matz,z,fv1,fv2,ier)
   421      &                   
'*ERROR in knotmpc while calculating the'   422                      write(*,*) 
'       eigenvalues/eigenvectors'   426                   if((dabs(w(1)-1.d0).lt.dabs(w(2)-1.d0)).and.
   427      &                 (dabs(w(1)-1.d0).lt.dabs(w(3)-1.d0))) 
then   430                   elseif((dabs(w(2)-1.d0).lt.dabs(w(1)-1.d0)).and.
   431      &                    (dabs(w(2)-1.d0).lt.dabs(w(3)-1.d0))) 
then   438                   xi1=datan2((z(1,l)*e2(1)+z(2,l)*e2(2)+z(3,l)*e2(2)),
   439      &                 (z(1,l)*e1(1)+z(2,l)*e1(2)+z(3,l)*e1(2)))
   452                call forcadd(irotnode,idir,val,nodeforc,
   453      &              ndirforc,xforc,nforc,nforc_,iamforc,
   454      &              iamplitude,nam,ntrans,trab,inotr,co,
   455      &              ikforc,ilforc,isector,add,user,idefforc,
   456      &              ipompc,nodempc,nmpc,ikmpc,ilmpc,labmpc)
   461                if(lakon(ielem)(7:7).eq.
'L') 
then   462                   indexx=iponor(1,indexe+j)
   464                      xnoref(k)=xnor(indexx+k)
   469                      if(dabs(xnoref(k)).gt.dmax) 
then   477                   if(dabs(1.d0-dmax).lt.1.d-3) 
then   479                      if(nam.gt.0) iamplitude=0
   481                      call bounadd(irotnode,imax,imax,val,nodeboun,
   482      &                    ndirboun,xboun,nboun,nboun_,iamboun,
   483      &                    iamplitude,nam,ipompc,nodempc,coefmpc,
   484      &                    nmpc,nmpc_,mpcfree,inotr,trab,ntrans,
   485      &                    ikboun,ilboun,ikmpc,ilmpc,co,nk,nk_,labmpc,
   486      &                    
type,typeboun,nmethod,iperturb,fixed,vold,
   494                         idof=8*(node-1)+3+imax
   495                         call nident(ikboun,idof,nboun,id)
   496                         if((id.gt.0).and.(ikboun(id).eq.idof)) 
then   498                            if(imax.gt.3) imax=imax-3
   511                         idof=8*(irotnode-1)+imax
   512                         call nident(ikmpc,idof,nmpc,id)
   514                         if(nmpc.gt.nmpc_) 
then   516      &                          
'*ERROR in gen3dnor: increase nmpc_'   530                         nodempc(1,mpcfree)=irotnode
   531                         nodempc(2,mpcfree)=imax
   532                         coefmpc(mpcfree)=xnoref(imax)
   533                         mpcfree=nodempc(3,mpcfree)
   535                         if(imax.gt.3) imax=imax-3
   536                         nodempc(1,mpcfree)=irotnode
   537                         nodempc(2,mpcfree)=imax
   538                         coefmpc(mpcfree)=xnoref(imax)
   539                         mpcfree=nodempc(3,mpcfree)
   541                         if(imax.gt.3) imax=imax-3
   542                         nodempc(1,mpcfree)=irotnode
   543                         nodempc(2,mpcfree)=imax
   544                         coefmpc(mpcfree)=xnoref(imax)
   546                         mpcfree=nodempc(3,mpcfree)
   547                         nodempc(3,mpcfreeold)=0
   557             if((idir.gt.3).and.((nmethod.ne.4).or.(iperturb.le.1)))
then   568                call nident(ikforc,idof,nforc,id)
   569                if(ilforc(id).ne.i) cycle
   573                if(lakon(ielem)(7:7).eq.
'L') 
then   582                      xn(j)=co(j,knor(indexk+3))-co(j,knor(indexk+1))
   584                   dd=dsqrt(xn(1)*xn(1)+xn(2)*xn(2)+xn(3)*xn(3))
   589                elseif(lakon(ielem)(7:7).eq.
'B') 
then   599                elseif(inotr(1,node).eq.0) 
then   621                if(lakon(ielem)(7:7).eq.
'L') 
then   622                   dot=a(1,idirref)*xn(1)+a(2,idirref)*xn(2)+
   625                      write(*,*) 
'*ERROR in gen3dforc: applied'   626                      write(*,*) 
'       moment in node ',node
   627                      write(*,*) 
'       and direction ',idir-1
   628                      write(*,*) 
'       has a significant'   630      &                    
'       component along the drilling'   631                      write(*,*) 
'       direction; this is not'   632                      write(*,*) 
'       allowed'   642                do j=lstart,lend,linc
   643                   nodeact=knor(indexk+j)
   646                      call usermpc(ipompc,nodempc,coefmpc,
   647      &                    labmpc,nmpc,nmpc_,mpcfree,ikmpc,ilmpc,
   648      &                    nk,nk_,nodeboun,ndirboun,ikboun,ilboun,
   649      &                    nboun,nboun_,nnodes,nodeact,co,label,
   650      &                    typeboun,iperturb,node,idirref,xboun)
   658                   co(k,nodeact)=a(k,idirref)
   661                call usermpc(ipompc,nodempc,coefmpc,
   662      &              labmpc,nmpc,nmpc_,mpcfree,ikmpc,ilmpc,
   663      &              nk,nk_,nodeboun,ndirboun,ikboun,ilboun,
   664      &              nboun,nboun_,nnodes,nodeact,co,label,
   665      &              typeboun,iperturb,node,idirref,xboun)
   670                call usermpc(ipompc,nodempc,coefmpc,
   671      &              labmpc,nmpc,nmpc_,mpcfree,ikmpc,ilmpc,
   672      &              nk,nk_,nodeboun,ndirboun,ikboun,ilboun,
   673      &              nboun,nboun_,nnodes,nodeact,co,label,
   674      &              typeboun,iperturb,node,idirref,xboun)
   680                if(nodeact.ne.-1) 
then   682                   call forcadd(nk,idir,val,nodeforc,
   683      &              ndirforc,xforc,nforc,nforc_,iamforc,
   684      &              iamplitude,nam,ntrans,trab,inotr,co,
   685      &              ikforc,ilforc,isector,add,user,idefforc,
   686      &              ipompc,nodempc,nmpc,ikmpc,ilmpc,labmpc)
   699             if(lakon(ielem)(7:7).eq.
'L') 
then   700                newnode=knor(indexk+1)
   701                idof=8*(newnode-1)+idir
   702                call nident(ikmpc,idof,nmpc,id)
   703                if((id.le.0).or.(ikmpc(id).ne.idof)) 
then   705                   if(nmpc.gt.nmpc_) 
then   707      &                    
'*ERROR in gen3dforc: increase nmpc_'   724                   nodempc(1,mpcfree)=newnode
   725                   nodempc(2,mpcfree)=idir
   726                   if((j.gt.nedge).or.(.not.quadratic)) 
then   727                      coefmpc(mpcfree)=1.d0
   729                      coefmpc(mpcfree)=-1.d0
   731                   mpcfree=nodempc(3,mpcfree)
   732                   if(mpcfree.eq.0) 
then   734      &                    
'*ERROR in gen3dforc: increase memmpc_'   738                   if((j.le.nedge).and.(quadratic)) 
then   739                      nodempc(1,mpcfree)=knor(indexk+2)
   740                      nodempc(2,mpcfree)=idir
   741                      coefmpc(mpcfree)=4.d0
   742                      mpcfree=nodempc(3,mpcfree)
   743                      if(mpcfree.eq.0) 
then   745      &                       
'*ERROR in gen3dforc: increase memmpc_'   750                   nodempc(1,mpcfree)=knor(indexk+3)
   751                   nodempc(2,mpcfree)=idir
   752                   if((j.gt.nedge).or.(.not.quadratic)) 
then   753                      coefmpc(mpcfree)=1.d0
   755                      coefmpc(mpcfree)=-1.d0
   757                   mpcfree=nodempc(3,mpcfree)
   758                   if(mpcfree.eq.0) 
then   760      &                    
'*ERROR in gen3dforc: increase memmpc_'   764                   nodempc(1,mpcfree)=node
   765                   nodempc(2,mpcfree)=idir
   766                   coefmpc(mpcfree)=-2.d0
   767                   mpcfreenew=nodempc(3,mpcfree)
   768                   if(mpcfreenew.eq.0) 
then   770      &                    
'*ERROR in gen3dforc: increase memmpc_'   777             elseif(lakon(ielem)(7:7).eq.
'B') 
then   781                newnode=knor(indexk+1)
   782                idof=8*(newnode-1)+idir
   783                call nident(ikmpc,idof,nmpc,id)
   784                if((id.le.0).or.(ikmpc(id).ne.idof)) 
then   786                   if(nmpc.gt.nmpc_) 
then   788      &                    
'*ERROR in gen3dforc: increase nmpc_'   800                         nodempc(1,mpcfree)=knor(indexk+k)
   801                         nodempc(2,mpcfree)=idir
   802                         coefmpc(mpcfree)=1.d0
   803                         mpcfree=nodempc(3,mpcfree)
   804                         if(mpcfree.eq.0) 
then   806      &                          
'*ERROR in gen3dforc: increase memmpc_'   810                   nodempc(1,mpcfree)=node
   811                   nodempc(2,mpcfree)=idir
   812                   coefmpc(mpcfree)=-4.d0
   813                   mpcfreenew=nodempc(3,mpcfree)
   814                   if(mpcfreenew.eq.0) 
then   816      &                    
'*ERROR in gen3dforc: increase memmpc_'   827                newnode=knor(indexk+2)
   828                idof=8*(newnode-1)+idir
   829                call nident(ikmpc,idof,nmpc,id)
   830                if(((id.le.0).or.(ikmpc(id).ne.idof)).and.
   833                   if(nmpc.gt.nmpc_) 
then   835      &                    
'*ERROR in gen3dmpc: increase nmpc_'   846                   nodempc(1,mpcfree)=newnode
   847                   nodempc(2,mpcfree)=idir
   848                   coefmpc(mpcfree)=1.d0
   849                   mpcfree=nodempc(3,mpcfree)
   850                   if(mpcfree.eq.0) 
then   852      &                    
'*ERROR in gen3dmpc: increase memmpc_'   855                   nodempc(1,mpcfree)=node
   856                   nodempc(2,mpcfree)=idir
   857                   coefmpc(mpcfree)=-1.d0
   858                   mpcfreenew=nodempc(3,mpcfree)
   859                   if(mpcfreenew.eq.0) 
then   861      &                    
'*ERROR in gen3dmpc: increase memmpc_' subroutine knotmpc(ipompc, nodempc, coefmpc, irefnode, irotnode, iexpnode, labmpc, nmpc, nmpc_, mpcfree, ikmpc, ilmpc, nk, nk_, nodeboun, ndirboun, ikboun, ilboun, nboun, nboun_, idepnodes, typeboun, co, xboun, istep, k, ndepnodes, idim, e1, e2, t1)
Definition: knotmpc.f:24
subroutine rs(nm, n, a, w, matz, z, fv1, fv2, ierr)
Definition: rs.f:27
static double * c1
Definition: mafillvcompmain.c:30
subroutine dgesv(N, NRHS, A, LDA, IPIV, B, LDB, INFO)
Definition: dgesv.f:58
subroutine mpcrem(i, mpcfree, nodempc, nmpc, ikmpc, ilmpc, labmpc, coefmpc, ipompc)
Definition: mpcrem.f:21
subroutine nident(x, px, n, id)
Definition: nident.f:26
subroutine usermpc(ipompc, nodempc, coefmpc, labmpc, nmpc, nmpc_, mpcfree, ikmpc, ilmpc, nk, nk_, nodeboun, ndirboun, ikboun, ilboun, nboun, nboun_, nnodes, node, co, label, typeboun, iperturb, noderef, idirref, xboun)
Definition: usermpc.f:23
subroutine bounadd(node, is, ie, val, nodeboun, ndirboun, xboun, nboun, nboun_, iamboun, iamplitude, nam, ipompc, nodempc, coefmpc, nmpc, nmpc_, mpcfree, inotr, trab, ntrans, ikboun, ilboun, ikmpc, ilmpc, co, nk, nk_, labmpc, type, typeboun, nmethod, iperturb, fixed, vold, nodetrue, mi, label)
Definition: bounadd.f:24
subroutine forcadd(node, i, val, nodeforc, ndirforc, xforc, nforc, nforc_, iamforc, iamplitude, nam, ntrans, trab, inotr, co, ikforc, ilforc, isector, add, user, idefforc, ipompc, nodempc, nmpc, ikmpc, ilmpc, labmpc)
Definition: forcadd.f:23