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

Go to the source code of this file.

Functions/Subroutines

subroutine shape9q (xi, et, xl, xsj, xs, shp, iflag)
 

Function/Subroutine Documentation

◆ shape9q()

subroutine shape9q ( real*8, intent(in)  xi,
real*8, intent(in)  et,
real*8, dimension(3,9), intent(in)  xl,
real*8, dimension(3), intent(out)  xsj,
real*8, dimension(3,7), intent(out)  xs,
real*8, dimension(7,9), intent(out)  shp,
integer, intent(in)  iflag 
)
20 !
21 ! shape functions and derivatives for a 9-node quadratic
22 ! isoparametric quadrilateral element. -1<=xi,et<=1
23 !
24 ! iflag=1: calculate only the value of the shape functions
25 ! iflag=2: calculate the value of the shape functions,
26 ! their derivatives w.r.t. the local coordinates
27 ! and the Jacobian vector (local normal to the
28 ! surface)
29 ! iflag=3: calculate the value of the shape functions, the
30 ! value of their derivatives w.r.t. the global
31 ! coordinates and the Jacobian vector (local normal
32 ! to the surface)
33 ! iflag=4: calculate the value of the shape functions, the
34 ! value of their 1st and 2nd order derivatives
35 ! w.r.t. the local coordinates, the Jacobian vector
36 ! (local normal to the surface)
37 !
38  implicit none
39 !
40  integer i,j,k,iflag
41 !
42  real*8 shp(7,9),xs(3,7),xsi(2,3),xl(3,9),sh(3),xsj(3),xi,et,
43  & fxi1,fxi2,fxi3,fet1,fet2,fet3,dfxi1,dfxi2,dfxi3,dfet1,dfet2,
44  & dfet3,ddfxi1,ddfxi2,ddfxi3,ddfet1,ddfet2,ddfet3
45 !
46  intent(in) xi,et,xl,iflag
47 !
48  intent(out) shp,xs,xsj
49 !
50 ! shape functions and their glocal derivatives for an element
51 ! described with two local parameters and three global ones.
52 !
53 ! shape functions in one dimension
54 !
55  fxi1=xi*(xi-1.d0)/2.d0
56  fxi2=(1.d0-xi)*(1.d0+xi)
57  fxi3=xi*(xi+1.d0)/2.d0
58 !
59  fet1=et*(et-1.d0)/2.d0
60  fet2=(1.d0-et)*(1.d0+et)
61  fet3=et*(et+1.d0)/2.d0
62 !
63 ! shape functions
64 !
65  shp(4,1)=fxi1*fet1
66  shp(4,2)=fxi3*fet1
67  shp(4,3)=fxi3*fet3
68  shp(4,4)=fxi1*fet3
69  shp(4,5)=fxi2*fet1
70  shp(4,6)=fxi3*fet2
71  shp(4,7)=fxi2*fet3
72  shp(4,8)=fxi1*fet2
73  shp(4,9)=fxi2*fet2
74 !
75  if(iflag.eq.1) return
76 !
77 ! derivative of the shape functions in one dimension
78 !
79  dfxi1=(2.d0*xi-1.d0)/2.d0
80  dfxi2=-2.d0*xi
81  dfxi3=(2.d0*xi+1.d0)/2.d0
82 !
83  dfet1=(2.d0*et-1.d0)/2.d0
84  dfet2=-2.d0*et
85  dfet3=(2.d0*et+1.d0)/2.d0
86 !
87 ! local derivatives of the shape functions: xi-derivative
88 !
89  shp(1,1)=dfxi1*fet1
90  shp(1,2)=dfxi3*fet1
91  shp(1,3)=dfxi3*fet3
92  shp(1,4)=dfxi1*fet3
93  shp(1,5)=dfxi2*fet1
94  shp(1,6)=dfxi3*fet2
95  shp(1,7)=dfxi2*fet3
96  shp(1,8)=dfxi1*fet2
97  shp(1,9)=dfxi2*fet2
98 !
99 ! local derivatives of the shape functions: eta-derivative
100 !
101  shp(2,1)=fxi1*dfet1
102  shp(2,2)=fxi3*dfet1
103  shp(2,3)=fxi3*dfet3
104  shp(2,4)=fxi1*dfet3
105  shp(2,5)=fxi2*dfet1
106  shp(2,6)=fxi3*dfet2
107  shp(2,7)=fxi2*dfet3
108  shp(2,8)=fxi1*dfet2
109  shp(2,9)=fxi2*dfet2
110 !
111 ! computation of the local derivative of the global coordinates
112 ! (xs)
113 !
114  do i=1,3
115  do j=1,2
116  xs(i,j)=0.d0
117  do k=1,9
118  xs(i,j)=xs(i,j)+xl(i,k)*shp(j,k)
119  enddo
120  enddo
121  enddo
122 !
123 ! computation of the jacobian vector
124 !
125  xsj(1)=xs(2,1)*xs(3,2)-xs(3,1)*xs(2,2)
126  xsj(2)=xs(1,2)*xs(3,1)-xs(3,2)*xs(1,1)
127  xsj(3)=xs(1,1)*xs(2,2)-xs(2,1)*xs(1,2)
128 !
129  if(iflag.eq.3) then
130 !
131 ! computation of the global derivative of the local coordinates
132 ! (xsi) (inversion of xs)
133 !
134  if(dabs(xsj(3)).gt.1.d-10) then
135  xsi(1,1)=xs(2,2)/xsj(3)
136  xsi(2,2)=xs(1,1)/xsj(3)
137  xsi(1,2)=-xs(1,2)/xsj(3)
138  xsi(2,1)=-xs(2,1)/xsj(3)
139  if(dabs(xsj(2)).gt.1.d-10) then
140  xsi(2,3)=xs(1,1)/(-xsj(2))
141  xsi(1,3)=-xs(1,2)/(-xsj(2))
142  elseif(dabs(xsj(1)).gt.1.d-10) then
143  xsi(2,3)=xs(2,1)/xsj(1)
144  xsi(1,3)=-xs(2,2)/xsj(1)
145  else
146  xsi(2,3)=0.d0
147  xsi(1,3)=0.d0
148  endif
149  elseif(dabs(xsj(2)).gt.1.d-10) then
150  xsi(1,1)=xs(3,2)/(-xsj(2))
151  xsi(2,3)=xs(1,1)/(-xsj(2))
152  xsi(1,3)=-xs(1,2)/(-xsj(2))
153  xsi(2,1)=-xs(3,1)/(-xsj(2))
154  if(dabs(xsj(1)).gt.1.d-10) then
155  xsi(1,2)=xs(3,2)/xsj(1)
156  xsi(2,2)=-xs(3,1)/xsj(1)
157  else
158  xsi(1,2)=0.d0
159  xsi(2,2)=0.d0
160  endif
161  else
162  xsi(1,2)=xs(3,2)/xsj(1)
163  xsi(2,3)=xs(2,1)/xsj(1)
164  xsi(1,3)=-xs(2,2)/xsj(1)
165  xsi(2,2)=-xs(3,1)/xsj(1)
166  xsi(1,1)=0.d0
167  xsi(2,1)=0.d0
168  endif
169 !
170 ! computation of the global derivatives of the shape functions
171 !
172  do k=1,9
173  do j=1,3
174  sh(j)=shp(1,k)*xsi(1,j)+shp(2,k)*xsi(2,j)
175  enddo
176  do j=1,3
177  shp(j,k)=sh(j)
178  enddo
179  enddo
180 !
181  elseif(iflag.eq.4) then
182 !
183 ! second derivative of the shape functions in one dimension
184 !
185  ddfxi1=1.d0
186  ddfxi2=-2.d0
187  ddfxi3=1.d0
188 !
189  ddfet1=1.d0
190  ddfet2=-2.d0
191  ddfet3=1.d0
192 !
193 ! local 2nd order derivatives of the shape functions: xi,xi-derivative
194 !
195  shp(5,1)=ddfxi1*fet1
196  shp(5,2)=ddfxi3*fet1
197  shp(5,3)=ddfxi3*fet3
198  shp(5,4)=ddfxi1*fet3
199  shp(5,5)=ddfxi2*fet1
200  shp(5,6)=ddfxi3*fet2
201  shp(5,7)=ddfxi2*fet3
202  shp(5,8)=ddfxi1*fet2
203  shp(5,9)=ddfxi2*fet2
204 !
205 ! local 2nd order derivatives of the shape functions: xi,eta-derivative
206 !
207  shp(6,1)=dfxi1*dfet1
208  shp(6,2)=dfxi3*dfet1
209  shp(6,3)=dfxi3*dfet3
210  shp(6,4)=dfxi1*dfet3
211  shp(6,5)=dfxi2*dfet1
212  shp(6,6)=dfxi3*dfet2
213  shp(6,7)=dfxi2*dfet3
214  shp(6,8)=dfxi1*dfet2
215  shp(6,9)=dfxi2*dfet2
216 !
217 ! local 2nd order derivatives of the shape functions: eta,eta-derivative
218 !
219  shp(7,1)=fxi1*ddfet1
220  shp(7,2)=fxi3*ddfet1
221  shp(7,3)=fxi3*ddfet3
222  shp(7,4)=fxi1*ddfet3
223  shp(7,5)=fxi2*ddfet1
224  shp(7,6)=fxi3*ddfet2
225  shp(7,7)=fxi2*ddfet3
226  shp(7,8)=fxi1*ddfet2
227  shp(7,9)=fxi2*ddfet2
228 !
229 ! computation of the local 2nd derivatives of the global coordinates
230 ! (xs)
231 !
232  do i=1,3
233  do j=5,7
234  xs(i,j)=0.d0
235  do k=1,9
236  xs(i,j)=xs(i,j)+xl(i,k)*shp(j,k)
237  enddo
238  enddo
239  enddo
240  endif
241 !
242  return
Hosted by OpenAircraft.com, (Michigan UAV, LLC)