F ULLY C ONVOLUTIONAL A PPROACH FOR S IMULATING W AVE D YNAMICS
Anonymous authors
Paper under double-blind review
A BSTRACT
In this work we investigate the performance of fully convolutional networks to predict the motion and interaction of surface waves in open and closed complex geometries.
We focus on a U-Net architecture and assess its ability to capture and extrapolate wave propagation in time as well as the reﬂection, interference and diffraction of waves.
We investigate how well the network generalises both to long-time predictions and to geometric conﬁgurations not seen during training.
We demonstrate that our U-Net architecture is capable of accurately predicting the height distribution of waves on a liquid surface within curved and multi-faceted open and closed geometries, when only simple box and right-angled corner geometries were seen during training.
We found the RMSE of the predictions remained of order 1 × 10 − 4 times the characteristic length of the domain for at least 20 time-steps.
I NTRODUCTION
Predicting the spatio-temporal dynamics of physical systems is a recurrent problem in many areas of science and engineering.
A well-established process consists of describing the physical phenomena by human-engineered mathematical models, which captures our current understanding of the physical laws governing the system, but whose complexity may prevent ﬁnding analytical solutions.
Scientists therefore frequently turn to numerical solvers to simulate such mathematical models and generate accurate approximations to their solution.
The huge progress in machine learning (ML) algorithms and increased availability of computational power during the last decade has motivated a signiﬁcant growth in the popularity of data-driven physics.
In this ﬁeld, the interpolation capabilities of neural networks (NNs) have been mostly used in two ways: ﬁrst, to solve partial differential equations (PDEs) in an unsupervised manner (Dissanayake & Phan-Thien, 1994; Lagaris et al., 1998; 2000; Raissi et al., 2019) and second, to predict the physical dynamics from previous observations without knowledge of the underlying equations (Guo et al., 2016; Farimani et al., 2017; Thuerey et al., 2018; Lee & You, 2018).
Unlike the ﬁrst approach, the latter does not lead to an analytical representation of the physical dynamics, however, it makes feasible to produce predictions for a diversity of physical domains, boundary conditions and initial conditions without needing to re-train the network, provided that the physical laws are unaltered.
Recent studies applying convolutional neural networks (CNNs) to simulate ﬂuid dynamics have reported a speed-up of up to four orders of magnitude, in comparison to traditional numerical solvers, while keeping a similar accuracy (Guo et al., 2016).
The major shortcoming of NNs are their often poor generalization to unseen conﬁgurations and poor long-time predictions in unsteady simulations.
In this work, we investigate the application of fully convolutional neural networks to the problem of forecasting surface wave dynamics, the motion of which is mathematically described by the shallow water equations.
Computational modelling of surface waves is widely used in seismology, computer animation and ﬂood modelling (Ersoy et al., 2017; Garc´ıa-Navarro et al., 2019).
Our network learnt to simulate a range of physical phenomena including wave propagation, reﬂection, interference and diffraction at sharp corners.
This kind of NN could supplement or potentially replace numerical algorithms used to solve the shallow water PDEs, reducing the inference time by several orders of magnitude and allowing for real-time solutions. This has particular relevance in iterative design scenarios and applications such as tsunami prediction.
Contribution.
We demonstrate that our U-Net architecture is able to accurately predict surface wave dynamics in complex straight-sided and curved geometries, even when trained only on data sets with simple straight-sided boundaries.
The generalisation to different initial conditions and longertime predictions are also evaluated.
Additionally, we show how including the MSE of the wave gradient into the loss function signiﬁcantly reduces spurious oscillations in predicted solutions and may help improve the prediction of the position of the wavefronts.
Our network is able to simulate wave dynamics four orders of magnitude faster than a state-of-the-art spectral/ hp element numerical solver (Karniadakis & Sherwin, 2013), so it could be an effective replacement for numerical solvers in applications where performance is critical.
R ELATED W ORK
Physics-informed NNs for solving PDEs.
The use of NNs for the solution of partial differential equations has been investigated since the early 1990s.
Most of the relevant research at that time built on the idea of exploiting the universal function approximator property of multi-layer perceptrons (MLPs) (Dissanayake & Phan-Thien, 1994; Dissanayake & Phan-Thien, 1994; Lagaris et al., 1998).
In such an approach, the solutions to the PDEs are approximated as MLPs whose only inputs are the spatio-temporal coordinates.
These MLPs are trained in an unsupervised way to satisfy the governing PDEs as well as the initial and boundary conditions.
The main advantage of this paradigm is that the solution is obtained in a differentiable, closed analytic form, easily usable in any subsequent calculation.
Nevertheless, these networks cannot extrapolate to different domains, boundary conditions or initial conditions; making it necessary to re-train the network for every slight modiﬁcation of the problem.
These techniques inspired the more modern physics-informed neural networks (PINNs) (Raissi et al., 2017; 2018; 2019; Lu et al., 2019), which include deeper MLPs and random collocation points, and were shown to be able to extrapolate solutions outside of the time interval used for tuning the learnable parameters.
PINNs have been used to solve the one-dimensional Burger’s equation and the two dimensional Schrodinger equation (Raissi et al., 2017), as well as the two-dimensional Navier-Stokes equations (Raissi et al., 2018).
Although PINNs are successful at solving PDEs with high accuracy, they have to be retrained for every variation of the boundary conditions or initial conditions.
For this reasons, PINNs are not an ideal alternative to numerical solvers when ﬂexibility and short computational time are a priority.
Computer vision for simulating steady physics.
During the last ﬁve years, most of the networks used to predict continuous physics have included convolution layers.
For instance, CNNs have been used to solve the Poisson’s equation (Tang et al., 2018; ¨Ozbay et al., 2019), and to solve the steady
Navier-Stokes equations (Guo et al., 2016; Miyanawala & Jaiman, 2017; Yilmaz & German, 2017;
Farimani et al., 2017; Thuerey et al., 2018; Zhang et al., 2018).
The use of CNNs allows for visual inputs representing physical information, such as the domain geometry or the initial condition, and for visual outputs representing the solution ﬁelds.
In contrast to PINNs, the network predictions are purely based on observation, without knowledge of the underlying governing equations.
This paradigm has proven to extrapolate well to domain geometries, boundary conditions and initial conditions not seen during training (Thuerey et al., 2018).
The evaluation of these networks for prediction is considerably faster than traditional PDE solvers, allowing relatively accurate solutions to be predicted between one and four orders of magnitude faster (Guo et al., 2016; Farimani et al., 2017).
These reasons make CNNs perfect for developing surrogate models, complementing expensive numerical solvers (Guo et al., 2016; Miyanawala & Jaiman, 2017), or for real-time animations (Kim et al., 2019).
Our work takes inspiration from Guo et al.
(2016) in the use of a binary geometry ﬁeld to represent the physical domain.
Although Guo et al.
; Farimani et al.
(2017) and Thuerey et al.
(2018) proved the generalisation of their networks to domain geometries not seen during training, these unseen domains contain elementary geometrical entities included within the training data.
We go one step further by training the network with exclusively straight boundaries and proving the network is able to generalise to arbitrary domains incorporating boundaries with varying radius of curvature.
Computer vision for simulating unsteady physics.
Unsteady physics have also been explored from the computer vision perspective (Fotiadis et al., 2020; Lee & You, 2018; Sorteberg et al., 2018; Wiewel et al., 2019; Kim et al., 2019), although to a lesser extent than steady physics.
Here, the input to the network is a sequence of past solution ﬁelds, while the output is a sequence of predicted solution ﬁelds at future times.
When predicting unsteady phenomena there is an additional challenge: keeping the predictions accurate along time.
To address this, Sorteberg et al.
; Wiewel et al.
(2019) and Kim et al.
(2019) proposed to use encoder-propagator-decoder architectures, whereas Fotiadis et al.
and Lee & You (2018) continued to use encoder-decoder architectures similar to those used for steady problems.
Inspired by Fotiadis et al.
(2020), which showed that feed-forward networks perform at least as well as recurrent networks in wave forecasting, we opt to use a U-Net architecture (Ronneberger et al., 2015) to perform each time-step of the simulations.
M ETHOD 3. W AVE D YNAMICS D ATA S ETS
The data sets used during training and testing were generated by solving the inviscid, twodimensional shallow water equations with Nektar++, a high-order spectral/ hp element solver (Cantwell et al., 2015).
In conservative form, these equations are given by
[Equation]
where g = 9 . 80665 m/s 2 is the acceleration due to gravity and D ∈ R 2 denotes the domain under consideration.
Unknown variables in this system are the water depth h ( x, y, t ) and the components of the two-dimensional velocity vector u ( x, y, t ) and v ( x, y, t ) .
We imposed two forms of boundary conditions: solid wall boundaries, which result in wave reﬂection and diffraction; and open boundaries, which allow waves to exit the domain.
As initial conditions we considered a droplet , represented mathematically by a localized two-dimensional
Gaussian:
[Equation]
where I is set to 0.1 m, C is randomly sampled from a uniform distribution between 400 andm − 2 and the droplet centre, ( x c , y c ) , is randomly sampled from a uniform distribution in D . Addi- [Figure]
tionally, we generated two data sets with two droplets using the initial condition:
[Equation]
Here C i , x c,i and y c,i follow the same uniform distributions as in equation (2), I 1 = 0 .
1 m
and I 2 is randomly sampled from a uniform distribution between 0.05 and 0.1 m.
Each simulation in the data sets is associated with a binary geometry ﬁeld, Ω( x, y ) , which satisﬁes
[Equation]
Therefore, Ω = 0 inside the ﬂuid domain and Ω = 1 in the solid boundaries (Guo et al., 2016).
This geometry forms an additional input to the network, required to provide information about the walls location.
Figure 2 shows the geometry ﬁeld for the seven categories of ﬂuid domains included in the data sets.
For full details of the data sets, see Appendix A.
3. N EURAL N ETWORK AS S IMULATION E NGINE
Our neural network is based on the U-Net architecture (Ronneberger et al., 2015), which has been extensively used for image-to-image translation tasks (Farimani et al., 2017; Fotiadis et al., 2020; Isola et al., 2016; Thuerey et al., 2018).
This architecture consists of a fully convolutional feedforward encoder-decoder network with skip connections between the encoder and the decoder.
In wave dynamics forecasting, the input sequence and the target share an important amount of information at different length scales, this makes the U-Net a particularly appropriate architecture for our problem.
Our U-Net receives six ﬁelds as input: the geometry ﬁeld, Ω , and a sequence of ﬁve consecutive height ﬁelds, { h s , h s +1 , h s +2 , h s +3 , h s +4 } . It generates as output a prediction of the subsequent height ﬁeld, ˆ h s +5 , at the next time point.
Hence, each evaluation of the network corresponds to performing a single time-step, and the network is re-fed to make further predictions.
See Appendix B for more details about our U-Net architecture.
3. G RADIENT L OSS
The loss function used in the present work is given by
[Equation]
[Figure] where λ is a hyper-parameter and MSE( x, y ) is the mean-squared error.
The derivatives in equation (5) were computed using second-order ﬁnite differences.
This loss function penalises oscillations in the predicted ﬁelds and favours smooth solutions.
This is especially important for temporal forecasting by consecutively re-feeding the network, since the spurious oscillations are ampliﬁed in each new prediction.
In the case of wave dynamics, the gradients have a large magnitude on the leading and trailing edges of the wavefront.
Capturing such small-scale information enables the network to accurately learn and reproduce the wave speed and width of wavefront.
3. T RAINING
Our U-Net 2 was trained against the simple closed box and open corner geometries shown in Figures 2a and 2b, with a single droplet as initial condition.
The time step was set to ∆ t = 0 .
12 seconds and the spatial resolution was set to 128 pix/m. A series of transformations were applied to perform data augmentation and normalisation (see Appendix C).
We trained for 500 epochs with the Adam optimiser and its standard parameters (Kingma & Ba, 2014) and the loss function given by equation (5) with λ = 0 . 05 .
The learning rate was set to 10 − 4 and decreased by a factor of 10 everyepochs.
The time origin for the input sequences is not at t = 0 , instead it is randomly selected, and ﬁve time-steps are performed before updating the network weights.
R ESULTS AND D ISCUSSION
In this section we evaluate the ability of the trained model to extrapolate to different domain geometries and initial conditions.
We also assess the quality of long-time predictions.
4. G RAD L OSS VS MSE
Figure 3a compares the ground truth and two predictions obtained ﬁve time steps ahead of the last temporal height frame used as input.
The height ﬁeld in the central image was predicted by the U-Net trained with the plain MSE, whereas the prediction on the right was obtained after training with the loss function given by equation (5).
Here, the suppression of the oscillations on the wavefront when using the GradLoss instead of the MSE is clearly apparent.
To quantify this difference, Figure 3b shows the root-mean-squared error (RMSE), averaged over 500 simulations, during 20 time-steps for both loss functions.
We can conclude that, even for the ﬁrst predicted time-step, the network trained with the MSE is considerably less accurate.
This difference is ampliﬁed linearly with each new predicted frame.
4. G ENERALISATION TO D IFFERENT D OMAIN G EOMETRIES
Our network proved to generalise to complex domain geometries not seen during training, some including curved walls, when only the closed domain and open-corner domain were used for training (Figures 2a and 2b).
The three columns of Figure 4b depict the ground truth, prediction and the absolute value of their difference every ﬁve time-steps (the input height ﬁelds are depicted in Figure
[Figure] 4a).
This Figure shows that our network is able to accurately predict the wave speed and correctly infer the appearance of reﬂections at the solid boundaries.
This is evidenced by the predicted height ﬁeld at frame 25 (after 20 time-steps), where we observe that the position and wavelength of the predicted and true waves are coincident.
The main discrepancy between ground truth and predictions is the height of the wavefronts diffracted by the edges of the steps, which are of lower magnitude in the predicted ﬁelds.
The reason for this may be the fact that the network is less exposed to wave refraction than to wave propagation and reﬂection during training.
The previous domain is a straightforward extension of the domain in Figure 2b, which was used during training, so the ability of the network to extrapolate to this conﬁguration is not unexpected.
We now explore the generalisation of the network to curved boundaries, which is potentially more challenging.
Figures 5a and 5b depict the inputs and outputs for a simulation in the domain depicted in Figure 2d.
By visual inspection, these results suggest that the network is able to accurately predict wave reﬂections on circular convex walls, and errors are of the same magnitude to those in Figure 4b.
The same conclusion was obtained for wave reﬂections on circular concave walls, as illustrated by Figure 6a.
The network is also able to produce good-quality predictions for conﬁgurations involving reﬂections on walls whose radius of curvature is not uniform, although in these cases more substantial differ- [Figure] ences between targets and predictions can be seen.
For instance, the prediction in Figure 6b shows a high resemblance with the ground truth even after 20 time-steps. However, the difference between the ground truth and the predictions is larger than in simpler geometries.
The temporal frames depicted in Figure 1 also illustrate the good generalisation to a ﬂuid domain surrounded by spline-sided walls.
The successful generalisation to this kind of domains is likely due to the localised support of the convolution kernels and the architecture.
When the convolutions are applied, the network may interpret curved walls as polygonal walls made up of lots of many straight walls of size equal to the stride size.
In that case, the higher the image resolution, the smaller radius of curvature that could be handled by the network.
4. T WO D ROPLETS AS I NITIAL C ONDITION
The main challenge in using our model to extrapolate the initial conditions in equation (3) is the dissipation of wavefronts after interference between the two initial excitations.
We observed that this effect is more signiﬁcant the greater the number of interacting wavefronts.
Simulations in the domains from Figures 2a and 2b can be accessed at https://ibb.co/SVFsDJq and https://ibb.co/NCw5gSg respectively. [Figure]
4. L ONG -T IME P REDICTIONS
We assessed the ability of the network to make accurate predictions over long time periods by simulating in a larger domain.
Figure 7 shows predictions and ground truth after 30, 55 andtime-steps.
The initial condition is a single droplet (equation (2)) placed in the centre of the narrow channel.
The network is able to predict accurately the speed of the leading wavefront, however, the wave magnitude is not retained and it is not able to maintain the propagation of the wavefronts originating from reﬂections within the narrower channel, which can be seen to quickly dissipate.
This problem could be addressed by training the U-Net for longer output sequences and possibly increasing the depth of the network.
C ONCLUSION
In this work we investigated the application of fully convolutional deep neural networks for forecasting wave dynamics on ﬂuid surfaces.
In particular, we focused on a U-Net architecture with two skip connections and we trained the network to predict the spatio-temporal evolution of wave dynamics, including: wave propagation, wave interference, wave reﬂection and wave refraction.
We demonstrated that including the MSE between the gradients of the predicted height and the truth height in the loss function signiﬁcantly reduces spurious oscillations in the solution and helps to predict the position of the wavefronts more accurately.
This suggests that loss functions which capture discrepancies in the predicted spatial gradients provide valuable information when training networks to forecast wave dynamics, especially over long-time intervals.
The domains considered during training only included a closed box and and a single right-angled corners.
However, our U-Net was able to extrapolate to curved walls with varying radii of curvature.
The RMSE was of order 0.0001 times the characteristic length for at least 20 time steps for both the training and testing datasets.
When ran on a GPU these simulations are around 10 4 times faster than the equivalent numerical simulation used for generating our data sets.
These ﬁndings highlight the potential for neural networks to accurately approximate the evolution of wave dynamics with computational times several orders of magnitude smaller than conventional numerical simulation.
B U-N ET A RCHITECTURE
The diagram in Figure 8 depicts the U-Net architecture used in the present work.
The network receives six ﬁelds as input: the geometry ﬁeld Ω and a sequence of ﬁve consecutive height ﬁelds { h s , h s +1 , h s +2 , h s +3 , h s +4 } .
The output is a prediction of the subsequent height ﬁeld ˆ h s +5 .
Whereas some recent studies (Fotiadis et al., 2020; Thuerey et al., 2018) have used bi-linear interpolation to perform the up-sampling, we opted to use transpose convolutions with a 2x2 kernel and stride 2.
This increases the number of trainable parameters to 1,864,577, but we also noticed a signiﬁcant improvement in the quality of the predictions.
C N ORMALISATION AND D ATA A UGMENTATION
To improve generalisation across a range of wave dynamics, the height ﬁelds were re-scaled according to ˜ h ← ( h − ¯ h ) / (max( h ) − ¯ h ) , where ¯ h = 1 and max( h )
= 1 .
This re-scaling was reversed for visualising the network predictions.
In order to avoid over-ﬁtting and improve the generalisation capabilities of the network, we apply two sets of transformations to the training data sets.
For the data set A such transformations consist on random rotations of 90, 180 and 270 deg as well as horizontal and vertical ﬂips.
For the dataset B random rotations by multiples of 15 deg are applied and the physical size of the frames is reduced to 1 m × 1 m by cropping the original frames to domains whose center position follows an uniform distribution from 0.9 to 1.1 m in both spatial directions.
Finally, the images of all these sequences were linearly interpolated to a 128 × 128 resolution to satisfy the 128 pix/m requirement.
Regarding the testing data sets, sets C, D and H are augmented in the same manner as the data set A , since they contain open boundaries; and data sets E, F, G and
I are augmented like B , as they contain only closed boundaries.
D S IMULATION E XAMPLES
Videos comparing Nektar++ simulations and simulations ran with our U-Net can be accessed on the links in Table 2.
The examples from datasets A and B here included were used during training, whereas all the other simulations are extrapolations.
[Table]
https://ibb.co/Cw4m4wt
[Table]
https://ibb.co/thjW5n
[Table]
https://ibb.co/SVFsDJq
[Table]
https://ibb.co/NCw5gSg