.. _section-A5.6:

Appendix 5.6: Optional Eulerian Solution for Pipe Temperatures
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

As mentioned in :numref:`section-5.4.1`, a Eulerian calculation can be used to
speed up the pipe temperature calculation if the coolant moves more than
two nodes in a time step. This Eulerian speed-up has only been
implemented for flow in the nominal direction; if flow reversal has
occurred in a pipe, then the Eulerian calculation is not used.

For the Eulerian calculation, :eq:`eq-5.4-1` for the coolant is replaced by

.. math::
	:label: A5.6-1

	\rho_{\text{c}} c_{\text{c}}A_{\text{c}} \frac{\partial \text{T}_{\text{c}}}{\partial \text{t}} + wc_{\text{c}} \frac{\partial \text{T}_{\text{c}}}{\partial \text{z}} = P_{\text{er}} h_{\text{wc} }\left( T_{\text{w}} - T_{\text{c}} \right) + q_c'

:eq:`eq-5.4-2` is still used for the wall. Finite differencing of :eq:`A5.6-1`
gives

.. math::
	:label: A5.6-2

	\rho_{\text{c}} c_{\text{c}}A_{\text{c}}\left\lbrack \frac{T_{\text{c}6\text{j}} + T_{\text{c}6\text{j} + 1} - T_{\text{c}5\text{j}} - T_{\text{c}5\text{j}+1}}{2\delta t} \right\rbrack  \\
	+ \frac{wc_{\text{c}}}{\Delta z} \left\lbrack \theta_{1} \left( T_{\text{c}5\text{j} + 1} - T_{\text{c}5\text{j}} \right) + \theta_{2}\left( T_{\text{c}6\text{j} + 1} - T_{\text{c}6\text{j}} \right) \right\rbrack =  \\
	P_{\text{er}} h_{\text{wc}} \left\{ \theta_{1} \left\lbrack T_{\text{w}5\text{j}} -  \frac{T_{\text{c}5\text{j}} + T_{\text{c}5\text{j} + 1}}{2} \right\rbrack \right. \\ \left.
	+ \theta_{2} \left\lbrack T_{\text{w}6\text{j}} -  \frac{T_{\text{c}6\text{j}} + T_{\text{c}6\text{j} + 1}}{2} \right\rbrack  \right\} +q_{cj}'

Similarly, finite differencing of :eq:`eq-5.4-2` gives

.. math::
	:label: A5.6-3

	\frac{M_{\text{w}} C_{\text{w}}}{\delta t} \left( T_{\text{w}6\text{j}} - T_{\text{w}5\text{j}} \right) = P_{\text{er}} h_{\text{wc}} \left\lbrack \theta_{1} \left( \frac{T_{\text{c}5\text{j}}
	+ T_{\text{c}5\text{j} + 1}}{2} - T_{\text{w}5\text{j}} \right) \right. \\ \left.
	+ \theta_{2} \left( \frac{T_{\text{c}6\text{j}} + T_{\text{c}6\text{j} + 1}}{2} - T_{\text{w}6\text{j}} \right) \right\rbrack \\
	+ \left( hA \right)_{\text{snk}} \left( T_{\text{snk}} - \theta_{1} T_{\text{w}5\text{j}} - \theta_{2} T_{\text{w}6\text{j}} \right) + q_{wj}'


:eq:`A5.6-3` can be rewritten as

.. math::
	:label: A5.6-4

	T_{\text{w}6\text{j}} = B_{\text{w}0\text{j}} + B_{\text{w}1\text{j}} \left( T_{\text{c}6\text{j}} + T_{\text{c}6\text{j} + 1} \right)

where

.. math::
	:label: A5.6-5

	B_{\text{w}1\text{j}} = \frac{P_{\text{er}} h_{\text{wc}} \theta_{2}\delta t}{2 d_{\text{w}}}

.. math::
	:label: A5.6-6

	d_{\text{w}} = M_{\text{w}} C_{\text{w}} + \theta_{2} \delta t \left\lbrack P_{\text{er}} h_{\text{wc}} + \left( hA \right)_{\text{snk}} \right\rbrack

and

