Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
v3d4_damping.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_damping(vhalf,R_in,&
54  numnp,&
55  numcstet,lmcstet,coor,&
56  nstart,nend, kappadamp)
57 
58 ! Consistant Damping matrix [C]
59 
60  IMPLICIT NONE
61 
62  INTEGER :: i
63  INTEGER :: numnp,numcstet
64  INTEGER :: nstart, nend
65 
66  REAL*8 :: inv60=1.d0/60.d0, inv120=1.d0/120.d0
67 
68  REAL*8 :: kappadamp
69 
70 ! Tet connectivity table
71  INTEGER, DIMENSION(1:4,1:numcstet) :: lmcstet
72 ! nodal velocities
73  REAL*8, DIMENSION(1:3*numnp) :: vhalf
74 !-- node numbers
75  INTEGER :: n1,n2,n3,n4
76 !-- x, y, and z velocity of nodes
77  REAL*8 :: u1,u2,u3,u4,v1,v2,v3,v4,w1,w2,w3,w4
78 !-- coordinate holding variable
79  REAL*8 :: x1,x2,x3,x4,y1,y2,y3,y4,z1,z2,z3,z4
80 !-- Coordinate subtractions
81  REAL*8 :: x14, x24, x34, y14, y24, y34, z14, z24, z34
82 !-- Dummy
83  REAL*8 :: c11, c21, c31
84 
85 ! mesh coordinates
86  REAL*8, DIMENSION(1:3,1:numnp) :: coor
87 !-- 6*volume, inverse(6*volume), and the volume
88  REAL*8 :: vx6, vx6inv, vol,multiplier
89 
90  INTEGER :: k1n1,k1n2,k1n3,k1n4,k2n1,k2n2,k2n3,k2n4
91  INTEGER :: k3n1,k3n2,k3n3,k3n4
92 
93 ! Contibution to the Net Force Vector
94  REAL*8, DIMENSION(1:3*numnp) :: r_in
95 
96  DO i = nstart, nend
97 
98  n1 = lmcstet(1,i)
99  n2 = lmcstet(2,i)
100  n3 = lmcstet(3,i)
101  n4 = lmcstet(4,i)
102 
103  k3n1 = 3*n1
104  k3n2 = 3*n2
105  k3n3 = 3*n3
106  k3n4 = 3*n4
107 
108  k2n1 = k3n1 - 1
109  k2n2 = k3n2 - 1
110  k2n3 = k3n3 - 1
111  k2n4 = k3n4 - 1
112 
113  k1n1 = k3n1 - 2
114  k1n2 = k3n2 - 2
115  k1n3 = k3n3 - 2
116  k1n4 = k3n4 - 2
117 
118  ! k#n# dummy variables replaces:
119  u1 = vhalf(k1n1) ! (3*n1-2)
120  u2 = vhalf(k1n2) ! (3*n2-2)
121  u3 = vhalf(k1n3) ! (3*n3-2)
122  u4 = vhalf(k1n4) ! (3*n4-2)
123  v1 = vhalf(k2n1) ! (3*n1-1)
124  v2 = vhalf(k2n2) ! (3*n2-1)
125  v3 = vhalf(k2n3) ! (3*n3-1)
126  v4 = vhalf(k2n4) ! (3*n4-1)
127  w1 = vhalf(k3n1) ! (3*n1)
128  w2 = vhalf(k3n2) ! (3*n2)
129  w3 = vhalf(k3n3) ! (3*n3)
130  w4 = vhalf(k3n4) ! (3*n4)
131 
132  x1 = coor(1,n1) ! Node 1, x-coor
133  x2 = coor(1,n2) ! Node 2, x-coor
134  x3 = coor(1,n3) ! Node 3, x-coor
135  x4 = coor(1,n4) ! Node 4, x-coor
136  y1 = coor(2,n1) ! Node 1, y-coor
137  y2 = coor(2,n2) ! Node 2, y-coor
138  y3 = coor(2,n3) ! Node 3, y-coor
139  y4 = coor(2,n4) ! Node 4, y-coor
140  z1 = coor(3,n1) ! Node 1, z-coor
141  z2 = coor(3,n2) ! Node 2, z-coor
142  z3 = coor(3,n3) ! Node 3, z-coor
143  z4 = coor(3,n4) ! Node 4, z-coor
144 
145  x14 = x1 - x4
146  x24 = x2 - x4
147  x34 = x3 - x4
148  y14 = y1 - y4
149  y24 = y2 - y4
150  y34 = y3 - y4
151  z14 = z1 - z4
152  z24 = z2 - z4
153  z34 = z3 - z4
154  c11 = y24*z34 - z24*y34
155  c21 = -( x24*z34 - z24*x34 )
156  c31 = x24*y34 - y24*x34
157 
158  vx6 = -( x14*c11 + y14*c21 + z14*c31 )
159 
160  multiplier = kappadamp*vx6
161 
162 ! local node 1
163  r_in(k1n1) = r_in(k1n1) - multiplier*(inv60*u1+inv120*(u2+u3+u4))
164  r_in(k2n1) = r_in(k2n1) - multiplier*(inv60*v1+inv120*(v2+v3+v4))
165  r_in(k3n1) = r_in(k3n1) - multiplier*(inv60*w1+inv120*(w2+w3+w4))
166 ! local node 2
167  r_in(k1n2) = r_in(k1n2) - multiplier*(inv60*u2+inv120*(u1+u3+u4))
168  r_in(k2n2) = r_in(k2n2) - multiplier*(inv60*v2+inv120*(v1+v3+v4))
169  r_in(k3n2) = r_in(k3n2) - multiplier*(inv60*w2+inv120*(w1+w3+w4))
170 ! local node 3
171  r_in(k1n3) = r_in(k1n3) - multiplier*(inv60*u3+inv120*(u1+u2+u4))
172  r_in(k2n3) = r_in(k2n3) - multiplier*(inv60*v3+inv120*(v1+v2+v4))
173  r_in(k3n3) = r_in(k3n3) - multiplier*(inv60*w3+inv120*(w1+w2+w4))
174 ! local node 4
175  r_in(k1n4) = r_in(k1n4) - multiplier*(inv60*u4+inv120*(u1+u2+u3))
176  r_in(k2n4) = r_in(k2n4) - multiplier*(inv60*v4+inv120*(v1+v2+v3))
177  r_in(k3n4) = r_in(k3n4) - multiplier*(inv60*w4+inv120*(w1+w2+w3))
178 
179  END DO
180 
181  RETURN
182 END SUBROUTINE v3d4_damping
183 
subroutine v3d4_damping(vhalf, R_in, numnp, numcstet, lmcstet, coor, nstart, nend, KappaDamp)
blockLoc i
Definition: read.cpp:79