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