Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ControlVolume.F90
Go to the documentation of this file.
1 ! *********************************************************************
2 ! * Rocstar Simulation Suite *
3 ! * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4 ! * *
5 ! * Illinois Rocstar LLC *
6 ! * Champaign, IL *
7 ! * www.illinoisrocstar.com *
8 ! * sales@illinoisrocstar.com *
9 ! * *
10 ! * License: See LICENSE file in top level of distribution package or *
11 ! * http://opensource.org/licenses/NCSA *
12 ! *********************************************************************
13 ! *********************************************************************
14 ! * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15 ! * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16 ! * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17 ! * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18 ! * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19 ! * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20 ! * Arising FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21 ! * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22 ! *********************************************************************
23 !******************************************************************************
24 !
25 ! Purpose: calculate the volume of a cell.
26 !
27 ! Description: file contains the following subroutines:
28 !
29 ! - VolumeTetra = tetrahedron
30 ! - VolumePyramid = pyramid
31 ! - VolumePrism = prism
32 ! - VolumeHexa = hexahedron
33 !
34 ! Input: xyzNodes = coordinates (1st index) of the nodes (2nd index) of the
35 ! control volume (must be ordered!);
36 ! faceVecs = face vectors (outward facing).
37 !
38 ! Output: volume = volume of the cell.
39 !
40 ! Notes: volume is calculated using the divergence theorem as described in:
41 ! Bruner, C.W.S.: Geometric Properties of Arbitrary Polyhedra in Terms
42 ! of Face Geometry. AIAA Journal, 33 (1995), p. 1350. See developer`s
43 ! guide for numbering of nodes.
44 !
45 !******************************************************************************
46 !
47 ! $Id: ControlVolume.F90,v 1.3 2008/12/06 08:44:08 mtcampbe Exp $
48 !
49 ! Copyright: (c) 2001 by the University of Illinois
50 !
51 !******************************************************************************
52 
53 SUBROUTINE volumetetra( xyzNodes,faceVecs,volume )
54 
55  USE moddatatypes
56  IMPLICIT NONE
57 
58 ! ... parameters
59  REAL(RFREAL) :: xyznodes(3,4), facevecs(3,4)
60  REAL(RFREAL) :: volume
61 
62 ! ... local variables
63 
64 
65 !******************************************************************************
66 
67 END SUBROUTINE volumetetra
68 
69 ! #############################################################################
70 ! #############################################################################
71 
72 SUBROUTINE volumepyramid( xyzNodes,faceVecs,volume )
73 
74  USE moddatatypes
75  IMPLICIT NONE
76 
77 ! ... parameters
78  REAL(RFREAL) :: xyznodes(3,5), facevecs(3,5)
79  REAL(RFREAL) :: volume
80 
81 ! ... local variables
82 
83 
84 !******************************************************************************
85 
86 END SUBROUTINE volumepyramid
87 
88 ! #############################################################################
89 ! #############################################################################
90 
91 SUBROUTINE volumeprism( xyzNodes,faceVecs,volume )
92 
93  USE moddatatypes
94  IMPLICIT NONE
95 
96 ! ... parameters
97  REAL(RFREAL) :: xyznodes(3,6), facevecs(3,5)
98  REAL(RFREAL) :: volume
99 
100 ! ... local variables
101 
102 
103 !******************************************************************************
104 
105 END SUBROUTINE volumeprism
106 
107 ! #############################################################################
108 ! #############################################################################
109 
110 SUBROUTINE volumehexa( xyzNodes,faceVecs,volume )
111 
112  USE moddatatypes
113  IMPLICIT NONE
114 
115 ! ... parameters
116  REAL(RFREAL) :: xyznodes(3,8), facevecs(3,6)
117  REAL(RFREAL) :: volume
118 
119 ! ... local variables
120  REAL(RFREAL) :: rm1(3), rm2(3), rm3(3), rm4(3), rm5(3), rm6(3)
121  REAL(RFREAL) :: rms1, rms2, rms3, rms4, rms5, rms6
122 
123 !******************************************************************************
124 
125  rm1(1) = 0.25_rfreal*(xyznodes(1,1)+xyznodes(1,2)+xyznodes(1,3)+xyznodes(1,4))
126  rm1(2) = 0.25_rfreal*(xyznodes(2,1)+xyznodes(2,2)+xyznodes(2,3)+xyznodes(2,4))
127  rm1(3) = 0.25_rfreal*(xyznodes(3,1)+xyznodes(3,2)+xyznodes(3,3)+xyznodes(3,4))
128 
129  rm2(1) = 0.25_rfreal*(xyznodes(1,5)+xyznodes(1,8)+xyznodes(1,7)+xyznodes(1,6))
130  rm2(2) = 0.25_rfreal*(xyznodes(2,5)+xyznodes(2,8)+xyznodes(2,7)+xyznodes(2,6))
131  rm2(3) = 0.25_rfreal*(xyznodes(3,5)+xyznodes(3,8)+xyznodes(3,7)+xyznodes(3,6))
132 
133  rm3(1) = 0.25_rfreal*(xyznodes(1,1)+xyznodes(1,5)+xyznodes(1,6)+xyznodes(1,2))
134  rm3(2) = 0.25_rfreal*(xyznodes(2,1)+xyznodes(2,5)+xyznodes(2,6)+xyznodes(2,2))
135  rm3(3) = 0.25_rfreal*(xyznodes(3,1)+xyznodes(3,5)+xyznodes(3,6)+xyznodes(3,2))
136 
137  rm4(1) = 0.25_rfreal*(xyznodes(1,8)+xyznodes(1,4)+xyznodes(1,3)+xyznodes(1,7))
138  rm4(2) = 0.25_rfreal*(xyznodes(2,8)+xyznodes(2,4)+xyznodes(2,3)+xyznodes(2,7))
139  rm4(3) = 0.25_rfreal*(xyznodes(3,8)+xyznodes(3,4)+xyznodes(3,3)+xyznodes(3,7))
140 
141  rm5(1) = 0.25_rfreal*(xyznodes(1,1)+xyznodes(1,4)+xyznodes(1,8)+xyznodes(1,5))
142  rm5(2) = 0.25_rfreal*(xyznodes(2,1)+xyznodes(2,4)+xyznodes(2,8)+xyznodes(2,5))
143  rm5(3) = 0.25_rfreal*(xyznodes(3,1)+xyznodes(3,4)+xyznodes(3,8)+xyznodes(3,5))
144 
145  rm6(1) = 0.25_rfreal*(xyznodes(1,2)+xyznodes(1,6)+xyznodes(1,7)+xyznodes(1,3))
146  rm6(2) = 0.25_rfreal*(xyznodes(2,2)+xyznodes(2,6)+xyznodes(2,7)+xyznodes(2,3))
147  rm6(3) = 0.25_rfreal*(xyznodes(3,2)+xyznodes(3,6)+xyznodes(3,7)+xyznodes(3,3))
148 
149  rms1 = rm1(1)*facevecs(1,1) + rm1(2)*facevecs(2,1) + rm1(3)*facevecs(3,1)
150  rms2 = rm2(1)*facevecs(1,2) + rm2(2)*facevecs(2,2) + rm2(3)*facevecs(3,2)
151  rms3 = rm3(1)*facevecs(1,3) + rm3(2)*facevecs(2,3) + rm3(3)*facevecs(3,3)
152  rms4 = rm4(1)*facevecs(1,4) + rm4(2)*facevecs(2,4) + rm4(3)*facevecs(3,4)
153  rms5 = rm5(1)*facevecs(1,5) + rm5(2)*facevecs(2,5) + rm5(3)*facevecs(3,5)
154  rms6 = rm6(1)*facevecs(1,6) + rm6(2)*facevecs(2,6) + rm6(3)*facevecs(3,6)
155 
156  volume = (rms1+rms2+rms3+rms4+rms5+rms6)/3._rfreal
157 
158 END SUBROUTINE volumehexa
159 
160 !******************************************************************************
161 !
162 ! RCS Revision history:
163 !
164 ! $Log: ControlVolume.F90,v $
165 ! Revision 1.3 2008/12/06 08:44:08 mtcampbe
166 ! Updated license.
167 !
168 ! Revision 1.2 2008/11/19 22:17:22 mtcampbe
169 ! Added Illinois Open Source License/Copyright
170 !
171 ! Revision 1.1 2004/12/01 16:48:22 haselbac
172 ! Initial revision after changing case
173 !
174 ! Revision 1.2 2002/08/30 01:47:58 jblazek
175 ! Added support for moving grids.
176 !
177 ! Revision 1.1 2002/01/08 22:09:16 jblazek
178 ! Added calculation of face vectors and volumes.
179 !
180 !******************************************************************************
181 
182 
183 
184 
185 
186 
subroutine volumepyramid(xyzNodes, faceVecs, volume)
int volume(const block *b)
Definition: split.cpp:181
subroutine volumeprism(xyzNodes, faceVecs, volume)
subroutine volumehexa(xyzNodes, faceVecs, volume)
subroutine volumetetra(xyzNodes, faceVecs, volume)