background image
Code_Aster
®
Version
8.2
Titrate:
Procedure
TEST_FONCTION
Date:
22/02/06
Author (S):
COURTEOUS Mr., L. VIVAN
Key
:
U4.92.02-H1
Page:
1/8
Instruction manual
U4.9- booklet: Impression/Test HT-62/06/004/A
Organization (S):
EDF-R & D/AMA, CS IF















Instruction manual
U4.9- booklet: Impression/Test
Document: U4.92.02



Procedure
TEST_FONCTION








1 Goal
To extract a numerical value or an attribute from a function for comparison with a value from
reference. The function is is a structure of data of the type
function
,
tablecloth
, is contained
in a structure of data of the type
tabl_intsp
.
This procedure writes a conventional message then
“OK”
(if it is good) or
“NOOK”
(if not).
It does not stop the execution if the test is not checked; this makes it possible to use it is systematically
for the tests of validation, that is to say to extract and print a value of a function or a tablecloth
for a particular value of a parameter.
This control is used primarily by the cases tests to validate the not-regression of
results.
background image
Code_Aster
®
Version
8.2
Titrate:
Procedure
TEST_FONCTION
Date:
22/02/06
Author (S):
COURTEOUS Mr., L. VIVAN
Key
:
U4.92.02-H1
Page:
2/8
Instruction manual
U4.9- booklet: Impression/Test HT-62/06/004/A
2 Syntax
TEST_FONCTION
(
UNIT
=
/links,
[I]
/
8,
[DEFECT]
/VALUE = _F (
FUNCTION
= F,
/
[function]
/
[fonction_C]
NOM_PARA
= lnom,
[l_Kn]
I
PRECISION
=
/
prec,
[R]
/
1.0D-3, [DEFECT]
I
CRITERION =
/“RELATIVE”,
[DEFECT]
/
“ABSOLUTE”,
VALE_PARA =
will lpara,
[l_R]
/
VALE_REFE =
refe,
[R]
/
VALE_REFE_C =
compl,
[C]
VALE_ABS =/“YES”,
/
“NOT”,
[DEFECT]
REFERENCE =
/“ANALYTICAL”,
/
“SOURCE_EXTERNE”,
/
“NON_REGRESSION”,
/
“AUTRE_ASTER”,
VERSION =…,
[TXM]
),
/
ATTRIBUTE
=_F (
FUNCTION
= F,
/
[function]
/
[fonction_C]
PARA
=
reality,
[R]
I
PREC_PARA
=
/
prec,
[R]
/
1.0D-3, [DEFECT]
I
CRIT_PARA
=/“RELATIVE”, [DEFECT]
/
“ABSOLUTE”,
ATTR =
/“NOM_PARA”,
/
“NOM_RESU”,
/
“PROL_DROITE”,
/
“PROL_GAUCHE”,
/
“Interpol”,
/
“PROL_GAUCHE_FONC”,
/
“PROL_DROITE_FONC”,
/
“INTERPOL_FONC”,
/
“NOM_PARA_FONC”,
ATTR_REFE
= attr,
[KN]
REFERENCE =
/“ANALYTICAL”,
/
“SOURCE_EXTERNE”,
/
“NON_REGRESSION”,
VERSION
=
towards,
[KN]
/
“AUTRE_ASTER”,
),
background image
Code_Aster
®
Version
8.2
Titrate:
Procedure
TEST_FONCTION
Date:
22/02/06
Author (S):
COURTEOUS Mr., L. VIVAN
Key
:
U4.92.02-H1
Page:
3/8
Instruction manual
U4.9- booklet: Impression/Test HT-62/06/004/A
/
TABL_INTSP=_F (
INTE_SPEC
=
F,
[tabl_intsp]
/
NUME_ORDRE_I
=
I,
[I]
NUME_ORDRE_J
=
J,
[I]
/NOEUD_I =
nd_i,
[node]
NOEUD_J =
nd_j,
[node]
NOM_CMP_I =
ncmp_i,
[KN]
NOM_CMP_J =
ncmp_j,
[KN]
NUME_VITE_FLUI = n_vit,
[I]
VALE_PARA = real,
[R]
VALE_REFE_C = compl,
[C]
I
PRECISION
=
/
prec,
[R]
/
1.0D-3, [DEFECT]
I
CRITERION =/“RELATIVE”,
[DEFECT]
/
“ABSOLUTE”,
REFERENCE =
/“ANALYTICAL”,
/
“SOURCE_EXTERNE”,
/
“NON_REGRESSION”,
VERSION
=
towards,
[KN]
/
“AUTRE_ASTER”,
),
TEST_NOOK =/
“NOT”,
[DEFECT]
/“YES”,
)

