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

Go to the source code of this file.

Functions/Subroutines

subroutine distattach_3d (xig, etg, zeg, pneigh, pnode, a, p, ratio, nterms)
 

Function/Subroutine Documentation

◆ distattach_3d()

subroutine distattach_3d ( real*8, intent(in)  xig,
real*8, intent(in)  etg,
real*8, intent(in)  zeg,
real*8, dimension(3,*), intent(in)  pneigh,
real*8, dimension(3), intent(in)  pnode,
real*8, intent(inout)  a,
real*8, dimension(3), intent(inout)  p,
real*8, dimension(20), intent(inout)  ratio,
integer, intent(in)  nterms 
)
21 !
22 ! calculates the distance between the node with coordinates
23 ! in "pnode" and the node with local coordinates xig and etg
24 ! in a face described by "nterms" nodes with coordinates
25 ! in pneigh
26 !
27  implicit none
28 !
29  integer nterms,i,j,iy,kflag,n
30 !
31  real*8 ratio(20),pneigh(3,*),pnode(3),a,xi,et,xig,etg,p(3),
32  & dummy,ze,zeg,omg,omh,omr,opg,oph,opr,dx(3),al,
33  & tpgphpr,tmgphpr,tmgmhpr,tpgmhpr,tpgphmr,tmgphmr,tmgmhmr,tpgmhmr,
34  & omgopg,omhoph,omropr,omgmopg,omhmoph,omrmopr
35 !
36  intent(in) xig,etg,zeg,pneigh,pnode,
37  & nterms
38 !
39  intent(inout) ratio,a,p
40 !
41  kflag=1
42  n=3
43 !
44  if(nterms.eq.4) then
45  xi=(xig+1.d0)/2.d0
46  et=(etg+1.d0)/2.d0
47  ze=(zeg+1.d0)/2.d0
48  dx(1)=xi
49  dx(2)=et
50  dx(3)=ze
51  call dsort(dx,iy,n,kflag)
52  if(dx(3).gt.1.d-30) then
53  al=dx(3)/(xi+et+ze)
54  xi=al*xi
55  et=al*et
56  ze=al*ze
57  endif
58 c if(xi+et+ze.gt.1.d0) then
59 c dummy=2.d0*(1.d0-xi-et-ze)/3.d0
60 c xi=dummy+xi
61 c et=dummy+et
62 c ze=dummy+ze
63 c endif
64 !
65 ! shape functions
66 !
67  ratio(1)=1.d0-xi-et-ze
68  ratio(2)=xi
69  ratio(3)=et
70  ratio(4)=ze
71  elseif(nterms.eq.6) then
72  xi=(xig+1.d0)/2.d0
73  et=(etg+1.d0)/2.d0
74  if(xi+et.gt.1.d0) then
75  dummy=xi
76  xi=1.d0-et
77  et=1.d0-dummy
78  endif
79 !
80  ze=zeg
81 
82  a=1.d0-xi-et
83 !
84 ! shape functions
85 !
86  ratio(1)=0.5d0*a *(1.d0-ze)
87  ratio(2)=0.5d0*xi*(1.d0-ze)
88  ratio(3)=0.5d0*et*(1.d0-ze)
89  ratio(4)=0.5d0*a *(1.d0+ze)
90  ratio(5)=0.5d0*xi*(1.d0+ze)
91  ratio(6)=0.5d0*et*(1.d0+ze)
92  elseif(nterms.eq.8) then
93  xi=xig
94  et=etg
95  ze=zeg
96 !
97  omg=1.d0-xi
98  omh=1.d0-et
99  omr=1.d0-ze
100  opg=1.d0+xi
101  oph=1.d0+et
102  opr=1.d0+ze
103 !
104 ! shape functions
105 !
106  ratio(1)=omg*omh*omr/8.d0
107  ratio(2)=opg*omh*omr/8.d0
108  ratio(3)=opg*oph*omr/8.d0
109  ratio(4)=omg*oph*omr/8.d0
110  ratio(5)=omg*omh*opr/8.d0
111  ratio(6)=opg*omh*opr/8.d0
112  ratio(7)=opg*oph*opr/8.d0
113  ratio(8)=omg*oph*opr/8.d0
114  elseif(nterms.eq.10) then
115  xi=(xig+1.d0)/2.d0
116  et=(etg+1.d0)/2.d0
117  ze=(zeg+1.d0)/2.d0
118  dx(1)=xi
119  dx(2)=et
120  dx(3)=ze
121  call dsort(dx,iy,n,kflag)
122  if(dx(3).gt.1.d-30) then
123  al=dx(3)/(xi+et+ze)
124  xi=al*xi
125  et=al*et
126  ze=al*ze
127  endif
128 c if(xi+et+ze.gt.1.d0) then
129 c dummy=2.d0*(1.d0-xi-et-ze)/3.d0
130 c xi=dummy+xi
131 c et=dummy+et
132 c ze=dummy+ze
133 c endif
134 !
135 ! shape functions
136 !
137  a=1.d0-xi-et-ze
138  ratio( 1)=(2.d0*a-1.d0)*a
139  ratio( 2)=xi*(2.d0*xi-1.d0)
140  ratio( 3)=et*(2.d0*et-1.d0)
141  ratio( 4)=ze*(2.d0*ze-1.d0)
142  ratio( 5)=4.d0*xi*a
143  ratio( 6)=4.d0*xi*et
144  ratio( 7)=4.d0*et*a
145  ratio( 8)=4.d0*ze*a
146  ratio( 9)=4.d0*xi*ze
147  ratio(10)=4.d0*et*ze
148  elseif(nterms.eq.15) then
149  xi=(xig+1.d0)/2.d0
150  et=(etg+1.d0)/2.d0
151  if(xi+et.gt.1.d0) then
152  dummy=xi
153  xi=1.d0-et
154  et=1.d0-dummy
155  endif
156 !
157  ze=zeg
158  a=1.d0-xi-et
159 !
160 ! shape functions
161 !
162  ratio(1)=-0.5*a*(1.0-ze)*(2.0*xi+2.0*et+ze)
163  ratio(2)=0.5*xi*(1.0-ze)*(2.0*xi-2.0-ze)
164  ratio(3)=0.5*et*(1.0-ze)*(2.0*et-2.0-ze)
165  ratio(4)=-0.5*a*(1.0+ze)*(2.0*xi+2.0*et-ze)
166  ratio(5)=0.5*xi*(1.0+ze)*(2.0*xi-2.0+ze)
167  ratio(6)=0.5*et*(1.0+ze)*(2.0*et-2.0+ze)
168  ratio(7)=2.0*xi*a*(1.0-ze)
169  ratio(8)=2.0*xi*et*(1.0-ze)
170  ratio(9)=2.0*et*a*(1.0-ze)
171  ratio(10)=2.0*xi*a*(1.0+ze)
172  ratio(11)=2.0*xi*et*(1.0+ze)
173  ratio(12)=2.0*et*a*(1.0+ze)
174  ratio(13)= a*(1.0-ze*ze)
175  ratio(14)=xi*(1.0-ze*ze)
176  ratio(15)=et*(1.0-ze*ze)
177  elseif(nterms.eq.20) then
178  xi=xig
179  et=etg
180  ze=zeg
181 !
182  omg=1.d0-xi
183  omh=1.d0-et
184  omr=1.d0-ze
185  opg=1.d0+xi
186  oph=1.d0+et
187  opr=1.d0+ze
188  tpgphpr=opg+oph+ze
189  tmgphpr=omg+oph+ze
190  tmgmhpr=omg+omh+ze
191  tpgmhpr=opg+omh+ze
192  tpgphmr=opg+oph-ze
193  tmgphmr=omg+oph-ze
194  tmgmhmr=omg+omh-ze
195  tpgmhmr=opg+omh-ze
196  omgopg=omg*opg/4.d0
197  omhoph=omh*oph/4.d0
198  omropr=omr*opr/4.d0
199  omgmopg=(omg-opg)/4.d0
200  omhmoph=(omh-oph)/4.d0
201  omrmopr=(omr-opr)/4.d0
202 !
203 ! shape functions
204 !
205  ratio( 1)=-omg*omh*omr*tpgphpr/8.d0
206  ratio( 2)=-opg*omh*omr*tmgphpr/8.d0
207  ratio( 3)=-opg*oph*omr*tmgmhpr/8.d0
208  ratio( 4)=-omg*oph*omr*tpgmhpr/8.d0
209  ratio( 5)=-omg*omh*opr*tpgphmr/8.d0
210  ratio( 6)=-opg*omh*opr*tmgphmr/8.d0
211  ratio( 7)=-opg*oph*opr*tmgmhmr/8.d0
212  ratio( 8)=-omg*oph*opr*tpgmhmr/8.d0
213  ratio( 9)=omgopg*omh*omr
214  ratio(10)=omhoph*opg*omr
215  ratio(11)=omgopg*oph*omr
216  ratio(12)=omhoph*omg*omr
217  ratio(13)=omgopg*omh*opr
218  ratio(14)=omhoph*opg*opr
219  ratio(15)=omgopg*oph*opr
220  ratio(16)=omhoph*omg*opr
221  ratio(17)=omropr*omg*omh
222  ratio(18)=omropr*opg*omh
223  ratio(19)=omropr*opg*oph
224  ratio(20)=omropr*omg*oph
225  else
226  write(*,*) '*ERROR in distattach: case with ',nterms
227  write(*,*) ' terms is not covered'
228  call exit(201)
229  endif
230 !
231 ! calculating the position in the face
232 !
233  do i=1,3
234  p(i)=0.d0
235  do j=1,nterms
236  p(i)=p(i)+ratio(j)*pneigh(i,j)
237  enddo
238  enddo
239 !
240 ! calculating the distance
241 !
242  a=(pnode(1)-p(1))**2+(pnode(2)-p(2))**2+(pnode(3)-p(3))**2
243 !
244  return
subroutine dsort(dx, iy, n, kflag)
Definition: dsort.f:6
Hosted by OpenAircraft.com, (Michigan UAV, LLC)