OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
hm_read_rand.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_rand ../starter/source/general_controls/computation/hm_read_rand.F
25!||--- called by ------------------------------------------------------
26!|| lectur ../starter/source/starter/lectur.F
27!||--- calls -----------------------------------------------------
28!|| ancmsg ../starter/source/output/message/message.f
29!|| hm_get_floatv ../starter/source/devtools/hm_reader/hm_get_floatv.F
30!|| hm_get_intv ../starter/source/devtools/hm_reader/hm_get_intv.F
31!|| hm_option_read_key ../starter/source/devtools/hm_reader/hm_option_read_key.F
32!|| hm_option_start ../starter/source/devtools/hm_reader/hm_option_start.F
33!|| ngr2usr ../starter/source/system/nintrr.f
34!||--- uses -----------------------------------------------------
35!|| hm_option_read_mod ../starter/share/modules1/hm_option_read_mod.F
36!|| message_mod ../starter/share/message_module/message_mod.F
37!|| random_mod ../starter/share/modules1/random_mod.F
38!|| submodel_mod ../starter/share/modules1/submodel_mod.F
39!||====================================================================
40 SUBROUTINE hm_read_rand(X ,IGRNOD ,ITAB,IRAND,ALEA,XSEED,
41 . UNITAB,LSUBMODEL)
42C-----------------------------------------------
43C M o d u l e s
44C-----------------------------------------------
45 USE message_mod
46 USE groupdef_mod
47 USE submodel_mod
49 USE unitab_mod
50 USE random_mod
52C-----------------------------------------------
53C I m p l i c i t T y p e s
54C-----------------------------------------------
55#include "implicit_f.inc"
56C-----------------------------------------------
57C C o m m o n B l o c k s
58C-----------------------------------------------
59#include "com04_c.inc"
60#include "scr03_c.inc"
61#include "random_c.inc"
62#include "units_c.inc"
63C-----------------------------------------------
64C D u m m y A r g u m e n t s
65C-----------------------------------------------
66 INTEGER ITAB(*),IRAND(*)
68 . x(3,*),alea(*),xseed(*)
69C-----------------------------------------------
70 TYPE (GROUP_) ,TARGET, DIMENSION(NGRNOD) :: IGRNOD
71 TYPE (SUBMODEL_DATA),INTENT(IN)::LSUBMODEL(*)
72 TYPE (UNIT_TYPE_),INTENT(IN) ::UNITAB
73C-----------------------------------------------
74C E x t e r n a l F u n c t i o n s
75C-----------------------------------------------
76 INTEGER NGR2USR
78 . aleat
79 EXTERNAL ngr2usr,aleat
80C-----------------------------------------------
81C L o c a l V a r i a b l e s
82C-----------------------------------------------
83 INTEGER I,J,ID,IS,IGRS,IALL,NRANDG,SUB_ID
84 CHARACTER(LEN=NCHARKEY) :: KEY
85!
86 INTEGER, DIMENSION(:), POINTER :: INGR2USR
87 LOGICAL IS_AVAILABLE
88C======================================================================|
89 iall = 0
90 nrandg = 0
91 seed =zero
92 xalea =zero
93C--------------------------------------------------
94C START BROWSING MODEL RBODY
95C--------------------------------------------------
96 is_available = .false.
97 CALL hm_option_start('/RANDOM')
98C-----------------------------
99 DO i=1,nrand
100 irand(i) = 0
101 alea(i) = zero
102 xseed(i) = zero
103 ! --------------------------------
104 ! check if -rxalea or -rseed command line option are used
105 IF(.NOT.rand_struct%CMD) THEN
106C--------------------------------------------------
107C EXTRACT DATAS OF /RANDOM
108C--------------------------------------------------
109 CALL hm_option_read_key(lsubmodel,
110 . keyword2 = key,
111 . submodel_id = sub_id)
112C
113 IF(sub_id == 0) THEN
114 CALL hm_get_floatv('XALEA',alea(i),is_available,lsubmodel,unitab)
115 CALL hm_get_floatv('SEED',xseed(i),is_available,lsubmodel,unitab)
116 CALL hm_get_intv('GRNOD_ID',id,is_available,lsubmodel)
117C
118 irand(i) = id
119 IF (alea(i) > zero) THEN
120 seed = xseed(i)
121 IF(key(1:5) == 'GRNOD') THEN
122 nrandg = nrandg+1
123 ingr2usr => igrnod(1:ngrnod)%ID
124 irand(nrandg) = ngr2usr(id,ingr2usr,ngrnod)
125 IF (irand(nrandg) == 0) THEN
126 CALL ancmsg(msgid=173,
127 . msgtype=msgerror,
128 . anmode=aninfo,
129 . c1='RANDOM NOISE',
130 . c2='NODE',
131 . i1=id)
132 nrandg = nrandg-1
133 ENDIF
134 ELSE
135 iall = iall+1
136 xalea = alea(i)
137 ENDIF
138 ENDIF
139 ENDIF
140 ! --------------------------------
141 ELSE
142 ! -rxalea or -rseed command line option are used
143 iall = iall+1
144 irand(i) = 0
145 alea(i) = rand_struct%ALEA_NBR
146 xseed(i) = rand_struct%SEED_NBR
147 seed = xseed(i)
148 xalea = alea(i)
149 ENDIF
150 ! --------------------------------
151 ENDDO
152 IF ((nrandg == 0 .AND. xalea > zero).OR.(nrandg > 0 .AND. iall == 0) ) THEN
153 IF(.NOT.rand_struct%CMD) WRITE(iout,1000)
154 ENDIF
155C---
156 IF (nrandg == 0 .AND. xalea > zero) THEN
157C-----------------------
158C All nodes
159C-----------------------
160 DO i=1,numnod
161 x(1,i)=x(1,i)+xalea*aleat()
162 x(2,i)=x(2,i)+xalea*aleat()
163 x(3,i)=x(3,i)+xalea*aleat()
164 ENDDO
165C
166 WRITE (iout,'(8X,A)')'NODE GROUP : ALL NODES'
167 WRITE (iout,1100) xalea
168 IF (seed /= zero) WRITE (iout,1200) seed
169 IF (ipri >= 4) THEN
170 WRITE (iout,1400)
171 DO i=1,numnod
172 WRITE(iout,1500)itab(i),x(1,i),x(2,i),x(3,i)
173 ENDDO
174 ENDIF
175 ELSEIF (nrandg > 0 .AND. iall == 0) THEN
176C-----------------------
177C Node groups only
178C-----------------------
179 DO i=1,nrandg
180 igrs = irand(i)
181 seed = xseed(i)
182 DO j=1,igrnod(igrs)%NENTITY
183 is=igrnod(igrs)%ENTITY(j)
184 x(1,is)=x(1,is)+alea(i)*aleat()
185 x(2,is)=x(2,is)+alea(i)*aleat()
186 x(3,is)=x(3,is)+alea(i)*aleat()
187 ENDDO
188 WRITE (iout,1050) igrnod(igrs)%ID
189 WRITE (iout,1100) alea(i)
190 IF (seed /= zero) WRITE (iout,1200) seed
191 ENDDO
192 IF (ipri >= 4) THEN
193 WRITE (iout,1400)
194 DO i=1,nrandg
195 igrs = irand(i)
196 DO j=1,igrnod(igrs)%NENTITY
197 is=igrnod(igrs)%ENTITY(j)
198 WRITE(iout,1500) itab(is),x(1,is),x(2,is),x(3,is)
199 ENDDO
200 ENDDO
201 ENDIF
202 ENDIF
203C-----------------------
204 RETURN
205 1000 FORMAT(//
206 .' RANDOM NOISE '/
207 .' ------------ ')
208 1050 FORMAT(/8x,'NODE GROUP : ID = ',i10)
209 1100 FORMAT( 8x,'MAXIMUM RANDOM NOISE : XALEA = ',1pg20.13)
210 1200 FORMAT( 8x,'RANDOM SEQUENCE : SEED = ',1pg20.13)
211 1400 FORMAT(/8x,'NEW NODE COORDINATES',20x,'X',24x,'Y',24x,'Z')
212 1500 FORMAT( 7x,i10,3(5x,e20.13))
213C---
214 RETURN
215 END SUBROUTINE hm_read_rand
#define my_real
Definition cppsort.cpp:32
subroutine hm_get_floatv(name, rval, is_available, lsubmodel, unitab)
subroutine hm_get_intv(name, ival, is_available, lsubmodel)
subroutine hm_option_start(entity_type)
subroutine hm_read_rand(x, igrnod, itab, irand, alea, xseed, unitab, lsubmodel)
#define seed()
Definition macros.h:43
integer, parameter ncharkey
type(random_struct) rand_struct
Definition random_mod.F:52
integer function ngr2usr(iu, igr, ngr)
Definition nintrr.F:325
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:889
program starter
Definition starter.F:39