Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
v3d4_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 v3d4_mass(coor,lmcstet,matcstet, &
54  rho,xm,numnp,numcstet,numat_vol,nstart,nend)
55 
56 !!****f* Rocfrac/Rocfrac/Source/v3d4n_nl.f90
57 !!
58 !! NAME
59 !! v3d4_mass
60 !!
61 !! FUNCTION
62 !!
63 !! Computes the lumped mass matrix for a 4-node tetrahedral.
64 !!
65 !! INPUTS
66 !!
67 !! NumNP -- Number of nodes
68 !! numcstet -- Number of elements
69 !! Coor -- number of coordinates
70 !! Matcstet -- Material id
71 !! rho -- Density
72 !! lmcstet -- Nodal connectivity
73 !! nstart, nend -- element beginning and end loop counter
74 !! numat_vol -- number of materials
75 !!
76 !! OUTPUT
77 !!
78 !! xm -- lumped mass matrix
79 !!
80 !!****
81 
82  IMPLICIT NONE
83  INTEGER :: numnp ! number of nodes
84  INTEGER :: numcstet ! number of CSTets
85  INTEGER :: numat_vol ! number of materials
86 !-- densities
87  REAL*8, DIMENSION(1:numat_vol) :: rho
88 !-- reciprical of mass matrix diagonal
89  REAL*8, DIMENSION(1:numnp) :: xm
90 !-- material number for CSTet element
91  INTEGER, DIMENSION(1:numcstet) :: matcstet
92 !-- connectivity table for CSTet elem
93  INTEGER, DIMENSION(1:4,1:numcstet) :: lmcstet
94 !-- global coordinates
95  REAL*8, DIMENSION(1:3,1:numnp) :: coor
96 !-- Displacement
97  REAL*8, DIMENSION(1:3*numnp) :: disp
98 
99  REAL*8 :: aa ! determinant of jacobian (2*area)
100  REAL*8 :: x !,x1,x2,x3 ! dummy variable
101  INTEGER :: m ! current element's material number
102  INTEGER :: n1,n2,n3,n4,n5,n6 ! nodes, and dummy vars
103  INTEGER :: n7,n8,n9,n10
104  INTEGER :: i,nstart,nend ! loop counter
105 !-- Coordinate holding variable
106  REAL*8 :: x1,x2,x3,x4,y1,y2,y3,y4,z1,z2,z3,z4
107 !-- Coordinate subtractions
108  REAL*8 :: x14, x24, x34, y14, y24, y34, z14, z24, z34
109 !--
110  REAL*8 :: c11, c21, c31
111 !-- 6*volume and the volume
112  REAL*8 :: vx6,volume
113 
114  DO i = nstart,nend
115  m = matcstet(i)
116  n1 = lmcstet(1,i)
117  n2 = lmcstet(2,i)
118  n3 = lmcstet(3,i)
119  n4 = lmcstet(4,i)
120 
121  x1 = coor(1,n1)
122  x2 = coor(1,n2)
123  x3 = coor(1,n3)
124  x4 = coor(1,n4)
125  y1 = coor(2,n1)
126  y2 = coor(2,n2)
127  y3 = coor(2,n3)
128  y4 = coor(2,n4)
129  z1 = coor(3,n1)
130  z2 = coor(3,n2)
131  z3 = coor(3,n3)
132  z4 = coor(3,n4)
133 
134  x14 = x1 - x4
135  x24 = x2 - x4
136  x34 = x3 - x4
137  y14 = y1 - y4
138  y24 = y2 - y4
139  y34 = y3 - y4
140  z14 = z1 - z4
141  z24 = z2 - z4
142  z34 = z3 - z4
143 
144  c11 = y24*z34 - z24*y34
145  c21 = -( x24*z34 - z24*x34 )
146  c31 = x24*y34 - y24*x34
147 
148  vx6 = -( x14*c11 + y14*c21 + z14*c31 )
149 
150 !!$ Vx6 = x2*y3*z4 - x2*y4*z3 - y2*x3*z4 + y2*x4*z3 + z2*x3*y4
151 !!$ $ - z2*x4*y3 - x1*y3*z4 + x1*y4*z3 + x1*y2*z4 - x1*y2*z3
152 !!$ $ - x1*z2*y4 + x1*z2*y3 + y1*x3*z4 - y1*x4*z3 - y1*x2*z4
153 !!$ $ + y1*x2*z3 + y1*z2*x4 - y1*z2*x3 - z1*x3*y4 + z1*x4*y3
154 !!$ $ + z1*x2*y4 - z1*x2*y3 - z1*y2*x4 + z1*y2*x3
155 
156  x = rho(m)*vx6/24.d0
157 
158  IF(x.LT.0.d0)THEN
159  print*,'ROCFRAC: ERROR'
160  print*,'ROCFRAC: NEG, Volume... STOPPING'
161  print*,'ROCFRAC: ELEMENT =',i
162  print*,'ROCFRAC: NODES=',n1,n2,n3,n4
163  print*,'ROCFRAC: x-Coordinates:',x1,x2,x3,x4
164  print*,'ROCFRAC: y-Coordinates:',y1,y2,y3,y4
165  print*,'ROCFRAC: z-Coordinates:',z1,z2,z3,z4
166  stop
167  ENDIF
168 
169  xm(n1) = xm(n1) + x
170  xm(n2) = xm(n2) + x
171  xm(n3) = xm(n3) + x
172  xm(n4) = xm(n4) + x
173 
174 
175  ENDDO
176 
177  RETURN
178 END SUBROUTINE v3d4_mass
179 
subroutine v3d4_mass(coor, lmcstet, matcstet, rho, xm, numnp, numcstet, numat_vol, nstart, nend)
Definition: v3d4_mass.f90:53
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