Salome HOME
fix warnings on tutorial build
[modules/hydro.git] / doc / salome / tutorial / english / english_interpolationZ.rst
1 ..
2    Copyright (C) 2015-2016 EDF
3
4    This file is part of SALOME HYDRO module.
5
6    SALOME HYDRO module is free software: you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation, either version 3 of the License, or
9    (at your option) any later version.
10
11    SALOME HYDRO module is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with SALOME HYDRO module.  If not, see <http://www.gnu.org/licenses/>.
18
19 #########################################
20 Z Interpolation
21 #########################################
22
23 .. |HYDROSolver| image:: ../_static/HYDROSolver.png
24    :align: middle
25    :width: 16pt
26    :height: 16pt
27
28 .. |genereInterpolz| image:: ../_static/genereInterpolz.png
29    :align: middle
30
31 .. |Bottom| image:: ../_static/Bottom.png
32    :align: middle
33
34 .. |Capture_meshZ| image:: ../_static/Capture_meshZ.png
35    :align: middle
36
37
38 .. |occ_view_scaling| image:: ../_static/occ_view_scaling.png
39    :align: middle
40    :width: 16pt
41    :height: 16pt
42
43 The mesh generated in the previous step does not contain any information on the altitude.
44 To supply the TELEMAC code with this data, a field containing the Z-coordinate of the nodes must be added to the mesh.
45
46 The method for calculating the Z coordinate was described zone by zone in the calculation case set-up section of the HYDRO module.
47
48 Calculation of the Z interpolation at the mesh nodes
49 ====================================================
50
51 The altitude field is constituted by means of the following Python script that must be generated and then run.
52
53 In the script, the regions of the HYDRO calculation case are associated to the corrresponding faces group of the mesh.
54 A specific command in HYDROSOLVER module helps to build this association.
55
56 The HYDROSOLVER module is activated with a selection in the module list (combo box) or its icon in the toolbar: |HYDROSolver|.
57 Activate the command *Generate interpolz.py* in the *Hydro* menu.
58
59 Select the calculation case in the study tree, under the folder *HYDRO / CALCULATION CASE*.
60 Its name appears in the first line of the dialog: *Calculation case*.
61
62 In the *Output path* field, give the full path of the Python script to create (script name must end with .py).
63
64 In the *MED file* field, select the mesh field produced at the previous step.
65
66 *Undefined Z* is used when he HYDRO module does not know how to calculate the altitude on a point.
67 This may be used to help in case of problems in the zones definition in the calculation case.
68
69 The interpolation of point clouds can be done in two ways, depending on whether the clouds are denser than the mesh, or vice versa.
70 For very dense point clouds, it suffices to take the altitude of the closest point in the cloud.
71 If the mesh is denser than the cloud, it is better to use linearised interpolation, obtained by previous triangulation of the point cloud.
72 This last method is more accurate but slightly more costly, computationally.
73
74 The region names must be selected in correspondance of their group of faces (representing the same geometric face),
75 and, for the other groups, the selection should be *None*.
76
77   |genereInterpolz|
78
79 The script produces several files, whose names are derived from the original file name of the mesh, with different suffixes,
80 which are stored in the original file's directory:
81
82  * garonne_1.med: original file (z coordinate = 0)
83  * garonne_1.xyz: xyz file (ASCII) of the altitudes at the nodes *(optional)*
84  * garonne_1F.med: calculated value of the Z coordinate and “BOTTOM” field with the Z-value at each node
85
86 **Remark** : The Z coordinate on mesh nodes is not used by TELEMAC, but is useful for visual control in SMESH.
87
88 To run the script, the HYDRO module for the study must be active. If resuming work on a study that was previously saved,
89 the HYDRO module must be activated before running the script
90 (simply select HYDRO at least once in order for the data stored in the study file to be read).
91
92 The script is executed manually with the File / Load Script... menu command.
93 The script blocks the graphic interface during execution.
94 It displays an execution trace in the Python console that is displayed by default in the GEOM and SMESH modules.
95
96 It is also possible to edit the following script:
97
98 The script needs to be copied and modified as needed for the region names used in the calculation case and for the named groups of mesh faces.
99
100 .. literalinclude:: ../interpolZ.py
101     :lines: 1-
102
103 Visualisation of the Z interpolation at the mesh nodes
104 ======================================================
105
106 Visualisation with the MED module
107 ---------------------------------
108
109 The MED module offers a simple field view of a MED mesh.
110 The MED module must first be activated, then use the *File/Add Data Source* menu or the equivalent icon and find the *garonne_1F.med* file.
111 Expanding the *garonne_1F.med* object in the study tree will reveal the *HYDRO_Garonne_1* mesh and the *BOTTOM* field.
112
113 Select the field and click on the *scalar map* icon.
114
115 The field is displayed in 3D view. The 3D-view context menu contains the *Representation / Surface with Edges* command
116
117   |Bottom|
118
119 Visualisation in the SMESH module
120 ---------------------------------
121
122 When the interpolation script finishes running, the *HYDRO_Garonne_1* mesh should appear a second time, with a different icon,
123 underneath the first instance in the study tree. If it is not visible, use the *Refresh* command in the study tree context menu
124 to update the file list.
125
126 The second mesh is displayed in the SMESH module using the *show* command. For a better relief view, the Z scale needs to be modified
127 with the 3D view icon |occ_view_scaling| . In this case, scaling the Z-axis by a factor of 3 is sufficient.
128
129 *Remember*: objects are manipulated in 3D view using the <CTRL> key and the mouse buttons or the mouse wheel for zooming.
130
131 The following is a group view corresponding to the study regions:
132
133   |Capture_meshZ|
134
135 .. only:: html
136
137    :ref:`ref_english_exempleInondation`