diff --git a/doc/paper/2023/simhydro/presentation/presentation.org b/doc/paper/2023/simhydro/presentation/presentation.org new file mode 100644 index 0000000000000000000000000000000000000000..8cabf3321d13c78e0d67abcfdf3fbf2ff58a45e7 --- /dev/null +++ b/doc/paper/2023/simhydro/presentation/presentation.org @@ -0,0 +1,487 @@ +# presentation.org -- Pamhyr +# Copyright (C) 2023 INRAE +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +# -*- coding: utf-8 -*- + +#+STARTUP: indent hideblocks content beamer + +#+TITLE: SimHydro 2023 +#+SUBTITLE: \textbf{Pamhyr2}: a graphical user interface for 1D hydro-sedimentary modelling of rivers + +# #+AUTHOR: Pierre-Antoine Rouby +#+LATEX_HEADER: \author[Pierre-Antoine Rouby]{\textbf{Pierre-Antoine Rouby$^{*}$}, Benoît Camenen, Lionel Pénard, Léa Kieffer, Théophile Terraz\\\texttt{<pierre-antoine.rouby@inrae.fr>}^{*}} +#+EMAIL: pierre-antoine.rouby@inrae.fr +#+INSTITUTE: INRAE Lyon-Villerbanne, teams River Hydraulics +#+LATEX_HEADER: \institute{INRAE Lyon-Villerbanne, River Hydraulics team} +#+DATE: 9th November + +#+KEYWORDS: g ui, hydraulics, sedimentary, hydro-sedimentary, 1D modelling, freesoftware, foss + +#+OPTIONS: H:2 toc:t num:t author:nil +#+LATEX_CLASS: beamer +#+LATEX_CLASS_OPTIONS: [slideopt,A4,showboxes,svgnames,aspectratio=169] +# #+LATEX_CLASS_OPTIONS: [presentation] +#+BEAMER_THEME: default +#+COLUMNS: %45ITEM %10BEAMER_ENV(Env) %10BEAMER_ACT(Act) %4BEAMER_COL(Col) + +#+LANGUAGE: fr +#+LATEX_HEADER: \usepackage[frenchb]{babel} + +#+BEGIN_SRC emacs-lisp :results silent :exports none + (setq org-latex-pdf-process (list + "latexmk -pdflatex='lualatex -shell-escape -interaction nonstopmode' -pdf -f %f")) + + (add-to-list 'org-latex-packages-alist '("" "minted")) + (setq org-latex-listings 'minted) + (setq org-src-fontify-natively t) + + (org-add-link-type + "cite" 'ebib + (lambda (path desc format) + (cond + ((eq format 'html) + (format "(<cite>%s</cite>)" path)) + ((eq format 'text) + (format "[%s]" path)) + ((eq format 'latex) + (if (or (not desc) (equal 0 (search "cite:" desc))) + (format "\\cite{%s}" path) + (format "\\cite[%s][%s]{%s}" + (cadr (split-string desc ";")) + (car (split-string desc ";")) path)))))) +#+END_SRC + +#+LATEX_HEADER: \setbeamertemplate{footline}[frame number] +#+LATEX_HEADER: \setbeamertemplate{headline}{} +#+LATEX_HEADER: \usepackage{multirow} +#+LATEX_HEADER: \usepackage{fontawesome5} +#+LATEX_HEADER: \usepackage{tcolorbox} +#+LATEX_HEADER: \usepackage{tikz} + +#+LATEX_HEADER: \logo{\includegraphics[width=.1\textwidth]{../../../../../src/View/ui/ressources/Logo-INRAE.png}} + +#+LATEX_HEADER: \newcommand{\R}[1]{\rotatebox[origin=c]{90}{#1}} + +# Beamer colors +#+LATEX_HEADER: \setbeamersize{text margin left=0.5cm,text margin right=0.5cm} +#+LATEX_HEADER: \setbeamerfont{alerted text}{series=\bfseries} +#+LATEX_HEADER: \setbeamerfont{example text}{series=\bfseries} + +#+LATEX_HEADER: \definecolor{inrae_1}{RGB}{102,193,191} +#+LATEX_HEADER: \definecolor{inrae_2}{RGB}{0,150,152} +#+LATEX_HEADER: \definecolor{inrae_3}{RGB}{39,86,98} + +#+LATEX_HEADER: \setbeamercolor{alerted text}{fg=inrae_1} +#+LATEX_HEADER: \setbeamercolor{structure}{fg=inrae_2} +#+LATEX_HEADER: \setbeamercolor{normal text}{fg=inrae_3} +#+LATEX_HEADER: \setbeamercolor*{author}{fg=inrae_3} + +#+LATEX_HEADER: \usepackage[absolute,showboxes,overlay]{textpos} + +#+LATEX_HEADER: \TPshowboxesfalse +#+LATEX_HEADER: \textblockorigin{5mm}{0mm} + +# Biblio +#+LATEX_HEADER: \usepackage{natbib} +# #+LATEX_HEADER: \bibliographystyle{apalike} +#+LATEX_HEADER: \setbeamertemplate{bibliography item}{} +#+LATEX_HEADER: \renewcommand\bibfont{\scriptsize} +#+LATEX_HEADER: \setbeamertemplate{frametitle continuation}[from second] +#+LATEX_HEADER: \setbeamercolor*{bibliography entry title}{fg=inrae_3} +#+LATEX_HEADER: \setbeamercolor*{bibliography entry author}{fg=inrae_3} +#+LATEX_HEADER: \setbeamercolor*{bibliography entry location}{fg=inrae_3} + +#+LATEX_HEADER: \usepackage{bbding} +#+LATEX_HEADER: \usepackage{pdfpages} + +# Renew title page +#+LATEX_HEADER: \defbeamertemplate*{title page}{customized}[1][] +#+LATEX_HEADER: { +# #+LATEX_HEADER: { +# #+LATEX_HEADER: \usebeamerfont{date}\usebeamercolor[fg]{date} +# #+LATEX_HEADER: \tikz[overlay,remember picture] +# #+LATEX_HEADER: \node[xshift=-1cm,yshift=-1cm,text width=10cm] at (current page.north east) { +# #+LATEX_HEADER: 7$^{th}$ International Conference\\ +# #+LATEX_HEADER: 8TH-10TH November\\ +# #+LATEX_HEADER: EDF Lab - CHATOU, FRANCE +# #+LATEX_HEADER: } +# #+LATEX_HEADER: } +#+LATEX_HEADER: { +#+LATEX_HEADER: \usebeamerfont{title}\inserttitle\par +#+LATEX_HEADER: \usebeamerfont{title}\usebeamercolor[fg]{title} +#+LATEX_HEADER: \large New modeling paradigms for water issues?\par +#+LATEX_HEADER: } +#+LATEX_HEADER: \bigskip +#+LATEX_HEADER: \begin{center} +#+LATEX_HEADER: \usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle} +#+LATEX_HEADER: { +#+LATEX_HEADER: \LARGE\insertsubtitle\par +#+LATEX_HEADER: } +#+LATEX_HEADER: \bigskip +#+LATEX_HEADER: \usebeamerfont{author}\usebeamercolor[fg]{author}\insertauthor\par +#+LATEX_HEADER: \bigskip +#+LATEX_HEADER: \usebeamerfont{institute}\usebeamercolor[fg]{institute}\insertinstitute\par +#+LATEX_HEADER: \bigskip +#+LATEX_HEADER: \usebeamerfont{date}\usebeamercolor[fg]{date}\insertdate\par +#+LATEX_HEADER: \usebeamercolor[fg]{titlegraphic}\inserttitlegraphic +#+LATEX_HEADER: \end{center} +#+LATEX_HEADER: } + +# #+LATEX_HEADER: \newcommand{\tred}[1]{\textcolor{rouge_inrae}{#1}} + +#+TODO: TODO WIP TOREVIEW | DONE + +#+MACRO: pamhyr \textsc{PAMHyR} +#+MACRO: pamhyr2 \textsc{Pamhyr2} + +#+MACRO: pause \pause +#+MACRO: framebreak \framebreak +#+MACRO: no +# #+MACRO: OK \checkmark +#+MACRO: OK \faIcon{check} +#+MACRO: bf \textbf{$1} + +# #+latex: \frame{\tocpage} + +* 1D hydro-sedimentary simulation at INRAE +** COMMENT 1D river flow simulation +*** INRAE (Lyon-Villerbanne) + +- Mage [fn:: Mage: https://gitlab.irstea.fr/jean-baptiste.faure/mage] +- RubarBE [fn:: RubarBE: + https://gitlab.irstea.fr/theophile.terraz/rubarbe] + +*** Other project + +- Mascaret [fn:: OpenTeleMac: http://www.opentelemac.org] +- HEC-RAS [fn:: HEC-RAS: + https://www.hec.usace.army.mil/software/hec-ras] +- Mike 11 [fn:: Mike11: + https://www.mikepoweredbydhi.com/products/mike-11] + +** {{{pamhyr}}} +#+BEGIN_EXPORT latex +\tikz[overlay,remember picture] +\node[xshift=-4cm,yshift=4cm] at (current page.south east) { + \includegraphics[width=7cm]{../images/PAMHyR.png} +}; +#+END_EXPORT + +{{{pamhyr}}} developed at INRAE in Java since the end of 90s + +*** Features +- Graphical user interface +- Define and edit complexe 1D river models +- Run a solver +- Visualize simulation results + +*** Compatibility +- 2 solvers *Mage and RubarBE* +# - Multi-reaches (Only for Mage) +- Multi-platform (Linux / Windows) + +** {{{pamhyr}}} +#+BEGIN_EXPORT latex +\tikz[overlay,remember picture] +\node[xshift=-4cm,yshift=4cm] at (current page.south east) { + \includegraphics[width=7cm]{../images/PAMHyR.png} +}; +#+END_EXPORT + +*** Conception issues +- Monolingual French +- Interface too different for each solver +- Impossible to undo an action + +*** Huge technical debts +- Out dated technologies (UML $\to$ Java) +- Unmaintained library +- Unstable development process + +Hard to maintain or add features to the interface + +(No modification since 2016) + +* Presentation of {{{pamhyr2}}} +** {{{Pamhyr2}}} - Needs - General constraints + +Create a new version of {{{pamhyr}}} called {{{pamhyr2}}} + +{{{pause}}} + +*** Constraints for users experience +:PROPERTIES: +:BEAMER_COL: 0.5 +:BEAMER_ENV: block +:END: ++ *User friendly* ++ *Multi platform* (at least Linux and Windows) ++ *Multi language* (at least English and French) ++ *Multi solver* (as much as possible, at least Mage and + RubarBE) ++ *Single save file* per study + +{{{pause}}} + +*** Constraints for developers experience +:PROPERTIES: +:BEAMER_COL: 0.5 +:BEAMER_ENV: block +:END: +- *Common used* code library and tools +# - *Modular* and *flexible* code +- *Clear* architecture +- *Free and open sources software* (FOSS) + +** {{{Pamhyr2}}} - Needs - Features +# #+BEGIN_EXPORT latex +# \tikz[overlay,remember picture] +# \node[xshift=-5cm,yshift=-2cm] at (current page.north east) { +# \includegraphics[width=6cm]{../images/geometry_saar.png} +# }; +# #+END_EXPORT + +**** {{{no}}} +:PROPERTIES: +:BEAMER_COL: 0.30 +:BEAMER_ENV: block +:END: +- Define and edit data + + River network + + Geometry + + Boundary conditions + + Friction + + Initial conditions + + *Sedimentary layers* +- User meshed geometry +- Run a solver +- Display results + + Default visualisation + + *Customized visualisation* + +**** {{{no}}} +:PROPERTIES: +:BEAMER_COL: 0.70 +:BEAMER_ENV: block +:END: +[[../images/geometry_saar.png]] + +** {{{pamhyr2}}} - Technical choices +#+BEGIN_EXPORT latex +\tikz[overlay,remember picture] +\node[xshift=-9.3cm,yshift=-4cm] at (current page.north east) { + \includegraphics[width=6.3cm]{../images/BC.png} +}; +#+END_EXPORT + +*** Technologies +:PROPERTIES: +:BEAMER_COL: 0.60 +:BEAMER_ENV: block +:END: +- *Python* +- *PyQt* +- Qt Designer +- Qt Linguist +- *Matplotlib* +- SQLite (as =*.pamhyr=) +- *GPLv3* license (strong copyleft) + +*** Architecture +:PROPERTIES: +:BEAMER_COL: 0.35 +:BEAMER_ENV: block +:END: +- Qt Model/View +- Multiple solvers configuration +- *Unified interface*, as much as possible + +** {{{pamhyr2}}} - State of the project +#+BEGIN_EXPORT latex +\tikz[overlay,remember picture] +\node[xshift=-4.5cm,yshift=-2.5cm] at (current page.north east) { + \includegraphics[width=8cm]{../images/apply_sedi.png} +}; +#+END_EXPORT + +*** {{{no}}} +:PROPERTIES: +:BEAMER_COL: 0.40 +:BEAMER_ENV: block +:END: + +\vspace{-1.5cm} + +\begin{center} +\emph{Last version:} \texttt{v0.0.3} +\end{center} + +{{{pause}}} + +#+latex: \begin{center} +#+latex: \resizebox{0.9\columnwidth}{!}{ +# #+caption: Tools by methods +#+name: tab:current-state +#+attr_latex: :align |l|c| +|---------------------------------+-----------------| +| {{{bf(Features)}}} | {{{bf(State)}}} | +|---------------------------------+-----------------| +| Create save and load study | {{{OK}}} | +| *Undo/Redo actions* | {{{OK}}} | +| Edit river network | {{{OK}}} | +| Edit geometry | {{{OK}}} | +| Edit boundary conditions | {{{OK}}} | +| Edit lateral contributions | {{{OK}}} | +| Edit frictions (Stricklers) | {{{OK}}} | +| Edit initial conditions | {{{OK}}} | +| *Edit sedimentary layers* | {{{OK}}} | +| Edit hydraulics structures | | +| Edit suspended sediment | | +| Edit polluant | | +| Use meshing tool | WIP | +| Run a solver | {{{OK}}} | +| Read and display results | {{{OK}}} | +| Customize results visualisation | WIP | +| Generic solver input/output | | +|---------------------------------+-----------------| +#+latex: } +#+latex: \end{center} + +{{{pause}}} + +*** {{{no}}} +:PROPERTIES: +:BEAMER_COL: 0.60 +:BEAMER_ENV: block +:END: + +\vspace{2.5cm} + +#+latex: \begin{center} +#+latex: \resizebox{0.8\columnwidth}{!}{ +# #+caption: Tools by methods +#+name: tab:current-state-solver +#+attr_latex: :align |l|c|c|c| +|----------------------------+----------------+-------------------+--------------------| +| {{{bf(Usage)}}} | {{{bf(Mage)}}} | {{{bf(RubarBE)}}} | {{{bf(Mascaret)}}} | +|----------------------------+----------------+-------------------+--------------------| +| *Hydraulics* (mono reach) | {{{OK}}} | | {{{OK}}} | +| *Hydraulics* (multi reach) | {{{OK}}} | | | +| *Bed load evolution* | {{{OK}}} | | | +|----------------------------+----------------+-------------------+--------------------| +#+latex: } +#+latex: \end{center} + +# #+LaTeX: \vspace{0.3cm} + +#+latex: \begin{center} +#+latex: \resizebox{0.6\columnwidth}{!}{ +# #+caption: Tools by methods +#+name: tab:current-state-package +#+attr_latex: :align |l|c|c| +|--------------------+---------------------+-------------------| +| {{{bf(Packages)}}} | {{{bf(GNU/Linux)}}} | {{{bf(Windows)}}} | +|--------------------+---------------------+-------------------| +| Archive (tar/zip) | {{{OK}}} | {{{OK}}} | +| Installer | | {{{OK}}} | +|--------------------+---------------------+-------------------| +#+latex: } +#+latex: \end{center} + +* Future work and perspective +** Future work +#+BEGIN_EXPORT latex +\tikz[overlay,remember picture] +\node[xshift=-4.8cm,yshift=-3.8cm] at (current page.north east) { + \includegraphics[width=8.7cm]{../images/results_hydro.png} +}; +#+END_EXPORT + +*** Next step +- *Meshing tools integration* +- *Custom results visualisation* + + Python + matplotlib script +- RubarBE integration +- Hydraulics structures +- Unified graphics theme + +*** Open questions +- Generic solver input/output (HDF5? CGNS? SQLite?) +- GNU/Linux packages (Pip? Conda? Guix? Deb?) + +** Contribution +#+LaTeX: \begin{center} +\faIcon{gitlab} https://gitlab.irstea.fr/theophile.terraz/pamhyr/ +#+LaTeX: \end{center} + +*** For users +:PROPERTIES: +:BEAMER_COL: 0.45 +:BEAMER_ENV: block +:END: +- Try {{{pamhyr2}}} +- Report bug +- Propose improvement +- Improve translation +- Improve user documentation +- Improve tests cases examples +- /Find better project name/ + +*** For developers +:PROPERTIES: +:BEAMER_COL: 0.45 +:BEAMER_ENV: block +:END: +- Add new solver / features +- Improve sources code +- Improve developers documentation +- Improve unit tests + +# * Conclusion +** Thanks for listening +# #+BEGIN_EXPORT latex +# \tikz[overlay,remember picture] +# \node[xshift=-6cm,yshift=-1.5cm,text width=10cm] at (current page.north east) { +# {\small\emph{\alert{Journées de la modélisation 1D hydro-sédimentaire} (in french) -} +# \emph{30 \& 31 janvier 2024, INRAE Villeurbanne - } +# \emph{Information and inscription: }\texttt{<benoit.camenen@inrae.fr>}} +# }; +# #+END_EXPORT + +#+LaTeX: \begin{center} +\faIcon{gitlab} https://gitlab.irstea.fr/theophile.terraz/pamhyr/ +#+LaTeX: \end{center} + +#+LaTeX: \begin{center} +/*Journées de la modélisation 1D hydro-sédimentaire*/ (in French) +#+LaTeX: \\ +/30 & 31 janvier 2024/, INRAE Villeurbanne +#+LaTeX: \\ +Information and registration: =<benoit.camenen@inrae.fr>= +#+LaTeX: \end{center} + +- {{{pamhyr2}}} developers: + + =<pierre-antoine.rouby@inrae.fr>=, + + =<theophile.terraz@inrae.fr>= +- Mage/RubarBE developer: + + =<theophile.terraz@inrae.fr>= + +# #+LaTeX: \vspace{0.5cm} +# #+LaTeX: \begin{center} +# #+LaTeX: {\Large +# *Thanks for listening* +# #+LaTeX: } +# #+LaTeX: \end{center} diff --git a/src/Model/Geometry/Reach.py b/src/Model/Geometry/Reach.py index c10b56fc50817e0b12264bc185e8288de0a8d275..3ef25793e744592f4b8c4b00d9a0903e9ed6f254 100644 --- a/src/Model/Geometry/Reach.py +++ b/src/Model/Geometry/Reach.py @@ -368,6 +368,9 @@ class Reach(SQLSubModel): def inter_profiles_rk(self): profiles = sorted(self.profiles, key=lambda p: p.rk) + if len(profiles) == 0: + return [] + first = profiles[0] last = profiles[-1] @@ -750,6 +753,9 @@ class Reach(SQLSubModel): cnt += 1 def get_incline(self): + if len(self.profiles) == 0: + return 0.0 + first = self.profile(0) last = self.profile(len(self) - 1) @@ -767,6 +773,9 @@ class Reach(SQLSubModel): def get_incline_mean(self): profiles = self.profiles + if len(profiles) == 0: + return 0.0 + previous = profiles[0] incline_acc = 0 @@ -790,6 +799,9 @@ class Reach(SQLSubModel): def get_incline_median(self): profiles = self.profiles + if len(profiles) == 0: + return 0.0 + previous = profiles[0] incline_acc = [] @@ -814,6 +826,9 @@ class Reach(SQLSubModel): def get_incline_median_mean(self): profiles = self.profiles + if len(profiles) == 0: + return 0.0 + previous = profiles[0] incline_acc = [] diff --git a/src/View/BoundaryCondition/Edit/Window.py b/src/View/BoundaryCondition/Edit/Window.py index 336a9671b4e7edfafcff4ca3cf70b7f541381b8a..a414dcaa70df7004e9a19fc9f0567f1916233873 100644 --- a/src/View/BoundaryCondition/Edit/Window.py +++ b/src/View/BoundaryCondition/Edit/Window.py @@ -347,6 +347,13 @@ class EditBoundaryConditionWindow(PamhyrWindow): if node is None: return reach = self._data.reach(self._study.river)[0] + if len(reach.profiles) == 0: + self.message_box( + text=self._trad["title_need_geometry"], + informative_text=self._trad["msg_need_geometry"] + ) + return + profile = reach.profiles[-1] dlg = GenerateDialog(self.slope_value, reach, @@ -379,6 +386,13 @@ class EditBoundaryConditionWindow(PamhyrWindow): if node is None: return reach = self._data.reach(self._study.river)[0] + if len(reach.profiles) == 0: + self.message_box( + text=self._trad["title_need_geometry"], + informative_text=self._trad["msg_need_geometry"] + ) + return + profile = reach.profiles[-1] z_min = profile.z_min() z_max = profile.z_max() diff --git a/src/View/BoundaryCondition/Edit/translate.py b/src/View/BoundaryCondition/Edit/translate.py index 006c49df0fc6d97fdf66722fcb825cc48a4af8cf..3912b81c6e18c4440935b3dbfa98824e3c845850 100644 --- a/src/View/BoundaryCondition/Edit/translate.py +++ b/src/View/BoundaryCondition/Edit/translate.py @@ -44,3 +44,12 @@ class BCETranslate(BCTranslate): "z": self._dict["unit_elevation"], "solid": _translate("BoundaryCondition", "Solid (kg/s)"), } + + self._dict["title_need_geometry"] = _translate( + "Geometry", "No geometry" + ) + self._dict["msg_need_geometry"] = _translate( + "Geometry", + "There is not geometry found for this reach, " + "a geometry is needed to this features" + ) diff --git a/src/View/Tools/ASubWindow.py b/src/View/Tools/ASubWindow.py index 01db62f43e56f477bf40139b847971ed928a7240..25928e4db07b4119ada6bc49a78af913fdee8a73 100644 --- a/src/View/Tools/ASubWindow.py +++ b/src/View/Tools/ASubWindow.py @@ -142,7 +142,7 @@ class WindowToolKit(object): Returns: Nothing """ - msg = QMessageBox() + msg = QMessageBox(parent=self) msg.setIcon(QMessageBox.Warning) msg.setText(text)