yjhp1016 / taichi_LBM3D

A 3D sparse LBM solver implemented using Taichi
MIT License
283 stars 37 forks source link

A question #17

Open Vivia93 opened 1 year ago

Vivia93 commented 1 year ago

Dear author,

Hello. Thank you very much for publishing your work. I am greatly benefited from studying. In the post-processing stage, I have a question. When processing a group in Paraview, I chose the "rho" option, but the images in each step did not change. What is the reason for this? Is it a normal phenomenon?

I hope to receive your answer.

yjhp1016 commented 1 year ago

Hi, thanks for your interest. I think there are two things you can check:

  1. if you are using uniform bodyforce to drive the fluid and periodic boundary conditions, there might not be too much change on rho, especially for channel flow.

  2. you probably need to click rescale button in paraview to make sure the visualization range is reasonable for your data at different times. Initially the rho is uniform everywhere, but they might become not uniform after several time steps, now you need to click this rescale button to make visualization scale consistent to your "current data range". [image: image.png]

Thanks, if you have any questions, please let me know

On Mon, 7 Aug 2023 at 07:54, Vivia93 @.***> wrote:

Dear author,

Hello. Thank you very much for publishing your work. I am greatly benefited from studying. In the post-processing stage, I have a question. When processing a group in Paraview, I chose the "rho" option, but the images in each step did not change. What is the reason for this? Is it a normal phenomenon?

I hope to receive your answer.

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

Vivia93 commented 1 year ago

Hello,Dr.Yang,

Thank you very much for your answer. I have a question that I would like to ask. In the lbm_solver_3d_2phase.py file,I want to simulate gas (non wetting phase) entering water saturated rocks (wetting phase),but the code does not specify the density used to replace the fluid, so I only changed the viscosity of the fluid. From the simulation results, it can be seen that there is not much change in density. If possible, can we express the density used to drive the fluid? 5 40

yjhp1016 commented 1 year ago

Hi,

Please don't use density to define different phases, this LBM two phase code is a color gradient method, so we have another variable phi to represent the ratio of water/oil at every lattice. this phi is updated with a convection-diffusion equation, the velocity field is calculated using normal LBM, so there are two input file, in code lbm_solver_3d_2phase.py, find the line: solid_np, phase_np = init_geo('./img_ftb131.txt', './phase_ftb131.dat')

This is the line to define geometry, and initial water/oil distribution (phase_ftb131.dat, 1=water, -1=oil), more details can be found in paper attached with this email, this code actually is a Taichi implementation of this paper, please refer to this paper for more details.

On Mon, 28 Aug 2023 at 13:39, Vivia93 @.***> wrote:

Hello,Dr.Yang,

Thank you very much for your answer. I have a question that I would like to ask. In the lbm_solver_3d_2phase.py file,I want to simulate gas (non wetting phase) entering water saturated rocks (wetting phase),but the code does not specify the density used to replace the fluid, so I only changed the viscosity of the fluid. From the simulation results, it can be seen that there is not much change in density. If possible, can we express the density used to drive the fluid? [image: 5] https://user-images.githubusercontent.com/130535694/263704107-e18cb487-76a9-4dfd-ae0d-67c0f09b7bcd.jpg [image: 40] https://user-images.githubusercontent.com/130535694/263704142-2df4471c-c961-46ec-bce8-d30edeccd3c8.jpg

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

Vivia93 commented 1 year ago

Hello Dr. Yang,

Thank you for your answer. May I ask if it is possible to calculate the saturation of the water and gas phases in the lbm_solver_3d_2phase.py file, and then use this to calculate the relative permeability?

In the phase file, I defined 1 as the water phase and -1 as the gas phase.. You mentioned that psi represents the water/air ratio (the original code is water/oil). Can I use psi to calculate the relative permeability?

Looking forward to your reply.

yjhp1016 commented 1 year ago

Hi,

phi is a measure of water/oil ratio at each lattice. If you want to calculate saturation, you need to iterate all fluid lattice, count how many fluid lattices with phi>0 then use this number to divide total fluid lattice number, you will get the water saturation :-)

Jianhui

On Fri, 1 Sept 2023 at 10:47, Vivia93 @.***> wrote:

Hello Dr. Yang,

Thank you for your answer. May I ask if it is possible to calculate the saturation of the water and gas phases in the lbm_solver_3d_2phase.py file, and then use this to calculate the relative permeability?

In the phase file, I defined 1 as the water phase and -1 as the gas phase.. You mentioned that psi represents the water/air ratio (the original code is water/oil). Can I use psi to calculate the relative permeability?

Looking forward to your reply.

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

Vivia93 commented 1 year ago

Hello Dr. Yang, I calculated the saturation of the water and gas phases, but when I reached 200 steps, I suddenly encountered an error, and the output vtk file was also incorrect. May I ask what caused this issue?

1693643508(1) 1693643759(1) 1693643812(1) 1693644032(1) 1693644068(1)

yjhp1016 commented 1 year ago