.. math::
	:label: A5.6-7

	B_{\text{w}0\text{j}} =  \left\{ M_{\text{w}} C_{\text{w}} T_{\text{w}5\text{j}} + P_{\text{er}} h_{\text{wc}} \theta_{1} \delta t \left\lbrack \frac{T_{\text{c}5\text{j}} + T_{\text{c}5\text{j} + 1}}{2} - T_{\text{w}5\text{j}} \right\rbrack \right. \\ \left.
	+ \left( hA \right)_{\text{snk}} \delta t \left( T_{\text{snk}} - \theta_{1} T_{\text{w}5\text{j}} \right) + q_{wj}' \delta t \right\} \big/ d_{\text{w}}

Similarly, :eq:`A5.6-2` can be rewritten as

.. math::
	:label: A5.6-8

	T_{\text{c}6\text{j} + 1} = B_{\text{c}0\text{j}} + B_{\text{c}1\text{j}} T_{\text{c}6\text{j}} + B_{\text{c}2\text{j}} T_{\text{w}6\text{j}}

where

.. math::
	:label: A5.6-9

	B_{\text{c}0\text{j}} = \left\{ \Delta z \rho_{\text{c}} c_{\text{c}} A_{\text{c}} \left( T_{\text{c}5\text{j}} + T_{\text{c5j} + 1} \right) + 2\theta_{1} \delta t w c_{\text{c}} \left( T_{\text{c}5\text{j}} - T_{\text{c}5\text{j} + 1} \right) \right. \\ \left.
	+ 2 \theta_{1} \delta t \Delta z P_{\text{er}} h_{\text{wc}} \left\lbrack T_{\text{w}5\text{j}} - \frac{T_{\text{c}5\text{j}} + T_{\text{c}5\text{j} + 1}}{2} \right\rbrack + 2\delta t \Delta z q_{cj}' \right\} \big/ d_{\text{c}}

.. math::
	:label: A5.6-10

	d_{\text{c}} = \rho_{\text{c}} c_{\text{c}} A_{\text{c}} \Delta z + 2\theta_{2} \delta t \left( wc_{\text{c}} + \frac{P_{\text{er}} h_{\text{wc}}}{2} \Delta z \right)

.. math::
	:label: A5.6-11

	B_{\text{c}1\text{j}} =  - \left\{ \rho_{\text{c}} c_{\text{c}} A_{\text{c}} \Delta z + 2\theta_{2} \delta t \left( \frac{P_{\text{er}} h_{\text{wc}}}{2} \Delta z - wc_{\text{c}} \right)  \right\} \big/ d_{\text{c}}

and

.. math::
	:label: A5.6-12

	B_{\text{c}2\text{j}} = \frac{2\theta_{2} \delta t\Delta z P_{\text{er}} h_{\text{wc}}}{d_{\text{c}}}

:eq:`A5.6-4` and :eq:`A5.6-8` can be combined to give

.. math::
	:label: A5.6-13

	T_{\text{c}6\text{j} + 1} = B_{\text{cc}0\text{j}} + B_{\text{cc}1\text{j}} T_{\text{c}6\text{j}}

where

.. math::
	:label: A5.6-14

	B_{\text{cc}0\text{j}} = \frac{B_{\text{c}0\text{j}} + B_{\text{c}2\text{j}} B_{\text{w}0\text{j}}}{1 - B_{\text{c}2\text{j}} B_{\text{w}1\text{j}}}

and

.. math::
	:label: A5.6-15

	B_{\text{cc}1\text{j}} = \frac{B_{\text{c}1\text{j}} + B_{\text{c}2\text{j}} B_{\text{w}1\text{j}}}{1 - B_{\text{c}2\text{j}} B_{\text{w}1\text{j}}}

Note that :math:`B_{\text{cc}0\text{j}}` and
:math:`B_{\text{cc}1\text{j}}` can be calculated before the temperatures
at the end of the sub-interval are known.

The pipe inlet temperature at the end of the step is used to set the
first coolant temperature, :math:`T_{\text{c}61}`. The code marches
along the pipe, using :eq:`A5.6-13` to calculate
:math:`T_{\text{c}6\text{j}+1}` after :math:`T_{\text{c}6\text{j}}` has
been calculated. After the coolant temperatures have been calculated,
:eq:`A5.6-4` is used to calculate the wall temperatures.