SPEED
MAKE_NORMAL.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine make_normal (ind, xs1, xs2, xs3, xs4, ys1, ys2, ys3, ys4, zs1, zs2, zs3, zs4, nx, ny, nz, par, arr)
 Makes normal vector of a given surface.
 

Function/Subroutine Documentation

◆ make_normal()

subroutine make_normal ( integer*4, intent(in)  ind,
real*8, intent(in)  xs1,
real*8, intent(in)  xs2,
real*8, intent(in)  xs3,
real*8, intent(in)  xs4,
real*8, intent(in)  ys1,
real*8, intent(in)  ys2,
real*8, intent(in)  ys3,
real*8, intent(in)  ys4,
real*8, intent(in)  zs1,
real*8, intent(in)  zs2,
real*8, intent(in)  zs3,
real*8, intent(in)  zs4,
real*8, intent(out)  nx,
real*8, intent(out)  ny,
real*8, intent(out)  nz,
integer*4, intent(in)  par,
integer*4, intent(in)  arr 
)

Makes normal vector of a given surface.

Author
Ilario Mazzieri
Date
September, 2013
Version
1.0
Parameters
[in]indface of the hex
[in]xs1x-coordinate of the 1-node defining the face
[in]xs2x-coordinate of the 2-node defining the face
[in]xs3x-coordinate of the 3-node defining the face
[in]xs4x-coordinate of the 4-node defining the face
[in]ys1y-coordinate of the 1-node defining the face
[in]ys2y-coordinate of the 2-node defining the face
[in]ys3y-coordinate of the 3-node defining the face
[in]ys4y-coordinate of the 4-node defining the face
[in]zs1z-coordinate of the 1-node defining the face
[in]zs2z-coordinate of the 2-node defining the face
[in]zs3z-coordinate of the 3-node defining the face
[in]zs4z-coordinate of the 4-node defining the face
[in]parcontrol parameter (dummy)
[in]arrcontrol parameter (dummy)
[out]nxx-component of the normal vector
[out]nyy-component of the normal vector
[out]nzz-component of the normal vector

Definition at line 44 of file MAKE_NORMAL.f90.

