SPEED
GET_AREA_FACE.f90
Go to the documentation of this file.
1! Copyright (C) 2012 The SPEED FOUNDATION
2! Author: Ilario Mazzieri
3!
4! This file is part of SPEED.
5!
6! SPEED is free software; you can redistribute it and/or modify it
7! under the terms of the GNU Affero General Public License as
8! published by the Free Software Foundation, either version 3 of the
9! License, or (at your option) any later version.
10!
11! SPEED is distributed in the hope that it will be useful, but
12! WITHOUT ANY WARRANTY; without even the implied warranty of
13! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14! Affero General Public License for more details.
15!
16! You should have received a copy of the GNU Affero General Public License
17! along with SPEED. If not, see <http://www.gnu.org/licenses/>.
18
37
38 subroutine get_area_face(x1,x2,x3,x4,y1,y2,y3,y4,z1,z2,z3,z4,surf,ielem)
39
40 implicit none
41
42 integer*4, intent(in) :: ielem
43
44 real*8 :: a,b,c,vx,vy,vz,wx,wy,wz,xbar,ybar,zbar
45 real*8, intent(in) :: x1,x2,x3,x4,y1,y2,y3,y4,z1,z2,z3,z4
46 real*8, intent(out) :: surf
47
48 surf = 0.d0
49
50 xbar = (x1 + x2 + x3 + x4)/4.d0
51 ybar = (y1 + y2 + y3 + y4)/4.d0
52 zbar = (z1 + z2 + z3 + z4)/4.d0
53
54 vx = x4 - x1
55 vy = y4 - y1
56 vz = z4 - z1
57
58 wx = xbar - x1
59 wy = ybar - y1
60 wz = zbar - z1
61
62
63 a = vy*wz - vz*wy
64 b = -vx*wz + vz*wx
65 c = vx*wy - vy*wx
66
67
68
69 surf = surf + 0.5d0*dsqrt(a**2.d0 + b**2.d0 + c**2.d0)
70
71 vx = x2 - x1
72 vy = y2 - y1
73 vz = z2 - z1
74
75 wx = xbar - x1
76 wy = ybar - y1
77 wz = zbar - z1
78
79
80 a = vy*wz - vz*wy
81 b = -vx*wz + vz*wx
82 c = vx*wy - vy*wx
83
84 surf = surf + 0.5d0*dsqrt(a**2.d0 + b**2.d0 + c**2.d0)
85
86 vx = x2 - x3
87 vy = y2 - y3
88 vz = z2 - z3
89
90 wx = xbar - x3
91 wy = ybar - y3
92 wz = zbar - z3
93
94
95 a = vy*wz - vz*wy
96 b = -vx*wz + vz*wx
97 c = vx*wy - vy*wx
98
99 surf = surf + 0.5d0*dsqrt(a**2.d0 + b**2.d0 + c**2.d0)
100
101 vx = x4 - x3
102 vy = y4 - y3
103 vz = z4 - z3
104
105 wx = xbar - x3
106 wy = ybar - y3
107 wz = zbar - z3
108
109
110 a = vy*wz - vz*wy
111 b = -vx*wz + vz*wx
112 c = vx*wy - vy*wx
113
114 surf = surf + 0.5d0*dsqrt(a**2.d0 + b**2.d0 + c**2.d0)
115
116 end subroutine get_area_face
subroutine get_area_face(x1, x2, x3, x4, y1, y2, y3, y4, z1, z2, z3, z4, surf, ielem)
Computes area of a face (quad).