stochasticHydroTools / SlenderBody

Slender-body hydrodynamics
11 stars 4 forks source link

BatchedNBodyRPY can't be found #1

Closed ruinianxu closed 2 years ago

ruinianxu commented 2 years ago

Hey,

First of all thanks for sharing the code. I am trying to run the example script ThreeShearedFibs but got the error that

ModuleNotFoundError: No module named 'BatchedNBodyRPY'

I checked but couldn't find where it is installed. Could you please help me with this issue? Thanks in advance.

Best, Ruinian Xu

RaulPPelaez commented 2 years ago

Hi, the error is talking about this other repo: https://github.com/RaulPPelaez/BatchedNBodyRPY That is needed here: https://github.com/stochasticHydroTools/SlenderBody/blob/045492bca5c784a3f07e4bd9a5ea9bb1e0f303f6/Python/fiberCollection.py#L11 As far as I can tell there is no automatic building system in place for it.

ruinianxu commented 2 years ago

@RaulPPelaez Hi Raul,

Thank you so much for quick reply and I successfully compiled BatchedNBodyRPY. The current issue is that I can't compile modified finufft.

I replaced finufft folder under Python folder in the official Repo and ran make python. But I got a lot of errors. I wonder if you could provide your own makefile or let me know what specific version/tag of finufft you used. Thanks in advance.

Best, Ruinian Xu

RaulPPelaez commented 2 years ago

Hi, I am afraid you will have to ask the finufft guys about compiling it, since I am not an expert. I do not have a Makefile at hand, but it is a quite system-dependent thing in this case, so it would not be of much use to you anyway. I will leave this open in case the maintainer of this repo has more information

ruinianxu commented 2 years ago

@RaulPPelaez I think the key issue for compiling finufft is that finufftpy.cpp is not compiled such that I got the following error in _interfaces.py. ModuleNotFoundError: No module named 'finufftpy_cpp' The finufftpy.cpp doesn't exist in the original repo and it is reasonable that I got this error by just following official compiling instructions. I wonder how I should compile it. Thanks in advance.

ruinianxu commented 2 years ago

@RaulPPelaez Addressed. The current verision of finufft doesn't work. It should be downgraded to v1.1.2.

ruinianxu commented 2 years ago

@RaulPPelaez I am sorry for keeping bothering you. I think I've complied all required libraries and I am close to success but got into this issue.

Traceback (most recent call last):
  File "ThreeShearedFibs.py", line 95, in <module>
    maxX = TIntegrator.updateAllFibers(iT,dt,stopcount,Dom,Ewald,gravity/Lf,of);
  File "../TemporalIntegrator.py", line 166, in updateAllFibers
    RHS = self._allFibers.formBlockDiagRHS(XforNL,XsforNL,tvalSolve,forceExt,lamStar,Dom,Ewald);
  File "../fiberCollection.py", line 197, in formBlockDiagRHS
    nonLocal = self.nonLocalVelocity(X_nonLoc,Xs_nonLoc,totForce,Dom,RPYEval,1-FPimplicit);
  File "../fiberCollection.py", line 351, in nonLocalVelocity
    alltargets,numTbyFib = self.determineQuadLists(X_nonLoc,self._uniPoints,Dom);
  File "../fiberCollection.py", line 623, in determineQuadLists
    neighborList = self._SpatialUni.otherNeighborsList(self._SpatialCheb, qUpsamplecut);
  File "../SpatialDatabase.py", line 180, in otherNeighborsList
    raise NotImplementedError('Other neighbors not implemented in Rauls linked list implementation')
NotImplementedError: Other neighbors not implemented in Rauls linked list implementation

Really appreciate it if you could provide me with some hints.

omaxian commented 2 years ago

Hi Ruinian,

The file ThreeShearedFibs.py is trying to use the special quadrature scheme to correct the non local velocity. For that you need the nearest neighbors between two different sets of points, and that's not implemented in the spatial database object.

You should be able to get around this error by changing line 147 in fiberCollection.py: self._SpatialUni = CellLinkedList(np.zeros((self._Nunifpf*self._Nfib,3)),Dom,nThr=self._nThreads);

to self._SpatialUni = ckDSpatial(np.zeros((self._Nunifpf*self._Nfib,3)),Dom)

omaxian commented 2 years ago

Ruinian,

Also, depending on your application, it might be more efficient to use Ewald splitting with a GPU for hydrodynamic evaluation. It is talked about on p. 10-11 here: https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1009240.

You can find a sample instantiation here: https://github.com/stochasticHydroTools/SlenderBody/blob/045492bca5c784a3f07e4bd9a5ea9bb1e0f303f6/Python/Examples/BundleStress.py#L66.

This will bypass the need to use finufft and the special quadratures.

Keep me posted on your progress. Thanks,

Ondrej Maxian

ruinianxu commented 2 years ago

@omaxian Hi Ondrej,

Thank you so much for your quick reply. I've successfully ran ThreeShearedFibs and will definitely give the Ewald splitting a shot.

I will let you know once I have any updates.

Best, Ruinian Xu

omaxian commented 2 years ago

Great, I will close this issue then.