OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
inter_cell_color.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_cell_color ../engine/source/interfaces/generic/inter_cell_color.F
25!||--- called by ------------------------------------------------------
26!|| inter_color_voxel ../engine/source/interfaces/generic/inter_color_voxel.F
27!||--- uses -----------------------------------------------------
28!|| inter_sorting_mod ../engine/share/modules/inter_sorting_mod.F
29!|| inter_struct_mod ../engine/share/modules/inter_struct_mod.F
30!||====================================================================
31 SUBROUTINE inter_cell_color(X,IGAP ,NRTM ,STF ,
32 2 TZINF ,CURV_MAX,
33 3 GAPMIN ,GAPMAX,GAP_M ,
34 4 IRECT ,GAP ,BGAPSMX,DRAD ,NB_INDEX_CELL,SIZE_INDEX_CELL,INDEX_CELL,
35 5 NEEDED,MAIN_COARSE_GRID,DGAPLOAD)
36!$COMMENT
37! INTER_CELL_COLOR description :
38! color the fine cell & coarse cell with main nodes
39!
40! INTER_CELL_COLOR organization :
41! loop over the active MAIN surface and :
42! * computation of fine grid index IX/IY/IZ
43! * color the fine grid IX/IY/IZ
44! * if the interface is a large interface : computation of coarse grid index and coloration of coarse grid
45!$ENDCOMMENT
46C-----------------------------------------------
47C M o d u l e s
48C-----------------------------------------------
51C-----------------------------------------------
52C I m p l i c i t T y p e s
53C-----------------------------------------------
54#include "implicit_f.inc"
55#include "comlock.inc"
56C-----------------------------------------------
57C C o m m o n B l o c k s
58C-----------------------------------------------
59#include "com04_c.inc"
60#include "task_c.inc"
61C-----------------------------------------------
62C D u m m y A r g u m e n t s
63C-----------------------------------------------
64 LOGICAL, INTENT(in) :: NEEDED
65 INTEGER :: IGAP, NRTM, IRECT(4,NRTM)
66 my_real :: X(3,NUMNOD),STF(NRTM), GAP_M(NRTM), BGAPSMX,DRAD
67 my_real :: TZINF,GAPMIN,GAPMAX,GAP,CURV_MAX(NRTM)
68 INTEGER, INTENT(inout) :: NB_INDEX_CELL
69 INTEGER, INTENT(in) :: SIZE_INDEX_CELL
70 INTEGER, DIMENSION(SIZE_INDEX_CELL),INTENT(inout) :: INDEX_CELL
71 INTEGER, DIMENSION(NB_BOX_COARSE_GRID,NB_BOX_COARSE_GRID,NB_BOX_COARSE_GRID), INTENT(inout) :: MAIN_COARSE_GRID
72 my_real , INTENT(IN) :: dgapload
73C-----------------------------------------------
74C L o c a l V a r i a b l e s
75C-----------------------------------------------
76 INTEGER LOC_PROC,
77 . NBX,NBY,NBZ,NE,M1,M2,M3,M4,
78 . IX1,IY1,IZ1,IX2,IY2,IZ2,IX,IY,IZ
79 my_real
80 . aaa, marge,
81 . xmaxb,ymaxb,zmaxb,xminb,yminb,zminb,
82 . xmine,ymine,zmine,xmaxe,ymaxe,zmaxe,
83 . xx1,xx2,xx3,xx4,yy1,yy2,yy3,yy4,zz1,zz2,zz3,zz4
84 INTEGER :: IX_COARSE,IY_COARSE,IZ_COARSE
85 my_real :: VALUE,real_value
86C-----------------------------------------------
87C S o u r c e L i n e s
88C-----------------------------------------------
89 loc_proc = ispmd + 1
90 marge = tzinf-max(gap+dgapload,drad)
91
92 nbx = nb_cell_x
93 nby = nb_cell_y
94 nbz = nb_cell_z
95
96 xmaxb = box_limit(1)
97 ymaxb = box_limit(2)
98 zmaxb = box_limit(3)
99 xminb = box_limit(4)
100 yminb = box_limit(5)
101 zminb = box_limit(6)
102 ! ------------------------------
103 ! loop over the main surface
104 DO ne=1,nrtm
105 ! skip the deleted surfaces
106 IF(stf(ne) == zero)cycle
107
108 IF(igap == 0)THEN
109 aaa = tzinf+curv_max(ne)
110 ELSE
111 aaa = marge+curv_max(ne)+
112 . max(min(gapmax,max(gapmin,bgapsmx+gap_m(ne)))+dgapload,drad)
113 ENDIF
114 ! nodes of the surface
115 m1 = irect(1,ne)
116 m2 = irect(2,ne)
117 m3 = irect(3,ne)
118 m4 = irect(4,ne)
119 xx1=x(1,m1)
120 xx2=x(1,m2)
121 xx3=x(1,m3)
122 xx4=x(1,m4)
123 xmaxe=max(xx1,xx2,xx3,xx4)
124 xmine=min(xx1,xx2,xx3,xx4)
125
126 yy1=x(2,m1)
127 yy2=x(2,m2)
128 yy3=x(2,m3)
129 yy4=x(2,m4)
130 ymaxe=max(yy1,yy2,yy3,yy4)
131 ymine=min(yy1,yy2,yy3,yy4)
132
133 zz1=x(3,m1)
134 zz2=x(3,m2)
135 zz3=x(3,m3)
136 zz4=x(3,m4)
137 zmaxe=max(zz1,zz2,zz3,zz4)
138 zmine=min(zz1,zz2,zz3,zz4)
139
140 ! cell index computation
141 ix1=int(nbx*(xmine-aaa-xminb)/(xmaxb-xminb))
142 iy1=int(nby*(ymine-aaa-yminb)/(ymaxb-yminb))
143 iz1=int(nbz*(zmine-aaa-zminb)/(zmaxb-zminb))
144
145 ix1=max(1,min(nbx,ix1))
146 iy1=max(1,min(nby,iy1))
147 iz1=max(1,min(nbz,iz1))
148
149 ix2=int(nbx*(xmaxe+aaa-xminb)/(xmaxb-xminb))
150 iy2=int(nby*(ymaxe+aaa-yminb)/(ymaxb-yminb))
151 iz2=int(nbz*(zmaxe+aaa-zminb)/(zmaxb-zminb))
152
153 ix2=max(1,min(nbx,ix2))
154 iy2=max(1,min(nby,iy2))
155 iz2=max(1,min(nbz,iz2))
156
157 real_value = float(nb_box_coarse_grid)
158
159 ! loop over the cell and cell coloration
160 DO iz = iz1, iz2
161 VALUE = real_value*float(iz)/float(nb_cell_z)
162 iz_coarse = min(int(VALUE),nb_box_coarse_grid)
163 iz_coarse = max(iz_coarse,1)
164 DO iy = iy1, iy2
165 VALUE = real_value*float(iy)/float(nb_cell_y)
166 iy_coarse = min(int(VALUE),nb_box_coarse_grid)
167 iy_coarse = max(iy_coarse,1)
168 DO ix = ix1, ix2
169 VALUE = real_value*float(ix)/float(nb_cell_x)
170 ix_coarse = min(int(VALUE),nb_box_coarse_grid)
171 ix_coarse = max(ix_coarse,1)
172 IF(cell_bool(ix,iy,iz)) THEN
173 nb_index_cell = nb_index_cell + 1
174 index_cell(nb_index_cell) = ix + 1000*iy +1000**2 * iz
175 cell_bool(ix,iy,iz) = .false.
176 IF(needed) main_coarse_grid(ix_coarse,iy_coarse,iz_coarse) = 1
177 ENDIF
178 END DO
179 END DO
180 END DO
181 ENDDO
182 ! ------------------------------
183C
184 RETURN
185 END SUBROUTINE inter_cell_color
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)
#define min(a, b)
Definition macros.h:20
#define max(a, b)
Definition macros.h:21
logical, dimension(:,:,:), allocatable cell_bool
integer, parameter nb_box_coarse_grid