Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TractPressLoad.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 tractpressload(R_ex,numnp, &
54  interfacesfnumelems, interfacesfnumnodes, &
55  interfacesfelemconn, &
56  mapnodesf,lwrbnd,uppbnd, coor, disp, mapsfelvolel,&
57  elconnvol,ieltype,numelvol,tractpress )
58 
59  IMPLICIT NONE
60 
61 ! Transforms the pressure given in the deformed state to
62 ! the undeformed configuration. This subroutine is for
63 ! the formulation where all quantities are with respect to
64 ! the undeformed configuration. Assumes the
65 ! pressure (tractions) are constant over the surface of
66 ! the triangle.
67 
68 ! 1-3 for 4 node tet (i.e. 3 node triangles)
69 ! 4-6 for 10 node tet (i.e. 6 node triangles, mid-side nodes get traction)
70 
71  INTEGER :: lwrbnd,uppbnd
72 
73  INTEGER :: ieltype,numelvol
74  INTEGER, DIMENSION(1:iElType,1:NumElVol) :: elconnvol
75 
76  INTEGER :: numnp ! number of nodes
77 
78  INTEGER :: interfacesfnumelems,interfacesfnumnodes
79  INTEGER, DIMENSION(1:UppBnd,1:InterfaceSFNumElems) :: interfacesfelemconn
80  INTEGER, DIMENSION(1:InterfaceSFNumNodes) :: mapnodesf
81  REAL*8, DIMENSION(1:3*NumNp) :: disp
82 
83  REAL*8, DIMENSION(1:3*numnp) :: r_ex ! external force
84 
85  INTEGER :: nx, ny, nz
86  INTEGER :: i,j,k
87 
88  INTEGER,DIMENSION(1:3) :: triconn
89  REAL*8,DIMENSION(1:3) :: uniftract
90 
91 ! mesh coordinates
92  REAL*8, DIMENSION(1:3,1:numnp) :: coor
93 
94  REAL*8 :: x0p,y0p,z0p
95  REAL*8 :: x1p,y1p,z1p
96  REAL*8 :: x2p,y2p,z2p
97  REAL*8 :: x3p,y3p,z3p
98 
99 ! Components sides vector
100 
101  REAL*8 :: x1x0, y1y0, z1z0
102  REAL*8 :: x2x0, y2y0, z2z0
103 
104  REAL*8 :: magnorm, area, at
105  REAL*8 :: gauss = 0.333333333333333d0
106  REAL*8 :: weight = 1.0d0
107  REAL*8 :: xnorm,ynorm,znorm
108  REAL*8 :: u1,v1,w1,u2,v2,w2,u3,v3,w3,u4,v4,w4
109  REAL*8 :: x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4
110  REAL*8 :: j11,j12,j13,j21,j22,j23
111  REAL*8 :: invdenjplus
112  REAL*8 :: jplus11, jplus12, jplus21, jplus22, jplus31, jplus32
113  REAL*8 :: gradu11, gradu12, gradu13, gradu21, gradu22, gradu23
114  REAL*8 :: gradu31, gradu32, gradu33
115  REAL*8 :: f11t,f12t,f13t,f21t,f22t,f23t,f31t,f32t,f33t
116  REAL*8 :: j1, undefnorm(1:3)
117  INTEGER :: idvol
118 
119  INTEGER :: n1,n2,n3,n4
120 ! -- dummy and counters
121  INTEGER :: k1n1,k1n2,k1n3,k1n4,k2n1,k2n2,k2n3,k2n4
122  INTEGER :: k3n1,k3n2,k3n3,k3n4
123  REAL*8 :: tractpress
124 !-- Coordinate subtractions
125  REAL*8 :: x14, x24, x34, y14, y24, y34, z14, z24, z34
126 !-- Coordinate subtractions: These are to speed up B calculation
127  REAL*8 :: x12, x13, y12, y13, z12, z13!--
128 
129  REAL*8 :: c11, c21, c31
130  REAL*8 :: vx6, vx6inv
131 !-- spacial derivatives
132  REAL*8 :: b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12
133 !-- partial derivatives of the displacement
134  REAL*8 :: dudx,dvdy,dwdz,dudy,dvdx,dvdz,dwdy,dudz,dwdx
135  INTEGER, DIMENSION(1:NumElVol) :: mapsfelvolel
136  REAL*8 :: jac3d
137  REAL*8 :: defnorm(1:3)
138  REAL*8 :: denfinvt,magnormdef,area0
139  REAL*8 :: f11,f12,f13,f21,f22,f23,f31,f32,f33
140  REAL*8 :: finvt11, finvt12, finvt13, finvt21, finvt22, finvt23, finvt31, finvt32, finvt33
141 
142  INTEGER :: n1s,n2s,n3s
143 
144  DO i = 1, interfacesfnumelems
145 
146 ! Compute the Gradient of U (disp) Volumetric
147 
148  idvol = mapsfelvolel(i) ! Relates Surface id to Volumetric id
149 
150  n1 = elconnvol(1,idvol)
151  n2 = elconnvol(2,idvol)
152  n3 = elconnvol(3,idvol)
153  n4 = elconnvol(4,idvol)
154 
155  k3n1 = 3*n1
156  k3n2 = 3*n2
157  k3n3 = 3*n3
158  k3n4 = 3*n4
159 
160  k2n1 = k3n1 - 1
161  k2n2 = k3n2 - 1
162  k2n3 = k3n3 - 1
163  k2n4 = k3n4 - 1
164 
165  k1n1 = k3n1 - 2
166  k1n2 = k3n2 - 2
167  k1n3 = k3n3 - 2
168  k1n4 = k3n4 - 2
169 
170  x1 = coor(1,n1)
171  x2 = coor(1,n2)
172  x3 = coor(1,n3)
173  x4 = coor(1,n4)
174  y1 = coor(2,n1)
175  y2 = coor(2,n2)
176  y3 = coor(2,n3)
177  y4 = coor(2,n4)
178  z1 = coor(3,n1)
179  z2 = coor(3,n2)
180  z3 = coor(3,n3)
181  z4 = coor(3,n4)
182 
183  ! k#n# dummy variables replaces:
184  u1 = disp(k1n1) ! (3*n1-2)
185  u2 = disp(k1n2) ! (3*n2-2)
186  u3 = disp(k1n3) ! (3*n3-2)
187  u4 = disp(k1n4) ! (3*n4-2)
188  v1 = disp(k2n1) ! (3*n1-1)
189  v2 = disp(k2n2) ! (3*n2-1)
190  v3 = disp(k2n3) ! (3*n3-1)
191  v4 = disp(k2n4) ! (3*n4-1)
192  w1 = disp(k3n1) ! (3*n1)
193  w2 = disp(k3n2) ! (3*n2)
194  w3 = disp(k3n3) ! (3*n3)
195  w4 = disp(k3n4) ! (3*n4)
196 
197  x12 = x1 - x2 ! not used in vol. calc
198  x13 = x1 - x3 ! not used in vol. calc
199  x14 = x1 - x4
200  x24 = x2 - x4
201  x34 = x3 - x4
202  y12 = y1 - y2 ! not used in vol. calc
203  y13 = y1 - y3 ! not used in vol. calc
204  y14 = y1 - y4
205  y24 = y2 - y4
206  y34 = y3 - y4
207  z12 = z1 - z2 ! not used in vol. calc
208  z13 = z1 - z3 ! not used in vol. calc
209  z14 = z1 - z4
210  z24 = z2 - z4
211  z34 = z3 - z4
212 
213  c11 = y24*z34 - z24*y34
214  c21 = -( x24*z34 - z24*x34 )
215  c31 = x24*y34 - y24*x34
216 
217  vx6 = -( x14*c11 + y14*c21 + z14*c31 )
218 
219  vx6inv = 1.d0 / vx6
220 
221 ! See the maple worksheet 'V3D4.mws' for the derivation of [B]
222 ! NOTE: Factored for a more equivalent/compact form then maple's
223 
224  b1 = (y34*z24 - y24*z34) * vx6inv
225  b2 = (z34*x24 - z24*x34) * vx6inv
226  b3 = (x34*y24 - x24*y34) * vx6inv
227  b4 = (y13*z14 - y14*z13) * vx6inv
228  b5 = (z13*x14 - z14*x13) * vx6inv
229  b6 = (x13*y14 - x14*y13) * vx6inv
230  b7 = (y14*z12 - y12*z14) * vx6inv
231  b8 = (z14*x12 - z12*x14) * vx6inv
232  b9 = (x14*y12 - x12*y14) * vx6inv
233  b10 = (y12*z13 - y13*z12) * vx6inv
234  b11 = (z12*x13 - z13*x12) * vx6inv
235  b12 = (x12*y13 - x13*y12) * vx6inv
236 !
237 ! Calculate displacement gradient (H)
238 !
239  dudx = b1*u1 + b4*u2 + b7*u3 + b10*u4
240  dvdy = b2*v1 + b5*v2 + b8*v3 + b11*v4
241  dwdz = b3*w1 + b6*w2 + b9*w3 + b12*w4
242  dudy = b2*u1 + b5*u2 + b8*u3 + b11*u4
243  dvdx = b1*v1 + b4*v2 + b7*v3 + b10*v4
244  dvdz = b3*v1 + b6*v2 + b9*v3 + b12*v4
245  dwdy = b2*w1 + b5*w2 + b8*w3 + b11*w4
246  dudz = b3*u1 + b6*u2 + b9*u3 + b12*u4
247  dwdx = b1*w1 + b4*w2 + b7*w3 + b10*w4
248 !
249 ! deformation gradients F
250 !
251  f11 = 1.d0 + dudx
252  f12 = dudy
253  f13 = dudz
254  f21 = dvdx
255  f22 = 1.d0 + dvdy
256  f23 = dvdz
257  f31 = dwdx
258  f32 = dwdy
259  f33 = 1.d0 + dwdz
260 
261 !
262 !
263 !
264 
265  denfinvt = f11*(f22*f33-f32*f23) - f12*(f21*f33+f31*f23) + f13*(f21*f32-f31*f22)
266 
267  finvt11 = (f22*f33-f32*f23)/denfinvt
268  finvt12 = -(f21*f33-f31*f23)/denfinvt
269  finvt13 = (f21*f32-f31*f22)/denfinvt
270  finvt21 = -(f12*f33-f32*f13)/denfinvt
271  finvt22 = (f11*f33-f31*f13)/denfinvt
272  finvt23 = -(f11*f32-f31*f12)/denfinvt
273  finvt31 = (f12*f23-f22*f13)/denfinvt
274  finvt32 = -(f11*f23-f21*f13)/denfinvt
275  finvt33 = (f11*f22-f21*f12)/denfinvt
276 
277  jac3d = denfinvt
278 
279 ! Nodes of the Triangle ( Vertex Nodes )
280 
281  triconn(1:3) = interfacesfelemconn(1:3,i)
282 
283 ! 1) Calculate the Normal in the Deformed Configuration
284 
285 ! Uses the fact that the norm of the cross product vector
286 ! is the area of the parallelogram they form. The triangle they
287 ! form has half that area.
288 
289  n1s = mapnodesf(triconn(1))
290  n2s = mapnodesf(triconn(2))
291  n3s = mapnodesf(triconn(3))
292 
293  !TEST
294  IF(n1s.NE.n1.AND.n1s.NE.n2.AND.n1s.NE.n3.AND.n1s.NE.n4)THEN
295  print*,'n1s NOT part of volume element',n1s,n1,n2,n3,n4,mapsfelvolel(i),i
296  stop
297  ENDIF
298  IF(n2s.NE.n1.AND.n2s.NE.n2.AND.n2s.NE.n3.AND.n2s.NE.n4)THEN
299  print*,'n2s NOT part of volume element'
300  stop
301  ENDIF
302  IF(n3s.NE.n1.AND.n3s.NE.n2.AND.n3s.NE.n3.AND.n3s.NE.n4)THEN
303  print*,'n3s NOT part of volume element'
304  stop
305  ENDIF
306 
307 
308  x1 = coor(1,mapnodesf(triconn(1)))
309  y1 = coor(2,mapnodesf(triconn(1)))
310  z1 = coor(3,mapnodesf(triconn(1)))
311 
312  x2 = coor(1,mapnodesf(triconn(2)))
313  y2 = coor(2,mapnodesf(triconn(2)))
314  z2 = coor(3,mapnodesf(triconn(2)))
315 
316  x3 = coor(1,mapnodesf(triconn(3)))
317  y3 = coor(2,mapnodesf(triconn(3)))
318  z3 = coor(3,mapnodesf(triconn(3)))
319 
320  u1 = disp(3*mapnodesf(triconn(1))-2)
321  v1 = disp(3*mapnodesf(triconn(1))-1)
322  w1 = disp(3*mapnodesf(triconn(1)) )
323 
324  u2 = disp(3*mapnodesf(triconn(2))-2)
325  v2 = disp(3*mapnodesf(triconn(2))-1)
326  w2 = disp(3*mapnodesf(triconn(2)) )
327 
328  u3 = disp(3*mapnodesf(triconn(3))-2)
329  v3 = disp(3*mapnodesf(triconn(3))-1)
330  w3 = disp(3*mapnodesf(triconn(3)) )
331 
332  x0p = x1
333  y0p = y1
334  z0p = z1
335 
336  x1p = x2
337  y1p = y2
338  z1p = z2
339 
340  x2p = x3
341  y2p = y3
342  z2p = z3
343 
344 
345 ! Find vector componets of the sides
346 
347  x1x0 = x1p - x0p
348  y1y0 = y1p - y0p
349  z1z0 = z1p - z0p
350 
351  x2x0 = x2p - x0p
352  y2y0 = y2p - y0p
353  z2z0 = z2p - z0p
354 
355 ! Take the cross product
356 
357  x3p = y1y0 * z2z0 - z1z0 * y2y0
358  y3p = z1z0 * x2x0 - x1x0 * z2z0
359  z3p = x1x0 * y2y0 - y1y0 * x2x0
360 
361 ! Computes the Euclidean norm of a vector in 3D Deformed Config.
362 
363  magnorm = sqrt( x3p*x3p + y3p*y3p + z3p*z3p )
364 
365  xnorm = x3p/magnorm
366  ynorm = y3p/magnorm
367  znorm = z3p/magnorm
368 
369 ! area0 = 0.5*MagNorm
370 
371 ! little n (deformed normal)
372 
373  defnorm(1) = jac3d * (finvt11*xnorm+finvt12*ynorm+finvt13*znorm)
374  defnorm(2) = jac3d * (finvt21*xnorm+finvt22*ynorm+finvt23*znorm)
375  defnorm(3) = jac3d * (finvt31*xnorm+finvt32*ynorm+finvt33*znorm)
376 
377  magnormdef = sqrt( defnorm(1)**2 + defnorm(2)**2 + defnorm(3)**2 )
378 
379  defnorm(1) = defnorm(1)/magnormdef
380  defnorm(2) = defnorm(2)/magnormdef
381  defnorm(3) = defnorm(3)/magnormdef
382 
383  x0p = x1 + u1
384  y0p = y1 + v1
385  z0p = z1 + w1
386 
387  x1p = x2 + u2
388  y1p = y2 + v2
389  z1p = z2 + w2
390 
391  x2p = x3 + u3
392  y2p = y3 + v3
393  z2p = z3 + w3
394 
395 ! Find vector componets of the sides
396 
397  x1x0 = x1p - x0p
398  y1y0 = y1p - y0p
399  z1z0 = z1p - z0p
400 
401  x2x0 = x2p - x0p
402  y2y0 = y2p - y0p
403  z2z0 = z2p - z0p
404 
405 ! Take the cross product
406 
407  x3p = y1y0 * z2z0 - z1z0 * y2y0
408  y3p = z1z0 * x2x0 - x1x0 * z2z0
409  z3p = x1x0 * y2y0 - y1y0 * x2x0
410 
411 ! Computes the Euclidean norm of a vector in 3D Deformed Config.
412 
413  magnormdef = sqrt( x3p*x3p + y3p*y3p + z3p*z3p )
414 
415  area = 0.5*magnormdef
416 
417 ! Pressure * Jac2D * n * Area0 (Jac2D = Area/Area0)
418 
419  uniftract(1) = -tractpress*defnorm(1)*area/3.d0
420  uniftract(2) = -tractpress*defnorm(2)*area/3.d0
421  uniftract(3) = -tractpress*defnorm(3)*area/3.d0
422 
423 ! print*, -TractPress*defNorm(1)*Area/3.d0
424 
425 ! Assembly into global external load vector R_ex
426 
427  triconn(1:3) = interfacesfelemconn(lwrbnd:uppbnd,i)
428 
429  DO j = 1, 3
430  nz = mapnodesf(triconn(j))*3 ! volume node
431  nx = nz - 2
432  ny = nz - 1
433  r_ex(nx) = r_ex(nx) + uniftract(1)
434  r_ex(ny) = r_ex(ny) + uniftract(2)
435  r_ex(nz) = r_ex(nz) + uniftract(3)
436  ENDDO
437 
438  ENDDO
439 
440 END SUBROUTINE tractpressload
441 
j indices k indices k
Definition: Indexing.h:6
subroutine tractpressload(R_ex, numnp, InterfaceSFNumElems, InterfaceSFNumNodes, InterfaceSFElemConn, MapNodeSF, LwrBnd, UppBnd, coor, Disp, MapSFElVolEl, ElConnVol, iElType, NumElVol, TractPress)
double sqrt(double d)
Definition: double.h:73
blockLoc i
Definition: read.cpp:79
virtual std::ostream & print(std::ostream &os) const
j indices j
Definition: Indexing.h:6