Abstract
This article presents a new methodology called deep Theory of FunctionalConnections (TFC) that estimates the solutions of partial differentialequations (PDEs) by combining neural networks with TFC. TFC is used totransform PDEs with boundary conditions into unconstrained optimizationproblems by embedding the boundary conditions into a "constrained expression."In this work, a neural network is chosen as the free function, and used tosolve the now unconstrained optimization problem. The loss function is taken asthe square of the residual of the PDE. Then, the neural network is trained inan unsupervised manner to solve the unconstrained optimization problem. Thismethodology has two major differences when compared with popular methods usedto estimate the solutions of PDEs. First, this methodology does not need todiscretize the domain into a grid, rather, this methodology randomly samplespoints from the domain during the training phase. Second, after training, thismethodology represents a closed form, analytical, differentiable approximationof the solution throughout the entire training domain. In contrast, otherpopular methods require interpolation if the estimated solution is desired atpoints that do not lie on the discretized grid. The deep TFC method forestimating the solution of PDEs is demonstrated on four problems with a varietyof boundary conditions.
Quick Read (beta)
Deep Theory of Functional Connections: A New Method for Estimating the Solutions of PDEs
Abstract
This article presents a new methodology called deep Theory of Functional Connections (TFC) that estimates the solutions of partial differential equations (PDEs) by combining neural networks with TFC. TFC is used to transform PDEs with boundary conditions into unconstrained optimization problems by embedding the boundary conditions into a “constrained expression.” In this work, a neural network is chosen as the free function, and used to solve the now unconstrained optimization problem. The loss function is taken as the square of the residual of the PDE. Then, the neural network is trained in an unsupervised manner to solve the unconstrained optimization problem. This methodology has two major differences when compared with popular methods used to estimate the solutions of PDEs. First, this methodology does not need to discretize the domain into a grid, rather, this methodology randomly samples points from the domain during the training phase. Second, after training, this methodology represents a closed form, analytical, differentiable approximation of the solution throughout the entire training domain. In contrast, other popular methods require interpolation if the estimated solution is desired at points that do not lie on the discretized grid. The deep TFC method for estimating the solution of PDEs is demonstrated on four problems with a variety of boundary conditions.
1 Introduction
Partial differential equations are a powerful mathematical tool that is used to model physical phenomena, and their solutions are used in the design and verification processes of a variety of systems. For example, the solution of PDEs may be used to verify that the loads experienced by a beam throughout its lifetime will not cause the beam to fail. Many methods exist to approximate the solutions of PDEs. The most famous of these methods is the finite element method (FEM) [FEA1, FEA2, FEA3]. FEM has been incredibly successful in approximating the solution to PDEs in a variety of fields including structures, fluids, and acoustics. However, FEM does have some drawbacks.
FEM discretizes the domain into elements. This works well for lowdimensional cases, but the number of elements grows exponentially with the number of dimensions. Therefore, the discretization becomes prohibitive as the number of dimensions increases. Another issue is that FEM solves the PDE at discrete nodes, but if the solution is needed at locations different than these nodes, an interpolation scheme must be used.
Reference [ModernPDE] explored the use of neural networks to solve PDEs, and showed that the use of neural networks avoids these problems. Rather than discretizing the entire domain into a number of elements that grows exponentially with the dimension, neural networks can sample points randomly from the domain. Moreover, once the neural network is trained, it is a closed form, analytical, differentiable approximation of the PDE. Therefore, no interpolation scheme is needed when estimating the solution at points that did not appear during training, and further analytical manipulation of the solution can be done with ease. Furthermore, Ref. [ModernPDE] compared the neural network method with FEM on a set of test points that did not appear during training (i.e. points that were not the nodes in the FEM solution), and showed that the solution obtained by the neural network generalized well to points outside of the training data. In fact, the maximum error on the test set of data was never more than the maximum error on the training set of data. In contrast, the FEM had more error on the test set than on the training set. In one case, the test set had approximately 3 orders of magnitude more error than the training set.
Reference [ModernPDE] is not the first article to explore the use of neural networks to solve PDEs. One of the early papers on the topic was Ref. [OrigOdePde]. Although Ref. [ModernPDE] improved what was presented in [OrigOdePde] in almost every way, one item that was missing was exact satisfaction of the boundary constraints. The solution for PDEs presented by Ref. [OrigOdePde] used a method similar to the Coon’s Patch [CoonsPatch] to satisfy the boundary constraints exactly.
Exact boundary constraint satisfaction is of interest for a variety of problems, especially when the boundary value information is known to a high degree of precision. This is especially useful for physics informed problems. Take for example, using the heat equation to describe the temperature within a rod. If the temperature on the edges of the rod is know to a high degree of precision, and the heat equation is being used to estimate the temperature inside the rod, then the only information that is known for sure a priori is the boundary conditions. Hence, it is desired to have the boundary conditions of the rod met exactly. Moreover, embedding the boundary conditions means that the neural network only needs to sample points from the interior of the domain, not the domain and the boundary. Thus, a method for embedding boundary conditions for PDEs of arbitrary dimension is desired. Luckily, a framework for embedding constraints into machine learning algorithms has already been invented: the Theory of Functional Connections (TFC) [SVMTFC]. In Ref. [SVMTFC], TFC was used to embed constraints into support vector machines, but left embedding constraints into neural networks to future work. This research shows how to embed constraints into neural networks, and leverages this technique to numerically estimate the solutions of PDEs.
TFC is a framework that is able to satisfy many types of boundary conditions while maintaining a function that can be freely chosen. This free function can be chosen, for example, to minimize the residual of a differential equation. TFC has already been used to solve differential equations with initial value constraints, boundary value constraints, relative constraints, integral constraints, and infinite constraints [TFC, LDE, NDE, TFCInt]. Recently, the framework was extended to $n$ dimensions [MTFC] for constraints on the value and flux of $n1$ dimensional manifolds. This means the framework can now generate constrained expressions that satisfy the boundary constraints of multidimensional PDEs [MTFCPDE].
2 Theory of Functional Connections
The Theory of Functional Connections (TFC) is a mathematical framework designed to turn constrained problems into unconstrained problems. This is accomplished through the use of the constrained expression, which is a mathematical expression that represents the family of all possible functions that satisfy the problem’s constraints. This technique is especially useful when solving PDEs, as it transforms the PDE into an unconstrained optimization problem. TFC has two major steps: 1) embed the boundary conditions of the problem into the constrained expression 2) solve the now unconstrained optimization problem. The paragraphs that follow will explain these steps in more detail.
The TFC framework is easiest to understand when explained via an example, like a simple harmonic oscillator. Equation (1) gives an example of a simple harmonic oscillator problem.
$$m{y}^{\prime \prime}+ky=0\mathit{\hspace{1em}}\text{subject to:}\{\begin{array}{cc}y(0)={y}_{0}\hfill & \\ {y}^{\prime}(0)={y}_{0}^{\prime}\hfill & \end{array}$$  (1) 
Step one of the TFC framework is to build the constrained expression. The constrained expression consists of two parts; the first part is a function that satisfies the boundary constraints, and the second part projects the freefunction, $g(\text{\mathbf{x}})$, onto the hypersurface of functions that are equal to zero at the boundaries. For problems with boundary and derivative constraints, the constrained expression can be written compactly using Eq. (2).
$f(\text{\mathbf{x}})={\mathcal{M}}_{{i}_{1},{i}_{2},\mathrm{\dots},{i}_{n}}(c(\text{\mathbf{x}})){v}_{{i}_{1}}({x}_{1}){v}_{{i}_{2}}({x}_{2})\mathrm{\dots}{v}_{{i}_{n}}({x}_{n})+$  (2)  
$g(\text{\mathbf{x}}){\mathcal{M}}_{{i}_{1},{i}_{2},\mathrm{\dots},{i}_{n}}(g(\text{\mathbf{x}})){v}_{{i}_{1}}({x}_{1}){v}_{{i}_{2}}({x}_{2})\mathrm{\dots}{v}_{{i}_{n}}({x}_{n})$ 
where x is a vector of the independent variables, ${\left\{\begin{array}{ccc}\hfill {x}_{1}\hfill & \hfill {x}_{2}\hfill & \hfill \mathrm{\dots}{x}_{n}\hfill \end{array}\right\}}^{T}$, $\mathcal{M}$ is an $n$th order tensor containing the boundary conditions $c(\text{\mathbf{x}})$, ${v}_{{i}_{1}}\mathrm{\dots}{v}_{{i}_{n}}$ are vectors whose elements are functions of the independent variables, $g(\text{\mathbf{x}})$ is the freefunction that can be chosen to be anything^{1}^{1} 1 More specifically, the free function $g(\text{\mathbf{x}})$ can be chosen to be any function as long as that function is defined at the constraints., and $f(\text{\mathbf{x}})$ is the constrained expression. The first term in $f(\text{\mathbf{x}})$ satisfies the boundary conditions, and the final two terms project the freefunction, $g(\text{\mathbf{x}})$, onto the space of functions that vanish at the constraints.
For one dimension with independent variable ${x}_{1}$ on the domain $[0,1]$ and for boundary and firstderivative constraints only, $\mathcal{M}$ has the following form,
$$\mathcal{M}(c({x}_{1}))=\left[\begin{array}{cccc}\hfill c(0)\hfill & \hfill {c}_{{x}_{1}}(0)\hfill & \hfill c(1)\hfill & \hfill {c}_{{x}_{1}}(1)\hfill \end{array}\right].$$ 
The values of $\mathcal{M}$ that are unused are eliminated, and the vector, $v$, is created afterwards with the appropriate size. For the one dimensional simple harmonic oscillator, $\mathcal{M}$ and $v$ are given by Eq. (3).
$\mathcal{M}(c({x}_{1}))$  $=\left[\begin{array}{cc}\hfill c(0)\hfill & \hfill {c}_{{x}_{1}}(0)\hfill \end{array}\right]$  (3)  
$v$  $=\left[\begin{array}{c}\hfill {p}^{1}({x}_{1})\hfill \\ \hfill {p}^{2}({x}_{1})\hfill \end{array}\right]$ 
where ${p}^{1}({x}_{1})$ and ${p}^{2}({x}_{1})$ are functions that need to be solved for. Substituting everything into the constrained expression, $f({x}_{1})$, and simplifying yields Eq. (4).
$$f({x}_{1})={p}^{1}({x}_{1})\left(b(0)g(0)\right)+{p}^{2}({x}_{1})\left({b}_{{x}_{1}}(0){g}_{{x}_{1}}(0)\right)+g({x}_{1})$$  (4) 
The functions ${p}_{1}({x}_{1})$ and ${p}_{2}({x}_{1})$ are solved for by setting the constrained expression, $f({x}_{1})$, equal to the boundary constraints at the boundaries. For the simple harmonic oscillator this yields the set of simultaneous equations given by Eqs. (5) and (6).
$$b(0)={p}^{1}(0)\left(b(0)g(0)\right)+{p}^{2}(0)\left({b}_{{x}_{1}}(0){g}_{{x}_{1}}(0)\right)+g(0)$$  (5) 
$${b}_{t}(0)={p}_{{x}_{1}}^{1}(0)\left(b(0)g(0)\right)+{p}_{{x}_{1}}^{2}(0)\left({b}_{{x}_{1}}(0){g}_{{x}_{1}}(0)\right)+{g}_{{x}_{1}}(0)$$  (6) 
Equation (5) shows that ${p}^{1}(0)=1$ and ${p}^{2}(0)=0$, and Eq. (6) shows that ${p}_{{x}_{1}}^{1}(0)=0$ and ${p}_{{x}_{1}}^{2}(0)=1$. One solution to this set of simultaneous equations is ${p}^{1}({x}_{1})=1$ and ${p}^{2}({x}_{1})={x}_{1}$. Substituting these results back into the constrained expression and substituting $b(0)={y}_{0}$ and ${b}_{{x}_{1}}(0)={\dot{y}}_{0}$ yields Eq. (7).
$$f({x}_{1})=g({x}_{1})+{y}_{0}g(0)+t\left({y}_{0}^{\prime}{g}_{{x}_{1}}(0)\right)$$  (7) 
Notice that for any function $g({x}_{1})$, the boundary conditions will always be satisfied exactly. Therefore, solving the differential equation has now become an unconstrained optimization problem. This unconstrained optimization problem could be cast in the following way. Let the function to be minimized, $\mathcal{L}$, be equal to the square of the residual of the differential equation,
$$\mathcal{L}({x}_{1})={\left(m{f}^{\prime \prime}({x}_{1})+kf({x}_{1})\right)}^{2}.$$ 
This function is to be minimized by varying the function $g({x}_{1})$. One way to do this is to make $g({x}_{1})$ a linear combination of a series of basis functions, and minimize the coefficients that multiply those basis functions via leastsquares or some other optimization technique. For an example of this implementation via Chebyshev Orthogonal Polynomials see [LDE]. Also, [NDE] shows how this can be done using nonlinear least squares for nonlinear ODEs.
2.1 $n$Dimensional Constrained Expressions
The previous example derived the constrained expression by creating and solving a series of simultaneous algebraic equations. This technique works well for constrained expressions in one dimension; however, a different, more mechanized formalism exists that is useful for deriving these expression in $n$ dimensions for constraints on the value and flux of $n1$ dimensional manifolds [MTFC]. This formalism shows how to construct the two portions of the constrained expression shown in Eq. (2): 1) $n$th order tensor $\mathcal{M}$ 2) the $n$ vectors, $v$.
Before discussing how to build the $\mathcal{M}$ tensor and $v$ vectors, let’s introduce some mathematical notation. Let $k\in [1,n]$ be an index used to denote the $k$th dimension. Let ${}^{k}c_{p}^{d}:={\frac{{\partial}^{d}c(\text{\mathbf{x}})}{\partial {x}_{k}^{d}}}_{{x}_{k}=p}$ be the constraint specified by taking the $d$th derivative of the constraint function, $c(\text{\mathbf{x}})$, evaluated at the ${x}_{k}=p$ hyperplane. Further, let ${}^{k}c_{{\text{\mathbf{p}}}_{k}}^{{\text{\mathbf{d}}}_{k}}$ be the vector of ${\mathrm{\ell}}_{k}$ constraints defined at the ${x}_{k}={\text{\mathbf{p}}}_{k}$ hyperplanes with derivative orders of ${\text{\mathbf{d}}}_{k}$, where ${\text{\mathbf{p}}}_{k}$ and ${\text{\mathbf{d}}}_{k}\in {\mathcal{R}}^{{\mathrm{\ell}}_{k}}$. In addition, let’s define a boundary condition operator ${}^{k}b_{p}^{d}$ that takes the $d$th derivative with respect to ${x}_{k}$ of a function, and then evaluates that function at the ${x}_{k}=p$ hyperplane. Mathematically,
$${}^{k}b_{p}^{d}[f(\text{\mathbf{x}})]={\frac{{\partial}^{d}f(\text{\mathbf{x}})}{\partial {x}_{k}^{d}}}_{{x}_{k}=p}$$ 
This mathematical notation will be used to introduce a stepbystep method for building the $\mathcal{M}$ tensor. This stepbystep process will be be illustrated via a 3dimensional example that has Dirichlet boundary conditions in ${x}_{1}$ and initial conditions in ${x}_{2}$ and ${x}_{3}$ on the domain ${x}_{1},{x}_{2},{x}_{3}\in [0,1]\times [0,1]\times [0,1]$. The $\mathcal{M}$ tensor is constructed using the following three rules.

