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
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
1715namespace uammd_dpstokes {
18- using FCM_BM = uammd::BDHI::FCM_ns::Kernels::BarnettMagland;
19- using FCM = uammd::BDHI::FCM_impl<FCM_BM, FCM_BM>;
2016using DPStokesSlab = uammd::DPStokesSlab_ns::DPStokes;
2117using uammd::System;
2218using 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-
6644WallMode 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
11887public:
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