A list of puns related to "Lattice Boltzmann Methods"
Hello,
Iβm currently working at my master thesis and I implement a Lattice Boltzmann Method for Solids. The project Iβm working on is already in an advanced state and my main task is to parallelise the necessary calculations (Which is usually quite straight forward for LBM). At the moment I struggle quite a lot with the architecture design of the software. In the past for simpler problems I usually came up with my own ides which werenβt ideal by any means but worked. In this project I want to program it more efficiently so I need to do some research about proper software design.
So my question would me if you know any literature about (object oriented) software design specifically for engineering related problems. In general I always found a lot of good books about numerical procedures explaining the foundational principles. Furhtermore, there are a lot of good physics books explaining the physical concepts (FEM, LBM etc.). However, I need some advice on the implementation especially if it getβs more complicated than just a regular, rectangular mesh.
Would really appreciate if anyone got some experience or ideas.
TLDR: Iβm looking for books/literature explaining the implementation part of mechanical problems instead of just the physics.
I recently learned of the incredibly powerful Lattice Boltzmann Method and how easy it is to write an implementation in something like Python or C# (see https://medium.com/swlh/create-your-own-lattice-boltzmann-simulation-with-python-8759e8b53b1c) and I was wandering if anybody knows how this could be extended to flows on the surface of a sphere? The idea being to implement a dry dynamical core circulation model. How would you represent the grid, a cube sphere, polar coordinates, modified equations?
Karman Vortex. A symmetric flow passing a circular object.
LBM is a method to simulate fluids and it is really easy to implement it in Python.
https://github.com/goktug97/LatticeBoltzmannSimulation
Call it with
PYTHONPATH="$(pwd)/:$PYTHONPATH" python3 simulations/karman_vortex.py --text Python
and it will simulate a fluid around "Python" text
Having found a number of papers on the curvilinear Lattice Boltzmann Method, such as
https://www.sciencedirect.com/science/article/abs/pii/S0045793014001066?via%3Dihub
Iβve been trying to apply the maths to curvilinear cubed sphere grids such as those described by
https://iopscience.iop.org/article/10.1088/1755-1315/19/1/012012/pdf
Ignoring the elliptic method as it requires an iterative solution, I would like to use the Equiangular Gnomonic mapping, but this is defined per face rather than for the inscribed cube as a whole so there would be seams between each face.
This means the metric for the curvilinear transformation would be piecewise, but symmetrical. As the curvilinear derivatives are solved with finite difference before the LBE is run the maths should be fine for each individual face, but Iβm not sure how to stitch the faces together when running the LBE.
Iβll write the code in Python when I get round to it, but would each face have its own set of np arrays? How would I connect them for flow between faces? Could I fit into 1 array somehow?
Any help is appreciated.
P.S. I have a copy of βThe Lattice Boltzmann Method: Principles and Practiceβ so I can refer to that for anything regarding the standard Cartesian LBM.
I want learn all about lattice Boltzmann methods, but irony is I am not from fluid mechanics background. So can anyone suggest me what course of learning should I follow ?
Perhaps suggest me a textbook that takes me through the basics of fluid mechanics to fluid dynamics to CFD and finally I would have enough background to start with lattice-Boltzmann method.
I have around 2.5 months for this.
Any help would be appreciated. Thanks.
As per the discussion topic vote, December's monthly topic is the Lattice Boltzmann method.
Hi everyone,
I am currently learning LBM. I have derived the approximated distribution formula from scratch, this:
f_i=w_i rho (1+x_j u_j+1/2(u_j u_k+(sigma^2-1)d_ij)(x_i x_j-d_ij)
During the derivation, the first step is to approximate a Gaussian distribution with Hermite polynomials. The formula above, uses Hermite polynomials up to degree 2.
One question is, is this a good approximation? I plotted the original function and the function approximated by 2 degree of Hermite polynomials. This is what it looks like:
https://preview.redd.it/ccsf3swtyxr11.png?width=360&format=png&auto=webp&s=a7e51643f1124f4d43c69c5ed3b523923497c289
From my perspective, this is a really poor approximation. The value is so wrong at x=0.
Sure we can approximate it with more terms, but given the formula derived from it is widely used, I have doubt on the accuracy of this formula.
Anyone familiar with LBM can help me?
EDIT:
Please confirm my expansion is done correctly:
Gaussian: Exp(-x^2/2)/Sqrt(2 Pi)
Approximated 2nd order: Exp(-x^2) (1+2x^2)/(2 Sqrt(Pi))
(Original function have miu and sigma which are substituted with 0 and 1 respectively)
EDIT 2:
u/wstrncdn ask me to provide image of higher order approximations, here is the result:
https://preview.redd.it/wyb7ndwml2s11.png?width=660&format=png&auto=webp&s=0888344acd3feaee6104ac113d8a770e5c6dacee
It looks like even 3rd order approximation wasn't that good, but it's better with 6th and 9th terms added.
9th Appro: exp(-x^2) (321-312x^2+552x^4-160x^6+16x^8)/(384 sqrt(Pi))
EDIT 3:
Some people pointed out that it's the moment integral that's important. So let's see how accurate it is:
(Ordered from 1st to 9th approximation)
0th moment: {1., 1., 1., 1., 1., 1., 1., 1., 1.}
2nd moment: {0.5, 1., 1., 1., 1., 1., 1., 1., 1.}
4th moment: {0.75, 2.25, 2.25, 3., 3., 3., 3., 3., 3.}
1st, 3rd moments are all zero (obviously because of symmetry)
So 2nd order approximation will get the wrong 4th moment, but the 0th and 2nd are correct. Not sure about asymmetric distributions though.
EDIT 4:
The discussion have went a long way but I think we can conclude now: 2nd order approximation LBM is actually accurate up to 2nd moments for integrals only, and that's all we want so nothing to be surprised here.
I have been working on multiphase LBM for quite a few months. Now, I want to get into multiphase non isothermal but I'm struggling. Can anyone suggest me how to start either by journals or any basic code from which I can start working on. Thank you.
Hello All,
I was perusing past posts and questions on LBM here (and some other subreddits) and noticed some misconceptions and false statements.
If there is any interest I am here to answer any questions I can about LBM, its limitations, its pros, and where the method is going.
Hi guys! We wanted to share our new webinar with you, as we've released a groundbreaking GPU-based solver using the Lattice Boltzmann method with an unparalleled combination of accuracy and speed. Our free webinar will teach you how you can now run transient simulations in hours instead of days, all in a web browser.
Feel free to register here, we look forward to seeing you!
https://www.simscale.com/webinars-workshops/lbm-flow-solver/
Results of a CFD simulation of LOHAS Park being post-processed in a web browser on SimScale
Hello All,
I hope I can generate some interest in this niche topic, and answer any questions if you've heard of the method before!
I am a PhD Candidate working primarily on the theory, but also computational implementation of the lattice Boltzmann method and lattice gas cellular automata. This is an alternative approach to solving the Navier-Stokes equations, and beyond, as it does not rely on the continuum assumption. There is quite a laundry list of pros that have been developed over the past 18 years of this approaches existence.
I'm in my final year of Automobile Engineering (undergrad). I wanted to start a project on fuel injection modeling using the Lattice Boltzmann method. I plan to work my way up to multi-phase modeling over a period of time. Are there any tutorials on the net for a beginner like me?
I'm reasonably experienced in modeling multi-phase flows in fluent and my concepts of FEM and FVM are good, though I'm guessing they won't matter once I get involved in LBM. I've downloaded a software called Palabos, and I've also heard that you can write the code for such a problem in MATLAB. Any help would be appreciated.
Hey Everyone!
For everyone starting out with simulations, I created a tutorial on the Lattice Boltzmann method with code and example simulations. It is quite an easy method with can simulate quite complex stuff in 2D.
Here is the link: https://minttube.net/topic/5/3/9/
I will also add videos in the future!
Thank in advance!
I've initialized an D2Q9 LBM simulation with the following parameters.
size = 32 x 32 initial state, set to BGK equilibrium with density of 1 (zero quantized velocity density = 4/9, cardinal velocities = 1/9, ordinal velocities 1/36). tau = 0.6, assuming unit dt (1) and unit dx (1).
Then before I run the simulation, I modify the initial state so that the north quantized velocity has + .01 added to it for every cell.
When running the simulation I get odd results. I get a increase in velocity (and density) over time with no other changes put into the system and eventually it appears to break the simulation. I would have expected the velocity to dissipate overtime as the system reaches total equilibrium. The simulation appears to do strange things when I add velocity to the initial state (or really add any velocity at all). With out changing velocity during the simulation, there seems to be some sort of run-away effect causing an increase in density overtime, I'm unsure however if this is actually due to the boundaries or not.
Here are example videos, https://imgur.com/a/qc0lbrg
My streaming code basically is this:
My collision code uses the BGK operator, and basically is this:
w_i * density * ( 1 + 3 * (dot(c_i,u)) + (9/2) * (dot(c_i,u)^2) - 3/2 * (dot(u,u))^2);
Not explicitly CFD but I figured someone here might be able to answer my question.
I would like to run some isothermal and non-isothermal simulations using Lattice-Boltzmann and I'm looking into using the beta feature in ANSYS Fluent 2021 R1. I took a look at the Beta Manual but I'm looking for a more theoretical guide to help me troubleshoot and assess the quality of my simulation.
I uploaded it in the following repository: https://github.com/Nappael/JuliaLatticeBoltzmann
The included code runs a simple wave propagation problem with an initial density perturbation, but it's the same streaming -> BGK collision algorithm that is often used in fluid flow problems and should be very easy to modify for such a purpose. I tried to make it run as fast as possible, and the main loop is totally allocation free, but more advice would definitely be appreciated as I'm still learning.
Hopefully this ends up being useful to someone. It's only 80 lines and hopefully easy to understand and learn from.
Some things I learnt:
- Julia has some really helpful libraries for Tensor arithmetic that are really efficient, create easy to read code, and are well suited to calculate the macroscopic fluid properties (density, velocity) in the LB method. This code uses Einsum to calculate the velocities as well as the Feq term in the BGK collision equation. There's also TensorOperations.jl which I'm yet to test but has CUDA support, so maybe could be useful to get this code running efficiently on GPU's.
- In 2D at least, the streaming step can be made extremely efficient using the in-place circshift! into a placeholder array, then circshift! again into the final F array. This wouldn't work quite so cleanly in 3D but I'm sure something can be done there.
I import a mesh (.msh) into Fluent LBM (see attachment). The mesh contains four contact regions. In ANSYS Meshing, I model all four as interface zones but Fluent changes them to walls:
Zone not slit.
Warning:Thread type of contact_region-src has been changed from interface to wall.
Zone not slit.
Warning:Thread type of contact_region-trg has been changed from interface to wall.
Zone not slit.
Warning:Thread type of contact_region_2-src has been changed from interface to wall.
Zone not slit.
Warning:Thread type of contact_region_2-trg has been changed from interface to wall.
--------------------------------------------------------------------------------------------------------------------------------------
The boundary types included in Fluent LBM are inlet, outlet, wall and symmetry.
Thus, I suspect that the problem should be resolved during the meshing stage. Does anyone know how I could approach meshing to make it LBM-proof?
--------------------------------------------------------------------------------------------------------------------------------------
EDIT [SOLVED]: I remodelled the geometry as one body instead of three, eliminating the need for contact regions.
Hello,
edit: after editing a link I managed to somehow delete half of the text I wrote so I will try to rewrite it....
After asking several questions in this subreddit let me share with you the results we (a student of mine and me) obtained by implementing a lattice Boltzmann (LB) toy 2d code in futhark. The reason I chose the LB method is because it is a highly parallel algorithm and that I know it well (I am one of the main developers of the Palabos library).
The code can be found there:
https://githepia.hesge.ch/orestis.malaspin/palathark
Disclaimer: the code is certainly not very idiomatic futhark, it is very (very very) experimental.
By changing the makefile you can also see an output image with the SDL2 library but it's not required.
This post is quite lengthy so I give first the results. If you are interested in the algorithm I expand a bit below. The LB method performance is measured in MSUPS (Mega Sites Updates per Second). I will refer to the performance of each branch which of the repo to differentiate them. The tests are performed on a GPU: nvidia RTX 2080 ti with the opencl backend. The major difference between the different is the memory layout used (and in the fastest case single precision floats are used). This is still ongoing experiment, but I thought sharing it here at this point could be a good idea for maybe some feedback.
three_dim 670
one_dim 670
one_dim_t 860
one_dim_t_tuples 1300
one_dim_t_tuples_floats 3200
These results are quite impressive IMO. Let us discuss now briefly the differences between the branches. The major difference is the memory layout of the principal data structure of the LB method. In the three_dim
branch we used the memory layout usually used for C/C++ codes with the multi-dimensional array being of type f: [nx][ny][9]f64
. In the one_dim
branch the two fused dimensions are flattened, and one sees no difference in performance, f:[n][9]f64
with n=nx*ny
. In the one_dim_t
branch we simply take the transpose of f:[9][n]f64
. Here we see an increase in performance of about 40%. Finally, in one_dim_t_tuples
we express the first dimension of the f
data structure by using a 9-components tuples.
f: ([n]f64, [n]f64, [n]f64, [n]f64, [n]f64, [n]f64, [n]f64, [n]f64, [n]f64).
We see a quite important increase in perform
... keep reading on reddit β‘Hello my numerical simulation friends! I am trying to get in touch with Lattice-Boltzmann for CFD applications. I am knowledgeable with RANS CFD modeling in a number of software like Fluent and STAR-CCM+. I wanted to know how it can be applicable to an example such as external aerodynamic flows over cars. Also, how complex is the need for meshing and solution setup for LB CFD?
I want learn all about lattice Boltzmann methods, but irony is I am not from fluid mechanics background. So can anyone suggest me what course of learning should I follow ?
Perhaps suggest me a textbook that takes me through the basics of fluid mechanics to fluid dynamics to CFD and finally I would have enough background to start with lattice-Boltzmann method.
I have around 2.5 months for this.
Any help would be appreciated. Thanks.
Hey Everyone!
For everyone starting out with simulations, I created a tutorial on the Lattice Boltzmann method with code and example simulations. It is quite an easy method with can simulate quite complex stuff in 2D.
Here is the link: https://minttube.net/topic/5/3/9/
I will also add videos in the future!
Thank in advance!
Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.