Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
v3d4_thermal.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_thermal(NumEl, NumNP, ElConnVol, Coor, Kappa, &
54  rnet, t, rho,cp, matcstet,numat_vol,meshvelo,elemstart, elemend)
55 
56 !!****f* Rocfrac/Source/v3d4_thermal
57 !!
58 !! NAME
59 !! v3d4_thermal.f90
60 !!
61 !! FUNCTION
62 !! Calculates the internal force vector due to heat
63 !! transfer for a 3D 10-node tet element.
64 !!
65 !! ALE
66 !! {Rnet} = [K]{T} + [K] {T}.
67 !!
68 !! ALE
69 !! where [K] is the element matrices
70 !! [K] is the conductivity matrix
71 !! {T} is the temperature
72 !!
73 !!
74 !! USED BY
75 !! RocFracMain
76 !!
77 !! INPUTS
78 !! NumEl - Number of Elements
79 !! NumNP - Number of Nodes
80 !! ElConnVol - Element Connectivity Array
81 !! Coor - Current Mesh coordinates
82 !! Kappa - thermal conductivity
83 !! Rnet - Accumulated "force" vector (RnetHT)
84 !! T - Temperature
85 !! RhoCp - Density * Cp
86 !! MeshVel - Mesh motion velocity
87 !!
88 !! OUTPUT
89 !!
90 !! Accumulated "force" vector with the addition of
91 !! the internal "force" vector (RnetHT)
92 !!
93 !!***
94 
95  IMPLICIT NONE
96 
97 !---- Global variables
98  INTEGER :: numnp ! number of nodal points
99  INTEGER :: numel ! number of CSTet elements
100  INTEGER :: numat_vol ! number of volumetric materials
101  integer :: elemstart, elemend
102 
103  REAL*8, DIMENSION(1:numat_vol) :: kappa
104  REAL*8, DIMENSION(1:NumNP) :: t
105  REAL*8, DIMENSION(1:numat_vol) :: rho,cp
106 !-- coordinate array
107  REAL*8, DIMENSION(1:3,1:numnp) :: coor
108 
109  REAL*8, DIMENSION(1:3*numnp) :: meshvelo
110 !-- internal force
111  REAL*8, DIMENSION(1:numnp) :: rnet
112 !-- connectivity table for CSTet
113  INTEGER, DIMENSION(1:4,1:NumEl) :: elconnvol
114 !-- mat number for CSTet element
115  INTEGER, DIMENSION(1:NumEl) :: matcstet
116 !---- Local variables
117 !-- node numbers
118  INTEGER :: n1,n2,n3,n4
119 !-- x, y, and z displacements of nodes
120  REAL*8 :: u1,u2,u3,u4,v1,v2,v3,v4,w1,w2,w3,w4
121 !-- 6*volume, inverse(6*volume), and the volume
122  REAL*8 :: vx6, vx6inv, vol
123 !-- spacial derivatives
124  REAL*8 :: b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12
125 !-- strains
126  REAL*8 :: e11,e22,e33,e12,e23,e13
127 !-- coordinate holding variable
128  REAL*8 :: x1,x2,x3,x4,y1,y2,y3,y4,z1,z2,z3,z4
129 !-- Coordinate subtractions
130  REAL*8 :: x14, x24, x34, y14, y24, y34, z14, z24, z34
131 !-- Coordinate subtractions: These are to speed up B calculation
132  REAL*8 :: x12, x13, y12, y13, z12, z13
133 !-- Dummy
134  REAL*8 :: c11, c21, c31
135 !-- dummy and counters
136  INTEGER :: i,j,nstart,nend
137  INTEGER :: imat, igpt
138  INTEGER :: k1n1,k1n2,k1n3,k1n4,k2n1,k2n2,k2n3,k2n4
139  INTEGER :: k3n1,k3n2,k3n3,k3n4
140 
141 
142  REAL*8, DIMENSION(1:4,1:4) :: kloc
143  REAL*8, DIMENSION(1:4) :: tloc, rinloc
144 
145  REAL*8, DIMENSION(1:3,1:4) :: b
146  REAL*8, DIMENSION(1:3,1:3) :: kappamatrx = reshape( &
147  (/1.000000000000000,0.000000000000000,0.000000000000000, &
148  0.000000000000000,1.000000000000000,0.000000000000000, &
149  0.000000000000000,0.000000000000000,1.000000000000000/),(/3,3/) )
150 
151  DO i = elemstart, elemend
152  imat = matcstet(i)
153 
154  n1 = elconnvol(1,i)
155  n2 = elconnvol(2,i)
156  n3 = elconnvol(3,i)
157  n4 = elconnvol(4,i)
158 
159  k3n1 = 3*n1
160  k3n2 = 3*n2
161  k3n3 = 3*n3
162  k3n4 = 3*n4
163 
164  k2n1 = k3n1 - 1
165  k2n2 = k3n2 - 1
166  k2n3 = k3n3 - 1
167  k2n4 = k3n4 - 1
168 
169  k1n1 = k3n1 - 2
170  k1n2 = k3n2 - 2
171  k1n3 = k3n3 - 2
172  k1n4 = k3n4 - 2
173  ! k#n# dummy variables replaces:
174 
175  tloc(1) = t(n1)
176  tloc(2) = t(n2)
177  tloc(3) = t(n3)
178  tloc(4) = t(n4)
179 
180  x1 = coor(1,n1) ! Node 1, x-coor
181  x2 = coor(1,n2) ! Node 2, x-coor
182  x3 = coor(1,n3) ! Node 3, x-coor
183  x4 = coor(1,n4) ! Node 4, x-coor
184  y1 = coor(2,n1) ! Node 1, y-coor
185  y2 = coor(2,n2) ! Node 2, y-coor
186  y3 = coor(2,n3) ! Node 3, y-coor
187  y4 = coor(2,n4) ! Node 4, y-coor
188  z1 = coor(3,n1) ! Node 1, z-coor
189  z2 = coor(3,n2) ! Node 2, z-coor
190  z3 = coor(3,n3) ! Node 3, z-coor
191  z4 = coor(3,n4) ! Node 4, z-coor
192 
193 
194  x12 = x1 - x2 ! not used in vol. calc
195  x13 = x1 - x3 ! not used in vol. calc
196  x14 = x1 - x4
197  x24 = x2 - x4
198  x34 = x3 - x4
199  y12 = y1 - y2 ! not used in vol. calc
200  y13 = y1 - y3 ! not used in vol. calc
201  y14 = y1 - y4
202  y24 = y2 - y4
203  y34 = y3 - y4
204  z12 = z1 - z2 ! not used in vol. calc
205  z13 = z1 - z3 ! not used in vol. calc
206  z14 = z1 - z4
207  z24 = z2 - z4
208  z34 = z3 - z4
209 
210  c11 = y24*z34 - z24*y34
211  c21 = -( x24*z34 - z24*x34 )
212  c31 = x24*y34 - y24*x34
213 
214  vx6 = -( x14*c11 + y14*c21 + z14*c31 )
215 
216  vx6inv = 1.d0 / vx6
217 
218 ! See the maple worksheet 'V3D4.mws' for the derivation of [B]
219 ! NOTE: Factored for a more equivalent/compact form then maple's
220 
221  b(1,1) = (y34*z24 - y24*z34) * vx6inv
222  b(2,1) = (z34*x24 - z24*x34) * vx6inv
223  b(3,1) = (x34*y24 - x24*y34) * vx6inv
224  b(1,2) = (y13*z14 - y14*z13) * vx6inv
225  b(2,2) = (z13*x14 - z14*x13) * vx6inv
226  b(3,2) = (x13*y14 - x14*y13) * vx6inv
227  b(1,3) = (y14*z12 - y12*z14) * vx6inv
228  b(2,3) = (z14*x12 - z12*x14) * vx6inv
229  b(3,3) = (x14*y12 - x12*y14) * vx6inv
230  b(1,4) = (y12*z13 - y13*z12) * vx6inv
231  b(2,4) = (z12*x13 - z13*x12) * vx6inv
232  b(3,4) = (x12*y13 - x13*y12) * vx6inv
233 
234  vol = vx6 / 6.d0
235 
236  kloc = kappa(imat)*matmul(matmul(transpose(b),kappamatrx),b)*vol
237 
238 
239  rinloc(:) = matmul(kloc,tloc)
240 
241  rnet(n1) = rnet(n1) - rinloc(1)
242  rnet(n2) = rnet(n2) - rinloc(2)
243  rnet(n3) = rnet(n3) - rinloc(3)
244  rnet(n4) = rnet(n4) - rinloc(4)
245 
246  ENDDO
247  RETURN
248 END SUBROUTINE v3d4_thermal
249 
unsigned char b() const
Definition: Color.h:70
subroutine v3d4_thermal(NumEl, NumNP, ElConnVol, Coor, Kappa, Rnet, T, Rho, Cp, matcstet, numat_vol, MeshVelo, ElemStart, ElemEnd)
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6