CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

How to compute liquid volume of the NOT whole domain

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By gschaider

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 24, 2008, 23:17
Default Hi, I'd like to compute
  #1
Senior Member
 
shinji nakagawa
Join Date: Mar 2009
Location: Japan
Posts: 113
Blog Entries: 1
Rep Power: 18
snak is on a distinguished road
Hi,

I'd like to compute the liquid volume left in a restricted domain after an interFoam simulation. I'd like to know the liquid volume in the region of z < 1, for instance.

I have found the thread "How to compute total liquid volume of the whole domain?" related to my question.
http://www.cfd-online.com/OpenFOAM_D...tml?1184365098
The source code in the thread is quite impressive. However, I don't know how to limit the region with sum() function.

Would you please give some advice or drop a hint to me?
snak is offline   Reply With Quote

Old   March 25, 2008, 15:05
Default Hi You can iterate over the
  #2
Senior Member
 
Join Date: Mar 2009
Posts: 248
Rep Power: 18
jaswi is on a distinguished road
Hi

You can iterate over the cells in the domain while checking if cellcentre.z() < 1.0 and if the condition satisfies then add the liquid in that cell to your running sum.

hope that helps

Regards
Jaswi
jaswi is offline   Reply With Quote

Old   March 27, 2008, 23:53
Default Hi Jaswi Thank you very muc
  #3
Senior Member
 
shinji nakagawa
Join Date: Mar 2009
Location: Japan
Posts: 113
Blog Entries: 1
Rep Power: 18
snak is on a distinguished road
Hi Jaswi

Thank you very much for your advice.

I'm gonna try to write short code, though I have to learn a bit more about OpenFOAM source code.

Thanks,
snakagawa
snak is offline   Reply With Quote

Old   June 25, 2008, 00:19
Default Hi, I added the following s
  #4
Senior Member
 
shinji nakagawa
Join Date: Mar 2009
Location: Japan
Posts: 113
Blog Entries: 1
Rep Power: 18
snak is on a distinguished road
Hi,

I added the following short code to calculate liquid volume in the specified region.

----------------
Info << " Liquid (whole domain): " << sum(mesh.V()*gamma) << endl;

sumVol = 0;
forAll(mesh.cells(),cellI)
{
if( mesh.C()[cellI].component(0) >= validXmin
& mesh.C()[cellI].component(0) <= validXmax
& mesh.C()[cellI].component(1) >= validYmin
& mesh.C()[cellI].component(1) <= validYmax
& mesh.C()[cellI].component(2) >= validZmin
& mesh.C()[cellI].component(2) <= validZmax )
{sumVol = sumVol + mesh.V()[cellI]*gamma[cellI]; }
}
Info << " Liquid in specified region: " << sumVol << endl;
Info << endl;
----------------

It works fine for a single processor calculation.

With multi-processors, however, the calculated liquid volume in the specified region is not correct. Liquid volume in whole domain is correct. I think that my code have some problem in handling the coordinates in decomposed field.

Would you please give some advice to modify the code?

Thank you in advance,
snakagawa
snak is offline   Reply With Quote

Old   June 25, 2008, 08:34
Default A reduce(sumVol,plusOp
  #5
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
A
reduce(sumVol,plusOp<scalar>());
before the Info might solve that. Have a look elsewhere what it actually does.

Bernhard
ThorgrimmCFD likes this.
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider 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
How to calculate liquid volume as the interface moves for interFoam Solver asaha OpenFOAM Running, Solving & CFD 25 October 21, 2009 05:34
surfaces inside a volume (domain) Johannes CFX 1 December 22, 2008 11:17
Liquid phase volume fraction sega OpenFOAM Running, Solving & CFD 23 August 21, 2008 06:58
How to compute total liquid volume of the whole domain hsieh OpenFOAM Post-Processing 2 July 13, 2007 19:18
Compute volume Tony Main CFD Forum 1 October 2, 2001 18:39


All times are GMT -4. The time now is 16:42.