OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
rdbox.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!|| checkpara ../starter/source/model/box/rdbox.F
25!||--- called by ------------------------------------------------------
26!|| box_surf_sh ../starter/source/model/box/bigbox.F
27!|| boxtage ../starter/source/model/box/bigbox.F
28!|| boxtagn ../starter/source/model/box/bigbox.F
29!|| elstagbox ../starter/source/model/box/bigbox.F
30!|| simple_elt_box ../starter/source/model/sets/simpl_elt_box.F
31!|| simple_node_box ../starter/source/model/sets/simple_node_box.F
32!|| simple_rbody_box ../starter/source/model/sets/simple_rbody_box.F
33!||--- calls -----------------------------------------------------
34!|| inside_parallelepiped ../starter/source/model/box/rdbox.F
35!|| projskew ../starter/source/model/box/rdbox.F
36!||====================================================================
37 SUBROUTINE checkpara(XP1,YP1,ZP1,XP2,YP2,ZP2,
38 . ISK,NODIN,SKEW,OK)
39C-----------------------------------------------
40C I m p l i c i t T y p e s
41C-----------------------------------------------
42#include "implicit_f.inc"
43C-----------------------------------------------
44C C o m m o n B l o c k s
45C-----------------------------------------------
46#include "param_c.inc"
47C-----------------------------------------------
48C D u m m y A r g u m e n t s
49C-----------------------------------------------
50 INTEGER ISK,OK
52 . xp1,yp1,zp1,xp2,yp2,zp2,skew(lskew,*),nodin(3)
53C-----------------------------------------------
54C L o c a l V a r i a b l e s
55C-----------------------------------------------
57 . p1(3),p2(3),p3(3),p4(3),pp2(3)
58C-----------------------------------------------
59 p1(1) = xp1
60 p1(2) = yp1
61 p1(3) = zp1
62 CALL projskew(p1,skew,isk)
63C
64 pp2(1) = xp2
65 pp2(2) = yp2
66 pp2(3) = zp2
67 CALL projskew(pp2,skew,isk)
68C
69 p2(1) = pp2(1)
70 p2(2) = p1(2)
71 p2(3) = p1(3)
72C
73 p3(1) = p1(1)
74 p3(2) = pp2(2)
75 p3(3) = p1(3)
76C
77 p4(1) = p1(1)
78 p4(2) = p1(2)
79 p4(3) = pp2(3)
80C
81 CALL projskew(nodin,skew,isk)
82C
83 CALL inside_parallelepiped(p1, p2, p3, p4, nodin, ok)
84C
85 RETURN
86 END
87!||====================================================================
88!|| projskew ../starter/source/model/box/rdbox.F
89!||--- called by ------------------------------------------------------
90!|| checkpara ../starter/source/model/box/rdbox.F
91!||====================================================================
92 SUBROUTINE projskew(PO,SK,ISK)
93C-----------------------------------------------
94C I m p l i c i t T y p e s
95C-----------------------------------------------
96#include "implicit_f.inc"
97C-----------------------------------------------
98C C o m m o n B l o c k s
99C-----------------------------------------------
100#include "param_c.inc"
101C-----------------------------------------------
102C D u m m y A r g u m e n t s
103C-----------------------------------------------
104 INTEGER ISK
105 my_real
106 . po(3),sk(lskew,*)
107C-----------------------------------------------
108C L o c a l V a r i a b l e s
109C-----------------------------------------------
110 INTEGER JSK
111 my_real
112 . sum,pn(3)
113C-----------------------------------------------
114 jsk = isk + 1
115C
116 pn(1) = po(1)*sk(1,jsk) + po(2)*sk(2,jsk) + po(3)*sk(3,jsk)
117 sum = sk(1,jsk)**2 + sk(2,jsk)**2 + sk(3,jsk)**2
118 sum = sqrt(sum)
119 pn(1) = pn(1) / sum
120C
121 pn(2) = po(1)*sk(4,jsk) + po(2)*sk(5,jsk) + po(3)*sk(6,jsk)
122 sum = sk(4,jsk)**2 + sk(5,jsk)**2 + sk(6,jsk)**2
123 sum = sqrt(sum)
124 pn(2) = pn(2) / sum
125C
126 pn(3) = po(1)*sk(7,jsk) + po(2)*sk(8,jsk) + po(3)*sk(9,jsk)
127 sum = sk(7,jsk)**2 + sk(8,jsk)**2 + sk(9,jsk)**2
128 sum = sqrt(sum)
129 pn(3) = pn(3) / sum
130C
131 po(1) = pn(1)
132 po(2) = pn(2)
133 po(3) = pn(3)
134C
135 RETURN
136 END
137!||====================================================================
138!|| inside_parallelepiped ../starter/source/model/box/rdbox.F
139!||--- called by ------------------------------------------------------
140!|| checkpara ../starter/source/model/box/rdbox.F
141!||====================================================================
142 SUBROUTINE inside_parallelepiped(P1, P2, P3, P4, P, OK)
143C nodes inside parallelepiped in 3D.
144C
145C
146C *------------------*
147C / . / \
148C / . / \
149C / . / \
150C P4------------------* \
151C \ . \ \
152C \ . \ \
153C \ . \ \
154C \ P2.........\.......\
155C \ . \ /
156C \ . \ /
157C \ . \ /
158C P1-----------------P3
159C
160C
161C Parameters:
162C
163C Input, reals: P1(3), P2(3), P3(3), P4(3), four corners
164C of the parallelepiped. It is assumed that P2, P3 and P4 are
165C immediate neighbors of P1.
166C
167C Input, real: P(3), the node to be checked.
168C
169C IF integer "OK == 1", the node P
170C is inside the parallelepiped, or on its boundary.
171C
172C-----------------------------------------------
173C I m p l i c i t T y p e s
174C-----------------------------------------------
175#include "implicit_f.inc"
176C-----------------------------------------------
177C D u m m y A r g u m e n t s
178C-----------------------------------------------
179 INTEGER OK
180 my_real
181 . p1(3),p2(3),p3(3),p4(3),p(3)
182C-----------------------------------------------
183C L o c a l V a r i a b l e s
184C-----------------------------------------------
185 my_real
186 . dot,suma
187C-----------------------------------------------
188 dot = dot_product( p(1:3) - p1(1:3),
189 . p2(1:3) - p1(1:3))
190 IF(dot < zero)RETURN
191 suma = sum((p2(1:3) - p1(1:3) )**2)
192 IF((suma == zero . and. p(1) /= p1(1)) .OR.
193 . suma < dot)RETURN
194C---
195 dot = dot_product( p(1:3) - p1(1:3),
196 . p3(1:3) - p1(1:3))
197 IF(dot < zero)RETURN
198 suma = sum((p3(1:3) - p1(1:3) )**2)
199 IF((suma == zero . and. p(2) /= p1(2)) .OR.
200 . suma < dot)RETURN
201C---
202 dot = dot_product( p(1:3) - p1(1:3),
203 . p4(1:3) - p1(1:3))
204 IF(dot < zero)RETURN
205 suma = sum((p4(1:3) - p1(1:3) )**2)
206 IF((suma == zero . and. p(3) /= p1(3)) .OR.
207 . suma < dot)RETURN
208C---
209 ok = 1
210C---
211 RETURN
212 END
213!||====================================================================
214!|| checkcyl ../starter/source/model/box/rdbox.F
215!||--- called by ------------------------------------------------------
216!|| box_surf_sh ../starter/source/model/box/bigbox.F
217!|| boxtage ../starter/source/model/box/bigbox.F
218!|| boxtagn ../starter/source/model/box/bigbox.F
219!|| elstagbox ../starter/source/model/box/bigbox.F
220!|| simple_elt_box ../starter/source/model/sets/simpl_elt_box.F
221!|| simple_node_box ../starter/source/model/sets/simple_node_box.F
222!|| simple_rbody_box ../starter/source/model/sets/simple_rbody_box.f
223!||--- calls -----------------------------------------------------
224!|| inside_cylinder ../starter/source/model/box/rdbox.F
225!||====================================================================
226 SUBROUTINE checkcyl(XP1, YP1, ZP1, XP2, YP2, ZP2,
227 . NODIN, D, OK )
228C-----------------------------------------------
229C I m p l i c i t T y p e s
230C-----------------------------------------------
231#include "implicit_f.inc"
232C-----------------------------------------------
233C D u m m y A r g u m e n t s
234C-----------------------------------------------
235 INTEGER OK
236 my_real
237 . xp1,yp1,zp1,xp2,yp2,zp2,nodin(3),d
238C-----------------------------------------------
239C L o c a l V a r i a b l e s
240C-----------------------------------------------
241 my_real
242 . p1(3),p2(3)
243C-----------------------------------------------
244
245C-----------------------------------------------
246 p1(1) = xp1
247 p1(2) = yp1
248 p1(3) = zp1
249C
250 p2(1) = xp2
251 p2(2) = yp2
252 p2(3) = zp2
253C
254 CALL inside_cylinder(p1, p2, nodin, d, ok)
255C
256 RETURN
257 END
258!||====================================================================
259!|| inside_cylinder ../starter/source/model/box/rdbox.F
260!||--- called by ------------------------------------------------------
261!|| checkcyl ../starter/source/model/box/rdbox.F
262!||--- calls -----------------------------------------------------
263!|| vec_length ../starter/source/model/box/rdbox.F
264!||====================================================================
265 SUBROUTINE inside_cylinder(P1, P2, P, D, OK)
266C-----------------------------------------------
267C The surface and interior of a (finite) cylinder in 3D is defined
268C by an axis, which is the line segment from point P1 to P2, and a
269C diameter D. The points contained in the volume include:
270C * points at a distance less than or equal to D/2 from the line through P1
271C and P2, whose nearest point on the line through P1 and P2 is, in fact,
272C P1, P2, or any point between them.
273C---
274C Input, D, the diameter of the cylinder.
275C Input, P(3), the checked point.
276C Input, P1(3), P2(3), the points defining the cylinder axis.
277C-----------------------------------------------
278C I m p l i c i t T y p e s
279C-----------------------------------------------
280#include "implicit_f.inc"
281C-----------------------------------------------
282C D u m m y A r g u m e n t s
283C-----------------------------------------------
284 INTEGER OK
285 my_real
286 . p1(3),p2(3),p(3),d
287C-----------------------------------------------
288C L o c a l V a r i a b l e s
289C-----------------------------------------------
290 my_real
291 . axis(3),axis_length,vec_length,off_axix_component,
292 . p_dot_axis,p_length
293C-----------------------------------------------
294 axis(1:3) = p2(1:3) - p1(1:3)
295 axis_length = vec_length(3,axis)
296 IF(axis_length == zero)RETURN
297C
298 axis(1:3) = axis(1:3) / axis_length
299 p_dot_axis = dot_product(p(1:3) - p1(1:3),axis)
300C
301C If the point lies below or above the "caps" of the cylinder, we're done.
302C
303 IF(p_dot_axis < zero .or. axis_length < p_dot_axis)RETURN
304C
305C Otherwise, determine the distance from P to the axis.
306C
307 p_length = vec_length(3, p1(1:3) - (p(1:3) - p_dot_axis * axis(1:3)))
308 IF(p_length <= half*d)ok = 1
309C
310 RETURN
311 END
312C-----------------
313!||====================================================================
314!|| vec_length ../starter/source/model/box/rdbox.F
315!||--- called by ------------------------------------------------------
316!|| inside_cylinder ../starter/source/model/box/rdbox.F
317!||====================================================================
318 FUNCTION vec_length(DIMENS,X)
319C-----------------
320C VEC_LENGTH returns the Euclidean length of a vector.
321C
322 IMPLICIT NONE
323C
324 INTEGER dimens
325 my_real
326 . vec_length,x(dimens)
327C-------------------------------
328 vec_length = sqrt(sum((x(1:dimens))**2))
329C
330 RETURN
331 END
332!||====================================================================
333!|| checksphere ../starter/source/model/box/rdbox.F
334!||--- called by ------------------------------------------------------
335!|| box_surf_sh ../starter/source/model/box/bigbox.F
336!|| boxtage ../starter/source/model/box/bigbox.f
337!|| boxtagn ../starter/source/model/box/bigbox.F
338!|| elstagbox ../starter/source/model/box/bigbox.F
339!|| simple_elt_box ../starter/source/model/sets/simpl_elt_box.F
340!|| simple_node_box ../starter/source/model/sets/simple_node_box.F
341!|| simple_rbody_box ../starter/source/model/sets/simple_rbody_box.F
342!||--- calls -----------------------------------------------------
343!|| inside_sphere ../starter/source/model/box/rdbox.F
344!||====================================================================
345 SUBROUTINE checksphere(XP, YP, ZP, NODIN, D, OK)
346C-----------------------------------------------
347C I m p l i c i t T y p e s
348C-----------------------------------------------
349#include "implicit_f.inc"
350C-----------------------------------------------
351C D u m m y A r g u m e n t s
352C-----------------------------------------------
353 INTEGER OK
354 my_real
355 . xp,yp,zp,nodin(3),d
356C-----------------------------------------------
357C L o c a l V a r i a b l e s
358C-----------------------------------------------
359 my_real
360 . p(3)
361C-----------------------------------------------
362 p(1) = xp
363 p(2) = yp
364 p(3) = zp
365C
366 CALL inside_sphere(p, nodin, d, ok)
367C
368 RETURN
369 END
370!||====================================================================
371!|| inside_sphere ../starter/source/model/box/rdbox.F
372!||--- called by ------------------------------------------------------
373!|| checksphere ../starter/source/model/box/rdbox.F
374!||====================================================================
375 SUBROUTINE inside_sphere(PC, P, D, OK)
376C-----------------------------------------------
377C Implicit Sphere Equation:
378C
379C SUM ( ( P(1:3) - PC(1:3) )**2 ) = D**2/4
380C-----------------------------------------------
381C I m p l i c i t T y p e s
382C-----------------------------------------------
383#include "implicit_f.inc"
384C-----------------------------------------------
385C D u m m y A r g u m e n t s
386C-----------------------------------------------
387 INTEGER OK
388 my_real
389 . pc(3),p(3),d
390C-----------------------------------------------
391C L o c a l V a r i a b l e s
392C-----------------------------------------------
393 my_real
394 . p1(3),p2(3),suma
395C-----------------------------------------------
396 suma = sum((p(1:3) - pc(1:3))**2)
397 suma = four*suma
398 IF(suma <= d**2) ok = 1
399C
400 RETURN
401 END
subroutine bigbox(x, flag, nnod, skew, igs, iskn, itabm1, ibox, id, ibufbox, iadb, titr, key, nn, iboxmax, igrnod)
Definition bigbox.F:38
subroutine boxtage(x, skew, ibox, isu, boxtype, ix, nix, nix1, iparte, ipart, klevtree, eltree, keltree, numel, nadmesh, flag, iboxmax, iadb, ibufbox)
Definition bigbox.F:1033
#define my_real
Definition cppsort.cpp:32
subroutine inside_parallelepiped(p1, p2, p3, p4, p, ok)
Definition rdbox.F:143
subroutine checkcyl(xp1, yp1, zp1, xp2, yp2, zp2, nodin, d, ok)
Definition rdbox.F:228
subroutine inside_cylinder(p1, p2, p, d, ok)
Definition rdbox.F:266
subroutine projskew(po, sk, isk)
Definition rdbox.F:93
subroutine checkpara(xp1, yp1, zp1, xp2, yp2, zp2, isk, nodin, skew, ok)
Definition rdbox.F:39
function vec_length(dimens, x)
Definition rdbox.F:319
subroutine inside_sphere(pc, p, d, ok)
Definition rdbox.F:376
subroutine checksphere(xp, yp, zp, nodin, d, ok)
Definition rdbox.F:346
subroutine simple_rbody_box(ibox, x, skew, ib, nd_array, nd_size, rby_msn)
program starter
Definition starter.F:39