OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
sensor_dist_surf0.F File Reference
#include "implicit_f.inc"
#include "comlock.inc"
#include "com04_c.inc"
#include "com01_c.inc"

Go to the source code of this file.

Functions/Subroutines

subroutine sensor_dist_surf0 (nsensor, sensor_tab, x, igrsurf, comm_sens16)

Function/Subroutine Documentation

◆ sensor_dist_surf0()

subroutine sensor_dist_surf0 ( integer, intent(in) nsensor,
type (sensor_str_), dimension(nsensor), intent(inout) sensor_tab,
dimension(3,numnod) x,
type (surf_), dimension(nsurf), target igrsurf,
type (sensor_comm), intent(in) comm_sens16 )

Definition at line 35 of file sensor_dist_surf0.F.

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
#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