42 . IPART ,RNOISE ,IPARTC ,IPARTG ,IPARTSP ,
43 . IGRPART ,IPARTS ,PERTURB ,IDPERTURB,
44 . INDEX ,INDEX_ITYP,NPART_SHELL,OFFS ,QP_IPERTURB,
45 . QP_RPERTURB,LSUBMODEL,UNITAB)
59#include "implicit_f.inc"
72 my_real :: RNOISE(NPERTURB,NUMELC+NUMELTG+NUMELS+NUMSPH),
74 INTEGER IPART(LIPART1,*),(*),IPARTSP(*),IPARTG(*),IPARTS(*),
76 . idperturb(nperturb),index(numelc+numeltg+numels+numsph),
77 . index_ityp(numelc+numeltg+numels+numsph),npart_shell,
78 . qp_iperturb(nperturb,6)
79 TYPE (UNIT_TYPE_) ,
INTENT(IN) :: UNITAB
80 TYPE (SUBMODEL_DATA) ,
INTENT(IN) :: LSUBMODEL(*)
81 TYPE (GROUP_) ,
DIMENSION(NGRPART):: IGRPART
82 TYPE (MATPARAM_STRUCT_) ,
DIMENSION(NUMMAT) ,
INTENT(INOUT) :: MAT_PARAM
86 INTEGER ICOUNT,II,J,K,N,I_METHOD,MAX_PART,OPT_ID,FAIL_ID,UNIT_ID,KLEN,
87 . CPT_PART,NB_RANDOM,I_SEED,NPERTURB_FAIL,
88 . NB_INTERV,SEED,SEED_RANDOM,IFAILMAT,IFAILTYPE,ITYP,I_PERTURB_VAR,SIZEY
89 INTEGER,
DIMENSION(50) :: DISTRIB
90 INTEGER,
DIMENSION(8) :: DT_SEED
91 INTEGER,
DIMENSION(:,:),
ALLOCATABLE :: TAB_PART
92 INTEGER,
DIMENSION(:),
ALLOCATABLE :: A_SEED
94 . mean,stdev,mean_input,sd_input,max_distrib,temp,min_value,
95 . max_value,interv,
VALUE,max_value1,minval,maxval,bid
96 my_real,
DIMENSION(:),
ALLOCATABLE :: array
97 CHARACTER(LEN=NCHARTITLE)::TITR
98 CHARACTER*100 KEY1,KEY2
99 CHARACTER(LEN=NCHARKEY) :: PARAM
102 DATA mess/
'PERTURBATION DEFINITION '/
110 DO icount = 1+offs,nperturb_fail+offs
115 . option_id = opt_id,
116 . unit_id = unit_id ,
119 . option_titr = titr)
121 idperturb(icount) = opt_id
122 klen = len_trim(key2)
123 IF (key2(1:klen) ==
'BIQUAD')
THEN
126 CALL ancmsg(msgid=1192, msgtype=msgerror, anmode=aninfo,
133 CALL hm_get_intv (
'fail_ID' ,fail_id ,is_available,lsubmodel)
136 IF (fail_id > 0)
THEN
138 DO j=1,mat_param(n)%NFAIL
139 IF (mat_param(n)%FAIL(j)%FAIL_ID == fail_id)
THEN
140 IF (ifailtype /= mat_param(n)%FAIL(j)%IRUPT)
THEN
141 CALL ancmsg(msgid=1193, msgtype=msgerror, anmode=aninfo,
151 IF (ifailmat > 0)
EXIT
155 perturb(icount) = ityp
157 IF (ifailmat > 0)
THEN
159 IF(ipart(1,n) == ifailmat)
THEN
160 cpt_part = cpt_part + 1
164 CALL ancmsg(msgid=1137, msgtype=msgerror, anmode=aninfo,
168 . c2=
'FAILURE CRITERIA')
170 max_part =
max(max_part,cpt_part)
174 ALLOCATE(tab_part(nperturb,max_part))
180 DO icount = 1+offs,nperturb_fail+offs
185 . option_id = opt_id,
186 . unit_id = unit_id ,
189 . option_titr = titr)
190 idperturb(icount) = opt_id
192 klen = len_trim(key2)
193 IF (key2(1:klen) ==
'BIQUAD')
THEN
196 CALL hm_get_floatv(
'F_Mean' ,mean ,is_available,lsubmodel,unitab)
197 CALL hm_get_floatv(
'Deviation' ,stdev ,is_available,lsubmodel,unitab)
198 CALL hm_get_floatv(
'Min_cut' ,minval ,is_available,lsubmodel,unitab)
199 CALL hm_get_floatv(
'Max_cut' ,maxval ,is_available,lsubmodel,unitab)
200 CALL hm_get_intv (
'Seed' ,seed ,is_available,lsubmodel)
201 CALL hm_get_intv (
'Idistri' ,i_method ,is_available,lsubmodel)
203 CALL hm_get_intv (
'fail_ID' ,fail_id ,is_available,lsubmodel)
208 IF (i_method == 0) i_method = 2
209 IF (i_method == 2)
THEN
210 IF (minval == zero .AND.
THEN
218 qp_iperturb(icount,1) = opt_id
219 qp_iperturb(icount,2) = ityp
220 qp_iperturb(icount,3) = seed
221 qp_iperturb(icount,4) = i_method
222 qp_iperturb(icount,5) = fail_id
223 qp_rperturb(icount,1) = mean
224 qp_rperturb(icount,2) = stdev
225 qp_rperturb(icount,3) = minval
226 qp_rperturb(icount,4) = maxval
228 IF (param(1:2) ==
'c3' .or. param(1:2) ==
'C3')
THEN
230 qp_iperturb(icount,6) = i_perturb_var
232 CALL ancmsg(msgid=1194,msgtype=msgerror,anmode=aninfo,
241 DO j=1,mat_param(n)%NFAIL
242 IF (mat_param(n)%FAIL(j)%FAIL_ID == fail_id)
THEN
247 IF (ifailmat > 0)
EXIT
250 IF (ifailmat > 0)
THEN
253 IF(ipart(1,n) == ifailmat)
THEN
254 cpt_part = cpt_part + 1
255 tab_part(icount,cpt_part) = n
262 IF(i_method == 2)
THEN
264 . opt_id,
'GAUSSIAN',mean_input,sd_input,seed,key2,fail_id,param
265 WRITE (iout,
'(10I10)') ipart(4,tab_part(icount,1:cpt_part))
268 ELSEIF(i_method == 1)
THEN
269 WRITE (iout,4100) opt_id,
'RANDOM',seed,key2,fail_id,param
270 WRITE (iout,
'(10I10)') ipart(4,tab_part(icount,1:cpt_part))
278 IF (ipartc(ii) == tab_part(icount,k))
THEN
279 nb_random = nb_random + 1
280 index(nb_random) = ii
281 index_ityp(nb_random) = 3
287 IF(ipartg(ii) == tab_part(icount,k))
THEN
288 nb_random = nb_random + 1
289 index(nb_random) = ii
290 index_ityp(nb_random) = 7
296 IF (iparts(ii) == tab_part(icount,k))
THEN
297 nb_random = nb_random + 1
298 index(nb_random) = ii
299 index_ityp(nb_random) = 1
305 IF (ipartsp(ii) == tab_part(icount,k))
THEN
306 nb_random = nb_random + 1
307 index(nb_random) = ii
308 index_ityp(nb_random) = 51
316 CALL random_seed(size=i_seed)
317 ALLOCATE(a_seed(1:i_seed))
318 CALL random_seed(get=a_seed)
319 CALL date_and_time(values=dt_seed)
320 a_seed=dt_seed(8)*dt_seed(7)*dt_seed(6)
321 seed=dt_seed(8)*dt_seed(7)*dt_seed(6)
322 CALL random_seed(put=a_seed)
326 CALL random_seed(size=i_seed)
327 ALLOCATE(a_seed(1:i_seed))
329 CALL random_seed(put=a_seed)
337 ALLOCATE(array(nb_random+2))
338 CALL random_number(array)
344 IF ( i_method == 2)
THEN
345 DO ii = 1, nb_random+1, 2
346 temp = stdev * sqrt(-2.0*log(array(ii))) * cos(2*pi*array(ii+1)) +
349 . stdev * sqrt(-2.0*log(array(ii))) * sin(2*pi*array(ii+1)) + mean
353 array(ii) =
max(
min(maxval,array(ii)),minval)
354 max_value =
max(array(ii),max_value)
355 min_value =
min(array(ii),min_value)
357 ELSEIF(i_method == 1)
THEN
359 array(ii) = array(ii)*(maxval-minval)+minval
360 max_value =
max(array(ii),max_value)
361 min_value =
min(array(ii),min_value)
366 IF (index_ityp(ii) == 3)
THEN
367 rnoise(icount,index(ii)) = array(ii)
368 ELSEIF (index_ityp(ii) == 7)
THEN
369 rnoise(icount,index(ii)+numelc) = array(ii)
370 ELSEIF (index_ityp(ii) == 1)
THEN
371 rnoise(icount,index(ii)+numelc+numeltg) = array(ii)
372 ELSEIF (index_ityp(ii) == 51)
THEN
373 rnoise(icount,index(ii)+numelc+numeltg+numels) = array(ii)
379 mean = sum(array)/nb_random
380 stdev = sqrt(sum((array - mean)**2)/nb_random)
384 IF (i_method == 2)
THEN
385 max_distrib = one /(stdev*sqrt(two * pi))
386 ELSEIF(i_method == 1)
THEN
387 max_distrib = one /(max_value-min_value)
390 WRITE (iout,5000)
'C3',fail_id
395 IF (minval /= -ep30 .AND. maxval /= ep30)
THEN
399 CALL plot_distrib( array,nb_random, nb_interv,sizey,min_value,
400 . max_value,max_distrib,
'#')
402 IF (i_method == 2)
THEN
403 WRITE (iout,2000) mean,stdev
404 ELSEIF (i_method == 1)
THEN
405 WRITE (iout,2050) mean
408 IF (seed_random == 1)
WRITE (iout,2100) seed
411 IF (
ALLOCATEDDEALLOCATE(array)
420 4000
FORMAT(/
' PERTURBATION ID'
421 .
' ---------------'/
422 .
' TYPE . . . . . . . . . . . . . . .',a/
423 .
' INPUT MEAN VALUE . . . . . . . . .',1pg20.13/
424 .
' INPUT STANDARD DEVIATION . . . . .',1pg20.13/
425 .
' INPUT SEED VALUE . . . . . . . . .',i10/
426 .
' FAILURE CRITERIA . . . . . . . . .',a/
427 .
' FAILURE CRITERIA ID. . . . . . . .',i10/
428 .
' APPLIED ON PARAMETER . . . . . . .',a/
430 4100
FORMAT(/
' PERTURBATION ID',i10/
431 .
' ---------------'/
432 .
' TYPE . . . . . . . . . . . . . . .',a/
433 . ' input seed
VALUE . . . . . . . . .
',I10/
434 . ' failure criteria . . . . . . . . .
',A/
435 . ' failure criteria
id. . . . . . . .
',I10/
436 . ' applied on
PARAMETER . . . . . . .
',A/
440 . ' generated mean
VALUE . . . . . . .
',1PG20.13/
441 . ' generated standard deviation . . .
',1PG20.13)
443 . ' generated mean
VALUE . . . . . . .
',1PG20.13)
445 . ' generated seed
VALUE . . . . . . .
',I10/)
448 . ' distribution of scale factors applied to
',A,' VALUE'/
449 . ' of failure criteria
id= . . . . . .
',I10)
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)