Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
v3d4_r_bar.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 v3d4_r_bar(d_bar,R_bar,numnp,NumElv, &
54  & lmcstet,meshcoor,nstart,nend)
55 
56 !!****f* Rocfrac/Rocfrac/Source/v3d4_r_bar.f90
57 !!
58 !! NAME
59 !! v3d4_r_bar
60 !!
61 !! FUNCTION
62 !! _
63 !! Caluculates R for the ALE forumulation for
64 !! the 4-node tetrahedral
65 !!
66 !! INPUTS
67 !! d_bar -- Displacement from mesh motion and
68 !! surface regression
69 !! numnp -- Number of Nodes
70 !! NumElv -- Number of volumetric elements
71 !! lmcstet -- Element connectivity
72 !! meshcoor -- mesh coordinates
73 !! nstart -- starting element number
74 !! nend -- ending element number
75 !!
76 !! OUTPUT
77 !! _
78 !! Rbar -- R additional internal force from ALE
79 !!
80 !!****
81 
82  IMPLICIT NONE
83 
84 !-- Number of nodes
85  INTEGER :: numnp
86 !-- Nodal mesh displacements
87  REAL*8, DIMENSION(1:3*numnp) :: d_bar
88 !-- Internal force
89  REAL*8, DIMENSION(1:3*numnp) :: r_bar
90 !-- Coordinates of position w.r.t. to global basis of nodes
91  REAL*8, DIMENSION(1:3,1:numnp) :: meshcoor
92 !-- Number of LSTs
93  INTEGER :: numelv
94 !-- Tetrahedra conectivity table
95  INTEGER, DIMENSION(1:4,1:NumElv) :: lmcstet
96 !-- Displacement holding variable
97  REAL*8, DIMENSION(1:12) :: disp
98 
99  INTEGER :: nstart,nend
100 
101 !-- Coordinate holding variables
102  REAL*8 :: x1, x2, x3, x4, y1, y2, y3, y4, z1, z2, z3, z4
103 !-- Corrdinate subtractions
104  REAL*8 :: x14, x24, x34, y14, y24, y34, z14, z24, z34
105 !--
106  REAL*8 :: c11, c12, c13, c21, c22, c23, c31, c32, c33
107 
108  REAL*8 :: g11, g14, g17
109  REAL*8 :: g44, g47
110  REAL*8 :: g77
111 
112  REAL*8 :: den
113 
114  REAL*8 :: vx6
115 
116  INTEGER :: i, j, i3, j3, ielem
117  INTEGER :: nd1, nd2, nd3, nd4
118  INTEGER :: nx, ny, nz
119  INTEGER :: k
120 
121  REAL*8, DIMENSION(1:10) :: elstiff
122 
123  INTEGER, DIMENSION(1:4,1:4) :: map = &
124  & RESHAPE((/1,2,3,4,2,5,6,7,3,6,8,9,4,7,9,10/),(/4,4/))
125 
126  DO ielem = nstart, nend
127 
128  nd1 = lmcstet(1,ielem)
129  nd2 = lmcstet(2,ielem)
130  nd3 = lmcstet(3,ielem)
131  nd4 = lmcstet(4,ielem)
132 
133  x1 = meshcoor(1,nd1)
134  y1 = meshcoor(2,nd1)
135  z1 = meshcoor(3,nd1)
136  x2 = meshcoor(1,nd2)
137  y2 = meshcoor(2,nd2)
138  z2 = meshcoor(3,nd2)
139  x3 = meshcoor(1,nd3)
140  y3 = meshcoor(2,nd3)
141  z3 = meshcoor(3,nd3)
142  x4 = meshcoor(1,nd4)
143  y4 = meshcoor(2,nd4)
144  z4 = meshcoor(3,nd4)
145 
146  DO i = 1, 4
147  i3 = lmcstet(i,ielem)*3
148  nx = i3 - 2
149  ny = i3 - 1
150  nz = i3
151  disp(i*3-2) = d_bar(nx)
152  disp(i*3-1) = d_bar(ny)
153  disp(i*3 ) = d_bar(nz)
154  ENDDO
155 
156  x14 = x1 - x4
157  x24 = x2 - x4
158  x34 = x3 - x4
159  y14 = y1 - y4
160  y24 = y2 - y4
161  y34 = y3 - y4
162  z14 = z1 - z4
163  z24 = z2 - z4
164  z34 = z3 - z4
165 
166  c11 = y24*z34 - z24*y34
167  c12 = -( y14*z34 - z14*y34 )
168  c13 = y14*z24 - z14*y24
169  c21 = -( x24*z34 - z24*x34 )
170  c22 = x14*z34 - z14*x34
171  c23 = -( x14*z24 - z14*x24 )
172  c31 = x24*y34 - y24*x34
173  c32 = -( x14*y34 - y14*x34 )
174  c33 = x14*y24 - y14*x24
175 
176  g11 = c11**2 + c21**2 + c31**2
177  g14 = c11*c12 + c21*c22 + c31*c32
178  g17 = c11*c13 + c21*c23 + c31*c33
179 
180  g44 = c12**2 + c22**2 + c32**2
181  g47 = c12*c13 + c22*c23 + c32*c33
182 
183  g77 = c13**2 + c23**2 + c33**2
184 
185 ! Mathematica output was originally det*( )/6. where det is of the Jacobi,
186 ! but the det Jacobi for the 4-node constant strain tetradedral
187 ! is equal to 6 * volume
188  ! corresponding term in upper triangle
189  elstiff(1) = g11 ! 1
190  elstiff(2) = g14 ! 4
191  elstiff(3) = g17 ! 7
192  elstiff(4) = -g11 - g14 - g17 ! 10
193  elstiff(5)= g44 ! 34 ! 13
194  elstiff(6)= g47 ! 37 ! 14
195  elstiff(7)= -g14 - g44 - g47 !40 ! 15
196  elstiff(8)= g77 ! 58 ! 8
197  elstiff(9)= -g17 - g47 - g77 ! 61 ! 9
198  elstiff(10)= g11 + 2.d0*g14 + 2.d0*g17 + g44 + 2.d0*g47 + g77 ! 73 ! 10
199 
200 ! need the minus sign in order to get the same as the original
201 
202  vx6 = -( x14*c11 + y14*c21 + z14*c31 )
203 
204 ! Vx6 = -( x14*y24*z34 - x14*z24*y34 - y14*x24*z34 + y14*z24*x34
205 ! $ + z14*x24*y34 - z14*y24*x34)
206 
207  den = 1.d0/(6.d0*vx6)
208 ! elstiff(1:10) = elstiff(1:10)*den
209  elstiff(1) = elstiff(1)*den
210  elstiff(2) = elstiff(2)*den
211  elstiff(3) = elstiff(3)*den
212  elstiff(4) = elstiff(4)*den
213  elstiff(5)= elstiff(5)*den
214  elstiff(6)= elstiff(6)*den
215  elstiff(7)= elstiff(7)*den
216  elstiff(8)= elstiff(8)*den
217  elstiff(9)= elstiff(9)*den
218  elstiff(10)= elstiff(10)*den
219 
220  DO i = 1, 4
221  nz = lmcstet(i,ielem)*3
222  nx = nz - 2
223  ny = nz - 1
224  DO j = 1, 4
225  j3 = j*3
226  k = map(j,i)
227  r_bar(nx) = r_bar(nx) + elstiff(k) * disp(j3-2)
228  r_bar(ny) = r_bar(ny) + elstiff(k) * disp(j3-1)
229  r_bar(nz) = r_bar(nz) + elstiff(k) * disp(j3)
230  ENDDO
231  ENDDO
232  ENDDO
233 
234  RETURN
235 END SUBROUTINE v3d4_r_bar
236 
j indices k indices k
Definition: Indexing.h:6
NT & den
blockLoc i
Definition: read.cpp:79
subroutine v3d4_r_bar(d_bar, R_bar, numnp, NumElv, lmcstet, meshcoor, nstart, nend)
Definition: v3d4_r_bar.f90:53
CImg< T > & map(const CImg< t > &palette)
Map predefined palette on the scalar (indexed) instance image.
Definition: CImg.h:15571
j indices j
Definition: Indexing.h:6