November 4, 2021, 16:14
|
Calculating bubble volume in rising bubble simulation
|
#1
|
Member
Venkat Ganesh
Join Date: May 2020
Location: Cincinnati, Ohio
Posts: 49
Rep Power: 6
|
I'm performing a rising bubble simulation and I'd like to calculate the bubble volume at each writeInterval. I went through some threads and programming guides and came up with a rough code. However I'm not sure how to implement that. I tried creating a function object from a copy of 'vorticity' and changed things around, but the compiler doesn't recognize mesh and alpha1 within the code. Can someone guide in this regard?
Also is there a way I can have the bubble volume written out in a separate text file/csv with just two columns containing time and bubble volume instead of writing it out within the time directory at each writeInterval?
Code:
scalar vol;
scalar vol_tot_air = 0.0;
scalar r_ori = 0.0007505;
scalar h_ori = 0.001;
scalar vol_ori = 3.14*r_ori*r_ori*h_ori;
forAll(mesh.C(), celli) //Loop through all cells
{
if (alpha1[celli] > 0.5)
{
vol = alpha1[celli]*mesh.V()[celli];
}
else
{
vol = 0;
}
vol_tot_air += vol;
}
scalar vol_final_air = 2*3.14*vol_tot_air;
scalar vol_bubble = vol_final_air - vol_ori;
|
|
|