ENFORCING DIRICHLET BOUNDARY CONDITIONS IN PHYSICS -INFORMED NEURAL NETWORKS AND VARIATIONAL PHYSICS -INFORMED NEURAL NETWORKS

2025-05-06 0 0 5.77MB 22 页 10玖币
侵权投诉
ENFORCING DIRICHLET BOUNDARY CONDITIONS IN
PHYSICS-INFORMED NEURAL NETWORKS AND VARIATIONAL
PHYSICS-INFORMED NEURAL NETWORKS
A PREPRINT
S. BerroneC. CanutoM. PintoreN. Sukumar
August 1, 2023
ABSTRACT
In this paper, we present and compare four methods to enforce Dirichlet boundary conditions in
Physics-Informed Neural Networks (PINNs) and Variational Physics-Informed Neural Networks
(VPINNs). Such conditions are usually imposed by adding penalization terms in the loss function
and properly choosing the corresponding scaling coefficients; however, in practice, this requires an
expensive tuning phase. We show through several numerical tests that modifying the output of the
neural network to exactly match the prescribed values leads to more efficient and accurate solvers.
The best results are achieved by exactly enforcing the Dirichlet boundary conditions by means of
an approximate distance function. We also show that variationally imposing the Dirichlet boundary
conditions via Nitsche’s method leads to suboptimal solvers.
Keywords Dirichlet boundary conditions, PINN, VPINN, deep neural networks, approximate distance function
2020 MSC 35A15, 65L10, 65L20, 65K10, 68T05
1 Introduction
Physics-Informed Neural Networks (PINNs), proposed in [
36
] after the initial pioneering contributions of Lagaris et
al. [
27
,
28
,
29
], are rapidly emerging computational methods to solve partial differential equations (PDEs). In its basic
formulation, a PINN is a neural network that is trained to minimize the PDE residual on a given set of collocation points
in order to compute a corresponding approximate solution. In particular, the fact that the PDE solution is sought in a
nonlinear space via a nonlinear optimizer distinguishes PINNs from classical computational methods. This provides
PINNs flexibility, since the same code can be used to solve completely different problems by adapting the neural network
loss function that is used in the training phase. Moreover, due to the intrinsic nonlinearity and the adaptive architecture
of the neural network, PINNs can efficiently solve inverse [
8
,
16
,
33
], parametric [
15
], high-dimensional [
17
,
30
] as
well as nonlinear [
21
] problems. Another important feature characterizing PINNs is that it is possible to combine
distinct types of information within the same loss function to readily modify the optimization process. This is useful,
for instance, to effortlessly integrate (synthetic or experimental) external data into the training phase to obtain an
approximate solution that is computed using both data and physics [9].
In order to improve the original PINN idea, several extensions have been developed. Some of these developments
include the Deep Ritz method (DRM) [
45
], in which the energy functional of a variational problem is minimized; the
conservative PINN (cPINN) [
20
], where the approximate solution is computed by a domain-decomposition approach
enforcing flux conservation at the interfaces, as well as its improvement in the extended PINN (XPINN) [
19
]; and the
variational PINN (VPINN) [22, 23], in which the loss function is defined by exploiting the variational structure of the
underlying PDE.
Dipartimento di Scienze Matematiche, Politecnico di Torino, Corso Duca degli Abruzzi 24, 10129 Torino, Italy. ste-
fano.berrone@polito.it (S. Berrone), claudio.canuto@polito.it (C. Canuto), moreno.pintore@polito.it (M. Pintore).
Department of Civil and Environmental Engineering, University of California, Davis, CA 95616, USA. nsukumar@ucdavis.edu
arXiv:2210.14795v2 [math.NA] 31 Jul 2023
Enforcing Dirichlet boundary conditions in PINNs and VPINNs A PREPRINT
Most of the existing PINN approaches enforce the essential (Dirichlet) boundary conditions by means of additional
penalization terms that contribute to the loss function, these are each multiplied by constant weighting factors. See
for instance [
11
,
12
,
13
,
18
,
35
,
38
,
41
,
47
,
49
]; note that this list is by no means exhaustive, therefore we also refer
to [
4
,
10
,
31
] for more detailed overviews of the PINN literature. However, such an approach may lead to poor
approximation, and therefore several techniques to improve it have been proposed. In [
32
] and [
43
], adaptive scaling
parameters are proposed to balance the different terms in the loss functions. In particular, in [
32
] the parameters are
updated during the minimization to maximize the loss function via backpropagation, whereas in [
43
] a fixed learning
rate annealing procedure is adopted. Other alternatives are related to adaptive sampling strategies (e.g., [
26
,
40
,
14
]) or
to specific techniques such as the Neural Tangent Kernel [44].
Note that although it is possible to automatically tune these scaling parameters during the training, such techniques
require more involved implementations and in most cases lead to intrusive methods since the optimizer has to be
modified. Instead, in this paper, we focus on three simple and non-intrusive approaches to impose Dirichlet boundary
conditions and we compare their accuracy and efficiency. The proposed approaches are tested using standard PINN and
interpolated VPINN which have been proven to be more stable than standard VPINNs [6].
The main contributions of this paper are as follows:
1.
We present three non-standard approaches to enforce Dirichlet boundary conditions on PINNs and VPINNs,
and discuss their mathematical formulation and their pros and cons. Two of them, based on the use of an
approximate distance function, modify the output of the neural network to exactly impose such conditions,
whereas the last one enforces them approximately by a weak formulation of the equation.
2.
The performance of the distinct approaches to impose Dirichlet boundary conditions is assessed on various
test cases. On average, we find that exactly imposing the boundary conditions leads to more efficient and
accurate solvers. We also compare the interpolated VPINN to the standard PINN, and observe that the different
approaches used to enforce the boundary conditions affect these two models in similar ways.
The structure of the remainder of this paper is as follows. In Section 2, the PINN and VPINN formulations are described:
first, we describe the neural network architecture in Section 2.1 and then focus on the loss functions that characterize
the two models in Section 2.2. Subsequently, in Section 3, we present the four approaches to enforce the imposition
of Dirichlet boundary conditions; three of them can be used with both PINNs and VPINNs, whereas the last one is
used to enforce the required boundary conditions only on VPINNs because it relies on the variational formulation.
Numerical results are presented in Section 4. In Section 4.1, we first analyze for a second-order elliptic problem the
convergence rate of the VPINN with respect to mesh refinement. In doing so, we demonstrate that when the neural
network is properly trained, identical optimal convergence rates are realized by all approaches only if the PDE solution
is simple enough. Otherwise, only enforcing the Dirichlet boundary conditions with Nitsche’s method or by exactly
imposing them via approximate distance functions ensure the theoretical convergence rate. In addition, we compare
the behavior of the loss function and the
H1
error while increasing the number of epochs, as well as the behavior of
the error when the network architecture is varied. In Section 4.2, we show that it is also possible to efficiently solve
second-order parametric nonlinear elliptic problems. Furthermore, in Sections 4.3– 4.5, we compare the performance of
all approaches on PINNs and VPINNs by solving a linear elasticity problem and a stabilized Eikonal equation over an
L-shaped domain, and a convection problem. Finally, in Section 5, we close with our main findings and present a few
perspectives for future work.
2 PINNs and interpolated variational PINNs
In this section, we describe the PINN and VPINN that are used in Section 4. In particular, in Section 2.1 the neural
network architecture is presented, and the construction of the loss functions is discussed in Section 2.2.
2.1 Neural network description
In this work we compare the efficiency of four approaches to enforce Dirichlet boundary conditions in PINN and
VPINN. The main difference between these two numerical models is the training loss function; the architecture of the
neural network is the same and is independent of the way the boundary conditions are imposed.
In our numerical experiments we only consider fully-connected feed forward neural networks with a fixed architecture.
Such neural networks can be represented as nonlinear parametric functions
uNN :RNin RNout
that can be evaluated
via the following recursive formula:
x
i=σiAix
i1+bi, i = 1,2, . . . , L. (2.1)
2
Enforcing Dirichlet boundary conditions in PINNs and VPINNs A PREPRINT
In particular, with the notation of
(2.1)
,
x
0RNin
is the neural network input vector,
x
LRNout
is the neural network
output vector, the neural network architecture consists of an input layer,
L1
hidden layers and one output layer,
Ai
and
bi
are matrices and vectors containing the neural network weights, and
σi:RR
is the activation function of the
i
-th layer and is element-wise applied to its input vector. We also remark that the
i
-th layer is said to contain
dim(x
i)
neurons and that
σi
has to be nonlinear for any
i= 1,2, . . . , L 1
. Common nonlinear activation functions are the
rectified linear unit (
ReLU(x) := max(0, x)
), the hyperbolic tangent and the sigmoid function. In this work, we take
σLto be the identity function in order to avoid imposing any constraint on the neural network output.
The weights contained in
Ai
and
bi
can be logically reorganized in a single vector
wNN
. The goal of the training phase
is to find a vector
wNN
that minimizes the loss function; however, since such a loss function is nonlinear with respect
to wNN and the corresponding manifold is extremely complicated, we can at best find good local minima.
2.2 PINN and interpolated VPINN loss functions
For the sake of simplicity, the loss function for PINN and interpolated VPINN is stated for second-order elliptic
boundary-value problems. However, the discussion can be directly generalized to different PDEs, and in Section 4,
numerical results associated with other problems are also presented.
Let us consider the model problem:
Lu := −∇ · (µu) + β· ∇u+σu =fin ,
u=gon ΓD,
µu
n =ψon ΓN,
(2.2)
where
Rn
is a bounded domain whose Lipschitz boundary
is partitioned as
Ω = ΓDΓN
, with
measn1D)>0
. For the well-posedness of the boundary-value problem we require
µ
,
σL(Ω)
and
β(W1,(Ω))n
satisfying, in the entire domain
,
µµ0
for some strictly positive constant
µ0
and
σ1
2·β0
.
Moreover,
fL2(Ω)
,
ψL2N)
and
g=u|ΓD
for some
uH1(Ω)
. We point out that even if these assumptions
ensure the well-posedness of the problem, PINNs and VPINNs often struggle to compute low regularity solutions. We
refer to [42] for a recent example of a neural network based model that overcomes this issue.
In order to train a PINN, one introduces a set of collocation points
{x1, . . . , xNI}
and evaluates the corresponding
equation residuals {rPINN
1, . . . , rPINN
NI}. Such residuals, for problem (2.2), are defined as:
rPINN
i(u) = −∇ · (µu)(xi) + β· ∇u(xi) + σu(xi)f(xi)i= 1,2, . . . , NI.(2.3)
Since we are interested in a neural network that satisfies the PDE in a discrete sense, the loss function minimized during
the PINN training is:
R2
PINN(w) =
NI
X
i=1 rPINN
i(w)
2.(2.4)
In
(2.4)
, when
NI
is sufficiently large and
R2
PINN(uNN)
is close to zero, the function
uNN
represented by the neural
network output approximately satisfies the PDE and can thus be considered a good approximation of the exact solution.
Other terms are often added to impose the boundary conditions or improve the training, which are discussed in Section 3.
Let us now focus on the interpolated VPINN proposed in [
6
]. We introduce the function spaces
U:= H1(Ω)
and
V:= {vH1(Ω) : v|ΓD= 0}, the bilinear form a:U×VRand the linear form F:VR,
a(w, v) = Z
µw· ∇v+βwv +σwv, F (v) = Z
fv +ZΓN
ψv.
The variational counterpart of problem (2.2) thus reads: Find uUsuch that:
a(u, v) = F(v)vV,
u=gon ΓD.(2.5)
In order to discretize problem
(2.5)
, we use two discrete function spaces. Inspired by the Petrov-Galerkin framework,
we denote the discrete trial space by
UhU
and the discrete test space by
VhV
. The functions comprising such
spaces are generated on two conforming, shape-regular and nested partitions
TH
and
Th
with compatible meshsizes
H
and
h
, respectively. Assuming that
Th
is the finer mesh, one can claim that
Hh < H
and that every element of
Th
is
strictly contained in an element of TH.
3
Enforcing Dirichlet boundary conditions in PINNs and VPINNs A PREPRINT
0 0.2 0.4 0.6 0.8 1
0
0.5
1
(a)
0 0.2 0.4 0.6 0.8 1
-0.5
0
0.5
1
(b) (c)
Fig. 1 Pair of meshes and corresponding basis functions of a one-dimensional discretization (left) and nested meshes
TH
and
Th
in a two-dimensional domain (right). (a) Basis functions of
Vh
. The filled circles (red) are the nodes of
the corresponding mesh
Th
; (b) Basis functions of
UH
. The filled circles (blue) are the vertex nodes that define the
elements of the corresponding mesh
TH
; and (c) Meshes used in the numerical experiments of Sections 4.3 and 4.4.
The blue mesh is TH, the red one is Th. All the figures are obtained with q= 3,ktest = 1,kint = 4.
Denoting by
UH:= span{φu
i:iIH} ⊂ U
the space of piecewise polynomial functions of order
kint
over
TH
and
Vh:= span{φv
i:iIh} ⊂ V
the space of piecewise polynomial functions of order
ktest
over
Th
that vanish on
ΓD
,
we define the discrete variational problem as: Find uUHsuch that:
a(u, v) = F(v)vVh,
u=gHon ΓD,(2.6)
where
gH
is a suitable piecewise polynomial approximation of
g
. A representation of the spaces
UH
and
Vh
in a
one-dimensional domain is provided in Figures 1a and 1b. Examples of pair of meshes
TH
and
Th
are shown in Fig. 1c.
In order to obtain computable forms
ah
and
Fh
, we introduce elemental quadrature rules of order
q
and define
ah(·,·)
and
Fh(·)
as the approximations of
a(·,·)
and
F(·)
computed with such quadrature rules. In [
6
], under suitable
assumptions, an a priori error estimate with respect to mesh refinement has been proved when
q=kint +ktest 2
. It is
then possible to define the computable variational residuals associated with the basis functions of Vhas:
rh,i(w) = Fh(φv
i)ah(w, φv
i), i Ih.(2.7)
Consequently, in order to compute an approximate solution of problem
(2.6)
, one seeks a function
wUH
that
minimizes the quantity:
R2
h(w) = X
iIh
r2
h,i(w),(2.8)
and satisfies the imposed boundary conditions. We refer to Section 3 for a detailed description of different approaches
used to impose Dirichlet boundary conditions. It should be noted that, since in Sections 4.2–4.5 we consider problems
other than
(2.2)
, the residuals in
(2.7)
have to be suitably modified, while the loss function structure defined in
(2.8)
is
maintained.
We are interested in using a neural network to find the minimizer of
R2
h
. We thus denote by
IH:C0(Ω) UH
an
interpolation operator used to map the function
uNN
associated with the neural network to its interpolating element in
UH
, and train the neural network to minimize the quantity
R2
h(IHuNN )
. We highlight that in order to construct the
function
IHuNN
, the neural network has to be evaluated only on
dim(UH)
interpolation points
{xI
1, . . . , xI
dim(UH)} ⊂
.
Then, assuming that {φu
i:iIH}is a Lagrange basis such that φu
i(xI
j) = δij for every i, j IH, it holds:
IHuNN =X
iIH
uNN (xI
i)φu
i.(2.9)
4
Enforcing Dirichlet boundary conditions in PINNs and VPINNs A PREPRINT
We remark that the approaches proposed in Section 3 can also be used on non-interpolated VPINNs. However, we
restrict our analysis to interpolated VPINNs because of their better stability properties (see Fig. 11 and the corresponding
discussion).
3 Mathematical formulation
We compare four methods to impose Dirichlet boundary conditions on PINNs and VPINNs. We do not consider
Neumann or Robin boundary conditions since they can be weakly enforced by the trained VPINN due to the chosen
variational formulation (computations using PINNs is discussed in [
39
]). We also highlight that method
MD
below
can be used only with VPINNs because it relies on the variational formulation of the PDE. We analyze the following
methods:
MA:
Incorporation of an additional cost in the loss function that penalizes unsatisfied boundary conditions; this is
the standard approach in PINNs and VPINNs because of its simplicity and effectiveness. In fact, it is possible
to choose
NB
control points
{xg
1, . . . , xg
NB} ⊂ ΓD
and modify the loss functions defined in
(2.4)
or
(2.8)
as
follows:
R2
PINN(w) =
NI
X
i=1 rPINN
i(w)
2+λ
NB
X
i=1
(w(xg
i)g(xg
i))2,(3.1)
or
R2
h(w) = X
iIh
r2
h,i(w) + λ
NB
X
i=1
(w(xg
i)g(xg
i))2,(3.2)
where
λ > 0
is a model hyperparameter. Note that on considering the interpolated VPINN and exploiting the
solution structure in
(2.9)
, it is possible to ensure the uniqueness of the numerical solution by choosing the
control points {xg
1, . . . , xg
NB}as the NBinterpolation points belonging to ΓD.
We also highlight that such a method can be easily adapted to impose other types of boundary conditions just
by adding suitable terms to
(3.1)
and
(3.2)
. On the other hand, despite its simplicity, the main drawback of this
approach is that it leads to a more complex multi-objective optimization problem.
MB:
Exactly imposing the Dirichlet boundary conditions as described in [
39
] and [
6
]. In this method we add a
non-trainable layer Bat the end of the neural network to modify its output waccording to the rule:
Bw =g+ϕw, (3.3)
where
gC0(Ω)
is an extension of the function
g
inside the domain
(i.e.,
g|ΓD=g
) and
ϕC0(Ω)
is
an approximate distance function (ADF) to the boundary
ΓD
, i.e.,
ϕ(x)=0
if and only if
xΓD
, and it is
positive elsewhere. During the training phase one minimizes the quantity R2
PINN(Bw)or R2
h(Bw).
For the sake of simplicity, we only consider ADFs for two-dimensional unions of segments, even though the
approach generalizes to more complex geometries. Following the derivation of
g
and
ϕ
in [
39
], we start by
defining
d
as the signed distance function from
x:= (x, y)
to the line defined by the segment
AB
of length
L
with vertices A= (xA, yA)and B= (xB, yB):
d(x) = (xxA)(yByA)(yyA)(xBxA)
L.
Then, we denote
(xc, yc) := (xA+xB)/2,(yA+yB)/2
to be the center of
AB
and define
t
as the following
trimming function:
t(x) = 1
L"L
22
− ∥(x, y)(xc, yc)2#.
Note that t0defines a circle of center (xc, yc). Finally, the ADF to AB is defined as
ϕ(x) = v
u
u
td2+ t2+d4t
2!2
.
A graphical representation of
d(x)
,
t(x)
and
ϕ(x)
for an inclined line segment is shown in Figures 2a, 2b
and2c, respectively.
5
摘要:

ENFORCINGDIRICHLETBOUNDARYCONDITIONSINPHYSICS-INFORMEDNEURALNETWORKSANDVARIATIONALPHYSICS-INFORMEDNEURALNETWORKSAPREPRINTS.Berrone∗C.Canuto∗M.Pintore∗N.Sukumar†August1,2023ABSTRACTInthispaper,wepresentandcomparefourmethodstoenforceDirichletboundaryconditionsinPhysics-InformedNeuralNetworks(PINNs)and...

展开>> 收起<<
ENFORCING DIRICHLET BOUNDARY CONDITIONS IN PHYSICS -INFORMED NEURAL NETWORKS AND VARIATIONAL PHYSICS -INFORMED NEURAL NETWORKS.pdf

共22页,预览5页

还剩页未读, 继续阅读

声明:本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。玖贝云文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知玖贝云文库,我们立即给予删除!
分类:图书资源 价格:10玖币 属性:22 页 大小:5.77MB 格式:PDF 时间:2025-05-06

开通VIP享超值会员特权

  • 多端同步记录
  • 高速下载文档
  • 免费文档工具
  • 分享文档赚钱
  • 每日登录抽奖
  • 优质衍生服务
/ 22
客服
关注