-
Notifications
You must be signed in to change notification settings - Fork 189
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
LB boundary slice and node setters are broken #4859
Comments
Update: the flag field is actually properly communicated, but we never wrote a communicator for the bounce-back velocity map, and the slice update function doesn't automatically recompute the |
The node setters have the exact same bug. This is an issue for circular Couette flow, which are set up by node setters. |
Here is my understanding so far: we must always run a full communication after each call to a node setter or slice setter. This is already the case for the velocity, force, flag and population fields, but not for the UBB map. We cannot introduce a flag to track pending changes introduced by setter functions and trigger a ghost communication whenever a getter function is called, because this would break the constness of the getters, and would also require a mechanism to synchronize the state of the flag between all MPI ranks, which is tedious since we don't include MPI header files. In addition, there are valid use cases for getting the state of the ghost layer before the ghost update, for example during particle coupling where the particle force is interpolated on the fluid while the fluid force is interpolated on the particle. For completeness, here is how the pending status flag would have worked: class LBWalberlaImpl {
/** Flags for pending ghost layer communication. */
enum PendingGhostLayerCommunicationFlag : unsigned int {
/** No pending field update. */
PENDING_COMM_NONE = 0u,
/** Pending changes to pdf/velocity/force fields. */
PENDING_COMM_GHOST = 1u,
/** Pending changes to boundary fields. */
PENDING_COMM_BOUNDARY = 2u,
};
unsigned int m_pending_changes = PENDING_COMM_NONE;
public:
void ghost_communication() override {
if (m_pending_changes & PENDING_COMM_BOUNDARY) {
reallocate_ubb_field();
ghost_communication_boundary();
ghost_communication_pdfs();
} else if (m_pending_changes & PENDING_COMM_GHOST) {
ghost_communication_pdfs();
}
}
void ghost_communication_boundary() {
m_boundary_communicator->communicate();
m_pending_changes &= ~PENDING_COMM_BOUNDARY;
}
void ghost_communication_pdfs() {
m_pdfs_communicator->communicate();
m_pending_changes &= ~PENDING_COMM_GHOST;
}
bool set_node_velocity(Utils::Vector3i const &node, Utils::Vector3d const &vel) {
m_pending_changes |= PENDING_COMM_GHOST;
auto bc = get_block_and_cell(get_lattice(), node, false);
if (bc) {
/* ... */
}
return bc.has_value();
}
}; |
Fixes #4859, fixes #4855 Description of changes: - bugfix: - LB boundaries are now properly communicated in the ghost layer - see details in #4859 - performance: - the LB flag field is no longer communicated at every time step - the LB UBB field is no longer recalculated at every time step - LB boundary setters (node, slice, shape) now always trigger a full ghost communication - maintainability: - the waLBerla header files are no longer visible in the ESPResSo core and script interface - the Boost dependency is now checked at the CMake level to prevent building broken ESPResSo shared libraries (see details in #4856)
The lattice model sets a
blockforest::communication::UniformBufferedScheme<typename stencil::D3Q27>
communicator to exchange information about the pdfs, forces, velocities, and the flag field:espresso/src/walberla_bridge/src/lattice_boltzmann/LBWalberlaImpl.hpp
Lines 360 to 362 in 5cc8361
However, the communication doesn't actually exchange the velocity bounce back flag or normals with neighboring domains. LB boundaries set up via the Python slice setter will only update local domains, and their ghost layer will never be marked as boundaries. Boundaries located at the interface with neighboring domains act as sinks, since fluid can enter them from neighbor domains, but cannot escape them due to bounce-back conditions.
MWE:
Execution:
Output:
For longer simulation times, the fluid velocity gets smaller in magnitude, even though the fluid total momentum remains constant. This bug only affects simulations running with 2 or more MPI ranks.
LB boundaries set up with shapes are not affected by this bug: boundary conditions are calculated for all grid points using the shape, ghost layer included. The slice setter has a different behavior: the slice is further divided into smaller chunks according to the Cartesian topology, in an effort to reduce the communication overhead for large slices.
The text was updated successfully, but these errors were encountered: