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

Go to the source code of this file.

Functions/Subroutines

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

Function/Subroutine Documentation

◆ shape4q()

subroutine shape4q ( real*8, intent(in)  xi,
real*8, intent(in)  et,
real*8, dimension(3,8), intent(in)  xl,
real*8, dimension(3), intent(out)  xsj,
real*8, dimension(3,7), intent(out)  xs,
real*8, dimension(7,4), intent(out)  shp,
integer, intent(in)  iflag 
)
20 !
21 ! iflag=1: calculate only the value of the shape functions
22 ! iflag=2: calculate the value of the shape functions,
23 ! their derivatives w.r.t. the local coordinates
24 ! and the Jacobian vector (local normal to the
25 ! surface)
26 ! iflag=3: calculate the value of the shape functions, the
27 ! value of their derivatives w.r.t. the global
28 ! coordinates and the Jacobian vector (local normal
29 ! to the surface)
30 ! iflag=4: calculate the value of the shape functions, the
31 ! value of their 1st and 2nd order derivatives
32 ! w.r.t. the local coordinates, the Jacobian vector
33 ! (local normal to the surface)
34 ! iflag=5: calculate the value of the shape functions and
35 ! their derivatives w.r.t. the local coordinates
36 !
37  implicit none
38 !
39  integer i,j,k,iflag
40 !
41  real*8 shp(7,4),xs(3,7),xsi(2,3),xl(3,8),sh(3),xsj(3),xi,et,
42  & xip,xim,etp,etm
43 !
44  intent(in) xi,et,xl,iflag
45 !
46  intent(out) shp,xs,xsj
47 !
48 ! shape functions and their glocal derivatives for an element
49 ! described with two local parameters and three global ones.
50 !
51  xip=1.d0+xi
52  xim=1.d0-xi
53  etp=1.d0+et
54  etm=1.d0-et
55 !
56 ! shape functions
57 !
58  shp(4,1)=xim*etm/4.d0
59  shp(4,2)=xip*etm/4.d0
60  shp(4,3)=xip*(etp)/4.d0
61  shp(4,4)=xim*(etp)/4.d0
62 !
63  if(iflag.eq.1) return
64 !
65 ! local derivatives of the shape functions: xi-derivative
66 !
67  shp(1,1)=-etm/4.d0
68  shp(1,2)=etm/4.d0
69  shp(1,3)=(etp)/4.d0
70  shp(1,4)=-(etp)/4.d0
71 !
72 ! local derivatives of the shape functions: eta-derivative
73 !
74  shp(2,1)=-xim/4.d0
75  shp(2,2)=-xip/4.d0
76  shp(2,3)=xip/4.d0
77  shp(2,4)=xim/4.d0
78 !
79  if(iflag.eq.5) return
80 !
81 ! computation of the local derivative of the global coordinates
82 ! (xs)
83 !
84  do i=1,3
85  do j=1,2
86  xs(i,j)=0.d0
87  do k=1,4
88  xs(i,j)=xs(i,j)+xl(i,k)*shp(j,k)
89  enddo
90  enddo
91  enddo
92 !
93 ! computation of the jacobian vector
94 !
95  xsj(1)=xs(2,1)*xs(3,2)-xs(3,1)*xs(2,2)
96  xsj(2)=xs(1,2)*xs(3,1)-xs(3,2)*xs(1,1)
97  xsj(3)=xs(1,1)*xs(2,2)-xs(2,1)*xs(1,2)
98 !
99  if(iflag.eq.3) then
100 !
101 ! computation of the global derivative of the local coordinates
102 ! (xsi) (inversion of xs)
103 !
104 c xsi(1,1)=xs(2,2)/xsj(3)
105 c xsi(2,1)=-xs(2,1)/xsj(3)
106 c xsi(1,2)=-xs(1,2)/xsj(3)
107 c xsi(2,2)=xs(1,1)/xsj(3)
108 c xsi(1,3)=-xs(2,2)/xsj(1)
109 c xsi(2,3)=xs(2,1)/xsj(1)
110  if(dabs(xsj(3)).gt.1.d-10) then
111  xsi(1,1)=xs(2,2)/xsj(3)
112  xsi(2,2)=xs(1,1)/xsj(3)
113  xsi(1,2)=-xs(1,2)/xsj(3)
114  xsi(2,1)=-xs(2,1)/xsj(3)
115  if(dabs(xsj(2)).gt.1.d-10) then
116  xsi(2,3)=xs(1,1)/(-xsj(2))
117  xsi(1,3)=-xs(1,2)/(-xsj(2))
118  elseif(dabs(xsj(1)).gt.1.d-10) then
119  xsi(2,3)=xs(2,1)/xsj(1)
120  xsi(1,3)=-xs(2,2)/xsj(1)
121  else
122  xsi(2,3)=0.d0
123  xsi(1,3)=0.d0
124  endif
125  elseif(dabs(xsj(2)).gt.1.d-10) then
126  xsi(1,1)=xs(3,2)/(-xsj(2))
127  xsi(2,3)=xs(1,1)/(-xsj(2))
128  xsi(1,3)=-xs(1,2)/(-xsj(2))
129  xsi(2,1)=-xs(3,1)/(-xsj(2))
130  if(dabs(xsj(1)).gt.1.d-10) then
131  xsi(1,2)=xs(3,2)/xsj(1)
132  xsi(2,2)=-xs(3,1)/xsj(1)
133  else
134  xsi(1,2)=0.d0
135  xsi(2,2)=0.d0
136  endif
137  else
138  xsi(1,2)=xs(3,2)/xsj(1)
139  xsi(2,3)=xs(2,1)/xsj(1)
140  xsi(1,3)=-xs(2,2)/xsj(1)
141  xsi(2,2)=-xs(3,1)/xsj(1)
142  xsi(1,1)=0.d0
143  xsi(2,1)=0.d0
144  endif
145 !
146 ! computation of the global derivatives of the shape functions
147 !
148  do k=1,4
149  do j=1,3
150  sh(j)=shp(1,k)*xsi(1,j)+shp(2,k)*xsi(2,j)
151  enddo
152  do j=1,3
153  shp(j,k)=sh(j)
154  enddo
155  enddo
156 !
157  elseif(iflag.eq.4) then
158 !
159 ! local 2nd order derivatives of the shape functions: xi,xi-derivative
160 !
161  shp(5,1)=0.d0
162  shp(5,2)=0.d0
163  shp(5,3)=0.d0
164  shp(5,4)=0.d0
165 !
166 ! local 2nd order derivatives of the shape functions: xi,eta-derivative
167 !
168  shp(6,1)=0.25d0
169  shp(6,2)=-0.25d0
170  shp(6,3)=0.25d0
171  shp(6,4)=-0.25d0
172 !
173 ! local 2nd order derivatives of the shape functions: eta,eta-derivative
174 !
175  shp(7,1)=0.d0
176  shp(7,2)=0.d0
177  shp(7,3)=0.d0
178  shp(7,4)=0.d0
179 !
180 ! computation of the local 2nd derivatives of the global coordinates
181 ! (xs)
182 !
183  do i=1,3
184  xs(i,5)=0.d0
185  xs(i,7)=0.d0
186  enddo
187  do i=1,3
188  xs(i,6)=0.d0
189  do k=1,4
190  xs(i,6)=xs(i,6)+xl(i,k)*shp(6,k)
191  enddo
192  enddo
193  endif
194 !
195  return
Hosted by OpenAircraft.com, (Michigan UAV, LLC)