CalculiX  2.13
A Free Software Three-Dimensional Structural Finite Element Program
mpcadd.f File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine mpcadd (nodedep, is, ie, nboun, ipompc, nodempc, coefmpc, nmpc, nmpc_, mpcfree, orab, ikboun, ikmpc, ilmpc, co, labmpc, label, nodeind, iorientation)
 

Function/Subroutine Documentation

◆ mpcadd()

subroutine mpcadd ( integer  nodedep,
integer  is,
integer  ie,
integer  nboun,
integer, dimension(*)  ipompc,
integer, dimension(3,*)  nodempc,
real*8, dimension(*)  coefmpc,
integer  nmpc,
integer  nmpc_,
integer  mpcfree,
real*8, dimension(7,*)  orab,
integer, dimension(*)  ikboun,
integer, dimension(*)  ikmpc,
integer, dimension(*)  ilmpc,
real*8, dimension(3,*)  co,
character*20, dimension(*)  labmpc,
character*20  label,
integer  nodeind,
integer  iorientation 
)
22 !
23 ! generates an equality MPC between node "nodedep" (dependent) and
24 ! node "nodeind" (independent), both at the same position,
25 ! in orientation system "iorientation" for local degrees of
26 ! freedom "is" up to "ie".
27 !
28  implicit none
29 !
30  character*20 labmpc(*),label
31 !
32  integer nodedep,is,ie,nboun,i,j,ipompc(*),nodempc(3,*),nmpc,nmpc_,
33  & mpcfree,ikboun(*),ikmpc(*),ilmpc(*),idof,number,id,
34  & mpcfreeold,three,kflag,iy(3),inumber,nodeind,iorientation
35 !
36  real*8 coefmpc(*),a(3,3),co(3,*),orab(7,*),dx(3),p(3)
37 !
38  loop: do i=is,ie
39 !
40  if(iorientation.eq.0) then
41 !
42 ! no transformation applies: simple SPC
43 !
44  idof=8*(nodedep-1)+i
45  call nident(ikboun,idof,nboun,id)
46  if(id.gt.0) then
47  if(ikboun(id).eq.idof) then
48  cycle loop
49  endif
50  endif
51  call nident(ikmpc,idof,nmpc,id)
52  if(id.ne.0) then
53  if(ikmpc(id).eq.idof) cycle loop
54  endif
55 !
56 ! new MPC
57 !
58  nmpc=nmpc+1
59  if(nmpc.gt.nmpc_) then
60  write(*,*) '*ERROR in mpcadd: increase nmpc_'
61  call exit(201)
62  endif
63  labmpc(nmpc)=label
64  ipompc(nmpc)=mpcfree
65  do j=nmpc,id+2,-1
66  ikmpc(j)=ikmpc(j-1)
67  ilmpc(j)=ilmpc(j-1)
68  enddo
69  ikmpc(id+1)=idof
70  ilmpc(id+1)=nmpc
71 !
72  nodempc(1,mpcfree)=nodedep
73  nodempc(2,mpcfree)=i
74  coefmpc(mpcfree)=1.d0
75  mpcfree=nodempc(3,mpcfree)
76  if(mpcfree.eq.0) then
77  write(*,*) '*ERROR in mpcadd: increase memmpc_'
78  call exit(201)
79  endif
80 !
81  nodempc(1,mpcfree)=nodeind
82  nodempc(2,mpcfree)=i
83  coefmpc(mpcfree)=-1.d0
84  mpcfreeold=mpcfree
85  mpcfree=nodempc(3,mpcfree)
86  if(mpcfree.eq.0) then
87  write(*,*) '*ERROR in mpcadd: increase memmpc_'
88  call exit(201)
89  endif
90  nodempc(3,mpcfreeold)=0
91 !
92  else
93 !
94 ! transformation applies
95 !
96  do j=1,3
97  p(j)=co(j,nodedep)
98  enddo
99  call transformatrix(orab(1,iorientation),p,a)
100 !
101 ! new mpc
102 !
103  iy(1)=1
104  iy(2)=2
105  iy(3)=3
106  dx(1)=dabs(a(1,i))
107  dx(2)=dabs(a(2,i))
108  dx(3)=dabs(a(3,i))
109  three=3
110  kflag=-2
111  call dsort(dx,iy,three,kflag)
112  do inumber=1,3
113  number=iy(inumber)
114  idof=8*(nodedep-1)+number
115  call nident(ikmpc,idof,nmpc,id)
116  if(id.ne.0) then
117  if(ikmpc(id).eq.idof) cycle
118  endif
119  if(dabs(a(number,i)).lt.1.d-5) cycle
120  nmpc=nmpc+1
121  if(nmpc.gt.nmpc_) then
122  write(*,*) '*ERROR in mpcadd: increase nmpc_'
123  call exit(201)
124  endif
125  labmpc(nmpc)=label
126  ipompc(nmpc)=mpcfree
127  do j=nmpc,id+2,-1
128  ikmpc(j)=ikmpc(j-1)
129  ilmpc(j)=ilmpc(j-1)
130  enddo
131  ikmpc(id+1)=idof
132  ilmpc(id+1)=nmpc
133  exit
134  enddo
135 !
136 ! check whether a dependent term was found; if none was
137 ! found this can be due to the fact that:
138 ! - all dofs were used by other MPC's
139 ! - the MPC coefficients were too small
140 ! - or a combination of both
141 !
142  if(inumber.gt.3) cycle
143 !
144  inumber=inumber-1
145  do j=1,3
146  inumber=inumber+1
147  if(inumber.gt.3) inumber=1
148  number=iy(inumber)
149  if(dabs(a(number,i)).lt.1.d-30) cycle
150 !
151  nodempc(1,mpcfree)=nodedep
152  nodempc(2,mpcfree)=number
153  coefmpc(mpcfree)=a(number,i)
154  mpcfree=nodempc(3,mpcfree)
155  if(mpcfree.eq.0) then
156  write(*,*) '*ERROR in mpcadd: increase memmpc_'
157  call exit(201)
158  endif
159 !
160  nodempc(1,mpcfree)=nodeind
161  nodempc(2,mpcfree)=number
162  coefmpc(mpcfree)=-a(number,i)
163  mpcfreeold=mpcfree
164  mpcfree=nodempc(3,mpcfree)
165  if(mpcfree.eq.0) then
166  write(*,*) '*ERROR in mpcadd: increase memmpc_'
167  call exit(201)
168  endif
169  enddo
170 !
171  nodempc(3,mpcfreeold)=0
172  endif
173  enddo loop
174 !
175  return
subroutine transformatrix(xab, p, a)
Definition: transformatrix.f:20
subroutine nident(x, px, n, id)
Definition: nident.f:26
subroutine dsort(dx, iy, n, kflag)
Definition: dsort.f:6
Hosted by OpenAircraft.com, (Michigan UAV, LLC)