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!||--- uses -----------------------------------------------------
29!|| element_mod ../common_source/modules/elements/element_mod.F90
30!||====================================================================
31 SUBROUTINE centroid3(NEL, LENGTH, NFT, IXS, XGRID,
32 . ELEM_CENTROID, FACE_CENTROID)
33 use element_mod , only : nixs
34C-----------------------------------------------
35C D e s c r i p t i o n
36C-----------------------------------------------
37C Computes the centroids of the elements
38C-----------------------------------------------
39C I m p l i c i t T y p e s
40C-----------------------------------------------
41#include "implicit_f.inc"
42C-----------------------------------------------
43C C o m m o n B l o c k s
44C-----------------------------------------------
45! NIXS
46C-----------------------------------------------
47C D u m m y A r g u m e n t s
48C-----------------------------------------------
49 INTEGER, INTENT(IN) :: NEL, NFT, IXS(NIXS, *), LENGTH
50 my_real, INTENT(IN) :: xgrid(3, *)
51 my_real, INTENT(OUT) :: elem_centroid(3, nel), face_centroid(3, 6, nel)
52C-----------------------------------------------
53C L o c a l V a r i a b l e s
54C-----------------------------------------------
55 INTEGER :: I, II, NODE1, NODE2, NODE3, NODE4, NODE5, NODE6, NODE7, NODE8
57 . x1(3), x2(3), x3(3), x4(3), x5(3), x6(3), x7(3), x8(3)
58 DO ii = 1, nel
59 i = ii + nft
60C Nodes of the element locally stored in NODE* for memory access
61 node1 = ixs(2, i)
62 node2 = ixs(3, i)
63 node3 = ixs(4, i)
64 node4 = ixs(5, i)
65 node5 = ixs(6, i)
66 node6 = ixs(7, i)
67 node7 = ixs(8, i)
68 node8 = ixs(9, i)
69C Node coordinates
70 x1(1:3) = xgrid(1:3, node1)
71 x2(1:3) = xgrid(1:3, node2)
72 x3(1:3) = xgrid(1:3, node3)
73 x4(1:3) = xgrid(1:3, node4)
74 x5(1:3) = xgrid(1:3, node5)
75 x6(1:3) = xgrid(1:3, node6)
76 x7(1:3) = xgrid(1:3, node7)
77 x8(1:3) = xgrid(1:3, node8)
78C Centroid
79 elem_centroid(1:3, ii) = one_over_8 * (x1(1:3) + x2(1:3) + x3(1:3) + x4(1:3) +
80 . x5(1:3) + x6(1:3) + x7(1:3) + x8(1:3))
81C Face centroid
82C Face 1
83 face_centroid(1:3, 1, ii) = fourth * (x1(1:3) + x2(1:3) + x3(1:3) + x4(1:3))
84C Face 2
85 face_centroid(1:3, 2, ii) = fourth * (x3(1:3) + x4(1:3) + x8(1:3) + x7(1:3))
86C Face 3
87 face_centroid(1:3, 3, ii) = fourth * (x5(1:3) + x6(1:3) + x7(1:3) + x8(1:3))
88C Face 4
89 face_centroid(1:3, 4, ii) = fourth * (x1(1:3) + x2(1:3) + x6(1:3) + x5(1:3))
90C Face 5
91 face_centroid(1:3, 5, ii) = fourth * (x2(1:3) + x3(1:3) + x7(1:3) + x6(1:3))
92C Face 6
93 face_centroid(1:3, 6, ii) = fourth * (x1(1:3) + x4(1:3) + x8(1:3) + x5(1:3))
94 ENDDO
95 END SUBROUTINE centroid3
96
97!||====================================================================
98!|| centroid3t ../engine/source/multifluid/centroid.F
99!||--- called by ------------------------------------------------------
100!|| alew6 ../engine/source/ale/grid/alew6.F
101!|| multi_face_elem_data ../engine/source/multifluid/multi_face_data_elem.F
102!||--- calls -----------------------------------------------------
103!|| geom ../engine/source/ale/alemuscl/geom.F
104!||--- uses -----------------------------------------------------
105!|| element_mod ../common_source/modules/elements/element_mod.F90
106!||====================================================================
107 SUBROUTINE centroid3t(NEL, LENGTH, NFT, IXS, XGRID,
108 . ELEM_CENTROID, FACE_CENTROID)
109 use element_mod , only : nixs
110C-----------------------------------------------
111C D e s c r i p t i o n
112C-----------------------------------------------
113C Computes the centroids of the elements
114C-----------------------------------------------
115C I m p l i c i t T y p e s
116C-----------------------------------------------
117#include "implicit_f.inc"
118C-----------------------------------------------
119C C o m m o n B l o c k s
120C-----------------------------------------------
121! NIXS
122C-----------------------------------------------
123C D u m m y A r g u m e n t s
124C-----------------------------------------------
125 INTEGER, INTENT(IN) :: NEL, NFT, IXS(NIXS, *), LENGTH
126 my_real, INTENT(IN) :: XGRID(3, *)
127 my_real, INTENT(OUT) :: elem_centroid(3, nel), face_centroid(3, 6, nel)
128C-----------------------------------------------
129C L o c a l V a r i a b l e s
130C-----------------------------------------------
131 INTEGER :: I, II, NODE1, NODE2, NODE3, NODE4
132 my_real
133 . x1(3), x2(3), x3(3), x4(3), vol
134 my_real
135 . a(3), b(3), c(3)
136 DO ii = 1, nel
137 i = ii + nft
138C Nodes of the element locally stored in NODE* for memory access
139 node1 = ixs(2, i)
140 node2 = ixs(4, i)
141 node3 = ixs(7, i)
142 node4 = ixs(6, i)
143C Node coordinates
144 x1(1:3) = xgrid(1:3, node1)
145 x2(1:3) = xgrid(1:3, node2)
146 x3(1:3) = xgrid(1:3, node3)
147 x4(1:3) = xgrid(1:3, node4)
148 elem_centroid(1:3, ii) = zero
149C Centroid
150 vol = zero
151 a(1:3) = x1(1:3)
152 b(1:3) = x2(1:3)
153 c(1:3) = x4(1:3)
154 CALL geom(a, b, c,elem_centroid(1,ii),elem_centroid(2,ii),elem_centroid(3,ii), vol)
155
156 a(1:3) = x1(1:3)
157 b(1:3) = x3(1:3)
158 c(1:3) = x2(1:3)
159 CALL geom(a, b, c,elem_centroid(1,ii),elem_centroid(2,ii),elem_centroid(3,ii), vol)
160
161 a(1:3) = x1(1:3)
162 b(1:3) = x4(1:3)
163 c(1:3) = x3(1:3)
164 CALL geom(a, b, c,elem_centroid(1,ii),elem_centroid(2,ii),elem_centroid(3,ii), vol)
165
166 a(1:3) = x2(1:3)
167 b(1:3) = x3(1:3)
168 c(1:3) = x4(1:3)
169 CALL geom(a, b, c,elem_centroid(1,ii),elem_centroid(2,ii),elem_centroid(3,ii), vol)
170
171 vol = vol / 6.d0
172 elem_centroid(1:3, ii) = elem_centroid(1:3, ii) / 12.d0 / vol
173
174 !ELEM_CENTROID(1:3, II) = FOURTH * (X1(1:3) + X2(1:3) + X3(1:3) + X4(1:3))
175C Face centroid
176C Face 1
177 face_centroid(1:3, 5, ii) = third * (x1(1:3) + x2(1:3) + x3(1:3))
178C Face 2
179 face_centroid(1:3, 6, ii) = third * (x1(1:3) + x2(1:3) + x4(1:3))
180C Face 3
181 face_centroid(1:3, 2, ii) = third * (x2(1:3) + x3(1:3) + x4(1:3))
182C Face 4
183 face_centroid(1:3, 4, ii) = third * (x1(1:3) + x3(1:3) + x4(1:3))
184 ENDDO
185 END SUBROUTINE centroid3t
186
187!||====================================================================
188!|| centroid2 ../engine/source/multifluid/centroid.F
189!||--- called by ------------------------------------------------------
190!|| alew6 ../engine/source/ale/grid/alew6.F
191!|| multi_face_elem_data ../engine/source/multifluid/multi_face_data_elem.F
192!||--- uses -----------------------------------------------------
193!|| element_mod ../common_source/modules/elements/element_mod.F90
194!||====================================================================
195 SUBROUTINE centroid2(NEL, LENGTH, NFT, IXQ, XGRID,
196 . ELEM_CENTROID, FACE_CENTROID)
197 use element_mod , only : nixq
198C-----------------------------------------------
199C D e s c r i p t i o n
200C-----------------------------------------------
201C Computes the centroids of the elements
202C-----------------------------------------------
203C I m p l i c i t T y p e s
204C-----------------------------------------------
205#include "implicit_f.inc"
206C-----------------------------------------------
207C C o m m o n B l o c k s
208C-----------------------------------------------
209! NIXS
210C-----------------------------------------------
211C D u m m y A r g u m e n t s
212C-----------------------------------------------
213 INTEGER, INTENT(IN) :: NEL, NFT, IXQ(NIXQ, *), LENGTH
214 my_real, INTENT(IN) :: XGRID(3, *)
215 my_real, INTENT(OUT) :: ELEM_CENTROID(3, NEL), FACE_CENTROID(3, 6, NEL)
216C-----------------------------------------------
217C L o c a l V a r i a b l e s
218C-----------------------------------------------
219 INTEGER :: I, II, NODE1, NODE2, NODE3, NODE4
220 my_real
221 . X1(3), X2(3), X3(3), X4(3)
222 DO ii = 1, nel
223 i = ii + nft
224C Nodes of the element locally stored in NODE* for memory access
225 node1 = ixq(2, i)
226 node2 = ixq(3, i)
227 node3 = ixq(4, i)
228 node4 = ixq(5, i)
229C Node coordinates
230 x1(1:3) = xgrid(1:3, node1)
231 x2(1:3) = xgrid(1:3, node2)
232 x3(1:3) = xgrid(1:3, node3)
233 x4(1:3) = xgrid(1:3, node4)
234C Centroid
235 elem_centroid(1:3, ii) = fourth * (x1(1:3) + x2(1:3) + x3(1:3) + x4(1:3))
236C Face centroid
237C Face 1
238 face_centroid(1:3, 1, ii) = half * (x1(1:3) + x2(1:3))
239C Face 2
240 face_centroid(1:3, 2, ii) = half * (x2(1:3) + x3(1:3))
241C Face 3
242 face_centroid(1:3, 3, ii) = half * (x3(1:3) + x4(1:3))
243C Face 4
244 face_centroid(1:3, 4, ii) = half * (x1(1:3) + x4(1:3))
245
246 ENDDO
247 END SUBROUTINE centroid2
248
249!||====================================================================
250!|| centroid2t ../engine/source/multifluid/centroid.F
251!||--- called by ------------------------------------------------------
252!|| multi_face_elem_data ../engine/source/multifluid/multi_face_data_elem.F
253!||--- uses -----------------------------------------------------
254!|| element_mod ../common_source/modules/elements/element_mod.F90
255!||====================================================================
256 SUBROUTINE centroid2t(NEL, LENGTH, NFT, IXTG, XGRID,
257 . ELEM_CENTROID, FACE_CENTROID)
258 use element_mod , only : nixtg
259C-----------------------------------------------
260C D e s c r i p t i o n
261C-----------------------------------------------
262C Computes the centroids of the elements
263C-----------------------------------------------
264C I m p l i c i t T y p e s
265C-----------------------------------------------
266#include "implicit_f.inc"
267C-----------------------------------------------
268C C o m m o n B l o c k s
269C-----------------------------------------------
270! NIXS
271C-----------------------------------------------
272C D u m m y A r g u m e n t s
273C-----------------------------------------------
274 INTEGER, INTENT(IN) :: NEL, NFT, IXTG(NIXTG, *), LENGTH
275 my_real, INTENT(IN) :: XGRID(3, *)
276 my_real, INTENT(OUT) :: ELEM_CENTROID(3, NEL), FACE_CENTROID(3, 6, NEL)
277C-----------------------------------------------
278C L o c a l V a r i a b l e s
279C-----------------------------------------------
280 INTEGER :: I, II, NODE1, NODE2, NODE3
281 my_real
282 . X1(3), X2(3), X3(3)
283 DO II = 1, nel
284 i = ii + nft
285C Nodes of the element locally stored in NODE* for memory access
286 node1 = ixtg(2, i)
287 node2 = ixtg(3, i)
288 node3 = ixtg(4, i)
289C Node coordinates
290 x1(1:3) = xgrid(1:3, node1)
291 x2(1:3) = xgrid(1:3, node2)
292 x3(1:3) = xgrid(1:3, node3)
293C Centroid
294 elem_centroid(1:3, ii) = third * (x1(1:3) + x2(1:3) + x3(1:3))
295C Face centroid
296C Face 1
297 face_centroid(1:3, 1, ii) = half * (x1(1:3) + x2(1:3))
298C Face 2
299 face_centroid(1:3, 2, ii) = half * (x2(1:3) + x3(1:3))
300C Face 3
301 face_centroid(1:3, 3, ii) = half * (x3(1:3) + x1(1:3))
302
303 ENDDO
304 END SUBROUTINE centroid2t
subroutine centroid2t(nel, length, nft, ixtg, xgrid, elem_centroid, face_centroid)
Definition centroid.F:258
subroutine centroid3t(nel, length, nft, ixs, xgrid, elem_centroid, face_centroid)
Definition centroid.F:109
subroutine centroid3(nel, length, nft, ixs, xgrid, elem_centroid, face_centroid)
Definition centroid.F:33
subroutine centroid2(nel, length, nft, ixq, xgrid, elem_centroid, face_centroid)
Definition centroid.F:197
#define my_real
Definition cppsort.cpp:32
subroutine geom(a, b, c, center_x, center_y, center_z, vol)
Definition geom.F:30