OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
ale_box_coloration.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_coloration ../starter/source/initial_conditions/inivol/ale_box_coloration.F
25!||--- called by ------------------------------------------------------
26!|| init_inivol ../starter/source/initial_conditions/inivol/init_inivol.F90
27!||--- calls -----------------------------------------------------
28!||--- uses -----------------------------------------------------
29!|| inivol_def_mod ../starter/share/modules1/inivol_mod.F
30!||====================================================================
31 SUBROUTINE ale_box_coloration(NSURF,NUMNOD,
32 . NB_CELL_X,NB_CELL_Y,NB_CELL_Z,SURFACE_NUMBER,
33 . MIN_MAX_POSITION,CELL,X,IGRSURF,INIVOL,CELL_POSITION,
34 . ALE_NODE_NUMBER,LIST_ALE_NODE)
35!$COMMENT
36! ALE_BOX_COLORATION description
37! ALE_BOX_COLORATION colors the grid created by ALE_BOX_CREATION routine
38! with the node of the surface
39!
40! ALE_BOX_COLORATION organization :
41! - loop over the surface
42! - loop over the node of the surface
43! - compute the node's position (ix,iy,iz) in the cell
44! - color the cell (ix,iy,iz) & all the cells crossed by a segment of the surface
45! - the position of ALE nodes in the grid are computed
46!$ENDCOMMENT
47 USE array_mod
49 USE groupdef_mod , only : surf_
50C-----------------------------------------------
51C I m p l i c i t T y p e s
52C-----------------------------------------------
53#include "implicit_f.inc"
54C-----------------------------------------------
55C D u m m y A r g u m e n t s
56C-----------------------------------------------
57 INTEGER,INTENT(IN) :: NSURF,NUMNOD
58 INTEGER, INTENT(IN) :: NB_CELL_X,NB_CELL_Y,NB_CELL_Z ! number of cell in x/y/z direction
59 INTEGER, INTENT(IN) :: SURFACE_NUMBER ! number of surface
60 TYPE(array_type), DIMENSION(SURFACE_NUMBER), INTENT(INOUT) :: CELL ! voxcell
61 my_real, DIMENSION(6), INTENT(IN) :: min_max_position ! min/max position
62 my_real, DIMENSION(3,NUMNOD), INTENT(IN) :: x ! position
63 INTEGER, DIMENSION(3,NUMNOD), INTENT(INOUT) :: CELL_POSITION ! position of node/cell
64 TYPE (SURF_), DIMENSION(NSURF), INTENT(IN) :: IGRSURF ! surface data
65 TYPE (INIVOL_STRUCT_), INTENT(IN) :: INIVOL ! inivol data
66 INTEGER, INTENT(IN) :: ALE_NODE_NUMBER ! number of ale node
67 INTEGER, DIMENSION(ALE_NODE_NUMBER), INTENT(IN) :: LIST_ALE_NODE ! list of ale node
68C-----------------------------------------------
69C L o c a l V a r i a b l e s
70C-----------------------------------------------
71 INTEGER :: I,J,K
72 INTEGER :: II,JJ,KK
73 INTEGER, DIMENSION(5) :: IX,IY,IZ
74 INTEGER :: SURFACE_ID,SURFACE_NODE_NUMBER,SURFACE_TYPE
75 INTEGER, DIMENSION(4) :: NODE_ID
76 INTEGER :: LOW_X,UP_X
77 INTEGER :: LOW_Y,UP_Y
78 INTEGER :: LOW_Z,UP_Z
79 my_real :: xmin,ymin,zmin
80 my_real :: xmax,ymax,zmax
81C-----------------------------------------------
82
83 ! ------------------
84 xmax = min_max_position(4)
85 xmin = min_max_position(1)
86 ymax = min_max_position(5)
87 ymin = min_max_position(2)
88 zmax = min_max_position(6)
89 zmin = min_max_position(3)
90 ! ------------------
91
92 ! ------------------
93 ! loop over the surface
94 DO i=1,surface_number
95 ! ------------------
96 ! allocation of CELL array
97 cell(i)%SIZE_INT_ARRAY_3D(1) = nb_cell_x
98 cell(i)%SIZE_INT_ARRAY_3D(2) = nb_cell_y
99 cell(i)%SIZE_INT_ARRAY_3D(3) = nb_cell_z
100 CALL alloc_3d_array(cell(i))
101 cell(i)%INT_ARRAY_3D(1:nb_cell_x,1:nb_cell_y,1:nb_cell_z) = 0
102 ! ------------------
103
104 ! ------------------
105 surface_id = inivol%CONTAINER(i)%SURF_ID ! surface id
106 surface_node_number = igrsurf(surface_id)%NSEG ! number of segment of the surface
107 surface_type = igrsurf(surface_id)%TYPE ! type of surface
108 IF(surface_type/=200.AND.surface_type/=101) THEN
109 DO k=1,surface_node_number
110 ! ------------------
111 ! load the positions of the 4 nodes of the surface K
112 DO j=1,4
113 node_id(j) = igrsurf(surface_id)%NODES(k,j) ! node id
114 ix(j)=max(1,1+int(nb_cell_x*(x(1,node_id(j))-xmin)/(xmax-xmin)))
115 iy(j)=max(1,1+int(nb_cell_y*(x(2,node_id(j))-ymin)/(ymax-ymin)))
116 iz(j)=max(1,1+int(nb_cell_z*(x(3,node_id(j))-zmin)/(zmax-zmin)))
117 ENDDO
118 ix(5) = ix(1)
119 iy(5) = iy(1)
120 iz(5) = iz(1)
121 ! ------------------
122 ! tag the cells crossed by the segments of the surface K
123 ! 1 2 3
124 ! * ----- * ----- * ----- *
125 ! | o_____|__o | |
126 ! a | \ | | | | a1,b1,c1,a2,b2 are coloured
127 ! * --\-- * -o--- * ----- *
128 ! | \ | / | |
129 ! b | \ |/ | |
130 ! * -----o* ----- * ----- *
131 ! | | | |
132 ! c | | | |
133 ! * ----- * ----- * ----- *
134
135 low_x = nb_cell_x + 1
136 up_x = -1
137 low_y = nb_cell_y + 1
138 up_y = -1
139 low_z = nb_cell_z + 1
140 up_z = -1
141 DO j=1,4
142 low_z = min(low_z,iz(j))
143 up_z = max(up_z,iz(j+1))
144 low_y = min(low_y,iy(j))
145 up_y = max(up_y,iy(j+1))
146 low_x = min(low_x,ix(j))
147 up_x = max(up_x,ix(j+1))
148 ENDDO
149 low_z = max(1,low_z)
150 up_z = min(nb_cell_z,up_z)
151 low_y = max(1,low_y)
152 up_y = min(nb_cell_y,up_y)
153 low_x = max(1,low_x)
154 up_x = min(nb_cell_x,up_x)
155 ! ------------------
156 DO kk=low_z,up_z
157 DO jj=low_y,up_y
158 DO ii=low_x,up_x
159 ! ------------------
160 ! the cell (ii,jj,kk) contains a node of a surface or is crossed by the segment
161 IF(cell(i)%INT_ARRAY_3D(ii,jj,kk)/=2) THEN
162 cell(i)%INT_ARRAY_3D(ii,jj,kk) = 2
163 ENDIF
164 ! ------------------
165 ENDDO
166 ENDDO
167 ENDDO
168 ! ------------------
169 ENDDO
170 ! ------------------
171 ENDIF
172 ENDDO
173 ! ------------------
174
175 ! ------------------
176 ! compute the position of ALE nodes in grid
177 DO j=1,ale_node_number
178 i = list_ale_node(j)
179 cell_position(1,i) =max(1,1+int(nb_cell_x*(x(1,i)-xmin)/(xmax-xmin)))
180 cell_position(2,i) =max(1,1+int(nb_cell_y*(x(2,i)-ymin)/(ymax-ymin)))
181 cell_position(3,i) =max(1,1+int(nb_cell_z*(x(3,i)-zmin)/(zmax-zmin)))
182
183 ! ensure that cell_position does not exceed the number of
184 ! cell(single precision issue)
185 cell_position(1,i) =min(cell_position(1,i),nb_cell_x)
186 cell_position(2,i) =min(cell_position(2,i),nb_cell_y)
187 cell_position(3,i) =min(cell_position(3,i),nb_cell_z)
188 ENDDO
189 ! ------------------
190
191 RETURN
192 END SUBROUTINE ale_box_coloration
subroutine ale_box_coloration(nsurf, numnod, nb_cell_x, nb_cell_y, nb_cell_z, surface_number, min_max_position, cell, x, igrsurf, inivol, cell_position, ale_node_number, list_ale_node)
#define my_real
Definition cppsort.cpp:32
subroutine ymax(idn, fac, npc, pld, stiffmin, stiffmax, stiffini, stiffavg)
Definition law100_upd.F:272
#define min(a, b)
Definition macros.h:20
#define max(a, b)
Definition macros.h:21
subroutine alloc_3d_array(this)
Definition array_mod.F:157