lululxvi / deepxde

A library for scientific machine learning and physics-informed learning
https://deepxde.readthedocs.io
GNU Lesser General Public License v2.1
2.5k stars 714 forks source link

Simulation of boundary conditions and initial condition discontinuities #625

Open LanPeng-94 opened 2 years ago

LanPeng-94 commented 2 years ago

Dear Dr.Lu: Recently, I'm having a problem with PINNs simulation and would like to ask for your advice. The problem is described as follows: PDE:u_xx+u_x=u_t BC1:u(0,t)=0 BC2:u(10,t)=m (where m is a constant) IC: u(x,0)=np.piecewise(x, [x != 0, x == 0], [0, m]) (This means that the initial condition will be discontinuous at the point (10,0)) I simulated using PINNs and compared it with the analytical solution, and the results showed that all the loss terms were in the order of 1e-6 accuracy, and the final results are shown in the figure below. It is obvious that the error around the point (10, 0) is significantly higher than the other calculation areas, and the other points can be fitted better. Do you have any method to improve the accuracy of the calculation? 微信图片_20220418161520

lululxvi commented 2 years ago

If IC and BC are not consistent at the corner, then it is difficult, as NN is always a continuous function. You can modify IC and BC to be consistent.

praksharma commented 2 years ago

Here I solved a steady-state problem with 4 discontinuous corners with my own code (not DeepXDE). DeepXDE gains loss around the edges for some reason.

image

You can't solve these problems with baseline PINN. A quick fix would be to not train those points. On top of that use importance sampling to increase the points cloud near the area.

Use other PINNs with skip connections that introduce artificial diffusion very similar to Petrov-Galerkin.

LanPeng-94 commented 2 years ago

Here I solved a steady-state problem with 4 discontinuous corners with my own code (not DeepXDE). DeepXDE gains loss around the edges for some reason.

image

You can't solve these problems with baseline PINN. A quick fix would be to not train those points. On top of that use importance sampling to increase the points cloud near the area.

Use other PINNs with skip connections that introduce artificial diffusion very similar to Petrov-Galerkin.

Thank you very much for your answer. For this, I tried RAR and adding calculation points in areas with large errors, and these results did not improve my calculation results. For the importance sampling you mentioned, do you mean adding training points in areas with large errors? Do you have similar learning documents, or can you show me the code with your correct results, I am curious how you handle it?

praksharma commented 2 years ago

Sorry, I can't share the code (we are writing a paper). You can learn more about importance sampling here.

Their code is public but not open source, so we wrote our own version from scratch. Importance sampling is more than just adding training points in areas with large errors.

We are solving a similar 3D problem with discontinuities over the edges of a cuboid instead of just on the corners in 2D. Sorry, I wasn't helpful.

LanPeng-94 commented 2 years ago

Thank you very much for your help and I look forward to your paper and available codes.

LanPeng-94 commented 2 years ago

Sorry, I can't share the code (we are writing a paper). You can learn more about importance sampling here.

Their code is public but not open source, so we wrote our own version from scratch. Importance sampling is more than just adding training points in areas with large errors.

We are solving a similar 3D problem with discontinuities over the edges of a cuboid instead of just on the corners in 2D. Sorry, I wasn't helpful.

Hi, Is there an article on PINNs with skip connections?

praksharma commented 2 years ago

Wang's Learning rate annealing comprises a two transformer layer residual connection.

LanPeng-94 commented 2 years ago

Thank you for your answer