Correcting model misspecification in physics-informed neural networks (PINNs)
Abstract
Data-driven discovery of governing equations in computational science has emerged as a new paradigm for obtaining accurate physical models and as a possible alternative to theoretical derivations. The recently developed physics-informed neural networks (PINNs) have also been employed to learn governing equations given data across diverse scientific disciplines, e.g., in biology and fluid dynamics. Despite the effectiveness of PINNs for discovering governing equations, the physical models encoded in PINNs may be misspecified in complex systems as some of the physical processes may not be fully understood, leading to the poor accuracy of PINN predictions. In this work, we present a general approach to correct the misspecified physical models in PINNs for discovering governing equations, given some sparse and/or noisy data. Specifically, we first encode the assumed physical models, which may be misspecified in PINNs, and then employ other deep neural networks (DNNs) to model the discrepancy between the imperfect models and the observational data. Due to the expressivity of DNNs, the proposed method is capable of reducing the computational errors caused by the model misspecification and thus enables the applications of PINNs in complex systems where the physical processes are not exactly known. Furthermore, we utilize the Bayesian physics-informed neural networks (B-PINNs) and/or ensemble PINNs to quantify uncertainties arising from noisy and/or gappy data in the discovered governing equations. A series of numerical examples including reaction-diffusion systems and non-Newtonian channel and cavity flows demonstrate that the added DNNs are capable of correcting the model misspecification in PINNs and thus reduce the discrepancy between the physical models encoded in PINNs and the observational data. In addition, the B-PINNs and ensemble PINNs can provide reasonable uncertainty bounds in the discovered physical models, which makes the predictions more reliable. We also demonstrate that we can seamlessly combine the present approach with the symbolic regression to obtain the explicit governing equations upon the training of PINNs. We envision that the proposed approach will extend the applications of PINNs for discovering governing equations in problems where the physico-chemical or biological processes are not well understood.
Keywords:
model uncertainty, physics-informed neural networks , model misspecification , uncertainty quantification , non-Newtonian flows , symbolic regression1 Introduction
Accurate governing equations or physical models are essential for understanding and quantifying physical processes across diverse scientific disciplines, such as the Navier-Stokes equations in fluid dynamics and the transport equations in geosciences. Generally, the governing equations are derived based on established theories such as the conservation of mass and momentum, thermodynamic laws, and so on. However, there are also complex systems in which the governing equations are difficult to obtain theoretically due to the lack of understanding for certain physical processes, e.g., the constitutive relation in highly nonequilibrium flows zhang2020data, the forcing caused by solar and volcanic variability in climate problems fyfe2021significant, non-equilibrium reactions, etc. How to obtain analytical expressions that represent physical phenomena in nature and engineering remains an open question.
With the rapid growth of available data and computing power, data-driven discovery of governing equations based on machine learning algorithms has emerged as a new paradigm for obtaining accurate physical models as the alternative to theoretical derivations schmidt2009distilling, brunton2016discovering, rudy2017data, chen2021physics, zhang2022gfinns, lee2022structure, gonzalez1998identification, rico1992discrete, zhang2018robust. To name a few examples, Schmidt et al. presented a symbolic regression approach to discover equations from experimental data schmidt2009distilling; Brunton et al. proposed the sparse identification of nonlinear dynamical systems (SINDy) to learn both ordinary and partial differential equations from data brunton2016discovering, rudy2017data. In addition, Chen et al. employed deep neural networks (DNNs), more specifically the physics-informed neural networks (PINNs), which encode the physical laws into DNNs via automatic differentiation raissi2019physics, to discover governing equations from scarce data chen2021physics. In most of the aforementioned approaches, a library of candidate terms that describe all the possible physical processes is required as prior knowledge schmidt2009distilling, brunton2016discovering, rudy2017data, chen2021physics. However, mathematical expressions or models for certain physical processes are quite challenging to obtain in some complex real-world applications, e.g., chemical reactions in combustion, the constitutive relation in highly partially ionized plasmas, etc. It is probable that we miss some details of the physical process, hence misspecifying the physical models in such scenarios berger2020model. An incomplete or non-comprehensive library leads to the discrepancy between the observational data and the assumed governing equations. In other words, the discovered governing equations may not be accurate enough to describe the physical processes represented by the observational data.
Several recent approaches have been developed to reduce the discrepancy between the observational data and the assumed physical models. For instance, Ebers et al. ebers2022discrepancy proposed to learn the missing physics or the discrepancy between the imperfect models and the measurements using a plurality of methods, e.g. Gaussian process regression (GPR), DNNs, etc.; Chen et al. also employed DNNs to recover the missing physics in prior models chen2021generalized; in zhang2023discovering, eastman2022pinn, combinations of PINNs and symbolic regression were employed to identify the missing physics in biological problems, e.g. Alzheimer’s disease; Saurabh et al. malani2023some and Zhu et al. zhu2023implementation discovered source terms of dynamic systems in a “gray-box” fashion with NN-based numerical integrators. However, most of the existing work focuses on resolving the missing physics. Investigations on scenarios that we misspecify the physical models are rare to the best of our knowledge. Further, the observational data from sensors in real-world applications are generally noisy, and may also be incomplete due to the limitation of data collection techniques. Such noisy and incomplete or gappy data lead to uncertainties in the predictions of machine learning algorithms or more specifically the scientific machine learning algorithms psaros2023uncertainty, zou2022neuraluq. In addition, as widely discussed in the climate change modeling parker2013ensemble, gosling2012benefits, berger2020model, the incomplete understanding of physical processes will also result in uncertainties in simulations. We point out that quantifying uncertainties arsing from noisy/gappy data as well as the incomplete understanding of the physical processes is an important issue but has been largely ignored in the existing literature on data-driven discovery of governing equations. In the current study, we refer to the uncertainties in the discovered physical models as model uncertainty.
In the present work, we aim to address the issue of misspecifying physical models as well as quantifying model uncertainty in the data-driven discovery of governing equations. Specifically, PINNs are employed as the backbone to discover the governing equations or physical models from data due to their effectiveness as well as easy implementations. In particular, we first encode the assumed physical models that may be misspecified in PINNs, and add another DNN as the correction to the misspecified model to alleviate the discrepancy between the imperfect models and the observational data. We note that the library of candidate terms used in schmidt2009distilling, brunton2016discovering, rudy2017data, chen2021physics is not required here since the added DNN can serve as a universal approximator to model the discrepancy. The Bayesian physics-informed neural networks (B-PINNs) yang2021b and/or ensemble PINNs psaros2023uncertainty, zou2022neuraluq are used to quantify the uncertainties in the discovered governing equations or physical models arising from the noisy and/or gappy data. Further, the symbolic regression is utilized to obtain the analytical expression for the unknown physics based on the trained DNNs that are used to correct the model misspecifications in PINNs.
The rest of this paper is organized as follows. In Sec. 2, we introduce the model misspecification in PINNs as well as our approach to correct it, and also the methods for quantifying uncertainties in PINN predictions. In Sec. 3, we conduct four numerical experiments to demonstrate the effectiveness of the proposed approach in addressing the model misspecification issue in PINNs. We summarize the present work in Sec. 4.
2 Model misspecification in PINNs for learning governing equations
2.1 Learning governing equations from data using PINNs
Consider the following nonlinear ODE/PDE describing a physical system:
| (1a) | ||||
| (1b) | ||||
where is the domain, is the model parameter, is the sought solution, is the source term, is the boundary term, and are operators parameterized by , defining the equation and the boundary condition. The PINN method is capable of solving ODEs/PDEs given initial/boundary conditions as well as learning governing equations and identifying model parameters from data yang2021b, zou2022neuraluq, lu2021deepxde, cai2021physics, pang2019fpinns, kharazmi2021hp, jagtap2021extended, jagtap2020conservative, zou2023hydra, linka2022bayesian, chen2023leveraging, lin2022multi, leung2022nh, tang2023pinns, tang2023adversarial, meng2021multi, sarabian2022physics, guo2022monte, gao2023failure, YIN2023105424. A schematic view of the PINN method is presented in Fig. 1, in which a DNN with as the activation function and as the parameter is built to approximate with and with , respectively, via automatic differentiation raissi2019physics.
In the present study, we focus on using PINNs to learn governing equations from data. The dataset for learning governing equations with PINNs is denoted by , which can be expressed as , where is the set of data for , and and are sets of data for the physics. The model parameter , which defines the equation, is then obtained by optimizing the following PINN loss function with the gradient-descent method and its variants ruder2016overview:
| (2) |
where
are belief weights for balancing different terms, and is the -norm for finite-dimensional vector. We note that in certain cases we may not have data corresponding to the boundary/initial conditions, i.e., the last term in , and we can directly drop this term in the computations.
2.2 Correcting the model misspecification in PINNs
The computational accuracy of PINNs in learning governing equations strongly depends on the encoded physical models, i.e. and/or in Eq. (1). However, the correct specification of the physics is not always guaranteed, leading to significant discrepancy between the observational data and the assumed governing equations. An example is demonstrated in Fig. 2 where the flow is non-Newtonian but the physical model is misspecified as the one for Newtonian flows (see Sec. 3.3.1 for details). As a result, the physics and the data cannot be fitted well at the same time: the training does not land on the region “IV”, where both the losses for the data as well as the residual of the equations are close to zero, regardless of the choice of belief weights in the loss function Eq. (2), i.e. for the physics and for the data. Three results from PINNs are sampled and displayed in Fig. 2(b): when fits the data (which come from a non-Newtonian flow), it does not satisfy the governing equations for Newtonian flows; when is forced to follow the Newtonian flow by setting large , it presents Newtonian behavior and thus cannot fit the data from the non-Newtonian flow well.
The discrepancy between observational data and the assumed governing equations is caused by the physics/model misspecification. In this regard, we propose a general approach developed upon the original PINN framework to quantify the discrepancy as well as to correct the model misspecification. In this work, we focus on the misspecification of the differential operator , but the proposed approach can be easily generalized to the boundary/initial operator. Here, we denote the misspecified differential operator by and then the discrepancy can be quantified as follows:
| (3) |
Inspired by the PINN method, in which the sought solution is modeled with a DNN parameterized by , we employ another DNN parameterized by to model , denoted as . The source term is approximated by , and hence the term penalizing the violation of the physics in the loss function (2) is reformulated as:
| (4) |
We note that plays two important roles in our approach handling model misspecification: (1) it approximates the function quantifying the model discrepancy, i.e. , and (2) it allows both the data term and the PDE term to be minimized to very small values simultaneously in the training of PINNs such that data are fitted by and the (corrected) physics are satisfied.
2.3 Uncertainty quantification
As mentioned in Sec. 2.2, a key step in the present work is to learn the correction term, i.e., , that is used to fix the issue of model misspecifications in PINNs. Generally, the measurements in real-world applications are noisy and can also be incomplete, leading to the uncertainties in predictions from PINNs psaros2023uncertainty, zou2022neuraluq. We refer to the uncertainties in as model uncertainty. Here, two typical approaches are employed for quantifying the uncertainties in , i.e., ensemble PINNs psaros2023uncertainty, zou2022neuraluq and B-PINNs yang2021b. The former is computationally efficient but has difficulties preventing overfitting when the data are noisy, while the latter is able to handle the noisy data well but is computationally more expensive. We therefore utilize the ensemble PINNs and B-PINNs for cases with clean and noisy data, respectively.
We now briefly review the ensemble PINNs and B-PINNs. The ensemble PINN method follows the deep ensemble method, proposed in lakshminarayanan2017simple, and employs multiple standard training of PINNs independently. That is, PINNs with the PDE loss term in Eq. (4) are trained multiple times with random initialization of the DNN parameter. Each random initialization corresponds to one initial guess for minimizing the PINN loss function (2) and each training is finding one global minimum. As a result, ensemble PINNs can be considered as identifying different maximum a posteriori (MAP) estimates of the PINN loss function psaros2023uncertainty. On the other hand, the B-PINN method focuses on estimating the posteriors for and based on the Bayes’ rule as follows:
| (5) |
Here is the density function for the posterior distribution, for the likelihood, and for the prior. Given independent and identically distributed (i.i.d.) data, the density function for the likelihood distribution can be written as follows:
| (6) |
If we further assume that the data for , and follow Gaussian distribution with mean zero and standard deviation, , and , respectively, then correcting it follows that:
| (7a) | ||||
| (7b) | ||||
| (7c) | ||||
We note that , and are often treated as scales of the additive Gaussian noise in measuring data of , and , respectively. Various methods, e.g. Markov Chain Monte Carlo (MCMC) and variational inference, have been proposed to tackle the posterior distribution (5). In this work, we choose to use Hamiltonian Monte Carlo (HMC) method to estimate the posterior distribution by sampling and from it. We also note that here we only consider the homogeneous noise, while more complicated noise models, e.g. the heteroscedastic noise psaros2023uncertainty, are also compatible with the framework.
In both the ensemble PINN and B-PINN methods, we obtain samples of the NN parameters, from which statistics of the prediction are estimated. In general, the mean and the standard deviation are often chosen to represent the prediction and the uncertainty psaros2023uncertainty, respectively. Specifically in this work, we obtain samples of and from ensemble PINNs and/or B-PINNs, denoted by and , respectively, where denotes the number of samples. Then, the predicted means of the sought solution and the discrepancy are estimated as follows:
| (8) |
where and denote the mean of and , respectively. Similarly, the predicted uncertainties are:
| (9) |
where and denote the variance of and , respectively. Interested readers are directed to psaros2023uncertainty for a review and zou2022neuraluq for a comprehensive Python library termed NeuralUQ.
We note that upon the computation of , it can be used in various way: (1) its value represents the model discrepancy and its uncetainty represents the uncertainty in the physical model which we refer to as model uncertainty; (2) it corrects the misspecified physical models and identifies a system which explains the data; and (3) it could also be used to obtain mathematical expressions for the missing details of certain physical process via the symbolic regression zhang2023discovering, eastman2022pinn, kiyani2023framework. Specifically in the present work, we employ the symbolic regression method developed in cranmer2023interpretable and the associated Python library PySR to regress analytic mathematical expressions for the unknown physical processes (See Sec. 3.1 for a demonstration example).
3 Results and discussion
In this section, we conduct four numerical experiments, i.e., (1) an ODE system, (2) a one-dimensional (1D) reaction-diffusion equation, (3) a two-dimensional (2D) channel flow, and (4) a 2D cavity flow. In the first two examples, reaction models are possibly misspecified, and in the last two examples, we assume that we misspecify the constitutive relation in non-Newtonian flows as Newtonian ones. In all the test cases, we employ DNNs to correct the misspecified models as discussed in Sec. 2. Details for the computations (e.g., training steps, NN architectures, etc.) can be found in A.
3.1 Pedagogical example: An ODE system
We first consider the following one-dimensional ODE:
| (10) |
where is a non-negative constant, is the initial condition, and is the source term. In certain real-world applications, the reaction term, i.e., in the right hand side of Eq. (10), may not be exactly known and herein it is misspecified as an empirical model. In this regard, we study the effect of different prior knowledge about the reaction model in the discovery of governing equation. In particular, the following cases are considered:
- 1.
Case (A): The reaction term is correctly specified as , where is unknown.
- 2.
Case (B): The reaction term is misspecified as , where is unknown.
- 3.
Case (C): The reaction term is misspecified as (with known ) but we add to correct it, i.e., .
We denote the reaction term as , and the target here is to identify given data on as well as differently specified models. In Case (A) and (B), the problem degenerates to identifying the model parameter , and in these two cases can then be computed by and , respectively, where is the PINN estimate of . In Case(C), is computed by where is the estimation of the discrepancy induced by the model misspecification. We note that in Case (C) we assume is known and set for simplicity. This is because the discrepancy is already modeled by and hence treating as unknown does not make any difference in correcting the misspecified model.
To reduce the effect of the noisy/gappy data on the predicted accuracy, we first test the case with clean and sufficient data. The training data are generated by solving Eq. (10) with and using MATLAB ode45 MATLAB. We assume that we have 101 data for and , uniformly sampled from , and we employ ensemble PINNs zou2022neuraluq, psaros2023uncertainty to learn the governing equation and also quantify the uncertainties in predictions. In all the test cases here, we choose a DNN with two hidden layers, each of which has 50 neurons and is equipped with hyperbolic tangent as the activation function, to approximate . The equations are then encoded in PINNs via the automatic differentiation raissi2019physics. Further, we utilize an additional DNN to correct the model misspecification in Case (C), which has the same architecture as the one used for approximating . The Adam optimizer kingma2014adam is applied to train the ensemble PINNs.
| Error of | Error of | Error of | Error of | ||
|---|---|---|---|---|---|
| Case (A): Known model | |||||
| Case (B): Misspecified model | |||||
| Case (C): Corrected model |
As shown in Fig. 4(a), PINNs with correct physical model (Case (A)) enable accurate inference of and the surrogate model fits the data and satisfies the ODE simultaneously. In contrast, PINNs with misspecified physical model (Case (B)) yield completely wrong estimate of as displayed in Fig. 4(b). In Case (C), we add a DNN to correct the misspecified reaction model used in Case (B). As illustrated in Fig. 4(c) as well as Table 1, the predicted accuracy for improves significantly as compared to the result in Case (B). In addition, the computational accuracy for , and in Case (C) is quite similar as in the Case (A), where the physical model is correctly specified. The above results demonstrate the effectiveness of the present approach. We note that the predicted uncertainties in all cases are quite small, which is reasonable since we use sufficient data for both and to determine the unknown reaction term here. Furthermore, we present further results as well as the related discussion for the case with clean but gappy data in B.1.
| Error of | ||
| Case (A): Known model | ||
| Case (B): Misspecified model | ||
| Case (C): Corrected model | 0.2 |
We now keep the same setup as in Case (A) - (C) but assume that the training data are both noisy and gappy. In these cases, data of and are randomly sampled from and corrupted by independent additive Gaussian noises with known noise scales ( for and for ). As discussed in Sec. 2, we will employ the B-PINNs to quantify the uncertainties arsing from the noise as well as the incompleteness of the training data. As shown in Fig. 5, (1) B-PINNs with correct physical model can obtain accurate predictions for both , , and , and the computational errors for are generally bounded by the predicted uncertainties (Case (A), Fig. 5(a)); (2) B-PINNs with the misspecified physical model fails to provide accurate inference for , , or (Case (B), Fig. 5(b)); and (3) B-PINNs with a DNN as correction to the misspecified model is able to improve the predicted accuracy for , , and , as compared to the results in Case (B) (Case (C), Fig. 5(c)). Similar as in Case (A), the computational errors for are bounded by the predicted uncertainties here.
In addition to the relation between the computational errors and the predicted uncertainties for discussed above, we would like to further discuss that: (1) it is interesting to observe in Case (A) and Case (C) that the predicted uncertainty near the right end is larger than that near the left end. We note that the results here are reasonable since we do not have data for on the right end; (2) the predicted uncertainties of for in Case (C) are larger than those in Case (A) although we use the same training data as well as prior for the BNN that is used to approximate . We remark that the difference between the uncertainties in these two cases is caused by the lack of knowledge on the physical model and reflects the uncertainty in physical models.
We further verify the learned governing equation from the proposed approach. Specifically, we solve the equation with the inferred , , and the initial condition , using MATLAB ode45 to see if the solution for agrees with the reference solution. We denote the solution to the identified system by . In particular, 1000 posterior samples of and from the B-PINNs are used to compute , as displayed in Fig. 6. We further illustrate the relative errors between the mean for and the reference solution in Table 2. As we can see, PINNs with correct physical model leads to the lowest error in . Adding a DNN to correct the misspecified model can significantly improve the accuracy in as compared to the case with misspecified model, and the computational errors are slightly larger than the ones from the correct physical model. We also present the computational errors for from the ensemble PINNs in Table 1, which will not be discussed again since the results are similar as the above ones. Finally, we would like to point out that (1) the uncertainties in the reconstructed (i.e., ) are caused by the predicted uncertainties for and from B-PINNs, and (2) the computational errors for the mean of in Case (A) and (C) are of the same order as the noise in the measurements, suggesting the reasonableness of the current results.
As discussed in Sec. 2, the discovered physical models or governing equations up to now are expressed using the trained DNNs (i.e., ), which are not explicitly presented. We can then combine the proposed method with the symbolic regression as the further step to obtain the explicit governing equations. Here we take the results in Case (C) from both ensemble PINNs and B-PINNs to demonstrate how to get the analytical expressions for the trained NNs, i.e., . Recall that with the present methodology the reaction term is now expressed as . Assume that we now have the knowledge that the reaction term is autonomous with respect to the solution, i.e. . We can then adopt the symbolic regression developed in cranmer2023interpretable to find the analytical expression of from and . The data for the symbolic regression are generated as , where are uniform grids points on , and and are the predicted means from the trained ensemble PINNs/B-PINNs. As displayed in Table 3, the recovered reaction model via symbolic regression agrees well with the reference solution as we have sufficient clean data. However, for the case with noisy and gappy data, the expression for the reaction model from symbolic regression does not match the reference solution. The result is expected since we can see in Fig. 5(c) that the predicted mean for does not agree well with the reference solution well and the predicted uncertainties are generally large. Generally, increasing the number of training data is able to reduce the predicted uncertainty in B-PINNs psaros2023uncertainty, zou2022neuraluq. Here we also show that the learned reaction model agrees better with the reference solution as we increase the training data from 50 to 101 in B-PINNs. A recommendation here is to use the predicted uncertainty as guidance, i.e., we use the symbolic regression for discovering equation when the predicted uncertainty is small to achieve better accuracy. More results for the symbolic regression can be found in B.2.
| Reference | Clean and sufficient data | Noisy and gappy data | Noisy and sufficient data |
|---|---|---|---|
3.2 Reaction-diffusion equation
We now consider the following time-dependent PDE that describes a reaction-diffusion system:
| (11) | ||||
where denotes the diffusion coefficient, is the reaction model, is the reaction rate, and is the source term. Similar as in Sec. 3.1, we test the following three cases:
- 1.
Case (A): The reaction model is correctly specified and the reaction rate is unknown.
- 2.
Case (B): The reaction model is misspecified as and the reaction rate is unknown.
- 3.
Case (C): The reaction model is misspecified as and we correct it with a DNN, i.e., (with known ).
We denote the reaction term as and we would like to identify from data of , and different physical models. In Case (A)/(B)/(C), the estimate of is //, where is the estimate of . We note that in Case (C) we assume is known because the model misspecification induced by wrong can be fully covered by .
Here we only consider a general scenario, i.e., the training data are noisy and gappy. In this case, we employ B-PINNs to identify with uncertainties. We assume that we have 121 measurements on and measurements of , which are evenly distributed in the temporal-spatial domain . In addition, the measurement errors for both and are assumed to be Gaussian, and the noise scales are and for and , respectively. Further, the reference solution is obtained by solving Eq. (11) with , , and . Similar as in Sec. 3.1, we use one DNN to model the sought solution and another DNN to approximate the discrepancy in Case (C). Details of the B-PINN method, e.g. hyperparameters of NNs and HMC, can be found in A.
As show in Fig. 7, we observe that: (1) the predicted means for and agree the best with the reference solutions as the reaction model is correctly specified (Case (A), second column in Fig. 7); (2) the predictions for and show significant discrepancy as compared to the reference solution when the reaction model is misspecified (Case (B), third column in Fig. 7); (3) the predicted mean for in Case (C) is similar as that in Case (A), in which the reaction model is correctly specified; and (4) the predicted mean for in Case (C) is not as good as the one in Case (A), but it is much better than the result in Case (B) where the reaction model is misspecified. All the results demonstrate that the added DNNs are able to correct the misspecified model which in turn enhance the computational accuracy in PINNs.
We further illustrate the predicted uncertainties for both and in Fig. 8. In particular, we only depict the uncertainties at one representative time for simplicity. As we can see, (1) the computational errors for both and are generally bounded by the predicted uncertainties in Case (A) (first column in Fig. 8) and Case (C) (third column in Fig. 8), while they cannot be bounded by the predicted uncertainties in the case with misspecified reaction model i.e. Case (B) (second column in Fig. 8), and (2) the predicted uncertainties for and are generally larger in Case (C) (third column in Fig. 8) than those in Case (A) (first column in Fig. 8), which are similar as the results in Sec. 3.1. Again, we attribute the difference between the predicted uncertainties for Case (A) and (C) to the model uncertainty.
3.3 2D non-Newtonian flows
In this section, we test the capability of the present approach in non-Newtonian flows where we misspecify the constitutive relation as the Newtonian one, and then we employ DNNs to correct the misspecified models. In particular, we consider the steady flows in a 2D channel and a 2D cavity, and the employed non-Newtonian fluids are power-law ones. The constitutive relation in a power-law fluid is expressed as , where is the dynamic viscosity of a fluid, is a constant, denotes the shear rate (), is the fluid velocify, and is the power law index. Without loss of generality, the fluids are shear-thinning (pseudoplastic, ) and shear-thickening (dilatant, ) in the channel and cavity flows, respectively.
3.3.1 Channel flow
The following 2D non-Newtonian channel flow is considered here and the corresponding governing equation is expressed as wang2015localized:
| (12) | ||||
where , is a constant, and . The analytical solution reads as
| (13) |
For this specific case, we set to generate the reference solution as well as training data.
In the first test case, we assume that we have clean measurements of and clean measurements of , randomly and uniformly sampled from , respectively. We assume the fluid is a Newtonian one and the viscosity is an unknown constant. We then employ the PINN method to identify the unknown viscosity in the following equation:
| (14) |
which describes Newtonian flows. Specifically, the boundary condition is hard-encoded in the equation for so that we only have two terms in the PINN loss function (2), i.e., for the data of and for the equation. As shown in Fig. 2(b), we cannot minimize and simultaneously in PINNs, regardless of the choice of belief weights for those two terms, indicating that the NN surrogate model is not able to fit the non-Newtonian data and satisfy the Newtonian physical law at the same time.
Similar as in previous two examples in this section, we can add a DNN as the correction in Eq. (14) to address the model misspecification issue in PINNs. The equation with the correction term can now be expressed as follows:
| (15) |
where denotes the correction term. Here we treat as known and set since we have a DNN to model the discrepancy. We present the results from the PINNs with a correction in Fig. 9(a), and we can see that the current predictions for and agree with the reference solutions much better than in the case where the model is misspecified.
We note that in this specific case we can also employ other approaches to address the issue that we cannot fit the data and satisfy the equation simultaneously in PINNs if the physical model is misspecified. A natural way is to treat the viscosity in Eq. (14) as an unknown function and employ a DNN to directly learn the constitutive relation. We present the corresponding results in Fig. 9(b), in which we employ the same setup, e.g., training data, NN architecture in PINNs, as used in Fig. 2 as well as Fig. 9(a). As shown, PINNs with a DNN for learning the viscosity now can fit and much better than the results in Fig. 2. We then compare the these results with the ones in Fig. 9(a). As shown, the predictions for are similar, but the PINN with a DNN as correction is able to provide more accurate predictions for , i.e., less fluctuations are observed in Fig. 9(a) than in Fig. 9(b). Furthermore, we illustrate the loss histories for training PINNs in these two approaches in Fig. 9(c). As we can see, the training loss decreases faster and converges to smaller values in the case where we add a DNN as correction to the misspecified model, as compared to the approach in which we model the viscosity as an unknown function. We conjecture that the superior performance of the proposed approach can be attributed to the following reason: modeling the viscosity as an unknown function via a DNN requires the accurate estimate of the derivatives in Eq. (14), which is quite challenging since results in very sharp gradients for the viscosity around . However, the correction term, i.e., in Eq. (14), is a quite smooth function, as shown in Fig. 10. Hence, we can expect the easier training as well as better accuracy in the proposed method.
We now move to the noisy-data case and employ B-PINNs to quantify the model uncertainty. The same noisy measurements of and noisy measurements of are sampled but now they are corrupted by additive Gaussian noise with and noise scales, respectively. In B-PINNs, we test two specific cases, i.e., (1) we assume the fluid is Newtonian and encode Eq. (14) in B-PINNs. The objective is then to infer the unknown viscosity given data, similar as the case in Fig. 2; and (2) we are not sure if the fluid is Newtonian or not, we then add a DNN as the correction to the possible misspecified model, i.e., Eq. (15). Also, we note that in this specific case can be computed analytically by plugging the analytic solution of the power-law fluid into Eq. (15): , which serves as the reference in what follows.
The results from B-PINNs are illustrated in Fig. 10. As observed, the NN surrogate is not able to fit the data and satisfy the misspecified physical model at the same time (Fig. 10(a)). In addition, with the additional DNN for correcting the misspecified physical model in the previous case, can now fit the data and satiafy the corrected physical model simultaneously, as shown in Fig. 10(b). Also, we can see that the computational errors between the predicted mean and the reference solution for are bounded by the predicted uncertainties in the entire computational domain.
3.3.2 Cavity flow
Next, we consider steady non-Newtonian flow in a two-dimensional lid-driven square cavity (i.e., ), which can be described by the incompressible Navier-Stokes equations as
| (16a) | ||||
| (16b) | ||||
where denotes the velocity in and directions, respectively; is the pressure; and is the kinematic viscosity. In particular, the boundary condition for the upper wall is expressed as
| (17) |
where , and are constant. Specifically, , is the length of the cavity. In addition, the remaining walls are stationary. Here, the viscosity model is the same as the one used in channel flow, i.e., . The objective is to learn the governing equations, which explain the data given measurements on , , and . In particular, the training data as well as the reference solution in this case are generated by solving Eq. (16a) using the lattice Boltzmann equation model (LBE) in wang2015localized with . Details for the computations in LBE can be found in C.
Similar as in Sec. 3.3.1, suppose we misspecify the governing equations as the ones for Newtonian flows, and we then employ the present approach to correct the model misspecification as follows:
| (18a) | ||||
| (18b) | ||||
where are the two components correcting the momentum equations in and directions, respectively, and for . The continuity equation Eq. (18a) is correctly specified and hence does not need correction.
We assume that we have random measurements of , random measurements of , and uniformly distributed measurements of from the reference solution. Here we only consider the case with clean data and the ensemble PINNs are employed for quantifying the model uncertainty. We would like to mention that we do not use B-PINNs here since we need to utilize several hundred training data to achieve meaningful results, which is computationally expensive as the HMC is used for posterior estimation. Similarly, we test two specific cases, i.e., (1) the viscosity in Eq. (18b) is an unknown constant and we do not use the correction in PINNs, and (2) we have an initial guess for the viscosity in Eq. (18b) and we add in PINNs for the correction for the possible misspecification. Specifically, we use one DNN to model the velocity , one DNN to approximate the pressure , and one DNN to model the discrepancy in Eq. (18b), i.e. . In particular, we set as the initial guess in Case (2) which will not affect the computational accuracy in PINNs since the model discrepancy is already leveraged by .
| Error of | Error of | Error of | Error of | |
|---|---|---|---|---|
| Misspecified model | ||||
| Misspecified model with correction |
.
We present the predictions for in Fig. 11. As we can see, PINNs with misspecified model lead to inaccurate inference for both and (Fig. 11(a)). The proposed approach, however, achieves much better results by adding a DNN to correct the model misspecification. We further illustrate the computational errors for both cases in Table 4, which clearly shows the effectiveness as well as superiority of the present method. In addition, we show some representative 1D slices for the predicted , and with uncertainties in Fig. 12. Similarly, the PINNs with misspecified model cannot fit the data and satisfy the physical model at the same time (Fig. 12(a)), while this issue can be handled well as we add a DNN to correct the misspecified model, as shown in Fig. 12(b).
4 Summary
We presented a general approach to improve the accuracy of physics-informed neural networks (PINNs) for discovering governing equations from data when the physical model is misspecified. In particular, we first assume the mathematical models for the specific problem we considered and encode them in PINNs via automatic differentiation. We note that the assumed models may be misspecified in certain complex systems since not all the physical processes are fully understood here. We then utilize another deep neural networks (DNN) to model the discrepancy between the imperfect models and the observational data in order to correct the misspecified model. In addition, to quantify uncertainties arising from noisy and/or gappy data, we employ two typical uncertainty-induced PINNs methods, i.e., the Bayesian physics-informed neural networks (B-PINNs) and ensemble PINNs. A series of numerical examples are conducted to show the effectiveness of the proposed method. Specifically, we considered (1) a reaction-diffusion system where we misspecified the reaction model, and (2) non-Newtonian flows in two-dimensional channel and cavity but misspecified the fluid viscosity. The results show that the present approach can achieve good accuracy since the added DNN is able to correct the misspecified physical models encoded in PINNs. Also, the B-PINNs and/or ensemble PINNs can provide reasonable uncertainty bounds for the discovered physical models, which reflects the uncertainties in physical models, i.e., model uncertainty. Furthermore, we showcase that we can seamlessly combine the proposed method with the symbolic regression to obtain explicit governing equations based on the trained NNs. Finally, we expect the proposed approach to be a promising tool in a wider class of applications for solving problems where the physical processes are not fully understood.
Acknowledgement
This work was supported by the MURI/AFOSR project (FA9550-20-1-0358), the DOE-MMICS SEA-CROGS project (DE-SC0023191), the NIH grant Neural Operator Learning to Predict Aneurysmal Growth and Outcomes (R01HL168473), and the NIH grant CRCNS: Waste-clearance flows in the brain inferred using physics-informed neural networks (R01AT012312). Z.Z. thanks Dr. Khemraj Shukla from Brown University for helpful discussion.
References
- [1] J. Zhang, W. Ma, Data-driven discovery of governing equations for fluid dynamics based on molecular simulation, Journal of Fluid Mechanics 892 (2020) A5.
- [2] J. C. Fyfe, V. V. Kharin, B. D. Santer, J. N. Cole, N. P. Gillett, Significant impact of forcing uncertainty in a large ensemble of climate model simulations, Proceedings of the National Academy of Sciences 118 (23) (2021) e2016549118.
- [3] M. Schmidt, H. Lipson, Distilling free-form natural laws from experimental data, science 324 (5923) (2009) 81–85.
- [4] S. L. Brunton, J. L. Proctor, J. N. Kutz, Discovering governing equations from data by sparse identification of nonlinear dynamical systems, Proceedings of the National Academy of Sciences 113 (15) (2016) 3932–3937.
- [5] S. H. Rudy, S. L. Brunton, J. L. Proctor, J. N. Kutz, Data-driven discovery of partial differential equations, Science advances 3 (4) (2017) e1602614.
- [6] Z. Chen, Y. Liu, H. Sun, Physics-informed learning of governing equations from scarce data, Nature communications 12 (1) (2021) 6136.
- [7] Z. Zhang, Y. Shin, G. Em Karniadakis, GFINNs: GENERIC formalism informed neural networks for deterministic and stochastic dynamical systems, Philosophical Transactions of the Royal Society A 380 (2229) (2022) 20210207.
- [8] K. Lee, N. Trask, P. Stinis, Structure-preserving sparse identification of nonlinear dynamics for data-driven modeling, in: Mathematical and Scientific Machine Learning, PMLR, 2022, pp. 65–80.
- [9] R. González-García, R. Rico-Martìnez, I. G. Kevrekidis, Identification of distributed parameter systems: A neural net based approach, Computers & chemical engineering 22 (1998) S965–S968.
- [10] R. Rico-Martinez, K. Krischer, I. Kevrekidis, M. Kube, J. Hudson, Discrete-vs. continuous-time nonlinear signal processing of cu electrodissolution data, Chemical Engineering Communications 118 (1) (1992) 25–48.
- [11] S. Zhang, G. Lin, Robust data-driven discovery of governing physical laws with error bars, Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences 474 (2217) (2018) 20180305.
- [12] M. Raissi, P. Perdikaris, G. E. Karniadakis, Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations, Journal of Computational Physics 378 (2019) 686–707.
- [13] L. Berger, M. Marinacci, Model uncertainty in climate change economics: A review and proposed framework for future research, Environmental and Resource Economics 77 (3) (2020) 475–501.
- [14] M. R. Ebers, K. M. Steele, J. N. Kutz, Discrepancy Modeling Framework: Learning missing physics, modeling systematic residuals, and disambiguating between deterministic and random effects, arXiv preprint arXiv:2203.05164 (2022).
- [15] Z. Chen, D. Xiu, On generalized residual network for deep learning of unknown dynamical systems, Journal of Computational Physics 438 (2021) 110362.
- [16] Z. Zhang, Z. Zou, E. Kuhl, G. E. Karniadakis, Discovering a reaction-diffusion model for Alzheimer’s disease by combining PINNs with symbolic regression, arXiv preprint arXiv:2307.08107 (2023).
- [17] B. Eastman, L. Podina, M. Kohandel, A PINN Approach to Symbolic Differential Operator Discovery with Sparse Data, in: The Symbiosis of Deep Learning and Differential Equations II, 2022.
- [18] S. Malani, T. S. Bertalan, T. Cui, J. L. Avalos, M. Betenbaugh, I. G. Kevrekidis, Some of the variables, some of the parameters, some of the times, with some physics known: Identification with partial information, arXiv preprint arXiv:2304.14214 (2023).
- [19] A. Zhu, T. Bertalan, B. Zhu, Y. Tang, I. G. Kevrekidis, Implementation and (inverse modified) error analysis for implicitly-templated ode-nets, arXiv preprint arXiv:2303.17824 (2023).
- [20] A. F. Psaros, X. Meng, Z. Zou, L. Guo, G. E. Karniadakis, Uncertainty quantification in scientific machine learning: Methods, metrics, and comparisons, Journal of Computational Physics 477 (2023) 111902.
- [21] Z. Zou, X. Meng, A. F. Psaros, G. E. Karniadakis, NeuralUQ: A comprehensive library for uncertainty quantification in neural differential equations and operators, arXiv preprint arXiv:2208.11866 (2022).
- [22] W. S. Parker, Ensemble modeling, uncertainty and robust predictions, Wiley interdisciplinary reviews: Climate change 4 (3) (2013) 213–223.
- [23] S. N. Gosling, G. R. McGregor, J. A. Lowe, The benefits of quantifying climate model uncertainty in climate change impacts assessment: an example with heat-related mortality change estimates, Climatic Change 112 (2012) 217–231.
- [24] L. Yang, X. Meng, G. E. Karniadakis, B-PINNs: Bayesian physics-informed neural networks for forward and inverse PDE problems with noisy data, Journal of Computational Physics 425 (2021) 109913.
- [25] L. Lu, X. Meng, Z. Mao, G. E. Karniadakis, DeepXDE: A deep learning library for solving differential equations, SIAM review 63 (1) (2021) 208–228.
- [26] S. Cai, Z. Mao, Z. Wang, M. Yin, G. E. Karniadakis, Physics-informed neural networks (PINNs) for fluid mechanics: A review, Acta Mechanica Sinica 37 (12) (2021) 1727–1738.
- [27] G. Pang, L. Lu, G. E. Karniadakis, fPINNs: Fractional physics-informed neural networks, SIAM Journal on Scientific Computing 41 (4) (2019) A2603–A2626.
- [28] E. Kharazmi, Z. Zhang, G. E. Karniadakis, hp-VPINNs: Variational physics-informed neural networks with domain decomposition, Computer Methods in Applied Mechanics and Engineering 374 (2021) 113547.
- [29] A. D. Jagtap, G. E. Karniadakis, Extended Physics-informed Neural Networks (XPINNs): A Generalized Space-Time Domain Decomposition based Deep Learning Framework for Nonlinear Partial Differential Equations, in: AAAI spring symposium: MLPS, Vol. 10, 2021.
- [30] A. D. Jagtap, E. Kharazmi, G. E. Karniadakis, Conservative physics-informed neural networks on discrete domains for conservation laws: Applications to forward and inverse problems, Computer Methods in Applied Mechanics and Engineering 365 (2020) 113028.
- [31] Z. Zou, G. E. Karniadakis, L-HYDRA: multi-head physics-informed neural networks, arXiv preprint arXiv:2301.02152 (2023).
- [32] K. Linka, A. Schäfer, X. Meng, Z. Zou, G. E. Karniadakis, E. Kuhl, Bayesian Physics Informed Neural Networks for real-world nonlinear dynamical systems, Computer Methods in Applied Mechanics and Engineering 402 (2022) 115346.
- [33] P. Chen, T. Meng, Z. Zou, J. Darbon, G. E. Karniadakis, Leveraging multi-time Hamilton-Jacobi PDEs for certain scientific machine learning problems, arXiv preprint arXiv:2303.12928 (2023).
- [34] Multi-variance replica exchange SGMCMC for inverse and forward problems via Bayesian PINN, author=Lin, Guang and Wang, Yating and Zhang, Zecheng, Journal of Computational Physics 460 (2022) 111173.
- [35] W. T. Leung, G. Lin, Z. Zhang, NH-PINN: Neural homogenization-based physics-informed neural network for multiscale problems, Journal of Computational Physics 470 (2022) 111539.
- [36] K. Tang, X. Wan, C. Yang, DAS-PINNs: A deep adaptive sampling method for solving high-dimensional partial differential equations, Journal of Computational Physics 476 (2023) 111868.
- [37] K. Tang, J. Zhai, X. Wan, C. Yang, Adversarial Adaptive Sampling: Unify PINN and Optimal Transport for the Approximation of PDEs, arXiv preprint arXiv:2305.18702 (2023).
- [38] X. Meng, H. Babaee, G. E. Karniadakis, Multi-fidelity Bayesian neural networks: Algorithms and applications, Journal of Computational Physics 438 (2021) 110361.
- [39] M. Sarabian, H. Babaee, K. Laksari, Physics-informed neural networks for brain hemodynamic predictions using medical imaging, IEEE transactions on medical imaging 41 (9) (2022) 2285–2303.
- [40] L. Guo, H. Wu, X. Yu, T. Zhou, Monte carlo fpinns: Deep learning method for forward and inverse problems involving high dimensional fractional partial differential equations, Computer Methods in Applied Mechanics and Engineering 400 (2022) 115523.
- [41] Z. Gao, L. Yan, T. Zhou, Failure-informed adaptive sampling for pinns, SIAM Journal on Scientific Computing 45 (4) (2023) A1971–A1994.
- [42] M. Yin, Z. Zou, E. Zhang, C. Cavinato, J. D. Humphrey, G. E. Karniadakis, A generative modeling framework for inferring families of biomechanical constitutive laws in data-sparse regimes, Journal of the Mechanics and Physics of Solids 181 (2023) 105424.
- [43] S. Ruder, An overview of gradient descent optimization algorithms, arXiv preprint arXiv:1609.04747 (2016).
- [44] B. Lakshminarayanan, A. Pritzel, C. Blundell, Simple and scalable predictive uncertainty estimation using deep ensembles, Advances in Neural Information Processing Systems 30 (2017).
- [45] E. Kiyani, K. Shukla, G. E. Karniadakis, M. Karttunen, A Framework Based on Symbolic Regression Coupled with eXtended Physics-Informed Neural Networks for Gray-Box Learning of Equations of Motion from Data, arXiv preprint arXiv:2305.10706 (2023).
- [46] M. Cranmer, Interpretable machine learning for science with PySR and SymbolicRegression. jl, arXiv preprint arXiv:2305.01582 (2023).
- [47]
T. M. Inc., Matlab version: 9.13.0 (r2022b) (2022).
URL https://www.mathworks.com - [48] D. P. Kingma, J. Ba, Adam: A method for stochastic optimization, arXiv preprint arXiv:1412.6980 (2014).
- [49] L. Wang, J. Mi, X. Meng, Z. Guo, A localized mass-conserving lattice Boltzmann approach for non-Newtonian fluid flows, Communications in Computational Physics 17 (4) (2015) 908–924.
- [50] R. M. Neal, et al., MCMC using Hamiltonian dynamics, Handbook of Markov Chain Monte Carlo 2 (11) (2011) 2.
Appendix A Details of hyperparameters in numerical experiments
In Sec. 3.1, DNNs used to model / have two hidden layers, each of which has neurons and is equipped with hyperbolic tangent as the activation function, and take as input and output /. In Sec. 3.2, DNNs have two hidden layers and each layer has neurons and a hyperbolic tangent activation function. They take as input and output or . In Sec. 3.3.1, DNNs have two hidden layers ( neurons and a hyperbolic tangent activation function) and take as input and output or . In Sec. 3.3.2, a DNN with three hidden layers ( neurons and a hyperbolic tangent activation function) is used to model . That is, this DNN takes as input and outputs . Another DNN with three hidden layers ( neurons and a hyperbolic tangent activation function) is used to model . Besides, an additional DNN with three hidden layers ( neurons and a hyperbolic tangent activation function) is used to correct two misspecified equations and it takes as input and outputs .
The ensemble PINN method psaros2023uncertainty, zou2022neuraluq is used for clean data to obtain predictions with UQ. In Sec. 3.1, PINNs are independently trained with Adam optimizer kingma2014adam ( learning rate) for iterations. In Sec. 3.3.2, PINNs are independently trained with Adam optimizer ( learning rate) for iterations. To obtain results shown in Fig. 9, PINNs are trained with Adam optimizer for iterations. The learning rate decays from to for stable training.
The B-PINN method yang2021b is used for noisy data to obtain predictions with UQ. In all related examples, parameters of DNNs are assumed to be identically independent distributed (i.i.d.) Gaussian as the prior distribution with mean zero and standard deviation one. The likelihood distribution is also assumed to be independent Gaussian where the standard deviation is the known noise scale for additive Gaussian noise. In addition, Hamiltonian Monte Carlo (HMC) with adaptive step size neal2011mcmc is used to obtain posterior samples, in which the number of posterior samples is set to and the number of steps for the leap-frog scheme is set to . The number of burn-in samples and the initial step are tuned such that the acceptance rate lies between and . A open-sourced Python library for UQ in scientific machine learning, termed NeuralUQ zou2022neuraluq, is used for fast and convenient implementations.
Appendix B Additional results for the ODE system
B.1 Clean and gappy data
| Error of | Error of | Error of | Error of | ||
|---|---|---|---|---|---|
| Case (A): Known model | |||||
| Case (B): Misspecified model | |||||
| Case (C): Corrected model |
In Sec. 3.1, we considered both clean and noisy data cases. In clean data cases, we used sufficient clean data to demonstrate the effect of model misspecifications. Specifically, data are collected from values of and on sampling points uniformly distributed on . An alternative approach to estimate the reaction model is using finite difference scheme to approximate and then compute as . The shortcoming of this approach is that it is not applicable to more general dataset, e.g. data of and are not sampled on uniform grids and/or are not sampled from the same sensors. To showcase the generality of the proposed method, here we further consider a case where the data is clean but randomly sampled from .
As shown in Fig. 13(a) and Table 5, PINNs with correct physical model (Case (A)) yields the best results in predicting and identifying the governing equations. The results of PINNs with misspecified physical model (Case (B)) and our approach deliver consistent results with all the other cases in Sec.3.1. As illustrated in Fig. 13(c) as well as Table 5, our approach produces accurate inference of and the surrogate model is able to satisfy the ODE and fit the data at the same time, indicating that the generality of the present approach in handling model misspecification with clean but gappy data. We also notice that, compared to the case where data are clean and sufficient, here the predicted uncertainty and the error of from our approach are much larger (shown in Fig. 13(c) and Table 5). We note that when compared with Case (A) where the physical model is known with the same dataset, the increase of the predicted uncertainty and the error is caused by the model uncertainty; when compared with the clean-and-sufficient-data case, it is instead caused by the gappy data.
B.2 Symbolic regression
In Fig. 14, we present plots of the discovered equation using symbolic regression in various cases; see Sec. 3.1 for details and Table 3 for the discovered mathematical expressions. Recall that in noisy-data cases, we employed B-PINNs and obtained uncertainties in predicting and . By forming the data for symbolic regression as , we in fact obtain uncertainty in as well, which is leveraged in the following symbolic regression. As shown in Fig. 14, for noisy-data cases, we also perform symbolic regression on the upper and lower bounds of the uncertainty band in predicting . Although the discovered mathematical expressions in Table 3 from noisy-data cases are not as accurate, the error in function values is bounded by the upper and lower bounds. Besides, due to the increase of data, the predicted uncertainty from the noisy-and-sufficient-data case is significantly smaller.
Appendix C Details for the computations in lattice Boltzman equation model
In this section, we provide details for generating data of the non-Newtonian Cavity flow in Sec. 3.3.2 using the lattice Boltzman equation model (LBE) in wang2015localized. We set Re and use a uniform mesh of size on to perform the simulations.