Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
v3d8_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 v3d8_mass( coor,nodes,MatType,rho,xm, &
54  numnp,numel,nummat,nstart, nend)
55 
56 !!****f* Rocfrac/Rocfrac/Source/v3d8_mass.f90
57 !!
58 !! NAME
59 !! v3d8_mass
60 !!
61 !! FUNCTION
62 !!
63 !! Computes the lumped mass matrix for a 8-node hexahedral.
64 !!
65 !! INPUTS
66 !!
67 !! NumNP -- Number of nodes
68 !! NumEL -- Number of elements
69 !! Coor -- number of coordinates
70 !! MatType -- Material id
71 !! rho -- Density
72 !! nodes -- Nodal connectivity
73 !! nstart, nend -- element beginning and end loop counter
74 !! NumMat -- number of materials
75 !!
76 !! OUTPUT
77 !!
78 !! xm -- lumped mass matrix
79 !!
80 !!****
81 
82 
83 
84  IMPLICIT NONE
85 
86  INTEGER :: numel, numnp, nummat
87  INTEGER, DIMENSION(1:NumEl) :: mattype
88  INTEGER, DIMENSION(1:8,1:NumEl) :: nodes
89  REAL*8, DIMENSION(1:3,1:NumNP) :: coor
90  REAL*8, DIMENSION(1:NumMat) :: rho
91  REAL*8, DIMENSION(1:NumNP) :: xm
92 
93 ! root3 = 1./sqrt(3.)
94 
95  REAL*8, DIMENSION(1:3,1:8) :: ri = reshape( &
96  (/-0.577350269189626,-0.577350269189626,-0.577350269189626, &
97  0.577350269189626,-0.577350269189626,-0.577350269189626, &
98  0.577350269189626, 0.577350269189626,-0.577350269189626, &
99  -0.577350269189626, 0.577350269189626,-0.577350269189626, &
100  -0.577350269189626,-0.577350269189626, 0.577350269189626, &
101  0.577350269189626,-0.577350269189626, 0.577350269189626, &
102  0.577350269189626, 0.577350269189626, 0.577350269189626, &
103  -0.577350269189626, 0.577350269189626, 0.577350269189626/),(/3,8/) )
104 
105  REAL*8 :: nnn(8), dn(8,3)
106  integer :: ngpts = 8
107  INTEGER :: i,imat, igpt
108  INTEGER :: n1,n2,n3,n4,n5,n6,n7,n8
109  REAL*8 :: element_volume
110  REAL*8,DIMENSION(1:3,1:8) :: coord
111  REAL*8,DIMENSION(1:3,1:3) :: jac, jacinv
112  REAL*8 :: detj
113  REAL*8 :: node_mass
114  LOGICAL :: error
115  integer :: nstart, nend
116 
117  error = .false.
118 
119 
120  DO i = nstart, nend
121 
122  imat = mattype(i)
123 
124  element_volume = 0. ! Initialize
125 
126  n1 = nodes(1,i)
127  n2 = nodes(2,i)
128  n3 = nodes(3,i)
129  n4 = nodes(4,i)
130  n5 = nodes(5,i)
131  n6 = nodes(6,i)
132  n7 = nodes(7,i)
133  n8 = nodes(8,i)
134 
135  coord(1,1) = coor(1,n1)
136  coord(2,1) = coor(2,n1)
137  coord(3,1) = coor(3,n1)
138 
139  coord(1,2) = coor(1,n2)
140  coord(2,2) = coor(2,n2)
141  coord(3,2) = coor(3,n2)
142 
143  coord(1,3) = coor(1,n3)
144  coord(2,3) = coor(2,n3)
145  coord(3,3) = coor(3,n3)
146 
147  coord(1,4) = coor(1,n4)
148  coord(2,4) = coor(2,n4)
149  coord(3,4) = coor(3,n4)
150 
151  coord(1,5) = coor(1,n5)
152  coord(2,5) = coor(2,n5)
153  coord(3,5) = coor(3,n5)
154 
155  coord(1,6) = coor(1,n6)
156  coord(2,6) = coor(2,n6)
157  coord(3,6) = coor(3,n6)
158 
159  coord(1,7) = coor(1,n7)
160  coord(2,7) = coor(2,n7)
161  coord(3,7) = coor(3,n7)
162 
163  coord(1,8) = coor(1,n8)
164  coord(2,8) = coor(2,n8)
165  coord(3,8) = coor(3,n8)
166 
167  DO igpt = 1, ngpts ! LOOP over gauss points
168 
169  CALL get_shape(ri,nnn,dn,igpt) ! Get shape functions and derivatives
170 
171  CALL get_jacobien(coord,3,8,dn, & ! Compute jacobien
172  jac,jacinv,detj,error)
173 
174  IF(error) THEN ! Check for singular jacobien
175  WRITE(*,1000) igpt, i, detj
176  stop
177  END IF
178 
179  element_volume = element_volume + detj ! * wi(igpt), weigth for hex element = 1
180  ENDDO
181 
182  node_mass = element_volume*rho(imat)*0.125
183 
184  xm(n1 ) = xm(n1 ) + node_mass
185  xm(n2 ) = xm(n2 ) + node_mass
186  xm(n3 ) = xm(n3 ) + node_mass
187  xm(n4 ) = xm(n4 ) + node_mass
188  xm(n5 ) = xm(n5 ) + node_mass
189  xm(n6 ) = xm(n6 ) + node_mass
190  xm(n7 ) = xm(n7 ) + node_mass
191  xm(n8 ) = xm(n8 ) + node_mass
192 
193  ENDDO
194 
195 ! xm(:) = 1.d0/xm(:)
196 
197 1000 FORMAT (/,2x,'>>> Fatal error!', &
198  /,6x,'Jacobien at gauss point (',i2, &
199  ') of element ',i6,' is singular with detj =',e15.8)
200 
201 END SUBROUTINE v3d8_mass
202 
subroutine v3d8_mass(coor, nodes, MatType, rho, xm, NumNP, NumEl, NumMat, nstart, nend)
Definition: v3d8_mass.f90:53
int coord[NPANE][NROW *NCOL][3]
Definition: blastest.C:86
subroutine get_jacobien(coords, mcrd, nnode, dn, jac, jacinv, detj, error)
Definition: v3d8_me.f90:1003
blockLoc i
Definition: read.cpp:79
void int int REAL * x
Definition: read.cpp:74
subroutine get_shape(r, n, dn, igpt)
Definition: v3d8_me.f90:846