Simple Lattice-Boltzmann Simulator in Python | Computational Fluid Dynamics for Beginners

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ต.ค. 2024

ความคิดเห็น • 55

  • @mikhailnikolaev7282
    @mikhailnikolaev7282 ปีที่แล้ว +10

    It's incredible , your explanations are very clear !

  • @PEGuyMadison
    @PEGuyMadison 11 หลายเดือนก่อน +6

    Great video.. yes the text is hard to see, but one item I would suggest for real time programming is to get rid of the distance sort function.. use distance_squared and compare against a squared value. The SQRT function uses the iterative Newtonian method which can be too expensive and you can just compare distance_squared.

    • @RonM_1971
      @RonM_1971 9 หลายเดือนก่อน

      Now you see the code that I have pasted in. What is your proposal to speed it up a bit, please?

  • @aydencook03
    @aydencook03 2 ปีที่แล้ว +11

    Great video, although longer/more-explanatory variable names would really help with following along and understanding.

  • @incognitojoseph3914
    @incognitojoseph3914 9 หลายเดือนก่อน

    For anyone wondering how to implement constrained LBM with bounce-back condition, just use the same method implemented for cylinder. However the values might still leak through to the other side, hence just keep the previous value in place.

  • @pigsmart6315
    @pigsmart6315 2 ปีที่แล้ว +4

    Great and intuitive video

  • @AJ-et3vf
    @AJ-et3vf 2 ปีที่แล้ว +20

    The screen is very zoomed out so the text is small. Barely readable. Otherwise, very helpful.

  • @ricard458
    @ricard458 ปีที่แล้ว +3

    Amazing video! Will you teach us more simulations?

  • @kyunbumlee8241
    @kyunbumlee8241 ปีที่แล้ว

    Thank you for sharing this video!

  • @ttequenmartin4372
    @ttequenmartin4372 2 ปีที่แล้ว +9

    Very good idea, i reproduced it in Matlab and it works fine. Unfortunately, as i decreased the tau to see what happens with higher Reynolds, the simulation quickly becomes unstable. Even tau=0.3 is too low. Do you know if there is a way to avoid that, using maybe different propagation methods?

  • @yusufe-g4p
    @yusufe-g4p 8 หลายเดือนก่อน

    Nice video! I have a question: is there a particular reason why you didn't go the object oriented route?

  • @Farhad1333Farzan
    @Farhad1333Farzan 5 หลายเดือนก่อน

    Would you please make more of these and coding them it's really helpful

  • @sumairahmad9464
    @sumairahmad9464 ปีที่แล้ว +2

    how did you get to setting the relaxation time to exactly 0.53 and the velocity profile to 2.3 ? Any semi-formulation or trial and error? Also I am a bit confused about the time step , it is one lattice unit in general. Any formulation that you might know where I can set into SI units!
    Much obliged!

  • @AJ-et3vf
    @AJ-et3vf 2 ปีที่แล้ว

    Awesome video! Thank you!

  • @pablobotin9974
    @pablobotin9974 9 หลายเดือนก่อน +2

    Matias (or anyone else)! Could you please share the code?

  • @eelcogg
    @eelcogg 11 หลายเดือนก่อน

    This is cool, but the simulation appears to be very unstable. Even just changing the size of the cylinder causes it to crash. Are we missing a normalization step somewhere?

  • @arminamani8503
    @arminamani8503 ปีที่แล้ว

    hello , thank you very much for this great teaching . unfortunately Im not undrestand in initial condition in line 17 and 18

  • @nemhos666
    @nemhos666 ปีที่แล้ว

    it was amazing!

  • @roopakbaliyan5935
    @roopakbaliyan5935 ปีที่แล้ว

    Thank.
    If possible please upload more videos

  • @xmnemonic
    @xmnemonic ปีที่แล้ว

    good video. would double the sound volume though.

  • @venkatagonella8412
    @venkatagonella8412 8 หลายเดือนก่อน

    Hey Matias, thank you for this video. I want to read an STL file directly, create boundary and fluid particles and then simulate. I mean I wanted to read any general geometry, group the boundaries and then read the data into my LBM code. Kindly do suggest how to do this. currently I wrote 3D LBM code and hard coded for Lid driven cavity. I wanted to make my code generally applicable for any complex geometry. Kindly suggest

  • @dibyajyotinayak9079
    @dibyajyotinayak9079 2 หลายเดือนก่อน

    sir can you plese send me the matlab codes for " A numerical model to simulate the vertical velocity distribution in an open channel withdouble-layered rigid vegetation" on lattice boltzman method

  • @JitaoCai
    @JitaoCai 6 หลายเดือนก่อน

    May I ask why the boundaries at four walls are reflective? The program does not define the boundaries at four walls.

  • @TR1ZZA
    @TR1ZZA 5 หลายเดือนก่อน

    How would you calculate drag coefficient from this?

  • @charlesperry7300
    @charlesperry7300 2 ปีที่แล้ว

    Great application of Python's 'power. In studying the codes. i don't understand that in the streaming process, the cylinder does not appear to exist. As long as each pair of F swap for ALL the nodes in the cylinder region. ux and uy are not zero in the cylinder region. They are set be zero in the plot for the vorticity Anyway, it works magically. Apprecite any helpful comments .

    • @charlesperry7300
      @charlesperry7300 2 ปีที่แล้ว

      Because of the order of execution: collision ,streaming and then applying reflective boundary condition. Whatever the F components computed within the cylinder will never propagate outside of the cylinder, and thus has no effect at all This is is the key to understand how the boundary conditionis implemented in the algorithm.
      .

  • @ArminRamezanzadkerati
    @ArminRamezanzadkerati ปีที่แล้ว

    Thank you for the video.
    Is there anyway for 3D model?

  • @h.e.a311
    @h.e.a311 ปีที่แล้ว

    excellent

  • @Martin-iv5rp
    @Martin-iv5rp ปีที่แล้ว

    great video, it helps me a loit. thanks, but i have a question. How to plot the streamline?

    • @andyliu9377
      @andyliu9377 ปีที่แล้ว

      you might need other libraries or software to draw it, such as pyvista(library) and paraview(software)

  • @halilibrahimcetin9448
    @halilibrahimcetin9448 ปีที่แล้ว +1

    what happens if we rotate the cylinder? Can we simulate that?

  • @Plazmeer3705
    @Plazmeer3705 ปีที่แล้ว

    how do i make it like its a wind tunnel because it appears that the pressure is created at the objects surface instead of the very left wall
    furthermore could i create a point of temporary high pressure to simulate a cannon or rocket combustion chamber

  • @alreadyghosts7727
    @alreadyghosts7727 ปีที่แล้ว +1

    The article you link to is locked up behind a paywall.

    • @mrduckl
      @mrduckl ปีที่แล้ว +1

      you can see it with free acount

  • @vrj97
    @vrj97 ปีที่แล้ว

    Very nice video! Does anyone have a detailed explanation of how to relate the quantities in the simulation to physical units? Like if I have a mean stream velocity of 10cm/s, does that just mean that my delta_x and delta_t should be chosen such that delta_x/delta_t = 10? And I can think of the spacing in cm? I was reading about this and it seems a little more complicated, relating to how Navier-Stokes gets non-dimensionalized. Also somehow the speed of sound matters?

    • @samahnert8909
      @samahnert8909 10 หลายเดือนก่อน +3

      I’m not an expert in lattice Boltzmann but Im doing my phd in unsteady flows and I can share how I do things. Across the board in cfd research in canonical problems (such as the cylinder) it’s common practice to non-dimensionalize your system before running a simulation. For every flow, we pick a characteristic length scale (let’s say L) and velocity scale (let’s say U) giving a characteristic timescale (L/U), and we’ll choose a mass scale that’s supposed to represent fluid density. These are often all just set to 1 in the code so that the only free variable is viscosity. With this, we can define a reynolds number that will fully dictate how the flow behaves. Thus, I think it’s more helpful to think about these simulations in terms of reynolds number, not in terms of the free stream velocity since the reynolds number is what really matters. In terms of how to determine the delx/y, this is more dependent on the numerical scheme you choose to use to solve for the flow (I would refer you to read about the CFL number when designing the dx/y of your mesh). Again, I wouldn’t really think about this in terms of cm, I would just define a characteristic length and let that equal 1.
      For the final question, I want to emphasize that I am very much not a lattice Boltzmann person lol, so idk if this answer will be what you’re looking for. but in more mainstream cfd, speed of sound will not matter for incompressible flows. The speed of sound is actually “infinite” if you enforce incompressibility by solving the poisson equation for pressure (all this means is that pressure is nonlocal and changes everywhere instantaneously). Hopefully some of this was helpful, sorry I went on a tangent. I saw you asked for a “detailed explanation” and couldn’t help myself lol.

  • @hernanllano9711
    @hernanllano9711 2 ปีที่แล้ว

    Thanks!

  • @edwinrobert3507
    @edwinrobert3507 2 ปีที่แล้ว

    Can we have multiple obstacles of different shape and size?how will they affect flow?

    • @Martin-iv5rp
      @Martin-iv5rp ปีที่แล้ว

      yes we can do that, it'll make the difference with pattern of the vortex

  • @mktsp2
    @mktsp2 2 ปีที่แล้ว

    what is the best editor for python? Can i use rstudio?

    • @Martin-iv5rp
      @Martin-iv5rp ปีที่แล้ว

      i've never use rstudio, but so far, i like using pycharm, but we can use sublime text for more lightly python editor

  • @archi_designer
    @archi_designer ปีที่แล้ว

    how to use another shape for example from dxf file?

    • @omkamat9797
      @omkamat9797 ปีที่แล้ว

      I was using this as a skeleton code to implement in some other types of simulation. Usually, you can convert dxf to a png, and then turn that into a numpy array of 0 and 1. Then, with a few simply for loops, you can turn this into an array of true and false. You then simply make sure that the number of lattices are updated to match the size of the numpy array.

  • @luisbarba9532
    @luisbarba9532 ปีที่แล้ว

    How can i do this with a 3D object?

    • @omkamat9797
      @omkamat9797 ปีที่แล้ว

      you will have to use a D3Q19 instaed of the D2Q9. This will add an extra dimention to the F array and other array. I mean it should work probably, but I haven't tried it.

  • @daleeason9687
    @daleeason9687 ปีที่แล้ว +1

    I'm interested in the topic and what changes you make to the existing code. I'm not interested in watching you type the code with the usual typo corrections taking up my time. Is there a link to the final code somewhere?

  • @ch.narasimhakrishna2779
    @ch.narasimhakrishna2779 2 ปีที่แล้ว +1

    i get pictures after 50 iteriations how do i animate it and save it on my pc

    • @omkamat9797
      @omkamat9797 ปีที่แล้ว +1

      i used spyder, and use the save all plots option. Then I just found a free gif making website online, and uploaded all the images there, and it made a gid, showing the animation.

  • @HiddenSongsByHowlsSongbird
    @HiddenSongsByHowlsSongbird 6 วันที่ผ่านมา

    #CFD

  • @ch.narasimhakrishna2779
    @ch.narasimhakrishna2779 2 ปีที่แล้ว +1

    How can we save data in csv file

  • @michaelsteinhof9022
    @michaelsteinhof9022 2 ปีที่แล้ว +1

    pog

  • @ch.narasimhakrishna2779
    @ch.narasimhakrishna2779 2 ปีที่แล้ว +1

    How to can we store data at every time step in csv file to plot graphs later

  • @isaciocca325
    @isaciocca325 2 ปีที่แล้ว +1

    pog