Skip to content

3d droplet impact

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
  • #6662

    Hey all, Is it possible to simulate the droplet impact on the surface 2D or 3D using openLB. I am a beginner in OpenLB and not familiar with C++. I run the examples but the code is so confusing, I do not understand how the geometry is built for example in the laminar cylinder2d example I cannot find the relevant code. I have worked with Fortran to write LBM codes and i wanted to use OpenLB to run some 3d cedes but I found it so hard to modify or understand the example codes even in 2D, how to build a complete new simulation from zero. do you have any recommendation?


    For a basic introduction into OpenLB you can check out e.g. the userguide [pdf].

    The provided examples commonly set up the geometry (meaning material numbers assigned to cells) in the prepareGeometry function. This is also the case for laminar/cylinder2d.

    For a droplet impact you could start out e.g. by taking a look and modifying the freeSurface/fallingDrop(2,3)d examples (if free surface is a workable model for your application).


    Thanks Adrian, The thing I don’t understand is there is no sign of the defining the geometry for example the circular obstacle. I only found the center of the obstacle information in cylinder2d.cpp file.
    In the userguide it is mentioned that the geometry is read through an .stl file which I also cannot find it in the directory of the cylinder2D example. for instance if I wanted to change the circular obstacle into a rectangular one what should I do?


    or for example if I want to put a hexagonal obstacle what part of the code should be changed?


    For the cylinder2d example the most relevant line is 91:

      superGeometry.rename( 1,5, circle );

    This changes the fluid cells overlapped by the given circle indicator to 5. In prepareLattice cells of material 5 are then handled by either plain or interpolated bounce back. If you want to exchange the circle with another obstacle geometry, you only need to change the circle indicator to some other indicator class (e.g. IndicatorCuboid2D for a rectangular shape).


    ok thanks, got it.
    can you explain how the following code generate a circle?
    I think only rectangular and circle and triangle can be defined using the library of Openlb and if I want to create for example a hexagonal I have to write my own code.

    template <typename S>
    class IndicatorCircle2D : public IndicatorF2D<S> {
    const Vector<S,2> _center;
    const S _radius;
    const S _radius2;
    IndicatorCircle2D(Vector<S,2> center, S radius);
    Vector<S,2> const& getCenter() const;
    S const getRadius() const;
    bool operator() (bool output[], const S input[]) override;
    bool distance(S& distance, const Vector<S,2>& origin, const Vector<S,2>& direction, int iC=-1) override;
    bool normal(Vector<S,2>& normal, const Vector<S,2>& origin, const Vector<S,2>& direction, int iC=-1) override;
    S signedDistance(const Vector<S,2>& input) override;
    using IndicatorF2D<S>::distance;


    Basic ones are implemented as well as a stl-interface. But it is easy to write your own. Would be nice if you could share your code here to be included in the next release! Best Mathias


    Hi all,
    Can you explain how this command change only the flow cells into the material number 1 and kepps the boundary cells as 2?

    superGeometry.rename( 2,1,{1,1} );

    I found this function
    void rename(int fromM, int toM);
    /// replace one material that fulfills an indicator functor condition with another

    so the materials are change from 2 to 1, then what is {1,1};



    Hello abbas,

    rename(int fromM, int toM) will replace one material with another.

    It is possible to call the rename function with additional parameters. The different ways to call the function can be found in our user guide or our doxygen documentation.

    In this case ( superGeometry.rename( 2,1,{1,1} ) ) the material 2 (boundary) is replaced by 1 (fluid), respecting an offset. Here the offset is 1 in both x- and y-direction.



    Dear Adrian,
    Thanks again for your reply, Can you introduce a paper that use the same method which is used in the free surface simulation in open LB. I would like to simulate droplet impact on the solid surface, I believe the interaction between the solid and liquid is not considered in the free surface model.
    What is the solution for it can I combine the free energy model and free surface model for droplet impact on the solid surface with different hydrophobicity?

    one more question when I tried to run the 3D falling droplet i got the following error, can you help?
    Segmentation fault (core dumped)\



    OpenLB’s free surface implementation follows the approach of Thürey “Physically based Animation of Free Surface Flows with the Lattice Boltzmann Method”. PhD thesis. 2007.

    I am not very familiar with the free energy model so I can’t comment on the combinability. Possibly some of my colleagues will be able to help.

    The examples as they are included in the release were tested successfully on various systems – to investigate this problem I’ll need to know more about where and how you tried to execute the simulation and whether you changed anything.


    Thanks Adrian, I tried other 3d model like 3d cylinder, it runs without problem. the 2d falling droplet also works without problem, but it gives error for 3d falling droplet. I did not change anything in the code I used the Ubuntu windows shell installed and run it.


    I just remembered that the default resolution of the fallingDrop3d case at N=1024 was chosen to big for most common desktop systems. i.e. only the lattice data requires around 127 GiB of RAM for this resolution which likely causes the process to be killed with memory errors on your system. We since changed it to a more sustainable value of N=200.

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.