isds-neu / PhyCRNet

Physics-informed convolutional-recurrent neural networks for solving spatiotemporal PDEs
MIT License
108 stars 34 forks source link

Problem generating data #6

Open FPaiva99 opened 2 years ago

FPaiva99 commented 2 years ago

Hi, I've been trying to test your code, but while running Burgers_2dsolver[HighOrder].py there occurs an issue which leads to the values for U and V becoming entirely "nan" after the first iteration and thus all the plots after the first one are blank and the generated file to be used in PhyCRNet_burgers.py does not work correctly.

The warnings which I assume relate to the cause of this problem, when running Burgers_2dsolver[HighOrder].py, are as follows: RuntimeWarning: overflow encountered in multiply u_t = (1.0/R) laplace_u - U u_x - V u_y RuntimeWarning: invalid value encountered in subtract u_t = (1.0/R) laplace_u - U u_x - V u_y RuntimeWarning: overflow encountered in multiply v_t = (1.0/R) laplace_v - U v_x - V * v_y

...and so on, covering what looks like all the operations.

If you have any knowledge on how to solve this issue I'd really appreciate it. And thank you for making this available for everyone to study.

paulpuren commented 2 years ago

Hi, I've been trying to test your code, but while running Burgers_2dsolver[HighOrder].py there occurs an issue which leads to the values for U and V becoming entirely "nan" after the first iteration and thus all the plots after the first one are blank and the generated file to be used in PhyCRNet_burgers.py does not work correctly.

The warnings which I assume relate to the cause of this problem, when running Burgers_2dsolver[HighOrder].py, are as follows: RuntimeWarning: overflow encountered in multiply u_t = (1.0/R) laplace_u - U u_x - V u_y RuntimeWarning: invalid value encountered in subtract u_t = (1.0/R) laplace_u - U u_x - V u_y RuntimeWarning: overflow encountered in multiply v_t = (1.0/R) laplace_v - U v_x - V * v_y

...and so on, covering what looks like all the operations.

If you have any knowledge on how to solve this issue I'd really appreciate it. And thank you for making this available for everyone to study.

Hi, did you modify the code? If so, where did you change? I think it's probably the issue of initial condition. Thanks.

FPaiva99 commented 2 years ago

This happens without any changes to the code you have available

paulpuren commented 2 years ago

This happens without any changes to the code you have available

Hello, please change the M and N in line199 to 128 instead of 256. Sorry for the typo. I have corrected it in the repo.

reyhashemi commented 1 year ago

Hi and thank you for sharing this repo. I have also some issues with the data generation step. 1- u = torch.ifft(coeff, self.dim, normalized=False) in line 62 in random_fields.py gives me an error : AttributeError: module 'torch' has no attribute 'ifft' I must replace it with u = torch.fft.ifft(coeff, self.dim, norm="forward") to make it work. But when I do so, the generated data has nan+nanj values everywhere except uv0 where I still have very strange values :

array([[[[ 0. -0.j, 2129.1357 -0.j, 222.7216 -0.j, ..., 125.21399 -0.j, -85.1573 -0.j, 931.3776 -0.j], [ -527.9665 -0.j, -1190.0044 -0.j, -640.04846 -0.j, ..., 582.00226 -0.j, 1497.8472 -0.j, 1678.8093 -0.j], [ 683.1372 -0.j, 658.1623 -0.j, 163.92477 -0.j, ..., 287.4627 -0.j, 277.8958 -0.j, 1161.2817 -0.j], ..., [ 224.55377 -0.j, -543.3017 -0.j, 306.49304 -0.j, ..., -203.17023 -0.j, -48.21437 -0.j, 554.84155 -0.j], [ 32.657043-0.j, -689.1565 -0.j, -434.51898 -0.j, ..., 250.98328 -0.j, -762.5959 -0.j, -353.42575 -0.j], [ 882.3099 -0.j, -1609.5559 -0.j, 240.70152 -0.j, ..., -421.1898 -0.j, 413.07086 -0.j, 232.20418 -0.j]], [[ 0. -0.j, -3905.6528 -0.j, -653.72986 -0.j, ..., 525.6558 -0.j, 840.38464 -0.j, 1841.0209 -0.j], [ 3012.0054 -0.j, -884.5539 -0.j, 828.5674 -0.j, ..., 80.32678 -0.j, -796.58 -0.j, 4977.792 -0.j], [ -744.629 -0.j, -513.50964 -0.j, 1099.5518 -0.j, ..., -149.52063 -0.j, 654.4574 -0.j, 123.21655 -0.j], ..., [ 105.458015-0.j, -262.76746 -0.j, -56.977295-0.j, ..., 296.77374 -0.j, -66.17291 -0.j, -150.86192 -0.j], [ 414.95587 -0.j, 874.9513 -0.j, 574.8929 -0.j, ..., 546.9427 -0.j, 385.69714 -0.j, 438.05823 -0.j], [ 1612.0612 -0.j, -1955.2401 -0.j, -192.24503 -0.j, ..., -102.23626 -0.j, -506.6593 -0.j, -884.8588 -0.j]]]], dtype=complex64) I would appreciate if you could tell me how to debug this issue.

paulpuren commented 1 year ago

Hi, I think this is due to the update of the torch. The ifft has been removed. The simplest way may be to downgrade your PyTorch version.

reyhashemi commented 1 year ago

Hi and thank you very much for you response. Could you please let me know was the Pytorch version with which you validated your code ?

paulpuren commented 1 year ago

Hi and thank you very much for you response. Could you please let me know was the Pytorch version with which you validated your code ?

It's 1.7.0.

reyhashemi commented 1 year ago

Thank you very much. It worked!