Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FaceCentroid.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 face centroid of a triangular or quadrilateral face.
26 !
27 ! Description: File contains the following subroutines:
28 ! - FaceCentroidTria = Centroid of a triangle
29 ! - FaceCentroidQuad = Centroid of a quadrilateral
30 !
31 ! Input: xyzNodes = coordinates (1st index) of the nodes (2nd index) of the
32 ! polygon (clockwise ordered).
33 !
34 ! Output: fCenX, fCenY, fCenZ = x-,y-,z-component of the face centroid.
35 !
36 ! Notes:
37 ! 1. Quadrilateral face centroid is only approximate for distorted faces.
38 !
39 !******************************************************************************
40 !
41 ! $Id: FaceCentroid.F90,v 1.3 2008/12/06 08:44:09 mtcampbe Exp $
42 !
43 ! Copyright: (c) 2002 by the University of Illinois
44 !
45 !******************************************************************************
46 
47 SUBROUTINE facecentroidtria( xyz,fCenX,fCenY,fCenZ )
48 
49  USE moddatatypes
50 
51  IMPLICIT NONE
52 
53 ! ... parameters
54 
55  REAL(RFREAL), INTENT(IN) :: xyz(3,3)
56  REAL(RFREAL), INTENT(OUT) :: fcenx, fceny, fcenz
57 
58 ! ... local variables
59 
60  REAL(RFREAL), PARAMETER :: thrd = 1.0_rfreal/3.0_rfreal
61 
62 !******************************************************************************
63 
64  fcenx = thrd*(xyz(1,1) + xyz(1,2) + xyz(1,3))
65  fceny = thrd*(xyz(2,1) + xyz(2,2) + xyz(2,3))
66  fcenz = thrd*(xyz(3,1) + xyz(3,2) + xyz(3,3))
67 
68 END SUBROUTINE facecentroidtria
69 
70 ! #############################################################################
71 ! #############################################################################
72 
73 SUBROUTINE facecentroidquad( xyz,fCenX,fCenY,fCenZ )
74 
75  USE moddatatypes
76 
77  IMPLICIT NONE
78 
79 ! ... parameters
80 
81  REAL(RFREAL), INTENT(IN) :: xyz(3,4)
82  REAL(RFREAL), INTENT(OUT) :: fcenx, fceny, fcenz
83 
84 ! ... local variables
85 
86 !******************************************************************************
87 
88  fcenx = 0.25_rfreal*(xyz(1,1) + xyz(1,2) + xyz(1,3) + xyz(1,4))
89  fceny = 0.25_rfreal*(xyz(2,1) + xyz(2,2) + xyz(2,3) + xyz(2,4))
90  fcenz = 0.25_rfreal*(xyz(3,1) + xyz(3,2) + xyz(3,3) + xyz(3,4))
91 
92 END SUBROUTINE facecentroidquad
93 
94 !******************************************************************************
95 !
96 ! RCS Revision history:
97 !
98 ! $Log: FaceCentroid.F90,v $
99 ! Revision 1.3 2008/12/06 08:44:09 mtcampbe
100 ! Updated license.
101 !
102 ! Revision 1.2 2008/11/19 22:17:22 mtcampbe
103 ! Added Illinois Open Source License/Copyright
104 !
105 ! Revision 1.1 2004/12/01 16:48:32 haselbac
106 ! Initial revision after changing case
107 !
108 ! Revision 1.1 2002/03/14 19:01:10 haselbac
109 ! Initial revision
110 !
111 !******************************************************************************
112 
113 
114 
115 
116 
117 
subroutine facecentroidtria(xyz, fCenX, fCenY, fCenZ)
subroutine facecentroidquad(xyz, fCenX, fCenY, fCenZ)