OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
sensor_dist_surf0.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!|| sensor_dist_surf0 ../engine/source/tools/sensor/sensor_dist_surf0.F
25!||--- called by ------------------------------------------------------
26!|| resol ../engine/source/engine/resol.F
27!||--- calls -----------------------------------------------------
28!|| dist_node_seg3n ../engine/source/tools/sensor/dist_node_seg3n.F
29!|| dist_node_seg4n ../engine/source/tools/sensor/dist_node_seg4n.F
30!||--- uses -----------------------------------------------------
31!|| groupdef_mod ../common_source/modules/groupdef_mod.F
32!|| sensor_mod ../common_source/modules/sensor_mod.F90
33!|| spmd_mod ../engine/source/mpi/spmd_mod.F90
34!||====================================================================
35 SUBROUTINE sensor_dist_surf0(NSENSOR,SENSOR_TAB,X,IGRSURF,COMM_SENS16)
36!$COMMENT
37! SENSOR_DIST_SURF0 description
38! computation of distance to surface for sensor typ16
39! and reduction with a mpi communication
40!
41! SENSOR_DIST_SURF0 organization :
42! - computation of local distance
43! - reduction with mpi comm
44!$ENDCOMMENT
45c-----------------------------------------------
46C M o d u l e s
47c-----------------------------------------------
48 USE spmd_mod
49 USE groupdef_mod
50 USE sensor_mod
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 "com01_c.inc"
61C-----------------------------------------------
62C D u m m y A r g u m e n t s
63C-----------------------------------------------
64 INTEGER ,INTENT(IN) :: NSENSOR
65 my_real ,DIMENSION(3,NUMNOD) :: x
66 TYPE (SURF_) ,DIMENSION(NSURF), TARGET :: IGRSURF
67 TYPE (SENSOR_STR_), DIMENSION(NSENSOR),INTENT(INOUT) :: SENSOR_TAB
68 TYPE (SENSOR_COMM), INTENT(IN) :: COMM_SENS16
69C----------------------------------------------------------
70C Local Variables
71C----------------------------------------------------------
72 INTEGER I,ISURF,INOD,NP1,NP2,NP3,NP4,NSEG,IJK
73 my_real dist,dmin,dmax,tmin,tdelay
74 my_real xnod,ynod,znod,xp1,yp1,zp1,xp2,yp2,zp2,xp3,yp3,zp3,
75 . xp4,yp4,zp4
76 TYPE (SURF_) ,POINTER :: SURFACE
77 INTEGER :: ISENS
78 my_real, DIMENSION(COMM_SENS16%NUM_SENS) :: local_value,global_value
79! -----------------------------------------------------------
80
81 ! -----------------
82 ! computation of local distance (one distance per processor)
83 DO ijk=1,comm_sens16%NUM_SENS
84 isens = comm_sens16%ID_SENS(ijk)
85 local_value(ijk) = zero
86 global_value(ijk) = zero
87 IF (sensor_tab(isens)%STATUS == 1) cycle ! already activated
88
89C.....................................................
90C ==> DIST between node and a plan defined by 3 nodes
91C.....................................................
92C ID_N1 : Node identifier
93C ID_PN1 : Plan Node 1 identifier
94C ID_PN2 : Plan Node 2 identifier
95C ID_PN3 : Plan Node 3 identifier
96C
97 tmin = sensor_tab(isens)%TMIN ! min criterion time duration
98 tdelay = sensor_tab(isens)%TDELAY ! time delay before activation
99 inod = sensor_tab(isens)%IPARAM(1)
100 isurf = sensor_tab(isens)%IPARAM(2)
101c
102 dmin = sensor_tab(isens)%RPARAM(1)
103 dmax = sensor_tab(isens)%RPARAM(2)
104c
105c... Current position of reference node
106c
107 xnod = x(1,inod)
108 ynod = x(2,inod)
109 znod = x(3,inod)
110c
111c
112 ! calculate distance to Surf_Id composed of segments
113c
114 surface => igrsurf(isurf)
115 nseg = surface%NSEG
116c--------------------
117 SELECT CASE (surface%TYPE)
118c--------------------
119 CASE (2) ! SOLIDS
120c
121c to be completed
122c
123 CASE (3) ! SH4N
124c
125 DO i = 1,nseg
126 np1 = surface%NODES(i,1)
127 np2 = surface%NODES(i,2)
128 np3 = surface%NODES(i,3)
129 np4 = surface%NODES(i,4)
130 xp1 = x(1,np1)
131 yp1 = x(2,np1)
132 zp1 = x(3,np1)
133 xp2 = x(1,np2)
134 yp2 = x(2,np2)
135 zp2 = x(3,np2)
136 xp3 = x(1,np3)
137 yp3 = x(2,np3)
138 zp3 = x(3,np3)
139 xp4 = x(1,np4)
140 yp4 = x(2,np4)
141 zp4 = x(3,np4)
142 CALL dist_node_seg4n(
143 . dist,dmin,dmax,xnod,ynod,znod,
144 . xp1,yp1,zp1,xp2,yp2,zp2,xp3,yp3,zp3,xp4,yp4,zp4)
145 sensor_tab(isens)%VALUE = min(sensor_tab(isens)%VALUE, dist)
146 END DO
147c
148 CASE (7) ! SH3N
149c
150 DO i = 1,nseg
151 np1 = surface%NODES(i,1)
152 np2 = surface%NODES(i,2)
153 np3 = surface%NODES(i,3)
154 xp1 = x(1,np1)
155 yp1 = x(2,np1)
156 zp1 = x(3,np1)
157 xp2 = x(1,np2)
158 yp2 = x(2,np2)
159 zp2 = x(3,np2)
160 xp3 = x(1,np3)
161 yp3 = x(2,np3)
162 zp3 = x(3,np3)
163c
164 CALL dist_node_seg3n(
165 . dist,dmin,dmax,xnod,ynod,znod,
166 . xp1,yp1,zp1,xp2,yp2,zp2,xp3,yp3,zp3)
167 sensor_tab(isens)%VALUE = min(sensor_tab(isens)%VALUE, dist)
168 END DO
169c
170c--------------------
171 END SELECT
172c--------------------
173 local_value(ijk) = sensor_tab(isens)%VALUE
174 ENDDO
175 ! -----------------
176 ! reduction with mpi comm
177 IF(nspmd>1) THEN
178 CALL spmd_allreduce(local_value,global_value,comm_sens16%NUM_SENS,spmd_min)
179 ELSE
180 global_value(1:comm_sens16%NUM_SENS) = local_value(1:comm_sens16%NUM_SENS)
181 ENDIF
182 DO ijk=1,comm_sens16%NUM_SENS
183 isens = comm_sens16%ID_SENS(ijk)
184 sensor_tab(isens)%VALUE = global_value(ijk)
185 ENDDO
186 ! -----------------
187
188 RETURN
189 END SUBROUTINE
190
#define my_real
Definition cppsort.cpp:32
subroutine dist_node_seg3n(dist, dmin, dmax, nod_x, nod_y, nod_z, ax, ay, az, bx, by, bz, cx, cy, cz)
subroutine dist_node_seg4n(dist, dmin, dmax, nod_x, nod_y, nod_z, ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz)
#define min(a, b)
Definition macros.h:20
subroutine sensor_dist_surf0(nsensor, sensor_tab, x, igrsurf, comm_sens16)