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
Instruction manual
U4.3- booklet: Function
HT-66/05/004/A
Organization (S):
EDF-R & D/AMA, EDF-GDF/DIT-BEX, EDF-Pole Industry/CNPE of Tricastin
Instruction manual
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
count
.
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
Instruction manual
U4.3- booklet: Function
HT-66/05/004/A
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
[DEFECT]
INIT_ALEA
=
nor
[I]
INFORMATION =
/
1
[DEFECT]
/2
TITRATE
=
titrate
[l_Kn]
)
;
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
Instruction manual
U4.3- booklet: Function
HT-66/05/004/A
3 Operands
3.1 Operand
INTE_SPEC
INTE_SPEC = intf [tabl_intsp]
Name of the matrix interspectrale of the type
tabl_intsp
towards which the matrix interspectrale of
generated signal must tend.
The matrix interspectrale is a complex matrix, whose each term is written
()
[
]
+
-
-
-
=
D
T
Y
T
X
F
S
F
I
XY
2
E
)
(
)
(
E
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 mesh).
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 modelize, via
operators
CALC_FLUI_STRU
and
DEFI_SPEC_TURB
, a turbulent excitation induced by one
fluid flow.
3.3 Operand
Interpol
Interpol =
/
“YES”
[DEFECT]
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
).
/“NOT”
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 pitch 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.
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
Instruction manual
U4.3- booklet: Function
HT-66/05/004/A
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 the key word
DUREE_TIRAGE
is not present, the duration of the signal to be generated is calculated by
F
duration
=1
where
F
is the pitch in frequency of the interspectre (not minimum of origin of
the interspectre, or not calculated starting from the 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
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
who is retained.
If the key word
NB_POIN
is not present, the number of points is calculated so that the theorem of
Shannon is respected, i.e. that
max
2
1
F
T
>
, where
T
is the pitch in time of the signal with
to generate (which depends on
NB_POIN
and of
DUREE_TIRAGE)
and where
max
F
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 pitch 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
DUREE_TIRAGE
and
NB_POIN
are present then one a:
.
_
2
poin
Nb
duration
T
×
=
In this case, if
nb_poin
is too small by report/ratio
duration
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 pitch 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.
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
Instruction manual
U4.3- booklet: Function
HT-66/05/004/A
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
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] “Examples”.
Caution:
If the 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 duration
durée_tirage
put end to end. 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 with sound
nor
ième term of the continuation of pseudo-random numbers employed
for the generation of the signals.
If the 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 the 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 the key word
INIT_ALEA
with 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 the key word should be used
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].
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
Instruction manual
U4.3- booklet: Function
HT-66/05/004/A
3.9 Operand
INFORMATION
INFORMATION
=
/1
:
no impression.
/2
:
impression of the pitch 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
the number of points constituting the generated signals (it makes it possible to know 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
3.10 Operand
TITRATE
TITRATE = title
titrate
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 the key word
NB_POIN
is present, then one checks 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'
, it is checked that the various terms of the matrix interspectrale have the same one
discretization with a constant pitch in frequency.
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
Instruction manual
U4.3- booklet: Function
HT-66/05/004/A
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,
FUNCTION
=
sp11),
_F (
NUME_ORDRE_I = 1,
NUME_ORDRE_J
=
2,
FUNCTION
=
sp12),
_F (
NUME_ORDRE_I = 2,
NUME_ORDRE_J
=
2,
FUNCTION
=
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',)
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
Instruction manual
U4.3- booklet: Function
HT-66/05/004/A
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.