Deep Theory of Functional Connections: A New Method for Estimating the Solutions of PDEs

  • 2020-01-13 16:58:52
  • Carl Leake
  • 0

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

Carl Leake Ph.D. Student, Aerospace Engineering, Texas A&M University, College Station, TX. E-mail: [email protected]
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 low-dimensional 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) [SVM-TFC]. In Ref. [SVM-TFC], 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 [M-TFC] for constraints on the value and flux of n-1 dimensional manifolds. This means the framework can now generate constrained expressions that satisfy the boundary constraints of multidimensional PDEs [M-TFC-PDE].

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.

my′′+ky=0subject to:{y(0)=y0y(0)=y0 (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 free-function, g(𝐱), onto the hyper-surface 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(𝐱)=i1,i2,,in(c(𝐱))vi1(x1)vi2(x2)vin(xn)+ (2)
g(𝐱)-i1,i2,,in(g(𝐱))vi1(x1)vi2(x2)vin(xn)

where x is a vector of the independent variables, {x1x2xn}T, is an n-th order tensor containing the boundary conditions c(𝐱), vi1vin are vectors whose elements are functions of the independent variables, g(𝐱) is the free-function that can be chosen to be anything11 1 More specifically, the free function g(𝐱) can be chosen to be any function as long as that function is defined at the constraints., and f(𝐱) is the constrained expression. The first term in f(𝐱) satisfies the boundary conditions, and the final two terms project the free-function, g(𝐱), onto the space of functions that vanish at the constraints.

For one dimension with independent variable x1 on the domain [0,1] and for boundary and first-derivative constraints only, has the following form,

(c(x1))=[c(0)cx1(0)c(1)cx1(1)].

The values of that are unused are eliminated, and the vector, v, is created afterwards with the appropriate size. For the one dimensional simple harmonic oscillator, and v are given by Eq. (3).

(c(x1)) =[c(0)cx1(0)] (3)
v =[p1(x1)p2(x1)]

where p1(x1) and p2(x1) are functions that need to be solved for. Substituting everything into the constrained expression, f(x1), and simplifying yields Eq. (4).

f(x1)=p1(x1)(b(0)-g(0))+p2(x1)(bx1(0)-gx1(0))+g(x1) (4)

The functions p1(x1) and p2(x1) are solved for by setting the constrained expression, f(x1), 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)=p1(0)(b(0)-g(0))+p2(0)(bx1(0)-gx1(0))+g(0) (5)
bt(0)=px11(0)(b(0)-g(0))+px12(0)(bx1(0)-gx1(0))+gx1(0) (6)

Equation (5) shows that p1(0)=1 and p2(0)=0, and Eq. (6) shows that px11(0)=0 and px12(0)=1. One solution to this set of simultaneous equations is p1(x1)=1 and p2(x1)=x1. Substituting these results back into the constrained expression and substituting b(0)=y0 and bx1(0)=y˙0 yields Eq. (7).

f(x1)=g(x1)+y0-g(0)+t(y0-gx1(0)) (7)

Notice that for any function g(x1), 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, , be equal to the square of the residual of the differential equation,

(x1)=(mf′′(x1)+kf(x1))2.

This function is to be minimized by varying the function g(x1). One way to do this is to make g(x1) a linear combination of a series of basis functions, and minimize the coefficients that multiply those basis functions via least-squares 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 non-linear least squares for non-linear 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 n-1 dimensional manifolds [M-TFC]. This formalism shows how to construct the two portions of the constrained expression shown in Eq. (2): 1) n-th order tensor 2) the n vectors, v.

Before discussing how to build the tensor and v vectors, let’s introduce some mathematical notation. Let k[1,n] be an index used to denote the k-th dimension. Let cpdk:=dc(𝐱)xkd|xk=p be the constraint specified by taking the d-th derivative of the constraint function, c(𝐱), evaluated at the xk=p hyperplane. Further, let c𝐩k𝐝kk be the vector of k constraints defined at the xk=𝐩k hyperplanes with derivative orders of 𝐝k, where 𝐩k and 𝐝kk. In addition, let’s define a boundary condition operator bpdk that takes the d-th derivative with respect to xk of a function, and then evaluates that function at the xk=p hyperplane. Mathematically,

