Skip to content

3d droplet impact

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #6662
    abbas
    Participant

    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?

    #6663
    Adrian
    Keymaster

    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).

    #6670
    abbas
    Participant

    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?

    #6671
    abbas
    Participant

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

    #6672
    Adrian
    Keymaster

    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).

    #6674
    abbas
    Participant

    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> {
    private:
    const Vector<S,2> _center;
    const S _radius;
    const S _radius2;
    public:
    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;
    };

    #6675
    mathias
    Keymaster

    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

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