Salome HOME
Langage pour literalinclude
[modules/homard.git] / doc / en / gui_create_yacs.rst
1 .. _gui_create_yacs:
2
3 The schema YACS
4 ###############
5 .. index:: single: YACS
6 .. index:: single: case
7
8 The object YACS contains every definition that allows the creation of a schema. This schema will drive the alternation of the computation of a physical modelization over a mesh and the adaptation of the mesh for the computation. This alternation is driven by some criteria for the convergence.
9
10 .. note::
11   To read an exhaustive description of any part of the schema, see :doc:`yacs`
12
13 Procedure
14 *********
15 The automatic creation of the schema is going to be made in three phases.
16
17 - At first, it is necessary to have done a calculation on the very first mesh. This calculation will have produced the results in a MED file.
18 - Then, a case is created in the module HOMARD, as described in :doc:`gui_create_case`. In this case, we create the following iteration of the mesh by defining a hypothesis of adaptation ; see :doc:`gui_create_iteration`.
19 - Last, from this case, a schema will be created, based on the hypothesis for the adaptation.
20
21
22 .. image:: images/create_yacs_01.png
23    :align: center
24    :alt: yacs - creation
25    :width: 516
26    :height: 295
27
28 Name of the schema
29 ******************
30 A name of schema is automatically proposed: YACS_1, YACS_2, etc. This name can be modified. He must not have been already used for another schema.
31
32 The script
33 **********
34
35 The file containing the script which allows to launch the calculation connected to the physical modelling is supplied here. It is a script python who has to respect the following rules:
36
37 - the name of the class which manages the calculation is ``Script``
38 - to launch the calculation is made by the method``Compute()``
39 - the result of the calculation is under the shape of three variables: the code of error, a message, a dictionary python.
40
41 If they are necessary for the creation of the class, we can supply arguments under the shape:
42
43 - ``--rep_calc=rep_calc``, where ``rep_calc`` is the directory for the computation
44 - ``--num=num``, where ``num`` eis the number of calculation : 0 for the very first calculation, then 1, 2 etc.
45 - ``--mesh_file=meshfile``, where ``meshfile`` is the file that contains the mesh for the computation
46 - ``-v``, for the messages
47
48 In return:
49
50 - ``error`` : the error code, integer: 0 if it was correct, non 0 if not
51 - ``message`` : a possible message of information about the calculation
52 - ``dico_resu`` : a dictionary python that contains at less the two following keys: ``FileName`` is the key for the name of the MED file which contains the results of the calculation, ``V_TEST`` is the key for the real value to be tested.
53
54
55 Example for the script:
56 ::
57
58     argu = ["--rep_calc=" + rep_calc)]
59     argu.append("--num=%d" % numCalc)
60     argu.append("--mesh_file="  + MeshFile)
61     Script_A = Script(argu)
62     error, message, dico_resu = Script_A.compute ()
63
64 The directory
65 *************
66 The directory will countain all the files producted by the computations. By default, nothing is suggested. The choice is made either by giving a name into the text zone or by a selection through the search window.
67
68 The initial mesh
69 ****************
70 The initial mesh must be stored into a MED file. It is the very first mesh that is used to solve the physical problem. The name of the file is choosen either by giving a name into the text zone or by a selection through the search window.
71
72 The type of the schema
73 **********************
74 Two types of schemas are proposed: constant or variable.
75
76 The default choice, 'constant', alternate a computation that is always the same and a mesh adaptation: from a computation to another one, the only part that is changed is the mesh. All the rest is identical. For example, in case the calculation would model a transient phenomenon, it is always the completeness of the transient phenomenon that is taken into account.
77
78 The option 'variable' is inactive today.
79
80 Saving the schema
81 *****************
82 By default, the schema is saved into the file ``schema.xml`` in the directory of the case that is under the schema. If the file is deleted, it can be rewritten by the mouse option **Write**.
83
84 Object browser
85 **************
86 .. index:: single: object browser
87
88 The object browser contains the created schemas, identified by their names. They can be edited. Under every schema, there is a link to the case and the reference to the `xml` file that is written. This file can be read.
89
90 .. image:: images/create_yacs_1.png
91    :align: center
92
93 Corresponding python functions
94 ******************************
95 Look :doc:`tui_create_yacs`
96
97 How to use the schema
98 #####################
99
100 The schema that is produced by this procedure can be imported into the module YACS. It can be executed without any modification. It this case, the stop into the loop is done:
101
102 - either the maximal number of iterations for the loop (calcul,adaptation) is reached;
103 - or the test for the convergence over the variable ``V_TEST`` is satisfied.
104
105 By default, the maximal number of iterations is equal to 5 and the test for the convergence is satisfied if the variable varies less than one per a thousand in a relative value, between two successive iterations. These tests can be modified.
106
107 These tests ares done into the node "Analyse" of the schema, as described in :doc:`yacs`.
108
109 The maximal number of iterations is given by the variable `NbCalcMax`:
110
111 .. literalinclude:: ../files/yacs_01.fr.xml
112    :language: xml
113    :lines: 112-112
114
115 The value for the test is saved in a list all along the calculations:
116
117 .. literalinclude:: ../files/yacs_01.fr.xml
118    :language: xml
119    :lines: 137-141
120
121 and the test is calculated after the second iteration:
122
123 .. literalinclude:: ../files/yacs_01.fr.xml
124    :language: xml
125    :lines: 143-148
126
127 If this test is modified, it must be done here. But the instructions when it is converged must be kept to guarantee a good execution:
128
129 .. literalinclude:: ../files/yacs_01.fr.xml
130    :language: xml
131    :lines: 146-148
132
133 Examples
134 ########
135 .. index:: single: Code_Aster
136
137 A user's guide for schemas with *Code_Aster* is available here: :doc:`gui_create_yacs_aster`.
138
139
140
141