OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
inter_box_creation.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!|| inter_box_creation ../engine/source/interfaces/generic/inter_box_creation.f
25!||--- called by ------------------------------------------------------
26!|| inter_init_component ../engine/source/interfaces/generic/inter_init_component.F90
27!|| inter_prepare_sort ../engine/source/interfaces/generic/inter_prepare_sort.F
28!||--- uses -----------------------------------------------------
29!|| inter_sorting_mod ../engine/share/modules/inter_sorting_mod.F
30!||====================================================================
31 SUBROUTINE inter_box_creation(nb_cell_x,nb_cell_y,nb_cell_z,box_limit)
32!$COMMENT
33! INTER_BOX_CREATION description :
34! creation of the global box
35!
36! INTER_BOX_CREATION organization :
37! * compute the size dx/dy/dz in each direction
38! * choose the largest size
39! * compute the cell's size
40! * compute the number of cell for each direction
41!$ENDCOMMENT
42C-----------------------------------------------
43C M o d u l e s
44C-----------------------------------------------
46C-----------------------------------------------
47C I m p l i c i t T y p e s
48C-----------------------------------------------
49#include "implicit_f.inc"
50#include "comlock.inc"
51C-----------------------------------------------
52C C o m m o n B l o c k s
53C-----------------------------------------------
54#include "spmd_c.inc"
55C-----------------------------------------------
56C D u m m y A r g u m e n t s
57C-----------------------------------------------
58 integer, intent(inout) :: nb_cell_x !< number of cell in the x direction
59 integer, intent(inout) :: nb_cell_y !< number of cell in the y direction
60 integer, intent(inout) :: nb_cell_z !< number of cell in the z direction
61 my_real, dimension(6), intent(inout) :: box_limit !< upper & lower bound of the box
62C-----------------------------------------------
63C L o c a l V a r i a b l e s
64C-----------------------------------------------
65 INTEGER :: LEADING_DIMENSION
66 my_real :: dx_box,dy_box,dz_box
67 my_real :: ratio,size_cell,dist_max
68! ----------------------------------------
69
70 ! ------------------
71 ! Create the box :
72 ! number of cell = [ tota_number_of_node / ( dx*dy + dx*dz+dy*dz ) ]**(1/2) * dx or dy or dz
73 ! 1 < number of cell < 128
74
75 ! find the leading direction
76 dx_box = abs(box_limit(1) - box_limit(4))
77 dy_box = abs(box_limit(2) - box_limit(5))
78 dz_box = abs(box_limit(3) - box_limit(6))
79
80 dist_max = max(dx_box,dy_box,dz_box)
81 IF(dist_max==dx_box) leading_dimension = 1
82 IF(dist_max==dy_box) leading_dimension = 2
83 IF(dist_max==dz_box) leading_dimension = 3
84
85 ! compute the number of cell in the leading direction, then compute the number of cell in the other direction
86 ratio = sqrt( numnodg / (dx_box*dy_box+dx_box*dz_box+dy_box*dz_box))
87 IF(leading_dimension==1) THEN
88 nb_cell_x = nint( ratio * dx_box )
89 nb_cell_x = max(nb_cell_x,nb_box_coarse_grid)
90 nb_cell_x = nb_cell_x - modulo(nb_cell_x,4)
91 nb_cell_x = min(nb_cell_x,nb_box_limit)
92 nb_cell_x = max(nb_cell_x,nb_box_coarse_grid)
93
94 size_cell = dx_box / nb_cell_x
95
96 nb_cell_y = nint( dy_box / size_cell )
97 nb_cell_y = max(nb_cell_y,nb_box_coarse_grid)
98 nb_cell_y = nb_cell_y - modulo(nb_cell_y,4)
99 nb_cell_y = min(nb_cell_y,nb_box_limit)
100 nb_cell_y = max(nb_cell_y,nb_box_coarse_grid)
101
102 nb_cell_z = nint( dz_box / size_cell )
103 nb_cell_z = max(nb_cell_z,nb_box_coarse_grid)
104 nb_cell_z = nb_cell_z - modulo(nb_cell_z,4)
105 nb_cell_z = min(nb_cell_z,nb_box_limit)
106 nb_cell_z = max(nb_cell_z,nb_box_coarse_grid)
107 ELSEIF(leading_dimension==2) THEN
108 nb_cell_y = nint( ratio * dy_box )
109 nb_cell_y = max(nb_cell_y,nb_box_coarse_grid)
110 nb_cell_y = nb_cell_y - modulo(nb_cell_y,4)
111 nb_cell_y = min(nb_cell_y,nb_box_limit)
112 nb_cell_y = max(nb_cell_y,nb_box_coarse_grid)
113
114 size_cell = dy_box / nb_cell_y
115
116 nb_cell_x = nint( dx_box / size_cell )
117 nb_cell_x = max(nb_cell_x,nb_box_coarse_grid)
118 nb_cell_x = nb_cell_x - modulo(nb_cell_x,4)
119 nb_cell_x = min(nb_cell_x,nb_box_limit)
120 nb_cell_x = max(nb_cell_x,nb_box_coarse_grid)
121
122 nb_cell_z = nint( dz_box / size_cell )
123 nb_cell_z = max(nb_cell_z,nb_box_coarse_grid)
124 nb_cell_z = nb_cell_z - modulo(nb_cell_z,4)
125 nb_cell_z = min(nb_cell_z,nb_box_limit)
126 nb_cell_z = max(nb_cell_z,nb_box_coarse_grid)
127 ELSEIF(leading_dimension==3) THEN
128 nb_cell_z = nint( ratio * dz_box )
129 nb_cell_z = max(nb_cell_z,nb_box_coarse_grid)
130 nb_cell_z = nb_cell_z - modulo(nb_cell_z,4)
131 nb_cell_z = min(nb_cell_z,nb_box_limit)
132 nb_cell_z = max(nb_cell_z,nb_box_coarse_grid)
133
134 size_cell = dz_box / nb_cell_z
135
136 nb_cell_y = nint( dy_box / size_cell )
137 nb_cell_y = max(nb_cell_y,nb_box_coarse_grid)
138 nb_cell_y = nb_cell_y - modulo(nb_cell_y,4)
139 nb_cell_y = min(nb_cell_y,nb_box_limit)
140 nb_cell_y = max(nb_cell_y,nb_box_coarse_grid)
141
142 nb_cell_x = nint( dx_box / size_cell )
143 nb_cell_x = max(nb_cell_x,nb_box_coarse_grid)
144 nb_cell_x = nb_cell_x - modulo(nb_cell_x,4)
145 nb_cell_x = min(nb_cell_x,nb_box_limit)
146 nb_cell_x = max(nb_cell_x,nb_box_coarse_grid)
147 ENDIF
148 ! ------------------
149
150 RETURN
151 END SUBROUTINE inter_box_creation
#define my_real
Definition cppsort.cpp:32
subroutine inter_box_creation(nb_cell_x, nb_cell_y, nb_cell_z, box_limit)
#define min(a, b)
Definition macros.h:20
#define max(a, b)
Definition macros.h:21
integer, parameter nb_box_limit
integer, parameter nb_box_coarse_grid