taichi_LBM3D icon indicating copy to clipboard operation
taichi_LBM3D copied to clipboard

a question about poiseuille flow

Open zh-shen opened this issue 1 year ago • 19 comments

Dear Dr. Yang I want to compare the simulated results with the analytical results for the plane poiseuille flow problem, but the simulated maximum velocity is far from the analytical one. the parameters and the code is shown as follow: 0 1 the simulated result is: array([0. , 0.00529185, 0.01337433, 0.01914818, 0.02261291, 0.0237679 , 0.02261291, 0.01914818, 0.01337433, 0.00529183, 0. ], dtype=float32) but the analytical maximum velocity should be 0.1 I see your paper mentioned the use of halfway bounce-back boundary conditions for the poiseuille flow, how to make it? could you please give to some suggestions?

zh-shen avatar Sep 17 '23 13:09 zh-shen

Hi,

This code is already using half way bounce back scheme. When you run the simulation have you checked if the result already reach equilibrium? You can check by plot u_max VS time. when this max velocity doesn't.change any more it means the system reach equilibrium. I feel that if you need to run the simulation for a longer time, you probably will get better result.

zh-shen @.***> 于 2023年9月17日周日 下午2:50写道:

Dear Dr. Yang I want to compare the simulated results with the analytical results for the plane poiseuille flow problem, but the simulated maximum velocity is far from the analytical one. the parameters and the code is shown as follow: [image: 0] https://user-images.githubusercontent.com/55670602/268504527-d8b4f090-973b-4766-844f-318d3b95e08e.jpg [image: 1] https://user-images.githubusercontent.com/55670602/268504717-acc07148-f857-42d3-b39b-95705d156536.jpg the simulated result is: array([0. , 0.00529185, 0.01337433, 0.01914818, 0.02261291, 0.0237679 , 0.02261291, 0.01914818, 0.01337433, 0.00529183, 0. ], dtype=float32) but the analytical maximum velocity should be 0.1 I see your paper mentioned the use of halfway bounce-back boundary conditions for the poiseuille flow, how to make it? could you please give to some suggestions?

— Reply to this email directly, view it on GitHub https://github.com/yjhp1016/taichi_LBM3D/issues/20, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJEDKQCLFXLL7FBTH2JRTNTX2353DANCNFSM6AAAAAA43UHCIA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

yjhp1016 avatar Sep 17 '23 13:09 yjhp1016

thanks for your quick reply! I think the result has reached equilibrium, you can see the screenshot 2

zh-shen avatar Sep 17 '23 14:09 zh-shen

do i still run longer?

zh-shen avatar Sep 17 '23 14:09 zh-shen

Hi, due to the use of half way bounce back, you need to make your channel width as 12 lattice (your current geometry seems is 11lattice, means actual channel.width is 10lu). Analytical v_max should be 0.06667 not 0.1 (see the manuscript in your first email). If you enlarge the channel to correct size you can get better result I think

zh-shen @.***> 于 2023年9月17日周日 下午3:08写道:

thanks for your quick reply! I think the result has reached equilibrium, you can see the screenshot [image: 2] https://user-images.githubusercontent.com/55670602/268507159-78423bec-421b-4e2c-8aa4-2dae9444167a.jpg

— Reply to this email directly, view it on GitHub https://github.com/yjhp1016/taichi_LBM3D/issues/20#issuecomment-1722486160, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJEDKQD35EV3JD57L3GGVSDX2377DANCNFSM6AAAAAA43UHCIA . You are receiving this because you commented.Message ID: @.***>

yjhp1016 avatar Sep 17 '23 14:09 yjhp1016

To reduce the computing time, I reduced fy. and this is the code code the formular I used to calculate the max velovity is $u_{max}={gH^2\over 8\nu}$, then the analytical one is $u_{max}={1/610^{-6}410^2 \over 81/6} = 5*10^{-3}$. and the simulated results are results0 results1 the max velocity is stable for many time step, so i think the its reaches equilibrium. but the simulated one didn't match the analytical one. i don't know what the problem is

zh-shen avatar Sep 18 '23 02:09 zh-shen

Hi,

