OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
ale_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!|| ale_box_creation ../starter/source/initial_conditions/inivol/ale_box_creation.F
25!||--- called by ------------------------------------------------------
26!|| init_inivol ../starter/source/initial_conditions/inivol/init_inivol.F90
27!||====================================================================
28 SUBROUTINE ale_box_creation(NB_BOX_LIMIT,NB_CELL_X,NB_CELL_Y,NB_CELL_Z,
29 . ALE_ELEMENT_NUMBER,ELEMENT_SIZE,MIN_MAX_POSITION,
30 . LEADING_DIMENSION,SIZE_CELL)
31!$COMMENT
32! ALE_BOX_CREATION description
33! creation of a grid with (NB_CELL_X,NB_CELL_Y,NB_CELL_Z) cells
34!
35! ALE_BOX_CREATION organization :
36! - a direction is chosen
37! - the number of cell in this direction is computed
38! - then the number of cell in other directions are computed
39!$ENDCOMMENT
40C-----------------------------------------------
41C I m p l i c i t T y p e s
42C-----------------------------------------------
43#include "implicit_f.inc"
44C-----------------------------------------------
45C C o m m o n B l o c k s
46C-----------------------------------------------
47
48C-----------------------------------------------
49C D u m m y A r g u m e n t s
50C-----------------------------------------------
51 INTEGER, INTENT(IN) :: NB_BOX_LIMIT
52 INTEGER, INTENT(INOUT) :: NB_CELL_X,NB_CELL_Y,NB_CELL_Z
53 INTEGER, INTENT(IN) :: ALE_ELEMENT_NUMBER ! number of ale element with material 51 or 151
54 my_real, INTENT(INOUT) :: element_size ! max element size
55 my_real, DIMENSION(6), INTENT(INOUT) :: min_max_position ! min/max position
56 INTEGER, INTENT(INOUT) :: LEADING_DIMENSION
57 my_real, DIMENSION(3), INTENT(INOUT) :: size_cell ! cell's size in x/y/z direction
58C-----------------------------------------------
59C L o c a l V a r i a b l e s
60C-----------------------------------------------
61 my_real :: dx_box,dy_box,dz_box
62 my_real :: ratio,dist_max,local_size_cell
63C-----------------------------------------------
64 element_size = sqrt(three) * element_size
65 leading_dimension = 0
66 min_max_position(1:3) = min_max_position(1:3) - em10
67 min_max_position(4:6) = min_max_position(4:6) + em10
68 ! find the leading direction
69 dx_box = abs(min_max_position(1) - min_max_position(4))
70 dy_box = abs(min_max_position(2) - min_max_position(5))
71 dz_box = abs(min_max_position(3) - min_max_position(6))
72
73 IF(dx_box == 2*ep30)dx_box=zero ! y,z plane
74 IF(dy_box == 2*ep30)dy_box=zero ! x,z plane
75 IF(dz_box == 2*ep30)dz_box=zero ! x,y plane
76
77 dist_max = max(dx_box,dy_box,dz_box)
78 IF(dist_max==dx_box) leading_dimension = 1
79 IF(dist_max==dy_box) leading_dimension = 2
80 IF(dist_max==dz_box) leading_dimension = 3
81 ! -----------------------
82 ! compute the number of cell in the leading direction,
83 ! then compute the number of cell in the other direction
84 ratio = sqrt( ale_element_number / (dx_box*dy_box+dx_box*dz_box+dy_box*dz_box))
85 IF(leading_dimension==1) THEN
86 nb_cell_x = nint( ratio * dx_box )
87 nb_cell_x = min(nb_cell_x,nb_box_limit)
88
89 local_size_cell = dx_box / nb_cell_x
90 IF(local_size_cell<element_size) THEN
91 local_size_cell = element_size
92 nb_cell_x = nint( dx_box / local_size_cell )
93 nb_cell_x = min(nb_cell_x,nb_box_limit)
94 ENDIF
95 nb_cell_y = nint( dy_box / local_size_cell )
96 nb_cell_y = min(nb_cell_y,nb_box_limit)
97
98 nb_cell_z = nint( dz_box / local_size_cell )
99 nb_cell_z = min(nb_cell_z,nb_box_limit)
100 ELSEIF(leading_dimension==2) THEN
101 nb_cell_y = nint( ratio * dy_box )
102 nb_cell_y = min(nb_cell_y,nb_box_limit)
103
104 local_size_cell = dy_box / nb_cell_y
105 IF(local_size_cell<element_size) THEN
106 local_size_cell = element_size
107 nb_cell_y = nint( dy_box / local_size_cell )
108 nb_cell_y = min(nb_cell_y,nb_box_limit)
109 ENDIF
110 nb_cell_x = nint( dx_box / local_size_cell )
111 nb_cell_x = min(nb_cell_x,nb_box_limit)
112
113 nb_cell_z = nint( dz_box / local_size_cell )
114 nb_cell_z = min(nb_cell_z,nb_box_limit)
115 ELSE !IF(LEADING_DIMENSION==3) THEN
116 nb_cell_z = nint( ratio * dz_box )
117 nb_cell_z = min(nb_cell_z,nb_box_limit)
118
119 local_size_cell = dz_box / nb_cell_z
120 IF(local_size_cell<element_size) THEN
121 local_size_cell = element_size
122 nb_cell_z = nint( dz_box / local_size_cell )
123 nb_cell_z = min(nb_cell_z,nb_box_limit)
124 ENDIF
125 nb_cell_y = nint( dy_box / local_size_cell )
126 nb_cell_y = min(nb_cell_y,nb_box_limit)
127
128 nb_cell_x = nint( dx_box / local_size_cell )
129 nb_cell_x = min(nb_cell_x,nb_box_limit)
130 ENDIF
131 ! -----------------------
132
133 ! -----------------------
134 ! ensure that nb_cell_... is higher than 0 (2D case)
135 nb_cell_x = max(1,nb_cell_x)
136 nb_cell_y = max(1,nb_cell_y)
137 nb_cell_z = max(1,nb_cell_z)
138
139 size_cell(1) = dx_box / local_size_cell
140 size_cell(2) = dy_box / local_size_cell
141 size_cell(3) = dz_box / local_size_cell
142 ! -----------------------
143
144 RETURN
145 END SUBROUTINE ale_box_creation
subroutine ale_box_creation(nb_box_limit, nb_cell_x, nb_cell_y, nb_cell_z, ale_element_number, element_size, min_max_position, leading_dimension, size_cell)
#define my_real
Definition cppsort.cpp:32
#define min(a, b)
Definition macros.h:20
#define max(a, b)
Definition macros.h:21