Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
v3d4n_mass.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_mass( &
54  coor, & ! Mesh Coordinates
55  lmcstet, & ! Connectivity array
56  matcstet, & ! Element Material ID
57  rho, & ! Density
58  xm, & ! mass matrix
59  numnp, &
60  numcstet, &
61  numat_vol, &
62  nstart, &
63  nend,totalmass,numelneigh,elconn,alpha,vhat)
64 
65 !-----Performs displacement based computations for 2-d, triangular
66 !-----linear elastic elements with linear interpolation functions.
67 !-----(constant strain triangles)
68 !-----The mass matrixes surface tractions and the strain and stress
69 !-----calculations are all done here for the CSTs.
70  IMPLICIT NONE
71  INTEGER :: numnp ! number of nodes
72  INTEGER :: numcstet ! number of CSTets
73  INTEGER :: numat_vol ! number of materials
74 !-- densities
75  REAL*8, DIMENSION(1:numat_vol) :: rho
76 !-- reciprical of mass matrix diagonal
77  REAL*8, DIMENSION(1:numnp) :: xm
78 !-- material number for CSTet element
79  INTEGER, DIMENSION(1:numcstet) :: matcstet
80 !-- connectivity table for CSTet elem
81  INTEGER, DIMENSION(1:4,1:numcstet) :: lmcstet
82 !-- global coordinates
83  REAL*8, DIMENSION(1:3,1:numnp) :: coor
84  integer, DIMENSION(1:numnp) ::numelneigh
85  INTEGER, DIMENSION(1:numnp,1:40) :: elconn ! fix 40 should not be hard coded
86  REAL*8 :: aa ! determinant of jacobian (2*area)
87  REAL*8 :: x !,x1,x2,x3 ! dummy variable
88  INTEGER :: m ! current element's material number
89  INTEGER :: n1,n2,n3,n4,n5,n6 ! nodes, and dummy vars
90  INTEGER :: n7,n8,n9,n10
91  INTEGER :: i,j,nstart,nend ! loop counter
92 !-- Coordinate holding variable
93  REAL*8 :: x1,x2,x3,x4,y1,y2,y3,y4,z1,z2,z3,z4
94 !-- Coordinate subtractions
95  REAL*8 :: x14, x24, x34, y14, y24, y34, z14, z24, z34
96 !--
97  REAL*8 :: c11, c21, c31
98 !-- 6*volume and the volume
99  REAL*8 :: vx6,volume
100  REAL*8 :: totalmass,volel, aux
101  real*8, dimension(1:4,1:numcstet) :: alpha
102  integer :: ielnum
103  real*8 :: sumx
104  REAL*8, DIMENSION(1:numnp) :: vhat
105 
106 
107  DO i = 1, numnp
108  sumx = 0.d0
109  DO j = 1, numelneigh(i)
110  ielnum = elconn(i,j)
111  m = matcstet(ielnum)
112 
113  n1 = lmcstet(1,ielnum)
114  n2 = lmcstet(2,ielnum)
115  n3 = lmcstet(3,ielnum)
116  n4 = lmcstet(4,ielnum)
117 
118  x1 = coor(1,n1)
119  x2 = coor(1,n2)
120  x3 = coor(1,n3)
121  x4 = coor(1,n4)
122  y1 = coor(2,n1)
123  y2 = coor(2,n2)
124  y3 = coor(2,n3)
125  y4 = coor(2,n4)
126  z1 = coor(3,n1)
127  z2 = coor(3,n2)
128  z3 = coor(3,n3)
129  z4 = coor(3,n4)
130 
131  x14 = x1 - x4
132  x24 = x2 - x4
133  x34 = x3 - x4
134  y14 = y1 - y4
135  y24 = y2 - y4
136  y34 = y3 - y4
137  z14 = z1 - z4
138  z24 = z2 - z4
139  z34 = z3 - z4
140 
141  c11 = y24*z34 - z24*y34
142  c21 = -( x24*z34 - z24*x34 )
143  c31 = x24*y34 - y24*x34
144 
145  vx6 = -( x14*c11 + y14*c21 + z14*c31 )
146 
147  volel = vx6/6.d0
148 
149  IF( volel.LT.0.d0)THEN
150  print*,'ERROR'
151  print*,'NEG, Volume... STOPPING'
152  print*,' ELEMENT =',i
153  print*,' NODES=',n1,n2,n3,n4
154  print*,' x-Coordinates:',x1,x2,x3,x4
155  print*,' y-Coordinates:',y1,y2,y3,y4
156  print*,' z-Coordinates:',z1,z2,z3,z4
157  stop
158  ENDIF
159 
160  IF(n1.EQ.i)THEN
161  aux = alpha(1,ielnum)*volel
162  sumx = sumx + aux
163 ! print*,aux,rho(m)
164  xm(n1) = xm(n1) + aux*rho(m)
165  totalmass = totalmass + aux*rho(m)
166  ELSE IF(n2.EQ.i)THEN
167  aux = alpha(2,ielnum)*volel
168  sumx = sumx + aux
169 ! print*,aux,rho(m)
170  xm(n2) = xm(n2) + aux*rho(m)
171  totalmass = totalmass + aux*rho(m)
172  ELSE IF(n3.EQ.i)THEN
173  aux = alpha(3,ielnum)*volel
174  sumx = sumx + aux
175 ! print*,aux,rho(m)
176  xm(n3) = xm(n3) + aux*rho(m)
177  totalmass = totalmass + aux*rho(m)
178  ELSE IF(n4.EQ.i)THEN
179  aux = alpha(4,ielnum)*volel
180  sumx = sumx + aux
181 ! print*,aux,rho(m)
182  xm(n4) = xm(n4) + aux*rho(m)
183  totalmass = totalmass + aux*rho(m)
184  ENDIF
185  ENDDO
186  vhat(i) = sumx
187  ENDDO
188 
189 ! fix need to change if have more then one material, I.e. don't want to figure in the case
190 
191  RETURN
192  END
193 
FT m(int i, int j) const
int volume(const block *b)
Definition: split.cpp:181
blockLoc i
Definition: read.cpp:79
void int int REAL * x
Definition: read.cpp:74
virtual std::ostream & print(std::ostream &os) const
j indices j
Definition: Indexing.h:6
subroutine v3d4n_mass(coor, lmcstet, matcstet, rho, xm, numnp, numcstet, numat_vol, nstart, nend, TotalMass, NumElNeigh, ElConn, Alpha, Vhat)
Definition: v3d4n_mass.f90:53
unsigned char alpha() const
Definition: Color.h:75