-
Notifications
You must be signed in to change notification settings - Fork 5
/
kcurlET.f
175 lines (137 loc) · 5.11 KB
/
kcurlET.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
C STRAIN GRADIENTS
C *******************************************************************************
C * Compute Curl of a 2nd order tensor *
C * As a vector, curl of row written in corresponding column *
C * Full integration *
C *******************************************************************************
SUBROUTINE kcurlET(curlFp,Fp,xnat,gauss,gausscoords)
INCLUDE 'ABA_PARAM.INC'
integer, parameter:: nnodes=8
!scalars
real*8,intent(out) :: curlFP(8,9)
!arrays gauss is gauss coordinates of isoparametric element in (s1,s2,s3) space
real*8,intent(in) :: xnat(nnodes,3),gauss(nnodes,3),
+ gausscoords(3,nnodes), Fp(8,9)
real*8 :: J(3,3),Jinv(3,3),dNds(nnodes,3),dndx(nnodes,3),
+ fnode(3,nnodes), fmat1(3,3),dmout(3,3),N(nnodes), z(3)
!Extrapolation arrays
real*8 :: z11i(nnodes),z11n(nnodes),z12i(nnodes),z12n(nnodes),
+ z13i(nnodes),z13n(nnodes),z21i(nnodes),z21n(nnodes),z22i(nnodes),
+ z22n(nnodes),z23i(nnodes),z23n(nnodes),z31i(nnodes),z31n(nnodes),
+ z32i(nnodes),z32n(nnodes),z33i(nnodes),z33n(nnodes),
+ Nmat(nnodes,nnodes),xnmatI(nnodes,nnodes)
real(kind=8):: ri,si,ti,gr,gs,gt,dgr,dgs,dgt,xgauss
fnode = 0.;fmat1 = 0.;Nmat=0.;xnmatI=0.
z11i=0.;z11n=0.;z12i=0.;z12n=0.;z13i=0.;z13n=0.
z21i=0.;z21n=0.;z22i=0.;z22n=0.;z23i=0.;z23n=0.
z31i=0.;z31n=0.;z32i=0.;z32n=0.;z33i=0.;z33n=0.
C
C USE EIGHT GAUSS POINT FOR GRADIENTS
C
C LOOP OVER EIGHT INTEGRATION POINTS
! Evaluate curlT at the integration points, and simultaneously populate Nmat which will be later inverted for extrapolation purposes.
do kint2 = 1,8
C SPECIFY z - INTEGRATION POINT
z = gauss(kint2,1:3)
C SHAPE FUNCTIONS AND DERIVATIVES
do i = 1,nnodes
ri = xnat(i,1)
si = xnat(i,2)
ti = xnat(i,3)
!---------------------------
gr = 0.5*(1. + ri*z(1))
dgr = 0.5*ri
!---------------------------
gs = 0.5*(1.+si*z(2))
dgs = 0.5*si
!---------------------------
gt = 0.5*(1.+ti*z(3))
dgt = 0.5*ti
!---------------------------
N(i) = gr*gs*gt
!---------------------------
dNds(i, 1) = dgr*gs*gt ! dnds1(i)
dNds(i, 2) = gr*dgs*gt ! dnds2(i)
dNds(i, 3) = gr*gs*dgt ! dnds3(i)
end do
Nmat(kint2,:) = N
C
C SET UP JACOBIAN
C
J = matmul(gausscoords,dNds)
C AND ITS INVERSE
C
call KDETER(J,det)
if (abs(det) <= 1.0e-6 .or. det /= det) then !last part true if det=NaN
dmout = 0.0
else
call lapinverse(J,3,info,Jinv)
if(info /= 0) then
write(6,*) "inverse failure: J in kcurl"
end if
C
dndx = matmul(dNds,Jinv)
C
C DETERMINE first column of curlf: Read row, to determine column.
C
C
fnode(1:3, 1:8) = transpose(Fp(1:8,1:3))
fmat1 = matmul(fnode,dndx)
!Curlfp at integeration points
z11i(kint2) = fmat1(3,2) - fmat1(2,3)
z21i(kint2) = fmat1(1,3) - fmat1(3,1)
z31i(kint2) = fmat1(2,1) - fmat1(1,2)
C
C DETERMINE second column of curlf
C
C
fnode(1:3, 1:8) = transpose(Fp(1:8,4:6))
fmat1 = matmul(fnode,dndx)
!Curlfp at integeration points
z12i(kint2) = fmat1(3,2) - fmat1(2,3)
z22i(kint2) = fmat1(1,3) - fmat1(3,1)
z32i(kint2) = fmat1(2,1) - fmat1(1,2)
C
C DETERMINE third column of curlf
C
C
fnode(1:3, 1:8) = transpose(Fp(1:8,7:9))
fmat1 = matmul(fnode,dndx)
!Curlfp at integeration points
z13i(kint2) = fmat1(3,2) - fmat1(2,3)
z23i(kint2) = fmat1(1,3) - fmat1(3,1)
z33i(kint2) = fmat1(2,1) - fmat1(1,2)
C
end if
end do !kint2
!All integration points done. Extrapolation begins
call lapinverse(Nmat,nnodes,info2,xnmatI)
if(info2 /= 0) then
write(6,*) "inverse failure: xnmat in kcurl"
end if
z11n = matmul(xnmatI,z11i)
z21n = matmul(xnmatI,z21i)
z31n = matmul(xnmatI,z31i)
z12n = matmul(xnmatI,z12i)
z22n = matmul(xnmatI,z22i)
z32n = matmul(xnmatI,z32i)
z13n = matmul(xnmatI,z13i)
z23n = matmul(xnmatI,z23i)
z33n = matmul(xnmatI,z33i)
!The storage is done by row.
do kint=1,nnodes
curlFp(kint,1) = z11n(kint)
curlFp(kint,2) = z12n(kint)
curlFp(kint,3) = z13n(kint)
curlFp(kint,4) = z21n(kint)
curlFp(kint,5) = z22n(kint)
curlFp(kint,6) = z23n(kint)
curlFp(kint,7) = z31n(kint)
curlFp(kint,8) = z32n(kint)
curlFp(kint,9) = z33n(kint)
end do !kint
C
RETURN
END
C
C