Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPU version Z extent issue #8

Open
RaulPPelaez opened this issue Sep 14, 2022 · 0 comments
Open

CPU version Z extent issue #8

RaulPPelaez opened this issue Sep 14, 2022 · 0 comments

Comments

@RaulPPelaez
Copy link
Contributor

I am not sure what the z extent is supposed to be in the CPU version of DPStokes, but it seems like it is somewhat ignoring the zmin, zmax parameters. See for instance this snippet:

domType = 'DP'
nP = 2 #Number of particles
has_torque = False # Set to True if angular displacements are needed
viscosity = 0.957e-3
#Simulation domain limits
L=128
xmin = -L/2; xmax = L/2
ymin = -L/2; ymax = L/2
H = 32
zmin = 0; zmax = H
# Initialize the solver with all the parameters
solver = FCMJoint('cpu')
#Initialize can be called several times in order to change the parameters
solver.Initialize(numberParticles=nP, hydrodynamicRadius=1.0155, kernType=0,
                  domType=domType, has_torque=has_torque,
                  xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
                  viscosity=viscosity, optInd=0, ref=False)
xP = np.zeros(3 * nP, dtype = np.double) 
xP[4] += 1.000000;
forces = np.random.normal(0, 1, 3 * nP)*0
forces[2] = 1;
for zz in np.linspace(zmin, zmax, 10):
  xP[2::3]=zz
  solver.SetPositions(xP)
  V,T =  solver.Mdot(forces, np.empty(0))
  print('%g %g %g %g\n' % (zz, V[0], V[1], V[2]))

The output of this snippet is:

Setting the unit cell...                                                                                                                                                     
        unit cell := [-64.0000,64.0000]x[-64.0000,64.0000]x[0.0000,32.0000]                                                                                                  
                                                                                                                                                                             
Determining the grid and configuring kernels...                                                                                                                              
                                                                                                                                                                             
        Optimal grid with adjusted extent (optInd=-1):                                                                                                                       
                                                                                                                                                                             
              L_x                     L_y                 N_x             N_y                  h                %-err                                                        
        128.08932363729969      128.08932363729969        196             196           0.6535169573331617      0.021627                                                     
                                                                                                                                                                             
        Candidate grids with user-defined extent (optInd=0,1,..):                                                                                                            
                                                                                                                                                                             
         N_x           h                %-err                                                                                                                                
         196    0.6530612244897959      0.021895                                                                                                                             
         200          0.64              0.028949                                                                                                                             
         210    0.6095238095238096      0.049185                                                                                                                             
         216    0.5925925925925926      0.13212                                                                                                                              
         224    0.5714285714285714      0.31513                                                                                                                              
         225    0.5688888888888889      0.34143                                                                                                                              
         240    0.5333333333333333      0.8184                                                                                                                               
         243    0.5267489711934157      0.93652                                                                                                                              
         245    0.5224489795918368      1.0176                                                                                                                               
         250         0.512              1.2257                                                                                                                               
Adjusting requested Ly for integer grid size...                                                                                                                              
                                                                                                                                                                             
        Final kernel settings:                                                                                                                                               
                                                                                                                                                                             
              R_h                w_m         beta_m                                                                                                                          
             1.0155               6     10.250524583972947                                                                                                                   
                                                                                                                                                                             
        Final grid settings for No wall domain (DP):

         (Nx, Ny, Nz) = (196, 197, 91)
         hxy = 0.6530612244897959
         Lx = 128.0000000000000000
         Ly = 128.6530612244897895
         z_a = 0.0000000000000000 
         z_b = 37.8775510204081627

Initializing force grid...
Precomputing solver and planning FFTs...

Solver is ready

Setting initial positions...
Building monopole particle-grid search structures...
Initialization complete.

0 -7.53011e-16 -9.45097e-17 53.3175

3.55556 1.49863e-16 1.10917e-15 53.3178

7.11111 -7.26801e-16 -3.19069e-16 53.9481

Position is outside of z extent Exiting ...                                                        

There are some issues with this:

  1. The code seems to recognize the z extend as [zmin, zmax+something]. But should it not be adding a buffer below zmin?
  2. The code fails when given z coordinates clearly inside the zmin, zmax range
  3. For some reason the grid is "corrected" in the Y direction, even when Lx=Ly, and moreover it is setting ny as and odd number!

@snatesh Could you give me some insights?

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant