Skip to content

Commit

Permalink
Improve math formatting in derivationofstream.tex
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikt-ma committed Sep 1, 2020
1 parent f559257 commit 13aef69
Showing 1 changed file with 42 additions and 42 deletions.
84 changes: 42 additions & 42 deletions chapters/derivationofstream.tex
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ \section{Reasons for avoiding the actual mixing enthalpy in connector definition
\begin{equation*}
\dot{H}_j=\dot{m}_j
\begin{cases}
h_{mix}&\text{if $\dot{m}_j>0$}\\
h_{outflow,j}&\text{if $\dot{m}_j<=0$}
h_{\mathrm{mix}}&\text{if $\dot{m}_j > 0$}\\
h_{\mathrm{outflow},j}&\text{if $\dot{m}_j \leq 0$}
\end{cases}
\end{equation*}
Herein, mass flow rates are positive when entering models (exiting the
connection set). The specific enthalpy represents the specific enthalpy
inside the component, close to the connector, for the case of outflow.
Expressed with variables used in the balance equations we arrive at:
\begin{equation*}
h_{outflow,j}=
h_{\mathrm{outflow},j}=
\begin{cases}
\frac{\dot{H}_j}{\dot{m}_j}&\text{if $\dot{m}_j<0$}\\
\textrm{arbitrary}&\text{if $\dot{m}_j>=0$}
\textrm{arbitrary}&\text{if $\dot{m}_j \geq 0$}
\end{cases}
\end{equation*}
While these equations are suitable for device-oriented modeling, the
Expand Down Expand Up @@ -59,18 +59,18 @@ \section{Rationale for the formulation of inStream}\label{rationale-for-the-form
\begin{split}
0=&\dot{m}_1\cdot
\begin{cases}
h_{mix}&\text{if $\dot{m}_1>0$}\\
h_{outflow,1}&\text{if $\dot{m}_1<=0$}
h_{\mathrm{mix}}&\text{if $\dot{m}_1 > 0$}\\
h_{\mathrm{outflow},1}&\text{if $\dot{m}_1 \leq 0$}
\end{cases}\\
+&\dot{m}_2\cdot
\begin{cases}
h_{mix}&\text{if $\dot{m}_2>0$}\\
h_{outflow,2}&\text{if $\dot{m}_2<=0$}
h_{\mathrm{mix}}&\text{if $\dot{m}_2 > 0$}\\
h_{\mathrm{outflow},2}&\text{if $\dot{m}_2 \leq 0$}
\end{cases}\\
+&\dot{m}_3\cdot
\begin{cases}
h_{mix}&\text{if $\dot{m}_3>0$}\\
h_{outflow,3}&\text{if $\dot{m}_3<=0$}
h_{\mathrm{mix}}&\text{if $\dot{m}_3 > 0$}\\
h_{\mathrm{outflow},3}&\text{if $\dot{m}_3 \leq 0$}
\end{cases}
\end{split}
\label{eq:D1a}
Expand All @@ -82,38 +82,38 @@ \section{Rationale for the formulation of inStream}\label{rationale-for-the-form
\label{eq:D1}
\end{subequations}

The balance equations are implemented using a max() operator in place of
The balance equations are implemented using a $\operatorname{max}$ operator in place of
the piecewise expressions, taking care of the different flow directions:
\begin{subequations}
\begin{equation}
\begin{split}
0=&\text{max}(\dot{m}_1,0)h_{mix}-\text{max}(-\dot{m}_1,0)h_{outflow,1}\\
+&\text{max}(\dot{m}_2,0)h_{mix}-\text{max}(-\dot{m}_2,0)h_{outflow,2}\\
+&\text{max}(\dot{m}_3,0)h_{mix}-\text{max}(-\dot{m}_3,0)h_{outflow,3}
0=&\operatorname{max}(\dot{m}_1,0)h_{\mathrm{mix}}-\operatorname{max}(-\dot{m}_1,0)h_{\mathrm{outflow},1}\\
+&\operatorname{max}(\dot{m}_2,0)h_{\mathrm{mix}}-\operatorname{max}(-\dot{m}_2,0)h_{\mathrm{outflow},2}\\
+&\operatorname{max}(\dot{m}_3,0)h_{\mathrm{mix}}-\operatorname{max}(-\dot{m}_3,0)h_{\mathrm{outflow},3}
\end{split}
\label{eq:D2a}
\end{equation}

\begin{equation}
\begin{split}
0=&\text{max}(\dot{m}_1,0)-\text{max}(-\dot{m}_1,0)\\
+&\text{max}(\dot{m}_2,0)-\text{max}(-\dot{m}_2,0)\\
+&\text{max}(\dot{m}_3,0)-\text{max}(-\dot{m}_3,0)
0=&\operatorname{max}(\dot{m}_1,0)-\operatorname{max}(-\dot{m}_1,0)\\
+&\operatorname{max}(\dot{m}_2,0)-\operatorname{max}(-\dot{m}_2,0)\\
+&\operatorname{max}(\dot{m}_3,0)-\operatorname{max}(-\dot{m}_3,0)
\end{split}
\label{eq:D2b}
\end{equation}
\label{eq:D2}
\end{subequations}

Equation \eqref{eq:D2a} is solved for $h_{mix}$
Equation \eqref{eq:D2a} is solved for $h_{\mathrm{mix}}$
\begin{equation*}
h_{mix}=\frac{\text{max}(-\dot{m}_1,0)h_{outflow,1}+\text{max}(-\dot{m}_2,0)h_{outflow,2}+\text{max}(-\dot{m}_3,0)h_{outflow,3}}
{\text{max}(\dot{m}_1,0)+\text{max}(\dot{m}_2,0)+\text{max}(\dot{m}_3,0)}
h_{\mathrm{mix}}=\frac{\operatorname{max}(-\dot{m}_1,0)h_{\mathrm{outflow},1}+\operatorname{max}(-\dot{m}_2,0)h_{\mathrm{outflow},2}+\operatorname{max}(-\dot{m}_3,0)h_{\mathrm{outflow},3}}
{\operatorname{max}(\dot{m}_1,0)+\operatorname{max}(\dot{m}_2,0)+\operatorname{max}(\dot{m}_3,0)}
\end{equation*}
Using \eqref{eq:D2b}, the denominator can be changed to:
\begin{equation*}
h_{mix}=\frac{\text{max}(-\dot{m}_1,0)h_{outflow,1}+\text{max}(-\dot{m}_2,0)h_{outflow,2}+\text{max}(-\dot{m}_3,0)h_{outflow,3}}
{\text{max}(-\dot{m}_1,0)+\text{max}(-\dot{m}_2,0)+\text{max}(-\dot{m}_3,0)}
h_{\mathrm{mix}}=\frac{\operatorname{max}(-\dot{m}_1,0)h_{\mathrm{outflow},1}+\operatorname{max}(-\dot{m}_2,0)h_{\mathrm{outflow},2}+\operatorname{max}(-\dot{m}_3,0)h_{\mathrm{outflow},3}}
{\operatorname{max}(-\dot{m}_1,0)+\operatorname{max}(-\dot{m}_2,0)+\operatorname{max}(-\dot{m}_3,0)}
\end{equation*}
Above it was shown that an equation of this type does not yield properly
formulated model equations. In the streams concept we therefore decide
Expand All @@ -127,14 +127,14 @@ \section{Rationale for the formulation of inStream}\label{rationale-for-the-form
it is therefore the mixing enthalpy under the assumption of fluid
flowing into said model.

We establish this quantity using a dedicated operator $\text{\lstinline!inStream!}(h_{outflow,i})=h_{mix}$ assuming that $\dot{m}_{i} >= 0$. This leads to
three different incarnations of (n in the general case). This is
We establish this quantity using a dedicated operator $\text{\lstinline!inStream!}(h_{\mathrm{outflow},i})=h_{\mathrm{mix}}$ assuming that $\dot{m}_{i} \geq 0$. This leads to
three different incarnations of ($n$ in the general case). This is
illustrated in the figure below. For the present example of three
components in a connection set, this means the following.
\begin{align*}
\text{\lstinline!inStream!}(h_{outflow,1}) &= \frac{\text{max}(-\dot{m}_2,0)h_{outflow,2}+\text{max}(-\dot{m}_3,0)h_{outflow,3}}{\text{max}(-\dot{m}_2,0)+\text{max}(-\dot{m}_3,0)}\\
\text{\lstinline!inStream!}(h_{outflow,2}) &= \frac{\text{max}(-\dot{m}_1,0)h_{outflow,1}+\text{max}(-\dot{m}_3,0)h_{outflow,3}}{\text{max}(-\dot{m}_1,0)+\text{max}(-\dot{m}_3,0)}\\
\text{\lstinline!inStream!}(h_{outflow,3}) &= \frac{\text{max}(-\dot{m}_1,0)h_{outflow,1}+\text{max}(-\dot{m}_2,0)h_{outflow,2}}{\text{max}(-\dot{m}_1,0)+\text{max}(-\dot{m}_2,0)}
\text{\lstinline!inStream!}(h_{\mathrm{outflow},1}) &= \frac{\operatorname{max}(-\dot{m}_2,0)h_{\mathrm{outflow},2}+\operatorname{max}(-\dot{m}_3,0)h_{\mathrm{outflow},3}}{\operatorname{max}(-\dot{m}_2,0)+\operatorname{max}(-\dot{m}_3,0)}\\
\text{\lstinline!inStream!}(h_{\mathrm{outflow},2}) &= \frac{\operatorname{max}(-\dot{m}_1,0)h_{\mathrm{outflow},1}+\operatorname{max}(-\dot{m}_3,0)h_{\mathrm{outflow},3}}{\operatorname{max}(-\dot{m}_1,0)+\operatorname{max}(-\dot{m}_3,0)}\\
\text{\lstinline!inStream!}(h_{\mathrm{outflow},3}) &= \frac{\operatorname{max}(-\dot{m}_1,0)h_{\mathrm{outflow},1}+\operatorname{max}(-\dot{m}_2,0)h_{\mathrm{outflow},2}}{\operatorname{max}(-\dot{m}_1,0)+\operatorname{max}(-\dot{m}_2,0)}
\end{align*}
\begin{figure}[H]
\begin{center}
Expand All @@ -146,7 +146,7 @@ \section{Rationale for the formulation of inStream}\label{rationale-for-the-form
In the general case of a connection set with \emph{n} components,
similar considerations lead to the following.
\begin{equation*}
\text{\lstinline!inStream!}(h_{outflow,i})=\frac{\sum_{j=1,...,n;j\neq i}\text{max}(-\dot{m}_j,0)h_{outflow,j}}{\sum_{j=1,...,n;j\neq i}\text{max}(-\dot{m}_j,0)}
\text{\lstinline!inStream!}(h_{\mathrm{outflow},i})=\frac{\sum_{j=1,...,n;j\neq i}\operatorname{max}(-\dot{m}_j,0)h_{\mathrm{outflow},j}}{\sum_{j=1,...,n;j\neq i}\operatorname{max}(-\dot{m}_j,0)}
\end{equation*}

\section{Special cases covered by inStream definition}\label{special-cases-covered-by-the-instream-operator-definition}
Expand All @@ -157,11 +157,11 @@ \subsection{Stream connector is not connected (N = 1)}\label{stream-connector-is
\subsection{Connection of 2 stream connectors, one to one connections (N = 2)}\label{connection-of-2-stream-connectors-one-to-one-connections-n-2}

\begin{align*}
\text{\lstinline!inStream!}(h_{outflow,1}) &= \frac{\text{max}(-\dot{m}_2,0)h_{outflow,2}}{\text{max}(-\dot{m}_2,0)}=h_{outflow,2}\\
\text{\lstinline!inStream!}(h_{outflow,2}) &= \frac{\text{max}(-\dot{m}_1,0)h_{outflow,1}}{\text{max}(-\dot{m}_1,0)}=h_{outflow,1}
\text{\lstinline!inStream!}(h_{\mathrm{outflow},1}) &= \frac{\operatorname{max}(-\dot{m}_2,0)h_{\mathrm{outflow},2}}{\operatorname{max}(-\dot{m}_2,0)}=h_{\mathrm{outflow},2}\\
\text{\lstinline!inStream!}(h_{\mathrm{outflow},2}) &= \frac{\operatorname{max}(-\dot{m}_1,0)h_{\mathrm{outflow},1}}{\operatorname{max}(-\dot{m}_1,0)}=h_{\mathrm{outflow},1}
\end{align*}

In this case, \lstinline!inStream! is continuous (contrary to $h_{mix}$) and does not
In this case, \lstinline!inStream! is continuous (contrary to $h_{\mathrm{mix}}$) and does not
depend on flow rates. The latter result means that this transformation
may remove nonlinear systems of equations, which requires that either
simplifications of the form $a * b / a = b$ must be provided, or that this
Expand All @@ -178,13 +178,13 @@ \subsection{Connection of 3 stream connectors where one mass flow rate is identi
the following equations, and as indicated the last formula can be
simplified further by using $\dot{m}_3=0$:
\begin{align*}
\text{\lstinline!inStream!}(h_{outflow,1}) &= h_{outflow,2}\\
\text{\lstinline!inStream!}(h_{outflow,2}) &= h_{outflow,1}\\
\text{\lstinline!inStream!}(h_{outflow,3}) &= \frac{\text{max}(-\dot{m}_1,0)h_{outflow,1}+\text{max}(-\dot{m}_2,0)h_{outflow,2}}{\text{max}(-\dot{m}_1,0)+\text{max}(-\dot{m}_2,0)}\\
\text{\lstinline!inStream!}(h_{\mathrm{outflow},1}) &= h_{\mathrm{outflow},2}\\
\text{\lstinline!inStream!}(h_{\mathrm{outflow},2}) &= h_{\mathrm{outflow},1}\\
\text{\lstinline!inStream!}(h_{\mathrm{outflow},3}) &= \frac{\operatorname{max}(-\dot{m}_1,0)h_{\mathrm{outflow},1}+\operatorname{max}(-\dot{m}_2,0)h_{\mathrm{outflow},2}}{\operatorname{max}(-\dot{m}_1,0)+\operatorname{max}(-\dot{m}_2,0)}\\
&=
\begin{cases}
h_{outflow,2}&\text{if $\dot{m}_1>=0$}\\
h_{outflow,1}&\text{if $\dot{m}_1<0$ and $\dot{m}_3=0$}
h_{\mathrm{outflow},2}&\text{if $\dot{m}_1 \geq 0$}\\
h_{\mathrm{outflow},1}&\text{if $\dot{m}_1 < 0$ and $\dot{m}_3 = 0$}
\end{cases}
\end{align*}
\begin{figure}[H]
Expand Down Expand Up @@ -228,21 +228,21 @@ \subsection{Connection of 3 stream connectors where two mass flow rates are posi
\end{lstlisting}
results in the following equation:
\begin{equation*}
\text{\lstinline!inStream!}(h_{outflow,1})=\frac{\text{max}(-\dot{m}_2,0)h_{outflow,2}+\text{max}(-\dot{m}_3,0)h_{outflow,3}}{\text{max}(-\dot{m}_2,0)+\text{max}(-\dot{m}_3,0)}=\frac{0}{0}
\text{\lstinline!inStream!}(h_{\mathrm{outflow},1})=\frac{\operatorname{max}(-\dot{m}_2,0)h_{\mathrm{outflow},2}+\operatorname{max}(-\dot{m}_3,0)h_{\mathrm{outflow},3}}{\operatorname{max}(-\dot{m}_2,0)+\operatorname{max}(-\dot{m}_3,0)}=\frac{0}{0}
\end{equation*}

\lstinline!inStream! cannot be evaluated for a connector, on which
the mass flow rate has to be negative by definition. The reason is that
the value is arbitrary, which is why it is defined as follows.
\begin{equation*}
\text{\lstinline!inStream!}(h_{outflow,1}):=h_{outflow,1}
\text{\lstinline!inStream!}(h_{\mathrm{outflow},1}):=h_{\mathrm{outflow},1}
\end{equation*}
For the remaining connectors, \lstinline!inStream! reduces to a simple result.
\begin{align*}
\text{\lstinline!inStream!}(h_{outflow,2}) &= \frac{\text{max}(-\dot{m}_1,0)h_{outflow,1}+\text{max}(-\dot{m}_3,0)h_{outflow,3}}{\text{max}(-\dot{m}_1,0)+\text{max}(-\dot{m}_3,0)}
= h_{outflow,1}\\
\text{\lstinline!inStream!}(h_{outflow,3}) &= \frac{\text{max}(-\dot{m}_1,0)h_{outflow,1}+\text{max}(-\dot{m}_2,0)h_{outflow,2}}{\text{max}(-\dot{m}_1,0)+\text{max}(-\dot{m}_2,0)}
= h_{outflow,1}
\text{\lstinline!inStream!}(h_{\mathrm{outflow},2}) &= \frac{\operatorname{max}(-\dot{m}_1,0)h_{\mathrm{outflow},1}+\operatorname{max}(-\dot{m}_3,0)h_{\mathrm{outflow},3}}{\operatorname{max}(-\dot{m}_1,0)+\operatorname{max}(-\dot{m}_3,0)}
= h_{\mathrm{outflow},1}\\
\text{\lstinline!inStream!}(h_{\mathrm{outflow},3}) &= \frac{\operatorname{max}(-\dot{m}_1,0)h_{\mathrm{outflow},1}+\operatorname{max}(-\dot{m}_2,0)h_{\mathrm{outflow},2}}{\operatorname{max}(-\dot{m}_1,0)+\operatorname{max}(-\dot{m}_2,0)}
= h_{\mathrm{outflow},1}
\end{align*}
Again, the previous non-linear algebraic system of equations is removed.
This means that utilizing the information about uni-directional flow is
Expand Down

0 comments on commit 13aef69

Please sign in to comment.