From 98b2465b9042d913cbfb1f27083ab6b5db0d2427 Mon Sep 17 00:00:00 2001 From: L Laniewski-Wollk Date: Mon, 6 May 2024 23:57:11 +1000 Subject: [PATCH] Making torque and omega optionally zero --- src/Handlers/acRemoteForceInterface.cpp | 8 +++++++- src/Lattice.cu.Rt | 27 +++++++++++++------------ src/Lattice.h.Rt | 1 + 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/Handlers/acRemoteForceInterface.cpp b/src/Handlers/acRemoteForceInterface.cpp index 63ca861a2..93e3625cf 100644 --- a/src/Handlers/acRemoteForceInterface.cpp +++ b/src/Handlers/acRemoteForceInterface.cpp @@ -55,7 +55,7 @@ int acRemoteForceInterface::ConnectRemoteForceInterface(std::string integrator_) bool use_box = true; attr = node.attribute("use_box"); if (attr) use_box = attr.as_bool(); - + if (use_box) { lbRegion reg = solver->lattice->region; double px = solver->lattice->px; @@ -69,6 +69,12 @@ int acRemoteForceInterface::ConnectRemoteForceInterface(std::string integrator_) pz + reg.dz - PART_MAR_BOX, pz + reg.dz + reg.nz + PART_MAR_BOX); } + + attr = node.attribute("omega"); + if (attr) solver->lattice->RFI_omega = attr.as_bool(); + attr = node.attribute("torque"); + if (attr) solver->lattice->RFI_torque = attr.as_bool(); + MPI_Barrier(MPMD.local); solver->lattice->RFI.Connect(MPMD.work,inter.work); diff --git a/src/Lattice.cu.Rt b/src/Lattice.cu.Rt index d17408bc3..01e4449c5 100644 --- a/src/Lattice.cu.Rt +++ b/src/Lattice.cu.Rt @@ -146,6 +146,8 @@ Lattice::Lattice(lbRegion _region, MPIInfo mpi_, int ns): zSet(ZONESETTINGS, ZON container->particle_data_size = 0; SC.balls = &RFI; RFI.name = "TCLB"; + RFI_omega = true; + RFI_torque = true; } /// Initialization of MPI buffors @@ -398,14 +400,9 @@ void Lattice::CopyInParticles() { CudaMalloc(&container->particle_data, RFI.mem_size()); } container->particle_data_size = RFI.size(); - for (size_t i=0; i 0) { CudaMemcpyAsync(container->particle_data, RFI.Particles(), RFI.mem_size(), CudaMemcpyHostToDevice, kernelStream); } @@ -422,12 +419,16 @@ void Lattice::CopyOutParticles() { CudaStreamSynchronize(kernelStream); DEBUG_PROF_PUSH("Testing particles for NaNs"); int nans = 0; - for (size_t i=0; i 0) notice("%d NANs in particle forces (overwritten with 0.0)\n", nans); diff --git a/src/Lattice.h.Rt b/src/Lattice.h.Rt index 6cdde4882..220b997a5 100644 --- a/src/Lattice.h.Rt +++ b/src/Lattice.h.Rt @@ -74,6 +74,7 @@ public: real_t px, py, pz; MPIInfo mpi; ///< MPI information rfi_t RFI; + bool RFI_omega, RFI_torque; solidcontainer_t SC; size_t particle_data_size_max; char snapFileName[STRING_LEN];