Appendix L — Solving Missing-Value ODEs

This appendix examines the numerical solution of sets of IVODEs wherein one or more necessary constants are missing, but an equal number of extra final values are known. The missing constants may be initial values of the dependent variables or they may be constants that appear within the IVODEs. Sets of equations of this type are referred to as missing value ordinary differential equations (MVODEs) in Reaction Engineering Basics. This appendix shows that MVODEs can be solved numerically using an ATE solver (see Appendix J) in conjunction with an IVODE solver (see Appendix K). No other solvers are needed.

L.1 Identifying MVODEs and Preparing to Solve Them Numerically

The sets of MVODEs that are solved in Reaction Engineering Basics are linear, first-order ODEs, as was the case for IVODEs in Appendix K. Recall that the initial values used when solving a set of IVODEs are constants, and that constants may also appear within the IVODEs. The values of these constants must be known before the IVODEs can be solved numerically. Recall also that the final value of either the independent variable or one of the dependent variables must also be known in order to solve a set of IVODEs numerically.

The first distinguishing feature of a set of MVODEs is that one or more constants (initial values of the dependent variables and/or constants that appear within the ODEs) are not known and cannot be calculated directly. Herein these constants are referred to as “missing values.” The second distinguishing feature of MVODEs for each missing value, an the final value of an additional dependent variable is known. For example if a set of four MVODEs contains two missing values, then three final values will be known: one for each of the two missing values plus the one needed to solve the IVODEs.

For the purpose of describing how to prepare to solve a set of MVODEs, the following variables will be used.

  • \(x\) - the independent variable
  • \(y_i\) - dependent variable \(i\)
  • \(y_{i,f}\) - the known final value of \(y_i\)
  • \(N_{mv}\) - the number of missing values
  • \(\underline{v}_m\) - the set of missing values.

If the final value of \(x\) is known, it should be used as the stopping criterion (sc), otherwise any one of \(y_{i,f}\) can be used as the stopping criterion. In preparation for solving the MVODEs, each of the \(y_{i,f}\) that is not being used as the stopping criterion should be used to write an implicit ATE for finding \(\underline{v}_m\). More specifically, the final value found by solving the ODEs, \(y_i \big\vert_{sc}\), should be set equal to \(y_{i,f}\) as shown in Equation L.1.

\[ 0 = y_i \big\vert_{sc} - y_{i,f} = \epsilon \tag{L.1}\]

Equation L.1 can be used to write an implicit ATE for each of the \(y_{i,f}\) that is not being used as the stopping criterion. Doing so will yield a set \(N_{mv}\) implicit ATEs that can be solved to find the \(N_{mv}\) missing values. These equations can be seen to be implicit equations for \(\underline{v}_m\) by noting that the final values found by solving the MVODEs, \(y_n \big\vert_{sc}\), depend upon the values of the missing values. Thus, solving these equations amounts to finding the missing values that cause the implicit ATEs to be true.

L.2 Mathematical Formulation of the Numerical Solution of a Set of MVODEs

Having identified the equations as a set of MVODEs with \(N_{mv}\) missing values and having written \(N_{mv}\) implicit ATEs for finding the values of the missing values, mathematical formulation of the solution is quite straightforward. Formulation of the numerical solution of the ODEs proceeds exactly as described in Appendix K. Because the missing values cannot be calculated, the formulation will show \(\underline{v}_m\) as required input for the function that calls the IVODE solver, and those missing values that appear within the ODEs will also be indicated as other input required by the derivatives function.

The formulation of the numerical solution of the implicit ATEs proceeds exactly as described in Appendix J. The missing values are the ATE unknowns, so they will provided as arguments to the residuals function. The residuals function algorithm simply calls the function that solves the IVODEs, extracts the necessary \(y_i \big\vert_{sc}\) from the results, and evaluates the ATE residuals, Equation L.1.

The steps involved in solving the MVODEs then consist of (1) calling the function that solves the implicit ATEs to get the missing values and then (2) calling the function that solves the IVODEs, providing the missing values to it, to get corresponding sets of values of the independent and dependent variables spanning the range from their initial values to the point where the stopping criterion was satisfied.

L.3 Example

The following example illustrates the mathematical formulation of the solution of a set of MVODEs as described above.

L.3.1 Formulation of the Solution of PFR Design Equations with Missing Values

A reaction engineer needs to solve the PFR design equations shown in equations (1) through (3) to find the volumetric flow rate, \(\dot{V}\) and the outlet temperature, \(T\big \vert_{z=L}\). The initial values and stopping criterion are shown in Table L.1. The rate can be calculated using equation (4). The values of \(D\), \(\Delta H\), \(\breve{C}_p\), \(k_0\), \(E\), \(R\), \(L\), \(\dot{n}_{A,0}\), and \(T_0\) are known as is the outlet molar flow rate of A, \(\dot{n}_{A,1}\).

