.. include:: /images.rst MMS-EX03: One dimensional transient heat equation ------------------------------------------------- .. _description-2: Description ~~~~~~~~~~~ Again consider the gas phase energy equations in MFIX given by equation (2‑25) in the previous example. The energy equations can be recast as the 1-dimensional transient heat equation by imposing the following simplifying assumptions: 1. Calculations are restricted to one dimension. 2. The domain length in the x-axial direction is :math:\text{xϵ}\left\lbrack 0,1 \right\rbrack. 3. | The gas volume fraction, density, thermal conductivity, and specific heat are set to one, | :math:\varepsilon_{g} = 1, :math:\rho_{g} = 1, :math:\kappa_{g} = 1, and :math:C_{\text{pg}} = 1. 4. The gas momentum equations are not solved and initial velocity field is set to zero so that the convective term is zero. 5. There are no chemical reactions, interphase mass transfer or other sources of energy implying: :math:\sum_{n = 1}^{N_{g}}{h_{\text{gn}}R_{\text{gn}}} + \mathcal{S}_{g} = 0. On re-evaluation of the energy equations, the following one-dimensional form (aka the transient heat equation) emerges: .. math:: \frac{\partial T_{g}}{\partial t} - \frac{\partial^{2}T_{g}}{\partial x^{2}} = 0 :label: ex03eq1 Following the MMS approach, the partial differential equation is recast as: .. math:: L\left( x,t \right) = \frac{\partial T_{g}}{\partial t} - \alpha\frac{\partial^{2}T_{g}}{\partial x^{2}} = 0 :label: ex03eq2 As MMS requires the selection of a manufactured solution, a suitable analytic form of appropriate continuous, differential order is chosen. In this case, note that whatever manufactured solution is picked must be continuously differentiable through its second spatial derivative and first temporal derivative. In addition, for illustrative purposes, the manufactured solution is chosen so that time will appear in the boundary conditions. For simplicity, MMS-EX02 is modified by incorporating a time value, *t*, as: .. math:: T_{g}\left( x,t \right) = T_{g0} + T_{\text{gx}}\cos\left( A_{\text{Tgx}}\text{πx} \right) + T_{\text{gt}}\cos\left( A_{\text{Tgt}}\text{πt} \right) + T_{\text{gtx}}\cos\left( A_{\text{Tgtx}}\text{πtx} \right) :label: ex03eq3 with a simple domain: :math:\left\{ t \geq 0,\ \ \ 0 \leq x \leq 1 \right\}. Then, this form is applied to :math:L\left( x,t \right): .. math:: L{(x,t)}_{T_{g}(x,t)} = \frac{\partial}{\partial t}T_{g}\left( x,t \right) - \alpha\frac{\partial^{2}}{\partial x^{2}}T_{g}\left( x,t \right) :label: ex03eq4 .. math:: :label: ex03eq5 L{(x,t)}_{T_{g}(x,t)} =& -T_{\text{gt}}\left( A_{\text{Tgt}}\pi \right)\sin\left( A_{\text{Tgt}}\text{πt} \right) - T_{\text{gxt}}\left( A_{\text{Tgtx}}\text{πx} \right)\sin\left( A_{\text{Tgtx}}\text{πtx} \right) \\ & + \alpha T_{\text{gx}}\left( A_{\text{Tgx}}\pi \right)^{2}\cos\left( A_{\text{Tgx}}\text{πx} \right) + \alpha T_{\text{gtx}}\left( A_{\text{Tgtx}}\pi \right)^{2}\cos\left( A_{\text{Tgtx}}\text{πtx} \right) Then, appropriate initial and/or boundary conditions are cast. For this case, an appropriate initial condition is: .. math:: T_{g}\left( x,0 \right) = T_{g0} + T_{\text{gx}}\cos\left( A_{\text{Tgx}}\text{πx} \right) + T_{\text{gt}} + T_{\text{gtx}} :label: ex03eq6 Focus then shifts to boundary conditions. On the spatial domain of interest: :math:\text{xϵ}\left\lbrack 0,1 \right\rbrack, boundary conditions become: .. math:: \begin{matrix} T_{g}\left( 0,t \right) = T_{g0} + T_{\text{gx}} + T_{\text{gt}}\cos\left( A_{\text{Tgt}}\text{πt} \right) + T_{\text{gtx}} \\ T_{g}\left( 1,t \right) = T_{g0} + T_{\text{gx}}\cos\left( A_{\text{Tgx}}\pi \right) + T_{\text{gt}}\cos\left( A_{\text{Tgt}}\text{πt} \right) + T_{\text{gtx}}\cos\left( A_{\text{Tgtx}}\text{πt} \right) \\ \end{matrix} :label: ex03eq7 Note that these boundary conditions, while Dirichlet in nature, are dependent on time. The parameters chosen in the manufactured solution are summarized below: Table 2‑4: Parameters used in MMS applied to transient heat conduction .. _table6: .. csv-table:: Parameters used in MMS applied to transient heat conduction :widths: auto ":math:T_{g0}", "500 K" ":math:T_{\text{gx}}", "10 K" ":math:T_{\text{gt}}", "100 K" ":math:T_{\text{gtx}}", "10 K" ":math:A_{\text{Tgx}}", "2.0" ":math:A_{\text{Tgt}}", "2.0" ":math:A_{\text{Tgtx}}", "2.0" .. _setup-2: Setup ~~~~~ This case is designed to test the energy equation implementation. .. _table7: .. csv-table:: MMS-EX03 Setup, Initial and Boundary Conditions. :widths: auto :header: "Computational/Physical model", " ", " " "1D, Steady-state, incompressible", " ", " " "Single-phase (no solids)", " ", " " "No gravity", " ", " " "Turbulence equations are not solved (Laminar)", " ", " " "Uniform mesh", " ", " " "Central scheme", " ", " " " ", " ", " " "**Geometry**", " ", " " "Coordinate system", "Cartesian", " " "Domain length, :math:L (x)", "1.0", "$$m$$" " ", " ", " " "**Material** :sup:†", " ", " " "Fluid density, :math:\rho_{g}", "1.0", "(kg·m\ :sup:-3)" "Fluid viscosity, :math:\mu_{g}", "1.0", "(Pa·s)" "Fluid specific heat, :math:C_{pg}", "1.0", "(J·kg\ :sup:-1·K\ :sup:-1)" " ", " ", " " "**Initial Conditions**", " ", " " "Pressure *(gauge)*, :math:P_{g}", "0.0", "(Pa)" "Temperature, :math:T_{g}", "Set with user routine", "$$K$$" " ", " ", " " "**Boundary Conditions** :sup:‡", " ", " " "East/West (x)", "(MMS)", " " "All other boundaries", "Adiabatic Walls", " " **†** Material properties selected to ensure comparable contribution from convection and diffusion terms. :sup:‡ The manufactured solution imposed on the east / west boundaries is given by equation (2‑38). In this case, because boundary conditions change with time, they must be managed by creating a user-defined function (in MFIX, update the standard function usr1.f). User defined functions specific to the MMS implementation in MFIX are used to introduce the source term. Specifically, for each computational cell, equation (2‑36) is evaluated and subtracted from the right hand side of the linear equation. Once the simulation has converged, the :math:L_{1}, :math:L_{2} and :math:L_{\infty} error norms are computed using equation (2‑34). Analysis variation for mixed variable problems ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When analyzing a problem where both transient and spatial order verification must be conducted simultaneously, care must be taken with problem set up. As a first step, to examine temporal order, spatial discretization must be held constant (fixed grid); then, to examine spatial order, temporal discretization must be held constant (fixed time step). Holding either discretization at a constant level introduces a fixed error that applies to all calculations in that group. In a problem such as this, one imagines discretization error as being in two parts: .. math:: DE = \ \text{DE}_{\text{temporal}} + \text{DE}_{\text{spatial}} :label: ex03eq8 When one of these errors is constant, the normed error that is collected to represent overall discretization error contains that constant, albeit one cannot preconceive its value. For example, consider that time step is held constant, and that this choice results in constant temporal discretization error, :math:k: .. math:: \left\| \text{DE} \right\| = \left\| k + \text{DE}_{\text{spatial}} \right\| :label: ex03eq9 Note that the existence of :math:k destroys the notion of equation (2-15) for calculating a one-variable observed order by masking :math:\text{DE}_{\text{spatial}}. To eliminate the effect of :math:k, observed order, :math:\widehat{p}, must be calculated in such a way as to naturally remove its presence. This can be done through subtraction as: .. math:: \widehat{p} = \frac{\ln\left( \frac{\left\| \text{DE}_{\mathcal{l +}2} \right\| - \left\| \text{DE}_{\mathcal{l +}1} \right\|}{\left\| \text{DE}_{\mathcal{l +}1} \right\| - \left\| \text{DE}_{\mathcal{l}} \right\|} \right)}{\ln\left( r \right)} :label: ex03eq10 with the caveat that at least 3 levels of spatial mesh are needed to isolate :math:\widehat{p}. Then, a similar calculation can be conducted by refining time step and using a fixed spatial mesh. If the reader now allows themselves a *thought experiment*, they might be curious how error might manifest itself when the observed order associated with space and the observed order associated with time are equal or non-equal. If equal, and a naïve approach to order calculation is made, one might not detect that an analysis like (2-15) is invalid. However, when non-equal, the naïve approach will result in utter confusion. (Yes, we did it.) To run a combined analysis without the above step where either temporal or spatial discretization is held constant, :cite:Ober_book provides a useful table illustrating refinement factors needed to accurately isolate observed order of spatially and temporally mixed problems in two discretization levels instead of three, by assuring that the spatial and temporal discretization error terms are scaled together as solutions approach their asymptotic range. A portion of that table is given here, as it applies to the problem at hand, where the expectation is a spatial order of 2, and a temporal order of 1. .. _table8: .. csv-table:: Mixed analysis refinement factors :cite:Ober_book; highlighted row for expected spatial order =2, and expected temporal order = 1 based on known MFIX routines :widths: auto :header: "Expected :math:p", "Expected :math:q", ":math:r_{x}", ":math:r_{t}", "Error ratio" "2", "1", "2", "4", "4" "2", "2", "2", ":math:\sqrt[2]{4}", "4" "2", "3", "2", ":math:\sqrt[3]{4}", "4" "2", "4", "2", ":math:\sqrt[4]{4}", "4" Likewise, Richards :cite:Richards1998 summarily defines :math:r_{t} = \left( r_{x} \right)^{\frac{p}{q}}. Using the suggestions from this table (formula) for an expected spatial order, :math:p = 2, and an expected temporal order, :math:q = 1, a calculated observed spatial order, :math:\widehat{p}, and a calculated observed temporal order, :math:\widehat{q} are computed as described in :cite:Ober_book: .. math:: \widehat{p} = \frac{\ln\left( \frac{\left\| \text{DE}_{l + 1} \right\|}{\left\| \text{DE}_{l} \right\|} \right)}{ln\left( r_{x} \right)}, \widehat{q} = \frac{\ln\left( \frac{\left\| \text{DE}_{l + 1} \right\|}{\left\| \text{DE}_{l} \right\|} \right)}{ln\left( r_{t} \right)} :label: ex03eq11 In the following result section, the calculations derived from both methodologies are illustrated. .. _results-2: Results ~~~~~~~ Both methodologies described in section 2.4.3 were implemented to examine temporal and spatial orders of accuracy in the transient heat equation as it applies to MFIX. Temporal order of accuracy ^^^^^^^^^^^^^^^^^^^^^^^^^^ The temporal order of accuracy is determined by fixing the grid size and performing simulations by reducing the time step size. In this case, with spatial domain set to :math:\text{xϵ}\left\lbrack 0,1 \right\rbrack, 16 cells were used corresponding to a coarse discretization. Expectation is that spatial error was significant. The following time step sizes were used: 1.25E-4s, 6.25E-5s, 3.13E-5s, 1.56E-5s, 7.81E-6s, and 3.91E-6s, resulting in a refinement factor, *r*, equal to 2. The observed order of accuracy, :math:\widehat{p}, converges to 1 which is equal to the formal order of the first-order Euler time stepping method utilized in MFIX. .. _table9: .. csv-table:: L norms and the observed order for the unsteady heat equation – temporal order of accuracy [4]_ :widths: auto :align: center :header: "h", *L\* :sub:1-norm, *L\* :sub:2-norm, *L\* :sub:∞-norm, *q* (L\ :sub:1), *q* (L\ :sub:2), *q* (L\ :sub:∞) "1", "9.4156E-02", "1.1189E-01", "1.9267E-01", "1.00", "0.95", "1.00" "2", "9.4175E-02", "1.1182E-01", "1.9260E-01", "1.00", "0.90", "1.00" "4", "9.4214E-02", "1.1168E-01", "1.9244E-01", "1.00", "0.77", "1.00" "8", "9.4291E-02", "1.1143E-01", "1.9214E-01", "1.00", "0.36", "1.00" "16", "9.4444E-02", "1.1101E-01", "1.9153E-01", "N/A", "N/A", "N/A" "32", "9.4751E-02", "1.1047E-01", "1.9031E-01", "N/A", "N/A", "N/A" An example calculation, using h = 1, 2, 4 and :math:L_{1}-norm is given: :math:\widehat{q} = \frac{\ln\left( \frac{\left\| \text{DE}_{\mathcal{l +}2} \right\| - \left\| \text{DE}_{\mathcal{l +}1} \right\|}{\left\| \text{DE}_{\mathcal{l +}1} \right\| - \left\| \text{DE}_{\mathcal{l}} \right\|} \right)}{\ln\left( r \right)} = \frac{\ln\left( \frac{\mathrm{9.4214E - 02} - \mathrm{9.4175E - 02}}{\mathrm{9.4175E - 02} - \mathrm{9.4156E - 02}} \right)}{\ln\left( \frac{\mathrm{1.25e - 4}}{\mathrm{6.25e - 5}} \right)} = 1.00 .. _fig6: .. figure:: /media/image8.jpg :align: center Observed Temporal Order of Accuracy, MMS Solution to 1-D transient heat equation in MFIX Spatial order of accuracy ^^^^^^^^^^^^^^^^^^^^^^^^^ Likewise, spatial order of accuracy is estimated by maintaining a constant time step, 0.005s in this case. On a spatial domain of :math:\text{xϵ}\left\lbrack 0,1 \right\rbrack, grid sizes were 3.12E-2m, 1.56E-2m, 7.81E-3m, 3.91E-3m and 1.95E-3m, resulting in a refinement factor, *r*, equal to 2. The observed order of accuracy, :math:\widehat{p}, converges to 2 which is equal to the formal order of the centered differencing scheme (diffusion term). .. _table10: .. csv-table:: L norms and the observed order for the unsteady heat equation – spatial order of accuracy [5]_ :widths: auto :align: center :header: "h", *L\* :sub:1-norm, *L\* :sub:2-norm, *L\* :sub:∞-norm, *p* (L\ :sub:1), *p* (L\ :sub:2), *p* (L\ :sub:∞) "1", "5.7762E-01", "6.2875E-01", "8.4644E-01", "2.00", "2.01", "1.99" "2", "5.7783E-01", "6.2884E-01", "8.4627E-01", "2.00", "2.03", "2.01" "4", "5.7867E-01", "6.2920E-01", "8.4559E-01", "2.00", "2.11", "2.04" "8", "5.8204E-01", "6.3068E-01", "8.4285E-01", "N/A", "N/A", "N/A" "16", "5.9554E-01", "6.3708E-01", "8.3158E-01", "N/A", "N/A", "N/A" An example calculation, using h = 1, 2, 4 and :math:L_{1}-norm is given: :math:\widehat{p} = \frac{\ln\left( \frac{\left\| \text{DE}_{\mathcal{l +}2} \right\| - \left\| \text{DE}_{\mathcal{l +}1} \right\|}{\left\| \text{DE}_{\mathcal{l +}1} \right\| - \left\| \text{DE}_{\mathcal{l}} \right\|} \right)}{\ln\left( r \right)} = \frac{\ln\left( \frac{\mathrm{5.7867E - 01} - \mathrm{5.7783E - 01}}{\mathrm{5.7783E - 01} - \mathrm{5.7762E - 01}} \right)}{\ln\left( \frac{\mathrm{3.12e - 2}}{\mathrm{1.56e - 2}} \right)} = 2.00 .. _fig7: .. figure:: /media/image9.jpg :align: center Observed Spatial Order of Accuracy, MMS Solution to 1-D transient heat equation in MFIX Combined order analysis ^^^^^^^^^^^^^^^^^^^^^^^ Having tested temporal and spatial discretization independently, a combined order analysis is performed by choosing grid size,\ :math:\ \mathrm{\Delta}x, and time step size, :math:\mathrm{\Delta}t, according to the descriptions in section 2.4.3. Based on the observed order of accuracies, it can be concluded that the energy equation in MFiX is reduced to a Forward Time Centered Space numerical scheme. In such a case, the pertinent non-dimensional number is the Fourier number given by, .. math:: Fo = \ \alpha\frac{\mathrm{\Delta}t}{{\mathrm{\Delta}x}^{2}} :label: ex03eq12 where :math:\alpha represents a diffusivity constant. The stability criterion for a Forward Time Centered Space scheme is :math:Fo < \frac{1}{2}. :math:\text{Fo} = 0.32 was chosen in this study, while :math:\alpha is set to 1. The grid sizes used were 1.25E-1m, 6.25E-2m, 3.13E-2m, 1.56E-2m and 7.81E-3m. The corresponding time-step sizes are obtained as, .. math:: \mathrm{\Delta}t = Fo\frac{{\mathrm{\Delta}x}^{2}}{\alpha} :label: ex03eq13 Note that this observation is in complete agreement with the table presented in section 2.4.3 where the analysis expectation is a problem with spatial order equal 2, and temporal order equal 1, thereby producing :math:r_{t} = \left( r_{x} \right)^{\frac{p}{q}} \rightarrow \mathrm{\Delta}t = Fo\left( \mathrm{\Delta}x \right)^{\frac{2}{1}} . The orders of accuracy were calculated using Equations (2-42). The tables below show that the results from combined order analysis are consistent with the individual verification tests, giving a calculated observed temporal order, :math:\widehat{q} = 1 and a calculated observed spatial order, :math:\widehat{p} = 2. Regardless of temporal or spatial analysis, the calculated norms used in combined order analysis are identical. This idea is illustrated in the following figure and tables. .. _fig8: .. figure:: /media/image10.jpg :align: center Observed Temporal and Spatial Orders of Accuracy using Combined order analysis, MMS Solution to 1-D transient heat equation in MFIX The key difference in calculation is the management of the denominator (related to refinement factor) for :math:\widehat{q} and :math:\widehat{p}. As explained previously, in this case, the refinement factor for time is :math:r_{t} = 4, and the refinement factor for space is :math:r_{x} = 2. .. _table11: .. csv-table:: L norms and the observed order in combined order analysis for the unsteady heat equation – temporal order of accuracy :widths: auto :align: center :header: "h", *L\* :sub:1-norm, *L\* :sub:2-norm, *L\* :sub:∞-norm, *q* (L\ :sub:1), *q* (L\ :sub:2), *q* (L\ :sub:∞) "1", "3.3848E-03", "3.4552E-03", "4.6133E-03", "1.00", "1.00", "1.00" "2", "1.3542E-02", "1.3823E-02", "1.8453E-02", "1.00", "1.00", "1.00" "4", "5.4204E-02", "5.5336E-02", "7.3780E-02", "1.00", "1.00", "1.00" "8", "2.1741E-01", "2.2202E-01", "2.9422E-01", "1.01", "1.01", "0.99" "16", "8.7873E-01", "8.9901E-01", "1.1638E+00", "N/A", "N/A", "N/A" .. _table12: .. csv-table:: L norms and the observed order in combined order analysis for the unsteady heat equation – spatial order of accuracy :widths: auto :align: center :header: "h", *L\* :sub:1-norm, *L\* :sub:2-norm, *L\* :sub:∞-norm, *p* (L\ :sub:1), *p* (L\ :sub:2), *p* (L\ :sub:∞) "1", "3.3848E-03", "3.4552E-03", "4.6133E-03", "2.00", "2.00", "2.00" "2", "1.3542E-02", "1.3823E-02", "1.8453E-02", "2.00", "2.00", "2.00" "4", "5.4204E-02", "5.5336E-02", "7.3780E-02", "2.00", "2.00", "2.00" "8", "2.1741E-01", "2.2202E-01", "2.9422E-01", "2.02", "2.02", "1.98" "16", "8.7873E-01", "8.9901E-01", "1.1638E+00", "N/A", "N/A", "N/A" An example calculation, using h = 2 and 4, with :math:L_{1}-norm is given: .. math:: \widehat{q} = \frac{\ln\left( \frac{\mathrm{5.4204E - 02}}{\mathrm{1.3542E - 02}} \right)}{\ln\left( 4 \right)} = 1.00, \widehat{p} = \frac{\ln\left( \frac{\mathrm{5.4204E - 02}}{\mathrm{1.3542E - 02}} \right)}{\ln\left( 2 \right)} = 2.00 .. [4] Significant digits shown in table may not result in shown values of :math:\widehat{p} because of round-off error. If the reader runs these simulations and holds all significant digits for calculation, :math:\widehat{p} values will match those shown. .. [5] Significant digits shown in table may not result in shown values of :math:\widehat{p} because of round-off error. If the reader runs these simulations and holds all significant digits for calculation, :math:\widehat{p} values will match those shown.