OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
inter_color_voxel.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_color_voxel ../engine/source/interfaces/generic/inter_color_voxel.f
25!||--- called by ------------------------------------------------------
26!|| inter_prepare_sort ../engine/source/interfaces/generic/inter_prepare_sort.F
27!||--- calls -----------------------------------------------------
28!|| inter_cell_color ../engine/source/interfaces/generic/inter_cell_color.F
29!|| my_barrier ../engine/source/system/machine.F
30!||--- uses -----------------------------------------------------
31!|| intbufdef_mod ../common_source/modules/interfaces/intbufdef_mod.F90
32!|| inter_sorting_mod ../engine/share/modules/inter_sorting_mod.F
33!|| inter_struct_mod ../engine/share/modules/inter_struct_mod.F
34!|| multi_fvm_mod ../common_source/modules/ale/multi_fvm_mod.F90
35!||====================================================================
36 SUBROUTINE inter_color_voxel(ITASK,NB_INTER_SORTED,LIST_INTER_SORTED,IPARI,INTBUF_TAB,
37 . X,INTER_STRUCT,SORT_COMM)
38!$COMMENT
39! INTER_COLOR_VOXEL description :
40! color the fine cell & coarse cell with main nodes
41!
42! INTER_COLOR_VOXEL organization :
43! loop over the interface and call of INTER_CELL_COLOR
44!$ENDCOMMENT
45C-----------------------------------------------
46C M o d u l e s
47C-----------------------------------------------
48 USE intbufdef_mod
49 USE multi_fvm_mod
52C-----------------------------------------------
53C I m p l i c i t T y p e s
54C-----------------------------------------------
55#include "implicit_f.inc"
56#include "comlock.inc"
57C-----------------------------------------------
58C C o m m o n B l o c k s
59C-----------------------------------------------
60#include "com01_c.inc"
61#include "com04_c.inc"
62#include "param_c.inc"
63#include "task_c.inc"
64C-----------------------------------------------
65C D u m m y A r g u m e n t s
66C-----------------------------------------------
67 INTEGER, INTENT(in) :: ITASK ! thread ID
68 INTEGER, INTENT(in) :: NB_INTER_SORTED ! number of interfaces that need to be sorted
69 INTEGER, DIMENSION(NB_INTER_SORTED), INTENT(in) :: LIST_INTER_SORTED ! list of interfaces that need to be sorted
70 INTEGER, DIMENSION(NPARI,NINTER), INTENT(in) :: IPARI ! interface data
71 TYPE(intbuf_struct_),DIMENSION(NINTER), INTENT(in) :: INTBUF_TAB ! interface data
72 my_real, DIMENSION(3*NUMNOD), INTENT(in) :: x ! position
73 TYPE(inter_struct_type), DIMENSION(NINTER), INTENT(inout) :: INTER_STRUCT ! structure for interface
74 TYPE(sorting_comm_type), DIMENSION(NINTER), INTENT(inout) :: SORT_COMM ! structure for interface sorting comm
75C-----------------------------------------------
76C L o c a l V a r i a b l e s
77C-----------------------------------------------
78 INTEGER :: KK,I,J
79 INTEGER :: NIN
80 INTEGER :: IX,IY,IZ
81 INTEGER :: SIZE_INDEX_CELL,TOTAL_NB_CELL
82 INTEGER :: NRTM,NRTM_T
83 INTEGER :: ADRESS,ESHIFT,SHIFT
84 INTEGER, DIMENSION(:), ALLOCATABLE :: INDEX_CELL
85 LOGICAL :: TYPE18
86 INTEGER :: NTY,INACTI
87 INTEGER :: VALUE
88 my_real :: dgapload
89
90 my_real :: tzinf,gapmin,gapmax,gap,drad
91
92! ----------------------------------------
93 ! --------------------
94 ! allocation of global omp array
95 IF(itask==0) THEN
98 ALLOCATE( nb_local_cell(nthread) )
99 ENDIF
100 CALL my_barrier()
101 ! --------------------
102 ! allocation of local omp array
103 size_index_cell = nb_cell_x*nb_cell_y*nb_cell_z
104 ALLOCATE(index_cell(size_index_cell))
105 nb_local_cell(itask+1) = 0
106
107 ! --------------------
108 ! loop over the interface
109 DO kk=1,nb_inter_sorted
110 nin = list_inter_sorted(kk)
111 nrtm = ipari(4,nin)
112 nrtm_t = nrtm/nthread
113 eshift = itask*nrtm_t
114 adress = 1 + itask*(ipari(4,nin)/nthread)
115 IF(itask==nthread-1) nrtm_t= nrtm - adress + 1
116 nb_local_cell(itask+1) = 0
117
118 tzinf = intbuf_tab(nin)%VARIABLES(tzinf_index)
119 gap =intbuf_tab(nin)%VARIABLES(gap_index)
120 gapmin=intbuf_tab(nin)%VARIABLES(gapmin_index)
121 gapmax=intbuf_tab(nin)%VARIABLES(gapmax_index)
122 drad = zero
123 IF(ipari(7,nin)==7) drad =intbuf_tab(nin)%VARIABLES(drad_index)
124 dgapload = intbuf_tab(nin)%VARIABLES(bgapemx_index)
125
126 nty = ipari(7,nin)
127 inacti = ipari(22,nin)
128 type18=.false.
129 IF(nty==7 .AND. inacti==7)type18=.true.
130
131 IF(itask==0) THEN
132 coarse_grid = .false.
133 IF(sort_comm(nin)%PROC_NUMBER>nspmd/2) THEN
134 coarse_grid = .true.
135 IF(.NOT.ALLOCATED(sort_comm(nin)%MAIN_COARSE_GRID) ) THEN
136 ALLOCATE(sort_comm(nin)%MAIN_COARSE_GRID(
138 ENDIF
139 sort_comm(nin)%MAIN_COARSE_GRID(:,:,:) = 0
140 ENDIF
141 ENDIF
142
143 CALL my_barrier()
144 ! --------------------
145 ! cell coloration by omp threads
146 CALL inter_cell_color( x,ipari(21,nin) ,nrtm_t ,intbuf_tab(nin)%STFM(1+eshift) ,
147 2 tzinf,inter_struct(nin)%CURV_MAX(adress),
148 3 gapmin ,gapmax,intbuf_tab(nin)%GAP_M(1+eshift) ,
149 4 intbuf_tab(nin)%IRECTM(1+4*eshift),gap,intbuf_tab(nin)%VARIABLES(bgapsmx_index),drad,
150 5 nb_local_cell(itask+1),size_index_cell,index_cell,
151 6 coarse_grid,sort_comm(nin)%MAIN_COARSE_GRID,dgapload)
152
153 CALL my_barrier()
154 ! --------------------
155 ! reduction of number of colored cells
156 IF(itask==0) THEN
157 total_nb_cell = 0
158 DO i=1,nthread
159 total_nb_cell = total_nb_cell + nb_local_cell(i)
160 ENDDO
161 sort_comm(nin)%SIZE_CELL_LIST(1) = total_nb_cell
162 sort_comm(nin)%SIZE_CELL_LIST(2) = 0
163 ALLOCATE( sort_comm(nin)%CELL_LIST(total_nb_cell) )
164 ENDIF
165 ! --------------------
166 ! flush global array CELL_BOOL to true for the next interface
167 DO i=1,nb_local_cell(itask+1)
168
169 VALUE = index_cell(i)
170 iz = ( VALUE - mod(VALUE,1000000) ) / 1000000
171 VALUE = VALUE - iz * 1000000
172 iy = ( VALUE - mod(VALUE,1000) ) / 1000
173 VALUE = VALUE - iy * 1000
174 ix = VALUE
175 cell_bool(ix,iy,iz) = .true.
176 ENDDO
177 CALL my_barrier()
178 ! --------------------
179
180 ! --------------------
181 ! reduction of colored cells
182 shift = 0
183 IF(itask>0) THEN
184 DO j=1,itask
185 shift = shift + nb_local_cell(j)
186 ENDDO
187 ENDIF
188 sort_comm(nin)%CELL_LIST(1+shift:nb_local_cell(itask+1)+shift) = index_cell(1:nb_local_cell(itask+1))
189
190 CALL my_barrier()
191 ! --------------------
192 ENDDO
193
194 CALL my_barrier()
195 ! --------------------
196 ! deallocation
197 IF(itask==0) THEN
198 DEALLOCATE(cell_bool)
199 DEALLOCATE( nb_local_cell )
200 ENDIF
201 DEALLOCATE(index_cell)
202 ! --------------------
203 RETURN
204 END SUBROUTINE inter_color_voxel
#define my_real
Definition cppsort.cpp:32
subroutine inter_cell_color(x, igap, nrtm, stf, tzinf, curv_max, gapmin, gapmax, gap_m, irect, gap, bgapsmx, drad, nb_index_cell, size_index_cell, index_cell, needed, main_coarse_grid, dgapload)
subroutine inter_color_voxel(itask, nb_inter_sorted, list_inter_sorted, ipari, intbuf_tab, x, inter_struct, sort_comm)
integer, dimension(:), allocatable nb_local_cell
logical, dimension(:,:,:), allocatable cell_bool
integer, parameter nb_box_coarse_grid
subroutine my_barrier
Definition machine.F:31