Skip to content

Step-by-step Tutorials?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #8176

    I am moderately familiar with both the Lattice Boltzmann method and C++, but I’ve been really struggling to make heads or tails of how to use OpenLB. I’ve looked through the user guide and a few examples, but I still feel completely clueless as to how to actually set up and run a model. Are there any simplified, step-by-step tutorials on configuring and running your first case? The “Examples” section of the user guide basically just says “Refer to the examples”, but I find them to be incredibly confusing as a beginner.

    For example, for the 2D Poiseuille flow example, I follow the first few lines. But then, it gets to the geometry, and it is over 100 lines of pretty intense looking code for what should be extremely simple geometry. I’m only more confused the further down I go as it gets into initialization, report writing/plotting, error estimation, and so on!


    Thank you for your interest in OpenLB! I read that you looked through the user guide but did you see chapter “10: Step by Step: Using OpenLB for Applications” there? This is probably exactly what you are searching for.

    As for the geometry of the poiseuille 2d case: Which case are you looking at? The geometry setup in examples/laminar/poiseuille2d consists of 33 lines including comments and empty lines so I am confused what you mean.


    Thanks for the reply. I did see that section: it does a really great high-level overview, but it doesn’t dive into a lot of the detailed specifics (which is where I’m struggling).

    For example, with the Poiseuille 2D case: it starts with superGeometry.rename. I assume that this is defining the fluid/walls AS a fluid/wall through the use of material numbers or something, but I am completely lost on the actual syntax/arguments, or how the material numbers need to be specified – both here and in the next section on inflows/outflows. The boundary condition section confused me at first with all of the if statements, but after re-reading it it mostly makes sense, other than the numbers being passed as arguments at the end (which I assume are somehow related to the material numbers).


    There is additional documentation on the geometry setup in chapter 3. You may also find Doxygen convenient for looking up specific methods.

    The conditionals in the lattice setup of the 2D Poiseuille case are only to realize the different supported boundary conditions for illustration (you control this via the definitions at the top of the file).

    The basic approach followed in many OpenLB cases is to:

    1. Separate the spatial domain into blocks (CuboidGeometry)
    2. Assign material numbers to the cells of the discretized domain (SuperGeometry) to group them into e.g. bulk and boundary cells
    3. Assign local cell models (Dynamics) and boundary conditions to cells using material indicators as a proxy
    4. Define initial and boundary values
    5. Start the core simulation loop with periodic output of results

    Do you have specific questions? Otherwise there really is no way around reading the code alongside the documentation if you want to further familiarize you with the code. One thing I want to highlight is that the specific way that the example cases are set up are only a convention that we found useful over the years – nothing is stopping you from structuring things differently using the core OpenLB classes.

    If you want hands-on instruction with practical exercises you may find our upcoming Spring School interesting. Of course you can also ask questions in this forum.

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