Skip to content

Commit

Permalink
Change notation for mass flow rate from \dot{m} to \tilde{m}. (modeli…
Browse files Browse the repository at this point in the history
…ca#2645)

* Change notation for mass flow rate from \dot{m} to \tilde{m}.
The reason is that it's the sum of mass flow rates that give \dot{m}
and the terms are not mass-derivatives.
Closes modelica#2644

Co-authored-by: Henrik Tidefelt <henrikt@wolfram.com>
  • Loading branch information
HansOlsson and henrikt-ma committed Oct 5, 2020
1 parent 2158b10 commit b365c0a
Showing 1 changed file with 46 additions and 45 deletions.
91 changes: 46 additions & 45 deletions chapters/derivationofstream.tex
Expand Up @@ -5,21 +5,22 @@ \chapter{Derivation of Stream Equations}\label{derivation-of-stream-equations}

\section{Reasons for avoiding the actual mixing enthalpy in connector definitions}\label{reasons-for-avoiding-the-actual-mixing-enthalpy-in-connector-definitions}

Consider a connection set with \emph{n} connectors. The mixing enthalpy
is defined by the mass balance
Consider a connection set with $n$ connectors, and denote the mass flow rates \lstinline!m_flow! by $\tilde{m}$.
The mixing enthalpy is defined by the mass balance (the general mass-balance for a component has
$\dot{m}=\sum\tilde{m}$ which simplifies for the mixing enthalpy where $m=0$ and thus $\dot{m}=0$)
\begin{equation*}
0=\sum_{j=1}^n\dot{m}_j
0=\sum_{j=1}^n\tilde{m}_j
\end{equation*}
and the energy balance
and similarly the energy balance
\begin{equation*}
0=\sum_{j=1}^n\dot{H}_j
0=\sum_{j=1}^n\tilde{H}_j
\end{equation*}
with
\begin{equation*}
\dot{H}_j=\dot{m}_j
\tilde{H}_j=\tilde{m}_j
\begin{cases}
h_{\mathrm{mix}}&\text{if $\dot{m}_j > 0$}\\
h_{\mathrm{outflow},j}&\text{if $\dot{m}_j \leq 0$}
h_{\mathrm{mix}}&\text{if $\tilde{m}_j>0$}\\
h_{\mathrm{outflow},j}&\text{if $\tilde{m}_j<=0$}
\end{cases}
\end{equation*}
Herein, mass flow rates are positive when entering models (exiting the
Expand All @@ -29,8 +30,8 @@ \section{Reasons for avoiding the actual mixing enthalpy in connector definition
\begin{equation*}
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 \geq 0$}
\frac{\tilde{H}_j}{\tilde{m}_j}&\text{if $\tilde{m}_j<0$}\\
\textrm{arbitrary}&\text{if $\tilde{m}_j \geq 0$}
\end{cases}
\end{equation*}
While these equations are suitable for device-oriented modeling, the
Expand All @@ -57,26 +58,26 @@ \section{Rationale for the formulation of inStream}\label{rationale-for-the-form
\begin{subequations}
\begin{equation}
\begin{split}
0=&\dot{m}_1\cdot
0=&\tilde{m}_1\cdot
\begin{cases}
h_{\mathrm{mix}}&\text{if $\dot{m}_1 > 0$}\\
h_{\mathrm{outflow},1}&\text{if $\dot{m}_1 \leq 0$}
h_{\mathrm{mix}}&\text{if $\tilde{m}_1>0$}\\
h_{\mathrm{outflow},1}&\text{if $\tilde{m}_1 \leq 0$}
\end{cases}\\
+&\dot{m}_2\cdot
+&\tilde{m}_2\cdot
\begin{cases}
h_{\mathrm{mix}}&\text{if $\dot{m}_2 > 0$}\\
h_{\mathrm{outflow},2}&\text{if $\dot{m}_2 \leq 0$}
h_{\mathrm{mix}}&\text{if $\tilde{m}_2>0$}\\
h_{\mathrm{outflow},2}&\text{if $\tilde{m}_2 \leq 0$}
\end{cases}\\
+&\dot{m}_3\cdot
+&\tilde{m}_3\cdot
\begin{cases}
h_{\mathrm{mix}}&\text{if $\dot{m}_3 > 0$}\\
h_{\mathrm{outflow},3}&\text{if $\dot{m}_3 \leq 0$}
h_{\mathrm{mix}}&\text{if $\tilde{m}_3>0$}\\
h_{\mathrm{outflow},3}&\text{if $\tilde{m}_3 \leq $}
\end{cases}
\end{split}
\label{eq:D1a}
\end{equation}
\begin{equation}
0=\dot{m}_1+\dot{m}_2+\dot{m}_3
0=\tilde{m}_1+\tilde{m}_2+\tilde{m}_3
\label{eq:D1b}
\end{equation}
\label{eq:D1}
Expand All @@ -87,18 +88,18 @@ \section{Rationale for the formulation of inStream}\label{rationale-for-the-form
\begin{subequations}
\begin{equation}
\begin{split}
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}
0=&\operatorname{max}(\tilde{m}_1,0)h_{\mathrm{mix}}-\operatorname{max}(-\tilde{m}_1,0)h_{\mathrm{outflow},1}\\
+&\operatorname{max}(\tilde{m}_2,0)h_{\mathrm{mix}}-\operatorname{max}(-\tilde{m}_2,0)h_{\mathrm{outflow},2}\\
+&\operatorname{max}(\tilde{m}_3,0)h_{\mathrm{mix}}-\operatorname{max}(-\tilde{m}_3,0)h_{\mathrm{outflow},3}
\end{split}
\label{eq:D2a}
\end{equation}

\begin{equation}
\begin{split}
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)
0=&\operatorname{max}(\tilde{m}_1,0)-\operatorname{max}(-\tilde{m}_1,0)\\
+&\operatorname{max}(\tilde{m}_2,0)-\operatorname{max}(-\tilde{m}_2,0)\\
+&\operatorname{max}(\tilde{m}_3,0)-\operatorname{max}(-\tilde{m}_3,0)
\end{split}
\label{eq:D2b}
\end{equation}
Expand All @@ -107,13 +108,13 @@ \section{Rationale for the formulation of inStream}\label{rationale-for-the-form

Equation \eqref{eq:D2a} is solved for $h_{\mathrm{mix}}$
\begin{equation*}
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)}
h_{\mathrm{mix}}=\frac{\operatorname{max}(-\tilde{m}_1,0)h_{\mathrm{outflow},1}+\operatorname{max}(-\tilde{m}_2,0)h_{\mathrm{outflow},2}+\operatorname{max}(-\tilde{m}_3,0)h_{\mathrm{outflow},3}}
{\operatorname{max}(\tilde{m}_1,0)+\operatorname{max}(\tilde{m}_2,0)+\operatorname{max}(\tilde{m}_3,0)}
\end{equation*}
Using \eqref{eq:D2b}, the denominator can be changed to:
\begin{equation*}
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)}
h_{\mathrm{mix}}=\frac{\operatorname{max}(-\tilde{m}_1,0)h_{\mathrm{outflow},1}+\operatorname{max}(-\tilde{m}_2,0)h_{\mathrm{outflow},2}+\operatorname{max}(-\tilde{m}_3,0)h_{\mathrm{outflow},3}}
{\operatorname{max}(-\tilde{m}_1,0)+\operatorname{max}(-\tilde{m}_2,0)+\operatorname{max}(-\tilde{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 +128,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_{\mathrm{outflow},i})=h_{\mathrm{mix}}$ assuming that $\dot{m}_{i} \geq 0$. This leads to
We establish this quantity using a dedicated operator $\text{\lstinline!inStream!}(h_{\mathrm{outflow},i})=h_{\mathrm{mix}}$ assuming that $\tilde{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_{\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)}
\text{\lstinline!inStream!}(h_{\mathrm{outflow},1}) &= \frac{\operatorname{max}(-\tilde{m}_2,0)h_{\mathrm{outflow},2}+\operatorname{max}(-\tilde{m}_3,0)h_{\mathrm{outflow},3}}{\operatorname{max}(-\tilde{m}_2,0)+\operatorname{max}(-\tilde{m}_3,0)}\\
\text{\lstinline!inStream!}(h_{\mathrm{outflow},2}) &= \frac{\operatorname{max}(-\tilde{m}_1,0)h_{\mathrm{outflow},1}+\operatorname{max}(-\tilde{m}_3,0)h_{\mathrm{outflow},3}}{\operatorname{max}(-\tilde{m}_1,0)+\operatorname{max}(-\tilde{m}_3,0)}\\
\text{\lstinline!inStream!}(h_{\mathrm{outflow},3}) &= \frac{\operatorname{max}(-\tilde{m}_1,0)h_{\mathrm{outflow},1}+\operatorname{max}(-\tilde{m}_2,0)h_{\mathrm{outflow},2}}{\operatorname{max}(-\tilde{m}_1,0)+\operatorname{max}(-\tilde{m}_2,0)}
\end{align*}
\begin{figure}[H]
\begin{center}
Expand All @@ -146,7 +147,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_{\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)}
\text{\lstinline!inStream!}(h_{\mathrm{outflow},i})=\frac{\sum_{j=1,...,n;j\neq i}\operatorname{max}(-\tilde{m}_j,0)h_{\mathrm{outflow},j}}{\sum_{j=1,...,n;j\neq i}\operatorname{max}(-\tilde{m}_j,0)}
\end{equation*}

\section{Special cases covered by inStream definition}\label{special-cases-covered-by-the-instream-operator-definition}
Expand All @@ -157,8 +158,8 @@ \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_{\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}
\text{\lstinline!inStream!}(h_{\mathrm{outflow},1}) &= \frac{\operatorname{max}(-\tilde{m}_2,0)h_{\mathrm{outflow},2}}{\operatorname{max}(-\tilde{m}_2,0)}=h_{\mathrm{outflow},2}\\
\text{\lstinline!inStream!}(h_{\mathrm{outflow},2}) &= \frac{\operatorname{max}(-\tilde{m}_1,0)h_{\mathrm{outflow},1}}{\operatorname{max}(-\tilde{m}_1,0)}=h_{\mathrm{outflow},1}
\end{align*}

In this case, \lstinline!inStream! is continuous (contrary to $h_{\mathrm{mix}}$) and does not
Expand All @@ -168,23 +169,23 @@ \subsection{Connection of 2 stream connectors, one to one connections (N = 2)}\l
case is treated directly.

\subsection{Connection of 3 stream connectors where one mass flow rate is identical to zero}\label{connection-of-3-stream-connectors-where-one-mass-flow-rate-is-identical-to-zero-n-3-and}
The case where $N=3$ and $\dot{m}_3=0$ occurs when a one-port sensor (like a temperature sensor) is
The case where $N=3$ and $\tilde{m}_3=0$ occurs when a one-port sensor (like a temperature sensor) is
connected to two connected components. For the sensor, the \lstinline!min! attribute
of the mass flow rate should be set to zero (no fluid exiting the
component via this connector).
This simplification (and similar ones) can also be used if a tool determines that a mass flow rate is zero or non-negative.
It is also possible to generalize this to the case where more than one sensor is connected.
The suggested implementation results in
the following equations, and as indicated the last formula can be
simplified further by using $\dot{m}_3=0$:
simplified further by using $\tilde{m}_3=0$:
\begin{align*}
\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)}\\
\text{\lstinline!inStream!}(h_{\mathrm{outflow},3}) &= \frac{\operatorname{max}(-\tilde{m}_1,0)h_{\mathrm{outflow},1}+\operatorname{max}(-\tilde{m}_2,0)h_{\mathrm{outflow},2}}{\operatorname{max}(-\tilde{m}_1,0)+\operatorname{max}(-\tilde{m}_2,0)}\\
&=
\begin{cases}
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$}
h_{\mathrm{outflow},2}&\text{if $\tilde{m}_1 \geq 0$}\\
h_{\mathrm{outflow},1}&\text{if $\tilde{m}_1 < 0$ and $\tilde{m}_3 = 0$}
\end{cases}
\end{align*}
\begin{figure}[H]
Expand Down Expand Up @@ -228,7 +229,7 @@ \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_{\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}
\text{\lstinline!inStream!}(h_{\mathrm{outflow},1})=\frac{\operatorname{max}(-\tilde{m}_2,0)h_{\mathrm{outflow},2}+\operatorname{max}(-\tilde{m}_3,0)h_{\mathrm{outflow},3}}{\operatorname{max}(-\tilde{m}_2,0)+\operatorname{max}(-\tilde{m}_3,0)}=\frac{0}{0}
\end{equation*}

\lstinline!inStream! cannot be evaluated for a connector, on which
Expand All @@ -239,9 +240,9 @@ \subsection{Connection of 3 stream connectors where two mass flow rates are posi
\end{equation*}
For the remaining connectors, \lstinline!inStream! reduces to a simple result.
\begin{align*}
\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},2}) &= \frac{\operatorname{max}(-\tilde{m}_1,0)h_{\mathrm{outflow},1}+\operatorname{max}(-\tilde{m}_3,0)h_{\mathrm{outflow},3}}{\operatorname{max}(-\tilde{m}_1,0)+\operatorname{max}(-\tilde{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)}
\text{\lstinline!inStream!}(h_{\mathrm{outflow},3}) &= \frac{\operatorname{max}(-\tilde{m}_1,0)h_{\mathrm{outflow},1}+\operatorname{max}(-\tilde{m}_2,0)h_{\mathrm{outflow},2}}{\operatorname{max}(-\tilde{m}_1,0)+\operatorname{max}(-\tilde{m}_2,0)}
= h_{\mathrm{outflow},1}
\end{align*}
Again, the previous non-linear algebraic system of equations is removed.
Expand Down

0 comments on commit b365c0a

Please sign in to comment.