AdityaLab/pinnsformer

The derivative in the code

KaiSUN1 opened this issue · 2 comments

I have been closely examining the implementation of the Navier-Stokes equation in your code and I appreciate the effort put into this work. I have a query regarding the computation of the second-order derivative, specifically u_xx.

In the code, the second-order derivative u_xx is calculated directly from u with respect to x_train, as shown below:

u_xx = torch.autograd.grad(u, x_train, ...)

However, I believe that to obtain the second-order derivative u_xx, we should first compute the first-order derivative u_x with respect to x_train, and then differentiate u_x with respect to x_train again, like this:

u_x = torch.autograd.grad(u, x_train, ..., create_graph=True)[0]
u_xx = torch.autograd.grad(u_x, x_train, ...)[0]

Could you please confirm if my understanding is correct? If so, would it be possible to update the code accordingly to reflect this change?

Thank you for your time and consideration. I look forward to your response.

Hi,I tested the code recently. We can make more deep discussions about pinnsformer. My Wechat:17792436115

For computing the 2nd derivative, you are correct.
For NS setup, we follow: https://github.com/maziarraissi/PINNs/tree/master/main/continuous_time_identification%20(Navier-Stokes)