bpdk[f(𝐱)]=df(𝐱)xkd|xk=p

This mathematical notation will be used to introduce a step-by-step method for building the tensor. This step-by-step process will be be illustrated via a 3-dimensional example that has Dirichlet boundary conditions in x1 and initial conditions in x2 and x3 on the domain x1,x2,x3[0,1]×[0,1]×[0,1]. The tensor is constructed using the following three rules.

  1. 1.

    The element 111=0.

  2. 2.

    The first order sub-tensor of 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,

    1,,1,ik,1,,1={0,kc𝐩k𝐝k}.

    Using the example boundary conditions,

    i111=[0,c(0,x2,x3),c(1,x2,x3)]T
    1i21=[0,c(x1,0,x3),cx2(x1,0,x3)]T (8)
    11i3=[0,c(x1,x2,0),cx3(x1,x2,0)]T.
  3. 3.

    The remaining elements of the 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,

    i1i2in=1b𝐩i1-11𝐝i1-11[2b𝐩i2-12𝐝i2-12[[nb𝐩in-1n𝐝in-1n[c(𝐱)]]]](-1)m+1,

    where m is the number of indices different than one. Using the example boundary conditions we give three examples:

    M133=-cx2x3(x1,0,0)
    M221=-c(0,0,x3)
    M332=cx2(1,0,0)

A simple procedure also exists for constructing the v vectors. The v vectors have a standard form:

𝐯k={1,i=1kαi1hi(xk),i=1kαi2hi(xk),,i=1kαikhi(xk)},

where hi(xk) are k linearly independent functions. The simplest set of linearly independent functions, and those most often used in the TFC constrained expressions, are monomials, hi(xk)=xki-1. The k×k coefficients, αij, can be computed by matrix inversion,

[kbp1d1[h1]kbp1d1[h2]kbp1d1[hk]kbp2d2[h1]kbp2d2[h2]kbp2d2[hk]kbpkdk[h1]kbpkdk[h2]kbpkdk[hk]][α11α12α1kα21α22α2kαk1αk2αkk]=[100010001].

Using the example boundary conditions, let’s derive the v1 vector using the linearly independent functions h1=1 and h2=x1.

[1011][α11α12α21α22]=[1001][α11α12α21α22]=[10-11]
v1={11-x1x1}.

For more examples and a proof that these procedures for generating the tensor and v vectors form a constrained expression see Ref. [M-TFC].

2.2 Two-Dimensional Example

This subsection will give an in depth example for a two-dimensional 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).

