Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
kavkapet committed May 10, 2024
2 parents 63f2e58 + fb6ec8c commit 3c6bd5c
Show file tree
Hide file tree
Showing 7 changed files with 470 additions and 468 deletions.
1 change: 1 addition & 0 deletions reference_manual/config/usepackage.tex
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
\usepackage{xspace}
\usepackage{framed}
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{pdflscape}
\usepackage[top=3cm, left=3.5cm, right=2.5cm, bottom=3cm, headheight=15pt, includeheadfoot]{geometry}%rozměry stránky
\usepackage{textcomp}
Expand Down
502 changes: 75 additions & 427 deletions reference_manual/text_en/hillhyd.tex

Large diffs are not rendered by default.

39 changes: 20 additions & 19 deletions reference_manual/text_en/intro.tex
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
The SMODERP2D episodic rainfall-runoff/erosion model based on a 1D profile
version, in which the surface runoff and the erosion were typically calculated
in several 1D profiles representing the main flow path in the hillslope
\cite{Dostal2000}. The current generation of the SMODERP2D model is pixel
distributed, and is implemented in python in order to be compatible with most
GIS software. The development is presented on the github platform at
\href{https://github.com/storm-fsv-cvut/smoderp2d}{github.com/storm-fsv-cvut/smoderp2d}.

The SMODERP2D model is primarily designed for surface runoff and erosion
computation. The surface flow routing in the model is based on the digital
elevation model (DEM). For simplicity, DEM also controls the spatial
discretization of the model.


\subsection{Model history and development}
The model has been developed since the end of the 1980´s at the Department of
Irrigation, Drainage and Land Scape Engineering, Faculty of Civil Engineering,
Czech Technical University in Prague. The first version of 1D model, designed
Expand All @@ -23,23 +38,9 @@
aforesaid sections into individual elements of the same length and forms thus
an interphase terminated by testing and comparison to the distributed 2D model.

The 2D model which is developed in last year is prepared as an extension to the
GIS softwares QGIS, ArcGIS. The actual script to calculate the 2D model was
elaborated in Python and used in each providers.
The 2D model which was developed in last years is prepared as an extension to
the GIS software such as grass, QGIS, or ArcGIS. The computational core of the
2D model was elaborated in Python and used in each provider. Additionally,
mathematical description of rill flow and flow in watercourses were implemented
in the 2D model version.

Mathematical calculation of surface runoff, the 2D model also includes a
submodel implemented for runoff calculation in the rills.

The SMODERP2D episodic rainfall-runoff/erosion model was used for the
investiga-tion presented here. The 2D model is based on a 1D profile version,
in which the surface runoff and the erosion were typically calculated in
several 1D profiles representing the main flow path in the hillslope [20]. The
current generation of the SMODERP2D model is pixel distributed, and is
implemented in python in order to be compatible with most GIS software. The
development is presented on the github platform at
github.com/storm-fsv-cvut/smoderp2d (accessed on 1 January 2022).

The SMODERP2D model is primarily designed for surface runoff and erosion
com-putation. The surface flow routing in the model is based on the digital
elevation model (DEM). DEM also controls the spatial discretization of the
model.
235 changes: 234 additions & 1 deletion reference_manual/text_en/num.tex
Original file line number Diff line number Diff line change
@@ -1,3 +1,236 @@
\subsection{Source code architecture}

\subsection{NumPy solution}
\subsection{Implicit method numerical solution}

\subsection{Explicit/Implicit approach}

\subsubsection{Explicit}
The time derivative in Equation \ref{eq:bilance} is calculated using an
explicit method. The computation is therefore sensitive to the size of the time
step. The size of the time step is controlled by the Courant criterion, which
needs to be kept below the theoretical maximum value of 1, while the maximum
value in practise is lower than 1
\cite{zhang1989modeling, esteves2000overland}.


The sheet flow water level of the next time t + 1 step in Equation
\ref{eq:bilance} which incorporates the sum \ref{eq:routing} is calculated with the
explicit time discretisation scheme for cell i as:
\begin{equation}
h_{i,t} =h_{i,t-1} + \mathrm{d}t (es_{i,t-1} + \sum_j^m q^{out}_{j,t-1}-
inf_{i,t-1} - q^{out}_{i,t-1}),
\label{eq:bilanceexpl}
\end{equation}


After inserting the equations~(\ref{eq:infiltration})
and~(\ref{eq:powerlaw2}) into equation~(\ref{eq:bilanceexpl}) the
final explicit form balance equation can be written as:
\begin{dmath}
h_{i,t} = h_{i,t-1} +
es_{i,t-1} + exf_{i,t-1} + \sum_{j}^{inflows}
1/n_{sheet,j}I_j^{y_j} h_{j,t-1}^{b_j} -
1/n_{sheet,i}I_i^{y_i}h_{i,t-1}^{b_i} - (
\frac{1}{2}S_it_1^{-1/2}+K_{s,i}).
\end{dmath}


\subsubsection{Implicit}
Alternatively the equation (\ref{eq:bilance}) solved using implicit
scheme. The right hand side can be expressed in for time $t$ as:

$$
\frac{h_{i,t} - h_{i,t-1} }{\mathrm{d} t} = \left(es_{i,t} +
\sum_j^{inflows} q^{in}_{j,t} - inf_{i,t} - q^{out}_{i,t}\right).
$$

After inserting the power-law equation (\ref{eq:powerlaw}) and several rearrangements the formula above can be written
as follows:



$$
h_{i,t} + \mathrm{d} t a_ih^{b_{i}-1}_{i,t} h_{i,t} - \mathrm{d} t \sum_j^{inflows}
a_jh^{b_{j}-1}_{j,t} h_{j,t} = h_{i,t-1} + \mathrm{d} t es_{i,t} - \mathrm{d}
t inf_{i,t}.
$$
Here the known part of the balance equation (rainfall and infiltration) are at the right hand side. To
extract the unknown $h$ form the power law a following rearrangement was used:



\begin{equation}
(1+\mathrm{d} t a_ih^{b_{i}-1}_{i,t})h_{i,t} - \mathrm{d} t \sum_j^{inflows}
a_jh^{b_{j}-1}_{j,t} h_{j,t} = h_{i,t-1} + \mathrm{d} t es_{i,t} -
\mathrm{d} t inf_{i,t}
\label{eq:impl}
\end{equation}

From the equation (\ref{eq:impl}) the system of linear equations can be constructed.

As example, lets show the equation (\ref{eq:impl}) for
$
i=5\ \mathrm{and}\ inflows\in\{7,8,9\}
$:


\begin{dmath}
(1+\Delta T a_5h^{b_{5}-1}_{5,t})h_{5,t} - \Delta T a_7h^{b_{7}-1}_{7,t} h_{7,t} + \Delta T a_8h^{b_{8}-1}_{8,t} h_{8,t} + \Delta T a_9 h^{b_{9}-1}_{9,t} h_{9,t} = h_{5,t-1} + \Delta T es_{5,t} - \Delta T inf_{5,t}.
\end{dmath}

In matrix form the above equation can be written as:



\begin{dmath}
\begin{bmatrix}
\hdots& & & & & & \\
\hdots & 1+\Delta T a_5h^{b_{5}-1}_{5,t} & \hdots & \Delta T a_7h^{b_{7}-1}_{7,t} & \Delta T a_8h^{b_{8}-1}_{8,t} & \Delta T a_9 h^{b_{9}-1}_{9,t} & \hdots \\
\hdots& & & & & & \\
\hdots& && & & & \\
\hdots& && & & & \\
\hdots& && & & & \\

\end{bmatrix}
%
\begin{bmatrix}
\vdots \\
h_{5,t} \\
\vdots \\
h_{7,t} \\
h_{8,t} \\
h_{9,t} \\
\vdots \\
%
\end{bmatrix}
=
\begin{bmatrix}
\vdots \\
h_{5,t-1} + \Delta T es_{5,t} - \Delta T inf_{5,t} \\
\vdots \\
\vdots \\
\vdots \\
\vdots \\
\vdots \\
%
\end{bmatrix}
\label{eq:sys}
\end{dmath}

The system (\ref{eq:sys}) is solved using \texttt{scipy} package method \texttt{root}
using \texttt{krigov} methof that shown the best convergence.


\paragraph{Implicit solution with rill flow} To calculated rill flow the water level in rill and needs to be calculated as
\begin{equation}
h_{rill} = \text{max}(h-h_{crit},0),
\label{eq:hrill2}
\end{equation}
where
\begin{equation}
h_{sheet} = \text{min}(h,h_{crit}).
\label{eq:hsheet2}
\end{equation}

Mannings formula is used to calculated the steady state flow in
the rill assuming rill is a channel (description in section \ref{sec:rill}.
$$
q_{rill} = 1/n R(h_{rill})^{2/3} i^{1/2}
$$


The balance equation becomes
\begin{dmath}
\frac{h_{i,t} - h_{i,t-1} }{\Delta T} =
es_{i,t} + \sum_j^{inflows} a_jh^{b_{j}}_{sh,j,t} + \sum_k^{inflows} 1/n_k R_k(h_{rl,k,t})^{2/3} i_k^{1/2} - inf_{i,t} - a_ih^{b_{i}}_{sh,i,t} - 1/n R(h_{rl,i,t})^{2/3} i^{1/2},
\end{dmath}
where $h_{sheet}$ and $h_{rill}$ are defined as (\ref{eq:hsheet2}) and (\ref{eq:hrill2}).

This formula is rearranged and, for practical purposes, the linear equation is the system is calculated with condition \\
for $h<=h_{crit}$ as
\begin{equation}
\left(\frac{1}{\Delta T}+a_ih^{b_{i}-1}_{i,t}\right)h_{i,t} - \sum_j^{inflows} a_jh^{b_{j}-1}_{j,t} h_{j,t} = \frac{h_{i,t-1}}{\Delta} + es_{i,t} - inf_{i,t}
\end{equation}
%
%
and for $h>h_{crit}$ as
\begin{multline}
\left(\frac{1}{\Delta T}
+ 1/n_i R_i(h_{i,t}-h_{crit,i})^{2/3} i_i^{1/2} \frac{1}{h_{i,t}}\right)h_{i,t} \\
- \sum_k^{inflows} \left( 1/n_k R_k(h_{k,t}-h_{crit,k})^{2/3} i_k^{1/2} \frac{1}{h_{k,t}}\right)h_{k,t}
= \\
\frac{h_{i,t-1} }{\Delta T}
+ es_{i,t}
+ \sum_j^{inflows} a_j h^{b_{j}}_{crit,j}
- inf_{i,t}
- a_i h^{b_{i}}_{crit,i}
\end{multline}
The later system of equations is constructed in similar fashion as the case of (\ref{eq:sys}) and solved with the same solver.



\subsection{Solving instability in calculation}

At higher flow velocities or with inappropriately chosen time step or pixel
size, or if abrupt change in solution occurs, instabilities occurred in
the solution. In the current version of the SMODERP2D program, this problem
is resolved for explicit solution by the Courant-Friedrich-Lewy (CFL)
condition and for implicit solution the model change the time step based on
the number of iterations in the system solution.


\subsubsection{Courant-Friedrich-Lewy condition}
Filling of this condition ensures convergence of the explicit solution if
$\text{CFL} < 1.0$. The general equation of the CFL condition was derived
and adapted for the purposes of the SMODERP2D model to the following form:

\begin{equation}
\text{CFL} = \frac{1}{0.5601}\frac{v \Delta T}{\Delta X}
\label{eq:courrovnice}
\end{equation} where $v$ represents the velocity of surface or channel flow
[$m/s$], $\Delta T$ and $\Delta X$ represent time step and spatial step
respectively. The number 0.5601 was empiricaly shown to improve the
stability. Lower than 1 CFL conditions was also indicated by
\cite{zhang1989modeling, esteves2000overland}.

After completing of single time step, the highest value of CFL determined
from surface runoff using equation (\ref{eq:courrovnice}) is stored. Then,
this value is compared to the critical value of CFL, and according to the
rules illustrated in Table \ref{tab:cflsheet}, the time step length $\Delta
T$ is changed (or not changed). If $\Delta T$ changes, the calculation is
repeated in the given time step using the updated $\Delta T$. The
calculation progresses to the next time only when the stability of the
calculation is guaranteed.

\begin{table}[t!]
\centering
\caption{Criteria for changing the time step based on surface runoff}
\label{tab:cflsheet}
\begin{tabular}{ccc}
\hline
New & $\text{CFL} < 0.75 \lor 1.0 < \text{CFL}$ & $ 0.75 \geq \text{CFL} \geq 1.0 \lor \text{CFL} = 0.0^*$ \\
\hline
\hline
$\Delta T$ & = $\min\left(\frac{0.5601 \Delta X}{v}, \Delta T_{\text{max}}\right)$ & = original $\Delta T$\\
\hline
% \multicolumn{3}{l}{{\small CFL = 0.0 typically in the case when the flow velocity is zero. In that case,}}
\end{tabular}
\end{table}


\subsubsection{Stability in implicit solution}
To ensure the stability in implicit solution, the model checks the number
of iterations in the in the solver of the linear system. High number of
iteration indicate abrupt change in the solution, that leads to instability
in the solution. The changes in time step length follow simple rules, that
are hard-coded to the model in the current version. The rules are as
followsL
\begin{itemize}
\item if the number of iterations exceeds $it_{max}$, then the time step
is multiplied by factor smaller then one.
\item if the number of iterations is lower then $it_{min}$, then the time
step is multiplied by factor larger then one.
\item if the number of iterations is higher then $it_{min}$ and lower
then $it_{max}$, then the time step remains unchanged.
\end{itemize}

17 changes: 10 additions & 7 deletions reference_manual/text_en/title.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

\begin{titlepage} % Suppresses headers and footers on the title page

\centering % Centre everything on the title page
%\centering % Centre everything on the title page

\scshape % Use small caps for all text on the title page

Expand All @@ -12,19 +12,21 @@
% Title
%------------------------------------------------

\begin{center}
\rule{\textwidth}{0pt}\vspace*{-\baselineskip}\vspace*{2pt} % Thick horizontal rule
\rule{\textwidth}{0.4pt} % Thin horizontal rule

\vspace{0.75\baselineskip} % Whitespace above the title

{\LARGE \smod\ - Reference manual} % Title
{\LARGE \bf \smod: Reference manual} % Title

\vspace{0.75\baselineskip} % Whitespace below the title
%\vspace{0.75\baselineskip} % Whitespace below the title

\rule{\textwidth}{0.4pt}\vspace*{-\baselineskip}\vspace{3.2pt} % Thin horizontal rule
\rule{\textwidth}{0pt} % Thick horizontal rule

\vspace{2\baselineskip} % Whitespace after the title block
\end{center}

%------------------------------------------------
% Subtitle
Expand All @@ -42,11 +44,11 @@

\vspace{0.5\baselineskip} % Whitespace before the editors

{\scshape\Large Kavka, Jeřábek, Landa, Pešek \\ ... \\} % Editor list
{\scshape\Large Petr Kavka, Jakub Jeřábek, Martin Landa, Ondřej Pešek}

\vspace{0.5\baselineskip} % Whitespace below the editor list

\textit{CTU in Prague} % Editor affiliation
\textit{Czech Technical University in Prague} % Editor affiliation

\vfill % Whitespace between editor names and publisher logo

Expand All @@ -65,7 +67,6 @@
@ @ @ @ @ @ @ @ @ @ @
@ @ @ @ @ @ @ @ @ @ @
@ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @
\ \ / / / \ \ / \ / / / @ @ @ @ @ @
\ _\/ /_/ \ \/ \/ /_____/ @ @ @ @
\__/ \ / _\___/ @ @ @
Expand All @@ -82,9 +83,11 @@

\vspace{0.3\baselineskip} % Whitespace under the publisher logo

\begin{center}
2024 % Publication year

{\large publisher} % Publisher
%{\large publisher} % Publisher
\end{center}

\end{titlepage}

Expand Down
Loading

0 comments on commit 3c6bd5c

Please sign in to comment.