\[ \frac{d\dot{n}_A}{dz} = - \frac{\pi D^2}{4} r \tag{1} \]

\[ \frac{d\dot{n}_Z}{dz} = \frac{\pi D^2}{4} r \tag{2} \]

\[ \frac{dT}{dz} = \frac{-\pi D^2 r \Delta H}{4 \dot{V} \breve{C}_p} \tag{3} \]

Table L.1: Initial values and stopping criterion for solving equations, (1) - (3).
Variable Initial Value Stopping Criterion
\(z\) \(0\) \(L\)
\(\dot{n}_A\) \(\dot{n}_{A,0}\)
\(\dot{n}_Z\) \(0\)
\(T\) \(T_0\)

\[ r= k_0 \exp{\left( \frac{-E}{RT}\right)} \frac{\dot{n}_A}{\dot{V}} \tag{4} \]

The volumetric flow rate, \(\dot{V}\) is unknown and appears in the differential equations. At the same time two final values, \(z=L\) and \(\dot{n}_A = \dot{n}_{A,1}\) are known, making equations (1) through (3) MVODEs. Formulate their solution.


Implicit ATE for Calculating \(\dot{V}\)

\[ 0 = \dot{n}_A \big \vert_{z=L} - \dot{n}_{A,1} = \epsilon \tag{5} \]

ODE Design Equations

Derivatives Function

\(\qquad\) Arguments: \(z\), \(\dot{n}_A\), \(\dot{n}_Z\), and \(T\).

\(\qquad\) Other input: \(\dot{V}\).

\(\qquad\) Return values: \(\frac{d\dot{n}_A}{dz}\), \(\frac{d\dot{n}_Z}{dz}\), and \(\frac{dT}{dz}\).

\(\qquad\) Algorithm:

\(\qquad \qquad\) 1. Calculate other unknowns in the ODE design equations

\[ r= k_0 \exp{\left( \frac{-E}{RT}\right)} \frac{\dot{n}_A}{\dot{V}} \tag{4} \]

\(\qquad \qquad\) 2. Evaluate and return the derivatives using equaions (1) - (3).

Function that solves the ODE design equations

\(\qquad\) Argument: \(\dot{V}\).

\(\qquad\) Algorithm:

  1. Make \(\dot{V}\) available to the derivatives function.
  2. Call an IVODE solver
    1. Passing the initial values, stopping criterion, and the derivatives function as arguments
    2. Receiving \(\underline{z}\), \(\underline{\dot{n}}_A\), \(\underline{\dot{n}}_Z\), and \(\underline{T}\) spanning the range from \(z=0\) to \(z=L\).
  3. Return the results from the IVODE solver.

ATE

Residuals Function

\(\qquad\) Argument: \(\dot{V}\)

\(\qquad\) Return value: \(\epsilon\)

\(\qquad\) Algorithm:

  1. Call the function that solves the ODEs, above
    1. passing \(\dot{V}\) as the argument
    2. receiving \(\underline{z}\), \(\underline{\dot{n}}_A\), \(\underline{\dot{n}}_Z\), and \(\underline{T}\)
  2. evaluate and return \(\epsilon\) using equation (5).

Calculating the Quantities of Interest

  1. Guess a value for \(\dot{V}\).
  2. Call an ATE solver passing the guess and the residuals function, above, as arguments and receiving \(\dot{V}\).
  3. Call the function, above, that solves the ODE design equations passing \(\dot{V}\) as the argument and receiving \(\underline{z}\), \(\underline{\dot{n}}_A\), \(\underline{\dot{n}}_Z\), and \(\underline{T}\).
  4. Extract \(T\big \vert_{z=L}\) from the returned \(\underline{T}\).

L.4 Symbols Used in Appendix L

Symbol Meaning
\(k_0\) Arrhenius pre-exponential factor; an additional subscript indexes the reaction.
\(\dot{n}\) Molar flow rate; additional subscripts denote the reagent and identify the flow stream.
\(r\) Reaction rate; additional subscripts index the reaction.
\(sc\) Stopping criterion.
\(\underline{v}_m\) The set of missing values.
\(x\) Independent variable.
\(y\) Dependent variable, if present the first subscript indexes the dependent variables and a second subscripted \(f\) denotes the final value.
\(z\) Axial distance from the inlet of a PFR.
\(\breve{C}_p\) Volumetric heat capacity.
\(D\) Diameter.
\(E\) Activation energy; an additional subscript indexes the reaction.
\(L\) Length of a PFR.
\(N_{mv}\) Number of missing values.
\(R\) Ideal gas constant.
\(T\) Temperature; an additional subscript denotes the flow stream.
\(\dot{V}\) Volumetric flow rate; an additional subscript denotes the flow stream.
\(\epsilon\) Implicit ATE residual.
\(\Delta H\) Heat of reaction; an additional subscript indexes the reaction.