The functions are is with actual values [
function
], that is to say with complex values [
fonction_C
].
background image
Code_Aster
®
Version
8.2
Titrate:
Procedure
TEST_FONCTION
Date:
22/02/06
Author (S):
COURTEOUS Mr., L. VIVAN
Key
:
U4.92.02-H1
Page:
4/8
Instruction manual
U4.9- booklet: Impression/Test HT-62/06/004/A
3 Operands
3.1 Operand
UNIT
UNIT = links
Number of the logical unit on which one writes the result of test (OK or NOOK), except case
private individuals links = 8.
3.2 Word
key
VALUE
VALUE
=
Key word factor to test a value of a function or a tablecloth.
3.2.1 Operand
FUNCTION
FUNCTION = F
Name of the function (with a parameter) or tablecloth (with two parameters) on which is carried out
the operation.
NB: One cannot test functions of more than two parameters.
3.2.2 Operand
NOM_PARA
NOM_PARA = lnom
In the case of a function, this word key is not treated.
In the case of a tablecloth, the user will give 2 names of parameter: the first defining it
parameter of the tablecloth, the second defining the parameter of the function which one wants to test
(see the control
DEFI_NAPPE
[U4.31.03]).
3.2.3 Operands
PRECISION/CRITERION
PRECISION = prec
In the case of a tablecloth, one seeks the function defined by the value of the parameter in one
interval defined by the absolute or relative position:
“inst ± prec”
(cf.
CRITERION
).
By defect
prec = 1.0D-3
CRITERION =
·
“RELATIVE”
: the interval of search is:
[inst (1-prec), inst (1+prec)]
·
“ABSOLUTE”
: the interval of search is:
[inst-prec, inst+prec]
3.2.4 Operand
VALE_PARA
VALE_PARA = will lpara
In the case of a function, the user gives the value of the parameter for which the value of
function is tested.
In the case of a tablecloth, the user gives the 2 values corresponding to the names of both
parameters (that of the tablecloth and that of the function).
background image
Code_Aster
®
Version
8.2
Titrate:
Procedure
TEST_FONCTION
Date:
22/02/06
Author (S):
COURTEOUS Mr., L. VIVAN
Key
:
U4.92.02-H1
Page:
5/8
Instruction manual
U4.9- booklet: Impression/Test HT-62/06/004/A
3.2.5 Operand
VALE_REFE
/
VALE_REFE_C/VALE_ABS
/VALE_REFE = refe
Value of reference for the functions or the tablecloths to actual values.
/
VALE_REFE_C = compl
Value of reference for the functions or the tablecloths to complex values.
If VALE_ABS=' OUI', one tests the absolute value of the function.
3.2.6 Operands
REFERENCE
/
VERSION
REFERENCE =
Key word defining the nature of the reference solution.
“ANALYTICAL”
: the reference solution results from an analytical calculation
“SOURCE_EXTERNE”
: the reference solution results either from experimental results, or
of an average of the results obtained by other computer codes.
“NON_REGRESSION”
: the reference solution is that obtained with a version of Code_Aster
and the same modeling of the test.
“AUTRE_ASTER”
: the reference solution is that obtained with a version of Code_Aster
but on another modeling of the test.
If
REFERENCE
solution is
“NON_REGRESSION”
, it is then necessary to indicate
VERSION
Code_Aster which made it possible to obtain this solution.
3.3 Word
key
ATTRIBUTE
/ATTRIBUTE
=
Key word factor to test an attribute of a function or a tablecloth.
3.3.1 Operand
FUNCTION
FUNCTION = F
Name of the function or the tablecloth on which the operation is carried out.
3.3.2 Operand
PARA
PARA = real
In the case of a function, this word key is not necessary.
In the case of a tablecloth, the user gives the value of the parameter to recover the function so
to test the attribute.
3.3.3 Operands
PREC_PARA
/
CRIT_PARA
PREC_PARA = prec
One seeks the function defined by the value of the parameter in an interval defined by the position
absolute or relative:
“inst ± prec”
(cf.
CRITERION
[§3.2.3]).
By defect
prec = 1.0D-3.
CRIT_PARA =
“RELATIVE”: the interval of search is: [inst (1-prec), inst (1+prec)]
“ABSOLUTE”: the interval of search is: [inst-prec, inst+prec]
background image
Code_Aster
®
Version
8.2
Titrate:
Procedure
TEST_FONCTION
Date:
22/02/06
Author (S):
COURTEOUS Mr., L. VIVAN
Key
:
U4.92.02-H1
Page:
6/8
Instruction manual
U4.9- booklet: Impression/Test HT-62/06/004/A
3.3.4 Operand
ATTR
ATTR =
Name of the attribute to be tested. For the significance of the attributes to refer to
DEFI_FONCTION
[U4.31.02] or with
DEFI_NAPPE
[U4.31.03].
3.3.5 Operand
ATTR_REFE
ATTR_REFE = attr
Attribute of reference. For the significance of the attributes to refer to
DEFI_FONCTION
[U4.31.02]
or with
DEFI_NAPPE
[U4.31.03].
3.3.6 Operands
REFERENCE/VERSION
cf [§3.2.6].
3.4 Word
key
TABL_INTSP
/TABL_INTSP
=
Key word factor to test a value of a concept counts of type
tabl_intsp
product by
example by
LIRE_INTE_SPEC
[U4.36.01],
DEFI_INTE_SPEC
[U4.36.02],
CALC_INTE_SPEC
[U4.36.03],
PROJ_SPEC_BASE
[U4.63.14],
DYNA_SPEC_MODAL
[U4.53.23],
REST_SPEC_PHYS
[U4.63.22],
DYNA_ALEA_MODAL
[U4.52.22].
3.4.1 Operand
INTE_SPEC
INTE_SPEC = F
Name of the table of interspectres which contains at least a matrix interspectrale. If
table contains several matrices interspectrales (cf [§3.4.2]), the key word
NUME_VITE_FLUI
allows to select one of these matrices.
3.4.2 Operand
NUME_VITE_FLUI
NUME_VITE_FLUI = nvite
For the matrices interspectrales coming from a calculation where the control
CALC_FLUI_STRU
[U4.66.02] is used, it is necessary to indicate the number corresponding at the speed of the fluid which allowed
to define the matrix interspectrale which one wants to test.
3.4.3 Operands
NUME_ORDRE_I
/
NUME_ORDRE_J
NUME_ORDRE_I = I,
NUME_ORDRE_J = J,
Indices of the sequence numbers
I
and
J
allowing to define a term of the matrix interspectrale
when the lines and columns of this matrix are not named.
These matrices result from the operators
PROJ_SPEC_BASE
[U4.63.14],
DYNA_SPEC_MODAL
[U4.53.24],
LIRE_INTE_SPEC
[U4.36.01],
DEFI_INTE_SPEC
[U4.36.02],
CALC_INTE_SPEC
[U4.36.03],
DYNA_ALEA_MODAL
[U4.52.22].
background image
Code_Aster
®
Version
8.2
Titrate:
Procedure
TEST_FONCTION
Date:
22/02/06
Author (S):
COURTEOUS Mr., L. VIVAN
Key
:
U4.92.02-H1
Page:
7/8
Instruction manual
U4.9- booklet: Impression/Test HT-62/06/004/A
3.4.4 Operands
NOEUD_I/NOEUD_J/NOM_CMP_I/NOM_CMP_J
NOEUD_I = nd_i,
NOEUD_J = nd_j,
NOM_CMP_I = ncmp_i,
NOM_CMP_J = ncmp_j,
When the lines and columns of the matrix interspectrale are named, these operands
correspond then to the names of the nodes and associated components allowing to define one
term of this matrix.
These matrices result from the operator
REST_SPEC_PHYS
[U4.63.22].
These operands are excluded with the definite preceding operands in the paragraph [§3.4.3].
3.4.5 Operand
VALE_PARA
VALE_PARA = real
Value of the parameter for which the value of the function contained in the table is tested.
3.4.6 Operand
VALE_REFE_C
VALE_REFE_C = compl
Value of reference (complex number: real part, imaginary part or module, phase).
3.4.7 Operands
PRECISION/CRITERION
PRECISION = prec
Definition of the interval of search: absolute or relative position:
“inst ± prec”
(cf.
CRITERION
).
By defect
prec = 1.0D-3.
CRITERION =
“RELATIVE”: the interval of search is: [inst (1-prec), inst (1+prec)]
“ABSOLUTE”: the interval of search is: [inst-prec, inst+prec]
3.4.8 Operands
REFERENCE/VERSION
cf [§3.2.6].
3.5 Operand
TEST_NOOK
TEST_NOOK =
This option, to use with precaution, makes it possible to simulate that the attributes of a function
(in particular to limit its field of definition) will be well interpreted.
Example:
On a function with
PROL_GAUCHE = “EXCLUDED”
, if one tests the function with a value of
parameter lower than the value of the lower limit of the interval of definition of the function, one
should obtain an error.
With
TEST_NOOK = “YES”
,
TEST_FONCTION
return the result
“OK”
.
background image
Code_Aster
®
Version
8.2
Titrate:
Procedure
TEST_FONCTION
Date:
22/02/06
Author (S):
COURTEOUS Mr., L. VIVAN
Key
:
U4.92.02-H1
Page:
8/8
Instruction manual
U4.9- booklet: Impression/Test HT-62/06/004/A
4 Examples
4.1
Checking of a tablecloth
df1
= DEFI_FONCTION
(NOM_PARA = “INST”, NOM_RESU = “DEPL”,
VALE
=
(0., 0., 1., 1., 2., 2., 3., 3., 4., 4.
))
df2
= DEFI_FONCTION
(NOM_PARA = “INST”, NOM_RESU = “DEPL”,
VALE = (3., 3., 4., 4., 5., 5. )
)
dn1
= DEFI_NAPPE
(NOM_PARA = “AMOR”, NOM_RESU = “DEPL”,
VALE
=
(0.01,
0.02),
FUNCTION
=
(
df1,
df2
))
TEST_FONCTION
(
# one checks attribute “NOM_PARA” of the function df1 in the tablecloth dn1
ATTRIBUTE = (_F (FUNCTION =
dn1, PARA = 0.01, # 0.01 reached df1
ATTR
=
“NOM_PARA_FONC”,
ATTR_REFE
=
“INST”
),
# one checks attribute “NOM_PARA” of the tablecloth dn1
_F (FUNCTION =
DN1, ATTR = “NOM_PARA”,
ATTR_REFE
=
“AMOR”
)),
# one checks a value of the tablecloth dn1 (in practice on the function df1)
VALUE =
_F (FUNCTION =
dn1,
NOM_PARA = (“AMOR”, “INST”
),
VALE_PARA
=
(
0.01,
1.
),
VALE_REFE
=
1.
)
)
4.2
Checking of a function
li1=DEFI_LIST_REEL (DEBUT=0.,
INTERVALLE=_F (JUSQU_A=2 * pi,
PAS=2 * pi/20),
)

f1=FORMULE (NOM_PARA=' INST',
VALE=' sin (INST)
+
cos (INST) ',
)

fonc=CALC_FONC_INTERP (FONCTION=f1,
LIST_PARA=li1,
NOM_RESU=' DEPL',
INTERPOL=' LIN',
)

TEST_FONCTION (
# one tests an attribute of the function
ATTRIBUT=_F (
FONCTION=fonc,
ATTR=' INTERPOL',
ATTR_REFE=' FLAX
LIN',),
# one tests a value of the function
VALEUR=_F
(
FONCTION=fonc,
VALE_PARA=pi,
VALE_REFE=sin (pi) +cos (pi),
),)