Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
implicit_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 
54 !!****
55 !!
56 !! NAME
57 !! implicit_v3d8_mass
58 !!
59 !! FUNCTION
60 !! This subroutine constructs the global mass matrix as a lumped matrix.
61 !!
62 !! INPUTS
63 !! NumEl -- The number of elements that this processor knows about
64 !! NumNp -- The number of nodes that this processor knows about
65 !! NumMat -- The global number of materials in the structure
66 !! coor -- The coordinates of each of the nodes
67 !! nodes -- The connectivity table
68 !! MatType -- Mapping of material types to elements
69 !! ri -- Gauss point positions within an element
70 !! rho -- Density of the materials
71 !! iElStart -- First element to compute the mass matrix for
72 !! iElEnd -- Last element to compute the mass matrix for
73 !!
74 !! OUTPUTS
75 !! xm -- The inverse of the diagonal of the mass matrix
76 !!
77 !! USES
78 !! none
79 !!
80 !!****
81 
82 SUBROUTINE implicit_v3d8_mass( NumEl, NumNP, NumMat,&
83  coor,nodes,mattype,ri,rho,xm,ielstart, ielend)
84 
85 
86  USE precision
87 
88  IMPLICIT NONE
89 
90  INTEGER :: ielstart, ielend
91 
92  INTEGER :: numel, numnp, nummat
93  INTEGER, DIMENSION(1:NumEl) :: mattype
94  INTEGER, DIMENSION(1:8,1:NumEl) :: nodes
95  REAL(KIND=wp), DIMENSION(1:3,1:NumNP) :: coor
96  REAL(KIND=wp), DIMENSION(1:3,1:8) :: ri
97  REAL(KIND=wp), DIMENSION(1:NumMat) :: rho
98  REAL(KIND=wp), DIMENSION(1:NumNP) :: xm
99 
100  REAL(kind=wp) :: nnn(8), dn(8,3)
101  integer :: ngpts = 8
102  INTEGER :: i,imat, igpt
103  INTEGER :: n1,n2,n3,n4,n5,n6,n7,n8
104  REAL(kind=wp) :: element_volume
105  REAL(kind=wp),DIMENSION(1:3,1:8) :: coord
106  REAL(kind=wp),DIMENSION(1:3,1:3) :: jac, jacinv
107  REAL(kind=wp) :: detj
108  REAL(kind=wp) :: node_mass
109  LOGICAL :: error
110 
111  INTEGER :: j, k
112 
113 !!$ REAL(KIND=wp), ALLOCATABLE, DIMENSION(:) :: WT, HH, DH1, DH2, DH3
114 !!$ REAL(KIND=wp), ALLOCATABLE, DIMENSION(:) :: DET
115 !!$ REAL(KIND=wp), DIMENSION(1:3,1:280) :: DHG
116 !!$
117 !!$ REAL(KIND=wp), DIMENSION(1:8) :: NodalMass, Mass_ii
118 !!$ REAL(KIND=wp) :: Mass, SumMass_ii
119 !!$ REAL(KIND=wp) :: TotMass
120 !!$ INTEGER :: ii, j
121 
122 !!$ ALLOCATE(WT(1:ngpts))
123 !!$ ALLOCATE(HH(1:ngpts*8))
124 !!$ ALLOCATE(DH1(1:ngpts*8),DH2(1:ngpts*8),DH3(1:ngpts*8))
125 !!$ ALLOCATE(DET(1:ngpts))
126 
127  error = .false.
128 
129 
130 
131  DO i = ielstart, ielend
132 
133  imat = mattype(i)
134 
135  element_volume = 0._wp ! Initialize
136 
137  n1 = nodes(1,i)
138  n2 = nodes(2,i)
139  n3 = nodes(3,i)
140  n4 = nodes(4,i)
141  n5 = nodes(5,i)
142  n6 = nodes(6,i)
143  n7 = nodes(7,i)
144  n8 = nodes(8,i)
145 
146  coord(1,1) = coor(1,n1)
147  coord(2,1) = coor(2,n1)
148  coord(3,1) = coor(3,n1)
149 
150  coord(1,2) = coor(1,n2)
151  coord(2,2) = coor(2,n2)
152  coord(3,2) = coor(3,n2)
153 
154  coord(1,3) = coor(1,n3)
155  coord(2,3) = coor(2,n3)
156  coord(3,3) = coor(3,n3)
157 
158  coord(1,4) = coor(1,n4)
159  coord(2,4) = coor(2,n4)
160  coord(3,4) = coor(3,n4)
161 
162  coord(1,5) = coor(1,n5)
163  coord(2,5) = coor(2,n5)
164  coord(3,5) = coor(3,n5)
165 
166  coord(1,6) = coor(1,n6)
167  coord(2,6) = coor(2,n6)
168  coord(3,6) = coor(3,n6)
169 
170  coord(1,7) = coor(1,n7)
171  coord(2,7) = coor(2,n7)
172  coord(3,7) = coor(3,n7)
173 
174  coord(1,8) = coor(1,n8)
175  coord(2,8) = coor(2,n8)
176  coord(3,8) = coor(3,n8)
177 
178  DO igpt = 1, ngpts ! LOOP over gauss points
179 
180  CALL get_shape(ri,nnn,dn,igpt) ! Get shape functions and derivatives
181 
182  jac(1:3,1:3) = 0.0
183  jacinv(1:3,1:3) = 0.0
184 
185  CALL get_jacobien(coord,3,8,dn, & ! Compute jacobien
186  jac,jacinv,detj,error)
187 
188  IF(error) THEN ! Check for singular jacobien
189  WRITE(*,1000) igpt, i, detj
190  stop
191  END IF
192 
193  element_volume = element_volume + detj ! * wi(igpt), weigth for hex element = 1
194  ENDDO
195 
196 
197  node_mass = element_volume*rho(imat)*0.125_wp
198 
199  xm(n1 ) = xm(n1 ) + node_mass
200  xm(n2 ) = xm(n2 ) + node_mass
201  xm(n3 ) = xm(n3 ) + node_mass
202  xm(n4 ) = xm(n4 ) + node_mass
203  xm(n5 ) = xm(n5 ) + node_mass
204  xm(n6 ) = xm(n6 ) + node_mass
205  xm(n7 ) = xm(n7 ) + node_mass
206  xm(n8 ) = xm(n8 ) + node_mass
207 
208 
209 ! alternative
210 
211 !!$ CALL DHH8 (ngpts,WT,HH,DH1,DH2,DH3)
212 !!$
213 !!$ CALL JAC3D (8,coord(1,:),coord(2,:),coord(3,:),ngpts, &
214 !!$ DH1,DH2,DH3,DH1,DH2,DH3,DHG,DET)
215 !!$
216 !!$ element_volume = 0.d0
217 !!$ Mass_ii(:) = 0.d0
218 !!$
219 !!$! form diagonal terms of consistent mass matrix
220 !!$
221 !!$ ! M = int ( N rho N dV )
222 !!$ ! ii i i
223 !!$
224 !!$
225 !!$ J = 0
226 !!$ DO igpt = 1, ngpts
227 !!$ element_volume = element_volume + det(igpt)* wt(igpt)
228 !!$ DO ii = 1, 8
229 !!$ Mass_ii(ii) = Mass_ii(ii) + HH(J+ii) * rho(imat)* HH(J+ii) * det(igpt)* wt(igpt)
230 !!$ ENDDO
231 !!$ J = J + 8
232 !!$ ENDDO
233 !!$
234 !!$
235 !!$!
236 !!$! /
237 !!$! | rho Dv
238 !!$! |
239 !!$! /
240 !!$
241 !!$ Mass = rho(imat)*element_volume
242 !!$
243 !!$! Some the diagonal tems Mii of the consistent mass matix
244 !!$
245 !!$ SumMass_ii = 0.d0
246 !!$ DO ii = 1, 8
247 !!$ SumMass_ii = SumMass_ii + Mass_ii(ii)
248 !!$ ENDDO
249 !!$
250 !!$ DO ii = 1, 8
251 !!$ NodalMass(ii) = Mass_ii(ii) * Mass / SumMass_ii
252 !!$ ENDDO
253 !!$
254 !!$ PRINT*,NodalMass(:)
255 
256  ENDDO
257 
258  xm(:) = 1.0_wp/xm(:)
259 
260 1000 FORMAT (/,2x,'>>> Fatal error!', &
261  /,6x,'Jacobien at gauss point (',i2, &
262  ') of element ',i6,' is singular with detj =',e14.8)
263 
264 END SUBROUTINE implicit_v3d8_mass
265 
j indices k indices k
Definition: Indexing.h:6
int coord[NPANE][NROW *NCOL][3]
Definition: blastest.C:86
subroutine implicit_v3d8_mass(NumEl, NumNP, NumMat, coor, nodes, MatType, ri, rho, xm, iElStart, iElEnd)
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
j indices j
Definition: Indexing.h:6
subroutine get_shape(r, n, dn, igpt)
Definition: v3d8_me.f90:846