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

setup.py
Pierre-Antoine Rouby 2024-01-08 15:20:06 +01:00
commit f2b97b68bd
8 changed files with 105 additions and 13 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -65,7 +65,8 @@
31874.0000 14.5000 22.1900
31874.0000 17.6000 22.9900
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 2.5000 19.6900 rg
31875.0000 2.5000 18.6900
@ -73,8 +74,10 @@
31875.0000 10.7000 18.9900
31875.0000 10.7000 19.9900 rd
31875.0000 13.8900 21.8900
31875.0000 13.8900 23.0000
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 2.5000 19.6900 rg
31885.0000 2.5000 18.6900
@ -82,6 +85,7 @@
31885.0000 10.7000 18.9900
31885.0000 10.7000 19.9900 rd
31885.0000 13.8900 21.8900
31885.0000 13.8900 23.0000
999.9990 999.9990 999.9990
9 0 0 9 31886.0000
31886.0000 0.0000 22.9900
@ -303,7 +307,8 @@
34334.0000 14.0000 18.1000 rd
34334.0000 16.1000 21.1300
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 18.2900 rg
34335.0000 6.4000 17.7900
@ -311,8 +316,10 @@
34335.0000 12.8000 17.2600
34335.0000 12.8000 18.3100 rd
34335.0000 12.8000 20.7400
34335.0000 12.8000 22.0000
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 18.2900 rg
34343.0000 6.4000 17.7900
@ -320,6 +327,7 @@
34343.0000 12.8000 17.2600
34343.0000 12.8000 18.2900 rd
34343.0000 12.8000 20.7400
34343.0000 12.8000 22.0000
999.9990 999.9990 999.9990
28 0 0 10 34345.0000 avalPontThivencell
34345.0000 0.0000 21.3600

View File

@ -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 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}
@ -172,7 +172,8 @@ You can close the the \textit{Edit Boundary Conditions} and the \textit{Boundary
\section{Create 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}
\includegraphics[width=15cm]{ic.png}
@ -190,12 +191,77 @@ You fist have to define sets of Strickler coefficients. Click on \includegraphic
\includegraphics[width=15cm]{K.png}
\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}
\includegraphics[width=15cm]{frictions.png}
\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{}
\end{document}

View File

@ -49,6 +49,7 @@ class MeshingWithMage(AMeshingTool):
self._init_c_set_bief_name()
self._init_c_st_to_m_compl()
self._init_c_interpolate_profils_pas_transversal()
self._init_c_purge()
self._init_c_output_bief()
def _lib_path(self):
@ -104,6 +105,11 @@ class MeshingWithMage(AMeshingTool):
]
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):
self._c_output_bief = getattr(self._bief_lib, 'c_output_bief')
self._c_output_bief.argtypes = [c_char_p]
@ -181,8 +187,12 @@ class MeshingWithMage(AMeshingTool):
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.purge()
self.export_to_m(m_file)
@ -212,8 +222,12 @@ class MeshingWithMage(AMeshingTool):
return ns, npts_max
def complete_cross_section(self):
self.st_to_m_compl(0, ' ', ' ')
def complete_cross_section(self, gl=[]):
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):
self.interpolate_profils_pas_transversal(
@ -222,6 +236,9 @@ class MeshingWithMage(AMeshingTool):
step
)
def purge(self):
self._c_purge()
def export_to_m(self, m):
self.output_bief(m)

View File

@ -374,7 +374,7 @@ class Reach(SQLSubModel):
Returns:
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]
points_name = list(
map(

View File

@ -59,7 +59,7 @@ class GeometryReachTableModel(PamhyrTableModel):
return f"{kp:.4f}"
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:
return Qt.AlignHCenter | Qt.AlignVCenter

View File

@ -45,4 +45,5 @@ class GeometryTranslate(PamhyrTranslate):
self._sub_dict["table_headers"] = {
"name": _translate("Geometry", "Name"),
"kp": _translate("Geometry", "KP"),
"poins": _translate("Geometry", "Points"),
}