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

Control boundary condition per LB node #4252

Closed
RudolfWeeber opened this issue May 16, 2021 · 4 comments
Closed

Control boundary condition per LB node #4252

RudolfWeeber opened this issue May 16, 2021 · 4 comments
Assignees
Labels
waLBerla Issues regarding waLBerla integration

Comments

@RudolfWeeber
Copy link
Contributor

This sketches the steps that need to be taken to allow setting lb (velocity) boundary conditions on a per-node level. this would allow, e.g., for tangential flow around a cylinder (four-roller mill etc).

This is for the Walberla branch.

Objective: LB boundary velocity (and in the future, other BC) should be settable per node. Furthermore, there should be a quick way to mark all lb nodes as boundary that lie inside a Shape. In this way, user can, if suitable, use the boudaries much as with the current implementation.

  • Steps 1+5, and step 2 can be done in parallel and independently.
  • Once step 2 is done, step 7 can be done independently.
  • Steps 1-3 and 7 can be merged without affecting the current implementation

Outline:

  1. Implement functionality to find LB nodes that lie inside a Shape
  2. Expose the per lb node boundary related methods from the Walberla bridge via a callback-interface in lb_interface.cpp/hpp. Expose those methods to Cython via lb.pxd. These are in src/walberla_bridge/LBWalberlaiBase.hpp: get/set_node_velocity_at_boundary(), get_node_boundary_force(), remove_node_from_boudnary(), get_node_is_boudnary(), clear_boundaries().
  3. Python: Implement a class VelocityBounceBack witha data member holding the boudnary velocity for a single node.
  4. Add a "boundary" property to the LBFluidWalberla Cython class. The setter should accept an instance of VelocityBounceBack and call the boundary setter from 2 or None to clear the boudnary. The getter should return an instance of VelocityBounceBack with the boundary velocity set or None in case of no boundary.
  5. Using the the function from 1., write a generater LBFluidWalberla.get_nodes_inside_shape() generator which iterates over lb nodes that lie inside the given shape.
  6. Delete the current lbboundaries logic (src/core/grid_based_algorithms/LBBoundaries and lb_boudaires.cpp/hpp, src/script_interface/lbboundaries, src/python/esperssomd/lbboundaries.py)
  7. Implement a read-only property LBFluidWalberla.boundary_force which returns he force on a boundary lb node (LBWalberlaImpl::get_node_boundary_force())
  8. Convert samples and tutorials to use the convenience function from 5. to setup the lb noundary conditions

Details

1. Rastering

See utils/include/utils/raster.hpp for an idea.
Rather than returning a list of return values from the funciotn called at raster points, the new function should return a list of index-triplets for those raster points for which the funciotn f returned true.
With that a std::Vector<Utils::Vector3i> lb_nodes_inside_shape(const& Shape) can be written that returns the indices of lb nodes which are insde the shape. (Probably, a lambda should be used as test funciot for the raster funciton).

2. Exposing boundary related functions

See the lb_lbnode_get/set_velocity() functions in src/core/grid_based_algorithms/lb_interface.cpp and the corresponding functions in src/python/espressomd/lb.pxd as template

5. Generator

See the LBFluidWalberla.nodes() generator as template

@jngrad jngrad added the waLBerla Issues regarding waLBerla integration label May 25, 2021
@jngrad jngrad changed the title Control boundary condtion per lb node Control boundary condition per LB node Sep 2, 2021
@jngrad
Copy link
Member

jngrad commented Oct 19, 2021

@christophlohrmann's draft was merged in the walberla branch.

@jngrad
Copy link
Member

jngrad commented Oct 21, 2021

Progress report: it is now possible to set per-node slip velocities. There are still a few rough edges, for example when adding a new LB boundary, the core automatically clears the flag field and rebuilds it with the vector of LB boundaries. This means the per-node velocities must be set after all LB boundaries have been added. If one sets boundary velocities and then adds a new LB boundary, the per-node velocity information is silently lost and the sampled flow profile will be wrong.

There are two samples to illustrate the new feature. By default they produce quiver plots to show the fluid motion; pass option --visualizer to draw the flow field in a 3D window. The circular Couette flow is tested against the analytical formula for an infinitely long cylinder (Taylor-Couette equation).

  • ./pypresso ../samples/lb_circular_couette.py --visualizer
    Vector field of a fluid trapped in a vessel with a rotating rod
  • ./pypresso ../samples/lb_four_roller_mill.py --visualizer
    Vector field of a fluid trapped in a four-roller mill

@RudolfWeeber
Copy link
Contributor Author

RudolfWeeber commented Oct 22, 2021 via email

@RudolfWeeber
Copy link
Contributor Author

Rhis is done in the Walberla branch.

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

No branches or pull requests

4 participants