OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
sensor_dist_surf.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_surf ../engine/source/tools/sensor/sensor_dist_surf.F
25!||--- called by ------------------------------------------------------
26!|| sensor_base ../engine/source/tools/sensor/sensor_base.F
27!||--- calls -----------------------------------------------------
28!|| dist_node_plane_3n ../engine/source/tools/sensor/dist_node_plane_3n.F
29!||--- uses -----------------------------------------------------
30!|| groupdef_mod ../common_source/modules/groupdef_mod.F
31!|| sensor_mod ../common_source/modules/sensor_mod.f90
32!||====================================================================
33 SUBROUTINE sensor_dist_surf(SENSOR ,X ,IGRSURF)
34!$COMMENT
35! SENSOR_DIST_SURF description
36! computation of distance to surface for sensor typ16 + plane defined by 3 nodes
37! and modification of the state of sensor
38! For the other surface, the distance computation is done in SENSOR_DIST_SURF0 routine
39!
40! SENSOR_DIST_SURF0 organization :
41! - computation of local distance for sensor 16 + plane defined by 3 nodes
42! - sensor state modification
43!$ENDCOMMENT
44c-----------------------------------------------
45C M o d u l e s
46c-----------------------------------------------
47 USE groupdef_mod
48 USE sensor_mod
49C-----------------------------------------------
50C I m p l i c i t T y p e s
51C-----------------------------------------------
52#include "implicit_f.inc"
53#include "comlock.inc"
54C-----------------------------------------------
55C C o m m o n B l o c k s
56C-----------------------------------------------
57#include "units_c.inc"
58#include "com04_c.inc"
59#include "com08_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 my_real ,DIMENSION(3,NUMNOD) :: x
65 TYPE (SURF_) ,DIMENSION(NSURF), TARGET :: IGRSURF
66 TYPE (SENSOR_STR_) :: SENSOR
67C----------------------------------------------------------
68C Local Variables
69C----------------------------------------------------------
70 INTEGER ISURF, INOD, NP1, NP2, NP3, ICRIT, IFLAG
71 my_real dist,dmin,dmax,tdelay,tmin
72 my_real xnod,ynod,znod,xp1,yp1,zp1,xp2,yp2,zp2,xp3,yp3,zp3
73C=======================================================================
74 IF (sensor%STATUS == 1) RETURN ! already activated
75
76C.....................................................
77C ==> DIST between node and a plan defined by 3 nodes
78C.....................................................
79C ID_N1 : Node identifier
80C ID_PN1 : Plan Node 1 identifier
81C ID_PN2 : Plan Node 2 identifier
82C ID_PN3 : Plan Node 3 identifier
83C
84 tmin = sensor%TMIN
85 tdelay = sensor%TDELAY ! time delay before activation
86 inod = sensor%IPARAM(1)
87 isurf = sensor%IPARAM(2)
88c
89 dmin = sensor%RPARAM(1)
90 dmax = sensor%RPARAM(2)
91 icrit = 0
92 iflag = 0
93c
94c... Current position of reference node
95c
96 xnod = x(1,inod)
97 ynod = x(2,inod)
98 znod = x(3,inod)
99c
100c
101 IF (isurf == 0) THEN ! calculate distance to plane defined by 3 nodes
102c
103 np1 = sensor%IPARAM(3)
104 np2 = sensor%IPARAM(4)
105 np3 = sensor%IPARAM(5)
106 xp1 = x(1,np1)
107 yp1 = x(2,np1)
108 zp1 = x(3,np1)
109 xp2 = x(1,np2)
110 yp2 = x(2,np2)
111 zp2 = x(3,np2)
112 xp3 = x(1,np3)
113 yp3 = x(2,np3)
114 zp3 = x(3,np3)
115 CALL dist_node_plane_3n(dist,
116 . xnod,ynod,znod,xp1,yp1,zp1,xp2,yp2,zp2,xp3,yp3,zp3)
117c
118 sensor%VALUE = dist
119 END IF
120 IF (sensor%VALUE <= dmin) THEN
121 icrit = 1
122 iflag = 1
123 ELSE IF (sensor%VALUE >= dmax) THEN
124 icrit = 1
125 iflag = 2
126 END IF
127 sensor%RESULTS(1) = sensor%VALUE
128c----------------------------------------------------------------
129c check activation status
130c----------------------------------------------------------------
131 IF (sensor%TCRIT + tmin > tt) THEN
132 IF (icrit == 0) THEN
133 sensor%TCRIT = infinity
134 ELSE IF (sensor%TCRIT == infinity) THEN
135 sensor%TCRIT = min(sensor%TCRIT, tt)
136 END IF
137 END IF
138 IF (sensor%TSTART == infinity .and. sensor%TCRIT < infinity) THEN
139 sensor%TSTART = sensor%TCRIT + tmin + tdelay
140 END IF
141 IF (sensor%TSTART <= tt) THEN ! sensor activation
142 sensor%STATUS = 1
143 END IF
144c----------------------------------------------------------
145 IF (sensor%STATUS == 1 .and. ispmd == 0) THEN
146#include "lockon.inc"
147 WRITE (istdo,1100) sensor%SENS_ID,sensor%TSTART
148 WRITE (iout ,1100) sensor%SENS_ID,sensor%TSTART
149 IF (iflag == 1) THEN
150 WRITE (iout ,1200) dmin,dist
151 ELSE IF (iflag == 2) THEN
152 WRITE (iout ,1300) dmax,dist
153 END IF
154#include "lockoff.inc"
155 END IF
156c-----------------------------------------------------------------------
1571100 FORMAT(' SENSOR NUMBER ',i10,' ,ACTIVATED AT TIME ',1pe12.5)
1581200 FORMAT(' TARGET MIN DISTANCE TO PLAN = ',1pe12.5,/
159 . ' CURRENT DISTANCE AFTER TMIN and TDELAY = ',1pe12.5)
1601300 FORMAT(' TARGET MAX DISTANCE TO PLAN = ',1pe12.5,/
161 . ' CURRENT DISTANCE AFTER TMIN and TDELAY = ',1pe12.5)
162c----------------------------------------------------------
163 RETURN
164 END SUBROUTINE
#define my_real
Definition cppsort.cpp:32
subroutine dist_node_plane_3n(dist, xnod, ynod, znod, xp1, yp1, zp1, xp2, yp2, zp2, xp3, yp3, zp3)
#define min(a, b)
Definition macros.h:20
subroutine sensor_dist_surf(sensor, x, igrsurf)