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 I,ISURF,INOD,NP1,NP2,NP3,NP4,NSEG,ICRIT,IFLAG
71 my_real dist,dmin,dmax,alpha,tdelay,tmin
72 my_real xnod,ynod,znod,xp1,yp1,zp1,xp2,yp2,zp2,xp3,yp3,zp3,
73 . xp4,yp4,zp4,norm,infinity
74 TYPE (SURF_) ,POINTER :: SURFACE
75 parameter(infinity = 1.0e20)
76C=======================================================================
77 IF (sensor%STATUS == 1) RETURN ! already activated
78
79C.....................................................
80C ==> DIST between node and a plan defined by 3 nodes
81C.....................................................
82C ID_N1 : Node identifier
83C ID_PN1 : Plan Node 1 identifier
84C ID_PN2 : Plan Node 2 identifier
85C ID_PN3 : Plan Node 3 identifier
86C
87 tmin = sensor%TMIN
88 tdelay = sensor%TDELAY ! time delay before activation
89 inod = sensor%IPARAM(1)
90 isurf = sensor%IPARAM(2)
91c
92 dmin = sensor%RPARAM(1)
93 dmax = sensor%RPARAM(2)
94 icrit = 0
95 iflag = 0
96c
97c... Current position of reference node
98c
99 xnod = x(1,inod)
100 ynod = x(2,inod)
101 znod = x(3,inod)
102c
103c
104 IF (isurf == 0) THEN ! calculate distance to plane defined by 3 nodes
105c
106 np1 = sensor%IPARAM(3)
107 np2 = sensor%IPARAM(4)
108 np3 = sensor%IPARAM(5)
109 xp1 = x(1,np1)
110 yp1 = x(2,np1)
111 zp1 = x(3,np1)
112 xp2 = x(1,np2)
113 yp2 = x(2,np2)
114 zp2 = x(3,np2)
115 xp3 = x(1,np3)
116 yp3 = x(2,np3)
117 zp3 = x(3,np3)
118 CALL dist_node_plane_3n(dist,
119 . xnod,ynod,znod,xp1,yp1,zp1,xp2,yp2,zp2,xp3,yp3,zp3)
120c
121 sensor%VALUE = dist
122 END IF
123 IF (sensor%VALUE <= dmin) THEN
124 icrit = 1
125 iflag = 1
126 ELSE IF (sensor%VALUE >= dmax) THEN
127 icrit = 1
128 iflag = 2
129 END IF
130 sensor%RESULTS(1) = sensor%VALUE
131c----------------------------------------------------------------
132c check activation status
133c----------------------------------------------------------------
134 IF (sensor%TCRIT + tmin > tt) THEN
135 IF (icrit == 0) THEN
136 sensor%TCRIT = infinity
137 ELSE IF (sensor%TCRIT == infinity) THEN
138 sensor%TCRIT = min(sensor%TCRIT, tt)
139 END IF
140 END IF
141 IF (sensor%TSTART == infinity .and. sensor%TCRIT < infinity) THEN
142 sensor%TSTART = sensor%TCRIT + tmin + tdelay
143 END IF
144 IF (sensor%TSTART <= tt) THEN ! sensor activation
145 sensor%STATUS = 1
146 END IF
147c----------------------------------------------------------
148 IF (sensor%STATUS == 1 .and. ispmd == 0) THEN
149#include "lockon.inc"
150 WRITE (istdo,1100) sensor%SENS_ID,sensor%TSTART
151 WRITE (iout ,1100) sensor%SENS_ID,sensor%TSTART
152 IF (iflag == 1) THEN
153 WRITE (iout ,1200) dmin,dist
154 ELSE IF (iflag == 2) THEN
155 WRITE (iout ,1300) dmax,dist
156 END IF
157#include "lockoff.inc"
158 END IF
159c-----------------------------------------------------------------------
1601100 FORMAT(' SENSOR NUMBER ',i10,' ,ACTIVATED AT TIME ',1pe12.5)
1611200 FORMAT(' TARGET MIN DISTANCE TO PLAN = ',1pe12.5,/
162 . ' CURRENT DISTANCE AFTER TMIN and TDELAY = ',1pe12.5)
1631300 FORMAT(' TARGET MAX DISTANCE TO PLAN = ',1pe12.5,/
164 . ' CURRENT DISTANCE AFTER TMIN and TDELAY = ',1pe12.5)
165c----------------------------------------------------------
166 RETURN
167 END SUBROUTINE
#define my_real
Definition cppsort.cpp:32
norm(diag(diag(diag(inv(mat))) -id.SOL), 2) % destroy mumps instance id.JOB
subroutine dist_node_plane_3n(dist, xnod, ynod, znod, xp1, yp1, zp1, xp2, yp2, zp2, xp3, yp3, zp3)
#define alpha
Definition eval.h:35
#define min(a, b)
Definition macros.h:20
subroutine sensor_dist_surf(sensor, x, igrsurf)