1.
The element ${\mathcal{M}}_{111}=0$.

2.
The first order subtensor of $\mathcal{M}$ specified by keeping one dimension’s index free and setting all other dimension’s indices to 1 consists of the value $0$ and the boundary conditions for that dimension. Mathematically,
$${\mathcal{M}}_{1,\mathrm{\dots},1,{i}_{k},1,\mathrm{\dots},1}=\left\{\begin{array}{c}\hfill 0{,}^{k}{c}_{{\text{\mathbf{p}}}_{k}}^{{\text{\mathbf{d}}}_{k}}\hfill \end{array}\right\}.$$ Using the example boundary conditions,
${\mathcal{M}}_{{i}_{1}11}={[0,c(0,{x}_{2},{x}_{3}),c(1,{x}_{2},{x}_{3})]}^{T}$ ${\mathcal{M}}_{1{i}_{2}1}={[0,c({x}_{1},0,{x}_{3}),{c}_{{x}_{2}}({x}_{1},0,{x}_{3})]}^{T}$ (8) ${\mathcal{M}}_{11{i}_{3}}={[0,c({x}_{1},{x}_{2},0),{c}_{{x}_{3}}({x}_{1},{x}_{2},0)]}^{T}.$ 
3.
The remaining elements of the $\mathcal{M}$ tensor are those with at least two indices different from one. These elements are the geometric intersection of the boundary condition elements of the first order tensors given in Eq. (2), plus a sign ($+$ or $$) that is determined by the number of elements being intersected. Mathematically this can be written as,
$${\mathcal{M}}_{{i}_{1}{i}_{2}\mathrm{\dots}{i}_{n}}{=}^{1}{b}_{{\text{\mathbf{p}}}_{{i}_{1}1}^{1}}^{{\text{\mathbf{d}}}_{{i}_{1}1}^{1}}{[}^{2}{b}_{{\text{\mathbf{p}}}_{{i}_{2}1}^{2}}^{{\text{\mathbf{d}}}_{{i}_{2}1}^{2}}\left[\mathrm{\dots}{[}^{n}{b}_{{\text{\mathbf{p}}}_{{i}_{n}1}^{n}}^{{\text{\mathbf{d}}}_{{i}_{n}1}^{n}}[c(\text{\mathbf{x}})]]\mathrm{\dots}\right]]{(1)}^{m+1},$$ where $m$ is the number of indices different than one. Using the example boundary conditions we give three examples:
${M}_{133}={c}_{{x}_{2}{x}_{3}}({x}_{1},0,0)$ ${M}_{221}=c(0,0,{x}_{3})$ ${M}_{332}={c}_{{x}_{2}}(1,0,0)$
A simple procedure also exists for constructing the $v$ vectors. The $v$ vectors have a standard form:
$${\text{\mathbf{v}}}_{k}=\left\{\begin{array}{ccccc}\hfill 1,\hfill & \hfill \sum _{i=1}^{{\mathrm{\ell}}_{k}}{\alpha}_{i1}{h}_{i}({x}_{k}),\hfill & \hfill \sum _{i=1}^{{\mathrm{\ell}}_{k}}{\alpha}_{i2}{h}_{i}({x}_{k}),\hfill & \hfill \mathrm{\dots},\hfill & \hfill \sum _{i=1}^{{\mathrm{\ell}}_{k}}{\alpha}_{i{\mathrm{\ell}}_{k}}{h}_{i}({x}_{k})\hfill \end{array}\right\},$$ 
where ${h}_{i}({x}_{k})$ are ${\mathrm{\ell}}_{k}$ linearly independent functions. The simplest set of linearly independent functions, and those most often used in the TFC constrained expressions, are monomials, ${h}_{i}({x}_{k})={x}_{k}^{i1}$. The ${\mathrm{\ell}}_{k}\times {\mathrm{\ell}}_{k}$ coefficients, ${\alpha}_{ij}$, can be computed by matrix inversion,
$$\left[\begin{array}{cccc}\hfill {}^{k}{b}_{{p}_{1}}^{{d}_{1}}[{h}_{1}]\hfill & \hfill {}^{k}{b}_{{p}_{1}}^{{d}_{1}}[{h}_{2}]\hfill & \hfill \mathrm{\dots}\hfill & \hfill {}^{k}{b}_{{p}_{1}}^{{d}_{1}}[{h}_{{\mathrm{\ell}}_{k}}]\hfill \\ \hfill {}^{k}{b}_{{p}_{2}}^{{d}_{2}}[{h}_{1}]\hfill & \hfill {}^{k}{b}_{{p}_{2}}^{{d}_{2}}[{h}_{2}]\hfill & \hfill \mathrm{\dots}\hfill & \hfill {}^{k}{b}_{{p}_{2}}^{{d}_{2}}[{h}_{{\mathrm{\ell}}_{k}}]\hfill \\ \hfill \mathrm{\vdots}\hfill & \hfill \mathrm{\vdots}\hfill & \hfill \mathrm{\ddots}\hfill & \hfill \mathrm{\vdots}\hfill \\ \hfill {}^{k}{b}_{{p}_{{\mathrm{\ell}}_{k}}}^{{d}_{{\mathrm{\ell}}_{k}}}[{h}_{1}]\hfill & \hfill {}^{k}{b}_{{p}_{{\mathrm{\ell}}_{k}}}^{{d}_{{\mathrm{\ell}}_{k}}}[{h}_{2}]\hfill & \hfill \mathrm{\dots}\hfill & \hfill {}^{k}{b}_{{p}_{{\mathrm{\ell}}_{k}}}^{{d}_{{\mathrm{\ell}}_{k}}}[{h}_{{\mathrm{\ell}}_{k}}]\hfill \end{array}\right]\left[\begin{array}{cccc}\hfill {\alpha}_{11}\hfill & \hfill {\alpha}_{12}\hfill & \hfill \mathrm{\dots}\hfill & \hfill {\alpha}_{1{\mathrm{\ell}}_{k}}\hfill \\ \hfill {\alpha}_{21}\hfill & \hfill {\alpha}_{22}\hfill & \hfill \mathrm{\dots}\hfill & \hfill {\alpha}_{2{\mathrm{\ell}}_{k}}\hfill \\ \hfill \mathrm{\vdots}\hfill & \hfill \mathrm{\vdots}\hfill & \hfill \mathrm{\ddots}\hfill & \hfill \mathrm{\vdots}\hfill \\ \hfill {\alpha}_{{\mathrm{\ell}}_{k}1}\hfill & \hfill {\alpha}_{{\mathrm{\ell}}_{k}2}\hfill & \hfill \mathrm{\dots}\hfill & \hfill {\alpha}_{{\mathrm{\ell}}_{k}{\mathrm{\ell}}_{k}}\hfill \end{array}\right]=\left[\begin{array}{cccc}\hfill 1\hfill & \hfill 0\hfill & \hfill \mathrm{\dots}\hfill & \hfill 0\hfill \\ \hfill 0\hfill & \hfill 1\hfill & \hfill \mathrm{\dots}\hfill & \hfill 0\hfill \\ \hfill \mathrm{\vdots}\hfill & \hfill \mathrm{\vdots}\hfill & \hfill \mathrm{\ddots}\hfill & \hfill \mathrm{\vdots}\hfill \\ \hfill 0\hfill & \hfill 0\hfill & \hfill \mathrm{\dots}\hfill & \hfill 1\hfill \end{array}\right].$$ 
Using the example boundary conditions, let’s derive the ${v}_{1}$ vector using the linearly independent functions ${h}_{1}=1$ and ${h}_{2}={x}_{1}$.
$$\left[\begin{array}{cc}\hfill 1\hfill & \hfill 0\hfill \\ \hfill 1\hfill & \hfill 1\hfill \end{array}\right]\left[\begin{array}{cc}\hfill {\alpha}_{11}\hfill & \hfill {\alpha}_{12}\hfill \\ \hfill {\alpha}_{21}\hfill & \hfill {\alpha}_{22}\hfill \end{array}\right]=\left[\begin{array}{cc}\hfill 1\hfill & \hfill 0\hfill \\ \hfill 0\hfill & \hfill 1\hfill \end{array}\right]\u27f9\left[\begin{array}{cc}\hfill {\alpha}_{11}\hfill & \hfill {\alpha}_{12}\hfill \\ \hfill {\alpha}_{21}\hfill & \hfill {\alpha}_{22}\hfill \end{array}\right]=\left[\begin{array}{cc}\hfill 1\hfill & \hfill 0\hfill \\ \hfill 1\hfill & \hfill 1\hfill \end{array}\right]$$ 
$${v}_{1}=\left\{\begin{array}{ccc}\hfill 1\hfill & \hfill 1{x}_{1}\hfill & \hfill {x}_{1}\hfill \end{array}\right\}.$$ 
For more examples and a proof that these procedures for generating the $\mathcal{M}$ tensor and $v$ vectors form a constrained expression see Ref. [MTFC].
2.2 TwoDimensional Example
This subsection will give an in depth example for a twodimensional TFC case. The example is originally from [OrigOdePde] problem 5, and is one of the PDE problems analyzed in this article. The problem is shown in Eq. (9).
${\nabla}^{2}z(x,y)={e}^{x}(x2+{y}^{3}+6y)\mathit{\hspace{1em}}\text{subject to:}$  (9)  
$\{\begin{array}{cc}z(x,0)=c(x,0)=x{e}^{x}\hfill & \\ z(0,y)=c(0,y)={y}^{3}\hfill & \\ z(x,1)=c(x,1)={e}^{x}(x+1)\hfill & \\ z(1,y)=c(1,y)=(1+{y}^{3}){e}^{1}\hfill & \end{array}$  
$\text{where}\mathit{\hspace{1em}}(x,y)\in [0,1]\times [0,1]$ 
Following the stepbystep procedure given in the previous section we will construct the $\mathcal{M}$ tensor:

1.
The first element is ${\mathcal{M}}_{11}=0$.

2.
The first order subtensors of $\mathcal{M}$ are:
${\mathcal{M}}_{{i}_{1}1}$ $=\left\{\begin{array}{ccc}\hfill 0\hfill & \hfill c(0,y)\hfill & \hfill c(1,y)\hfill \end{array}\right\}$ ${\mathcal{M}}_{1{i}_{2}}$ $=\left\{\begin{array}{ccc}\hfill 0\hfill & \hfill c(x,0)\hfill & \hfill c(x,1)\hfill \end{array}\right\}$ 
3.
The remaining elements of $\mathcal{M}$ are the geometric intersection of elements from the first order subtensors.
${\mathcal{M}}_{22}$ $=c(0,0)$ ${\mathcal{M}}_{23}=c(1,0)$ ${\mathcal{M}}_{32}$ $=c(0,1)$ ${\mathcal{M}}_{33}=c(1,1)$
Hence, the $\mathcal{M}$ tensor is,
$${\mathcal{M}}_{{i}_{1}{i}_{2}}=\left[\begin{array}{ccc}\hfill 0\hfill & \hfill c(0,y)\hfill & \hfill c(1,y)\hfill \\ \hfill c(x,0)\hfill & \hfill c(0,0)\hfill & \hfill c(1,0)\hfill \\ \hfill c(x,1)\hfill & \hfill c(0,1)\hfill & \hfill c(1,1)\hfill \end{array}\right]=\left[\begin{array}{ccc}\hfill 0\hfill & \hfill {y}^{3}\hfill & \hfill (1+{y}^{3}){e}^{1}\hfill \\ \hfill x{e}^{x}\hfill & \hfill 0\hfill & \hfill {e}^{1}\hfill \\ \hfill {e}^{x}(x+1)\hfill & \hfill 1\hfill & \hfill 2{e}^{1}\hfill \end{array}\right]$$ 
Following the stepbystep procedure given in the previous section we will construct the $v$ vectors. For ${v}_{{i}_{1}}$ let’s choose the linearly independent functions ${h}_{1}=1$ and ${h}_{2}=x$.
$$\left[\begin{array}{cc}\hfill 1\hfill & \hfill 0\hfill \\ \hfill 1\hfill & \hfill 1\hfill \end{array}\right]\left[\begin{array}{cc}\hfill {\alpha}_{11}\hfill & \hfill {\alpha}_{12}\hfill \\ \hfill {\alpha}_{21}\hfill & \hfill {\alpha}_{22}\hfill \end{array}\right]=\left[\begin{array}{cc}\hfill 1\hfill & \hfill 0\hfill \\ \hfill 0\hfill & \hfill 1\hfill \end{array}\right]\u27f9\left[\begin{array}{cc}\hfill {\alpha}_{11}\hfill & \hfill {\alpha}_{12}\hfill \\ \hfill {\alpha}_{21}\hfill & \hfill {\alpha}_{22}\hfill \end{array}\right]=\left[\begin{array}{cc}\hfill 1\hfill & \hfill 0\hfill \\ \hfill 1\hfill & \hfill 1\hfill \end{array}\right]$$ 
$${v}_{{i}_{1}}=\left\{\begin{array}{ccc}\hfill 1\hfill & \hfill 1x\hfill & \hfill x\hfill \end{array}\right\}.$$ 
For ${v}_{{i}_{2}}$ let’s choose the linearly indpendent functions ${h}_{1}=1$ and ${h}_{2}=y$.
$$\left[\begin{array}{cc}\hfill 1\hfill & \hfill 0\hfill \\ \hfill 1\hfill & \hfill 1\hfill \end{array}\right]\left[\begin{array}{cc}\hfill {\alpha}_{11}\hfill & \hfill {\alpha}_{12}\hfill \\ \hfill {\alpha}_{21}\hfill & \hfill {\alpha}_{22}\hfill \end{array}\right]=\left[\begin{array}{cc}\hfill 1\hfill & \hfill 0\hfill \\ \hfill 0\hfill & \hfill 1\hfill \end{array}\right]\u27f9\left[\begin{array}{cc}\hfill {\alpha}_{11}\hfill & \hfill {\alpha}_{12}\hfill \\ \hfill {\alpha}_{21}\hfill & \hfill {\alpha}_{22}\hfill \end{array}\right]=\left[\begin{array}{cc}\hfill 1\hfill & \hfill 0\hfill \\ \hfill 1\hfill & \hfill 1\hfill \end{array}\right]$$ 
$${v}_{{i}_{2}}=\left\{\begin{array}{ccc}\hfill 1\hfill & \hfill 1y\hfill & \hfill y\hfill \end{array}\right\}.$$ 
Now, we use the constrained expression form given in Eq. (2) to finish building the constrained expression.
$f(x,y)=$  $g(x,y)+{\displaystyle \frac{xy({y}^{2}1)}{e}}+{e}^{x}(x+y)+(1x)\left(g(0,0)+y\left(g(0,1)+{y}^{2}g(0,0)1\right)\right)+$  (10)  
$(x1)g(0,y)+x\left(yg(1,1)+(1y)g(1,0)\right)xg(1,y)+(y1)g(x,0)yg(x,1)$ 
Notice, that Eq. (10) will always satisfy the boundary conditions of the problem regardless of the value of $g(x,y)$. Thus, the problem has been transformed into an unconstrained optimization problem where the cost function, $\mathcal{L}$, is the square of the residual of the PDE,
$$\mathcal{L}(x,y)={\left({\nabla}^{2}f(x,y){e}^{x}(x2+{y}^{3}+6y)\right)}^{2}.$$ 
For onedimensional ODEs, the minimization of the cost function was accomplished by making $g$ the summation of orthogonal polynomials, and performing leastsquares or some other optimization technique to find the coefficients that multiply those orthogonal polynomials. For two dimensions, one could make $g(x,y)$ the product of two sums of these orthogonal polynomials, calculate all of the crossterms, and then solve for the coefficients that multiply all terms and crossterms using leastsquares or nonlinear leastsquares. However, this will become prohibitive as the dimension increases. An alternative solution, and the one explored in this article, is to make the free function, $g(x,y)$, a neural network.
3 PDE Solution Methodology
As with the previous section, the easiest way to describe the methodology is with an example. The example used throughout this section will be the PDE given in Eq. (9).
As mentioned in the previous section, deep TFC approximates solutions to PDEs by finding the constrained expression for the PDE and choosing a neural network as the free function. For all of the problems analyzed in this article, a simple, fully connected neural network was used. These networks consist of nonlinear activation functions composed with affine transformations of the form $\mathcal{A}=W\cdot x+b$, where $W$ are neuron weights, $b$ are neuron biases, and $x$ is a vector of inputs from the previous layer (or the inputs to the neural network if it is the first layer). The weights and biases of the entire neural network make up the tunable parameters, $\theta $. In this article, neural networks will be represented with the symbol $\mathcal{N}$. For example, a neural network with inputs $x$ and $y$ would be given as $\mathcal{N}(x,y;\theta )$. Thus, the constrained expression, given originally in Eq. (10), now has the form given in Eq. (11).
$f(x,y)=$  $\mathcal{N}(x,y;\theta )+{\displaystyle \frac{xy({y}^{2}1)}{e}}+{e}^{x}(x+y)+$  (11)  
$(1x)\left(\mathcal{N}(0,0;\theta )+y\left(\mathcal{N}(0,1;\theta )+{y}^{2}\mathcal{N}(0,0;\theta )1\right)\right)+(x1)\mathcal{N}(0,y;\theta )+$  
$x\left(y\mathcal{N}(1,1;\theta )+(1y)\mathcal{N}(1,0;\theta )\right)x\mathcal{N}(1,y;\theta )+(y1)\mathcal{N}(x,0;\theta )y\mathcal{N}(x,1;\theta )$ 
In order to estimate the solution to the PDE, the parameters of the neural network have to be optimized to minimize the loss function, which is taken to be the square of the residual of the PDE. For this example,
${\mathcal{L}}_{i}({x}_{i},{y}_{i})$  $={\left({\nabla}^{2}f({x}_{i},{y}_{i}){e}^{{x}_{i}}({x}_{i}2+{y}_{i}^{3}+6{y}_{i})\right)}^{2},$  
$\mathcal{L}$  $={\displaystyle \sum _{i}^{N}}{\mathcal{L}}_{i}.$ 
The attentive reader will notice that training the neural network will require, for this example, taking two second order partial derivatives of $f(x,y)$ to calculate ${\mathcal{L}}_{i}$, and then taking gradients of $\mathcal{L}$ with respect to the neural network parameters, $\theta $, in order to train the neural network.
To take these higher order derivatives, TensorFlow’s™ gradients function was used [tensorflowWhitepaper]. This function uses automatic differentiation [AD] to compute these derivatives. However, one must be conscientious when using the gradients function to ensure they get the correct gradients.
When taking the gradient of a vector, ${y}_{j}$, with respect to another vector, ${x}_{i}$, TensorFlow™ computes,
$${z}_{i}=\frac{\partial \left({\sum}_{j=1}^{N}{y}_{j}\right)}{\partial {x}_{i}},$$ 
where ${z}_{i}$ is a vector of the same size as ${x}_{i}$. The only place where this may be an issue in the example used in this section is when computing ${\nabla}^{2}{f}_{i}$. The desired output of this calculation is the following vector,
$${z}_{i}=\{\frac{{\partial}^{2}{f}_{1}}{\partial {x}_{1}^{2}}+\frac{{\partial}^{2}{f}_{1}}{\partial {y}_{1}^{2}},\mathrm{\dots},\frac{{\partial}^{2}{f}_{N}}{\partial {x}_{N}^{2}}+\frac{{\partial}^{2}{f}_{N}}{\partial {y}_{N}^{2}}\},$$ 
where ${z}_{i}$ has the same size as ${f}_{i}$ and $({x}_{i},{y}_{i})$ is the pair used to generate ${f}_{i}$. TensorFlow’s™ gradients function will compute the following vector,
${z}_{i}=\{$  $\frac{{\partial}^{2}\left({\sum}_{j=1}^{N}{f}_{j}\right)}{\partial {x}_{1}^{2}}}+{\displaystyle \frac{{\partial}^{2}\left({\sum}_{j=1}^{N}{f}_{j}\right)}{\partial {y}_{1}^{2}}},\mathrm{\dots},$  
$\frac{{\partial}^{2}\left({\sum}_{j=1}^{N}{f}_{j}\right)}{\partial {x}_{N}^{2}}}+{\displaystyle \frac{{\partial}^{2}\left({\sum}_{j=1}^{N}{f}_{j}\right)}{\partial {y}_{N}^{2}}}\}.$ 
However, because ${f}_{i}$ only depends on $({x}_{i},{y}_{i})$ and the derivative operator commutes with the sum operator, TensorFlow’s™ gradients function will compute the desired vector. Moreover, the size of the output vector will be correct because the input vectors, ${x}_{i}$ and ${y}_{i}$, have the same size as ${f}_{i}$.
3.1 Training the Neural Network
Three methods were tried when optimizing the parameters of the neural networks:

