OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
hm_read_sensors.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!|| hm_read_sensors ../starter/source/tools/sensor/hm_read_sensors.F
25!||--- called by ------------------------------------------------------
26!|| lectur ../starter/source/starter/lectur.F
27!||--- calls -----------------------------------------------------
28!|| ancmsg ../starter/source/output/message/message.F
29!|| hm_option_count ../starter/source/devtools/hm_reader/hm_option_count.F
30!|| hm_option_read_key ../starter/source/devtools/hm_reader/hm_option_read_key.F
31!|| hm_option_start ../starter/source/devtools/hm_reader/hm_option_start.f
32!|| read_sensor_acc ../starter/source/tools/sensor/read_sensor_acc.F
33!|| read_sensor_and ../starter/source/tools/sensor/read_sensor_and.F
34!|| read_sensor_contact ../starter/source/tools/sensor/read_sensor_contact.F
35!|| read_sensor_disp ../starter/source/tools/sensor/read_sensor_disp.F
36!|| read_sensor_dist_surf ../starter/source/tools/sensor/read_sensor_dist_surf.F
37!|| read_sensor_energy ../starter/source/tools/sensor/read_sensor_energy.F
38!|| read_sensor_gauge ../starter/source/tools/sensor/read_sensor_gauge.F
39!|| read_sensor_hic ../starter/source/tools/sensor/read_sensor_hic.F
40!|| read_sensor_nic ../starter/source/tools/sensor/read_sensor_nic.F
41!|| read_sensor_not ../starter/source/tools/sensor/read_sensor_not.f
42!|| read_sensor_or ../starter/source/tools/sensor/read_sensor_or.F
43!|| read_sensor_python ../starter/source/tools/sensor/hm_read_sensor_python.F90
44!|| read_sensor_rbody ../starter/source/tools/sensor/read_sensor_rbody.F
45!|| read_sensor_rwall ../starter/source/tools/sensor/read_sensor_rwall.F
46!|| read_sensor_sect ../starter/source/tools/sensor/read_sensor_sect.F
47!|| read_sensor_sens ../starter/source/tools/sensor/read_sensor_sens.F
48!|| read_sensor_temp ../starter/source/tools/sensor/read_sensor_temp.F
49!|| read_sensor_time ../starter/source/tools/sensor/read_sensor_time.F
50!|| read_sensor_user ../starter/source/tools/sensor/read_sensor_user.F
51!|| read_sensor_vel ../starter/source/tools/sensor/read_sensor_vel.F
52!|| read_sensor_work ../starter/source/tools/sensor/read_sensor_work.F
53!|| sensor_tab_init ../starter/source/tools/sensor/sensor_tab_init.F
54!|| udouble ../starter/source/system/sysfus.F
55!||--- uses -----------------------------------------------------
56!|| hm_option_read_mod ../starter/share/modules1/hm_option_read_mod.F
57!|| message_mod ../starter/share/message_module/message_mod.F
58!|| read_sensor_python_mod ../starter/source/tools/sensor/hm_read_sensor_python.f90
59!|| submodel_mod ../starter/share/modules1/submodel_mod.F
60!|| surf_mod ../starter/share/modules1/surf_mod.F
61!||====================================================================
62 SUBROUTINE hm_read_sensors(PYTHON,
63 . SENSORS ,LACCELM ,ITABM1 ,IPART ,LGAUGE ,
64 . SUBSET ,NSETS ,IGRNOD ,
65 . ISKWN ,UNITAB ,LSUBMODEL ,HM_NSENS ,
66 . SENSOR_USER_STRUCT)
67C-----------------------------------------------
68C M o d u l e s
69C-----------------------------------------------
70 USE python_funct_mod
71 USE my_alloc_mod
72 USE unitab_mod
73 USE message_mod
74 USE groupdef_mod
76 USE surf_mod
77 USE submodel_mod
78 USE sensor_mod
80 USE read_sensor_python_mod, ONLY : read_sensor_python
82C-----------------------------------------------
83C I m p l i c i t T y p e s
84C-----------------------------------------------
85#include "implicit_f.inc"
86C-----------------------------------------------
87C C o m m o n B l o c k s
88C-----------------------------------------------
89#include "param_c.inc"
90#include "scr17_c.inc"
91#include "com04_c.inc"
92#include "units_c.inc"
93C-----------------------------------------------
94C D u m m y A r g u m e n t s
95C-----------------------------------------------
96 TYPE(python_), intent(inout) :: PYTHON
97 INTEGER ,INTENT(IN) :: NSETS
98 INTEGER ,INTENT(OUT) :: HM_NSENS
99 INTEGER ,DIMENSION(*) ,INTENT(IN) :: ITABM1
100 INTEGER ,DIMENSION(3,*) ,INTENT(IN) :: LACCELM,LGAUGE
101 INTEGER ,DIMENSION(LISKN,*) ,INTENT(IN) :: ISKWN
102 INTEGER ,DIMENSION(LIPART1,*) ,INTENT(IN) :: IPART
103 TYPE (SENSORS_) ,INTENT(INOUT) ,TARGET :: SENSORS
104 TYPE (GROUP_) ,DIMENSION(NGRNOD) :: IGRNOD
105 TYPE (SUBSET_) ,DIMENSION(NSUBS) :: SUBSET
106 TYPE (SUBMODEL_DATA) ,DIMENSION(NSUBMOD) :: LSUBMODEL
107 TYPE (UNIT_TYPE_) ,INTENT(IN) ::UNITAB
108 TYPE(sensor_user_struct_) ,INTENT(INOUT) :: SENSOR_USER_STRUCT
109C-----------------------------------------------
110C L o c a l V a r i a b l e s
111C-----------------------------------------------
112 INTEGER ISEN,IUNIT,IFLAGUNIT,NS,UNIT_ID,SENS_ID
113 my_real :: BID
114 CHARACTER(LEN=NCHARTITLE) :: TITR
115 CHARACTER KEY*40,MESS*40
116 INTEGER ,DIMENSION(:) ,ALLOCATABLE :: SID
117 TYPE(python_function), DIMENSION(:), ALLOCATABLE :: temp
118 DATA mess/'SENSOR DEFINITION '/
119C=======================================================================
120c Initialize sensor data structure
121c---------------------------------------------
122 CALL hm_option_count('/SENSOR', hm_nsens)
123 CALL hm_option_count('/SENSOR/PYTHON', ns)
124 IF(ns > 0) THEN
125 call python_initialize(python_error)
126 if(.not. allocated(python%functs)) then
127 allocate(python%functs(ns))
128 else
129 allocate(temp(python%nb_functs + ns))
130 temp(1:python%nb_functs) = python%functs
131 CALL move_alloc(from=temp,to=python%functs)
132 endif
133 END IF
134 IF (hm_nsens > 0) THEN
135 WRITE(istdo,'(A)')' .. SENSORS'
136 WRITE (iout,'(///,A)')' SENSORS'
137 WRITE (iout,'(A/)') ' -------'
138 END IF
139c---------------------------------------------
140 IF (ALLOCATED(sensors%SENSOR_TAB)) DEALLOCATE(sensors%SENSOR_TAB)
141 ALLOCATE(sensors%SENSOR_TAB(hm_nsens))
142 CALL my_alloc (sid,hm_nsens)
143 sensors%NSENSOR = hm_nsens
144c
145 CALL sensor_tab_init(sensors)
146c
147 CALL hm_option_start('/SENSOR')
148c
149c---------------------------------------------------
150c
151 DO isen = 1,hm_nsens
152c
153 CALL hm_option_read_key(lsubmodel,
154 . option_id = sens_id,
155 . option_titr = titr ,
156 . unit_id = unit_id ,
157 . keyword2 = key )
158c--------------------------------------------------
159c CHECK IF UNIT_ID EXISTS
160c--------------------------------------------------
161 iflagunit = 0
162 DO iunit=1,unitab%NUNITS
163 IF (unitab%UNIT_ID(iunit) == unit_id) THEN
164 iflagunit = 1
165 EXIT
166 ENDIF
167 ENDDO
168 IF (unit_id > 0 .AND. iflagunit == 0) THEN
169 CALL ancmsg(msgid=659,anmode=aninfo,msgtype=msgerror,
170 . i2=unit_id,i1=sens_id,
171 . c1='SENSOR', c2='SENSOR', c3='TITR')
172 ENDIF
173c
174 key = key(1:len_trim(key))
175c-----------------------
176 SELECT CASE(key)
177c-----------------------
178 CASE ('TIME' ,'TYPE0')
179 CALL read_sensor_time(sensors%SENSOR_TAB(isen) ,sens_id ,unitab ,lsubmodel)
180c
181 CASE ('ACCE' ,'TYPE1')
182 CALL read_sensor_acc(sensors%SENSOR_TAB(isen) ,sens_id ,titr ,
183 . laccelm ,unitab ,lsubmodel)
184c
185 CASE ('DIST' ,'TYPE2')
186 CALL read_sensor_disp(sensors%SENSOR_TAB(isen) ,sens_id ,
187 . itabm1 ,unitab ,lsubmodel)
188c
189 CASE ('SENS' ,'TYPE3')
190 CALL read_sensor_sens(sensors%SENSOR_TAB(isen) ,sens_id ,unitab ,lsubmodel)
191c
192 CASE ('AND' ,'TYPE4')
193 CALL read_sensor_and(sensors%SENSOR_TAB(isen) ,sens_id ,unitab ,lsubmodel)
194c
195 CASE ('OR' ,'TYPE5')
196 CALL read_sensor_or(sensors%SENSOR_TAB(isen) ,sens_id ,unitab ,lsubmodel)
197c
198 CASE ('INTER' ,'TYPE6')
199 CALL read_sensor_contact(sensors%SENSOR_TAB(isen) ,sens_id ,titr ,
200 . unitab ,lsubmodel)
201c
202 CASE ('RWALL' ,'TYPE7')
203 CALL read_sensor_rwall(sensors%SENSOR_TAB(isen) ,sens_id ,titr ,
204 . unitab ,lsubmodel)
205c
206 CASE ('NOT' ,'TYPE8')
207 CALL read_sensor_not(sensors%SENSOR_TAB(isen) ,sens_id ,unitab ,lsubmodel)
208c
209 CASE ('VEL' ,'TYPE9')
210 CALL read_sensor_vel(sensors%SENSOR_TAB(isen) ,sens_id ,
211 . itabm1 ,unitab ,lsubmodel)
212c
213 CASE ('GAUGE' ,'TYPE10')
214 CALL read_sensor_gauge(sensors%SENSOR_TAB(isen) ,sens_id ,titr ,
215 . lgauge ,unitab ,lsubmodel)
216c
217 CASE ('RBODY' ,'TYPE11')
218 CALL read_sensor_rbody(sensors%SENSOR_TAB(isen) ,sens_id ,titr ,
219 . unitab ,lsubmodel)
220c
221 CASE ('SECT' ,'TYPE12')
222 CALL read_sensor_sect(sensors%SENSOR_TAB(isen) ,sens_id ,titr ,
223 . unitab ,lsubmodel)
224c
225 CASE ('WORK' ,'TYPE13')
226 CALL read_sensor_work(sensors%SENSOR_TAB(isen) ,sens_id ,
227 . itabm1 ,unitab ,lsubmodel)
228c
229 CASE ('ENERGY' ,'TYPE14')
230 CALL read_sensor_energy(sensors%SENSOR_TAB(isen) ,sens_id ,titr ,
231 . ipart ,subset ,unitab ,lsubmodel)
232c
233 CASE ('DIST_SURF' ,'TYPE15')
234 CALL read_sensor_dist_surf(sensors%SENSOR_TAB(isen) ,sens_id ,
235 . itabm1 ,unitab ,lsubmodel)
236c
237 CASE ('HIC' ,'TYPE16')
238 CALL read_sensor_hic(sensors%SENSOR_TAB(isen) ,sens_id ,titr ,
239 . laccelm ,unitab ,lsubmodel)
240c
241 CASE ('TEMP')
242 CALL read_sensor_temp(sensors%SENSOR_TAB(isen) ,sens_id ,titr ,
243 . igrnod ,unitab ,lsubmodel)
244c
245 CASE ('NIC_NIJ')
246 CALL read_sensor_nic(
247 . sensors%SENSOR_TAB(isen) ,sens_id ,titr ,iskwn ,
248 . unitab ,lsubmodel )
249c
250 CASE ('USER1' ,'USER2','USER3')
251
252 sensors%SENSOR_TAB(isen)%TSTART = infinity
253
254 CALL read_sensor_user(hm_nsens ,isen ,titr,
255 . unitab ,lsubmodel ,key ,unit_id ,sens_id ,
256 . sensors%SENSOR_TAB(isen),sensor_user_struct)
257 sensors%SENSOR_TAB(isen)%SENS_ID = sens_id
258 CASE('PYTHON')
259 CALL read_sensor_python(python,
260 . sensors%SENSOR_TAB(isen) ,sens_id , lsubmodel )
261
262 CASE DEFAULT
263 CALL ancmsg(msgid=43, anmode=aninfo, msgtype=msgerror,
264 . c2=key(1:len_trim(key)),
265 . i1=sens_id,
266 . c1=titr)
267 END SELECT
268c
269 sensors%SENSOR_TAB(isen)%TITLE = titr
270c-----------------
271 END DO ! NSENSOR
272c-------------------------------------
273c Recherche des ID doubles : activate this code when lecsen is removed
274c-------------------------------------
275 DO isen = 1,sensors%NSENSOR
276 IF (sensors%SENSOR_TAB(isen)%SENS_ID > 0) THEN
277 sid(isen) = sensors%SENSOR_TAB(isen)%SENS_ID
278 END IF
279 END DO
280 CALL udouble(sid,1,sensors%NSENSOR,mess,0,bid)
281 DEALLOCATE(sid)
282c-----------
283 RETURN
284 END
subroutine hm_option_count(entity_type, hm_option_number)
subroutine hm_option_start(entity_type)
subroutine hm_read_sensors(python, sensors, laccelm, itabm1, ipart, lgauge, subset, nsets, igrnod, iskwn, unitab, lsubmodel, hm_nsens, sensor_user_struct)
integer, parameter nchartitle
subroutine read_sensor_acc(sensor_ptr, sens_id, titr, laccelm, unitab, lsubmodel)
subroutine read_sensor_and(sensor_ptr, sens_id, unitab, lsubmodel)
subroutine read_sensor_contact(sensor_ptr, sens_id, titr, unitab, lsubmodel)
subroutine read_sensor_disp(sensor_ptr, sens_id, itabm1, unitab, lsubmodel)
subroutine read_sensor_dist_surf(sensor_ptr, sens_id, itabm1, unitab, lsubmodel)
subroutine read_sensor_energy(sensor_ptr, sens_id, titr, ipart, subset, unitab, lsubmodel)
subroutine read_sensor_gauge(sensor_ptr, sens_id, titr, lgauge, unitab, lsubmodel)
subroutine read_sensor_hic(sensor_ptr, sens_id, titr, laccelm, unitab, lsubmodel)
subroutine read_sensor_nic(sensor_ptr, sens_id, titr, iskn, unitab, lsubmodel)
subroutine read_sensor_not(sensor_ptr, sens_id, unitab, lsubmodel)
subroutine read_sensor_or(sensor_ptr, sens_id, unitab, lsubmodel)
subroutine read_sensor_rbody(sensor_ptr, sens_id, titr, unitab, lsubmodel)
subroutine read_sensor_rwall(sensor_ptr, sens_id, titr, unitab, lsubmodel)
subroutine read_sensor_sect(sensor_ptr, sens_id, titr, unitab, lsubmodel)
subroutine read_sensor_sens(sensor_ptr, sens_id, unitab, lsubmodel)
subroutine read_sensor_temp(sensor_ptr, sens_id, titr, igrnod, unitab, lsubmodel)
subroutine read_sensor_time(sensor_ptr, sens_id, unitab, lsubmodel)
subroutine read_sensor_user(hm_nsensor, isen, title, unitab, lsubmodel, key, unit_id, sens_id, sensor_ptr, sensor_user_struct)
subroutine read_sensor_vel(sensor_ptr, sens_id, itabm1, unitab, lsubmodel)
subroutine read_sensor_work(sensor_ptr, sens_id, itabm1, unitab, lsubmodel)
subroutine sensor_tab_init(sensors)
subroutine ancmsg(msgid, msgtype, anmode, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, r1, r2, r3, r4, r5, r6, r7, r8, r9, c1, c2, c3, c4, c5, c6, c7, c8, c9, prmode)
Definition message.F:895
subroutine udouble(list, ilist, nlist, mess, ir, rlist)
Definition sysfus.F:573
program starter
Definition starter.F:39