CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Center of Gravity and Raise velocity of Bubble

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 14, 2017, 05:30
Default Center of Gravity and Raise velocity of Bubble
  #1
New Member
 
Rajesh
Join Date: Sep 2017
Location: Israel
Posts: 6
Rep Power: 8
Rajesh Nimmagadda is on a distinguished road
Hi Foamers,

I simulated raising bubble case proposed by Hysing et al. (http://www.karlin.mff.cuni.cz/~hron/...3/1934_ftp.pdf) in 2D using OpenFOAM 5.0. I would like to calculate the center of gravity as well as raise velocity of the bubble at different write time steps before getting on to my final time (t=3).

I tried to use swak4FOAM to do this. But my FOAM version is 5.0 and I couldn't find it compatible. I am using paraFOAM for post processing.

Help me out with some best possible way to calculate the C.G and raise velocity of bubble.

Thanks in advance.
Rajesh Nimmagadda is offline   Reply With Quote

Old   September 14, 2017, 08:00
Default
  #2
Senior Member
 
piu58's Avatar
 
Uwe Pilz
Join Date: Feb 2017
Location: Leipzig, Germany
Posts: 744
Rep Power: 15
piu58 is on a distinguished road
Because the region is rectangular you may calculate the center of gravity simply form the alpha values with any kind of programming language:
- read they in
- arrange it in rectangular form or get the line and row index from the vector
- calculate y (and if you want x) coordinates
- sum all the y coordinates and get the center of gravity

May be in the form (simple C)
Code:
	// parts in x and y
	int xParts=150;
	int yParts=2*xParts;
	
	int index=-1;
	double x,y;
	double sx=0; double sy=0;
	int countXy=0;
	int countBorder=0;
	// 1 is water, 0 is air.
	for (int i=0;i<yParts;i++) {
		for (int j=0; j<xParts;j++) {
			double m=content[index]; index++;
			if (index>anzahl) error("something is wrong");
			if (m<0.2) {		// Air
				x=(double)j/xParts;
				x=x-0.5/xParts;
				y=2.0*i/yParts;
				y=y+1.0/yParts; // corrction to the middle of an element
				sx+=x;sy+=y;countXy++;
			} // Air
			else if (m<0.99) { // was dazwischen
				countBorder++;
			}
		}
	}
	printf("AvgX: %lf AvgY: %lf\n Borderelements: %d", sx/countXy, sy/countXy, countBorder);
This piece of code additional counts the elements at the air water crossing which may be used to calculate circularity.
__________________
Uwe Pilz
--
Die der Hauptbewegung überlagerte Schwankungsbewegung ist in ihren Einzelheiten so hoffnungslos kompliziert, daß ihre theoretische Berechnung aussichtslos erscheint. (Hermann Schlichting, 1950)
piu58 is offline   Reply With Quote

Old   September 17, 2017, 07:11
Smile Resolved the problem
  #3
New Member
 
Rajesh
Join Date: Sep 2017
Location: Israel
Posts: 6
Rep Power: 8
Rajesh Nimmagadda is on a distinguished road
Thank you Uwe Pilz for your suggestion

I sorted out the problem. The volume fraction output file at each time step contains x-coordinate, y-coordinate and concentration values. These are utilized to calculate centroid and raise velocity of air bubble in water

By default, all the commercial solvers and open source codes will consider 0 volume fraction as complete air and 1 volume fraction as complete water. One can change these values in reverse before running the case (But be careful while assigning properties to the two fluids as this also need to be reversed).

Then get the output files and feed it into the self written code to calculate both the requirements.

One can also do this during run time with SWAKE4FOAM. But openFOAM 5.0 don't support it. There is one more option called Functional Object that can incorporated in the control dictionary which writes the required values at each time step. If any one is familiar with this then let me know. I would like to implement this.
Rajesh Nimmagadda is offline   Reply With Quote

Old   February 20, 2020, 21:53
Default
  #4
Senior Member
 
Nguyen Duy Trong
Join Date: Apr 2014
Posts: 124
Rep Power: 12
ndtrong is on a distinguished road
Quote:
Originally Posted by piu58 View Post
Because the region is rectangular you may calculate the center of gravity simply form the alpha values with any kind of programming language:
- read they in
- arrange it in rectangular form or get the line and row index from the vector
- calculate y (and if you want x) coordinates
- sum all the y coordinates and get the center of gravity

May be in the form (simple C)
Code:
	// parts in x and y
	int xParts=150;
	int yParts=2*xParts;
	
	int index=-1;
	double x,y;
	double sx=0; double sy=0;
	int countXy=0;
	int countBorder=0;
	// 1 is water, 0 is air.
	for (int i=0;i<yParts;i++) {
		for (int j=0; j<xParts;j++) {
			double m=content[index]; index++;
			if (index>anzahl) error("something is wrong");
			if (m<0.2) {		// Air
				x=(double)j/xParts;
				x=x-0.5/xParts;
				y=2.0*i/yParts;
				y=y+1.0/yParts; // corrction to the middle of an element
				sx+=x;sy+=y;countXy++;
			} // Air
			else if (m<0.99) { // was dazwischen
				countBorder++;
			}
		}
	}
	printf("AvgX: %lf AvgY: %lf\n Borderelements: %d", sx/countXy, sy/countXy, countBorder);
This piece of code additional counts the elements at the air water crossing which may be used to calculate circularity.
Dear Uwe

Could you please share more idea on how to compute circularity of bubble.
I am confusing on the way to compute it.

Thanks
ndtrong is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Center of Gravity and Raise velocity of Bubble Rajesh Nimmagadda OpenFOAM Post-Processing 0 September 14, 2017 05:17


All times are GMT -4. The time now is 12:21.