Looks like there is something not quite feasible in simulation configuration... Can you visualize the distribution of initial air and gas? what are their viscosity? What's the bodyforce you're using to drive the fluid?

On Sat, 2 Sept 2023 at 09:42, Vivia93 @.***> wrote:

Hello Dr. Yang, I calculated the saturation of the water and gas phases, but when I reached 200 steps, I suddenly encountered an error, and the output vtk file was also incorrect. May I ask what caused this issue?

[image: 1693643508(1)] https://user-images.githubusercontent.com/130535694/265192516-ac2074d8-21de-4e3e-8eb4-d6c85ce37540.png [image: 1693643759(1)] https://user-images.githubusercontent.com/130535694/265192663-d7c062b2-95a2-4c1e-bc13-9e273234b11c.png [image: 1693643812(1)] https://user-images.githubusercontent.com/130535694/265192761-9a102276-bc81-4a48-a1b8-8497e5786cf3.png [image: 1693644032(1)] https://user-images.githubusercontent.com/130535694/265193114-b50fa352-2c35-4fcf-80b8-0fc370390258.png [image: 1693644068(1)] https://user-images.githubusercontent.com/130535694/265193129-8b08a239-6f56-48dd-a4bd-4a62810c9ac1.png

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

Vivia93 commented 1 year ago

I set the viscosity of air and water separately

niu_l = 0.001         #psi>0 niu_g = 0.000018         #psi<0

And I also set the phase. txt to represent the initial two-phase distribution, as my model is 150x150x150, the 150 points in the two-phase file I set are a group, with six points in one group being the gas phase and the other being the water phase.

I have not modified the bodyforce used to drive the fluid.

ext_f[None] = ti.Vector([fx,fy,fz])

叶落何翩翩 @.***

 