1.
Adam optimizer [Adam]

2.
Broyden–Fletcher–Goldfarb–Shanno (BFGS) optimizaion algorithm [OrigTrainMethod]

3.
Hybrid method
The first method, Adam, is a variant of stochastic gradient descent (SGD) that combines the advantages of two other popular SGD variants: AdaGrad [AdaGrad] and RMSProp [RMSProp].
The second method, BFGS, is a quasiNewton method designed for solving unconstrained, nonlinear optimization problems. This method was chosen based on its performance when optimizing neural network parameters to estimate PDE solutions in Ref. [OrigOdePde]. The hybrid method uses both methods in series. For all four problems shown in this article, the BFGS optimizer gave the best results.
4 Results
This section compares the estimated solution found using deep TFC with with the analytical solution. Four PDE problems are analyzed. The first is the example PDE given in Eq. (9), and the second is the wave equation. The third and fourth PDEs are simple solutions to the incompressible NavierStokes equations.
4.1 Problem 1
The first problem analyzed was the PDE given by Eq. (9), copied below for the readers’ convenience.
${\nabla}^{2}z(x,y)={e}^{x}(x2+{y}^{3}+6y)\mathit{\hspace{1em}}\text{subject to:}$  
$\{\begin{array}{cc}z(x,0)=x{e}^{x}\hfill & \\ z(0,y)={y}^{3}\hfill & \\ z(x,1)={e}^{x}(x+1)\hfill & \\ z(1,y)=(1+{y}^{3}){e}^{1}\hfill & \end{array}$  
$\text{where}\mathit{\hspace{1em}}(x,y)\in [0,1]\times [0,1]$ 
The neural network used to estimate the solution to this PDE was a fully connected neural network with five hidden layers and 30 neurons per layer. The nonlinear activation function used was the hyperbolic tangent. Other neural network sizes and nonlinear activation functions were tried, but this size and activation function combination did the best. The biases of the neural network were all initialized as zeros, and the weights were initialized using TensorFlow’s™ implementation of the Xavier initialization with uniform random initialization [Init]. Training pairs, $(x,y)$, were created for this problem by sampling $x$ and $y$ as independent and identically distributed (IID) random variables on the uniform distribution on $[0,1]$. The network was trained using the BFGS method on a batch size of 10,000 training pairs.
Figure 1 shows the difference between the analytical solution and the estimated solution using deep TFC on a grid of 100 evenly distributed points (10 per independent variable). This grid represents the test set.
The maximum error on the test set was $4.806\times {10}^{6}$ meters and the average error was $8.872\times {10}^{7}$ meters. The maximum error is relatively low, five orders of magnitude lower than the solution values, which are on the order of ${10}^{1}$ meters. However, the maximum solution error using deep TFC is not as low as the maximum solution error obtained in [OrigOdePde], which was on the order of ${10}^{7}$ meters. Although there are many possible explanations for this discrepancy, for example, different implementations of the optimizer or different weight initialization functions, the author was concerned that it may be the assumed solution form, $f(x,y)$, that was causing the increase in estimated solution error. The solution form created using deep TFC is more complex both in the number of terms and the number of times the neural network appears within the assumed solution form.
To investigate, a comparison was made between the solution form posed in [OrigOdePde] and the solution form posed in this article, while keeping all other variables constant. For this comparison, the neural network architecture consisted of one hidden layer with 10 neurons, and the nonlinear activation function used was the hyperbolic tangent function^{2}^{2} 2 The sigmoid function was also tried, which is what is used in [OrigOdePde]; however, the average error and maximum error for both solution forms, deep TFC and [OrigOdePde], was almost doubled compared to using the hyperbolic tangent function.. The neural network was trained using the BFGS optimizer. The training pairs were created by randomly sampling 10,000 point pairs $(x,y)$ where $x$ and $y$ are IID random variables on the uniform distribution $[0,1]$. The test set was a grid of 100 evenly distributed points (10 per independent variable).
Figure 2 was created using the solution form posed in [OrigOdePde]. The maximum error on the test set was $5.481\times {10}^{6}$ meters and the average error on the test set was $1.131\times {10}^{6}$ meters.
Figure 3 was created using the deep TFC solution form. The maximum error on the test set was $8.124\times {10}^{6}$ meters and the average error on the test set was $1.696\times {10}^{6}$ meters.
Comparing Figs. 2 and 3 shows that the solution form from [OrigOdePde] does slightly better in terms of average error and maximum error for this problem, but the difference is not significant. However, neither of the tests conducted here is able to reduce the error to the level reported in [OrigOdePde]. Thus, there must be some other factor, initialization, optimizer method, etc., that is causing this difference. One important takeaway from this comparison is that despite the more complex solution form created using deep TFC, which can easily be applied to higher dimensions, the final solution accuracy is very similar to the simpler solution form that was designed for lowerdimensional problems.
4.2 Problem 2
The second problem analyzed was the wave equation, shown in Eq. (12).
$\frac{{\partial}^{2}u}{\partial {t}^{2}}}(x,t)={c}^{2}{\displaystyle \frac{{\partial}^{2}u}{\partial {x}^{2}}}(x,t)\mathit{\hspace{1em}}\text{subject to:$  (12)  
$\{\begin{array}{cc}\hfill & u(0,t)=0\hfill \\ \hfill & u(1,t)=0\hfill \\ \hfill & u(x,0)=x(1x)\hfill \\ \hfill & {u}_{t}(x,0)=0\hfill \end{array}$  
$\text{where}\mathit{\hspace{1em}}(x,t)\in [0,1]\times [0,1]$ 
where the constant, $c$, was chosen to be 1. The constrained expression for this problem is shown in Eq. (13).
$f(x,t)=$  $(1x)\left[\mathcal{N}(0,0)\mathcal{N}(0,t)\right]+x\left[\mathcal{N}(1,0)\mathcal{N}(1,t)\right]\mathcal{N}(x,0)+x(1x)+\mathcal{N}(x,t)+$  (13)  
$t\left[(1x){\mathcal{N}}_{t}(0,0)+x{\mathcal{N}}_{t}(1,0){\mathcal{N}}_{t}(x,0)\right]$ 
The neural network used to estimate the solution to this PDE was a fully connected neural network with two hidden layers and 30 neurons per layer. The nonlinear activation function used was the hyperbolic tangent. The biases and weights were initialized using the same method as problem 1. The training points, $(x,t)$, were created by sampling $x$ and $t$ IID from the uniform distribution on $[0,1]$. The network was trained using the BFGS method on a batch size of 10,000 training pairs.
Figure 4 shows the difference between the analytical solution and the estimated solution using deep TFC on a grid of 100 evenly distributed points (10 per independent variable). This grid represents the test set.
The maximum error on the test set was $2.701\times {10}^{3}$ meters and the average error on the test set was $6.978\times {10}^{4}$ meters. The error of this solution is larger than in the problem one, while the solution values are on the same order of magnitude, ${10}^{1}$ meters, as in problem one. The larger relative error in problem two is most likely due to the more oscillatory nature of the solution.
4.3 Problem 3
The third problem analyzed was a known solution to the incompressible NavierStokes equations, called Poiseuille flow. The problem solves the flow velocity in a twodimensional pipe in steadystate with a constant pressure gradient applied in the longitudinal axis. Equation (14) shows the associated equations and boundary conditions.
$\frac{\partial u}{\partial x}}+{\displaystyle \frac{\partial v}{\partial y}}=0$  (14)  
$\rho \left({\displaystyle \frac{\partial u}{\partial t}}+u{\displaystyle \frac{\partial u}{\partial x}}+v{\displaystyle \frac{\partial u}{\partial y}}\right)={\displaystyle \frac{\partial P}{\partial x}}+\mu \left({\displaystyle \frac{{\partial}^{2}u}{\partial {x}^{2}}}+{\displaystyle \frac{{\partial}^{2}u}{\partial {y}^{2}}}\right)$  
$\rho \left({\displaystyle \frac{\partial v}{\partial t}}+u{\displaystyle \frac{\partial v}{\partial x}}+v{\displaystyle \frac{\partial v}{\partial y}}\right)=\mu \left({\displaystyle \frac{{\partial}^{2}v}{\partial {x}^{2}}}+{\displaystyle \frac{{\partial}^{2}v}{\partial {y}^{2}}}\right)$  
subject to:  
$\{\begin{array}{cc}\hfill & u(0,y,t)=u(L,y,t)=u(x,y,0)=\frac{1}{2\mu}\frac{\partial P}{\partial x}\left({y}^{2}{\left(\frac{H}{2}\right)}^{2}\right)\hfill \\ \hfill & u(x,\frac{H}{2},t)=u(x,\frac{H}{2},t)=0\hfill \\ \hfill & v(0,y,t)=v(L,y,t)=v(x,y,0)=0\hfill \\ \hfill & v(0,\frac{H}{2},t)=v(0,\frac{H}{2},t)=0\hfill \end{array}$ 
where $u$ and $v$ are velocities in the $x$ and $y$ directions respectively, $H$ is the height of the channel, $P$ is the pressure, $\rho $ is the density, and $\mu $ is the viscosity. For this problem, the values $H=1$ m, $\rho =1$ kg/m${}^{3}$, $\mu =1$ Pa$\cdot $s, and $\frac{\partial P}{\partial x}=5$ N/m${}^{3}$ were chosen. The constrained expressions for the $u$velocity, ${f}^{u}(x,y,t)$, and $v$velocity, ${f}^{v}(x,y,t)$, are shown in Eq. (15).
${f}^{u}(x,y,t)=$  $\mathcal{N}(x,y,t;\theta )\mathcal{N}(x,y,0;\theta )+{\displaystyle \frac{Lx}{L}}\left(\mathcal{N}(0,y,0;\theta )\mathcal{N}(0,y,t;\theta )\right)$  (15)  
$+{\displaystyle \frac{x}{L}}\left(\mathcal{N}(L,y,0;\theta )\mathcal{N}(L,y,t;\theta )\right)+{\displaystyle \frac{P\left(4{y}^{2}{H}^{2}\right)}{8\mu}}+$  
$\frac{1}{2HL}}((2yH)((Lx)\mathcal{N}(0,{\displaystyle \frac{H}{2}},0;\theta )+x\mathcal{N}(L,{\displaystyle \frac{H}{2}},0;\theta )L\mathcal{N}(x,{\displaystyle \frac{H}{2}},0;\theta )$  
$(Lx)\mathcal{N}(0,{\displaystyle \frac{H}{2}},t;\theta )+L\mathcal{N}(x,{\displaystyle \frac{H}{2}},t;\theta )x\mathcal{N}(L,{\displaystyle \frac{H}{2}},t;\theta ))$  
$(H+2y)((Lx)\mathcal{N}(0,{\displaystyle \frac{H}{2}},0;\theta )L\mathcal{N}(x,{\displaystyle \frac{H}{2}},0;\theta )+x\mathcal{N}(L,{\displaystyle \frac{H}{2}},0;\theta )$  
$(Lx)\mathcal{N}(0,{\displaystyle \frac{H}{2}},t;\theta )x\mathcal{N}(L,{\displaystyle \frac{H}{2}},t;\theta )+L\mathcal{N}(x,{\displaystyle \frac{H}{2}},t;\theta )))$  
${f}^{v}(x,y,t)=$  $\mathcal{N}(x,y,t;\theta )\mathcal{N}(x,y,0;\theta )+{\displaystyle \frac{Lx}{L}}\left(\mathcal{N}(0,y,0;\theta )\mathcal{N}(0,y,t;\theta )\right)$  
$+{\displaystyle \frac{x}{L}}(\mathcal{N}(L,y,0;\theta )\mathcal{N}(L,y,t;\theta ))+{\displaystyle \frac{1}{2HL}}((2yH)((Lx)\mathcal{N}(0,{\displaystyle \frac{H}{2}},0;\theta )$  
$+x\mathcal{N}(L,{\displaystyle \frac{H}{2}},0;\theta )L\mathcal{N}(x,{\displaystyle \frac{H}{2}},0;\theta )(Lx)\mathcal{N}(0,{\displaystyle \frac{H}{2}},t;\theta )+L\mathcal{N}(x,{\displaystyle \frac{H}{2}},t;\theta )$  
$x\mathcal{N}(L,{\displaystyle \frac{H}{2}},t;\theta ))(H+2y)((Lx)\mathcal{N}(0,{\displaystyle \frac{H}{2}},0;\theta )L\mathcal{N}(x,{\displaystyle \frac{H}{2}},0;\theta )$  
$+x\mathcal{N}(L,{\displaystyle \frac{H}{2}},0;\theta )(Lx)\mathcal{N}(0,{\displaystyle \frac{H}{2}},t;\theta )x\mathcal{N}(L,{\displaystyle \frac{H}{2}},t;\theta )+L\mathcal{N}(x,{\displaystyle \frac{H}{2}},t;\theta )))$ 
The neural network used to estimate the solution to this PDE was a fully connected neural network with four hidden layers and 30 neurons per layer. The nonlinear activation function used was the sigmoid. The biases and weights were initialized using the same method as problem 1. The training points, $(x,y,t)$, were created by sampling $x$, $y$, and $t$ IID from the a uniform distribution that spanned the range of the associated independent variable. For $x$, the range was $[0,1]$. For $y$, the range was $[\frac{H}{2},\frac{H}{2}]$, and for $t$, the range was $[0,1]$. The network was trained using the BFGS method on a batch size of 1,000 training pairs. The loss function used was the sum of the squares of the residuals of the three PDEs in Eq. (14).
For one particular run^{3}^{3} 3 All errors are given in meters per second., the maximum error in the $u$velocity was $3.308\times {10}^{7}$, the average error in the $u$velocity was $9.998\times {10}^{8}$, the maximum error in the $v$velocity was $5.575\times {10}^{7}$, and the average error in the $v$velocity was $1.542\times {10}^{7}$. The maximum error and average error for this problem are much lower than in problems 1 and 2. However, the constrained expression for this problem essentially encodes the solution, because the initial flow condition at time zero is the same as the flow condition throughout the spatial domain at any time. Thus, if the neural network outputs a value of zero for all inputs, the problem will be solved exactly. Although the neural network does output a very small value for all inputs, it is interesting to note that none of the layers have weights or biases that are at or near zero.
4.4 Problem 4
The fourth problem is another solution to the NavierStokes equations, and is very similar to the third. The only difference is that in this case, the fluid is not in steady state, it starts from rest. Equation (16) shows the associated equations and boundary conditions.
$\frac{\partial u}{\partial x}}+{\displaystyle \frac{\partial v}{\partial y}}=0$  (16)  
$\rho \left({\displaystyle \frac{\partial u}{\partial t}}+u{\displaystyle \frac{\partial u}{\partial x}}+v{\displaystyle \frac{\partial u}{\partial y}}\right)={\displaystyle \frac{\partial P}{\partial x}}+\mu \left({\displaystyle \frac{{\partial}^{2}u}{\partial {x}^{2}}}+{\displaystyle \frac{{\partial}^{2}u}{\partial {y}^{2}}}\right)$  
$\rho \left({\displaystyle \frac{\partial v}{\partial t}}+u{\displaystyle \frac{\partial v}{\partial x}}+v{\displaystyle \frac{\partial v}{\partial y}}\right)=\mu \left({\displaystyle \frac{{\partial}^{2}v}{\partial {x}^{2}}}+{\displaystyle \frac{{\partial}^{2}v}{\partial {y}^{2}}}\right)$  
subject to:  
$\{\begin{array}{cc}\hfill & u(0,y,t)=\frac{\partial u}{\partial x}(0,y,t)=u(x,y,0)=0\hfill \\ \hfill & u(x,\frac{H}{2},t)=u(x,\frac{H}{2},t)=0\hfill \\ \hfill & v(0,y,t)=\frac{\partial v}{\partial x}(0,y,t)=v(x,y,0)=0\hfill \\ \hfill & v(0,\frac{H}{2},t)=v(0,\frac{H}{2},t)=0\hfill \end{array}$ 
This problem was created to avoid encoding the solution to the problem into the constrained expression, as was the case in the previous problem. The constrained expressions for the $u$velocity, ${f}^{u}(x,y,t)$, and $v$velocity, ${f}^{v}(x,y,t)$, are shown in Eq. (17).
${f}^{u}(x,y,t)=$  $\mathcal{N}(x,y,t;\theta )\mathcal{N}(x,y,0;\theta )+\mathcal{N}(0,y,0;\theta )\mathcal{N}(0,y,t;\theta )+x{\mathcal{N}}_{x}(0,y,0;\theta )x{\mathcal{N}}_{x}(0,y,t;\theta )$  (17)  
$\frac{1}{2H}}((2yH)(\mathcal{N}(0,{\displaystyle \frac{H}{2}},0;\theta )\mathcal{N}(x,{\displaystyle \frac{H}{2}},0;\theta )+x{\mathcal{N}}_{x}(0,{\displaystyle \frac{H}{2}},0;\theta )\mathcal{N}(0,{\displaystyle \frac{H}{2}},t;\theta )$  
$+\mathcal{N}(x,{\displaystyle \frac{H}{2}},t;\theta )x{\mathcal{N}}_{x}(0,{\displaystyle \frac{H}{2}},t;\theta ))(H+2y)(\mathcal{N}(0,{\displaystyle \frac{H}{2}},0;\theta )\mathcal{N}(x,{\displaystyle \frac{H}{2}},0;\theta )$  
$+x{\mathcal{N}}_{x}(0,{\displaystyle \frac{H}{2}},0;\theta )\mathcal{N}(0,{\displaystyle \frac{H}{2}},t;\theta )+\mathcal{N}(x,{\displaystyle \frac{H}{2}},t;\theta )x{\mathcal{N}}_{x}(0,{\displaystyle \frac{H}{2}},t;\theta )))$  
${f}^{v}(x,y,t)=$  $\mathcal{N}(x,y,t;\theta )\mathcal{N}(x,y,0;\theta )+\mathcal{N}(0,y,0;\theta )\mathcal{N}(0,y,t;\theta )+x{\mathcal{N}}_{x}(0,y,0;\theta )x{\mathcal{N}}_{x}(0,y,t;\theta )$  
$\frac{1}{2H}}((2yH)(\mathcal{N}(0,{\displaystyle \frac{H}{2}},0;\theta )\mathcal{N}(x,{\displaystyle \frac{H}{2}},0;\theta )+x{\mathcal{N}}_{x}(0,{\displaystyle \frac{H}{2}},0;\theta )\mathcal{N}(0,{\displaystyle \frac{H}{2}},t;\theta )$  
$+\mathcal{N}(x,{\displaystyle \frac{H}{2}},t;\theta )x{\mathcal{N}}_{x}(0,{\displaystyle \frac{H}{2}},t;\theta ))(H+2y)(\mathcal{N}(0,{\displaystyle \frac{H}{2}},0;\theta )\mathcal{N}(x,{\displaystyle \frac{H}{2}},0;\theta )$  
$+x{\mathcal{N}}_{x}(0,{\displaystyle \frac{H}{2}},0;\theta )\mathcal{N}(0,{\displaystyle \frac{H}{2}},t;\theta )+\mathcal{N}(x,{\displaystyle \frac{H}{2}},t;\theta )x{\mathcal{N}}_{x}(0,{\displaystyle \frac{H}{2}},t;\theta )))$ 
The neural network used in this problem is exactly the same as the neural network used in problem three. Problem 4 used 2,000 training points that were selected the same way as in problem three, except the new ranges for the independent variables were $[0,10]$ for $x$, $[0,3]$ for $t$, and $[\frac{H}{2},\frac{H}{2}]$ for $y$.
Figures 7 through 7 show the $u$velocity of the fluid throughout the domain at three different times. Qualitatively, the solution should look as follows. The solution should be symmetric about the line $y=0$, and the solution should develop spatially and temporally such that after a period of time and sufficiently far from the inlet, $x=0$, the $u$velocity will be equal or very close to the steady state $u$velocity of problem 3. Qualitatively, the $u$velocity field looks correct at all points. Quantitatively, the $u$velocity at $x=10$ from Fig. 7 was compared with the known steady state $u$velocity, and had a maximum error of $5.530\times {10}^{4}$ meters per second and an average error of $2.742\times {10}^{4}$ meters per second.
5 Conclusions
This article demonstrated how to combine neural networks with the Theory of Functional Connections into a new methodology, called deep TFC, that was used to estimate the solutions of PDEs. Results on four problems were presented that display how accurately relatively simple neural networks can approximate the solutions to some well known PDEs. The difficulty of the PDEs in these problems ranged from linear, twodimensional PDEs to coupled, nonlinear, threedimensional PDEs. Moreover, while the focus of this article was on PDEs, the capability to embed constraints into neural networks is useful for many other applications as well.
Future work should investigate the performance of different neural network architectures on the estimated solution error. For example, Ref. [ModernPDE] suggests a neural network architecture where the hidden layers contain elementwise multiplications and sums of sublayers. The sublayers are more standard neural network layers like the fully connected layers used in the neural networks of this article.
Another topic for investigation is reducing the estimated solution error by sampling the training points based on the loss function values for the training points of the previous iteration. For example, one could create batches where half of the new batch consists of half of the points in the previous batch that had the largest loss function value and the other half are randomly sampled from the domain. This should consistently give training points that are in portions of the domain where the estimated solution is farthest from the real solution.