Skip to content

Commit c9c39c2

Browse files
remove the triply periodic FCM from DPStokes interface (#82)
* remove the triply periodic FCM from DPStokes interface * restrict cuda version --------- Co-authored-by: Raul <raulppelaez@gmail.com>
1 parent ef4a54c commit c9c39c2

3 files changed

Lines changed: 11 additions & 51 deletions

File tree

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ channels:
55
dependencies:
66
- python <3.13
77
- cmake >=3.24
8-
- cuda-version <=13.1
8+
- cuda-version <= 13.1
99
- gxx >9,<15
1010
- cuda-libraries-dev
1111
- cuda-nvcc

solvers/DPStokes/extra/uammd_interface.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,14 @@ std::string getPrecision();
2020

2121
struct PyParameters {
2222
// The number of cells in each direction
23-
// If -1, they will be autocomputed from the tolerance if possible (DP cannot
24-
// do it, FCM can)
2523
int nx = -1;
2624
int ny = -1;
2725
int nz = -1;
2826
real viscosity;
2927
real Lx;
3028
real Ly;
3129
real zmin, zmax;
32-
// Tolerance will be ignored in DP mode, TP will use only tolerance and nxy/nz
30+
// Tolerance will be ignored in DP mode
3331
real tolerance = 1e-5;
3432
real delta = 1e-3; // RFD step size
3533
real w, w_d;

solvers/DPStokes/extra/uammd_wrapper.cu

Lines changed: 9 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Raul P. Pelaez 2021. Doubly Periodic Stokes UAMMD wrapper
2-
Allows to call the DPStokes or TP FCM modules from via a simple contained
2+
Allows to call the DPStokes module from via a simple contained
33
class to compute the product between the mobility tensor and a list forces
44
and torques acting on a group of positions.
55
@@ -9,14 +9,10 @@
99
*/
1010
#include <uammd.cuh>
1111
// Doubly Periodic FCM implementation (currently without noise)
12-
#include <Integrator/BDHI/DoublyPeriodic/DPStokesSlab.cuh>
13-
// Triply Periodic FCM implementation
1412
#include "uammd_interface.h"
15-
#include <Integrator/BDHI/BDHI_FCM.cuh>
13+
#include <Integrator/BDHI/DoublyPeriodic/DPStokesSlab.cuh>
1614
// Some convenient aliases
1715
namespace uammd_dpstokes {
18-
using FCM_BM = uammd::BDHI::FCM_ns::Kernels::BarnettMagland;
19-
using FCM = uammd::BDHI::FCM_impl<FCM_BM, FCM_BM>;
2016
using DPStokesSlab = uammd::DPStokesSlab_ns::DPStokes;
2117
using uammd::System;
2218
using uammd::DPStokesSlab_ns::WallMode;
@@ -45,24 +41,6 @@ struct Real3ToReal4SubstractOriginZ {
4541
}
4642
};
4743

48-
auto createFCMParameters(PyParameters pypar) {
49-
FCM::Parameters par;
50-
par.temperature =
51-
0; // FCM can compute fluctuations, but they are turned off here
52-
par.viscosity = pypar.viscosity;
53-
par.tolerance = pypar.tolerance;
54-
par.box = uammd::Box({pypar.Lx, pypar.Ly, pypar.zmax - pypar.zmin});
55-
par.cells = {pypar.nx, pypar.ny, pypar.nz};
56-
par.kernel =
57-
std::make_shared<FCM_BM>(pypar.w, pypar.alpha,
58-
pypar.beta.x, // TODO beta parameter may need to
59-
// be adjusted for non-square?
60-
pypar.Lx / pypar.nx);
61-
par.kernelTorque = std::make_shared<FCM_BM>(
62-
pypar.w_d, pypar.alpha_d, pypar.beta_d.x, pypar.Lx / pypar.nx);
63-
return par;
64-
}
65-
6644
WallMode stringToWallMode(std::string str) {
6745
if (str.compare("nowall") == 0) {
6846
return WallMode::none;
@@ -100,24 +78,14 @@ private:
10078
const uammd::real4 *d_force,
10179
const uammd::real4 *d_torques,
10280
int numberParticles, cudaStream_t st) {
103-
if (fcm) {
104-
return fcm->computeHydrodynamicDisplacements(
105-
(uammd::real4 *)(d_pos), (uammd::real4 *)(d_force),
106-
(uammd::real4 *)(d_torques), numberParticles, 0.0, 0.0, st);
107-
} else if (dpstokes) {
108-
return dpstokes->Mdot(reinterpret_cast<const uammd::real4 *>(d_pos),
109-
reinterpret_cast<const uammd::real4 *>(d_force),
110-
reinterpret_cast<const uammd::real4 *>(d_torques),
111-
numberParticles, st);
112-
} else {
113-
throw std::runtime_error("DPStokesUAMMD: No DPStokes or FCM module "
114-
"initialized. This should not had happened");
115-
}
81+
return dpstokes->Mdot(reinterpret_cast<const uammd::real4 *>(d_pos),
82+
reinterpret_cast<const uammd::real4 *>(d_force),
83+
reinterpret_cast<const uammd::real4 *>(d_torques),
84+
numberParticles, st);
11685
}
11786

11887
public:
11988
std::shared_ptr<DPStokesSlab> dpstokes;
120-
std::shared_ptr<FCM> fcm;
12189
cudaStream_t st;
12290
thrust::device_vector<uammd::real3> tmp3;
12391
thrust::device_vector<uammd::real4> force4;
@@ -127,15 +95,9 @@ public:
12795
real zOrigin;
12896

12997
DPStokesUAMMD(PyParameters pypar) {
130-
if (pypar.mode.compare("periodic") == 0) {
131-
auto par = createFCMParameters(pypar);
132-
this->fcm = std::make_shared<FCM>(par);
133-
zOrigin = 0;
134-
} else {
135-
auto par = createDPStokesParameters(pypar);
136-
this->dpstokes = std::make_shared<DPStokesSlab>(par);
137-
zOrigin = pypar.zmin + par.H * 0.5;
138-
}
98+
auto par = createDPStokesParameters(pypar);
99+
this->dpstokes = std::make_shared<DPStokesSlab>(par);
100+
zOrigin = pypar.zmin + par.H * 0.5;
139101
CudaSafeCall(cudaStreamCreate(&st));
140102
}
141103

0 commit comments

Comments
 (0)