Thanks for pointing out this issue, I have carefully checked the kernel, found two bugs, I have fixed them and added a poiseuille flow example (similar to yours), I tested it with different widths, and now can get results with only ~ 3% against analytical solution. Please use git pull to update your code and try :-)

Thanks,

Jianhui

On Mon, 18 Sept 2023 at 03:00, zh-shen @.***> wrote:

To reduce the computing time, I reduced fy. and this is the code [image: code] the formular I used to calculate the max velovity is $u_{max}={gH^2\over 8\nu}$, then the analytical one is $u_{max}={1/610^{-6}410^2 \over 81/6} = 5*10^{-3}$. and the simulated results are [image: results0] [image: results1] the max velocity is stable for many time step, so i think the its reaches equilibrium. but the simulated one didn't match the analytical one. i don't know what the problem is

— Reply to this email directly, view it on GitHub https://github.com/yjhp1016/taichi_LBM3D/issues/20#issuecomment-1722661909, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJEDKQEMITH7S3AD2U2AG3DX26TM7ANCNFSM6AAAAAA43UHCIA . You are receiving this because you commented.Message ID: @.***>

yjhp1016 avatar Sep 18 '23 13:09 yjhp1016

:-)

zh-shen avatar Sep 18 '23 15:09 zh-shen

hi, i recalculated two case of poiseuille flow with your new code the formular that i used to compute the max velocity is $u_{max}={fH^2\over 8 \rho \nu}$ the code of the first case is code0 the simulated result is result0 result1 you can see the max velocity is stable at 4.42e-4, but the analytical result is 5e-4

the second case is your example_poiseuille_flow.py, the code is code1 the simulated result is result2 result3 the simulated max velocity is still increase even i have simulated for 800000th step, and its value is up to 0.019685, but the analytical result should be about 0.016875. do you think the answer is acceptable? and did i make any mistake? thank for your reply!

zh-shen avatar Sep 19 '23 06:09 zh-shen

Hi I think.that shoud be fine. Taichi use single precision, so I'm not surprised we lost some accuracy. The code in C++ double precision can give much better result.

zh-shen @.***> 于 2023年9月19日周二 上午7:51写道:

hi, i recalculated two case of poiseuille flow with your new code the formular that i used to compute the max velocity is $u_{max}={fH^2\over 8 \rho \nu}$ the code of the first case is [image: code0] the simulated result is [image: result0] [image: result1] you can see the max velocity is stable at 4.42e-4, but the analytical result is 5e-4

the second case is your example_poiseuille_flow.py, the code is [image: code1] https://user-images.githubusercontent.com/55670602/268865004-ccb0b056-8c95-4c7d-a749-a961194b42b9.jpg the simulated result is [image: result2] https://user-images.githubusercontent.com/55670602/268865066-ebc59e1d-f381-4839-98ba-b6ce4942bb6e.jpg [image: result3] https://user-images.githubusercontent.com/55670602/268865095-860c5fe5-0646-40b2-bd51-da6c6a4a037b.jpg the simulated max velocity is still increase even i have simulated for 800000th step, and its value is up to 0.019685, but the analytical result should be about 0.016875. do you think the answer is acceptable? and did i make any mistake? thank for your reply!

— Reply to this email directly, view it on GitHub https://github.com/yjhp1016/taichi_LBM3D/issues/20#issuecomment-1724926893, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJEDKQECNMXJD2ZYHBXCPX3X3E6IZANCNFSM6AAAAAA43UHCIA . You are receiving this because you commented.Message ID: @.***>

yjhp1016 avatar Sep 19 '23 07:09 yjhp1016

but i get the same results evenif if write ti.init(default_ip=ti.i64,default_fp=ti.f64,arch=ti.cpu,kernel_profiler=False, print_ir=False) in the beginning of the code :disappointed_relieved:

zh-shen avatar Sep 19 '23 10:09 zh-shen

Because in the code, due to parallel computing, I need to use some atomic operation like += (this is automatically carried out with atomic operation in Taichi), anything with atomic operation will reduce the precision to f32. So if we want to leverage the parallelization feature, we probably can only use f32, but if we don't need any atomic operation, yes, we can use f64. Taichi is designed for computing graphic applications initially, they only need f32 for most of the scenarios.

