Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
v3d4n_nl.f90
Go to the documentation of this file.
1 !*********************************************************************
2 !* Illinois Open Source License *
3 !* *
4 !* University of Illinois/NCSA *
5 !* Open Source License *
6 !* *
7 !* Copyright@2008, University of Illinois. All rights reserved. *
8 !* *
9 !* Developed by: *
10 !* *
11 !* Center for Simulation of Advanced Rockets *
12 !* *
13 !* University of Illinois *
14 !* *
15 !* www.csar.uiuc.edu *
16 !* *
17 !* Permission is hereby granted, free of charge, to any person *
18 !* obtaining a copy of this software and associated documentation *
19 !* files (the "Software"), to deal with the Software without *
20 !* restriction, including without limitation the rights to use, *
21 !* copy, modify, merge, publish, distribute, sublicense, and/or *
22 !* sell copies of the Software, and to permit persons to whom the *
23 !* Software is furnished to do so, subject to the following *
24 !* conditions: *
25 !* *
26 !* *
27 !* @ Redistributions of source code must retain the above copyright *
28 !* notice, this list of conditions and the following disclaimers. *
29 !* *
30 !* @ Redistributions in binary form must reproduce the above *
31 !* copyright notice, this list of conditions and the following *
32 !* disclaimers in the documentation and/or other materials *
33 !* provided with the distribution. *
34 !* *
35 !* @ Neither the names of the Center for Simulation of Advanced *
36 !* Rockets, the University of Illinois, nor the names of its *
37 !* contributors may be used to endorse or promote products derived *
38 !* from this Software without specific prior written permission. *
39 !* *
40 !* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
41 !* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
42 !* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
43 !* NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
44 !* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
45 !* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
46 !* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
47 !* USE OR OTHER DEALINGS WITH THE SOFTWARE. *
48 !*********************************************************************
49 !* Please acknowledge The University of Illinois Center for *
50 !* Simulation of Advanced Rockets in works and publications *
51 !* resulting from this software or its derivatives. *
52 !*********************************************************************
53 SUBROUTINE v3d4n_nl(numnp, numel, coor, disp, nodes, Rnet,&
54  numelneigh, elconn, alpha, ahat,nummatvol, &
55  xmu,xlambda)
56 
57 !!****f* Rocfrac/Source/v3d4n_nl.f90
58 !!
59 !! NAME
60 !! v3d4n_nl
61 !!
62 !! FUNCTION
63 !!
64 !! Computes the internal force vector for a 4-node tetrahedral
65 !! NODE BASED ELEMENT for finite deformations.
66 !!
67 !! INPUTS
68 !!
69 !! NumNP -- Number of nodes
70 !! NumEL -- Number of elements
71 !! coor -- number of coordinates
72 !! disp -- Nodal Displacement
73 !! nodes -- Nodal connectivity
74 !! NumElNeigh -- Number of elements in contact with node
75 !! ElConn -- Element connectivity
76 !! alpha -- volume ratio
77 !! Ahat -- undeformed volume of node
78 !! NumMatVol -- number of materials
79 !! xmu -- material parameter
80 !! xlambda -- material parameter
81 !!
82 !! OUTPUT
83 !!
84 !! Rnet -- internal force vector
85 !!
86 !!****
87 
88 ! nprocs,TotNumNdComm,TotNumNeighProcs,NeighProcList,NumNdComm,neigh_lst,&
89 ! MPI_STATUS_SIZE,MPI_COMM_ROCFRAC,MPI_DOUBLE_PRECISION, &
90 ! ReqRcv,ReqSnd,StatRcv, StatSnd)
91 
93 
94  IMPLICIT NONE
95  integer :: nummatvol
96  INTEGER :: numnp, numel
97  REAL*8, DIMENSION(1:NumMatVol) :: xmu, xlambda
98  REAL*8, DIMENSION(1:numnp) :: ahat
99  REAL*8, DIMENSION(1:3*numnp) :: disp, rnet
100  REAL*8, DIMENSION(1:3,1:numnp) :: coor
101  INTEGER, DIMENSION(1:numnp) ::numelneigh
102  INTEGER, DIMENSION(1:numnp,1:40) :: elconn ! fix 40 should not be hard coded
103  INTEGER,DIMENSION(1:4,1:numel) :: nodes
104  REAL*8, DIMENSION(1:4,1:numel) :: alpha
105  REAL*8, DIMENSION(1:numnp) :: s11n, s22n, s33n, s12n, s13n,s23n
106 
107 ! Fix, not parallel
108 
109 
110  INTEGER :: i,k,j
111  REAL*8 :: aaa
112 !-- coordinate holding variable
113  REAL*8 :: x1,x2,x3,x4,y1,y2,y3,y4,z1,z2,z3,z4
114  REAL*8 :: x1d,x2d,x3d,x4d,y1d,y2d,y3d,y4d,z1d,z2d,z3d,z4d
115  INTEGER :: k1n1,k1n2,k1n3,k1n4,k2n1,k2n2,k2n3,k2n4
116  INTEGER :: k3n1,k3n2,k3n3,k3n4
117 
118  REAL*8 :: ahatinv
119  INTEGER :: ielnum
120 !-- x, y, and z displacements of nodes
121  REAL*8 :: u1,u2,u3,u4,v1,v2,v3,v4,w1,w2,w3,w4
122 !-- partial derivatives of the displacement
123  REAL*8 :: dudx,dvdy,dwdz,dudy,dvdx,dvdz,dwdy,dudz,dwdx
124 
125 !-- Coordinate subtractions
126  REAL*8 :: x14, x24, x34, y14, y24, y34, z14, z24, z34
127  REAL*8 :: x12, x13, y12, y13
128 !-- Added these to speed up B calculation
129 
130  REAL*8 :: z12, z13
131  REAL*8 :: c11, c12, c13, c21, c22, c23, c31, c32, c33
132  REAL*8 :: sh1, sh2, sh3, sh4, sh5, sh6, sh7, sh8, sh9, sh10, sh11, sh12
133  REAL*8 :: sh13, sh14, sh15
134 ! -- 6*volume and the volume
135  REAL*8 :: vx6
136 !-- spacial derivatives
137  REAL*8 :: b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12
138 !-- strains
139  REAL*8 :: e11,e22,e33,e12,e23,e13
140  REAL*8 :: b13, b14, b15
141  REAL*8 :: sums11n,sums22n,sums33n,sums12n,sums23n,sums13n
142  REAL*8 :: sume11n,sume22n,sume33n,sume12n,sume23n,sume13n
143 
144  REAL*8 :: e11n, e22n, e33n, e12n, e23n, e13n
145  INTEGER :: k3i,k2i,k1i
146  INTEGER :: ix
147  INTEGER :: n1, n2, n3, n4
148  REAL*8 :: volel, volel0,vx6inv,vol
149  REAL*8 :: s11e, s22e, s33e, s12e, s23e, s13e
150  REAL*8 :: vainv
151 
152  REAL*8 :: coeff1, coeff2
153  REAL*8 :: jacob
154  REAL*8 :: f11, f12, f13, f21, f22, f23, f31, f32, f33
155  REAL*8 :: vx6def, vx6invdef, voldef, vtotal
156 
157  DO i = 1, numnp ! for each node
158 
159 ! /* Undeformed Volume of node */
160 
161  vainv = 1.d0/ahat(i)
162 
163  ! /* Initialize to 0, Va, Va0, Fa */
164 
165  f11 = 0.d0
166  f22 = 0.d0
167  f33 = 0.d0
168  f12 = 0.d0
169  f13 = 0.d0
170  f21 = 0.d0
171  f23 = 0.d0
172  f31 = 0.d0
173  f32 = 0.d0
174 
175  voldef = 0.d0
176 
177  DO j = 1, numelneigh(i) ! for each element associated with node i
178 
179  ielnum = elconn(i,j)
180 
181  n1 = nodes(1,ielnum)
182  n2 = nodes(2,ielnum)
183  n3 = nodes(3,ielnum)
184  n4 = nodes(4,ielnum)
185 
186  IF(i.EQ.n1) THEN
187  ix = 1
188  ELSE IF(i.EQ.n2)THEN
189  ix = 2
190  ELSE IF(i.EQ.n3)THEN
191  ix = 3
192  ELSE IF(i.EQ.n4)THEN
193  ix = 4
194  ENDIF
195 
196  k3n1 = 3*n1
197  k3n2 = 3*n2
198  k3n3 = 3*n3
199  k3n4 = 3*n4
200 
201  k2n1 = k3n1 - 1
202  k2n2 = k3n2 - 1
203  k2n3 = k3n3 - 1
204  k2n4 = k3n4 - 1
205 
206  k1n1 = k3n1 - 2
207  k1n2 = k3n2 - 2
208  k1n3 = k3n3 - 2
209  k1n4 = k3n4 - 2
210 
211  ! k#n# dummy variables replaces:
212  u1 = disp(k1n1) ! (3*n1-2)
213  u2 = disp(k1n2) ! (3*n2-2)
214  u3 = disp(k1n3) ! (3*n3-2)
215  u4 = disp(k1n4) ! (3*n4-2)
216  v1 = disp(k2n1) ! (3*n1-1)
217  v2 = disp(k2n2) ! (3*n2-1)
218  v3 = disp(k2n3) ! (3*n3-1)
219  v4 = disp(k2n4) ! (3*n4-1)
220  w1 = disp(k3n1) ! (3*n1)
221  w2 = disp(k3n2) ! (3*n2)
222  w3 = disp(k3n3) ! (3*n3)
223  w4 = disp(k3n4) ! (3*n4)
224 
225  x1 = coor(1,n1)
226  x2 = coor(1,n2)
227  x3 = coor(1,n3)
228  x4 = coor(1,n4)
229  y1 = coor(2,n1)
230  y2 = coor(2,n2)
231  y3 = coor(2,n3)
232  y4 = coor(2,n4)
233  z1 = coor(3,n1)
234  z2 = coor(3,n2)
235  z3 = coor(3,n3)
236  z4 = coor(3,n4)
237 
238  x12 = x1 - x2 ! not used in vol. calc
239  x13 = x1 - x3 ! not used in vol. calc
240  x14 = x1 - x4
241  x24 = x2 - x4
242  x34 = x3 - x4
243  y12 = y1 - y2 ! not used in vol. calc
244  y13 = y1 - y3 ! not used in vol. calc
245  y14 = y1 - y4
246  y24 = y2 - y4
247  y34 = y3 - y4
248  z12 = z1 - z2 ! not used in vol. calc
249  z13 = z1 - z3 ! not used in vol. calc
250  z14 = z1 - z4
251  z24 = z2 - z4
252  z34 = z3 - z4
253 
254  c11 = y24*z34 - z24*y34
255  c21 = -( x24*z34 - z24*x34 )
256  c31 = x24*y34 - y24*x34
257 
258  vx6 = -( x14*c11 + y14*c21 + z14*c31 )
259 
260  vx6inv = 1.d0/vx6
261 
262  volel0 = vx6/6.d0 ! undeformed volume of element (Ve_O)
263 
264 ! Compute the Shape functions
265 ! NOTE: Factored for a more equivalent/compact form then maple's
266 
267  b1 = (y34*z24 - y24*z34) * vx6inv
268  b2 = (z34*x24 - z24*x34) * vx6inv
269  b3 = (x34*y24 - x24*y34) * vx6inv
270  b4 = (y13*z14 - y14*z13) * vx6inv
271  b5 = (z13*x14 - z14*x13) * vx6inv
272  b6 = (x13*y14 - x14*y13) * vx6inv
273  b7 = (y14*z12 - y12*z14) * vx6inv
274  b8 = (z14*x12 - z12*x14) * vx6inv
275  b9 = (x14*y12 - x12*y14) * vx6inv
276  b10 = (y12*z13 - y13*z12) * vx6inv
277  b11 = (z12*x13 - z13*x12) * vx6inv
278  b12 = (x12*y13 - x13*y12) * vx6inv
279 !
280 ! deformation gradients F
281 !
282  f11 = f11 + alpha(ix,ielnum)*volel0*(1.d0 + ( b1*u1 + b4*u2 + b7*u3 + b10*u4 )) ! 1 + ( dudx )
283  f22 = f22 + alpha(ix,ielnum)*volel0*(1.d0 + ( b2*v1 + b5*v2 + b8*v3 + b11*v4 )) ! 1 + ( dvdy )
284  f33 = f33 + alpha(ix,ielnum)*volel0*(1.d0 + ( b3*w1 + b6*w2 + b9*w3 + b12*w4 )) ! 1 + ( dwdz )
285  f12 = f12 + alpha(ix,ielnum)*volel0*(b2*u1 + b5*u2 + b8*u3 + b11*u4) ! dudy
286  f21 = f21 + alpha(ix,ielnum)*volel0*(b1*v1 + b4*v2 + b7*v3 + b10*v4) ! dvdx
287  f23 = f23 + alpha(ix,ielnum)*volel0*(b3*v1 + b6*v2 + b9*v3 + b12*v4) ! dvdz
288  f32 = f32 + alpha(ix,ielnum)*volel0*(b2*w1 + b5*w2 + b8*w3 + b11*w4) ! dwdy
289  f13 = f13 + alpha(ix,ielnum)*volel0*(b3*u1 + b6*u2 + b9*u3 + b12*u4) ! dudz
290  f31 = f31 + alpha(ix,ielnum)*volel0*(b1*w1 + b4*w2 + b7*w3 + b10*w4) ! dwdx
291 
292  ENDDO
293 
294  f11 = f11*vainv
295  f22 = f22*vainv
296  f33 = f33*vainv
297  f12 = f12*vainv
298  f13 = f13*vainv
299  f21 = f21*vainv
300  f23 = f23*vainv
301  f31 = f31*vainv
302  f32 = f32*vainv
303 ! should this be before divide by volume
304  jacob = f11*(f22*f33-f23*f32)+f12*(f31*f23-f21*f33)+f13*(-f31*f22+f21*f32)
305 
306 ! Jacob = voldef*VaInv
307 
308  IF( jacob.LE.0.d0) THEN
309  WRITE(*,100) i
310  stop
311  ENDIF
312 !
313 ! Compressible Neo-Hookean Material
314 ! Eq. (5.29)
315 
316  coeff1 = xmu(1)/jacob
317  coeff2 = xlambda(1)/jacob*log(jacob)
318 
319  s11n(i) = coeff1*(f11**2+f12**2+f13**2-1.d0) + coeff2
320  s12n(i) = coeff1*(f21*f11+f12*f22+f13*f23)
321  s13n(i) = coeff1*(f31*f11+f12*f32+f13*f33)
322  s22n(i) = coeff1*(f21**2+f22**2+f23**2-1.d0) + coeff2
323  s23n(i) = coeff1*(f21*f31+f32*f22+f23*f33)
324  s33n(i) = coeff1*(f31**2+f32**2+f33**2-1.d0) + coeff2
325 
326  ENDDO
327 
328  DO ielnum = 1, numel ! For each element
329 
330  n1 = nodes(1,ielnum)
331  n2 = nodes(2,ielnum)
332  n3 = nodes(3,ielnum)
333  n4 = nodes(4,ielnum)
334 
335  k3n1 = 3*n1
336  k3n2 = 3*n2
337  k3n3 = 3*n3
338  k3n4 = 3*n4
339 
340  k2n1 = k3n1 - 1
341  k2n2 = k3n2 - 1
342  k2n3 = k3n3 - 1
343  k2n4 = k3n4 - 1
344 
345  k1n1 = k3n1 - 2
346  k1n2 = k3n2 - 2
347  k1n3 = k3n3 - 2
348  k1n4 = k3n4 - 2
349 
350  ! k#n# dummy variables replaces:
351  u1 = disp(k1n1) ! (3*n1-2)
352  u2 = disp(k1n2) ! (3*n2-2)
353  u3 = disp(k1n3) ! (3*n3-2)
354  u4 = disp(k1n4) ! (3*n4-2)
355  v1 = disp(k2n1) ! (3*n1-1)
356  v2 = disp(k2n2) ! (3*n2-1)
357  v3 = disp(k2n3) ! (3*n3-1)
358  v4 = disp(k2n4) ! (3*n4-1)
359  w1 = disp(k3n1) ! (3*n1)
360  w2 = disp(k3n2) ! (3*n2)
361  w3 = disp(k3n3) ! (3*n3)
362  w4 = disp(k3n4) ! (3*n4)
363 
364  x1 = coor(1,n1)
365  x2 = coor(1,n2)
366  x3 = coor(1,n3)
367  x4 = coor(1,n4)
368  y1 = coor(2,n1)
369  y2 = coor(2,n2)
370  y3 = coor(2,n3)
371  y4 = coor(2,n4)
372  z1 = coor(3,n1)
373  z2 = coor(3,n2)
374  z3 = coor(3,n3)
375  z4 = coor(3,n4)
376 
377  x1 = x1 + u1
378  x2 = x2 + u2
379  x3 = x3 + u3
380  x4 = x4 + u4
381  y1 = y1 + v1
382  y2 = y2 + v2
383  y3 = y3 + v3
384  y4 = y4 + v4
385  z1 = z1 + w1
386  z2 = z2 + w2
387  z3 = z3 + w3
388  z4 = z4 + w4
389 
390  x12 = x1 - x2 ! not used in vol. calc
391  x13 = x1 - x3 ! not used in vol. calc
392  x14 = x1 - x4
393  x24 = x2 - x4
394  x34 = x3 - x4
395  y12 = y1 - y2 ! not used in vol. calc
396  y13 = y1 - y3 ! not used in vol. calc
397  y14 = y1 - y4
398  y24 = y2 - y4
399  y34 = y3 - y4
400  z12 = z1 - z2 ! not used in vol. calc
401  z13 = z1 - z3 ! not used in vol. calc
402  z14 = z1 - z4
403  z24 = z2 - z4
404  z34 = z3 - z4
405 
406  c11 = y24*z34 - z24*y34
407  c21 = -( x24*z34 - z24*x34 )
408  c31 = x24*y34 - y24*x34
409 
410  vx6def = -( x14*c11 + y14*c21 + z14*c31 )
411 
412  vx6invdef = 1.d0 / vx6def
413 
414 ! calculate the volume
415  voldef = vx6def/6.d0
416 
417  IF(vx6def.LE.0.d0) THEN
418  WRITE(*,100) i
419  stop
420  ENDIF
421 
422  ! equation (14)
423 
424  s11e = 0.d0
425  s22e = 0.d0
426  s33e = 0.d0
427  s12e = 0.d0
428  s23e = 0.d0
429  s13e = 0.d0
430 
431  DO k = 1, 4
432  s11e = s11e + alpha(k,ielnum)*s11n(nodes(k,ielnum))
433  s22e = s22e + alpha(k,ielnum)*s22n(nodes(k,ielnum))
434  s33e = s33e + alpha(k,ielnum)*s33n(nodes(k,ielnum))
435  s12e = s12e + alpha(k,ielnum)*s12n(nodes(k,ielnum))
436  s23e = s23e + alpha(k,ielnum)*s23n(nodes(k,ielnum))
437  s13e = s13e + alpha(k,ielnum)*s13n(nodes(k,ielnum))
438  ENDDO
439 
440  sh1 = (y34*z24 - y24*z34) * vx6invdef
441  sh2 = (z34*x24 - z24*x34) * vx6invdef
442  sh3 = (x34*y24 - x24*y34) * vx6invdef
443  sh4 = (y13*z14 - y14*z13) * vx6invdef
444  sh5 = (z13*x14 - z14*x13) * vx6invdef
445  sh6 = (x13*y14 - x14*y13) * vx6invdef
446  sh7 = (y14*z12 - y12*z14) * vx6invdef
447  sh8 = (z14*x12 - z12*x14) * vx6invdef
448  sh9 = (x14*y12 - x12*y14) * vx6invdef
449  sh10 = (y12*z13 - y13*z12) * vx6invdef
450  sh11 = (z12*x13 - z13*x12) * vx6invdef
451  sh12 = (x12*y13 - x13*y12) * vx6invdef
452 
453 ! ASSEMBLE THE INTERNAL FORCE VECTOR
454 !
455 ! local node 1
456  rnet(k1n1) = rnet(k1n1) - voldef* &
457  ( s11e*sh1 + s12e*sh2 + s13e*sh3 )
458  rnet(k2n1) = rnet(k2n1) - voldef* &
459  ( s12e*sh1 + s22e*sh2 + s23e*sh3 )
460  rnet(k3n1) = rnet(k3n1) - voldef* &
461  ( s13e*sh1 + s23e*sh2 + s33e*sh3 )
462 ! local node 2
463  rnet(k1n2) = rnet(k1n2) - voldef* &
464  ( s11e*sh4 + s12e*sh5 + s13e*sh6 )
465  rnet(k2n2) = rnet(k2n2) - voldef* &
466  ( s12e*sh4 + s22e*sh5 + s23e*sh6 )
467  rnet(k3n2) = rnet(k3n2) - voldef* &
468  ( s13e*sh4 + s23e*sh5 + s33e*sh6 )
469 ! local node 3
470  rnet(k1n3) = rnet(k1n3) - voldef* &
471  ( s11e*sh7 + s12e*sh8 + s13e*sh9 )
472  rnet(k2n3) = rnet(k2n3) - voldef* &
473  ( s12e*sh7 + s22e*sh8 + s23e*sh9 )
474  rnet(k3n3) = rnet(k3n3) - voldef* &
475  ( s13e*sh7 + s23e*sh8 + s33e*sh9 )
476 ! local node 4
477  rnet(k1n4) = rnet(k1n4) - voldef* &
478  ( s11e*sh10 + s12e*sh11 + s13e*sh12 )
479  rnet(k2n4) = rnet(k2n4) - voldef* &
480  ( s12e*sh10 + s22e*sh11 + s23e*sh12 )
481  rnet(k3n4) = rnet(k3n4) - voldef* &
482  ( s13e*sh10 + s23e*sh11 + s33e*sh12 )
483 
484  ENDDO
485 
486  RETURN
487 100 FORMAT(' Negative Jacobian for element: ',i10)
488 
489 END SUBROUTINE v3d4n_nl
490 
j indices k indices k
Definition: Indexing.h:6
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6
unsigned char alpha() const
Definition: Color.h:75
subroutine v3d4n_nl(numnp, numel, coor, disp, nodes, Rnet, NumElNeigh, ElConn, alpha, Ahat, NumMatVol, xmu, xlambda)
Definition: v3d4n_nl.f90:53