maziarraissi / PINNs

Physics Informed Deep Learning: Data-driven Solutions and Discovery of Nonlinear Partial Differential Equations
https://maziarraissi.github.io/PINNs
MIT License
3.45k stars 1.21k forks source link

more than two snapshots #32

Open cruzchue opened 3 years ago

cruzchue commented 3 years ago

The code for the Korteweg–de Vries problem (KdV.py) provides an example using only two time snapshots. I am wondering which parts need to be edited/added in order to use three or more time snapshots.

nish-ant commented 3 years ago

As proposed in the paper, the neural network, by design, is trained by minimizing the loss function which is a sum of squared errors calculated at two distinct time steps (equation (17) in paper).

For including information from more than two time steps, the calculation of loss can be done such that it iterates over all the snapshots.

cruzchue commented 3 years ago

Thanks for the quick response. The part of the loss function is certainly clear and well described along the four examples. I still have some related questions. First, I describe my understanding and the problem, then I post the questions.

Problem:

For calculating the loss, the script first computes the nonlinear operators in the functions net_U0 and net_U1. That is, net_U0 is for time snapshot 0, and net_U1 is for time snapshot 1: two time snapshots.

Now, for a third time snapshot, we would require a net_U2, which should not be a problem. But in both net_U0 and net_U1, there is a time step variable called "dt", which is the time difference between only two snapshot.

Questions:

nish-ant commented 3 years ago

Alright, now I understand the question better. I don't think the way you're trying to make it work will be possible in the given framework.

The time integration method is based on Runge-Kutta method, which takes intermediate steps between two time steps. The implicit RK equations show this clearly. However, you can tune the order, which ranges between q and 2q (q = number of stages).

Alternatively, a multistep method might be better suited for your task.

cruzchue commented 3 years ago

Many thanks for the information. For sure, we will take a look at that.