OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
centroid.F
Go to the documentation of this file.
1Copyright> OpenRadioss
2Copyright> Copyright (C) 1986-2025 Altair Engineering Inc.
3Copyright>
4Copyright> This program is free software: you can redistribute it and/or modify
5Copyright> it under the terms of the GNU Affero General Public License as published by
6Copyright> the Free Software Foundation, either version 3 of the License, or
7Copyright> (at your option) any later version.
8Copyright>
9Copyright> This program is distributed in the hope that it will be useful,
10Copyright> but WITHOUT ANY WARRANTY; without even the implied warranty of
11Copyright> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12Copyright> GNU Affero General Public License for more details.
13Copyright>
14Copyright> You should have received a copy of the GNU Affero General Public License
15Copyright> along with this program. If not, see <https://www.gnu.org/licenses/>.
16Copyright>
17Copyright>
18Copyright> Commercial Alternative: Altair Radioss Software
19Copyright>
20Copyright> As an alternative to this open-source version, Altair also offers Altair Radioss
21Copyright> software under a commercial license. Contact Altair to discuss further if the
22Copyright> commercial version may interest you: https://www.altair.com/radioss/.
23!||====================================================================
24!|| centroid3 ../engine/source/multifluid/centroid.F
25!||--- called by ------------------------------------------------------
26!|| alew6 ../engine/source/ale/grid/alew6.F
27!|| multi_face_elem_data ../engine/source/multifluid/multi_face_data_elem.F
28!||====================================================================
29 SUBROUTINE centroid3(NEL, LENGTH, NFT, IXS, XGRID,
30 . ELEM_CENTROID, FACE_CENTROID)
31C-----------------------------------------------
32C D e s c r i p t i o n
33C-----------------------------------------------
34C Computes the centroids of the elements
35C-----------------------------------------------
36C I m p l i c i t T y p e s
37C-----------------------------------------------
38#include "implicit_f.inc"
39C-----------------------------------------------
40C C o m m o n B l o c k s
41C-----------------------------------------------
42! NIXS
43C-----------------------------------------------
44C D u m m y A r g u m e n t s
45C-----------------------------------------------
46 INTEGER, INTENT(IN) :: NEL, NFT, IXS(NIXS, *), LENGTH
47 my_real, INTENT(IN) :: xgrid(3, *)
48 my_real, INTENT(OUT) :: elem_centroid(3, nel), face_centroid(3, 6, nel)
49C-----------------------------------------------
50C L o c a l V a r i a b l e s
51C-----------------------------------------------
52 INTEGER :: I, II, NODE1, NODE2, NODE3, NODE4, NODE5, NODE6, NODE7, NODE8
54 . x1(3), x2(3), x3(3), x4(3), x5(3), x6(3), x7(3), x8(3)
55 DO ii = 1, nel
56 i = ii + nft
57C Nodes of the element locally stored in NODE* for memory access
58 node1 = ixs(2, i)
59 node2 = ixs(3, i)
60 node3 = ixs(4, i)
61 node4 = ixs(5, i)
62 node5 = ixs(6, i)
63 node6 = ixs(7, i)
64 node7 = ixs(8, i)
65 node8 = ixs(9, i)
66C Node coordinates
67 x1(1:3) = xgrid(1:3, node1)
68 x2(1:3) = xgrid(1:3, node2)
69 x3(1:3) = xgrid(1:3, node3)
70 x4(1:3) = xgrid(1:3, node4)
71 x5(1:3) = xgrid(1:3, node5)
72 x6(1:3) = xgrid(1:3, node6)
73 x7(1:3) = xgrid(1:3, node7)
74 x8(1:3) = xgrid(1:3, node8)
75C Centroid
76 elem_centroid(1:3, ii) = one_over_8 * (x1(1:3) + x2(1:3) + x3(1:3) + x4(1:3) +
77 . x5(1:3) + x6(1:3) + x7(1:3) + x8(1:3))
78C Face centroid
79C Face 1
80 face_centroid(1:3, 1, ii) = fourth * (x1(1:3) + x2(1:3) + x3(1:3) + x4(1:3))
81C Face 2
82 face_centroid(1:3, 2, ii) = fourth * (x3(1:3) + x4(1:3) + x8(1:3) + x7(1:3))
83C Face 3
84 face_centroid(1:3, 3, ii) = fourth * (x5(1:3) + x6(1:3) + x7(1:3) + x8(1:3))
85C Face 4
86 face_centroid(1:3, 4, ii) = fourth * (x1(1:3) + x2(1:3) + x6(1:3) + x5(1:3))
87C Face 5
88 face_centroid(1:3, 5, ii) = fourth * (x2(1:3) + x3(1:3) + x7(1:3) + x6(1:3))
89C Face 6
90 face_centroid(1:3, 6, ii) = fourth * (x1(1:3) + x4(1:3) + x8(1:3) + x5(1:3))
91 ENDDO
92 END SUBROUTINE centroid3
93
94!||====================================================================
95!|| centroid3t ../engine/source/multifluid/centroid.F
96!||--- called by ------------------------------------------------------
97!|| alew6 ../engine/source/ale/grid/alew6.F
98!|| multi_face_elem_data ../engine/source/multifluid/multi_face_data_elem.F
99!||--- calls -----------------------------------------------------
100!|| geom ../engine/source/ale/alemuscl/geom.F
101!||====================================================================
102 SUBROUTINE centroid3t(NEL, LENGTH, NFT, IXS, XGRID,
103 . ELEM_CENTROID, FACE_CENTROID)
104C-----------------------------------------------
105C D e s c r i p t i o n
106C-----------------------------------------------
107C Computes the centroids of the elements
108C-----------------------------------------------
109C I m p l i c i t T y p e s
110C-----------------------------------------------
111#include "implicit_f.inc"
112C-----------------------------------------------
113C C o m m o n B l o c k s
114C-----------------------------------------------
115! NIXS
116C-----------------------------------------------
117C D u m m y A r g u m e n t s
118C-----------------------------------------------
119 INTEGER, INTENT(IN) :: NEL, NFT, IXS(NIXS, *), LENGTH
120 my_real, INTENT(IN) :: XGRID(3, *)
121 my_real, INTENT(OUT) :: elem_centroid(3, nel), face_centroid(3, 6, nel)
122C-----------------------------------------------
123C L o c a l V a r i a b l e s
124C-----------------------------------------------
125 INTEGER :: I, II, NODE1, NODE2, NODE3, NODE4, NODE5, NODE6, NODE7, NODE8
126 my_real
127 . x1(3), x2(3), x3(3), x4(3), vol
128 my_real
129 . a(3), b(3), c(3)
130 DO ii = 1, nel
131 i = ii + nft
132C Nodes of the element locally stored in NODE* for memory access
133 node1 = ixs(2, i)
134 node2 = ixs(4, i)
135 node3 = ixs(7, i)
136 node4 = ixs(6, i)
137C Node coordinates
138 x1(1:3) = xgrid(1:3, node1)
139 x2(1:3) = xgrid(1:3, node2)
140 x3(1:3) = xgrid(1:3, node3)
141 x4(1:3) = xgrid(1:3, node4)
142 elem_centroid(1:3, ii) = zero
143C Centroid
144 vol = zero
145 a(1:3) = x1(1:3)
146 b(1:3) = x2(1:3)
147 c(1:3) = x4(1:3)
148 CALL geom(a, b, c,elem_centroid(1,ii),elem_centroid(2,ii),elem_centroid(3,ii), vol)
149
150 a(1:3) = x1(1:3)
151 b(1:3) = x3(1:3)
152 c(1:3) = x2(1:3)
153 CALL geom(a, b, c,elem_centroid(1,ii),elem_centroid(2,ii),elem_centroid(3,ii), vol)
154
155 a(1:3) = x1(1:3)
156 b(1:3) = x4(1:3)
157 c(1:3) = x3(1:3)
158 CALL geom(a, b, c,elem_centroid(1,ii),elem_centroid(2,ii),elem_centroid(3,ii), vol)
159
160 a(1:3) = x2(1:3)
161 b(1:3) = x3(1:3)
162 c(1:3) = x4(1:3)
163 CALL geom(a, b, c,elem_centroid(1,ii),elem_centroid(2,ii),elem_centroid(3,ii), vol)
164
165 vol = vol / 6.d0
166 elem_centroid(1:3, ii) = elem_centroid(1:3, ii) / 12.d0 / vol
167
168 !ELEM_CENTROID(1:3, II) = FOURTH * (X1(1:3) + X2(1:3) + X3(1:3) + X4(1:3))
169C Face centroid
170C Face 1
171 face_centroid(1:3, 5, ii) = third * (x1(1:3) + x2(1:3) + x3(1:3))
172C Face 2
173 face_centroid(1:3, 6, ii) = third * (x1(1:3) + x2(1:3) + x4(1:3))
174C Face 3
175 face_centroid(1:3, 2, ii) = third * (x2(1:3) + x3(1:3) + x4(1:3))
176C Face 4
177 face_centroid(1:3, 4, ii) = third * (x1(1:3) + x3(1:3) + x4(1:3))
178 ENDDO
179 END SUBROUTINE centroid3t
180
181!||====================================================================
182!|| centroid2 ../engine/source/multifluid/centroid.F
183!||--- called by ------------------------------------------------------
184!|| alew6 ../engine/source/ale/grid/alew6.F
185!|| multi_face_elem_data ../engine/source/multifluid/multi_face_data_elem.F
186!||====================================================================
187 SUBROUTINE centroid2(NEL, LENGTH, NFT, IXQ, XGRID,
188 . ELEM_CENTROID, FACE_CENTROID)
189C-----------------------------------------------
190C D e s c r i p t i o n
191C-----------------------------------------------
192C Computes the centroids of the elements
193C-----------------------------------------------
194C I m p l i c i t T y p e s
195C-----------------------------------------------
196#include "implicit_f.inc"
197C-----------------------------------------------
198C C o m m o n B l o c k s
199C-----------------------------------------------
200! NIXS
201C-----------------------------------------------
202C D u m m y A r g u m e n t s
203C-----------------------------------------------
204 INTEGER, INTENT(IN) :: NEL, NFT, IXQ(NIXQ, *), LENGTH
205 my_real, INTENT(IN) :: XGRID(3, *)
206 my_real, INTENT(OUT) :: ELEM_CENTROID(3, NEL), FACE_CENTROID(3, 6, NEL)
207C-----------------------------------------------
208C L o c a l V a r i a b l e s
209C-----------------------------------------------
210 INTEGER :: I, II, NODE1, NODE2, NODE3, NODE4
211 my_real
212 . X1(3), X2(3), X3(3), X4(3)
213 DO ii = 1, nel
214 i = ii + nft
215C Nodes of the element locally stored in NODE* for memory access
216 node1 = ixq(2, i)
217 node2 = ixq(3, i)
218 node3 = ixq(4, i)
219 node4 = ixq(5, i)
220C Node coordinates
221 x1(1:3) = xgrid(1:3, node1)
222 x2(1:3) = xgrid(1:3, node2)
223 x3(1:3) = xgrid(1:3, node3)
224 x4(1:3) = xgrid(1:3, node4)
225C Centroid
226 elem_centroid(1:3, ii) = fourth * (x1(1:3) + x2(1:3) + x3(1:3) + x4(1:3))
227C Face centroid
228C Face 1
229 face_centroid(1:3, 1, ii) = half * (x1(1:3) + x2(1:3))
230C Face 2
231 face_centroid(1:3, 2, ii) = half * (x2(1:3) + x3(1:3))
232C Face 3
233 face_centroid(1:3, 3, ii) = half * (x3(1:3) + x4(1:3))
234C Face 4
235 face_centroid(1:3, 4, ii) = half * (x1(1:3) + x4(1:3))
236
237 ENDDO
238 END SUBROUTINE centroid2
239
240!||====================================================================
241!|| centroid2t ../engine/source/multifluid/centroid.F
242!||--- called by ------------------------------------------------------
243!|| multi_face_elem_data ../engine/source/multifluid/multi_face_data_elem.F
244!||====================================================================
245 SUBROUTINE centroid2t(NEL, LENGTH, NFT, IXTG, XGRID,
246 . ELEM_CENTROID, FACE_CENTROID)
247C-----------------------------------------------
248C D e s c r i p t i o n
249C-----------------------------------------------
250C Computes the centroids of the elements
251C-----------------------------------------------
252C I m p l i c i t T y p e s
253C-----------------------------------------------
254#include "implicit_f.inc"
255C-----------------------------------------------
256C C o m m o n B l o c k s
257C-----------------------------------------------
258! NIXS
259C-----------------------------------------------
260C D u m m y A r g u m e n t s
261C-----------------------------------------------
262 INTEGER, INTENT(IN) :: NEL, NFT, IXTG(NIXTG, *), LENGTH
263 my_real, INTENT(IN) :: XGRID(3, *)
264 my_real, INTENT(OUT) :: ELEM_CENTROID(3, NEL), FACE_CENTROID(3, 6, NEL)
265C-----------------------------------------------
266C L o c a l V a r i a b l e s
267C-----------------------------------------------
268 INTEGER :: I, II, NODE1, NODE2, NODE3, NODE4, NODE5, NODE6, NODE7, NODE8
269 my_real
270 . X1(3), X2(3), X3(3), X4(3), X5(3), X6(3), X7(3), X8(3)
271 DO II = 1, nel
272 i = ii + nft
273C Nodes of the element locally stored in NODE* for memory access
274 node1 = ixtg(2, i)
275 node2 = ixtg(3, i)
276 node3 = ixtg(4, i)
277C Node coordinates
278 x1(1:3) = xgrid(1:3, node1)
279 x2(1:3) = xgrid(1:3, node2)
280 x3(1:3) = xgrid(1:3, node3)
281C Centroid
282 elem_centroid(1:3, ii) = third * (x1(1:3) + x2(1:3) + x3(1:3))
283C Face centroid
284C Face 1
285 face_centroid(1:3, 1, ii) = half * (x1(1:3) + x2(1:3))
286C Face 2
287 face_centroid(1:3, 2, ii) = half * (x2(1:3) + x3(1:3))
288C Face 3
289 face_centroid(1:3, 3, ii) = half * (x3(1:3) + x1(1:3))
290
291 ENDDO
292 END SUBROUTINE centroid2t
subroutine centroid2t(nel, length, nft, ixtg, xgrid, elem_centroid, face_centroid)
Definition centroid.F:247
subroutine centroid3t(nel, length, nft, ixs, xgrid, elem_centroid, face_centroid)
Definition centroid.F:104
subroutine centroid3(nel, length, nft, ixs, xgrid, elem_centroid, face_centroid)
Definition centroid.F:31
subroutine centroid2(nel, length, nft, ixq, xgrid, elem_centroid, face_centroid)
Definition centroid.F:189
#define my_real
Definition cppsort.cpp:32
subroutine geom(a, b, c, center_x, center_y, center_z, vol)
Definition geom.F:30