Code_Aster ®
Version
7.4
Titrate:
Operator GENE_FONC_ALEA
Date:
08/02/05
Author (S):
S. CAMBIER, A. DUMOND, G. JACQUART Key
:
U4.36.05-G Page
: 1/8
Organization (S): EDF-R & D/AMA, EDF-GDF/DIT-BEX, EDF-Pôle Industrie/CNPE of Tricastin
Handbook of Utilization
U4.3- booklet: Function
Document: U4.36.05
Operator GENE_FONC_ALEA
1 Goal
To generate a trajectory of a monodimensional multivariate stochastic process (i.e with several
components and indexed on only one variable) stationary of null average starting from its density
spectral of power. The first use of this operator is the generation of temporal functions
known by their matrix interspectrale with an aim of carrying out a transitory dynamic calculation then.
The trajectories obtained have a matrix interspectrale which converges on average towards the matrix
interspectrale target and is the achievements of a process asymptotically Gaussian (i.e when it
a many hard copies tend towards the infinite one). The algorithm used is an algorithm of simulation per series
trigonometrical with random and transformed phase of opposite fast Fourier.
Product a concept of the type counts.
Handbook of Utilization
U4.3- booklet: Function
HT-66/05/004/A
Code_Aster ®
Version
7.4
Titrate:
Operator GENE_FONC_ALEA
Date:
08/02/05
Author (S):
S. CAMBIER, A. DUMOND, G. JACQUART Key
:
U4.36.05-G Page
: 2/8
2 Syntax
vf [table] = GENE_FONC_ALEA
(
INTE_SPEC
=
intf [tabl_intsp]
NUME_VITE_FLUI = nk
[I]
#
Case
with
interpolation
authorized
:
/INTERPOL = “YES”, [DEFECT]
DUREE_TIRAGE
=
duration
[R]
FREQ_INIT
=
fi
[R]
FREQ_FIN
=
FF
[R]
#
Case
with
interpolation
not
authorized
:
/INTERPOL = “NOT”,
NB_POIN = nb_poin [I]
NB_TIRAGE
=
/
NT
[I]
/
1
[DEFAUT]
INIT_ALEA
=
nor
[I]
INFORMATION =/1 [DEFECT]
/2
TITER
=
titrate
[l_Kn]
)
;
Handbook of Utilization
U4.3- booklet: Function
HT-66/05/004/A
Code_Aster ®
Version
7.4
Titrate:
Operator GENE_FONC_ALEA
Date:
08/02/05
Author (S):
S. CAMBIER, A. DUMOND, G. JACQUART Key
:
U4.36.05-G Page
: 3/8
3 Operands
3.1 Operand
INTE_SPEC
INTE_SPEC = intf [tabl_intsp]
Name of the matrix interspectrale of the tabl_intsp type towards which the matrix interspectrale of
generated signal must tend.
The matrix interspectrale is a complex matrix, whose each term is written
+
S
2
XY (F) = [
E X T
(Y
) T
(-)] - I F
E
D where E [] is the expectation, and where X and Y are
-
two stationary random processes (for example two components of a loading in
two points distinct from a grid).
Note:
To be physical, the matrix interspectrale must be a definite square matrix
positive.
3.2 Operand
NUME_VITE_FLUI
NUME_VITE_FLUI
=
nk
[I]
Sequence number when the table of interspectres contains several tables.
This sequence number corresponds at a rate of flow if the interspectres model, via
operators CALC_FLUI_STRU and DEFI_SPEC_TURB, a turbulent excitation induced by one
fluid flow.
3.3 Operand
Interpol
Interpol =
/
“OUI”
[DEFAUT]
One authorizes to interpolate the functions in frequency constituting the terms of the matrix
interspectrale. In particular, the new discretization will depend on the duration of the signal to generate
(key word DUREE_TIRAGE) and of the number of point of the FFT (key word NB_POIN).
/“NON”
The values of the interspectre used are only the existing values (not interpolation
used).
Caution:
If INTERPOL=' NON', it is necessary that:
· the various terms of the matrix interspectrale have the same one exactly
discretization and with a constant step in frequency. If the number of points of
discretization of the interspectre is not a power of 2, and/or is not compatible
with the interspectre one or alarms are emitted and a power of 2 ad hoc is
chosen,
· the interspectres are sufficiently finely discretized to allow one
generation of temporal with sufficient moments.
Handbook of Utilization
U4.3- booklet: Function
HT-66/05/004/A
Code_Aster ®
Version
7.4
Titrate:
Operator GENE_FONC_ALEA
Date:
08/02/05
Author (S):
S. CAMBIER, A. DUMOND, G. JACQUART Key
:
U4.36.05-G Page
: 4/8
3.4 Operand
DUREE_TIRAGE
DUREE_TIRAGE
=
duration
[R]
Lasted of the signal to generate, for each hard copy (the total duration will be thus NT X duration).
If key word DUREE_TIRAGE is not present, the duration of the signal to be generated is calculated by
duration =1 F
where F
is the step in frequency of the interspectre (not minimum of origin of
the interspectre, or not calculated starting from key words FREQ_INIT, FREQ_FIN and NB_POIN).
Note:
The generated signals start at moment 0. with a zero value.
Note:
To obtain the desired duration, the algorithm of generation adjusts the number of points
used in the FFT (cf [§3.6] Opérande NB_POIN) and the interspectre prolongs if need be with
beyond frequencies min and max by zero values.
3.5 Operands
FREQ_INIT/FREQ_FIN
FREQ_INIT
=
fi
[R]
FREQ_FIN = FF
[R]
First and last values of frequency for which the interspectre will be taken into account.
The presence of these key words causes to truncate the interspectre. If the key words are not
present, in fact the values of minimal and maximum frequency of the interspectre are
used.
3.6 Operand
NB_POIN
NB_POIN
=
nb_poin [I]
A number of points of discretization of the interspectre to be used in the algorithm of generation.
This number must be a power of 2 bus it corresponds to the number of points of the transform
of fast Fourier reverses used by the algorithm of generation. If such is not the case, it is
power of 2 immediately above than nb_poin which is retained.
If key word NB_POIN is not present, the number of points is calculated so that the theorem of
Shannon is respected, i.e. that 1 T
> 2 fmax, where T
is the step in time of the signal with
to generate (which depends on NB_POIN and DUREE_TIRAGE) and where fmax is the maximum frequency
reserve of the interspectre.
Suggestion:
It is advised not to specify the number of points, the coded algorithm choosing in
this case automatically the optimal value. In particular, if key words DUREE_TIRAGE and
NB_POIN are not present, then one is assured that the generated signal is coherent with
time with the step of discretization of the interspectre and with the maximum frequency. However,
if the user wants to specify NB_POIN, the two remarks which follow must help there.
Note:
If key words
duration
DUREE_TIRAGE and NB_POIN are present then one a: T
=
.
2×nb_ poin
In this case, if nb_poin too small by report/ratio is lasted so that the theorem of
Shannon is respected; then an alarm is emitted and it is the minimum number of points
allowing the respect of the theorem of Shannon who is retained. The value specified by
NB_POIN is thus taken into account only when it is higher than the value minimum. In
imposing a number of points raised, one can force the signal to have a step of discretization
in time smaller than that by defect. It is necessary then to be conscious that the discretization of
temporal is finer than the maximum frequency of the interspectre allows it theoretically.
Handbook of Utilization
U4.3- booklet: Function
HT-66/05/004/A
Code_Aster ®
Version
7.4
Titrate:
Operator GENE_FONC_ALEA
Date:
08/02/05
Author (S):
S. CAMBIER, A. DUMOND, G. JACQUART Key
:
U4.36.05-G Page
: 5/8
Note:
If INTERPOL=' NON' and if nb_poin is not compatible with the interspectre, an alarm
is emitted and a power of 2 ad hoc is selected.
Note:
The number of points constituting the generated signals is equal to twice the number of
points of discretization of the interspectre, and thus with twice nb_poin when the key word is
informed. This number of points is useful to know for a posterior use in
CALC_INTE_SPEC [U4.36.03] (cf [§3.9] “Opérande INFO” and [§5] “Exemples”).
3.7 Operand
NB_TIRAGE
NB_TIRAGE
=
NT
[I]
A number of hard copies which must contain the generated temporal signals. The signals results
will contain NT end to end put statistically independent hard copies.
One can then post-treat the results obtained starting from these signals generated with the operator
CALC_INTE_SPEC [U4.36.03], cf [§5] “Exemples”.
Caution:
If key word DUREE_TIRAGE is present, the total duration of signal will be NT X duration.
However, it is not of course equivalent to generate 1 hard copy of duration
NT X durée_tirage and NT hard copies of end to end put durée_tirage duration. In particular,
in the second case, there is statistical independence between the various sections of duration D,
however not in the first case.
3.8 Operand
INIT_ALEA
INIT_ALEA
=
nor
[I]
Cause initialization in its nor-ième term of the continuation of pseudo-random numbers employed
for the generation of the signals.
If key word INIT_ALEA misses, the terms used of the continuation are those immediately
consecutive with those already used. If no term were still used, the continuation is initialized with sound
first term.
Suggestion:
With less than one particular use, it is advised not to inform key word INIT_ALEA
in the operators according to: GENE_FONC_ALEA, GENE_VARI_ALEA and GENE_MATR_ALEA.
In this case, with the first call to the one of these operators, the continuation of pseudo numbers
random is initialized in its first term. The omission of key word INIT_ALEA to each one
calls of these operators in the command file guarantees independence
statistics of the pseudo-random numbers used.
Note:
The germ of the continuation remains identical of one execution to the other of Code_Aster; results
thus remain rigorously identical (one can thus test nonthe regression of results
statistics not converged). If one wishes to generate results statistically
independent from one execution to another, then it is necessary to use key word INIT_ALEA with
values raising the number of terms used in the former executions.
Caution:
The generator of random variable used is that of the module “random” of Python. It
depends on the version of Python exploited by Code_Aster. Not converged results
statistically can thus vary from one version to another of Code_Aster or a punt
form with the other, if the version of Python is not the same one and that between the two versions it
modulate random evolved/moved (case between Python 2.1 and 2.3).
Note:
In version Python 2.3, the period of the generator is 2 ** 19937-1 [bib1].
Handbook of Utilization
U4.3- booklet: Function
HT-66/05/004/A
Code_Aster ®
Version
7.4
Titrate:
Operator GENE_FONC_ALEA
Date:
08/02/05
Author (S):
S. CAMBIER, A. DUMOND, G. JACQUART Key
:
U4.36.05-G Page
: 6/8
3.9 Operand
INFO
INFO
=
/1
:
no impression.
/2
:
impression of the step of time, initial time, the final time of the generated signals, and
number of points used in the transform of fast Fourier opposite.
Note:
INFO=2 makes it possible to know the number of points constituting the generated signals (it is
twice the number of points used in the fast transform of Fourier reverse.) It is worth
to better use this number of points then in operator CALC_INTE_SPEC key word
NB_POIN (cf [§5] “Exemples”).
3.10 Operand
TITER
TITER = title
title is the title of calculation to print at the head results [U4.03.01].
4
Phase of checking
Various checks are carried out in FORTRAN to ensure that the data are coherent
(nb_poin sufficiently large compared to the maximum frequency and the duration to be generated, lasted
sufficient large compared to the discretization interspectre, etc…). Alarms are emitted
if necessary.
If key word NB_POIN is present, then it is checked that the value given is a power of 2. In
the contrary case, an alarm is emitted and the value is modified.
If INTERPOL=' NON', one checks that the various terms of the matrix interspectrale have the same one
discretization with a constant step in frequency.
Handbook of Utilization
U4.3- booklet: Function
HT-66/05/004/A
Code_Aster ®
Version
7.4
Titrate:
Operator GENE_FONC_ALEA
Date:
08/02/05
Author (S):
S. CAMBIER, A. DUMOND, G. JACQUART Key
:
U4.36.05-G Page
: 7/8
5 Examples
The purpose of # This example is only to give an idea of syntax and
# of the operators associated useful (for recovery with the functions
# generated and their possible checking).
# The interspectre used does not have significance. There is not
# of use of the functions generated (with a dyna_tran_modal by
# example).
# The cases test zzzz180a and sdll107a provide more complete examples
# Definition of the interspectre
spect11 = DEFI_FONCTION (
NOM_PARA = “FREQ”,
VALE_C
=
(
0.
,
10.
, 0.,
50.0,
10.
, 0.,
150. ,
0.1
, 0.,
)
)
spect12 = DEFI_FONCTION (
NOM_PARA = “FREQ”,
VALE_C
=
(
0.
,
0.5
, 0.8,
150. ,
0.5
, 0.8,
)
)
spect22 = DEFI_FONCTION (
NOM_PARA = “FREQ”
VALE_C
=
(
0.
, 1. , 0.,
150. ,
1.
, 0.,
)
)
mat_int = DEFI_INTE_SPEC (
DIMENSION = 2,
PAR_FONCTION
=
(
_F (
NUME_ORDRE_I = 1,
NUME_ORDRE_J
=
1,
FONCTION
=
sp11),
_F (
NUME_ORDRE_I = 1,
NUME_ORDRE_J
=
2,
FONCTION
=
sp12),
_F (
NUME_ORDRE_I = 2,
NUME_ORDRE_J
=
2,
FONCTION
=
sp22)
)
)
# Generation of the two temporal functions
vect = GENE_FONC_ALEA (
INTE_SPEC = mat_int,
DUREE_TIRAGE = 5.,
NB_TIRAGE = 10,
)
# Recovery of the two functions for example for a IMPR_COURBE
FONC1 = RECU_FONCTION (TABLE=vect,
FILTRE=_F (NOM_PARA = “NUME_ORDRE”,
VALE_I = 1),
NOM_PARA_TABL=' FONCTION',)
Handbook of Utilization
U4.3- booklet: Function
HT-66/05/004/A
Code_Aster ®
Version
7.4
Titrate:
Operator GENE_FONC_ALEA
Date:
08/02/05
Author (S):
S. CAMBIER, A. DUMOND, G. JACQUART Key
:
U4.36.05-G Page
: 8/8
FONC2 = RECU_FONCTION (TABLE=VECT1,
FILTRE=_F (NOM_PARA = “NUME_ORDRE”,
VALE_I = 2),
NOM_PARA_TABL=' FONCTION',)
# Checking: Calculation of the interspectre of the generated functions
# Attention: the value given to NB_POIN is important. It is
# desirable to take it equalizes with the constituent number of points
# the functions (2 * nb_fft if coming from GENE_FONC_ALEA).
INTERS=CALC_INTE_SPEC (INST_INIT=0.,
INST_FIN=50.,
DUREE_ANALYZE=5.,
DUREE_DECALAGE=5.,
NB_POIN=2048,
FONCTION= (FONC1, FONC2,))
# Recovery of the car-spectrum of FONC1 for comparison with spetc11
F11 =RECU_FONCTION (TABLE=INTERS, TYPE_RESU=' FONCTION_C',
FILTRE= (
_F (NOM_PARA=' NUME_ORDRE_I', VALE_I=1),
_F (NOM_PARA=' NUME_ORDRE_J', VALE_I=1),),
NOM_PARA_TABL=' FONCTION',
)
6 Bibliography
[1]
Mr. Matsumoto and T. Nishimura, Mersenne Twister: With 623-dimensionally equidistributed
uniform pseudorandom number generator, ACM Transactions one Modeling and Computer
Simulation vol. 8, No 1, January pp.3-30 1998.
Handbook of Utilization
U4.3- booklet: Function
HT-66/05/004/A
Outline document