2z(x,y)=e-x(x-2+y3+6y)subject to: (9)
{z(x,0)=c(x,0)=xe-xz(0,y)=c(0,y)=y3z(x,1)=c(x,1)=e-x(x+1)z(1,y)=c(1,y)=(1+y3)e-1
where(x,y)[0,1]×[0,1]

Following the step-by-step procedure given in the previous section we will construct the tensor:

  1. 1.

    The first element is 11=0.

  2. 2.

    The first order sub-tensors of are:

    i11 ={0c(0,y)c(1,y)}
    1i2 ={0c(x,0)c(x,1)}
  3. 3.

    The remaining elements of are the geometric intersection of elements from the first order sub-tensors.

    22 =-c(0,0) 23=-c(1,0)
    32 =-c(0,1) 33=-c(1,1)

Hence, the tensor is,

i1i2=[0c(0,y)c(1,y)c(x,0)-c(0,0)-c(1,0)c(x,1)-c(0,1)-c(1,1)]=[0y3(1+y3)e-1xe-x0-e-1e-x(x+1)-1-2e-1]

Following the step-by-step procedure given in the previous section we will construct the v vectors. For vi1 let’s choose the linearly independent functions h1=1 and h2=x.

[1011][α11α12α21α22]=[1001][α11α12α21α22]=[10-11]
vi1={11-xx}.

For vi2 let’s choose the linearly indpendent functions h1=1 and h2=y.

[1011][α11α12α21α22]=[1001][α11α12α21α22]=[10-11]
vi2={11-yy}.

Now, we use the constrained expression form given in Eq. (2) to finish building the constrained expression.

f(x,y)= g(x,y)+xy(y2-1)e+e-x(x+y)+(1-x)(g(0,0)+y(g(0,1)+y2-g(0,0)-1))+ (10)
(x-1)g(0,y)+x(yg(1,1)+(1-y)g(1,0))-xg(1,y)+(y-1)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, , is the square of the residual of the PDE,

(x,y)=(2f(x,y)-e-x(x-2+y3+6y))2.

For one-dimensional ODEs, the minimization of the cost function was accomplished by making g the summation of orthogonal polynomials, and performing least-squares 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 cross-terms, and then solve for the coefficients that multiply all terms and cross-terms using least-squares or non-linear least-squares. 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 non-linear activation functions composed with affine transformations of the form 𝒜=Wx+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, θ. In this article, neural networks will be represented with the symbol 𝒩. For example, a neural network with inputs x and y would be given as 𝒩(x,y;θ). Thus, the constrained expression, given originally in Eq. (10), now has the form given in Eq. (11).

f(x,y)= 𝒩(x,y;θ)+xy(y2-1)e+e-x(x+y)+ (11)
(1-x)(𝒩(0,0;θ)+y(𝒩(0,1;θ)+y2-𝒩(0,0;θ)-1))+(x-1)𝒩(0,y;θ)+
x(y𝒩(1,1;θ)+(1-y)𝒩(1,0;θ))-x𝒩(1,y;θ)+(y-1)𝒩(x,0;θ)-y𝒩(x,1;θ)

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,

i(xi,yi) =(2f(xi,yi)-e-xi(xi-2+yi3+6yi))2,
=iNi.

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 i, and then taking gradients of with respect to the neural network parameters, θ, 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, yj, with respect to another vector, xi, TensorFlow™ computes,

zi=(j=1Nyj)xi,

where zi is a vector of the same size as xi. The only place where this may be an issue in the example used in this section is when computing 2fi. The desired output of this calculation is the following vector,

zi={2f1x12+2f1y12,,2fNxN2+2fNyN2},

where zi has the same size as fi and (xi,yi) is the pair used to generate fi. TensorFlow’s™ gradients function will compute the following vector,

zi={ 2(j=1Nfj)x12+2(j=1Nfj)y12,,
2(j=1Nfj)xN2+2(j=1Nfj)yN2}.

However, because fi only depends on (xi,yi) 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, xi and yi, have the same size as fi.

3.1 Training the Neural Network

Three methods were tried when optimizing the parameters of the neural networks:

  1. 1.

    Adam optimizer [Adam]

  2. 2.

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

  3. 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 quasi-Newton method designed for solving unconstrained, non-linear 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 Navier-Stokes equations.

4.1 Problem 1

The first problem analyzed was the PDE given by Eq. (9), copied below for the readers’ convenience.

2z(x,y)=e-x(x-2+y3+6y)subject to:
{z(x,0)=xe-xz(0,y)=y3z(x,1)=e-x(x+1)z(1,y)=(1+y3)e-1
where(x,y)[0,1]×[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 non-linear activation function used was the hyperbolic tangent. Other neural network sizes and non-linear 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.

\includegraphics

[trim=2.5cm 1.0cm 0.75cm 2.0cm,clip,width=0.6]Figures/MyProb5.png

Figure 1: Problem 1 Solution Error

The maximum error on the test set was 4.806×10-6 meters and the average error was 8.872×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 non-linear activation function used was the hyperbolic tangent function22 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×10-6 meters and the average error on the test set was 1.131×10-6 meters.

\includegraphics

[trim=2.5cm 1.0cm 0.75cm 2.0cm,clip,width=0.6]Figures/P5OldMethod.png

Figure 2: Problem 1 Solution Error Using [OrigOdePde] Solution Form

Figure 3 was created using the deep TFC solution form. The maximum error on the test set was 8.124×10-6 meters and the average error on the test set was 1.696×10-6 meters.

\includegraphics

[trim=2.5cm 1.0cm 0.75cm 2.0cm,clip,width=0.6]Figures/P5NewMethod.png

Figure 3: Problem 1 Solution Error Using Deep TFC Solution Form

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 take-away 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 lower-dimensional problems.

4.2 Problem 2

The second problem analyzed was the wave equation, shown in Eq. (12).

2ut2(x,t)=c22ux2(x,t)subject to: (12)
{u(0,t)=0u(1,t)=0u(x,0)=x(1-x)ut(x,0)=0
where(x,t)[0,1]×[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)= (1-x)[𝒩(0,0)-𝒩(0,t)]+x[𝒩(1,0)-𝒩(1,t)]-𝒩(x,0)+x(1-x)+𝒩(x,t)+ (13)
t[(1-x)𝒩t(0,0)+x𝒩t(1,0)-𝒩t(x,0)]

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 non-linear 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.

\includegraphics

[trim=2.5cm 1.0cm 0.75cm 2.0cm,clip,width=0.6]Figures/P2.png

Figure 4: Problem 2 Solution Error

The maximum error on the test set was 2.701×10-3 meters and the average error on the test set was 6.978×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 Navier-Stokes equations, called Poiseuille flow. The problem solves the flow velocity in a two-dimensional pipe in steady-state with a constant pressure gradient applied in the longitudinal axis. Equation (14) shows the associated equations and boundary conditions.

ux+vy=0 (14)
ρ(ut+uux+vuy)=-Px+μ(2ux2+2uy2)
ρ(vt+uvx+vvy)=μ(2vx2+2vy2)
subject to:
{u(0,y,t)=u(L,y,t)=u(x,y,0)=12μPx(y2-(H2)2)u(x,H2,t)=u(x,-H2,t)=0v(0,y,t)=v(L,y,t)=v(x,y,0)=0v(0,H2,t)=v(0,-H2,t)=0

where u and v are velocities in the x and y directions respectively, H is the height of the channel, P is the pressure, ρ is the density, and μ is the viscosity. For this problem, the values H=1 m, ρ=1 kg/m3, μ=1 Pas, and Px=-5 N/m3 were chosen. The constrained expressions for the u-velocity, fu(x,y,t), and v-velocity, fv(x,y,t), are shown in Eq. (15).

fu(x,y,t)= 𝒩(x,y,t;θ)-𝒩(x,y,0;θ)+L-xL(𝒩(0,y,0;θ)-𝒩(0,y,t;θ)) (15)
+xL(𝒩(L,y,0;θ)-𝒩(L,y,t;θ))+P(4y2-H2)8μ+
12HL((2y-H)((L-x)𝒩(0,-H2,0;θ)+x𝒩(L,-H2,0;θ)-L𝒩(x,-H2,0;θ)
-(L-x)𝒩(0,-H2,t;θ)+L𝒩(x,-H2,t;θ)-x𝒩(L,-H2,t;θ))
-(H+2y)((L-x)𝒩(0,H2,0;θ)-L𝒩(x,H2,0;θ)+x𝒩(L,H2,0;θ)
-(L-x)𝒩(0,H2,t;θ)-x𝒩(L,H2,t;θ)+L𝒩(x,H2,t;θ)))
fv(x,y,t)= 𝒩(x,y,t;θ)-𝒩(x,y,0;θ)+L-xL(𝒩(0,y,0;θ)-𝒩(0,y,t;θ))
+xL(𝒩(L,y,0;θ)-𝒩(L,y,t;θ))+12HL((2y-H)((L-x)𝒩(0,-H2,0;θ)
+x𝒩(L,-H2,0;θ)-L𝒩(x,-H2,0;θ)-(L-x)𝒩(0,-H2,t;θ)+L𝒩(x,-H2,t;θ)
-x𝒩(L,-H2,t;θ))-(H+2y)((L-x)𝒩(0,H2,0;θ)-L𝒩(x,H2,0;θ)
+x𝒩(L,H2,0;θ)-(L-x)𝒩(0,H2,t;θ)-x𝒩(L,H2,t;θ)+L𝒩(x,H2,t;θ)))

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 non-linear 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 [-H2,H2], 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 run33 3 All errors are given in meters per second., the maximum error in the u-velocity was 3.308×10-7, the average error in the u-velocity was 9.998×10-8, the maximum error in the v-velocity was 5.575×10-7, and the average error in the v-velocity was 1.542×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 Navier-Stokes 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.

ux+vy=0 (16)
ρ(ut+uux+vuy)=-Px+μ(2ux2+2uy2)
ρ(vt+uvx+vvy)=μ(2vx2+2vy2)
subject to:
{u(0,y,t)=ux(0,y,t)=u(x,y,0)=0u(x,H2,t)=u(x,-H2,t)=0v(0,y,t)=vx(0,y,t)=v(x,y,0)=0v(0,H2,t)=v(0,-H2,t)=0

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, fu(x,y,t), and v-velocity, fv(x,y,t), are shown in Eq. (17).

fu(x,y,t)= 𝒩(x,y,t;θ)-𝒩(x,y,0;θ)+𝒩(0,y,0;θ)-𝒩(0,y,t;θ)+x𝒩x(0,y,0;θ)-x𝒩x(0,y,t;θ) (17)
12H((2y-H)(𝒩(0,-H2,0;θ)-𝒩(x,-H2,0;θ)+x𝒩x(0,-H2,0;θ)-𝒩(0,-H2,t;θ)
+𝒩(x,-H2,t;θ)-x𝒩x(0,-H2,t;θ))-(H+2y)(𝒩(0,H2,0;θ)-𝒩(x,H2,0;θ)
+x𝒩x(0,H2,0;θ)-𝒩(0,H2,t;θ)+𝒩(x,H2,t;θ)-x𝒩x(0,H2,t;θ)))
fv(x,y,t)= 𝒩(x,y,t;θ)-𝒩(x,y,0;θ)+𝒩(0,y,0;θ)-𝒩(0,y,t;θ)+x𝒩x(0,y,0;θ)-x𝒩x(0,y,t;θ)
12H((2y-H)(𝒩(0,-H2,0;θ)-𝒩(x,-H2,0;θ)+x𝒩x(0,-H2,0;θ)-𝒩(0,-H2,t;θ)
+𝒩(x,-H2,t;θ)-x𝒩x(0,-H2,t;θ))-(H+2y)(𝒩(0,H2,0;θ)-𝒩(x,H2,0;θ)
+x𝒩x(0,H2,0;θ)-𝒩(0,H2,t;θ)+𝒩(x,H2,t;θ)-x𝒩x(0,H2,t;θ)))
\includegraphics [trim=0.0cm 0.0cm 1.25cm 1.25cm,clip,width=]Figures/T001.png
Figure 5: U-Velocity in Meters Per Second at 0.01 Seconds
\includegraphics [trim=0.0cm 0.0cm 1.25cm 1.25cm,clip,width=]Figures/T01.png
Figure 6: U-Velocity in Meters Per Second at 0.1 Seconds
\includegraphics [trim=0.0cm 0.0cm 1.25cm 1.25cm,clip,width=]Figures/T3.png
Figure 7: U-Velocity in Meters Per Second at 3.0 Seconds

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 [-H2,H2] 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×10-4 meters per second and an average error of 2.742×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, two-dimensional PDEs to coupled, non-linear, three-dimensional 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 element-wise multiplications and sums of sub-layers. The sub-layers 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.

References