Mesharou / Pyticles

9 stars 4 forks source link

RuntimeError and ValueError occured in backward tracking #3

Open auroralin0408 opened 2 weeks ago

auroralin0408 commented 2 weeks ago

My setting is dfile = -1 , start_file = 528 , end_file = 360, and the simul.hc=5. But RuntimeError occurs after time=509, three times, and I don't know the reason why constant reading will suddenly gets wrong:

Traceback (most recent call last):
  File ".conda/envs/py311/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File ".conda/envs/py311/lib/python3.11/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "./src/Pyticles/Pyticles.py", line 584, in update_xyz
    exec(compile(open('Pyticles_subroutines/update_xyz_largemem.py').read(),\
  File "Pyticles_subroutines/update_xyz_largemem.py", line 128, in <module>
    z_w = part.get_depths_w(simul, x_periodic=x_periodic,
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "./src/Pyticles/./Modules/pyticles_sig_sa.py", line 1847, in get_depths_w
    (z_w) = partF.zlevs_w(topo, zeta, simul.hc,  simul.Cs_w)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: pyticles_3d_sig_sa.zlevs_w() 3rd argument (hc) can't be converted to double

ValueError occurs after time=491. I checked the results and it seems to be related to the x-periodic(=True) boudary, but I don't know how to fix it:

Traceback (most recent call last):
  File ".conda/envs/py311/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File ".conda/envs/py311/lib/python3.11/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "./src/Pyticles/Pyticles.py", line 584, in update_xyz
    exec(compile(open('Pyticles_subroutines/update_xyz_largemem.py').read(),\
  File "Pyticles_subroutines/update_xyz_largemem.py", line 86, in <module>
    part.get_vel_io(simul, pm=pm_s, pn=pn_s, timing=subtiming,
  File "./src/Pyticles/./Modules/pyticles_sig_sa.py", line 232, in get_vel_io
    u[ng-nw : nx2-nx1-1-ng+ne, ng-ns : ny2-ny1-ng+nn, :] = simul.Forder(
    ~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: could not broadcast input array from shape (512,82,30) into shape (513,82,30)

Looking forward to any advices, thanks!

Mesharou commented 2 weeks ago

It could indeed be related to the periodic option, which has probably not been tested recently. This could explain why the error does not occur immediately, but only when the first particles arrive at the periodic boundary.

Does it work without setting x_periodic to True?

Depending on the version of ROMS/CROCO, the horizontal grid may have a different size along the periodic dimension. What are the sizes of your outputs?

auroralin0408 commented 2 weeks ago

For x_periodic=True, it only occur the mentioned RuntimeErrors (8 times).

The horizontal size (x,y) of u is (513,514), v is (514,513).

Mesharou commented 1 week ago

But do you also have issues when using x_periodic=False?

auroralin0408 commented 1 week ago

Sorry, I just found my last comment wrong, "For x_periodic=False, it only occur the mentioned RuntimeErrors (8 times)." Errors occur when particles reach the x-periodic boundary.