On Tue, 19 Sept 2023 at 11:55, zh-shen @.***> wrote:

but i get the same results evenif if write ti.init(default_ip=ti.i64,default_fp=ti.f64,arch=ti.cpu,kernel_profiler=False, print_ir=False) in the beginning of the code 😥

— Reply to this email directly, view it on GitHub https://github.com/yjhp1016/taichi_LBM3D/issues/20#issuecomment-1725276449, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJEDKQHTD7CNKHQE57QSJG3X3F23RANCNFSM6AAAAAA43UHCIA . You are receiving this because you commented.Message ID: @.***>

yjhp1016 avatar Sep 19 '23 11:09 yjhp1016

:sob:

zh-shen avatar Sep 19 '23 12:09 zh-shen

What's the main application of your study? There might be some other small bug in the code, I can't guarantee 100% accuracy, and that's why I share the whole code with the community, so anyone who can find an issue and would help to improve the quality of this code package. Any suggestion is appreciated :-)

On Tue, 19 Sept 2023 at 13:01, zh-shen @.***> wrote:

😭

— Reply to this email directly, view it on GitHub https://github.com/yjhp1016/taichi_LBM3D/issues/20#issuecomment-1725371470, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJEDKQG7SHYWSUZGURLELJTX3GCS3ANCNFSM6AAAAAA43UHCIA . You are receiving this because you commented.Message ID: @.***>

yjhp1016 avatar Sep 19 '23 12:09 yjhp1016

i want to calculate the permeability of a porous medium, so i need to validate the code first

zh-shen avatar Sep 19 '23 12:09 zh-shen

we measure the permeability of a porous medium in the expriment is 0.4mD, at present, we can't get satisfying simulation results from your code. I don't want to deep into the LBM, i just want to use it as a tool to get a simulation result, do you have any recommendations on reliable LBM codes? with best regards!

zh-shen avatar Sep 20 '23 03:09 zh-shen

You can try OpenLB or Palabos.

But you probably need to be pay attention to imaging and segmentation part, it brings a lot of uncertainty, especially for carbonate rock of which the pore sizes spans several orders of magnitude, one simulation won't be able to cover all pore scales, it's difficult to selexlct REV (representative element volume), you need to use multi scale simulation to cover different scale of pore sizes. This is a still on going research topic.

zh-shen @.***> 于 2023年9月20日周三 上午4:23写道:

we measure the permeability of a porous medium in the expriment is 0.4mD, at present, we can't get satisfying simulation results from your code. I don't want to deep into the LBM, i just want to use it as a tool to get a simulation result, do you have any recommendations on reliable LBM codes? with best regards!

— Reply to this email directly, view it on GitHub https://github.com/yjhp1016/taichi_LBM3D/issues/20#issuecomment-1726825147, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJEDKQFG44TR3G2LEKYE3H3X3JOT5ANCNFSM6AAAAAA43UHCIA . You are receiving this because you commented.Message ID: @.***>

yjhp1016 avatar Sep 20 '23 06:09 yjhp1016

thanks for your advice :smile:

zh-shen avatar Sep 20 '23 07:09 zh-shen

I will spend some time to check if there is still some improvement that can be done on the code side (maybe some tuning on MRT parameters can help to increase the model performance), but I'm working on other issues, and can only work on this project using my spare time. So can't guarantee when this can be done... :-) You can try these two LB packages for now, they are well developed and tested.

On Wed, 20 Sept 2023 at 08:13, zh-shen @.***> wrote:

thanks for your advice 😄

— Reply to this email directly, view it on GitHub https://github.com/yjhp1016/taichi_LBM3D/issues/20#issuecomment-1727104824, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJEDKQFXBIE4LFKSQIP7NWLX3KJRZANCNFSM6AAAAAA43UHCIA . You are receiving this because you commented.Message ID: @.***>

yjhp1016 avatar Sep 20 '23 09:09 yjhp1016

ok~

zh-shen avatar Sep 20 '23 09:09 zh-shen