41 1 IPART ,RNOISE ,IGRPART ,IPM ,IPARTS ,
42 2 PERTURB ,LSUBMODEL,UNITAB ,IDPERTURB,INDEX ,
43 3 INDEX_ITYP,NPART_SOLID ,OFFS ,QP_IPERTURB,
57#include "implicit_f.inc"
69 TYPE (UNIT_TYPE_),
INTENT(IN) ::UNITAB
71 . RNOISE(NPERTURB,NUMELC+NUMELTG+NUMELS+NUMSPH),
72 . QP_RPERTURB(NPERTURB,4)
73 INTEGER IPART(LIPART1,*),
74 . ipm(npropmi,*),offs,
75 . iparts(*),perturb(nperturb),
76 . idperturb(nperturb),index(numelc+numeltg+numels+numsph),
77 . index_ityp(numelc+numeltg+numels+numsph),npart_solid,
78 . qp_iperturb(nperturb,6)
81 TYPE (GROUP_) ,
DIMENSION(NGRPART) :: IGRPART
85 INTEGER I,J,K,NUMA,I_METHOD,MAX_PART,
86 . CPT_PART,NB_RANDOM,I_SEED,DISTRIB(50),
87 . II,NB_INTERV,N,IOK,SEED,SEED_RANDOM,
88 . ITYP,I_PERTURB_VAR,IGRPRTS,SIZEY
89 CHARACTER(LEN=NCHARTITLE) :: TITR
90 INTEGER,
DIMENSION(:,:),
ALLOCATABLE :: TAB_PART
91 INTEGER,
DIMENSION(:),
ALLOCATABLE :: A_SEED
92 INTEGER,
DIMENSION(1:8) :: DT_SEED
94 . mean,sd,mean_input,sd_input,max_distrib,temp,min_value,
95 . max_value,minval,maxval,bid
96 my_real,
DIMENSION(:),
ALLOCATABLE :: array
97 CHARACTER*100 CHAR(100)
98 CHARACTER*100 CHAR1(100)
101 CHARACTER(LEN=NCHARFIELD)::CHVAR
106 DATA mess/
'PERTURBATION DEFINITION '
115 is_available = .false.
120 DO i=1+offs,npart_solid+offs
125 . option_id = idperturb(i),
126 . option_titr = titr)
137 CALL hm_get_intv(
'grpart_ID',igrprts,is_available,lsubmodel)
139 IF (chvar(1:4) ==
'dens' .OR. chvar(1:4) ==
'DENS') i_perturb_var = 1
142 IF (i_perturb_var /= 1)
CALL ancmsg(msgid=1194,
150 IF (igrprts /= 0)
THEN
152 IF (igrpart(n)%ID == igrprts)
THEN
172 . c2=
'GROUP OF PART')
173 ELSEIF (iok == 1)
THEN
174 cpt_part = igrpart(igrprts)%NENTITY
176 max_part =
max(max_part,cpt_part)
179 ALLOCATE(tab_part(nperturb,max_part))
185 DO i=1+offs,npart_solid+offs
188 index(1:(numelc+numeltg+numels+numsph)) = 0
189 index_ityp(1:numelc+numeltg+numels+numsph) = 0
194 . option_id = idperturb(i),
195 . option_titr = titr)
202 CALL hm_get_floatv(
'Deviation' ,sd ,is_available, lsubmodel, unitab)
203 CALL hm_get_floatv(
'Min_cut' ,minval ,is_available, lsubmodel, unitab)
204 CALL hm_get_floatv(
'Max_cut' ,maxval ,is_available, lsubmodel, unitab)
205 CALL hm_get_intv(
'Seed' ,seed ,is_available, lsubmodel)
206 CALL hm_get_intv(
'Idistri' ,i_method,is_available, lsubmodel)
209 IF(i_method == 0) i_method = 2
210 IF(minval == zero .AND. maxval == zero)
THEN
211 IF(i_method == 1)
THEN
212 ELSEIF(i_method == 2)
THEN
221 qp_iperturb(i,1) = idperturb(i)
222 qp_iperturb(i,2) = ityp
223 qp_iperturb(i,3) = seed
224 qp_iperturb(i,4) = i_method
225 qp_rperturb(i,1) = mean
226 qp_rperturb(i,2) = sd
227 qp_rperturb(i,3) = minval
228 qp_rperturb(i,4) = maxval
236 CALL hm_get_intv(
'grpart_ID' ,igrprts ,is_available,lsubmodel)
237 qp_iperturb(i,5) = igrprts
239 IF (chvar(1:4) ==
'dens' .OR. chvar(1:4) ==
'DENS') qp_iperturb(i,6) = 1
242 IF (igrprts /= 0)
THEN
244 IF (igrpart(n)%ID == igrprts)
THEN
256 DO j=1,igrpart(igrprts)%NENTITY
257 cpt_part = cpt_part + 1
258 numa = igrpart(igrprts)%ENTITY(j)
259 tab_part(i,cpt_part) = numa
264 IF(i_method == 2)
THEN
266 . idperturb(i),
'GAUSSIAN',mean_input,sd_input,seed
267 WRITE (iout,
'(10I10)') ipart(4,tab_part(i,1:cpt_part))
270 ELSEIF(i_method == 1)
THEN
272 . idperturb(i),
'RANDOM',seed
273 WRITE (iout,
'(10I10)') ipart(4,tab_part(i,1:cpt_part))
282 IF(iparts(ii) == tab_part(i,k))
THEN
283 nb_random = nb_random + 1
284 index(nb_random) = ii
285 index_ityp(nb_random) = 1
292 CALL random_seed(size=i_seed)
293 ALLOCATE(a_seed(1:i_seed))
294 CALL random_seed(get=a_seed)
295 CALL date_and_time(values=dt_seed)
296 a_seed=dt_seed(8)*dt_seed(7)*dt_seed(6)
297 seed=dt_seed(8)*dt_seed(7)*dt_seed(6)
298 CALL random_seed(put=a_seed)
302 CALL random_seed(size=i_seed)
303 ALLOCATE(a_seed(1:i_seed))
305 CALL random_seed(put=a_seed)
315 ALLOCATE(array(nb_random+2))
316 CALL random_number(array)
321 IF ( i_method == 2)
THEN
322 DO ii = 1, nb_random+1, 2
323 temp = sd * sqrt(-2.0*log(array(ii))) * cos(2*pi*array(ii+1)) + mean
324 array(ii+1) = sd * sqrt(-2.0*log(array(ii))) * sin(2*pi*array(ii+1)) + mean
328 array(ii) =
max(
min(maxval,array(ii)),minval)
329 max_value =
max(array(ii),max_value)
330 min_value =
min(array(ii),min_value)
332 ELSEIF(i_method == 1)
THEN
334 array(ii) = array(ii)*(maxval-minval)+minval
335 max_value =
max(array(ii),max_value)
336 min_value =
min(array(ii),min_value)
342 IF (index_ityp(ii) == 1)
THEN
343 rnoise(i,index(ii)+numelc+numeltg) = array(ii)
348 mean = sum(array)/nb_random
349 sd = sqrt(sum((array - mean)**2)/nb_random)
352 IF(i_method == 2)
THEN
353 max_distrib = one /(sd*sqrt(two * pi))
354 ELSEIF(i_method == 1)
THEN
355 max_distrib = one /(max_value-min_value)
361 IF (minval /= -ep30 .AND. maxval /= ep30)
THEN
365 CALL plot_distrib( array,nb_random, nb_interv,sizey,min_value,
366 . max_value,max_distrib,
'#')
367 IF(i_method == 2)
THEN
368 WRITE (iout,2000) mean,sd
369 ELSEIF(i_method == 1)
THEN
370 WRITE (iout,2050) mean
372 IF(seed_random == 1)
WRITE (iout,2100) seed
375 IF (
ALLOCATED(array))
DEALLOCATE(array)
379 6000
FORMAT(/
' PERTURBATION ID',i10/
380 +
' ---------------'/
381 +
' TYPE . . . . . . . . . . . . . . .',a/
382 +
' INPUT MEAN VALUE . . . . . . . . .',1pg20.13/
383 +
' INPUT STANDARD DEVIATION . . . . .',1pg20.13/
384 +
' INPUT SEED VALUE . . . . . . . . .',i10/
385 +
' SOLID DENSITIES, PARTS:')
386 6100
FORMAT(/
' PERTURBATION ID',i10/
387 +
' ---------------'/
388 +
' TYPE . . . . . . . . . . . . . . .',a/
389 +
' INPUT SEED VALUE . . . . . . . . .',i10/
390 +
' SOLID DENSITIES, PARTS:')
393 +
' GENERATED MEAN VALUE . . . . . . .',1pg20.13/
394 +
' GENERATED STANDARD DEVIATION . . .',1pg20.13)
396 +
' GENERATED MEAN VALUE . . . . . . .',1pg20.13)
398 +
' GENERATED SEED VALUE . . . . . . .',i10/)
401 +
' DISTRIBUTION OF SCALE FACTORS APPLIED TO DENSITIES OF SOLIDS')
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)