Commit f2b97b68 authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

Merge branch 'master' of gitlab-ssh.irstea.fr:theophile.terraz/pamhyr

Showing with 105 additions and 13 deletions
+105 -13
doc/users/Tuto1/BC_bug.png

22.9 KB

doc/users/Tuto1/bug_edit_time.png

5.29 KB

...@@ -65,7 +65,8 @@ ...@@ -65,7 +65,8 @@
31874.0000 14.5000 22.1900 31874.0000 14.5000 22.1900
31874.0000 17.6000 22.9900 31874.0000 17.6000 22.9900
999.9990 999.9990 999.9990 999.9990 999.9990 999.9990
7 0 0 7 31875.0000 PontRD101m 7 0 0 9 31875.0000 PontRD101m
31875.0000 0.5400 23.0000
31875.0000 0.5400 21.8900 31875.0000 0.5400 21.8900
31875.0000 2.5000 19.6900 rg 31875.0000 2.5000 19.6900 rg
31875.0000 2.5000 18.6900 31875.0000 2.5000 18.6900
...@@ -73,8 +74,10 @@ ...@@ -73,8 +74,10 @@
31875.0000 10.7000 18.9900 31875.0000 10.7000 18.9900
31875.0000 10.7000 19.9900 rd 31875.0000 10.7000 19.9900 rd
31875.0000 13.8900 21.8900 31875.0000 13.8900 21.8900
31875.0000 13.8900 23.0000
999.9990 999.9990 999.9990 999.9990 999.9990 999.9990
8 0 0 7 31885.0000 PontRD101v 8 0 0 9 31885.0000 PontRD101v
31885.0000 0.5400 23.0000
31885.0000 0.5400 21.8900 31885.0000 0.5400 21.8900
31885.0000 2.5000 19.6900 rg 31885.0000 2.5000 19.6900 rg
31885.0000 2.5000 18.6900 31885.0000 2.5000 18.6900
...@@ -82,6 +85,7 @@ ...@@ -82,6 +85,7 @@
31885.0000 10.7000 18.9900 31885.0000 10.7000 18.9900
31885.0000 10.7000 19.9900 rd 31885.0000 10.7000 19.9900 rd
31885.0000 13.8900 21.8900 31885.0000 13.8900 21.8900
31885.0000 13.8900 23.0000
999.9990 999.9990 999.9990 999.9990 999.9990 999.9990
9 0 0 9 31886.0000 9 0 0 9 31886.0000
31886.0000 0.0000 22.9900 31886.0000 0.0000 22.9900
...@@ -303,7 +307,8 @@ ...@@ -303,7 +307,8 @@
34334.0000 14.0000 18.1000 rd 34334.0000 14.0000 18.1000 rd
34334.0000 16.1000 21.1300 34334.0000 16.1000 21.1300
999.9990 999.9990 999.9990 999.9990 999.9990 999.9990
26 0 0 7 34335.0000 PontmThivencelle 26 0 0 9 34335.0000 PontmThivencelle
34335.0000 2.9000 22.0000
34335.0000 2.9000 20.7400 34335.0000 2.9000 20.7400
34335.0000 2.9000 18.2900 rg 34335.0000 2.9000 18.2900 rg
34335.0000 6.4000 17.7900 34335.0000 6.4000 17.7900
...@@ -311,8 +316,10 @@ ...@@ -311,8 +316,10 @@
34335.0000 12.8000 17.2600 34335.0000 12.8000 17.2600
34335.0000 12.8000 18.3100 rd 34335.0000 12.8000 18.3100 rd
34335.0000 12.8000 20.7400 34335.0000 12.8000 20.7400
34335.0000 12.8000 22.0000
999.9990 999.9990 999.9990 999.9990 999.9990 999.9990
27 0 0 7 34343.0000 PontvThivencelle 27 0 0 9 34343.0000 PontvThivencelle
34343.0000 2.9000 22.0000
34343.0000 2.9000 20.7400 34343.0000 2.9000 20.7400
34343.0000 2.9000 18.2900 rg 34343.0000 2.9000 18.2900 rg
34343.0000 6.4000 17.7900 34343.0000 6.4000 17.7900
...@@ -320,6 +327,7 @@ ...@@ -320,6 +327,7 @@
34343.0000 12.8000 17.2600 34343.0000 12.8000 17.2600
34343.0000 12.8000 18.2900 rd 34343.0000 12.8000 18.2900 rd
34343.0000 12.8000 20.7400 34343.0000 12.8000 20.7400
34343.0000 12.8000 22.0000
999.9990 999.9990 999.9990 999.9990 999.9990 999.9990
28 0 0 10 34345.0000 avalPontThivencell 28 0 0 10 34345.0000 avalPontThivencell
34345.0000 0.0000 21.3600 34345.0000 0.0000 21.3600
......
...@@ -142,7 +142,7 @@ select the cross section named \textit{PontRD101m} and open the edition window. ...@@ -142,7 +142,7 @@ select the cross section named \textit{PontRD101m} and open the edition window.
On the left panel is the list of all the points of the section, with their coordinates, their name and their transversal absisa. The Z coordinate of the highest point is written in blue and the lowest in red. Points can have a name. If a point with the same name exists in every section in a reach, it forms a longitudinal line. For example, here we have \textit{rg} and \textit{rd} which represent the left bank and the right bank of the main chanel. On the left panel is the list of all the points of the section, with their coordinates, their name and their transversal absisa. The Z coordinate of the highest point is written in blue and the lowest in red. Points can have a name. If a point with the same name exists in every section in a reach, it forms a longitudinal line. For example, here we have \textit{rg} and \textit{rd} which represent the left bank and the right bank of the main chanel.
On the plot is a projection of the cross section. You can use \texttt{[ctrl + click]} to select a point in the plot. For now we don't have to change anything. You can close the cross section edition window and the geometry edition window. On the plot is a projection of the cross section. You can use \texttt{[ctrl + click]} to select a point in the plot and \texttt{[shift + click]} to select a water line and fisualize usefull geometric data. You can close the cross section edition window and the geometry edition window.
\section{Edit the boundary conditions} \section{Edit the boundary conditions}
...@@ -172,7 +172,8 @@ You can close the the \textit{Edit Boundary Conditions} and the \textit{Boundary ...@@ -172,7 +172,8 @@ You can close the the \textit{Edit Boundary Conditions} and the \textit{Boundary
\section{Create initial conditions} \section{Create initial conditions}
From the main window, click on \texttt{[Hydraulics] => [Initial conditions]}. From the main window, click on \texttt{[Hydraulics] => [Initial conditions]}.
Click on \texttt{Generate minimal height} and enter a height of 2 meters in the pop-up window to generate an initial water height condition that verify the folowing conditions: a water height of at least 2 meters and a decreasing water surface elevation from upstream to downstream. You should see: If you don't know the initial conditions in water elevation and flow discharge of the river, you can use \texttt{[Generate minimal height]} or \texttt{[Generate constant discharge]} buttons to let Pamhyr2 estimate an initial condition using the Manning-Strickler formula.
Click on \texttt{[Generate minimal height]} and enter a discharge of $4 m^2$ in the pop-up window to generate an initial water height condition based on the Manning-Strickler formula and a uniform discharge of $4 m^2$. You should see:
\begin{center} \begin{center}
\includegraphics[width=15cm]{ic.png} \includegraphics[width=15cm]{ic.png}
...@@ -184,18 +185,83 @@ Close the \textit{Initial conditions} window. ...@@ -184,18 +185,83 @@ Close the \textit{Initial conditions} window.
\section{Edit friction coefficients} \section{Edit friction coefficients}
From the main window, click on \texttt{[Hydraulics] => [Edit friction]}. From the main window, click on \texttt{[Hydraulics] => [Edit friction]}.
You fist have to define sets of Strickler coefficients. Click on \includegraphics[width=0.5cm]{"../../../src/View/ui/ressources/edit.png"} to open the \textit{Strickler} window. Here you can create couples of Strickler coefficients, the first one for the minor bed, the second one for the medium bed. Click on \textit{add} four times to create four new couple. Give them the folowing values: You fist have to define sets of Strickler coefficients. Click on \includegraphics[width=0.5cm]{"../../../src/View/ui/ressources/edit.png"} to open the \textit{Strickler} window. Here you can create couples of Strickler coefficients, the first one for the minor bed, the second one for the medium bed. Click on \textit{add} four times to create four new couple. Give them the folowing values:
\begin{center} \begin{center}
\includegraphics[width=15cm]{K.png} \includegraphics[width=15cm]{K.png}
\par\end{center} \par\end{center}
Close the \textit{Strickler} window. On the \textit{Edit friction} window, add four lines with the button \includegraphics[width=0.5cm]{gtk_add.png} to create fous friction zones. Each zone is defined by a \textit{begin} and \textit{end} PK and a \textit{begin} and \textit{end} Strickler couple. The strickler coefficient couples inside a zone are interpolated from the \textit{begin} and \textit{end} couples. In our case, we will use constant coefficients per zone. Set the zones as follow: Close the \textit{Strickler} window. On the \textit{Edit friction} window, add four lines with the button \includegraphics[width=0.5cm]{gtk_add.png} to create four friction zones. Each zone is defined by a \textit{begin} and \textit{end} PK and a \textit{begin} and \textit{end} Strickler couple. The strickler coefficient couples inside a zone are interpolated from the \textit{begin} and \textit{end} couples. In our case, we will use constant coefficients per zone. Set the zones as follow:
\begin{center} \begin{center}
\includegraphics[width=15cm]{frictions.png} \includegraphics[width=15cm]{frictions.png}
\par\end{center} \par\end{center}
The selected zone is highlighted in blue. Close the \textit{Edit friction} window.
\section{Model hydraulic structures}
Sometimes there can be cross-sections in which Shallow water equations can not be used to model the water flow. In that case, we have to define an other law to link the water elevation and the flow discharge. This is the case, for example, under bridges when the water elevation is too high, leading to a flow in charge. Pamhyr2 enables to define various hydraulic structures with laws that can be parametrized. In our case, a weir and two bridges have to be represented as hydraulic structures.
From the main window, click on \texttt{[Hydraulics] => [Hydraulic structures]} to open the hydraulic structures window. Click tree times on the \includegraphics[width=0.5cm]{gtk_add.png} button to create three hydraulic structures. Each structure can have a name and must have a reach and a kp. Set them as follow:
\begin{center}
\includegraphics[width=15cm]{hs.png}
\par\end{center}
Select the downstream weir and click on \includegraphics[width=0.5cm]{"../../../src/View/ui/ressources/edit.png"} to edit the laws of this structure. Hydraulic structures are composed of basic hydraulic structures. You can combine the laws of several basic hydraulic structures to setup your structure. For this weir, we only need a weir basic hydraulic structure. Click on \includegraphics[width=0.5cm]{gtk_add.png} to add a new basic hydraulic structure, give it the \textit{weir} type and set it up as folow:
\begin{center}
\includegraphics[width=15cm]{seuil.png}
\par\end{center}
Go back to the \textit{hydraulic structures} window.
Select the RS101 bridge and click on \includegraphics[width=0.5cm]{"../../../src/View/ui/ressources/edit.png"} to edit the laws of this structure. A bridge can be modeled as a combination of an orifice for the flow under the bridge and a weir for the flow over the bridge. Create two basic hydraulic structures and set them as folow:
\begin{center}
\includegraphics[width=15cm]{seuilRS101.png}
\includegraphics[width=15cm]{orificeRS101.png}
\par\end{center}
Go back to the \textit{hydraulic structures} window and aply the same procedure for the Thivencelle bridge:
\begin{center}
\includegraphics[width=15cm]{orificeThivencelle.png}
\includegraphics[width=15cm]{seuilThivencelle.png}
\par\end{center}
You can now close the \textit{hydraulic structures} windows.
\section{Solver parameters}
From the main window, click on \texttt{[Execute] => [Numerical parameters for solvers]}.
In the window \textit{solver parameters} select the \textit{Mage v8} tab. Set the solver parameters as follow:
\begin{center}
\includegraphics[width=15cm]{param.png}
\par\end{center}
Close the \textit{solver parameters} window.
\section{Run the simulation}
From the main window, click on \texttt{[Execute] => [Run solver]}.
Select \textit{Defaut-Mage - (Mage8)} anc click on the \textit{Run} button.
It will open two windows: the \textit{Check list} window and the \textit{Solver log} window.
The \textit{Check list} window gives som hints about the validity of your model, and the \textit{Solver log} window displays the outputs of the solver.
From the \textit{Solver log} window you can re-run the computation, and from the textit{Solver log} window you can click on the \textit{Results} button to open the \textit{Results} window.
\section{Visualize the results}
If you closed the textit{Solver log} window, you can click on \texttt{[Results] => [Visualize last results]} from the main window to open the \textit{Results} window. The top lets panel let you select your reach, the bottom left panel lets you select a cross-section in that reach. the tree plots on the right show the reach and the cross-section the same way than in the \textit{Geometry} window. You can use the bottom slider to visualize the water elevation at different timesteps.
To visualize the flow discharge, switch to the \textit{Hydrograph} tab.
To create custom 2D plots, click on the \includegraphics[width=0.5cm]{gtk_add.png} button on the top left of the window. Select the values you want on the $X$ and $Y$ axis and click on \textit{OK}.
You can now see a new tab with the custom 2D plot in the right panel of the \textit{Results} window.
\pagebreak{} \pagebreak{}
\end{document} \end{document}
...@@ -49,6 +49,7 @@ class MeshingWithMage(AMeshingTool): ...@@ -49,6 +49,7 @@ class MeshingWithMage(AMeshingTool):
self._init_c_set_bief_name() self._init_c_set_bief_name()
self._init_c_st_to_m_compl() self._init_c_st_to_m_compl()
self._init_c_interpolate_profils_pas_transversal() self._init_c_interpolate_profils_pas_transversal()
self._init_c_purge()
self._init_c_output_bief() self._init_c_output_bief()
def _lib_path(self): def _lib_path(self):
...@@ -104,6 +105,11 @@ class MeshingWithMage(AMeshingTool): ...@@ -104,6 +105,11 @@ class MeshingWithMage(AMeshingTool):
] ]
self._c_interpolate_profils_pas_transversal.restype = None self._c_interpolate_profils_pas_transversal.restype = None
def _init_c_purge(self):
self._c_purge = getattr(self._bief_lib, 'c_purge')
self._c_purge.argtypes = None
self._c_purge.restype = None
def _init_c_output_bief(self): def _init_c_output_bief(self):
self._c_output_bief = getattr(self._bief_lib, 'c_output_bief') self._c_output_bief = getattr(self._bief_lib, 'c_output_bief')
self._c_output_bief.argtypes = [c_char_p] self._c_output_bief.argtypes = [c_char_p]
...@@ -181,8 +187,12 @@ class MeshingWithMage(AMeshingTool): ...@@ -181,8 +187,12 @@ class MeshingWithMage(AMeshingTool):
ns, npts_max = self.get_reach_stat() ns, npts_max = self.get_reach_stat()
self.complete_cross_section() gl = reach.compute_guidelines()
# we make sure that the lines are in the left-ti-right order
guide_list = [x.name for x in reach.profiles[0].named_points() if x in gl[0]]
self.complete_cross_section(guide_list)
self.interpolate_cross_section(ns, step) self.interpolate_cross_section(ns, step)
self.purge()
self.export_to_m(m_file) self.export_to_m(m_file)
...@@ -212,8 +222,12 @@ class MeshingWithMage(AMeshingTool): ...@@ -212,8 +222,12 @@ class MeshingWithMage(AMeshingTool):
return ns, npts_max return ns, npts_max
def complete_cross_section(self): def complete_cross_section(self, gl=[]):
self.st_to_m_compl(0, ' ', ' ') gl1 = ["un"]+gl
gl2 = gl+["np"]
print (gl1)
for l in zip(gl1, gl2):
self.st_to_m_compl(0, l[0], l[1])
def interpolate_cross_section(self, ns, step: float): def interpolate_cross_section(self, ns, step: float):
self.interpolate_profils_pas_transversal( self.interpolate_profils_pas_transversal(
...@@ -222,6 +236,9 @@ class MeshingWithMage(AMeshingTool): ...@@ -222,6 +236,9 @@ class MeshingWithMage(AMeshingTool):
step step
) )
def purge(self):
self._c_purge()
def export_to_m(self, m): def export_to_m(self, m):
self.output_bief(m) self.output_bief(m)
......
...@@ -374,7 +374,7 @@ class Reach(SQLSubModel): ...@@ -374,7 +374,7 @@ class Reach(SQLSubModel):
Returns: Returns:
Tuple of complete and incomplete guidelines name. Tuple of complete and incomplete guidelines name.
""" """
# Get all point contains into a guideline # Get all point contained into a guideline
named_points = [profile.named_points() for profile in self.profiles] named_points = [profile.named_points() for profile in self.profiles]
points_name = list( points_name = list(
map( map(
......
...@@ -59,7 +59,7 @@ class GeometryReachTableModel(PamhyrTableModel): ...@@ -59,7 +59,7 @@ class GeometryReachTableModel(PamhyrTableModel):
return f"{kp:.4f}" return f"{kp:.4f}"
if role == Qt.DisplayRole and index.column() == 2: if role == Qt.DisplayRole and index.column() == 2:
return self._data.profile(index.row()).profile_type return str(self._data.profile(index.row()).nb_points)
if role == Qt.TextAlignmentRole: if role == Qt.TextAlignmentRole:
return Qt.AlignHCenter | Qt.AlignVCenter return Qt.AlignHCenter | Qt.AlignVCenter
......
...@@ -45,4 +45,5 @@ class GeometryTranslate(PamhyrTranslate): ...@@ -45,4 +45,5 @@ class GeometryTranslate(PamhyrTranslate):
self._sub_dict["table_headers"] = { self._sub_dict["table_headers"] = {
"name": _translate("Geometry", "Name"), "name": _translate("Geometry", "Name"),
"kp": _translate("Geometry", "KP"), "kp": _translate("Geometry", "KP"),
"poins": _translate("Geometry", "Points"),
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment