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

Go to the source code of this file.

Functions/Subroutines

subroutine umpc_mean_rot (x, u, f, a, jdof, n, force, iit, idiscon, jnode, ikmpc, nmpc, ikboun, nboun, label)
 

Function/Subroutine Documentation

◆ umpc_mean_rot()

subroutine umpc_mean_rot ( real*8, dimension(3,*)  x,
real*8, dimension(3,*)  u,
real*8  f,
real*8, dimension(*)  a,
integer, dimension(*)  jdof,
integer  n,
real*8  force,
integer  iit,
integer  idiscon,
integer, dimension(*)  jnode,
integer, dimension(*)  ikmpc,
integer  nmpc,
integer, dimension(*)  ikboun,
integer  nboun,
character*20  label 
)
21 !
22 ! updates the coefficients in a mean rotation mpc
23 !
24 ! INPUT:
25 !
26 ! x(3,1..n) Carthesian coordinates of the nodes in the
27 ! user mpc.
28 ! u(3,1..n) Actual displacements of the nodes in the
29 ! user mpc.
30 ! jdof(1..n) Actual degrees of freedom of the mpc terms
31 ! n number of terms in the user mpc
32 ! force Actual value of the mpc force
33 ! iit iteration number
34 !
35 ! OUTPUT:
36 !
37 ! f Actual value of the mpc. If the mpc is
38 ! exactly satisfied, this value is zero
39 ! a(n) coefficients of the linearized mpc
40 ! jdof(1..n) Corrected degrees of freedom of the mpc terms
41 ! idiscon 0: no discontinuity
42 ! 1: discontinuity
43 ! If a discontinuity arises the previous
44 ! results are not extrapolated at the start of
45 ! a new increment
46 !
47  implicit none
48 !
49  character*20 label
50 !
51  integer jdof(*),n,nkn,i,j,k,imax,iit,idiscon,node,nodeold,
52  & nodemax,idirold,idirmax,jnode(*),idof,id,iold(3),inew(3),
53  & ikmpc(*),nmpc,ikboun(*),nboun,idir,nendnode
54 !
55  real*8 x(3,*),u(3,*),f,a(*),aa(3),cgx(3),cgu(3),pi(3),b(3),
56  & xi(3),dd,al,a1,amax,c1,c2,c3,c4,c9,c10,force,xcoef,
57  & transcoef(3)
58 !
59  nkn=(n-1)/3
60  if(3*nkn.ne.n-1) then
61  write(*,*)
62  & '*ERROR in meanrotmpc: MPC has wrong number of terms'
63  call exit(201)
64  endif
65 !
66 ! normal along the rotation axis
67 !
68  dd=0.d0
69  do i=1,3
70  aa(i)=x(i,n)
71  dd=dd+aa(i)**2
72  enddo
73  dd=dsqrt(dd)
74  if(dd.lt.1.d-10) then
75  write(*,*)
76  & '*ERROR in meanrotmpc: rotation vector has zero length'
77  call exit(201)
78  endif
79  do i=1,3
80  aa(i)=aa(i)/dd
81  enddo
82 !
83 ! finding the center of gravity of the position and the
84 ! displacements of the nodes involved in the MPC
85 !
86  do i=1,3
87  cgx(i)=0.d0
88  cgu(i)=0.d0
89  enddo
90 !
91  do i=1,nkn
92  do j=1,3
93  cgx(j)=cgx(j)+x(j,3*i-2)
94  cgu(j)=cgu(j)+u(j,3*i-2)
95  enddo
96  enddo
97 !
98  do i=1,3
99  cgx(i)=cgx(i)/nkn
100  cgu(i)=cgu(i)/nkn
101  enddo
102 !
103 ! initializing a
104 !
105  do i=1,n
106  a(i)=0.d0
107  enddo
108 !
109 ! calculating the partial derivatives and storing them in a
110 !
111  f=0.d0
112  do i=1,nkn
113 !
114 ! relative positions
115 !
116  do j=1,3
117  pi(j)=x(j,3*i-2)-cgx(j)
118  xi(j)=u(j,3*i-2)-cgu(j)+pi(j)
119  enddo
120 !
121 ! projection on a plane orthogonal to the rotation vector
122 !
123  c1=pi(1)*aa(1)+pi(2)*aa(2)+pi(3)*aa(3)
124  do j=1,3
125  pi(j)=pi(j)-c1*aa(j)
126  enddo
127 !
128  c1=xi(1)*aa(1)+xi(2)*aa(2)+xi(3)*aa(3)
129  do j=1,3
130  xi(j)=xi(j)-c1*aa(j)
131  enddo
132 !
133  c1=pi(1)*pi(1)+pi(2)*pi(2)+pi(3)*pi(3)
134  if(c1.lt.1.d-20) then
135  if(label(8:9).ne.'BS') then
136  write(*,*) '*WARNING in meanrotmpc: node ',jnode(3*i-2)
137  write(*,*) ' is very close to the '
138  write(*,*) ' rotation axis through the'
139  write(*,*) ' center of gravity of'
140  write(*,*) ' the nodal cloud in a'
141  write(*,*) ' mean rotation MPC.'
142  write(*,*) ' This node is not taken'
143  write(*,*) ' into account in the MPC'
144  endif
145  cycle
146  endif
147  c3=xi(1)*xi(1)+xi(2)*xi(2)+xi(3)*xi(3)
148  c2=dsqrt(c1*c3)
149 !
150  al=(aa(1)*pi(2)*xi(3)+aa(2)*pi(3)*xi(1)+aa(3)*pi(1)*xi(2)
151  & -aa(3)*pi(2)*xi(1)-aa(1)*pi(3)*xi(2)-aa(2)*pi(1)*xi(3))
152  & /c2
153 !
154  f=f+dasin(al)
155 !
156  do j=1,3
157  if(j.eq.1) then
158  c4=aa(2)*pi(3)-aa(3)*pi(2)
159  elseif(j.eq.2) then
160  c4=aa(3)*pi(1)-aa(1)*pi(3)
161  else
162  c4=aa(1)*pi(2)-aa(2)*pi(1)
163  endif
164  c9=(c4/c2-al*xi(j)/c3)/dsqrt(1.d0-al*al)
165 !
166  do k=1,nkn
167  if(i.eq.k) then
168  c10=c9*(1.d0-1.d0/real(nkn))
169  else
170  c10=-c9/real(nkn)
171  endif
172  a(k*3-3+j)=a(k*3-3+j)+c10
173  enddo
174  enddo
175  enddo
176  a(n)=-nkn
177  f=f-nkn*u(1,n)
178 !
179 ! assigning the degrees of freedom
180 ! the first three dofs may not be in ascending order
181 !
182  do i=1,3
183  b(i)=a(i)
184  enddo
185  do i=1,3
186  a(i)=b(jdof(i))
187  enddo
188 !
189  do i=4,nkn
190  jdof(i*3-2)=1
191  jdof(i*3-1)=2
192  jdof(i*3)=3
193  enddo
194 !
195  jdof(n)=1
196 !
197 ! looking for the maximum tangent to decide which DOF should be
198 ! taken to be the dependent one
199 !
200  if(dabs(a(1)).lt.1.d-5) then
201 !
202 ! special treatment of beam and shell mean rotation MPC's
203 ! cf. usermpc.f
204 !
205  if(label(8:9).eq.'BS') then
206  do i=1,3
207  transcoef(i)=a(n-4+i)
208  enddo
209  endif
210 !
211  imax=0
212  amax=1.d-5
213 !
214  if(label(8:9).eq.'BS') then
215  nendnode=n-4
216  else
217  nendnode=n-1
218  endif
219  do i=2,nendnode
220  if(dabs(a(i)).gt.amax) then
221  idir=jdof(i)
222 !
223  if(label(8:9).eq.'BS') then
224  if(a(i)*transcoef(idir).gt.0) cycle
225  endif
226 !
227  node=jnode(i)
228  idof=8*(node-1)+idir
229 !
230 ! check whether dof is not used in another MPC
231 !
232  call nident(ikmpc,idof,nmpc,id)
233  if(id.gt.0) then
234  if(ikmpc(id).eq.idof) cycle
235  endif
236 !
237 ! check whether dof is not used in a SPC
238 !
239  call nident(ikboun,idof,nboun,id)
240  if(id.gt.0) then
241  if(ikboun(id).eq.idof) cycle
242  endif
243 !
244  amax=dabs(a(i))
245  imax=i
246  endif
247  enddo
248 !
249  if(imax.eq.0) then
250  write(*,*) '*ERROR in umpc_mean_rot'
251  write(*,*) ' no mean rotation MPC can be'
252  write(*,*) ' generated for the MPC containing'
253  write(*,*) ' node ',jnode(1)
254  call exit(201)
255  endif
256 !
257  nodeold=jnode(1)
258  idirold=jdof(1)
259  nodemax=jnode(imax)
260  idirmax=jdof(imax)
261 !
262 ! exchange the node information, if needed
263 !
264  if(nodemax.ne.nodeold) then
265  do i=1,3
266  iold(jdof(i))=i
267  enddo
268  do i=4,n-4
269  if(jnode(i).eq.nodemax) then
270  if(jdof(i).eq.1) then
271  inew(1)=i
272  elseif(jdof(i).eq.2) then
273  inew(2)=i
274  else
275  inew(3)=i
276  endif
277  endif
278  enddo
279 !
280  do j=1,3
281  node=jnode(iold(j))
282  idir=jdof(iold(j))
283  xcoef=a(iold(j))
284  jnode(iold(j))=jnode(inew(j))
285  jdof(iold(j))=jdof(inew(j))
286  a(iold(j))=a(inew(j))
287  jnode(inew(j))=node
288  jdof(inew(j))=idir
289  a(inew(j))=xcoef
290  enddo
291  endif
292 !
293 ! exchange the direction information, if needed
294 !
295  iold(1)=1
296  do i=1,3
297  if(jdof(i).eq.idirmax) then
298  inew(1)=i
299  exit
300  endif
301  enddo
302 !
303  if(iold(1).ne.inew(1)) then
304  do j=1,1
305  idir=jdof(iold(j))
306  xcoef=a(iold(j))
307  jdof(iold(j))=jdof(inew(j))
308  a(iold(j))=a(inew(j))
309  jdof(inew(j))=idir
310  a(inew(j))=xcoef
311  enddo
312  endif
313  endif
314 !
315  return
static double * c1
Definition: mafillvcompmain.c:30
subroutine nident(x, px, n, id)
Definition: nident.f:26
Hosted by OpenAircraft.com, (Michigan UAV, LLC)