Hard-constraining Neumann boundary conditions in physics-informed neural networks via Fourier feature embeddings
Christopher Straub, Philipp Brendel, Vlad Medvedev, Andreas Rosskopf
TL;DR
The paper tackles the challenge of hard-constraining Neumann boundary conditions within physics-informed neural networks (PINNs) for diffusion-type problems, illustrated by a 1D model $\partial_t u = D\,\partial_x^2 u$ on $x\in[0,1]$ with Neumann data. It introduces a Fourier cosine feature embedding of the spatial input, where $\gamma(x)=(\cos(\pi x), \cos(\pi b_2 x), \ldots)$, so that the transformed solution $\tilde{u}(x,t)=u^{NN}(\gamma(x),t)$ satisfies vanishing Neumann conditions via the chain rule; non-vanishing BCs are handled by explicit additive terms, and the framework extends to general intervals and higher dimensions. The approach is evaluated against existing hard-constraining methods and vanilla PINNs on a forward diffusion problem, showing superior accuracy in high-frequency and multiscale settings, with favorable training-time profiles. The method is simple to implement, computationally efficient, and extensible to inverse problems and operator learning tasks, potentially broadening the applicability of PINNs to multiscale physical processes.
Abstract
We present a novel approach to hard-constrain Neumann boundary conditions in physics-informed neural networks (PINNs) using Fourier feature embeddings. Neumann boundary conditions are used to described critical processes in various application, yet they are more challenging to hard-constrain in PINNs than Dirichlet conditions. Our method employs specific Fourier feature embeddings to directly incorporate Neumann boundary conditions into the neural network's architecture instead of learning them. The embedding can be naturally extended by high frequency modes to better capture high frequency phenomena. We demonstrate the efficacy of our approach through experiments on a diffusion problem, for which our method outperforms existing hard-constraining methods and classical PINNs, particularly in multiscale and high frequency scenarios.