48
49 implicit none
50
51 integer*4, intent(in) :: ind, par, arr
52
53 real*8 :: a1,a2,a3,b1,b2,b3,aplane,bplane,cplane
54 real*8 :: norm1, norm2, norm3, norm4
55 real*8 :: nx1, nx2, nx3, nx4
56 real*8 :: ny1, ny2, ny3, ny4
57 real*8 :: nz1, nz2, nz3, nz4
58
59 real*8, intent(in) :: xs1, xs2, xs3, xs4, ys1, ys2, ys3, ys4, zs1, zs2, zs3, zs4
60 real*8, intent(out) :: nx,ny,nz
61
62 select case (ind)
63
64 case(1,3,5)
65 a1 = xs4-xs1
66 a2 = ys4-ys1
67 a3 = zs4-zs1
68 b1 = xs2-xs1
69 b2 = ys2-ys1
70 b3 = zs2-zs1
71 aplane = a2*b3 - a3*b2
72 bplane = -a1*b3 + a3*b1
73 cplane = a1*b2 - a2*b1
74
75 norm1 = aplane**2.d0 + bplane**2.d0 + cplane**2.d0
76 nx1 = aplane/dsqrt(norm1)
77 ny1 = bplane/dsqrt(norm1)
78 nz1 = cplane/dsqrt(norm1)
79
80
81 a1 = xs1-xs2
82 a2 = ys1-ys2
83 a3 = zs1-zs2
84 b1 = xs3-xs2
85 b2 = ys3-ys2
86 b3 = zs3-zs2
87 aplane = a2*b3 - a3*b2
88 bplane = -a1*b3 + a3*b1
89 cplane = a1*b2 - a2*b1
90
91 norm2 = aplane**2.d0 + bplane**2.d0 + cplane**2.d0
92 nx2 = aplane/dsqrt(norm2)
93 ny2 = bplane/dsqrt(norm2)
94 nz2 = cplane/dsqrt(norm2)
95
96
97 a1 = xs2-xs3
98 a2 = ys2-ys3
99 a3 = zs2-zs3
100 b1 = xs4-xs3
101 b2 = ys4-ys3
102 b3 = zs4-zs3
103 aplane = a2*b3 - a3*b2
104 bplane = -a1*b3 + a3*b1
105 cplane = a1*b2 - a2*b1
106
107 norm3 = aplane**2.d0 + bplane**2.d0 + cplane**2.d0
108 nx3 = aplane/dsqrt(norm3)
109 ny3 = bplane/dsqrt(norm3)
110 nz3 = cplane/dsqrt(norm3)
111
112
113 a1 = xs3-xs4
114 a2 = ys3-ys4
115 a3 = zs3-zs4
116 b1 = xs1-xs4
117 b2 = ys1-ys4
118 b3 = zs1-zs4
119 aplane = a2*b3 - a3*b2
120 bplane = -a1*b3 + a3*b1
121 cplane = a1*b2 - a2*b1
122
123 norm4 = aplane**2.d0 + bplane**2.d0 + cplane**2.d0
124 nx4 = aplane/dsqrt(norm4)
125 ny4 = bplane/dsqrt(norm4)
126 nz4 = cplane/dsqrt(norm4)
127
128 nx = (nx1 + nx2 + nx3 + nx4)/4.d0
129 ny = (ny1 + ny2 + ny3 + ny4)/4.d0
130 nz = (nz1 + nz2 + nz3 + nz4)/4.d0
131
132
133 case(2,4,6)
134
135 a1 = xs2-xs1
136 a2 = ys2-ys1
137 a3 = zs2-zs1
138 b1 = xs4-xs1
139 b2 = ys4-ys1
140 b3 = zs4-zs1
141 aplane = a2*b3 - a3*b2
142 bplane = -a1*b3 + a3*b1
143 cplane = a1*b2 - a2*b1
144
145 norm1 = aplane**2.d0 + bplane**2.d0 + cplane**2.d0
146 nx1 = aplane/dsqrt(norm1)
147 ny1 = bplane/dsqrt(norm1)
148 nz1 = cplane/dsqrt(norm1)
149
150
151 a1 = xs3-xs2
152 a2 = ys3-ys2
153 a3 = zs3-zs2
154 b1 = xs1-xs2
155 b2 = ys1-ys2
156 b3 = zs1-zs2
157 aplane = a2*b3 - a3*b2
158 bplane = -a1*b3 + a3*b1
159 cplane = a1*b2 - a2*b1
160
161 norm2 = aplane**2.d0 + bplane**2.d0 + cplane**2.d0
162 nx2 = aplane/dsqrt(norm2)
163 ny2 = bplane/dsqrt(norm2)
164 nz2 = cplane/dsqrt(norm2)
165
166
167 a1 = xs4-xs3
168 a2 = ys4-ys3
169 a3 = zs4-zs3
170 b1 = xs2-xs3
171 b2 = ys2-ys3
172 b3 = zs2-zs3
173 aplane = a2*b3 - a3*b2
174 bplane = -a1*b3 + a3*b1
175 cplane = a1*b2 - a2*b1
176
177 norm3 = aplane**2.d0 + bplane**2.d0 + cplane**2.d0
178 nx3 = aplane/dsqrt(norm3)
179 ny3 = bplane/dsqrt(norm3)
180 nz3 = cplane/dsqrt(norm3)
181
182
183 a1 = xs1-xs4
184 a2 = ys1-ys4
185 a3 = zs1-zs4
186 b1 = xs3-xs4
187 b2 = ys3-ys4
188 b3 = zs3-zs4
189 aplane = a2*b3 - a3*b2
190 bplane = -a1*b3 + a3*b1
191 cplane = a1*b2 - a2*b1
192
193 norm4 = aplane**2.d0 + bplane**2.d0 + cplane**2.d0
194 nx4 = aplane/dsqrt(norm4)
195 ny4 = bplane/dsqrt(norm4)
196 nz4 = cplane/dsqrt(norm4)
197
198
199 nx = (nx1 + nx2 + nx3 + nx4)/4.d0
200 ny = (ny1 + ny2 + ny3 + ny4)/4.d0
201 nz = (nz1 + nz2 + nz3 + nz4)/4.d0
202
203
204 end select
205
206
207

Referenced by make_dg_interface(), make_extint_forces(), and setup_dg_elem().

Here is the caller graph for this function: