OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
sensor_dist.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/.
23C=======================================================================
24!||====================================================================
25!|| sensor_dist ../engine/source/tools/sensor/sensor_dist.F
26!||--- called by ------------------------------------------------------
27!|| sensor_base ../engine/source/tools/sensor/sensor_base.F
28!||--- uses -----------------------------------------------------
29!|| sensor_mod ../common_source/modules/sensor_mod.F90
30!||====================================================================
31 SUBROUTINE sensor_dist(SENSOR ,X ,XSENS )
32C-----------------------------------------------
33C M o d u l e s
34C-----------------------------------------------
35 USE sensor_mod
36C-----------------------------------------------
37C I m p l i c i t T y p e s
38C-----------------------------------------------
39#include "implicit_f.inc"
40C-----------------------------------------------
41C C o m m o n B l o c k s
42C-----------------------------------------------
43#include "com01_c.inc"
44#include "com04_c.inc"
45#include "com08_c.inc"
46#include "units_c.inc"
47#include "comlock.inc"
48#include "task_c.inc"
49C-----------------------------------------------
50C D u m m y A r g u m e n t s
51C-----------------------------------------------
52 my_real, DIMENSION(3,NUMNOD) :: x
53 my_real, DIMENSION(12) :: xsens
54 TYPE (SENSOR_STR_) ,INTENT(INOUT) ,TARGET :: SENSOR
55C----------------------------------------------------------
56C Local Variables
57C----------------------------------------------------------
58 INTEGER :: N1,N2,ICRIT,DFLAG,IFLAG,ACTI
59 my_real :: dx,dy,dz,dd,dmin,dmax,tstart,tmin,tdelay
60C=======================================================================
61 tstart = sensor%TSTART
62 tdelay = sensor%TDELAY
63 tmin = sensor%TMIN
64c
65 n1 = sensor%IPARAM(1)
66 n2 = sensor%IPARAM(2)
67 dflag = sensor%IPARAM(3)
68 dmin = sensor%RPARAM(1)
69 dmax = sensor%RPARAM(2)
70 icrit = 0 ! activation
71 iflag = 0
72 acti = 0
73c
74 IF (nspmd == 1)THEN
75 dx = x(1,n1)-x(1,n2)
76 dy = x(2,n1)-x(2,n2)
77 dz = x(3,n1)-x(3,n2)
78 ELSE
79 dx = xsens(1)-xsens(4)
80 dy = xsens(2)-xsens(5)
81 dz = xsens(3)-xsens(6)
82 END IF
83 dd = sqrt(dx*dx+dy*dy+dz*dz)
84 IF (dd < dmin) THEN
85 icrit = 1
86 iflag = 1
87 ELSE IF (dd > dmax) THEN
88 icrit = 1
89 iflag = 2
90 END IF
91 sensor%RESULTS(1) = dd
92c----------------------------------------------------------------
93c check activation status
94c----------------------------------------------------------------
95 IF (sensor%STATUS == 0) THEN
96 IF (sensor%TCRIT + tmin > tt) THEN
97 IF (icrit == 0) THEN
98 sensor%TCRIT = infinity
99 ELSE IF (icrit == 1 .and. sensor%TCRIT == infinity) THEN
100 sensor%TCRIT = tt
101 END IF
102 END IF
103 tstart = sensor%TCRIT + tmin + tdelay
104 IF (tstart <= tt) THEN
105 ! sensor activation
106 acti = 1
107 sensor%STATUS = 1
108 sensor%TSTART = tstart
109 sensor%VALUE = infinity
110 END IF
111 END IF
112c
113 IF (dflag == 1 .and. sensor%STATUS == 1) THEN
114 IF (sensor%VALUE + tmin > tt) THEN
115 IF (icrit == 0 .and. sensor%VALUE == infinity) THEN
116 sensor%VALUE = tt
117 ELSE IF (icrit > 0) THEN
118 sensor%VALUE = infinity
119 END IF
120 END IF
121 IF (sensor%VALUE + tmin + tdelay <= tt) THEN
122 ! sensor deactivation
123 acti = 2
124 sensor%STATUS = 0
125 sensor%TCRIT = infinity
126 sensor%TSTART = infinity
127 END IF
128 END IF
129c-----------------------------------------------------------------------
130 IF (acti == 1) THEN
131 IF (ispmd == 0) THEN
132#include "lockon.inc"
133 WRITE (istdo,1000) sensor%SENS_ID,sensor%TSTART
134 WRITE (iout ,1000) sensor%SENS_ID,sensor%TSTART
135 IF (iflag == 1) THEN
136 WRITE (iout ,1200) dmin
137 ELSE IF (iflag == 2) THEN
138 WRITE (iout ,1300) dmax
139 END IF
140 WRITE (iout ,1400) dd
141#include "lockoff.inc"
142 ENDIF
143 ELSE IF (acti == 2) THEN
144 IF (ispmd == 0) THEN
145#include "lockon.inc"
146 WRITE (istdo,1100) sensor%SENS_ID,tt
147 WRITE (iout ,1100) sensor%SENS_ID,tt
148 WRITE (iout ,1400) dd
149#include "lockoff.inc"
150 ENDIF
151 ENDIF
152c-----------------------------------------------------------------------
1531000 FORMAT(' SENSOR NUMBER ',i10,' ACTIVATED AT TIME ',1pe12.5)
1541100 FORMAT(' SENSOR NUMBER ',i10,' DEACTIVATED AT TIME ',1pe12.5)
1551200 FORMAT(' TARGET MIN DISTANCE= ',1pe12.5)
1561300 FORMAT(' TARGET MAX DISTANCE= ',1pe12.5)
1571400 FORMAT(' CURRENT DISTANCE AFTER TMIN AND TDELAY = ',1pe12.5)
158c-----------------------------------------------------------------------
159 RETURN
160 END SUBROUTINE
#define my_real
Definition cppsort.cpp:32
subroutine sensor_dist(sensor, x, xsens)
Definition sensor_dist.F:32