------------------ 原始邮件 ------------------ 发件人: "yjhp1016/taichi_LBM3D" @.>; 发送时间: 2023年9月2日(星期六) 下午4:46 @.>; @.**@.>; 主题: Re: [yjhp1016/taichi_LBM3D] A question (Issue #17)

Looks like there is something not quite feasible in simulation configuration... Can you visualize the distribution of initial air and gas? what are their viscosity? What's the bodyforce you're using to drive the fluid?

On Sat, 2 Sept 2023 at 09:42, Vivia93 @.***> wrote:

> Hello Dr. Yang, > I calculated the saturation of the water and gas phases, but when I > reached 200 steps, I suddenly encountered an error, and the output vtk file > was also incorrect. May I ask what caused this issue? > > [image: 1693643508(1)] > <https://user-images.githubusercontent.com/130535694/265192516-ac2074d8-21de-4e3e-8eb4-d6c85ce37540.png&gt; > [image: 1693643759(1)] > <https://user-images.githubusercontent.com/130535694/265192663-d7c062b2-95a2-4c1e-bc13-9e273234b11c.png&gt; > [image: 1693643812(1)] > <https://user-images.githubusercontent.com/130535694/265192761-9a102276-bc81-4a48-a1b8-8497e5786cf3.png&gt; > [image: 1693644032(1)] > <https://user-images.githubusercontent.com/130535694/265193114-b50fa352-2c35-4fcf-80b8-0fc370390258.png&gt; > [image: 1693644068(1)] > <https://user-images.githubusercontent.com/130535694/265193129-8b08a239-6f56-48dd-a4bd-4a62810c9ac1.png&gt; > > — > Reply to this email directly, view it on GitHub > <https://github.com/yjhp1016/taichi_LBM3D/issues/17#issuecomment-1703766774&gt;, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AJEDKQGX37CGWYR2CTVSKTLXYLWORANCNFSM6AAAAAA3GQ26VE&gt; > . > You are receiving this because you commented.Message ID: > @.***> >

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

yjhp1016 commented 1 year ago

Hi,

The reason is you're using too small viscosity. The fluid part of this two phase LBM is a normal MRT-LBM, I won't use any viscosity smaller than 0.01. And viscosity contrast between two phases will greatly impact the stability of your simulation. So I suggest you''re using same viscosity for two phrases and keep them larger than 0.01. If you're problem is capillary dominate (very low capillary number < 1e-4), this is fine, as the dominating force is capillary not viscous/inertia, but if your problem is inertia dominate (capillary number > 1e-3), you probably can't use this two phase LBM, you need to try some other approaches.

On Sat, 2 Sept 2023 at 10:04, Vivia93 @.***> wrote:

I set the viscosity of air and water separately

niu_l = 0.001         #psi>0 niu_g = 0.000018         #psi<0

And I also set the phase. txt to represent the initial two-phase distribution, as my model is 150x150x150, the 150 points in the two-phase file I set are a group, with six points in one group being the gas phase and the other being the water phase.

I have not modified the bodyforce used to drive the fluid.

ext_f[None] = ti.Vector([fx,fy,fz])

叶落何翩翩 @.***

 

------------------ 原始邮件 ------------------ 发件人: "yjhp1016/taichi_LBM3D" @.>; 发送时间: 2023年9月2日(星期六) 下午4:46 @.>; @.**@.>; 主题: Re: [yjhp1016/taichi_LBM3D] A question (Issue #17)

Looks like there is something not quite feasible in simulation configuration... Can you visualize the distribution of initial air and gas? what are their viscosity? What's the bodyforce you're using to drive the fluid?

On Sat, 2 Sept 2023 at 09:42, Vivia93 @.***> wrote:

> Hello Dr. Yang, > I calculated the saturation of the water and gas phases, but when I > reached 200 steps, I suddenly encountered an error, and the output vtk file > was also incorrect. May I ask what caused this issue? > > [image: 1693643508(1)] > < https://user-images.githubusercontent.com/130535694/265192516-ac2074d8-21de-4e3e-8eb4-d6c85ce37540.png&gt;

> [image: 1693643759(1)] > < https://user-images.githubusercontent.com/130535694/265192663-d7c062b2-95a2-4c1e-bc13-9e273234b11c.png&gt;

> [image: 1693643812(1)] > < https://user-images.githubusercontent.com/130535694/265192761-9a102276-bc81-4a48-a1b8-8497e5786cf3.png&gt;

> [image: 1693644032(1)] > < https://user-images.githubusercontent.com/130535694/265193114-b50fa352-2c35-4fcf-80b8-0fc370390258.png&gt;

> [image: 1693644068(1)] > < https://user-images.githubusercontent.com/130535694/265193129-8b08a239-6f56-48dd-a4bd-4a62810c9ac1.png&gt;

> > — > Reply to this email directly, view it on GitHub > < https://github.com/yjhp1016/taichi_LBM3D/issues/17#issuecomment-1703766774&gt;,

> or unsubscribe > < https://github.com/notifications/unsubscribe-auth/AJEDKQGX37CGWYR2CTVSKTLXYLWORANCNFSM6AAAAAA3GQ26VE&gt;

> . > You are receiving this because you commented.Message ID: > @.***> >

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

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

Vivia93 commented 1 year ago

Hello,Dr.Yang,

In the two-phase flow simulation, I found that you set CapA=0.005, and I reset this parameter to CapA=0.0005 during the simulation. I have noticed that the displacement speed has increased. Is there any basis or range for the value of CapA parameter?

yjhp1016 commented 1 year ago

Hu, this is what we expect. small CapA means smaller surface tension, also means smaller capillary force, so it's easier to push the interface. If we use a very big CapA, it will make numerical stability issue, so I will keep CapA between 0.0 - 0.1

Vivia93 @.***> 于 2023年9月25日周一 上午6:46写道:

Hello,Dr.Yang,

In the two-phase flow simulation, I found that you set CapA=0.005, and I reset this parameter to CapA=0.0005 during the simulation. I have noticed that the displacement speed has increased. Is there any basis or range for the value of CapA parameter?

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

renxiaosa00 commented 1 year ago

solid_np,phase_np = init_geo('./img_ftb131.txt' ,'./phase_ftb131.dat')这是定义几何形状和初始水/油分布的线(phase_ftb131.dat,1=水,-1=油)

您好,请问您是如何将数据转换为需要的solid_np,phase_np = init_geo('./img_ftb131.txt' ,'./phase_ftb131.dat')这是定义几何形状和初始水/油分布的线(phase_ftb131.dat,1=水,-1=油)这2个文件的呢?img_ftb131是先按照切片数为第一层循环,然后按照行为第二层循环,再按照列为第三层循环进行读取CT的数据嘛?同样的,phase_ftb131相分布数据,是同样的顺序,然后将第一个切片的像素为0的位置设置为1,其余位置是-1,其余切片不用设置1和-1嘛?

renxiaosa00 commented 1 year ago

img_ftb131和phase_ftb131的matlab生成如下:

clc;clear;close all; % 将二值化0和128的bmp转换为2D的imgftb300 % 将每一个CT大小的前6行赋值为1形成1D的phase_ftb300

ImgPath = "自己的路径" matFiles = dir(fullfile(ImgPath,'*.bmp')); imgftb300 = []; phase_ftb300 = []; phase_ftb300_i= ones(300, 300);% 数字自己决定大小 phase_ftb300_i(1:6,:) = -1;%原始测试数据是前6行

lens = size(matFiles); for i = 1 : lens dataRes = imread(fullfile(ImgPath,matFiles(i).name)); dataRes(dataRes == 128) = 255;%自己的数据是128,故替换为255 imgftb300(:,:,i) = dataRes; phase_ftb300(:,:,i) = phase_ftb300_i; imagesc(dataRes);

end

imgftb300_2D = reshape(imgftb300, 300300, 300); phase_ftb300_2D = reshape(phase_ftb300, 300300*300, 1); save('imgftb300.txt','imgftb300_2D','-ascii'); save('phase_ftb300.txt','phase_ftb300_2D','-ascii');

yjhp1016 commented 1 year ago

你好,solid_np 和 phase_np 都是按照一样的顺序组织的: 比如如果solid_np 是一个三维数组 那么文件image_ftb131.txt 里面的顺序是: for k in range(nz): for j in range(ny): for i in range(xn): print(solid_np[i,j,k])

同样的顺序也用于 phase_ftb131.dat 上。 区别就是在img_ftb131.txt 也就是Geometry 的定义中 0 = Void, 1 = Solid,

第二个文件phase_ftb131.dat 是定义初始的油水分布的, -1 = non-wetting phase, 1 = wetting phase, 对于solid 的位置,phase 可以随便写1 或者 -1

如果有不清楚的可以在问我 On Sun, 8 Oct 2023 at 02:59, renxiaosa00 @.***> wrote:

solid_np,phase_np = init_geo('./img_ftb131.txt' ,'./phase_ftb131.dat')这是定义几何形状和初始水/油分布的线(phase_ftb131.dat,1=水,-1=油)

您好,请问您是如何将数据转换为需要的solid_np,phase_np = init_geo('./img_ftb131.txt' ,'./phase_ftb131.dat')这是定义几何形状和初始水/油分布的线(phase_ftb131.dat,1=水,-1=油)这2个文件的呢?img_ftb131是先按照切片数为第一层循环,然后按照行为第二层循环,再按照列为第三层循环进行读取CT的数据嘛?同样的,phase_ftb131相分布数据,是同样的顺序,然后将第一个切片的像素为0的位置设置为1,其余位置是-1,其余切片不用设置1和-1嘛?

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

renxiaosa00 commented 1 year ago

杨博士您好, 我计算了水相和气相的饱和度,但是当我达到200步时,突然遇到错误,并且输出vtk文件也不正确。请问这个问题是什么原因造成的呢?

1693643508(1) 1693643759(1) 1693643812(1) 1693644032(1) 1693644068(1) What is the purpose of calculating the water lattices and saturations? This is to calculate these parameters whether it converges or not?

renxiaosa00 commented 1 year ago

看起来模拟配置中有些不太可行......你能可视化初始空气和气体的分布吗?它们的粘度是多少?您用来驱动流体的体力是多少? …… On Sat, 2 Sept 2023 at 09:42, Vivia93 @.> wrote: Hello Dr. Yang, I calculated the saturation of the water and gas phases, but when I reached 200 steps, I suddenly encountered an error, and the output vtk file was also incorrect. May I ask what caused this issue? [image: 1693643508(1)] https://user-images.githubusercontent.com/130535694/265192516-ac2074d8-21de-4e3e-8eb4-d6c85ce37540.png [image: 1693643759(1)] https://user-images.githubusercontent.com/130535694/265192663-d7c062b2-95a2-4c1e-bc13-9e273234b11c.png [image: 1693643812(1)] https://user-images.githubusercontent.com/130535694/265192761-9a102276-bc81-4a48-a1b8-8497e5786cf3.png [image: 1693644032(1)] https://user-images.githubusercontent.com/130535694/265193114-b50fa352-2c35-4fcf-80b8-0fc370390258.png [image: 1693644068(1)] https://user-images.githubusercontent.com/130535694/265193129-8b08a239-6f56-48dd-a4bd-4a62810c9ac1.png — Reply to this email directly, view it on GitHub <#17 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJEDKQGX37CGWYR2CTVSKTLXYLWORANCNFSM6AAAAAA3GQ26VE . You are receiving this because you commented.Message ID: @.>

我是为了计算二氧化碳进入水的过程,参数设置如下: nx,ny,nz = 150.150.150 fx,fy,fz = 5e-5, -2e-5, 0.0 niu_l = .05 niu_g = .2 psi_solid = .7 CapA = 0.0005 模拟了80w次,最终的流动结果如下: a0cb74f781882e4e7809375b9a13b93 裁剪一半后流动最终结果如下: 318ff071130e8618b5d85d10f2dd9a3 整个phase的流动状态是一个视频,没法上传,就是刚开始流动的时候,出口也有了二氧化碳的变化,比较奇怪,也不清楚这些是什么状态,需要根据观察什么状态修整参数。还有,打印哪些数值稳定的参数呢?因为目前就计算了4个,rho似乎也没什么变化,只有phase velocity 有变化,也没有压力参数

renxiaosa00 commented 1 year ago

我是计算二氧化碳进入水的两相流模拟过程,数据大小也是150150150

yjhp1016 commented 1 year ago

这个看上去应该是最后几步有发散的情况,应该是设置的有点问题,我用的粘度0.1 两相都一样,体力1e-3, 表面张力CapA 2e-3 周期边界加固定颜色边界,你试试看

renxiaosa00 @.***> 于 2023年10月18日周三 上午2:45写道:

杨博士您好, 我计算了水相和气相的饱和度,但是当我达到200步时,突然遇到错误,并且输出vtk文件也不正确。请问这个问题是什么原因造成的呢?

[image: 1693643508(1)] https://user-images.githubusercontent.com/130535694/265192516-ac2074d8-21de-4e3e-8eb4-d6c85ce37540.png [image: 1693643759(1)] https://user-images.githubusercontent.com/130535694/265192663-d7c062b2-95a2-4c1e-bc13-9e273234b11c.png [image: 1693643812(1)] https://user-images.githubusercontent.com/130535694/265192761-9a102276-bc81-4a48-a1b8-8497e5786cf3.png [image: 1693644032(1)] https://user-images.githubusercontent.com/130535694/265193114-b50fa352-2c35-4fcf-80b8-0fc370390258.png [image: 1693644068(1)] https://user-images.githubusercontent.com/130535694/265193129-8b08a239-6f56-48dd-a4bd-4a62810c9ac1.png What is the purpose of calculating the water lattices and saturations? This is to calculate these parameters whether it converges or not?

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

renxiaosa00 commented 1 year ago

好的,谢谢您! (1)“体力1e-3”指的是fx fy 嘛? (2)周期边界加固定颜色指的是边界条件的bcxr嘛?比如说以下图片的设置这块嘛 image

yjhp1016 commented 1 year ago

体力是指fx, 或者fy, 或者fz, 例子中我给fx fy 都加了力,是为了让诸如过程快一些,从多个方向都有流动,正常模拟实验状态的画,只用定义一个方向的f, 取决于你想从哪个方向注入

你上面给出的就是周期边界了,因为没有选取任何边界使用压力或者速度边界条件,默认就是周期

颜色边界是让某一个inlet, outlet 固定颜色,是再这里定义, 下面就是X 方向的左面定义为固定颜色,为non-wetting 相,也就是从periodic 流动回来的在这里会被重新定义为non-wetting, 也就是如果X_left是inlet, 我们这里只注入non-wetting bc_psi_x_left, psi_x_left = 1, -1.0 # boundary condition for phase-field: 0 = periodic, bc_psi_x_right, psi_x_right = 0, 1.0 # 1 = constant value on the boundary, value = -1.0 phase1 or 1.0 = phase 2 bc_psi_y_left, psi_y_left = 0, 1.0 bc_psi_y_right, psi_y_right = 0, 1.0 bc_psi_z_left, psi_z_left = 0, 1.0 bc_psi_z_right, psi_z_right = 0, 1.0

On Wed, 18 Oct 2023 at 08:36, renxiaosa00 @.***> wrote:

好的,谢谢您! (1)“体力1e-3”指的是fx fy 嘛? (2)周期边界加固定颜色指的是边界条件的bcxr嘛?比如说以下图片的设置这块嘛 [image: image] https://user-images.githubusercontent.com/36992106/276147806-a9d39b81-1364-42fa-8a33-5859f626a424.png

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

renxiaosa00 commented 1 year ago

您好,我按照您的建议设置参数如下: 28c9685189324582d4601d0fd80db2e 得到的phase结果迭代0时如下: 1b7af426cce19012a46d1e358200ccb 中间过程结果如下: ec23bfbe9bffb5a58edf3c2340dccb1 f6f46bdaae68d568177b887a8b0b5b7 最后的结果是: 735f793fa244416a55f167bb111ee0d

假设入口是二氧化碳蓝色,水是红色,但流动的时候,理论上应该是蓝色二氧化碳慢慢驱出红色水,但是这个怎么出现的是灰色的相呢?请问这个是我的结果计算错了嘛还是出现什么别的设置的问题了?最后谢谢老师,期待您的指导!

yjhp1016 commented 1 year ago

应该是你可视化的问题,不应该用counter, 用threshold,只画phi 小于零的就能看到,然后让geometry部分opacity 调成半透明就能看到了应该

renxiaosa00 @.***> 于 2023年10月24日周二 上午8:17写道:

您好,我按照您的建议设置参数如下: [image: 28c9685189324582d4601d0fd80db2e] https://user-images.githubusercontent.com/36992106/277577035-9c20265c-f098-471a-8ecf-6d337d7e08df.jpg 得到的phase结果迭代0时如下: [image: 1b7af426cce19012a46d1e358200ccb] https://user-images.githubusercontent.com/36992106/277577153-0a50c856-cfc5-4742-b490-935fe71e16c6.jpg 中间过程结果如下: [image: ec23bfbe9bffb5a58edf3c2340dccb1] https://user-images.githubusercontent.com/36992106/277577215-f16ea31a-51aa-4836-8af5-90c4d7a9f227.jpg [image: f6f46bdaae68d568177b887a8b0b5b7] https://user-images.githubusercontent.com/36992106/277577254-434b2728-8a5b-4ff8-9b22-2568cc87d907.jpg 最后的结果是: [image: 735f793fa244416a55f167bb111ee0d] https://user-images.githubusercontent.com/36992106/277577305-f24a3e4b-284f-421d-bbf0-d552278d729e.jpg

假设入口是二氧化碳蓝色,水是红色,但流动的时候,理论上应该是蓝色二氧化碳慢慢驱出红色水,但是这个怎么出现的是灰色的相呢?请问这个是我的结果计算错了嘛还是出现什么别的设置的问题了?最后谢谢老师,期待您的指导!

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

renxiaosa00 commented 1 year ago

68c876d5a933e36998707402bf6d24f c72a90993d5c5e31cd68c041ee047a1 我设置了threshold,但是好像选择的opacity不太对,只要这块不是1,图像就没了,似乎是没找对geometry部分opacity,请问这个是在哪里找到的呢?我搜的可视化方法基本上很少有这个介绍。

yjhp1016 commented 1 year ago

你的模拟结果看起来好像是可以的,你先不要可视化geometry, 你把trehsold 选只可视化<0 的部分(phi), opacity 选1 然后从file, 选择文件,再重新打开一个结果文件,选择geoemtry 标签,这时候你可以使用counter 来可视化geometry 的表面,然后对这个表面选opacity 0.5左右(你自己尝试一个合适的值),就能差不多可视化出来多孔介质里面流体流动情况了。这个属于paraview操作的小trick 的问题 😀

On Tue, 24 Oct 2023 at 09:18, renxiaosa00 @.***> wrote:

[image: 68c876d5a933e36998707402bf6d24f] https://user-images.githubusercontent.com/36992106/277593217-174787fc-4b10-45d7-ab2f-eb80b079795a.jpg [image: c72a90993d5c5e31cd68c041ee047a1] https://user-images.githubusercontent.com/36992106/277593255-43e15465-efab-492d-9af9-ccb655f040b6.jpg

我设置了threshold,但是好像选择的opacity不太对,只要这块不是1,图像就没了,似乎是没找对geometry部分opacity,请问这个是在哪里找到的呢?我搜的可视化方法基本上很少有这个介绍。

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

renxiaosa00 commented 1 year ago

好的,谢谢您的指导,我属实是第一次接触多相流,真是太感谢您的指导了!就是我的出口总是在刚开始迭代的时候就产生相的变化,按理说刚开始二氧化碳进入孔隙的时候左边入口才开始慢慢移动,右边出口不该出现二氧化碳的,但是无论我怎么尝试,刚开始进入二氧化碳时,出口总是有二氧化碳存在,之前也听您解释过这个原因,但是改参数总也不知道哪些值往哪些方向改,就有些不知所措了

yjhp1016 commented 1 year ago

应该是右边像左边一样也需要使用固定颜色边界,你试试看

renxiaosa00 @.***> 于 2023年10月25日周三 上午2:10写道:

好的,谢谢您的指导,我属实是第一次接触多相流,真是太感谢您的指导了!就是我的出口总是在刚开始迭代的时候就产生相的变化,按理说刚开始二氧化碳进入孔隙的时候左边入口才开始慢慢移动,右边出口不该出现二氧化碳的,但是无论我怎么尝试,刚开始进入二氧化碳时,出口总是有二氧化碳存在,之前也听您解释过这个原因,但是改参数总也不知道哪些值往哪些方向改,就有些不知所措了

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

renxiaosa00 commented 1 year ago

我的颜色边界采用的默认的代码: bc_psi_x_left, psi_x_left = 1, -1.0 bc_psi_x_right, psi_x_right = 0, 1.0 bc_psi_y_left, psi_y_left = 0, 1.0 bc_psi_y_right, psi_y_right = 0, 1.0 bc_psi_z_left, psi_z_left = 0, 1.0 bc_psi_z_right, psi_z_right = 0, 1.0 “右边像左边一样也需要使用固定颜色边界”指的是不是bc_psi_x_right, psi_x_right = 1, -1.0啊?这样就能跟左边的bc_psi_x_left, psi_x_left颜色边界一样了

yjhp1016 commented 1 year ago

把第二行改成1 1.0 意思是使用固定颜色边界,边界上的颜色固定为1.0

renxiaosa00 @.***> 于 2023年10月25日周三 上午8:03写道:

我的颜色边界采用的默认的代码: bc_psi_x_left, psi_x_left = 1, -1.0 bc_psi_x_right, psi_x_right = 0, 1.0 bc_psi_y_left, psi_y_left = 0, 1.0 bc_psi_y_right, psi_y_right = 0, 1.0 bc_psi_z_left, psi_z_left = 0, 1.0 bc_psi_z_right, psi_z_right = 0, 1.0 “右边像左边一样也需要使用固定颜色边界”指的是不是bc_psi_x_right, psi_x_right = 1, -1.0啊?这样就能跟左边的bc_psi_x_left, psi_x_left颜色边界一样了

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

renxiaosa00 commented 1 year ago

我看后面备注是 1 = constant value on the boundary, value = -1.0 phase1 or 1.0 = phase 2,那么是不是bc_psi_x_right, psi_x_right = 1, 2.0啊?毕竟刚开始的初始条件右边出口按理说得是phase 2-水,左边入口才是-1对应的二氧化碳吧?是不是变量我理解错了,比如bc_psi是设置颜色的,psi是设置别的什么参数的?其实我没太搞懂pis_x/y/z, psi_solid分别是什么意思。

yjhp1016 commented 1 year ago

颜色LBM 使用phi 来表示non-wetting phase 或者wetting phase, phi的值一般介于-1.0 到 1.0 之间,我们一般可以简单的认为小于零的就是non-wetting phase, 大于0的是wetting phase (也和接触角有关,接触角变了也可能这两个反过来)。我那里写的-1.0 = phase 1 意思就是-1.0 表示non wetting phase, 1.0 = phase 2 意思是1.0 表示phase 2 (wetting phase). 所以这里第二行改为1 1.0 意思就是右边使用颜色边界,边界上固定为phi = 1.0 (也就是wetting phase)

On Wed, 25 Oct 2023 at 08:40, renxiaosa00 @.***> wrote:

我看后面备注是 1 = constant value on the boundary, value = -1.0 phase1 or 1.0 = phase 2,那么是不是bc_psi_x_right, psi_x_right = 1, 2.0啊?毕竟刚开始的初始条件右边出口按理说得是phase 2-水,左边入口才是-1对应的二氧化碳吧?是不是变量我理解错了,比如bc_psi是设置颜色的,psi是设置别的什么参数的?其实我没太搞懂pis_x/y/z, psi_solid分别是什么意思。

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

renxiaosa00 commented 1 year ago

噢噢,好的,谢谢老师!

hangqqq commented 1 year ago

Hello, may I ask if this happens because the force of the setting is too large

f913dcad7c0fa90ad0c4e80c4908c9f 1698395857255 1698395881910
yjhp1016 commented 1 year ago

It looks like there are some parameters too tough for simulation. For example viscosity, surface tension, please check these parameters and re run simulation.

On Fri, 27 Oct 2023 at 09:38, hangqqq @.***> wrote:

Hello, may I ask if this happens because the force of the setting is too large [image: f913dcad7c0fa90ad0c4e80c4908c9f] https://user-images.githubusercontent.com/140054215/278585620-337891e8-b952-49af-9757-238b0a41e46d.png [image: 1698395857255] https://user-images.githubusercontent.com/140054215/278585885-a88a6e30-6531-473b-bf8b-6aa957407a87.png [image: 1698395881910] https://user-images.githubusercontent.com/140054215/278585995-dd69ff38-baee-47a3-9b19-e242bcc1b48e.png

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

hangqqq commented 1 year ago
1698648606301 1698648515606

I would like to ask what is the reason for this sudden decline and the results that come out later?

yjhp1016 commented 1 year ago

I think the simulation crashed at some point. I think your viscosity of liquid 0.05 is.too small for this simulation. try using same viscosity for both phase. And probably smaller force like 1e-3

hangqqq @.***> 于 2023年10月30日周一 上午6:52写道:

[image: 1698648606301] https://user-images.githubusercontent.com/140054215/278961736-3f28c9ee-f240-48c1-a767-a0710194c94a.png [image: 1698648515606] https://user-images.githubusercontent.com/140054215/278961804-3187f0ca-6289-4447-a520-5e78c4ac1d7a.png I would like to ask what is the reason for this sudden decline and the results that come out later?

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

hangqqq commented 1 year ago

Hello! I would like to ask, what is the unit of 'niu'?

yjhp1016 commented 1 year ago

It is in lattice unit, you need to convert it into a physical unit using dimensional analysis. This is a big subject, you need to read some references. For example: https://www.sciencedirect.com/science/article/pii/S001793101834835X

On Thu, 2 Nov 2023 at 07:47, hangqqq @.***> wrote:

Hello! I would like to ask, what is the unit of 'niu'?

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

renxiaosa00 commented 1 year ago

1698648606301 1698648515606 I would like to ask what is the reason for this sudden decline and the results that come out later?

How to generate the water saturation and air saturation?

yjhp1016 commented 1 year ago

It means your simulation didn't converged. This might due to two reasons:

  1. Try using same viscosity for both phases and keep them bigger than 0.1

  2. Your mesh resolution is too low, try using a better mesh

renxiaosa00 @.***> 于 2023年11月15日周三 上午6:52写道:

[image: 1698648606301] https://user-images.githubusercontent.com/140054215/278961736-3f28c9ee-f240-48c1-a767-a0710194c94a.png [image: 1698648515606] https://user-images.githubusercontent.com/140054215/278961804-3187f0ca-6289-4447-a520-5e78c4ac1d7a.png I would like to ask what is the reason for this sudden decline and the results that come out later?

How to generate the water saturation and air saturation?

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

renxiaosa00 commented 1 year ago

杨博士您好, 我计算了水相和气相的饱和度,但是当我达到200步时,突然遇到错误,并且输出vtk文件也不正确。请问这个问题是什么原因造成的呢? 1693643508(1) 1693643759(1) 1693643812(1) 1693644032(1) 1693644068(1) What is the purpose of calculating the water lattices and saturations? This is to calculate these parameters whether it converges or not?

How are water_lattices and total fluid lattices defined?

renxiaosa00 commented 1 year ago

water_lattices and total fluid lattices

您好,请问计算饱和度的时候,water_lattices and total_fluid_lattices是怎么定义的呢?我看python里面没有A[None] = int(count)的定义模式啊

renxiaosa00 commented 1 year ago

40bea3b184dd025e80ea7371255d6fb 我总是报这样的错误额,迭代前声明total_fluid_lattices={"None":1}也不对。

yjhp1016 commented 1 year ago

A[None] 这个不是python里面的变量定义方式,这个是Taichi里面定义的张量,如果这个张量就是一个单个的元素,就这么赋值或者读取。所以如果你需要把water_lattices 这种变量在Taichi scope里面使用,需要在最前面定义为Taichi scope的单变量张量,这样就能在Taichi scope里面使用了 (充分利用GPU 并行的便利)

On Tue, 28 Nov 2023 at 07:44, renxiaosa00 @.***> wrote:

40bea3b184dd025e80ea7371255d6fb.jpg (view on web) https://github.com/yjhp1016/taichi_LBM3D/assets/36992106/51ae8080-2423-4e4a-8465-7b62af8e4678 我总是报这样的错误额,迭代前声明total_fluid_lattices={"None":1}也不对。

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

renxiaosa00 commented 1 year ago

1cdcdf98b626e648ff4e3d1299f38dca 这是我定义的方式,结果不对额

yjhp1016 commented 1 year ago

Declares a 0D scalar field whose data type is f32

f_0d = ti.field(ti.f32, shape=()) # 0D field

On Wed, 29 Nov 2023 at 08:27, renxiaosa00 @.***> wrote:

1cdcdf98b626e648ff4e3d1299f38dca.JPG (view on web) https://github.com/yjhp1016/taichi_LBM3D/assets/36992106/677649ea-0210-4426-8f1e-050e64ba3ecb 这是我定义的方式,结果不对额

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

renxiaosa00 commented 1 year ago

嗯,我找到办法了,也尝试成功了,谢谢老师! ed0ba44f8cdd7ef9560dd64fc2487a53

renxiaosa00 commented 12 months ago

老师,成图这块,我是这么搞的,总感觉不对劲,您方便的话,可以看看我是哪块出问题了嘛?我想设置的是红色水,蓝色气,左边蓝色慢慢替换红色的 image image image image image

yjhp1016 commented 12 months ago

一般做可视化的时候只显示一个phase 外加半透明的geometry, 如果你水和气都想显示,那就可能得rescale一下可视化范围到-1,1 然后可能需要把两项弄的半透明,要不里面都挡住了什么都看不到。

另外气的粘度,密度比对LBM应该是很困难的,你可能只能做非常小雷诺数下的模拟,这样可以近似用和水一样的密度,粘度比也可以近似为1, 要不大粘度比数值上很不稳定一般来说

On Fri, 8 Dec 2023 at 09:19, renxiaosa00 @.***> wrote:

老师,成图这块,我是这么搞的,总感觉不对劲,您方便的话,可以看看我是哪块出问题了嘛?我想设置的是红色水,蓝色气,左边蓝色慢慢替换红色的 image.png (view on web) https://github.com/yjhp1016/taichi_LBM3D/assets/36992106/7eb1a81d-8889-471a-9bdf-1f60285a1a0c image.png (view on web) https://github.com/yjhp1016/taichi_LBM3D/assets/36992106/c2bbeda6-2068-4d5b-a973-8fa370d3049e image.png (view on web) https://github.com/yjhp1016/taichi_LBM3D/assets/36992106/bb1199d1-00ca-4ad7-ba9e-34f0320ccddd image.png (view on web) https://github.com/yjhp1016/taichi_LBM3D/assets/36992106/2cc37dde-b544-4a34-aedb-4bc0283420d7 image.png (view on web) https://github.com/yjhp1016/taichi_LBM3D/assets/36992106/9ef7f406-fc19-472f-ae3b-f06b7ad2e93b

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

renxiaosa00 commented 12 months ago

嗯,好的,可视化这块似乎是我的模拟出问题了,把骨架当做孔隙了,所以一直显示不对劲。我换了数据结构后,再次模拟的时候,niu_l niu_g都是0.1,然后改变fx fy capA,psi_solid后,二氧化碳饱和度总是出现突然上升,比如模拟一段时间后CO2饱和度是0.5,下一步直接就0.9了,请问这种是一般因为什么原因啊?

renxiaosa00 commented 12 months ago

image 这是我的孔隙结构,然后,设置niu_l = 0.1, niu_g = 0.1,psi_solid = 0.7, fx=5e-3 fy=-5e-3,CapA = 2e-3模拟结果CO2饱和度会突然饱和,改变capA分别为2e-2 or 2e-1,都会发生这样的突然饱和,这种情况在流动上显示的是,刚开始在孔隙流动,突然下一步就饱和了,这个一般是要怎么根据结构调整参数呢,我看psi_solid 范围是【-1,1】这个对应实际角度是怎么个换算关系呢?还有capA,fx,fy的实际应用范围是什么样呢?